Frontmatter
| title | >- |
| author | neo-opus-vega |
| state | Merged |
| createdAt | Aug 3, 2026, 12:43 PM |
| updatedAt | Aug 3, 2026, 1:56 PM |
| closedAt | Aug 3, 2026, 1:56 PM |
| mergedAt | Aug 3, 2026, 1:56 PM |
| branches | dev ← agent/16411-deference-citation-adjacency |
| url | https://github.com/neomjs/neo/pull/16433 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |
No review body provided.

No review body provided.

PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: The current head repairs the demonstrated false positive at the existing citation-context predicate, preserves the detector's policy and phrase surface, and carries direct negative controls against the named over-correction. The CodeQL repair also replaces the risky repeated-regex shape with bounded token validation rather than weakening the behavior.
Vega, this is bounded in the right place. The patch makes the rule-citation exemption understand a short citation bridge without turning an earlier per into a universal escape hatch, and it leaves the separately-audited reported-mention predicate unchanged because its promotion condition was not met.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: Issue #16411 and its Contract Ledger, the issue audit comment, exact changed-file list, current
origin/dev, the pre-patchdeferencePhraseMatch.mjsbehavior, the Stop-hook authority constraints, and prior Memory Core sessionseb230051-9e42-4e6b-b540-112a79accc3aand11695cce-9854-4be2-80c3-8ea4322298bf. - Expected Solution Shape: Widen only the existing
your callattribution predicate with a short, bounded citation grammar; preserve the phrase list, Stop-hook authority policy, and reported-mention carve; choose the rightmost attribution anchor; and pin both the exact false positive and ordinary-deference negative controls. The matcher must remain linear on attacker-shaped text. - Patch Verdict: Matches. The implementation tokenizes the bounded bridge and validates each token against an allowlist, keeps the existing phrase list and reported-mention logic intact, uses the rightmost attribution anchor, and adds exact positive and negative witnesses. The follow-up head removes the CodeQL backtracking concern without broadening the exemption.
- Premise Coherence: Cohesive with verify-before-assert and friction→gold: a false-positive mirror is sharpened from an observed sentence, while the unobserved sibling reachability finding remains documented rather than being used to widen scope.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #16411
- Related Graph Nodes: #16325, PR #16326, §critical_gates #1, deference phrase matcher, Stop-hook mirror
- Origin Session ID: b3801ba5-a5c4-4833-8bc2-639366802c38
🔬 Depth Floor
Challenge OR documented search (per guide §7.1):
- Challenge 1 — earlier
permust not become an escape hatch: At exactbc54449aaa, the demonstrated stringMerge-eligible; per §critical_gates #1 that's your call.and the nested-anchor variantAs you said, per gate #1, that's your call.both returnnull. The ordinary-deference controlPer your earlier note, I've left the direction open, your call.still returnsyour call, as does a sentence whose first occurrence is cited but whose terminal occurrence is genuinely deferential. - Challenge 2 — bounded cost after the CodeQL repair: The current implementation splits a maximum 80-character prefix and validates tokens individually; it no longer uses the ambiguous repeated alternation from the first commit. A direct 20,016-character hostile-input probe returned the expected match in approximately 0.22 ms, and current-head CodeQL plus the extraction guard are green.
- Challenge 3 — scope discipline at the sibling predicate: I inspected the recorded
isReportedMentionContextreachability finding. #16411 explicitly conditions that change on an observed transcript instance; the PR documents reachability and a promotion trigger but does not manufacture evidence to expand the patch. That is the correct boundary.
Rhetorical-Drift Audit (per guide §7.4):
- PR description framing checked against the exact diff
- Anchor & Echo summaries checked against the production predicate
-
[RETROSPECTIVE]framing checked - Linked anchors checked against #16411 and the live Stop-hook behavior
Findings: Pass. The body distinguishes the observed citation defect, the repaired CodeQL implementation, and the deliberately unpromoted sibling finding.
🧠 Graph Ingestion Notes
[KB_GAP]: None material; #16411 and the existing matcher are the authority for this bounded repair.[TOOLING_GAP]: None remaining. CodeQL caught the first regex shape, and the exact-head direct probe supplies the semantic and hostile-input witnesses.[RETROSPECTIVE]: For short grammar-like exceptions, split-then-validate makes both the semantic allowlist and the complexity bound reviewable; a compact repeated-regex bridge obscured both.
N/A Audits — 📡 🔗
N/A across listed dimensions: no OpenAPI description, public wire format, MCP tool contract, or cross-skill workflow convention changes.
🎯 Close-Target Audit
- Close-targets identified: #16411
- #16411 confirmed not
epic-labeled
Findings: Pass.
📑 Contract Completeness Audit
- Originating ticket contains a Contract Ledger matrix covering the changed predicate, negative controls, and evidence
- Implemented PR diff matches that ledger
Findings: Pass. The diff widens only the cited-attribution case, preserves ordinary-deference detection, and leaves the transcript-conditioned sibling audit as a documented future trigger.
🪜 Evidence Audit
- PR body contains an
Evidence:declaration - Achieved evidence and residual ownership are aligned
- No unresolved acceptance criterion is hidden by the close target
- Sandbox-vs-achievable ceilings are distinguished
- No L1/L2 evidence is promoted to L3/L4
- Post-merge receipts are correctly treated as post-merge validation
Findings: Pass. This is a pure L2 matcher repair with current-head CI, focused author evidence, exact reviewer falsifiers, and no claimed residual acceptance work.
🧪 Test-Evidence & Location Audit
- Execution evidence: all required checks green at
bc54449aaa, including unit, CodeQL, and CodeQL extraction guard; author receipt records 263 focused hook tests passing - Reviewer falsifier: four semantic controls returned the expected results; a 20,016-character hostile input completed in approximately 0.22 ms; structure-map and diff-check exited 0
- Test location: the pure matcher regression remains with its owning lifecycle-hook unit spec
Findings: Pass. The tests cover the exact false positive, rightmost-anchor behavior, Markdown-stripped citations, and the named over-correction.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
Verdict weights: 30% premise / right thing, 30% architecture + placement, 30% diff correctness, 10% AC/audit sanity.
[ARCH_ALIGNMENT]: 97 - The repair stays inside the existing attribution predicate, preserves policy boundaries, and uses a reviewable bounded grammar.[CONTENT_COMPLETENESS]: 96 - The issue, ledger, PR body, audit comment, JSDoc, and regression witnesses describe both the repaired defect and the intentionally deferred sibling finding.[EXECUTION_QUALITY]: 98 - Exact-head CI is green, CodeQL's initial concern was repaired, and direct semantic plus hostile-input probes agree with the suite.[PRODUCTIVITY]: 97 - The observed false positive is removed without sacrificing ordinary-deference detection or widening the Stop-hook surface.[IMPACT]: 72 - The code change is small, but it prevents a core maintainer rule citation from being misclassified by turn-terminal infrastructure.[COMPLEXITY]: 42 - Two files and one private predicate, with the main subtlety concentrated in anchor selection and regex-cost control.[EFFORT_PROFILE]: Quick Win - High-confidence, bounded lifecycle-substrate repair with strong regression evidence.
The current head is ready for human merge.
Resolves #16411
Related: #16325 / PR #16326 (the same pattern-complete-but-composition-blind failure one level up, in the phrase list rather than the exemptions)
The
your callexemption was adjacency-anchored —/\bper\s+$/matched only the citation-FREEper your call, and fired on the form this repo mandates.§critical_gates #1 requires an agent to hand a merge to the human operator. Every correct execution of that gate produces a turn-terminal sentence assigning the decision, and the accurate way to write one names the gate. So satisfying gate #1 and passing the deference detector were in tension, and the tension resolved the wrong way: the honest phrasing (cite the rule) tripped, while the phrasing that passed (
per your call) cites nothing and reads worse. Live instance: PR #16397 reported merge-eligible 2026-08-02.Evidence: L2 (unit coverage at exact head; the matcher is pure and fully reachable in-sandbox) → L2 required, every AC being an assertion on a return value.
The fix, and the trap it had to avoid
The citation window may now contain the cited authority: a bounded allowlist of citation tokens (
§section,#ticket, bare digits,gate,rule), copular connectives (that's/that is/it's/it is), punctuation, dashes and whitespace between the anchor and the phrase.An allowlist, deliberately not a wildcard. The ticket's named trap is widening to "
perappears anywhere in 80 characters", which would exempt real deference that happens to cite something earlier — the genuine slip this detector exists to catch. That over-correction is pinned by a spec, not avoided by intent.Two details that only surface empirically:
Whitespace alone has to bridge.
stripMarkdownCoderuns first and replaces a backticked citation with a space, so the most idiomatic form in this repo —per `§critical_gates #1` that's your call— reaches this predicate asper that'swith its citation already erased. A citation-shape requirement would have left exactly that form still firing, which is the shape I'd most often write.The anchor matches rightmost, not leftmost. With a leftmost anchor,
as you said, per gate <a href="#/news/tickets/1">#1</a>, that's your callfails: the bridge fromas you saidcontainsper, which is not an allowlisted token. A greedy head pushes the anchor as late as possible, which also keepsper your call, but honestly, your call?firing on its trailing deferential use.The
:74-75audit — a positive finding, deliberately not fixed hereThe ticket required auditing
isReportedMentionContext's two patterns for the same adjacency narrowness. They have it. Probed against the exact head:The phrase your call is in the corpus.The reported phrase your call fired.The deference phrase, your call, fired at turn-end.The phrase list entry your call needs no change.A modifier between the determiner and the noun breaks the exemption. The tripping shape is the sentence
DEFERENCE_REMINDERitself asks an agent to write when reporting a false positive — "open a ticket to sharpen it" — so the hook currently penalizes its own friction→gold instruction.Left unchanged on purpose. The ticket conditions any change there on "a phrasing observed in a real transcript rather than invented for the test", and I have reachability, not an observed instance. Inventing one to justify the change is precisely what that AC forbids. Recorded on the ticket with this evidence and an explicit trigger: the first transcript instance promotes it to a follow-up. Folding it in would also make this PR two decisions — the second fix is a different widening (tolerating a modifier run and trailing punctuation after the noun) with its own over-correction analysis.
Test Evidence
NEO_CODE_BLOCK_0
Directory-scoped rather than file-scoped: both importers of this module —
stopHookDecision.mjsandlaneStateStopHook.mjs— have their specs in the same folder, so the folder is the regression surface. 15 of those are this matcher's own (2 tests added).Mutation-verified. Each new term reverted turns the predicted specs red:
[\s\S]*(the ticket's named over-correction)as you said, per gate #1)The first row is the one worth reading: the trap the ticket warned about is caught by a pre-existing regression test as well as the new one, so this widening could not have shipped silently even without the guard I added.
Deltas
isAttributiveCitationContext) plus two module-level regex constants naming the anchor and the bridge. NoDEFERENCE_PHRASESentry added or removed; no new exemption category;isReportedMentionContextuntouched.your callever needs a third context carve-out, the phrase is the wrong instrument and should be replaced by a turn-shape check — whether the turn names and starts a next lane, which is the thing this detector only proxies for.Post-Merge Validation
What this does NOT fix
The hook was substantively right about my turn even while wrong about the phrase: I ended on a table of items awaiting the operator instead of naming and starting my next lane, which is the §swarm_topology_anchor AND-discipline. A phrase detector cannot see turn shape, and this PR does not pretend to.
Authored by Vega (Claude Opus 5, Claude Code). Session 11695cce-9854-4be2-80c3-8ea4322298bf.