{
  "schema_version": "0.1",
  "artifact_type": "architecture",
  "canonical": true,
  "artifact_id": "ARCH-006",
  "agent_summary": {
    "title": "Impact-scoped verification contract architecture",
    "status": "implemented",
    "summary": "A small PRD-side planner turns exact local changes and committed policy into a portable request. AI-Collab enriches and executes it; deterministic escalation keeps incomplete impact data from narrowing verification unsafely.",
    "last_reviewed_at": "2026-07-14",
    "load_notes": "This JSON artifact is canonical. Generate Markdown only on explicit human request."
  },
  "context": "AI-Collab already exposes axis-labelled causal/semantic impact sets and structural code relationships. PRD Plugin already owns config validation, downstream delivery, and a Substrate handshake. The missing link is a portable verification-plan contract and downstream method guidance.",
  "principles": [
    "Reuse AI-Collab analysis; do not duplicate it.",
    "Exact and structural evidence outrank prediction.",
    "Narrow only when every changed file is accounted for; otherwise widen or run full.",
    "Keep the local path independent of remotes and CI."
  ],
  "components": [
    {"id": "ARCH-COMP-032", "summary": "Verification policy", "responsibility": "Define disabled-by-default test-scope settings, bounds, test patterns, core paths, escalation triggers, and executor selection in committed PRD config.", "requirement_ids": ["PRD-REQ-039", "PRD-NFR-021"], "interface_ids": ["ARCH-IF-025"]},
    {"id": "ARCH-COMP-033", "summary": "Deterministic test-scope planner", "responsibility": "Collect exact local changes or an explicit change list, normalize paths, apply deterministic full-suite triggers, and emit a versioned execution request without contacting AI-Collab.", "requirement_ids": ["PRD-REQ-040", "PRD-REQ-041", "PRD-NFR-022"], "interface_ids": ["ARCH-IF-026"]},
    {"id": "ARCH-COMP-034", "summary": "Substrate discovery and downstream method delivery", "responsibility": "Expose the planner in the existing adapter handshake and teach supported host skills to consume scoped evidence and escalation rules.", "requirement_ids": ["PRD-REQ-041", "PRD-REQ-042", "PRD-NFR-023"], "interface_ids": ["ARCH-IF-026", "ARCH-IF-027"]}
  ],
  "interfaces": [
    {"id": "ARCH-IF-025", "summary": "verification.test_scope policy", "producer": "operator or prd_config.py", "consumer": "PRD planner and AI-Collab runtime", "contract": "enabled, executor, neighbour_limit, max_changed_files, fallback, full_suite_triggers, core_paths, and test_patterns."},
    {"id": "ARCH-IF-026", "summary": "Versioned verification plan", "producer": "prd_test_scope.py", "consumer": "AI-Collab adapter", "contract": "Exact changed files; selected full/impact_scoped/none strategy; per-file impact requests; required structural expansion and test mapping; evidence precedence; fallback conditions; deterministic plan hash."},
    {"id": "ARCH-IF-027", "summary": "Runtime verification outcome", "producer": "AI-Collab runtime", "consumer": "agent verification workflow", "contract": "Selected tests and commands, accounted-for changed files, impact/structural sources, degraded or unmapped flags, executed results, and full-fallback reason when applicable."}
  ],
  "data_state_model": {
    "canonical_policy": ".prd_plugin/config.json#verification.test_scope",
    "planner": ".prd_plugin/scripts/prd_test_scope.py",
    "runtime_analysis": "AI-Collab repository index, impact sets, structural relations, and test ownership",
    "runtime_output": "ephemeral verification outcome; durable completion proof remains EV-*",
    "authority_rule": "PRD Plugin decides policy and fallbacks; AI-Collab computes and executes; neither predictive output nor the derived plan changes canonical project truth"
  },
  "decisions": [
    {"id": "ARCH-DEC-023", "summary": "Extend the existing Substrate adapter rather than create another runtime integration.", "rationale": "The adapter already owns capability discovery, PRD/AI-Collab boundaries, and downstream delivery; another executor would duplicate configuration and failure modes.", "source_ids": ["PRD-REQ-039", "PRD-REQ-041"]},
    {"id": "ARCH-DEC-024", "summary": "Keep changed-file collection and escalation deterministic while delegating enrichment and execution.", "rationale": "Git state and policy are locally knowable; impact, structural analysis, and test execution depend on AI-Collab runtime state and belong there.", "source_ids": ["PRD-REQ-040", "PRD-NFR-022", "PRD-NFR-023"]},
    {"id": "ARCH-DEC-025", "summary": "Require complete changed-file accounting before focused verification is valid.", "rationale": "A high-scoring predictive neighbour set can still miss an exact dependency; unaccounted or degraded inputs must widen instead of silently shrinking coverage.", "source_ids": ["PRD-REQ-041", "PRD-NFR-021"]}
  ],
  "risks": [
    {"id": "ARCH-RISK-019", "summary": "Predictive impact misses a relevant test.", "mitigation": "Exact files, explicit ownership, and structural links take precedence; every changed file must map or force full fallback.", "status": "mitigated"},
    {"id": "ARCH-RISK-020", "summary": "Repositories without AI-Collab, an index, a remote, or test mappings become unable to verify.", "mitigation": "Remote is never required; unavailable, degraded, or unmapped runtime state selects the configured full local verification path.", "status": "mitigated"},
    {"id": "ARCH-RISK-021", "summary": "Focused evidence is reused after the change set moves.", "mitigation": "Plans include normalized inputs and a deterministic hash; skills require evidence matched to the current change fingerprint.", "status": "mitigated"}
  ],
  "validation_strategy": [
    "RED/GREEN tests for config validation, local git change discovery, deterministic plan hashes, core/release/disabled fallbacks, and adapter discovery.",
    "Contract tests prove exact-file precedence, required structural expansion, degraded/unmapped fallback instructions, and remote-neutral behavior.",
    "Skill and installer tests prove downstream delivery and replacement of unconditional full-suite wording.",
    "Focused verification per increment, then one release gate and CHML audit loop before publication."
  ],
  "traceability": {
    "source_ids": ["REQ-094", "PRD-REQ-039", "PRD-REQ-040", "PRD-REQ-041", "PRD-REQ-042"],
    "implementation_task_ids": ["IMP-TASK-050", "IMP-TASK-051", "IMP-TASK-052"],
    "tracking_ids": ["TRK-094"],
    "health_ids": ["HLT-015"]
  }
}
