Skip to content

tools: ADR allocator (new-adr) + doc-ref drift lint (check-doc-refs)#5

Merged
cambios-agent[bot] merged 1 commit into
mainfrom
chore/anti-hallucination-tooling
Jun 9, 2026
Merged

tools: ADR allocator (new-adr) + doc-ref drift lint (check-doc-refs)#5
cambios-agent[bot] merged 1 commit into
mainfrom
chore/anti-hallucination-tooling

Conversation

@cambios-agent

@cambios-agent cambios-agent Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Anti-hallucination tooling from the agentic-flow guardrail discussion: replace "deduce a value and trust the model" with "allocate / verify via a tool." Built + committed from an isolated git worktree (the parallel-session contention lesson, applied).

make new-adr TITLE="..." - allocates the next ADR number from the actual docs/adr/*.md files (max + 1) and scaffolds the file, so the number is never eyeballed. (This is the failure mode that nearly produced a duplicate ADR-036 in a workflow output.) The duplicate-number guard already exists in check-adrs.py; this removes the manual step that fed it.

make check-doc-refs - verifies doc source-line refs resolve to live code: every [path#LNN] link must hit an existing file with >= NN lines, and an ASSUMPTIONS.md row naming a backtick SYMBOL must have that symbol within +-1 of the cited line. Catches the HD-01 class (a ref drifting off its const). On first run it found 46 genuinely-stale source-line refs in ASSUMPTIONS.md (e.g. MAX_TASKS cited :157, actually :214) - baselined per the don't-grow idiom; the bulk re-sync is a queued follow-up the tool will verify.

Why: CI proves code builds/tests; it does not read prose. The hands-off doc lane (auto-merged) is exactly where a hallucinated number or citation could land unreviewed. check-doc-refs is the machine check that closes that gap.

Out of scope (follow-ups): wiring check-doc-refs into ci.yml; the 46-ref bulk re-sync; the adversarial-verify harness stage.

Touches tools/ + Makefile (owned) -> needs your code-owner review.

🤖 Generated with Claude Code

What: two anti-hallucination tools from the agentic-flow guardrail discussion,
replacing "deduce a value and trust the model" with "allocate / verify via a tool":
  - `make new-adr TITLE="..."` allocates the next ADR number from the actual
    docs/adr/*.md files (max + 1) and scaffolds the file, so the number is never
    eyeballed (the failure that nearly produced a duplicate ADR-036). The
    duplicate-number guard already lives in check-adrs.py; this removes the manual
    step that fed it.
  - `make check-doc-refs` verifies source line-refs in docs resolve to live code:
    every [path#LNN] link must point at an existing file with >= NN lines, and an
    ASSUMPTIONS.md row naming a backtick `SYMBOL` must have that symbol within +-1
    of the cited line. Catches the HD-01 class (a ref drifting off its const). On
    first run it found 46 genuinely-stale source-line refs in ASSUMPTIONS.md (e.g.
    MAX_TASKS cited :157, actually :214) -- baselined per the don't-grow idiom; the
    bulk re-sync is a follow-up the tool will verify.
  - Makefile: new-adr / check-doc-refs / update-doc-refs-baseline targets + .PHONY.

Why: CI is an oracle for "does it build / test / prove", not "is this prose claim
true". The hands-off doc lane (auto-merged; CI cannot read prose) is exactly where
a hallucinated number or citation could land unreviewed. check-doc-refs is the
machine check that closes that for source-line refs.

Out of scope (follow-ups): wiring check-doc-refs into ci.yml as a blocking gate
(.github/, separate change); the 46-ref ASSUMPTIONS.md bulk re-sync; the
adversarial-verify harness stage (non-repo workflow change).

Verification: make check-doc-refs clean (46 baseline, 0 new); make new-adr
allocates the next number + guards empty TITLE; make check-adrs OK (no duplicate);
Makefile parses (targets resolve). No kernel code touched; CI runs the tri-arch
gate on the PR.

Staged files:
  Makefile
  tools/check-doc-refs-baseline.txt
  tools/check-doc-refs.py
  tools/new-adr.py

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cambios-agent cambios-agent Bot requested a review from riccajason as a code owner June 9, 2026 17:32
@cambios-agent cambios-agent Bot enabled auto-merge (squash) June 9, 2026 17:32

@riccajason riccajason left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct

@cambios-agent cambios-agent Bot merged commit 8a01c8a into main Jun 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant