{
  "schema_version": "0.1",
  "id": "IMP-009",
  "title": "Complete deterministic workflow engine",
  "status": "complete",
  "source_prd_id": "PRD-008",
  "source_architecture_id": "ARCH-008",
  "source_request_id": "REQ-096",
  "created_at": "2026-07-14",
  "updated_at": "2026-07-14",
  "summary": "Implement the complete engine, judgment boundary, management interfaces, lifecycle integration, downstream delivery, audit loop, and release as independently verified tracks.",
  "phases": [
    {"id": "IMP-PHASE-023", "name": "Contracts and state machine", "order": 1, "tasks": ["IMP-TASK-058", "IMP-TASK-059"], "exit_criteria": "Definitions, actions, plans, transitions, WFR persistence, and idempotency are fully tested."},
    {"id": "IMP-PHASE-024", "name": "Judgment and management surfaces", "order": 2, "tasks": ["IMP-TASK-060", "IMP-TASK-061"], "exit_criteria": "Judgment pause/resume and CLI/MCP/UTCP management operate through validated contracts."},
    {"id": "IMP-PHASE-025", "name": "Lifecycle integration", "order": 3, "tasks": ["IMP-TASK-062", "IMP-TASK-063"], "exit_criteria": "Supported session, delivery, engineering, verification, and closeout workflows are engine-owned."},
    {"id": "IMP-PHASE-026", "name": "Downstream delivery and knowledge", "order": 4, "tasks": ["IMP-TASK-064", "IMP-TASK-065"], "exit_criteria": "Config, installer, mirrors, skills, templates, docs, wiki, and migrations are complete and parity-green."},
    {"id": "IMP-PHASE-027", "name": "Audit and release", "order": 5, "tasks": ["IMP-TASK-066", "IMP-TASK-067"], "exit_criteria": "Traceability and CHML are zero; release suite/package/state are green; main and tag are pushed."}
  ],
  "tasks": [
    {"id": "IMP-TASK-058", "phase": "IMP-PHASE-023", "summary": "Write failing schema/catalog/action tests; implement versioned workflow definitions, reference resolution, action metadata, catalog audit, and plan hashing.", "files": ["tests/test_prd_workflows.py", "scripts/prd_workflows.py", "templates/workflows.json"], "sources": ["PRD-REQ-048", "PRD-REQ-051", "PRD-ACC-061", "ARCH-COMP-039", "ARCH-COMP-042", "ARCH-IF-032", "ARCH-IF-033", "ARCH-DEC-030", "ARCH-DEC-031"], "validation": "IMP-VAL-055", "complexity": "large", "confidence": "high", "risk": "high", "status": "complete"},
    {"id": "IMP-TASK-059", "phase": "IMP-PHASE-023", "summary": "Write failing transition/persistence tests; implement strict execution, WFR allocation, locks, atomic checkpoints, receipts, retry/cancel, idempotency, and postconditions.", "files": ["tests/test_prd_workflows.py", "scripts/prd_workflows.py", ".prd_plugin/state/workflow-runs.json", ".prd_plugin/ids/registry.json"], "sources": ["PRD-REQ-049", "PRD-REQ-050", "PRD-NFR-027", "PRD-NFR-028", "PRD-ACC-063", "PRD-ACC-064", "ARCH-COMP-040", "ARCH-COMP-041", "ARCH-IF-034", "ARCH-IF-035", "ARCH-DEC-032", "ARCH-DEC-034"], "validation": "IMP-VAL-056", "complexity": "x-large", "confidence": "medium", "risk": "high", "status": "complete"},
    {"id": "IMP-TASK-060", "phase": "IMP-PHASE-024", "summary": "Write failing judgment tests; implement source-bounded request bundles, pause/resume, result schemas, executor/profile policy, fallback, and no-write enforcement.", "files": ["tests/test_prd_workflows.py", "scripts/prd_workflows.py", "scripts/prd_reporting.py", "scripts/prd_substrate.py"], "sources": ["PRD-REQ-052", "PRD-NFR-029", "PRD-NFR-030", "PRD-ACC-066", "ARCH-COMP-043", "ARCH-IF-037", "ARCH-DEC-033"], "validation": "IMP-VAL-057", "complexity": "large", "confidence": "high", "risk": "high", "status": "complete"},
    {"id": "IMP-TASK-061", "phase": "IMP-PHASE-024", "summary": "Write failing interface tests; expose catalog, actions, audit, plan, run, resume, status, cancel, and retry through CLI, MCP, and read-only UTCP with worker guards.", "files": ["tests/test_prd_workflows.py", "tests/node/server.test.cjs", "mcp/server.cjs", "scripts/prd_tools.py", "utcp.json"], "sources": ["PRD-REQ-054", "PRD-ACC-068", "ARCH-COMP-044", "ARCH-IF-038"], "validation": "IMP-VAL-058", "complexity": "large", "confidence": "high", "risk": "medium", "status": "complete"},
    {"id": "IMP-TASK-062", "phase": "IMP-PHASE-025", "summary": "Write failing deterministic-action integration tests; register config/state/gate/graph/report/drift/test-plan/reflection/request/evidence/install/release actions with explicit metadata and receipts.", "files": ["tests/test_workflow_actions.py", "scripts/prd_workflows.py", "scripts/prd_config.py", "scripts/prd_gate.py"], "sources": ["PRD-REQ-051", "PRD-REQ-055", "PRD-ACC-065", "PRD-ACC-069", "ARCH-COMP-042", "ARCH-COMP-045", "ARCH-IF-036"], "validation": "IMP-VAL-059", "complexity": "x-large", "confidence": "medium", "risk": "high", "status": "complete"},
    {"id": "IMP-TASK-063", "phase": "IMP-PHASE-025", "summary": "Write failing lifecycle/hook tests; ship complete definitions for session, intake, planning, debugging, review, verification, closeout, maintenance, install/update, and release; route supported hooks/skills through them.", "files": ["tests/test_workflow_lifecycle.py", "templates/workflows.json", ".prd_plugin/hooks/prd_hook_dispatch.py", "skills/"], "sources": ["PRD-REQ-048", "PRD-REQ-055", "PRD-ACC-062", "PRD-ACC-069", "ARCH-COMP-045", "ARCH-IF-039", "ARCH-DEC-036"], "validation": "IMP-VAL-060", "complexity": "x-large", "confidence": "medium", "risk": "high", "status": "complete"},
    {"id": "IMP-TASK-064", "phase": "IMP-PHASE-026", "summary": "Write failing config/migration tests; add workflow controls, WFR prefix/state, additive installer migration, protected history, script scope, host mirrors, commands, and templates.", "files": ["tests/test_prd_install.py", "tests/test_unified_config.py", ".prd_plugin/config.json", "templates/", "scripts/prd_install.py", "commands/"], "sources": ["PRD-REQ-053", "PRD-REQ-056", "PRD-ACC-067", "PRD-ACC-070", "ARCH-COMP-046", "ARCH-DEC-035", "ARCH-DEC-037"], "validation": "IMP-VAL-061", "complexity": "x-large", "confidence": "high", "risk": "high", "status": "complete"},
    {"id": "IMP-TASK-065", "phase": "IMP-PHASE-026", "summary": "Update all host skills, method docs, README, install matrix, ingest manual, raw knowledge, wiki, examples, configuration guidance, and compatibility/migration documentation.", "files": ["AGENTS.md", "README.md", "docs/", "raw/", "wiki/", "skills/", "templates/repo-skeleton/"], "sources": ["PRD-REQ-055", "PRD-REQ-056", "PRD-NFR-032", "PRD-ACC-070", "ARCH-COMP-046"], "validation": "IMP-VAL-062", "complexity": "x-large", "confidence": "high", "risk": "medium", "status": "complete"},
    {"id": "IMP-TASK-066", "phase": "IMP-PHASE-027", "summary": "Perform traceability, security, compatibility, determinism-coverage, code-review, and CHML audits; fix and re-audit repeatedly until every severity is zero.", "files": ["tests/", "scripts/", ".prd_plugin/state/", "docs/", "wiki/"], "sources": ["PRD-REQ-057", "PRD-ACC-071", "ARCH-RISK-025", "ARCH-RISK-026", "ARCH-RISK-027", "ARCH-RISK-028", "ARCH-RISK-029", "ARCH-RISK-030", "ARCH-RISK-031", "ARCH-RISK-032"], "validation": "IMP-VAL-063", "complexity": "large", "confidence": "high", "risk": "high", "status": "complete"},
    {"id": "IMP-TASK-067", "phase": "IMP-PHASE-027", "summary": "Run one release-wide verification, record evidence/change/decision state, bump version after clean gap audit, validate package, merge, push main, and push annotated release tag.", "files": ["package.json", ".codex-plugin/plugin.json", ".prd_plugin/state/", "templates/releases.json", "docs/prd-plugin-ingest-manual.html"], "sources": ["PRD-REQ-057", "PRD-ACC-072", "ARCH-COMP-046"], "validation": "IMP-VAL-064", "complexity": "large", "confidence": "high", "risk": "high", "status": "complete"}
  ],
  "validations": [
    {"id": "IMP-VAL-055", "method": "Focused catalog/action tests prove strict schema, hashes, references, allowlists, metadata, and zero catalog findings.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-056", "method": "Focused state-machine tests prove transitions, atomic WFR persistence, idempotency, retry/resume/cancel, receipts, and postconditions.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-057", "method": "Focused judgment tests prove source and schema validation, pause/resume binding, provider neutrality, deterministic fallback, and no direct writes.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-058", "method": "CLI/MCP/UTCP parity tests prove bounded management operations and worker mutation guards.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-059", "method": "Action integration tests prove deterministic consumers return typed receipts and enforce declared authority/idempotency.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-060", "method": "Lifecycle and cross-host tests prove complete use-case coverage and LLM calls only at declared judgment steps.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-061", "method": "Config/installer/parity tests prove complete additive downstream delivery and protected user configuration/run history.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-062", "method": "Documentation, skill, template, wiki, command, manual, and install-matrix parity/lint checks report zero gaps.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-063", "method": "Repeated CRAFTE/CHML, traceability, state, security, compatibility, and determinism-coverage audits report zero findings.", "evidence": ["EV-084"]},
    {"id": "IMP-VAL-064", "method": "Release-wide tests, local workflow, state/gate/config/gap/release/wiki/manual/package checks, clean diff, remote main/tag push, and publication convention complete.", "evidence": ["EV-084", "EV-085", "EV-086"]}
  ],
  "dependencies": [
    "Current unified configuration, MCP state server, hook dispatcher, installer, graph, gate, reporting, Substrate, and verification-plan components remain available as registered action implementations.",
    "AI-Collab executes optional judgment/impact requests but never owns canonical PRD Plugin writes.",
    "No parallel writers are used in this implementation; canonical state and ID allocation remain single-writer."
  ],
  "risks_and_rollback": [
    "Keep existing specialized actions independently callable; disabling workflows returns entrypoints to their current direct behavior during rollback.",
    "Definitions are managed/versioned files while config and workflow-run history are protected and migrated additively.",
    "External/mutation-capable custom actions remain off by default and cannot be enabled by a workflow definition alone."
  ],
  "tracking_ids": ["TRK-101", "TRK-102", "TRK-103", "TRK-104", "TRK-105"]
}
