Expand description
Knowledge-graph bootstrap helpers.
Why: Issue #60 — after palace_create, the knowledge graph (KG) sits at
zero triples and there is no auto-discovery path. Users have no idea
they’re supposed to call kg_assert manually before kg_query returns
anything useful. kg_bootstrap closes this gap by scanning well-known
project files (Cargo.toml, package.json, pyproject.toml, CLAUDE.md,
.git/config, go.mod) and seeding structured triples that describe the
project (language, version, source repo, etc.). It also seeds temporal
metadata (created_at, bootstrapped_at) so even an empty project at
least has something in the KG and a timestamp anchor for future queries.
What: scan_project (in scan) returns a flat list of triples; the public
async entry point bootstrap_palace resolves a palace handle, runs the
scanner, and asserts each tuple through the existing KnowledgeGraph::assert
path. Types and helpers live in types.
Test: Unit tests in scan pin each scanner against fixture directories;
kg_bootstrap is exercised end-to-end from the MCP tool surface in
tools.rs.
Structs§
- Bootstrap
Result - Aggregate result of a bootstrap run.
- Bootstrap
Triple - A single bootstrap discovery before it becomes a Triple.
- Scanned
File - Per-file scan summary returned to the MCP caller.
Constants§
- KG_
EMPTY_ HINT - Hint string returned by
kg_querywhen the palace KG is empty.
Functions§
- bootstrap_
palace - Run the bootstrap scan against a palace.
- is_
kg_ empty_ for_ subject - Convenience: count active triples across an entire palace.
- result_
to_ json - Helper: bubble up the bootstrap result as the MCP JSON envelope expects.
- scan_
project - Blocking scanner: walk well-known files under
rootand extract triples.