Local-first 🧠memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly 😴 dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.
Deterministic dependency facts - manifests the architect reads, Terraform seeds the pre-extractor emits, and a digest that honours reach
Status: draft (phase 1 spec review applied)
Author: release orchestrator (via feature-release-playbook)
Audience: implementation
Base: origin/main 400b20ea (v1.67.0), branch feat/manifest-dependency-facts
Problem statement
The architecture scanner (o2b brain architect) reads one file, the root package.json, takes only its dependencies key, and turns a malformed manifest into the same null as an absent one (src/core/brain/architect/scan.ts:297-318, catch { return null; } at :315-317). Python, Go and Rust projects get no dependency facts at all, a broken manifest is never reported, and the depends_on relation that the graph vocabulary already defines (src/core/graph/relation-vocab.ts:32) is never produced for the modules the scanner finds. Separately, the deterministic pre-extractor reports extracted: false for every Terraform file (src/core/brain/ingest/pre-extract.ts:81-92), and its import seeds pass URL credentials through verbatim. Finally, three remote readers of the compiled preference digest and two health surfaces still name records the caller cannot read at its reach, the residue the v1.67.0 release left recorded.
Premise verification (live source, 400b20ea)
Full evidence: the three reconnaissance reports of this wave (manifest facts, HCL family, reach left-overs). The orchestrator re-opened the anchors this design builds on: architect/generate.ts:1-40, 360-425, graph/frontmatter-relations.ts:1-55, search/indexer.ts:605-630, graph/relation-vocab.ts:25-40, vault.ts:121-122, ingest/pre-extract.ts:76-100, 248-258, 355-372, redactor.ts:505-535, 815-840, brain/active.ts:66-92, and ran the current CLI on a fixture (outputs in cli-output/expected-output.md).
Card A (package-manifest dependency graph) - partly false, narrowed and built as narrowed
- False as captured: "a partner-tool dependency graph with one canonical package node per package". Open Second Brain stores no code graph; the codegraph partner is read-only by contract and refuses to fabricate dependency edges (
src/core/partner/codegraph-report.ts:11-13). What is built is the narrowed scope: deterministic manifest facts in the architect scanner. - Confirmed: only the root
package.jsonand onlydependenciesare read (scan.ts:297-305);pyproject.toml,go.mod,Cargo.tomlare read nowhere in the architect module. - Confirmed: a malformed manifest is swallowed silently (
scan.ts:315-317) and then the project name falls back to the directory basename (:372). - Corrected: "the relation exists, so emitting it is wiring only". Typed edges enter the index only through frontmatter fields named after a relation (
frontmatter-relations.ts:43-55->indexer.ts:613-627,relation: edge.relation), and architect frontmatter is written once and never rewritten (generate.ts:33-35,planNotepasses the head only on creation). Emittingdepends_ontherefore needs a declared exception to the write-once contract (decision M1). - Corrected (task text): "Bun has no TOML parser".
Bun.TOML.parseexists in the CI-pinned Bun 1.4.0, is typed (bun-types/bun.d.ts:1059-1076) and throwsSyntaxErroron malformed input. No repo code uses it yet. - Reduced: "one canonical package node per package" becomes "one canonical name per dependency, deduplicated per ecosystem". External packages have no note in the vault and get none; a vault-global package directory would be a new write surface for no measured need.
Card B (Terraform/HCL dependency graph) - partly false, narrowed and built as narrowed
- False as captured: a tree-sitter HCL graph with attribute preservation and module-directory topology. That is partner-tool work; Open Second Brain stores no code graph.
- Confirmed: the pre-extractor supports
.ts .tsx .mts .cts .js .jsx .mjs .cjs .py .pyionly (pre-extract.ts:81-92); a fixture.tffile reportsunsupported source extension ".tf". - Corrected: "secret-named attribute values are redacted before anything leaves the extractor". The extractor imports no redactor and emits names only, never values, so there are no attribute values to redact. The value that does leave is a module
sourcestring, which can carry URL credentials. - Found and fixed (neutral): an import specifier that embeds URL credentials, for example
import x from "https://user:pass@host/m.js", is emitted verbatim as animportsseed today. The same URL-credential pass that protects a Terraformsourceis applied to every family's specifiers in this release. - Two traps confirmed in code: the dispatch is a two-way
if (language === "python") ... else parseTsJs(:251-255), so a third family would fall into the TS parser silently; andJS_FAMILY_EXTENSIONSis derived as "every language except python" (:98-100), so.tfwould become a TS relative-import target. Both are fixed by construction (decision H2).
Fold-in (v1.67.0 reach left-overs) - confirmed, folded as recommended
- Confirmed:
brain_context, theosb://preferences/activeresource andbrain_pre_compress_packserve the shared digest bytes (active.ts:217-235renders unscoped;context-tools.ts:395, 407-412;resources.ts:336-354;pre-compress-pack.ts:114, 177-191), so a private preference's principle reaches a remote caller. The visibility matrix already names two of them inSTILL_NAMED_AT_REMOTE(tests/mcp/visibility-matrix.test.ts:503-522). - Confirmed:
brain_healthfindings (health-tools.ts:307-311) and thebrain_doctorrepair plan and apply (health-tools.ts:121-135,diagnostics.ts:1283-1295) are bounded by the owner scope only. - Not folded, recorded: (d)
brain_statusaggregate counts, (e) the one-bit refusal of create and move onto a hidden path, (f) basename ambiguity counted over hidden pages. See "Out of scope". - Unverified, probed in task D4: whether
Brain/active.md,Brain/lessons.mdand the digest are indexed as ordinary pages and reachable through a remotebrain_search(DEFAULT_SKIP_FILESis onlyindex.md,log.md,vault.ts:122).
Scope
- A Node-safe shared manifest vocabulary: the project-detection file list (used by codegraph project detection) and the dependency-bearing subset with ecosystem tags. Replaces the private
CODE_MANIFESTSlist. - Manifest readers in the architect module for
package.json,pyproject.toml(PEP 621, Poetry),Cargo.tomlandgo.mod, with a closed per-manifest status vocabulary (read,malformed,unreadable,unsupported) registered in the vocabulary census.pom.xml,build.gradle,Gemfile,composer.jsonare detected and reportedunsupportedby name. - Root manifests and per-module manifests (at the detected module paths) read from the walk's path list; the overview's
dependenciesregion lists runtime dependencies per ecosystem, the manifests read and their statuses, and one count line per ecosystem for the groups not listed. - Inter-module dependency facts: a module whose manifest declares a runtime dependency on the manifest name of exactly one other module gets a
depends_onedge. Rendered as a newmodule-dependenciesregion (Mermaid, its own claim sentence) in the overview, as adependenciesregion on each module note, and as a generator-owneddepends_onfrontmatter key on module notes, which the indexer turns into typeddepends_onlinks. - An additive
manifestsfield in theo2b brain architect --jsonenvelope and one text line when a manifest was not read. - A Terraform family (
hcl,.tfand.tfvars) in the pre-extractor: block entities in Terraform address syntax,depends_onandreferencesedges, modulesourceas animportsseed. Names only. - URL credentials redacted in every import specifier the pre-extractor emits (all families).
- The active digest, the resource and the pre-compress pack treat a preference the caller cannot read at its reach as absent;
brain_healthfindings andbrain_doctorrepair do the same; the registry rows flip to covered. - Docs:
docs/how-it-works.md,docs/cli-reference.md,docs/mcp.md,docs/updating.md.
Out of scope
- A partner-tool dependency graph, package notes, a vault-global package directory, version-constraint facts, lockfile reading.
- Maven, Gradle, Bundler and Composer dependency reading (reported
unsupportedby name: no XML reader in the runtime, and Maven semantics such as parent POMs,dependencyManagementand property interpolation cannot be read honestly from one file). - Workspace member discovery (
package.json#workspaces, Cargo[workspace] members,go.work) and new module bases (crates/,cmd/,internal/).MODULE_BASESis unchanged, so no existing note path moves. - HCL:
.hclfiles (Terragrunt, Packer, Nomad, Vault policies,.terraform.lock.hcluse other block vocabularies),.tf.json, attribute values, nested blocks (lifecycle,dynamic,provisioner,connection) as entities, multi-linedepends_onlists and expressions, references inside heredocs or template files,for_each/countexpansion,moved/import/check/removedblocks,terraform {}settings andrequired_providers, resolution of a local modulesourceto a directory. Batch-plan admission of.tf(code files are not batch-planned today;.tsand.pyare not admitted either). - Left-overs (d), (e), (f) as product decisions:
- (d)
brain_statusdoctor and preference counts stay whole-layer aggregates: no path, title or body leaves, the v1.67.0 dispositions already accept aggregate counts, and a partial fix would still leave the stale-scan and review-queue aggregates, so the registry row stays excluded either way. - (e)
brain_create_noteand lifecycle move or rename onto a hidden existing path keep their refusal: any other answer either overwrites a page or reports a write that did not happen. Pinned bytests/mcp/note-write-reach.test.ts:99-104andtests/mcp/note-lifecycle-references-reach.test.ts:115-135. - (f) a hidden page sharing a basename with a moved note still turns the link rewrite ambiguous: counting only readable files would rewrite
[[Old]]to a link that is ambiguous for every reader who can see the hidden page.
- (d)
- CHANGELOG and the version bump (PR preparation), the OpenClaw bundle rebuild (integrator).
Chosen approach
Variant 2 of the consultant ("manifest registry, fact-bearing module edges, reach-rendered digest"), adjusted: one shared Node-safe vocabulary module, one readers module with a closed status vocabulary, the scanner composing them, the generator rendering regions plus one generator-owned frontmatter key; the pre-extractor gains an hcl family in its own module behind a typed switch, with one specifier step that runs the redactor's URL-credential pass for every family; the active digest is re-rendered for a remote reader only when something is withheld. The consultant's status vocabulary ok | malformed | unsupported is replaced by read | malformed | unreadable | unsupported because an unreadable file (permission, I/O) and a malformed one are different operator actions.
Design decisions
One vocabulary note: wherever this release names a dependency (architect manifests and Terraform seeds alike) it uses one canonical name per ecosystem: the name as the ecosystem defines identity (npm and Go as declared, PyPI normalised per PEP 503, a Cargo dependency renamed with package = resolved to the real crate name, a Terraform module by its module.<name> address). The manifest status vocabulary and the pre-extractor's extracted: false reason stay separate: they belong to different subsystems with different consumers.
Manifest facts (cards A, lanes A and B)
- M1 (D1) Typed
depends_onis emitted. Inter-module edges go into a generator-owned frontmatter keydepends_onon module notes, rewritten on every run. This is the third declared exception in thegenerate.tsheader list: the generator owns exactly that key, never touches any other frontmatter key, removes the key when a module has no edge, and writes it as a YAML block list of quoted wikilinks to the target module notes. An unchanged project rewrites identical bytes (the merge returns the input when the rendered key is equal), so the byte-identity guarantee still holds. Evidence: the indexer reads every page's frontmatter, including notes underBrain/projects/arch/, which is not a skipped directory (vault.ts:121), and pushes each relation field as a link withrelationset (indexer.ts:613-627);normalizeRelationTargetpeels"[[...]]"(frontmatter-relations.ts). Task B3 proves the round trip with an index test. External packages have no note and stay a rendered list. - M2 (D2)
module-mapstays containment-only. Module dependencies render in a separatemodule-dependenciesregion with its own claim sentence: edges are declared by manifests, not measured from imports. Themodule-mapclaim and its tests (architect-module-map.test.ts:4-9, 91, 137) stay true. On a new overview the region followsdependencies(both are dependency facts); on an existing overviewmergeRegionsappends a new region at document end (regions.ts:20-26), stated in the docs. - M3 (D3) Record, never throw.
MANIFEST_STATUS(read,malformed,unreadable,unsupported) follows the four-piece idiom and is registered inCENSUS. Amalformedorunreadablereading carries a location-freedetail(the parser's message, or the errno code) and its project-relative path. One bad manifest never aborts the run: the run fails closed only on vault corruption (RegionError), as today. - M4 (D4) TOML through
Bun.TOML.parse, insidesrc/core/brain/architect/only (not in the OpenClaw bundle).SyntaxErrormaps tomalformedwith its message.readCargoWorkspacein the partner module is left alone (different module, own tests). - M5 (D5)
pom.xml,build.gradle,Gemfile,composer.jsonare detected and reportedunsupportedby name with their ecosystem, no dependencies. - M6 (D6) One shared vocabulary.
src/core/project-manifests.tsholds the detection list and the dependency-bearing subset with ecosystem tags; it uses noBun.*API becausesrc/core/partner/codegraph.tsimports it and is bundled intoopenclaw/index.js. The detection set stays exactly the nine files of today, soisCodeProjectbehaves identically. - M7 (D7) Runtime dependencies are listed; other groups are counted. Listed: npm
dependencies; PEP 621project.dependenciesplus Poetrytool.poetry.dependenciesminuspython; Cargo[dependencies]plus[target.*.dependencies]; go.modrequireentries without// indirect. Counted on one line per ecosystem, not listed:dev(npmdevDependencies, Poetry dev groups, PEP 735dependency-groups, Cargodev-dependencies),build(Cargobuild-dependencies),optional(npmoptionalDependencies, PEP 621optional-dependencies),indirect(go.mod// indirect).peerDependenciesis counted aspeer. - M8 (D8) Per-module manifests are read at each detected module path from the walk's path list (no second traversal;
WalkStats.paths). Edge binding uses exactly-one matching (resolveUniqueMatch, the v1.63.0 binding rule): a declared name that matches two modules' manifest names binds nothing. Self-edges are dropped.MODULE_BASESis unchanged. - M9 (D9) All root manifests are read.
name,version,descriptioncome from the firstreadroot manifest in the fixed precedencepackage.json,pyproject.toml,Cargo.toml,go.mod(go: the module path is the name).facts.manifestkeeps today's shape and staysnullwhen no root manifest is read, so the flat-layout test (architect.test.ts:142) and every JS vault's project name are unchanged. - M10 Wording. "stdlib-only" is replaced by "built-in runtime only, no dependency" in
scan.ts, the help text,docs/how-it-works.mdanddocs/cli-reference.md. - M11 CLI envelope.
manifestsis always present in--json(a scan fact likemodule_paths, empty array when no manifest exists):[{ path, ecosystem, status, detail? }], sorted by path. Text mode adds one line only when some manifest is notread.
Terraform family (card B, lane C)
- H1 Language
hclfor.tfand.tfvarsonly;.hclkeeps the existing unsupported reason. - H2 Dispatch becomes an exhaustive
switchon the language with anevercheck;JS_FAMILY_EXTENSIONSfilters fortypescriptandjavascriptexplicitly. - H3 Seeds use Terraform address syntax. New entity kinds
resource(<type>.<name>),data(data.<type>.<name>),module(module.<name>),variable(var.<name>),output(output.<name>),provider(provider.<name>),locals(local.<name>, one per declared local). New edge kindsdepends_on(address to address, single-line lists) andreferences(block address to a citedvar.,local.,module.,data.address, or a bare<type>.<name>declared as a resource in the same file). A modulesourcebecomes animportsseed from the file path to the redacted source string, never withresolvedTo(a directory is not a file). - H4 Names only, never values.
.tfvarsyieldsvariableseeds for depth-0 assignment names only, which is where literal secrets live. - H5 A per-line scanner tracks brace depth outside quoted strings (with
\"escapes), heredoc terminators (<<EOF,<<-EOF) and#,//and/* */comments, so braces and text inside strings and heredocs never count. It lives insrc/core/brain/ingest/pre-extract-hcl.tsto keep the line-grammar module readable; it is the first stateful family in the module. - H6 URL credentials are redacted by exporting the redactor's existing URL-credential pass (
redactUrlCredentials,redactor.ts:524) and applying it in the one specifier step (importSeedand the HCLsource). The fullredactRawOutputis not used because its key-value passes would rewrite specifier text. - H7 Out-of-scope constructs are declared by name in the module comment and in
docs/cli-reference.md, as the JSX limits are today (pre-extract.ts:201-207).
Reach left-overs (lane D)
- L1 Read-time filter.
RenderActiveOptionsgainsreadable?: (rel: string) => booleanapplied to the active and recently-retired sets; counts and most-applied follow from the render. The shared write stays unscoped (active.ts:69-82). A remote reader re-renders only when at least one record is withheld, passing the on-diskgenerated_at; otherwise it serves the file bytes, so vaults with nothing withheld stay byte-identical (tests/mcp/brain-context.test.ts:168, 176-196). - L2 All three readers:
brain_context, theosb://preferences/activeresource (throughrequestView(ctx), which also brings the owner gate to the resource; stated in the docs as a behaviour change underowner_scope_delivery: fail), and thebrain_pre_compress_packhead and top-K walk. - L3
brain_healthcomposeseveryArtifactRefView(owner, reachView(vault, contextReach(ctx)))in place of the owner view; the verdict is refolded over the kept families as today. - L4
brain_doctorrepair filters doctor issues by the same composed view beforeplanRepair(vault, { issues }), so fixes, needs-review andunfixablecounts are all bounded and nothing withheld is written at remote reach. The issue-ref extraction used by the report branch is hoisted intodiagnostics.tsso both branches share it. - L5 Registry rows
brain_context,brain_pre_compress_pack,osb://preferences/active,brain_health,brain_doctorflip to covered;"brain_context","brain_pre_compress_pack","brain_doctor #2"leaveSTILL_NAMED_AT_REMOTE. Public wording extends the v1.67.0 phrasing: these tools now also "treat a page the caller cannot read at its reach as absent". - L6 Derived pages probe (D4). If
Brain/active.md,Brain/lessons.mdor the digest are indexed and a remotebrain_searchreturns a withheld preference's text through them, and the fix is at most two files (apply the same read-time rule to their chunks, or keep the derived files out of the index), it is included; otherwise the finding is recorded in this document's risks and in the PR.
File changes
New: src/core/project-manifests.ts, src/core/brain/architect/manifests.ts, src/core/brain/ingest/pre-extract-hcl.ts; tests tests/core/project-manifests.test.ts, tests/core/brain/architect-manifests.test.ts, tests/core/brain/architect-dependencies.test.ts, tests/core/brain/architect-depends-on.test.ts, tests/core/brain/ingest/pre-extract-hcl.test.ts, tests/mcp/active-digest-reach.test.ts, tests/mcp/health-repair-reach.test.ts.
Modified: src/core/partner/codegraph.ts, src/core/brain/architect/scan.ts, src/core/brain/architect/generate.ts, src/cli/brain/verbs/architect.ts, src/cli/brain/help-text.ts, src/core/brain/ingest/pre-extract.ts, src/core/redactor.ts, src/mcp/brain/ingest-tools.ts, src/cli/brain/verbs/pre-extract.ts, src/cli/command-manifest.ts, src/core/brain/active.ts, src/mcp/brain/context-tools.ts, src/mcp/resources.ts, src/core/brain/pre-compress-pack.ts, src/mcp/brain/pack-tools.ts, src/mcp/brain/health-tools.ts, src/core/brain/diagnostics.ts, src/core/search/visibility-surface-registry.ts, and the tests and docs listed under "File ownership" in plan.md. Exact ownership per lane is in plan.md.
Bundled modules: src/core/partner/codegraph.ts and the new src/core/project-manifests.ts (lane A) enter openclaw/index.js; the architect and the pre-extractor are not bundled. The integrator rebuilds the bundle once after all lanes.
Risks and open questions
- Existing overviews gain
module-dependenciesat document end, and module notes gain adependenciesregion at document end, once (expectedupdatedon the first run after upgrade). - The generator-owned
depends_onkey overwrites any value an operator typed under that key on a module note; documented in the header exception and indocs/how-it-works.md. Bun.TOML.parseis a runtime built-in; if a future build bundles the architect for Node, the readers must move behind a runtime check. The readers module states this in its header.- PEP 508 name extraction is a prefix rule (up to the first of
[ ( < > = ! ~ ; @or whitespace); exotic direct references are named by that prefix only. - The HCL scanner is a line grammar: a block header split across lines is not seen. Declared by name.
- Derived-page indexing (L6), verified by task D4: the compiled digest pages (
Brain/active.md,Brain/lessons.md) are ordinary pages to the index. This release withholds them from generic page readers below local reach in the shared reach predicate (isPathReadableAtReach, with the pages named once inBRAIN_COMPILED_DIGEST_RELS); the dedicated readers (brain_context, theosb://preferences/activeresource,brain_pre_compress_pack,osb://lessons,brain_briefview=digestandview=morning,osb://digest/latest) serve a per-reader render instead. Local reach and the index are unchanged; the D4 test is an A/B between local and remote reach. The count views and the status counts remain registered as excluded readers. - Manifest input is untrusted text from a cloned repository. A name that is not a plausible package name is counted as
unrepresentableand never written; head fields are folded to one line with[[escaped; a parser failure is recorded with a fixed reason, never the parser's message; a nesting depth the parser cannot hold ismalformed(nesting too deep); a manifest larger thanMANIFEST_MAX_BYTESor not a regular file isunreadable. None of these aborts the run.