{
  "schema_version": "0.1",
  "id": "IMP-006",
  "title": "Config-toggleable PRD Plugin Substrate adapter",
  "status": "complete",
  "source_prd_id": "PRD-005",
  "source_architecture_id": "ARCH-005",
  "source_request_id": "REQ-091",
  "source_decision_id": "DEC-005",
  "created_at": "2026-07-14",
  "updated_at": "2026-07-14",
  "summary": "Deliver the PRD-side policy/contracts and AI-Collab-side projection/execution adapter through test-first increments, then eliminate all CHML audit findings.",
  "phases": [
    {"id": "IMP-PHASE-015", "name": "PRD contract and configuration", "order": 1, "tasks": ["IMP-TASK-042", "IMP-TASK-043", "IMP-TASK-044"], "exit_criteria": "Focused tests prove disabled-by-default config, handshake, complete privacy-safe snapshots, and repo-qualified graph output."},
    {"id": "IMP-PHASE-016", "name": "AI-Collab adapter runtime", "order": 2, "tasks": ["IMP-TASK-045", "IMP-TASK-046", "IMP-TASK-047"], "exit_criteria": "Adapter tests prove generation-aware projection, MCP-only coordination, reporting execution, and safe worker assignment."},
    {"id": "IMP-PHASE-017", "name": "Delivery, verification, and zero-finding audit", "order": 3, "tasks": ["IMP-TASK-048", "IMP-TASK-049"], "exit_criteria": "All delivery surfaces and both repositories are verified, durable evidence is recorded, and repeated CHML audits report zero findings."}
  ],
  "tasks": [
    {"id": "IMP-TASK-042", "phase": "IMP-PHASE-015", "summary": "Write failing tests for integrations.substrate defaults, validation, master-switch precedence, modes, capability allowlist, and prd_config.py toggling; implement the config contract.", "files": ["tests/test_substrate_adapter.py", "scripts/prd_config.py", "templates/config.json", ".prd_plugin/config.json", "templates/repo-skeleton/.prd_plugin/config.json"], "sources": ["PRD-REQ-030", "PRD-NFR-018", "ARCH-COMP-024", "ARCH-IF-017", "ARCH-DEC-018"], "validation": "IMP-VAL-039", "complexity": "medium", "confidence": "high", "risk": "low", "status": "complete", "completed_at": "2026-07-14"},
    {"id": "IMP-TASK-043", "phase": "IMP-PHASE-015", "summary": "Write failing tests for deterministic handshake and complete bounded record snapshots with privacy exclusions; implement the PRD-side adapter contract script and UTCP discovery entry.", "files": ["tests/test_substrate_adapter.py", "scripts/prd_substrate.py", "scripts/prd_tools.py", "templates/script-install-scope.json"], "sources": ["PRD-REQ-031", "PRD-REQ-032", "PRD-NFR-017", "PRD-NFR-020", "ARCH-COMP-025", "ARCH-COMP-026", "ARCH-IF-018", "ARCH-IF-019"], "validation": "IMP-VAL-040", "complexity": "large", "confidence": "high", "risk": "medium", "status": "complete", "completed_at": "2026-07-14"},
    {"id": "IMP-TASK-044", "phase": "IMP-PHASE-015", "summary": "Write failing tests for repo-qualified cause-effect graph export and adapter status diagnostics; implement graph and diagnostics integration without changing canonical graph semantics.", "files": ["tests/test_substrate_adapter.py", "scripts/prd_substrate.py", "scripts/prd_graph.py"], "sources": ["PRD-REQ-033", "PRD-REQ-038", "ARCH-COMP-027", "ARCH-COMP-031", "ARCH-IF-021"], "validation": "IMP-VAL-041", "complexity": "medium", "confidence": "high", "risk": "medium", "status": "complete", "completed_at": "2026-07-14"},
    {"id": "IMP-TASK-045", "phase": "IMP-PHASE-016", "summary": "Create an isolated AI-Collab worktree, write failing tests for official PRD handshake/snapshot consumption and generation-aware upsert/delete reconciliation, then implement the projector over existing Substrate client primitives.", "files": ["tools/prd-adapter/", "tools/repo-index/tracking-ingest.mjs", "tools/repo-index/substrate.mjs", "modules/ai-collab/src/tracking_mirror.rs"], "sources": ["PRD-REQ-032", "PRD-REQ-034", "ARCH-COMP-026", "ARCH-IF-019", "ARCH-IF-020", "ARCH-DEC-020"], "validation": "IMP-VAL-042", "complexity": "large", "confidence": "medium", "risk": "medium", "status": "complete", "completed_at": "2026-07-14", "evidence": ["EV-070"]},
    {"id": "IMP-TASK-046", "phase": "IMP-PHASE-016", "summary": "Write failing AI-Collab tests for repo-qualified graph projection and observe/coordinate mutation gating; implement graph import and MCP-only command routing.", "files": ["tools/prd-adapter/", "tools/conduit/", "modules/ai-collab/src/"], "sources": ["PRD-REQ-033", "PRD-REQ-035", "ARCH-COMP-027", "ARCH-COMP-028", "ARCH-IF-021", "ARCH-IF-022"], "validation": "IMP-VAL-043", "complexity": "large", "confidence": "medium", "risk": "high", "status": "complete", "completed_at": "2026-07-14", "evidence": ["EV-070"]},
    {"id": "IMP-TASK-047", "phase": "IMP-PHASE-016", "summary": "Write failing AI-Collab tests for delegated-reporting execution/fallback and parallel-worker tracking-branch environment; implement profile execution and goal correlation adapters.", "files": ["tools/prd-adapter/", "tools/agent-runner.mjs", "tools/goals/"], "sources": ["PRD-REQ-036", "PRD-REQ-037", "ARCH-COMP-029", "ARCH-COMP-030", "ARCH-IF-023", "ARCH-IF-024"], "validation": "IMP-VAL-044", "complexity": "large", "confidence": "medium", "risk": "medium", "status": "complete", "completed_at": "2026-07-14", "evidence": ["EV-070"]},
    {"id": "IMP-TASK-048", "phase": "IMP-PHASE-017", "summary": "Update downstream templates, installer scope, workflow skills, README, wiki, configuration docs, manifests, version metadata, and package tests so supported hosts discover and use the adapter correctly.", "files": ["README.md", "wiki/", "skills/", ".agents/skills/", ".opencode/skill/", "templates/", ".codex-plugin/plugin.json", ".opencode/plugin.json"], "sources": ["PRD-REQ-038", "ARCH-COMP-031", "ARCH-RISK-017", "ARCH-RISK-018"], "validation": "IMP-VAL-045", "complexity": "large", "confidence": "high", "risk": "medium", "status": "complete", "completed_at": "2026-07-14", "evidence": ["EV-071"]},
    {"id": "IMP-TASK-049", "phase": "IMP-PHASE-017", "summary": "Run both repositories' focused/full verification, record evidence/change/request graduation, perform code review, run CHML audit-fix-reaudit loops until zero, commit verified increments, and complete the active goal.", "files": ["tests/", ".prd_plugin/state/", "docs/evidence/", "wiki/"], "sources": ["PRD-ACC-048", "ARCH-RISK-013", "ARCH-RISK-014", "ARCH-RISK-015", "ARCH-RISK-016", "ARCH-RISK-017", "ARCH-RISK-018"], "validation": "IMP-VAL-046", "complexity": "large", "confidence": "high", "risk": "medium", "status": "complete", "completed_at": "2026-07-14", "evidence": ["EV-072", "EV-073"]}
  ],
  "validations": [
    {"id": "IMP-VAL-039", "method": "Focused Python tests demonstrate RED then GREEN for config defaults, validation, effective-mode precedence, and CLI toggles.", "evidence": ["EV-068"]},
    {"id": "IMP-VAL-040", "method": "Focused Python tests demonstrate RED then GREEN for versioned handshake, complete snapshots, bounds, deterministic hashes, and privacy exclusions.", "evidence": ["EV-069"]},
    {"id": "IMP-VAL-041", "method": "Focused graph/diagnostic tests demonstrate repo qualification, contract metadata, and disabled behavior.", "evidence": ["EV-069"]},
    {"id": "IMP-VAL-042", "method": "AI-Collab unit and substrate-contract tests prove generation-aware reconcile, unchanged silence, and single deletion notification.", "evidence": ["EV-070"]},
    {"id": "IMP-VAL-043", "method": "AI-Collab tests prove graph namespaces and reject all non-allowlisted, disabled, or observe-mode mutations before MCP invocation.", "evidence": ["EV-070"]},
    {"id": "IMP-VAL-044", "method": "AI-Collab tests prove source-validated delegated reporting/fallback and exact worker branch environment construction.", "evidence": ["EV-070"]},
    {"id": "IMP-VAL-045", "method": "Installer, package, config parity, script scope, skill parity, and documentation tests prove downstream delivery.", "evidence": ["EV-071"]},
    {"id": "IMP-VAL-046", "method": "Fresh full verification and repeated CHML audits in both repositories report zero findings before completion.", "evidence": ["EV-072", "EV-073"]}
  ],
  "dependencies": [
    "IMP-TASK-042 through IMP-TASK-044 establish the versioned PRD contract before AI-Collab consumes it.",
    "AI-Collab runtime changes use an isolated worktree because its primary checkout contains unrelated user changes."
  ],
  "risks_and_rollback": [
    "The adapter ships disabled by default; rollback disables integrations.substrate without altering canonical PRD state.",
    "AI-Collab projections are derived and can be rebuilt from repository state; failures must never require reverse synchronization.",
    "Coordinate mode fails closed on contract/version/policy errors while observe mode and normal PRD operation remain available."
  ],
  "tracking_ids": ["TRK-091"]
}
