feat(substrate): bidirectional verified reconcile + docs/YAML polish#15
Merged
CodeWithJuber merged 1 commit intoJul 6, 2026
Merged
Conversation
Part A — the verified LLM layer becomes bidirectional (default on when FORGE_LLM=1, `llm.bidirectional` in source/substrate.json to disable). The model may now REDUCE caution as well as add it, but only within bounds and never past hard floors: - M2 gate (preflight.js): a verified reading can CLEAR a false ask (llm-cleared), not only add one — but never clears a task with no concrete anchor or one naming symbols/files the repo doesn't define (repo-grounding floor threaded from informationGap). Still bounded by ±band. - M1 routing (route.js): a RAISE stays free; a LOWER is bounded to one routingBand and never below signalFloor when the rubric detects algorithmic/architectural terms — so a distributed rate-limiter can't be talked down to the cheap tier. - Orchestrator (substrate.js): threads `bidirectional` + the band/floor config from substrate.json; surfaces it in llm.bidirectional and richer llm.provenance (llm-cleared / llm-tightened / llm-raised / llm-lowered). - Full test matrix: clear/never-clear (hard-underspecified, unresolved entity, vague), tighten, raise, bounded-lower, strong-signal floor, and bidirectional:false revert. Part B — docs & YAML polish (voice preserved): - Fixed stale source paths in ARCHITECTURE.md (source/AGENTS.md + source/rules/ → source/rules.json, substrate.json, mcp.json) in both the diagram and the tree. - Added archived-pre-Forge banners to every docs/legacy/*.md (the project's own report had requested this), pointing to the current docs; flagged historical TODOs. - Documented bidirectional reconcile + the llm.bidirectional knob in the substrate README (with a propose→verify→reconcile mermaid diagram), GUIDE, and CHANGELOG. - Added purpose comments to the YAML files that lacked one (FUNDING.yml, ci.yml). - Verified all 67 markdown files are relative-link clean. 192 tests pass; typecheck + Biome clean; behaviour byte-identical with FORGE_LLM unset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGZUYFdUb4EViXV5tRid19
CodeWithJuber
marked this pull request as ready for review
July 6, 2026 05:36
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Two follow-ups to the merged LLM-adjudication layer (#14).
Part A — the verified reconcile becomes bidirectional. Today the layer is one-directional: the M2 gate can only tighten (add an ask) and M1 routing can only raise a tier. In a live run that flipped a clearly-specified task to "ASK FIRST." Now a verified reading can also reduce caution — default-on when
FORGE_LLM=1, with hard safety rails (llm.bidirectional: falseinsource/substrate.jsonreverts to the conservative mode). Still "never blind": the model proposes, external checks gate every move.preflight.js) — can clear a false ask (llm-cleared), not only add one. Two floors the model can never override still force the ask: a task with no concrete anchor, or one naming symbols/files the repo doesn't define (repo-grounding, threaded frominformationGap). Still bounded ±band, so a genuinely vague task can't be lifted over the line.route.js) — a raise is free (spotting hidden complexity costs at most a bigger model); a lower is bounded to oneroutingBandand never belowsignalFloorwhen the rubric detects algorithmic/architectural terms, so a "distributed rate-limiter" can't be talked down to the cheap tier.substrate.js) — threadsbidirectional+ the band/floor config; surfacesllm.bidirectionaland a richer per-facultyllm.provenance(llm-cleared/llm-tightened/llm-raised/llm-lowered).Part B — docs & YAML polish (signature voice preserved):
ARCHITECTURE.md(source/AGENTS.md+source/rules/→ the realsource/rules.json,substrate.json,mcp.json) in both the diagram and the repo tree.docs/legacy/*.md(the project's own daily report had asked for exactly this), pointing to the current docs and flagging historical action items as superseded — no secrets touched.llm.bidirectionalknob in the substrateREADME(with a propose→verify→reconcile mermaid diagram),GUIDE, andCHANGELOG.FUNDING.yml,ci.yml).Checklist
npm testpasses (Node 18/20/22) — 192 tests (was 180; +12 for the new matrix)npm run checkpasses (Biome lint + format)feat:)CHANGELOG.mdupdated under## [Unreleased]Risk & rollback
FORGE_LLM=1; behaviour is byte-identical with the flag off. Every move is externally verified and fail-safe.llm.bidirectional: false(conservative mode), leaveFORGE_LLMunset (feature inert), or revert the commit. No migrations.Extra checks (tick if applicable)
npm run typecheckpassesVerification (end-to-end, real
claudeCLI)FORGE_LLM=1 forge route "add a small in-memory cache with get and set"→llm-loweredto Haiku with a reasoned tag (the rubric had bumped it to mid on the word "cache").bidirectional:falsereverting to raise-/tighten-only.🤖 Generated with Claude Code
https://claude.ai/code/session_01HGZUYFdUb4EViXV5tRid19
Generated by Claude Code