feat: promote draft decisions when creating plans

Promote referenced drafts deterministically with system provenance, causal
Plan links, supersession history and recovery from publication failures.
Preserve direct human approval and historical records.

Add JVM and native regression coverage and update the portable protocol.
Record the WRK-0007 importer decision and six-step plan, and complete
WRK-0008 with verification evidence.
This commit is contained in:
2026-11-16 12:35:06 +00:00
parent 8572f43149
commit bc9fe8152c
101 changed files with 5322 additions and 14 deletions
+23 -1
View File
@@ -263,7 +263,7 @@ empty narrative. Narrative uses document version 2; the JSON `text` field remain
Statuses: DRAFT, ACCEPTED, REJECTED, SUPERSEDED. `decision update` changes only drafts,
recording actor/reason and a snapshot. Lists replace entire lists; explicit `--clear-*`
options clear them. `--text`/`--text-file` supplies narrative. Acceptance requires
options clear them. `--text`/`--text-file` supplies narrative. Direct acceptance requires
nonblank context/approach/rationale, actor/reason and `--human-approved`. This flag is
an attestation that approval occurred, not authenticated identity or OS permission.
An agent cannot infer approval from a proposal or a prior status. Rejection retains
@@ -271,6 +271,18 @@ the proposal. `decision revise` creates a new draft linked to an accepted/reject
DEC. Accepting that draft supersedes the prior accepted DEC, preserving both records.
Operational choices during execution remain distinct from these formal commitments.
Creating a Plan from a draft DEC is a separate deterministic acceptance route.
The framework records `origin: SYSTEM_PLAN`, the causal `planId`, actor
`system:planning` and `humanApproved: false`; it does not invent a direct human
attestation. Context, approach and rationale must still be nonblank. Referenced
drafts are promoted and their accepted predecessors are superseded with the same
Plan provenance. Already accepted DECs stay byte-identical; rejected/superseded
DECs and conflicting replacements cannot be used to create the Plan. Optional
approval `origin`/`planId` fields are absent on historical direct approvals, whose
meaning and serialization remain unchanged. Readers predating this capability
cannot read new system-promotion records; use the updated CLI, without rewriting
historical approvals.
## Topics, surveys and adapter runs
[Discussion refinement contracts](discussion-slice.md) specify TOP/SVY/DSP/RUN records,
@@ -355,6 +367,16 @@ timestamps and revision metadata. Each step (`TSK-0001`, decimal and plan-local)
records title/description, acceptance criteria, dependencies, status, result, evidence
and modification time. Statuses match Work's five values but describe external work.
`plan create --decision DEC` promotes referenced DRAFT decisions automatically,
without an adapter or LLM. Input, decision and revision-history validation runs
before promotion, under the project lock. Ordinary publication failures roll back
the attempted Plan and promotions. Publication is atomic per file, not a crash-proof
multi-file transaction: interrupted writes or failed recovery remain inspectable
with `work validate`. Validation checks the causal Plan's first revision, so later
Plan reference edits retain the original promotion provenance and cannot invent it.
Creating another Plan from an already accepted DEC does not add an approval.
`plan update` does not promote drafts; review its references before changing them.
Step dependencies must exist in that plan and be acyclic. Starting or completing a
step requires completed dependencies and accepted referenced decisions. Completion
requires result text (`--reason`) and owned evidence. `plan status COMPLETED` requires