feat: the end-to-end reliability layer — completion gate, session state, docs sweep, intent routing#47
Merged
Conversation
CI workflows (.github is now walked), manifests, and Dockerfiles become config: nodes with references edges to the code paths they name — a code change now lists the configs it can break. Lockfiles stay out (generated churn). RULES/DOC_EXTS/CODE_EXTS/CONFIG_* are exported as the ONE classification registry the completion gate and docs sweep reuse. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
…ions handoff rewrites .forge/state.md (bounded ≤150 lines: goal/phase, criteria, done, next, gotchas, recorded assumptions, in-progress git files) — snapshot semantics, injected at every session start so the next session resumes instead of re-assuming. decide appends ADR-lite D-#### entries to .forge/decisions.md (log semantics — supersede, never edit) and mints a machine-readable decision ledger twin. Both refuse secrets at write. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
SessionStart records HEAD once per session (.forge/sessions/<sid>.base — a resume never moves the anchor), prunes week-old session artifacts, and the rehydration block carries recent commits + uncommitted changes so a fresh session orients on evidence. sessionPath() becomes the one naming rule for every per-session artifact (log, baseline, marker, intent). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
docs check reconciles registries; docs sync answers the diff-shaped question: changed identifiers (paths + definitions + called symbols, from added AND removed lines, via the same RULES grammars the atlas parses) swept against every doc artifact → UPDATED / STALE (file:line hits) / VERIFIED-UNAFFECTED with the reason recorded. Advisory by default, --strict for CI, --base <ref> to widen. CHANGELOG + decisions.md exempt (append-only history). Symbols come only from non-test code files and only code-shaped names scan — dogfooding on this very branch caught the prose-parenthesis false-positive class. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
A synchronous Stop guard (the detached cortex.sh stop can never answer) blocks a session ONCE when code changed since the session baseline but no doc or state artifact moved with it — the reason IS the repair checklist (forge docs sync / handoff / decide + CUSUM drift alarm). Loop-safe (stop_hook_active + once-per-session marker), fail-open on every error path, FORGE_STOPGATE=0 kill switch. Classification derives from the atlas registries + shared isTestFile — no parallel regex lists. state.md is gitignored, so its signal is mtime-vs-baseline. Registered in both hook manifests (plugin + init template, lockstep-tested). Also fixes cortex.sh entry resolution in symlink installs: ~/.forge/src/… pointed at the nonexistent global/src/, silently no-opping every cortex hook outside plugin mode — both shims now resolve through the symlink (pwd -P), same as secret-redact.sh. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
The prompt is classified by the same math as model routing — a labeled bank (English + Hinglish rows) under overlap similarity with a confidence gate. Work intents (bugfix/feature/refactor/release) inject a ~6-line protocol card once per run of that intent; questions get no ceremony, below-confidence prompts get nothing. intentGrams deliberately differs from route's contentGrams: generic task verbs are complexity noise but exactly the intent signal — same math, different stop-set data. FORGE_INTENT=0 kill switch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
Preflight now RECORDS what it only displayed: once a goal is anchored, every prompt appends its graded driftScore to the session log (cusum — until now test-only math — accumulates the series and a sustained alarm rides the gate's block reason); proceeding under assumptions appends a record the advisory names and the next handoff surfaces. A guess can never silently become a fact. Hook entrypoint gains the stop-gate mode and the session-start baseline + snapshot + rehydration injection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
source/rules.json gains an end-to-end section (Definition of Done, no silent assumptions, decision log) that forge sync compiles into every tool. New skills — handoff, sync-docs, catchup — teach the workflow; the doc-sync crew agent repairs stale docs in its own context (never code) and joins the plugin agents list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
CLI dispatch + command registry for handoff/decide/docs-sync; README command rows + feature bullet; GUIDE sections (handoff, decide, docs sync, the completion-gate decision table, env rows FORGE_STOPGATE + FORGE_INTENT); ARCHITECTURE §5 (the reliability layer, incl. the deliberate checkpointCadence deferral); CHANGELOG [Unreleased] entries; CLAUDE.md test count. forge docs check passes on this tree. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
…erified defects Gate: the changed set is now SESSION-SCOPED — files from commits with committer time >= session start plus worktree changes minus the dirt snapshotted at SessionStart — so pre-existing edits, branch switches, and git pulls are never pinned on the agent (three demonstrated false-block classes). All git parsing moved to -z NUL output (C-quoted unicode/space/ arrow paths classified correctly). The block-once marker is written BEFORE blocking and an unwritable marker stands down instead of nagging every turn; a missing session_id disables gating (no shared 'default' state); SessionStart prunes BEFORE anchoring so a >7-day resume re-anchors instead of losing its baseline; vendor trees never enter the changed set. Memory: readState no longer truncates at a '<!--' inside snapshot rows (only the exact provenance line is stripped); forge decide takes an atomic mkdir lock so concurrent appends can't mint duplicate D-#### ids or interleave headers, and a failed append reports instead of half-succeeds; recorded assumptions dedupe and cap before entering the bounded snapshot. Docs sweep: .forge/state.md left the scanned set (handoff writes changed paths into it by design — scanning it was an unfixable self-reference); docs touched in the diff still answer for REMOVED symbols (the rename case); all-lowercase symbols count only inside backtick code spans; an unknown --base errors instead of silently diffing the index. Every fix carries a regression test (605 total, 0 failures). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
…ystem-setup-p26ka5
…r merge The v0.9.0 rotation on master renamed the [Unreleased] header this branch's entries sat under, so the textual merge filed unshipped work as released. Moved this branch's Added/Fixed entries back under [Unreleased]; [0.9.0] now lists exactly what the tag shipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
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
Implements the uploaded end-to-end reliability framework (claude-e2e-kit + FRAMEWORK/RESEARCH docs) natively in forgekit — every mechanism as a first-class feature, following forgekit idioms and math, so
forge initand the plugin deliver the whole system to downstream repos. Kills the two failure modes the framework formalizes: partial work (code changes without the artifacts that depend on it) and session amnesia (the next session re-assumes what this one knew).src/gate.js+ a synchronouscompletion-gate.shguard: when a session tries to finish having changed code since its git baseline with no doc or state artifact moved, the stop is blocked once, with the repair checklist as the reason. Loop-safe (stop_hook_active+ once-per-session marker), fail-open on every error path,FORGE_STOPGATE=0kill switch. Classification derives from the atlas registries + the shared test-file predicate — no parallel regex lists. Full decision-table test matrix.forge handoff— bounded session snapshot (.forge/state.md, rewritten ≤150 lines) re-injected at every session start;forge decide— append-only ADR-lite decision log + machine-readable ledger twin.HEADbaseline (resume never moves it), prunes week-old session artifacts, and injects the snapshot + last 10 commits + uncommitted changes.forge docs sync— the diff-driven docs sweep: changed identifiers (added AND removed lines) scanned against every doc artifact → UPDATED / STALE (file:line hits) / VERIFIED-UNAFFECTED with the reason recorded. Dogfooded on this very branch — which caught and fixed a prose-parenthesis false-positive class.FORGE_INTENT=0kill switch.forge impactlists the configs a change can break.end-to-endrules section compiled to every tool byforge sync;handoff/sync-docs/catchupskills;doc-synccrew agent.cortex.shentry resolution silently no-opped every cortex hook in symlink (non-plugin) installs; both shims now resolve through the symlink (pwd -P).Checklist
npm testpasses (Node 18/20/22) — 594 tests, 592 pass / 2 skipped, 49 newnpm run checkpasses (Biome lint + format)feat:/fix:/docs:…)CHANGELOG.mdupdated under## [Unreleased]forge substrate,forge impact, router/gate, or MCP substrate tools — GUIDE (gate decision table, three new command sections, env rows), ARCHITECTURE §5, README;forge docs checkpasses on this treeRisk & rollback
stop_hook_activeloop protection, fail-open on every error path (garbage stdin / no git / missing baseline / internal errors all allow — each has a test),FORGE_STOPGATE=0kill switch, test-only changes never block.FORGE_STOPGATE=0/ remove thecompletion-gate.shentry from the Stop arrays ofhooks/hooks.json+global/settings.template.jsonto disable just the gate.Extra checks (tick if applicable)
npm run typecheckpasses🤖 Generated with Claude Code
https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
Generated by Claude Code