Skip to main content

Module bootstrap

Module bootstrap 

Source
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§

BootstrapResult
Aggregate result of a bootstrap run.
BootstrapTriple
A single bootstrap discovery before it becomes a Triple.
ScannedFile
Per-file scan summary returned to the MCP caller.

Constants§

KG_EMPTY_HINT
Hint string returned by kg_query when 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 root and extract triples.