Reconciliation
How reconciliation works
The reconciliation engine detects three scenarios:
1. Someone edits code
The engine detects that code has drifted from the spec and proposes spec and doc updates.
2. Someone edits spec
The engine propagates the spec change to code and documentation.
3. Conflict
Code says one thing, the spec says another. The engine surfaces the disagreement and the user decides which is correct.
The system is always propose-and-approve, never auto-sync. Both users and LLMs can edit everything; the spec is the tiebreaker.
Using reconciliation
After running notarai init, use the /notarai-reconcile slash command in Claude Code to trigger a reconciliation pass.
The skill is a thin orchestrator that delegates context assembly to the notarai export-context CLI command:
- Determines a baseline (from
.notarai/reconciliation_state.jsonif available, or asks for a base branch). - Runs
notarai export-context --all --base-branch <baseline> --format markdownto gather per-spec reconciliation blocks containing spec content and changed-file lists. - For small changesets (10 or fewer changed files), analyzes all specs inline. For larger changesets, spawns one parallel sub-agent per spec.
- Reads changed files, runs
git diffper file, and evaluates each behavior, constraint, and invariant against the changes. - Notes
appliescross-cutting specs anddependenciesrefs for ripple-effect analysis. - Produces a structured report (DRIFT / VIOLATED / UNSPECCED / STALE REF findings).
- Walks through findings interactively, proposing exact changes for approval.
- Calls
mark_reconciled(via MCP or CLI) to update the hash cache, then snapshots reconciliation state.
The MCP server is used for mark_reconciled and snapshot_state when available, with CLI fallbacks (notarai state snapshot) when it is not.
For non-Claude agents, run notarai export-context directly and paste the output into your agent’s prompt. See the CLI reference for details.
Automatic validation
After notarai init, spec files are validated automatically whenever Claude Code writes or edits a file in .notarai/. Invalid specs block the tool use with errors on stderr. Non-spec files are ignored silently.