{
  "schema_version": "0.1",
  "artifact_type": "implementation_plan",
  "canonical": true,
  "artifact_id": "IMP-013",
  "agent_summary": {
    "title": "Structured Reasoning Diagnostic kernel implementation plan",
    "status": "complete",
    "summary": "Implement the local Reason Guard evolution in four test-first increments: contract and migration, deterministic evidence lifecycle, coalesced diagnostics and clearance, then cross-host delivery and release verification.",
    "last_reviewed_at": "2026-07-24",
    "load_notes": "Explicitly approved by the user on 2026-07-24. RSP/server work remains excluded."
  },
  "source_ids": ["REQ-173", "PRD-011", "ARCH-011", "WFR-408"],
  "approval_gate": {
    "status": "approved",
    "implementation_authorized": true,
    "approved_at": "2026-07-24",
    "approved_by": "user"
  },
  "phases": [
    {
      "id": "IMP-PHASE-041",
      "title": "Structured contract and safe migration",
      "tasks": [
        {
          "id": "IMP-TASK-104",
          "summary": "RED: extend the existing Reason Guard tests first for the versioned host-neutral directive, strict bounds and unknown-field rejection, explicit-versus-heuristic blocking policy, supported legacy migration, malformed/future-state handling, and atomic replay-safe behavior.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-085", "PRD-REQ-086", "PRD-REQ-089"],
          "architecture_ids": ["ARCH-COMP-065", "ARCH-DEC-056", "ARCH-DEC-060"],
          "validation_ids": ["IMP-VAL-093"]
        },
        {
          "id": "IMP-TASK-105",
          "summary": "GREEN: implement the bounded directive normalizer, structured obligation schema, source-confidence policy, and atomic local-state migration in the hub hook; refactor only after the focused tests pass.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-085", "PRD-REQ-086", "PRD-REQ-089", "PRD-REQ-091"],
          "architecture_ids": ["ARCH-COMP-065", "ARCH-COMP-066", "ARCH-IF-057", "ARCH-IF-060"],
          "validation_ids": ["IMP-VAL-093"]
        }
      ]
    },
    {
      "id": "IMP-PHASE-042",
      "title": "Deterministic evidence lifecycle and diagnostics",
      "tasks": [
        {
          "id": "IMP-TASK-106",
          "summary": "RED: add focused tests for the closed predicate allowlist, tool-use identity and outcome binding, expected-versus-observed comparison, mismatched and failed evidence, duplicate delivery, bounded sanitized persistence, and prohibited-content sentinels.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-087", "PRD-REQ-091"],
          "architecture_ids": ["ARCH-COMP-066", "ARCH-DEC-057"],
          "validation_ids": ["IMP-VAL-094"]
        },
        {
          "id": "IMP-TASK-107",
          "summary": "GREEN: implement deterministic evidence matching and obligation lifecycle transitions using only bounded allowlisted predicates; preserve explicit resolved/deferred semantics and existing mode behavior.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-087", "PRD-REQ-091"],
          "architecture_ids": ["ARCH-COMP-066", "ARCH-IF-058"],
          "validation_ids": ["IMP-VAL-094"]
        },
        {
          "id": "IMP-TASK-108",
          "summary": "RED then GREEN: extend existing violation tests and implement one active diagnostic per code and obligation, bounded occurrence metadata, deterministic replay updates, resolution lifecycle, and concise human-readable projection.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-088"],
          "architecture_ids": ["ARCH-COMP-067", "ARCH-DEC-058"],
          "validation_ids": ["IMP-VAL-095"]
        }
      ]
    },
    {
      "id": "IMP-PHASE-043",
      "title": "Completion clearance and cross-host surfaces",
      "tasks": [
        {
          "id": "IMP-TASK-109",
          "summary": "RED: add matrix tests for clear, conditional, and blocked clearance across full/reduced/missing coverage, report/enforce/off modes, open/resolved/deferred obligations, active diagnostics, replay, and report-digest changes.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-090", "PRD-REQ-093"],
          "architecture_ids": ["ARCH-COMP-068", "ARCH-DEC-059"],
          "validation_ids": ["IMP-VAL-096"]
        },
        {
          "id": "IMP-TASK-110",
          "summary": "GREEN: implement the coverage-qualified clearance receipt and project readable status, diagnostic explanations, on/off effects, auditability benefit, and measured latency through existing status, configuration, report, and UI surfaces; keep internal IDs secondary.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-090", "PRD-REQ-092", "PRD-REQ-093"],
          "architecture_ids": ["ARCH-COMP-068", "ARCH-COMP-069", "ARCH-IF-059"],
          "validation_ids": ["IMP-VAL-096", "IMP-VAL-097"]
        },
        {
          "id": "IMP-TASK-111",
          "summary": "RED then GREEN: prove equivalent Claude, Codex, and OpenCode dispatcher behavior, update the repository skeleton and installer-owned copies, and account for the internal hook capability through existing status/config surfaces without inventing a duplicate agent tool.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-092"],
          "architecture_ids": ["ARCH-COMP-069", "ARCH-IF-057", "ARCH-IF-058", "ARCH-IF-059"],
          "validation_ids": ["IMP-VAL-097"]
        }
      ]
    },
    {
      "id": "IMP-PHASE-044",
      "title": "Documentation, audit, and release",
      "tasks": [
        {
          "id": "IMP-TASK-112",
          "summary": "Update Reason Guard docs, wiki, configuration descriptions, downstream guidance, feature coverage, changelog, and release metadata; run focused privacy/performance tests, affected suites, E2E install/host coverage, code review, full hub gates, and audit-fix-reaudit loops until CHML is zero, then ship through the canonical hub release workflow.",
          "status": "complete",
          "requirement_ids": ["PRD-REQ-091", "PRD-REQ-092", "PRD-REQ-093"],
          "architecture_ids": ["ARCH-COMP-069", "ARCH-RISK-052"],
          "validation_ids": ["IMP-VAL-098"]
        }
      ]
    }
  ],
  "validations": [
    {
      "id": "IMP-VAL-093",
      "summary": "Directive and migration suite: valid structured directives normalize deterministically; invalid or oversized inputs do not create blockers; heuristics stay report-only; supported legacy state migrates atomically; malformed/future state and replay/concurrency cases fail safely."
    },
    {
      "id": "IMP-VAL-094",
      "summary": "Evidence and privacy suite: only correctly bound successful tool evidence satisfying every allowlisted predicate clears an obligation; arbitrary expressions are impossible; all durable and projected surfaces pass prohibited-content sentinels."
    },
    {
      "id": "IMP-VAL-095",
      "summary": "Diagnostic suite: repeated events coalesce by code and obligation, occurrence metadata is bounded and idempotent, resolved diagnostics retain sanitized audit value, and humans see one readable actionable finding."
    },
    {
      "id": "IMP-VAL-096",
      "summary": "Clearance matrix: full coverage and no blockers yields clear; reduced or missing coverage never yields unconditional clear; open/deferred blockers and mode semantics yield the correct conditional or blocked receipt bound to the report digest."
    },
    {
      "id": "IMP-VAL-097",
      "summary": "Parity and UX suite: Claude, Codex, OpenCode, hub, skeleton, installer, config, status, report, and UI fixtures agree; readable names and explanations are primary and internal IDs remain secondary."
    },
    {
      "id": "IMP-VAL-098",
      "summary": "Delivery gate: focused latency evidence shows bounded work and no material benchmark regression; affected and full suites, E2E downstream install checks, code review, state consistency, local workflow checks, feature/skill/tool coverage, package checks, and repeated CHML audits are all green at zero findings before release."
    }
  ],
  "execution_rules": [
    "Do not start implementation before explicit user approval.",
    "Use the existing tests and extend coverage in place; every code increment begins with a behavior-specific failing test.",
    "Commit each verified increment on the work branch; do not merge, push, tag, or publish until the relevant gates and configured autonomy conditions are satisfied.",
    "If implementation reveals adjacent server, symbol-impact, context-broker, remote-ingestion, or generic code-action needs, file them separately and keep them out of this delivery.",
    "Run the audit-fix-reaudit loop until CHML is zero; do not convert an unresolved finding into a completion claim."
  ],
  "traceability": {
    "request_ids": ["REQ-173"],
    "prd_ids": ["PRD-011", "PRD-REQ-085", "PRD-REQ-086", "PRD-REQ-087", "PRD-REQ-088", "PRD-REQ-089", "PRD-REQ-090", "PRD-REQ-091", "PRD-REQ-092", "PRD-REQ-093"],
    "architecture_ids": ["ARCH-011", "ARCH-COMP-065", "ARCH-COMP-066", "ARCH-COMP-067", "ARCH-COMP-068", "ARCH-COMP-069", "ARCH-DEC-055", "ARCH-DEC-056", "ARCH-DEC-057", "ARCH-DEC-058", "ARCH-DEC-059", "ARCH-DEC-060"],
    "tracking_ids": ["TRK-159"],
    "evidence_ids": ["EV-205", "EV-206"]
  }
}
