R91A — Ratify μ Scope — Execution Packet (Step 3 of 5)

Purpose. Sequence the exact Edit calls Step 4 will perform against docs/guides/implementation/task-breakdown.md to satisfy the 27 invariants locked in Step 2 (contract). This packet is the implementation script.

1. Files modified (Step 4 deliverable)

Single file: docs/guides/implementation/task-breakdown.md. Five distinct edit sites.

2. Edit sequence

Edit 1 — Replace the 2-entry Phase 4 block (L971–996) with the 10-entry block

old_string anchor: the entire block from ## Phase 4: μ Integrity Monitor through the trailing - **Effort:** L of the old P4.2.1, ending at the blank line before ---.

new_string: 10 entries. Format mirrors P1.* / P2.* / P3.* (template at L466 for P1.1.1).

The 10 entries (full text shipped):

## Phase 4: μ Integrity Monitor

#### P4.1.1 — Advisory Record Schema + Envelope
- **Depends on:** P1.5.4 (κ canonical serializer), P1.5.1 (κ version hash)
- **Input:** docs/3-world/physics/enforcement/integrity.md §Advisory record schema (L129-146), docs/spec/s14-integrity-monitor.md §Output
- **Output:** `src/domains/integrity/schema.ts`, `src/domains/integrity/__tests__/schema.test.ts`
- **Acceptance criteria:**
  - [ ] Zod schema for the 8-field envelope: `role`, `check`, `result`, `severity`, `evidence`, `recommendation`, `decision_hash`, `timestamp_logical`
  - [ ] `role`: `"Translator" | "Sentinel" | "Guide"`
  - [ ] `check`: `"circular_logic" | "coercion_trap" | "axiom_drift" | "axiom_regression"`
  - [ ] `result`: `"PASS" | "WARN" | "BLOCK"`
  - [ ] `severity`: `"LOW" | "MED" | "HIGH"` (matches λ severity bands; supersedes legacy INFO/WARNING/CRITICAL per R91 audit Q6)
  - [ ] `decision_hash`: `SHA-256(role || check || canonical(input) || result)` per R91 audit Q7 (uses κ P1.5.4 canonical serializer)
  - [ ] `timestamp_logical`: uint64 Lamport clock (not wall-clock; inherits θ design invariant)
  - [ ] Dedup: identical inputs produce identical advisories; `decision_hash` is the unique key
- **Effort:** S

#### P4.2.1 — Circular Logic Detector (DFS)
- **Depends on:** P4.1.1, P0.7.1 (ζ thought_records substrate), P1.2.4 (κ registry for rule-dep edges)
- **Input:** docs/3-world/physics/enforcement/integrity.md §1 Circular logic (L22-55) — DFS pseudocode
- **Output:** `src/domains/integrity/detectors/circular.ts`, `src/domains/integrity/detectors/__tests__/circular.test.ts`
- **Acceptance criteria:**
  - [ ] DFS cycle detection on `thought_records.cites` graph; edge source = `parent_hash` OR `refs[]`
  - [ ] `find_cycles(records): Cycle[]` returns all cycles (not just first)
  - [ ] IN_PROGRESS / DONE coloring; correctly handles diamonds (DAG, no cycle) vs. true back-edges (cycle)
  - [ ] Cross-rule cycle support: rule A depends on rule B which depends on rule A via different parameters (uses κ P1.2.4 rule-dep edges)
  - [ ] Threshold: any cycle → emit advisory with `severity=HIGH`, `result=WARN`
  - [ ] FP profile: <1% on test corpus; verified in P4.7.1
- **Effort:** M

#### P4.2.2 — Coercion Trap Detector (option-set)
- **Depends on:** P4.1.1, P1.4.1 (κ admission evaluator), P1.3.1 (κ rule engine), P2.1.2 (λ score compute)
- **Input:** docs/3-world/physics/enforcement/integrity.md §2 Coercion trap (L57-85) — option-set enumeration pseudocode
- **Output:** `src/domains/integrity/detectors/coercion.ts`, `src/domains/integrity/detectors/__tests__/coercion.test.ts`
- **Acceptance criteria:**
  - [ ] Enumerate all legal actions for a participant given current state (via κ admission evaluator P1.4.1)
  - [ ] For each action, compute outcome via κ rule engine P1.3.1 (collect `reputation_delta`, `obligation_beyond_capacity`)
  - [ ] Flag if: every available option produces `reputation_delta < 0` (uses λ P2.1.2 score-compute signature)
  - [ ] Flag if: every available option produces `obligation_beyond_capacity`
  - [ ] Flag if: action space is empty
  - [ ] On flag: emit advisory `check=coercion_trap`, `severity=HIGH`, `evidence=[presented, available, outcomes]`
  - [ ] No veto power: advisory only; cannot block the decision
- **Effort:** M

#### P4.2.3 — Axiom Drift Tracker (sliding window)
- **Depends on:** P4.1.1, P2.2.2 (λ penalties — parameter-change events surface), P1.1.1 (κ BPS arith)
- **Input:** docs/3-world/physics/enforcement/integrity.md §3 Axiom drift (L87-115) — sliding-window pseudocode + AX-01..AX-07 regression check
- **Output:** `src/domains/integrity/detectors/drift.ts`, `src/domains/integrity/detectors/__tests__/drift.test.ts`
- **Acceptance criteria:**
  - [ ] Sliding-window aggregation: 6-month window over parameter-change events per domain
  - [ ] Sum `abs(c.delta_bps)` across the window for each domain
  - [ ] Threshold 1: ≥800 bps (8%) → emit advisory `severity=MED`, `result=WARN`
  - [ ] Threshold 2: ≥1000 bps (10%, AX-06 cap) → emit advisory `severity=HIGH`, `result=BLOCK` (denies new proposals in domain)
  - [ ] AX-invariant regression check: for each staged proposal, simulate against AX-01..AX-07; if any invariant would regress → emit `check=axiom_regression`, `severity=HIGH`, `result=HARD BLOCK`
  - [ ] BPS arithmetic via P1.1.1 (no floats; integer-only)
  - [ ] FP profile: high without long history; verified in P4.7.1 with synthetic 12-month corpus
- **Effort:** L

#### P4.3.1 — Three Advisory Roles (Translator/Sentinel/Guide)
- **Depends on:** P4.1.1
- **Input:** docs/3-world/physics/enforcement/integrity.md §Three advisory roles (L117-127), docs/spec/s14-integrity-monitor.md §Advisory roles
- **Output:** `src/domains/integrity/roles.ts`, `src/domains/integrity/__tests__/roles.test.ts`
- **Acceptance criteria:**
  - [ ] Translator: read-only; summarize advisory reports for a human operator; no recommendations of its own (per integrity.md L123)
  - [ ] Sentinel: read-only; flag advisory reports that meet a severity threshold; may escalate to π (per integrity.md L124)
  - [ ] Guide: read-only; suggest corrective actions for human review; the human decides whether to act (per integrity.md L125)
  - [ ] All three roles are strictly read-only — no mutation API exposed
  - [ ] Standard output format across all roles (the P4.1.1 envelope)
  - [ ] No "Mutator" role exists (per integrity.md §Three advisory roles L127)
- **Effort:** M

#### P4.4.1 — Escalation FSM (4-result + 3 invariant mappings)
- **Depends on:** P4.1.1, P4.2.1, P4.2.2, P4.2.3, P1.4.1 (κ admission), P1.2.4 (κ registry)
- **Input:** docs/3-world/physics/enforcement/integrity.md §Escalation mapping (L148-157), docs/spec/s14-integrity-monitor.md §When advisory becomes enforcement
- **Output:** `src/domains/integrity/escalation.ts`, `src/domains/integrity/__tests__/escalation.test.ts`
- **Acceptance criteria:**
  - [ ] 4-result FSM: PASS / WARN / BLOCK / HARD BLOCK
  - [ ] PASS → log to ζ at `thought_type=advisory`; no further effect
  - [ ] WARN → log + surface in operator console; no rule change
  - [ ] BLOCK → record denial event into ζ at `thought_type=advisory`; π integration is out of scope for Phase 4 (per R91 audit Q5)
  - [ ] HARD BLOCK → α tool-lock admission denies; downstream κ evaluation never runs
  - [ ] Invariant mapping 1: circular-logic-in-rule-update → rule rejected at κ rule loader P1.2.4
  - [ ] Invariant mapping 2: coercion-in-admission → event rejected at κ admission P1.4.1
  - [ ] Invariant mapping 3: axiom-drift-beyond-limits → governance proposal rejected (records BLOCK event into ζ; π consumes when π ships)
- **Effort:** M

#### P4.5.1 — Advisory Persistence (`mcp_advisories` migration)
- **Depends on:** P4.1.1, P0.2.2 (SQLite migration runner)
- **Input:** docs/3-world/physics/enforcement/integrity.md §Phase 0 posture (L165-170) — names the `mcp_advisories` table stub; Phase 4 activates it
- **Output:** `src/db/migrations/*-advisories.sql`, `src/domains/integrity/repository.ts`, `src/domains/integrity/__tests__/repository.test.ts`
- **Acceptance criteria:**
  - [ ] SQLite migration creates `mcp_advisories` table with the 8 envelope fields from P4.1.1
  - [ ] `decision_hash TEXT NOT NULL UNIQUE` enforces dedup
  - [ ] `timestamp_logical INTEGER NOT NULL` (uint64 Lamport)
  - [ ] Indexes on `(check, severity)` and `(role)` for typical advisory queries
  - [ ] Repository: `insertAdvisory(record)`, `getAdvisory(decision_hash)`, `listAdvisories(filter)`
  - [ ] Idempotent insert: same `decision_hash` returns existing row, does not throw
- **Effort:** S

#### P4.6.1 — μ MCP Tool Surface (≥4 tools)
- **Depends on:** P4.3.1, P4.4.1, P4.5.1
- **Input:** docs/3-world/physics/enforcement/integrity.md §Phase 4 scope (L172-178), MCP tool registration pattern in existing β/ε/ζ/η/λ/θ surfaces
- **Output:** `src/tools/integrity.ts`, `src/tools/__tests__/integrity.test.ts`
- **Acceptance criteria:**
  - [ ] ≥4 MCP tools registered, growing the surface 23 → 27+
  - [ ] `integrity_check_circular`: trigger D1 detector over current `thought_records`; returns advisory list
  - [ ] `integrity_check_coercion`: trigger D2 detector over a `decision_record`; returns advisory or PASS
  - [ ] `integrity_check_drift`: trigger D3 detector for a domain; returns advisory or PASS
  - [ ] `integrity_query`: list / fetch advisories from `mcp_advisories` (uses P4.5.1 repository)
  - [ ] All tools use Zod v3.23 schemas + `registerTool` pattern as in existing θ/λ surfaces
  - [ ] Each tool's response shape matches the P4.1.1 envelope
- **Effort:** M

#### P4.7.1 — Test Corpus + Parity Harness
- **Depends on:** P4.2.1, P4.2.2, P4.2.3, P4.4.1, P4.5.1
- **Input:** Precedent: κ P1.5.5 parity harness (`src/domains/rules/__tests__/parity-harness.test.ts`, R87 #214); θ P3.8.1 4-scenario harness (R89 Phase B #246)
- **Output:** `src/__tests__/integrity/parity.test.ts`, fixture corpus in `src/__tests__/integrity/corpus/`
- **Acceptance criteria:**
  - [ ] D1 cycle-detection corpus: ≥10 fixtures spanning true cycles, diamonds (no cycle), self-loops, length-2 cycles, length-N cycles
  - [ ] D2 coercion corpus: ≥10 fixtures spanning all-negative, empty-set, mixed-outcome (no flag), reputation-loss-only, obligation-only
  - [ ] D3 drift corpus: ≥10 fixtures spanning under-threshold, 8% WARN, 10% BLOCK, AX-01..AX-07 regression cases
  - [ ] FP rate measurement: D1 <1%, D2 <5%, D3 <10% on the corpus (FP rates per integrity.md §1, §2, §3 declared profiles)
  - [ ] Parity harness: run each detector against its corpus; assert advisory output matches expected envelope byte-for-byte
- **Effort:** L

#### P4.8.1 — Fork Hook Subscriber (post-fork invariant sweep)
- **Depends on:** P4.2.3, P3.9.1 (θ ForkHookRegistry)
- **Input:** docs/3-world/physics/enforcement/integrity.md §Phase 4 scope (L177 — fork-hook awareness), docs/3-world/physics/laws/consensus.md (θ fork-hook surface)
- **Output:** `src/domains/integrity/fork-hook-subscriber.ts`, `src/domains/integrity/__tests__/fork-hook-subscriber.test.ts`
- **Acceptance criteria:**
  - [ ] Subscribes to θ `ForkHookRegistry` (from P3.9.1) for POST_FORK events
  - [ ] On POST_FORK event: triggers a D3 axiom-drift sweep across all domains in the forked sub-tree
  - [ ] Records sweep results to `mcp_advisories` via P4.5.1 repository
  - [ ] Idempotent: same fork event triggers at most one sweep (uses fork event id as dedup key)
  - [ ] Sweep is bounded: caps detectors at a configurable budget (default 100 advisories per fork event)
  - [ ] Stages the surface for ι Phase 5 (state-fork) activation; ι integration out of scope for Phase 4
- **Effort:** S

The packet’s edit will REPLACE the block at L971–996 with the 10-entry block above. Exact old_string includes the leading ## Phase 4: μ Integrity Monitor\n\n header and ends at the trailing blank line before --- (L997).

Edit 2 — Task Summary row L1138

old_string: | P4 μ Integrity | 2 tasks | 2 weeks | P1, P2, P3 |

new_string: | P4 μ Integrity | 10 tasks | 3-4 weeks | P1, P2, P3 |

Edit 3 — Total row L1142

old_string: | **Total** | **63 tasks** | **25-32 weeks** | |

new_string: | **Total** | **71 tasks** | **26-34 weeks** | |

Edit 4 — P6.3.1 dep L1068

old_string: - **Depends on:** P6.1.1, P4.1.1

new_string: - **Depends on:** P6.1.1, P4.4.1

Note: this is a unique 1-line pattern in the file (verified — no other P6.3.1 has this dep shape).

Edit 5 — Mermaid μ block + downstream edge

old_string (L1180–1182, with one trailing context line for uniqueness):

    P1.3.1 --> P4.1.1[P4.1.1 Coercion]
    P2.1.2 --> P4.1.1
    P4.1.1 --> P4.2.1[P4.2.1 Advisory Roles]

new_string (10-slice DAG mirroring R91 packet §4 wave structure):

    P1.5.4 --> P4.1.1[P4.1.1 Envelope]
    P1.5.1 --> P4.1.1
    P4.1.1 --> P4.2.1[P4.2.1 Circular]
    P4.1.1 --> P4.2.2[P4.2.2 Coercion]
    P4.1.1 --> P4.2.3[P4.2.3 Drift]
    P0.7.1 --> P4.2.1
    P1.2.4 --> P4.2.1
    P1.4.1 --> P4.2.2
    P1.3.1 --> P4.2.2
    P2.1.2 --> P4.2.2
    P2.2.2 --> P4.2.3
    P1.1.1 --> P4.2.3
    P4.1.1 --> P4.3.1[P4.3.1 Roles]
    P4.2.1 --> P4.4.1[P4.4.1 Escalation]
    P4.2.2 --> P4.4.1
    P4.2.3 --> P4.4.1
    P1.4.1 --> P4.4.1
    P1.2.4 --> P4.4.1
    P4.1.1 --> P4.5.1[P4.5.1 Persistence]
    P4.3.1 --> P4.6.1[P4.6.1 MCP Tools]
    P4.4.1 --> P4.6.1
    P4.5.1 --> P4.6.1
    P4.2.1 --> P4.7.1[P4.7.1 Parity]
    P4.2.2 --> P4.7.1
    P4.2.3 --> P4.7.1
    P4.4.1 --> P4.7.1
    P4.5.1 --> P4.7.1
    P4.2.3 --> P4.8.1[P4.8.1 Fork Hook]
    P3.9.1 --> P4.8.1

Edit 6 — Mermaid downstream edge L1195

old_string: ` P4.1.1 –> P6.3.1`

new_string: ` P4.4.1 –> P6.3.1`

3. Edit order

Edits 1–6 are order-independent (different line ranges; no overlap). Sequential execution is safe.

4. Test gate

Run from worktree root:

npm run build && npm run lint && npm test

Expected: build PASS, lint PASS, test 3102/3102 PASS across 69 suites. Docs-only change; zero regressions.

If startup — subprocess smoke flakes (known pre-existing issue per memory), re-run; do not investigate.

5. Push command

git push -u origin feature/r91a-ratify-mu-scope

6. PR command

Per CLAUDE.md §13, unset GITHUB_TOKEN first; use gh keyring auth:

unset GITHUB_TOKEN
gh pr create --title "docs(r91a-ratify-mu-scope): expand μ Phase 4 from 2 to 10 sub-tasks in canonical roadmap" --body "$(cat <<'EOF'
## Summary
- Replaces the 2 canonical μ Phase 4 sub-tasks in task-breakdown.md (P4.1.1 Coercion + P4.2.1 Three Roles) with 10 slices (P4.1.1 → P4.8.1) matching the R91 staging plan (R91 packet §3).
- Reconciles Task Summary row (2 → 10 tasks; total 63 → 71), P6.3.1 dep target (old P4.1.1 → P4.4.1, the right integration point), and the mermaid dependency graph.
- Predecessor PR to R91 (#249, staging file for μ). With R91A merged, the staging file in R91 becomes consistent with the canonical roadmap.

## Test plan
- [x] `npm run build && npm run lint && npm test` — 3102/3102 pass (docs-only; zero regression)
- [x] `grep -c "^#### P4\." docs/guides/implementation/task-breakdown.md` = 10
- [x] No `P4.1.1` reference remains in P6.3.1 dep (now P4.4.1)
- [x] `git diff --stat origin/main..HEAD` shows only chain docs + task-breakdown.md (zero src/* mutation)

## Writeback (for PM to fold into ζ chain when MCP attaches)
task_id: TBD (no live MCP client; writeback lands in PR body + memory per CLAUDE.md §4 alt branch)
branch: feature/r91a-ratify-mu-scope
worktree: .worktrees/claude/r91a-ratify-mu-scope
commits: <5 SHAs from the chain>
tests: npm run build && npm run lint && npm test (PASS, 3102/3102, zero regression)
summary: μ Phase 4 sub-task count reconciled in canonical roadmap from 2 → 10; ratifies the R91 staging packet's expansion. Predecessor to PR #249.
blockers: none.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

7. Forbiddens (re-asserted from contract §4)

  • --no-verify, --amend, --force-push
  • Pushing to main
  • Touching any file outside task-breakdown.md + the 4 chain docs
  • Touching the R91 worktree
  • Touching integrity.md, s14-integrity-monitor.md, roadmap.md
  • Inventing new ADRs

8. Conclusion

6 surgical Edit calls land in task-breakdown.md. The packet’s edit text is verbatim what Step 4 ships. Step 5 verifies INV-1 through INV-27 against the resulting file.


Packet closed 2026-05-13. Base SHA: 332feb62. Next: Step 4 implement.


Back to top

Colibri — documentation-first MCP runtime. Apache 2.0 + Commons Clause.

This site uses Just the Docs, a documentation theme for Jekyll.