Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions examples/adversarial-implementation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ The table is ordered. Missing or unknown facts never become false or null.
| Any `decisions.openQuestions` item | Hold before paid roles; show the unanswered question and evidence |
| Valid non-null migration record and `sharedApi.needed=true` | Existing Planner foundation and representative validation, then remaining consumer implementation, selected review and retirement |
| `migration=null`, `sharedApi.needed=false`, `implementation.ready=true` | Direct Implementor, then existing impact-selected independent review |
| `migration=null`, `sharedApi.needed=false`, `implementation.ready=false` | Ordinary Planner plan/evidence, then Implementor and selected review |
| `migration=null`, `sharedApi.needed=true`, either readiness value | Ordinary Planner plan/evidence, then one Implementor for necessary API work and consumers, followed by selected review |
| `migration=null`, `sharedApi.needed=false`, `implementation.ready=false` | Ordinary Planner plan/evidence, with original Architect discovery when requested, then the same Planner handoff to Implementor and selected review |
| `migration=null`, `sharedApi.needed=true`, either readiness value | Ordinary Planner plan/evidence, with original Architect discovery when requested, then the same Planner handoff to one Implementor for necessary API work and consumers, followed by selected review |

```text
Normal run.md launch
Expand All @@ -123,7 +123,9 @@ Justified migration record? (requires sharedApi.needed=true)
v
Shared API needed?
| yes -----------------------> STANDARD
| Planner plan/evidence -> Implementor
| Planner plan/evidence
| -> original Architect if discovery needed
| -> same Planner -> Implementor
| -> impact-selected review
| no
v
Expand Down Expand Up @@ -155,6 +157,17 @@ existing Ticket record; migration returns the existing Adversarial result.
Provider and persistence failures retain their existing handling. Preserve first
failure output and partial effects before another attempt.

The ordinary Ticket starts before the first Planner call. A validated
`needs_discovery` request reaches the original Architect and returns its answer
to the same Planner. Only that Planner's complete handoff starts implementation.
The initial journey runs at most those three discovery calls. Another discovery
request returns `status=paused`, `dispatchable=true`, `hold=null` and the exact
pending gate. Save the complete returned record and advance it with `continue.md
--props-record /absolute/path/to/ticket-record.json --props-steps 1`.
Planning and discovery must leave source clean at the exact launch revision,
including when a reply is rejected or absent. They require no signed feedback
commit. Routing consumes and resets none of the three correction allowances.

An occupied fresh-work directory holds; it is never an implicit retry or
continuation. An ordinary command's diagnostic journal is not a continuation
checkpoint. Reconcile its saved calls and partial effects before new work. In a
Expand Down Expand Up @@ -253,7 +266,12 @@ for complete/pass. Explicit conflicting fields remain errors. The Implementor
still supplies its actual resulting commit, and every role supplies its real
verdict, findings and evidence. The existing zero-response-correction option
continues to validate and retain a reply at zero; missing substantive facts are
never synthesized to make a reply pass.
never synthesized to make a reply pass. `discoveryRequests[].role` and
`discoveryGaps[].request.role` name the invoked reporting actor. A Planner
requesting Architect discovery still names `planner` as author; `next.role`
names `architect` as successor. Explicit contradictory authors are rejected.
The raw reply, rejection and disposition remain inspectable without becoming a
canonical result.

Acceptance clauses preserve their original source and wording through delivery.
A reviewer reports a material ambiguity as blocked instead of strengthening a
Expand Down Expand Up @@ -346,7 +364,7 @@ Here `request` is the prepared phase request above and `documents` is the
selected input map returned by `<Ticket.Documents>`. Keep the original session
and reserved attempts when changing this limit at a completed phase boundary.

To advance a saved `Ticket.Run` or `Ticket.Continue` record, pass that complete
To advance a saved ordinary `run.md`, `Ticket.Run` or `Ticket.Continue` record, pass that complete
record rather than reconstructing its assignment or artifact paths:

```bash
Expand All @@ -356,7 +374,11 @@ deno task xmd run --allow-absolute examples/adversarial-implementation/continue.
```

The returned record preserves the original manifest, sessions, documents, calls
and correction counts. Each step executes at most one recorded role. Held and
and correction counts, including a pre-implementation planning checkpoint.
Each explicit step executes at most one recorded role and joins settlement.
A dispatchable pause names its next gate and continuation action. A genuine
hold is nondispatchable and retains its pending assignment and reconciliation
reason. Held and
completed records return without a prompt. This entry does not clear a hold or
retry an uncertain execution. Resolve the recorded cause before preparing a
continuation, and preserve the original evidence. Capture the complete output
Expand Down Expand Up @@ -390,7 +412,8 @@ refuses editorial assignments; technical handoffs and API documentation remain
part of the roles' work.

Architect is conditional: reserving its conversation name starts no discovery
call. A Planner can return `needs_architect` with one structural question. An
call. An ordinary Planner returns `needs_discovery` with its concrete structural
question; the foundation route retains its `needs_architect` handoff. An
implemented change's impact selects architecture review. Existing repository
rules still govern material product decisions and architectural choices.
When the API foundation has structural impact, Architect reviews that committed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ Communicate the document sections relevant to this ticket in result.contract. Re
Use assignment.contract for the Architect-selected sections and ticket requirements. Omit result.contract; Preparation carries the existing packet forward. Identify a precise missing fact or a named document change in the handoff when the packet needs an Architect refresh. Existing mandatory reading requirements still apply.
</If>

Use discoveryRequests to name reusable questions as part of your first meaningful assignment; do not add a preliminary call merely to request them. Give each request a stable key, your role, a concrete question, neededFor, evidenceNeeded and the originating assignment or feedback reference. Read supplied answers first. Search for a precise missing fact or a named change, rather than repeating an earlier discovery walk. Tools remain available and mandatory readings remain required.
Use discoveryRequests to name reusable questions as part of your first meaningful assignment; do not add a preliminary call merely to request them. Give each request a stable key, role={props.role} (the actual invoked author), a concrete question, neededFor, evidenceNeeded and the originating assignment or feedback reference. Read supplied answers first. Search for a precise missing fact or a named change, rather than repeating an earlier discovery walk. Tools remain available and mandatory readings remain required.

Keep discoveryRequests[].role and discoveryGaps[].request.role equal to {props.role}. These fields name you, the reporting actor. next.role names the requested successor; requesting Architect does not make Architect the request author. Never relabel an explicit contradictory author.

Return discoveryGaps for preparation that missed something: the request, searched references, open/resolved status and actual evidence. An open gap returns needs_discovery and stops productive successors. When you resolved the gap within this assignment, retain it as resolved so later preparation can improve without repeating the investigation. A resolved gap requires evidence. Record toolCalls and elapsedMs only when measured; use null when unavailable. Return empty arrays when there are no requests or gaps. Never invent costs, proof or answers to complete a packet.

Expand Down Expand Up @@ -104,7 +106,9 @@ Reference individual UTF-8 text or JSON files in artifacts, evidence and handoff
Return exactly one JSON object conforming to this contract, without Markdown fences or surrounding prose. The handoff field is the complete ready-to-send request for the next owner; only that field becomes the next request. Artifacts and evidence travel as structured references. For a command on an uncommitted candidate, use evidence.revision=null and candidate=the retained candidate/command metadata path; a base HEAD is not its tested revision. Use a commit SHA only when the tested inputs correspond to that commit. Report observations as observations; schema validation does not establish test results, approvals or delivery readiness.
<Phase.Schema as="schemas" />
<Let as="phaseOutcome" value={schemas.result.allOf[["discovery","implementation","review"].indexOf(props.assignment.phase)].then.properties.outcome} />
<Let as="promptContract" value={{type:schemas.result.type,required:[...schemas.result.required.filter(name => !["phase","work",...(props.assignment.phase === "implementation" ? [] : ["revision"])].includes(name)),"discoveryRequests","discoveryGaps"],additionalProperties:false,properties:{...schemas.result.properties,phase:{const:props.assignment.phase},work:{const:props.assignment.work},outcome:phaseOutcome,contract:props.role === "architect" && props.assignment.phase === "discovery" ? schemas.result.properties.contract : undefined},$defs:schemas.result.$defs}} />
<Let as="authorRequest" value={{...schemas.result.properties.discoveryRequests.items,properties:{...schemas.result.properties.discoveryRequests.items.properties,role:{const:props.role}}}} />
<Let as="authorGap" value={{...schemas.result.properties.discoveryGaps.items,properties:{...schemas.result.properties.discoveryGaps.items.properties,request:authorRequest}}} />
<Let as="promptContract" value={{type:schemas.result.type,required:[...schemas.result.required.filter(name => !["phase","work",...(props.assignment.phase === "implementation" ? [] : ["revision"])].includes(name)),"discoveryRequests","discoveryGaps"],additionalProperties:false,properties:{...schemas.result.properties,discoveryRequests:{...schemas.result.properties.discoveryRequests,items:authorRequest},discoveryGaps:{...schemas.result.properties.discoveryGaps,items:authorGap},phase:{const:props.assignment.phase},work:{const:props.assignment.work},outcome:phaseOutcome,contract:props.role === "architect" && props.assignment.phase === "discovery" ? schemas.result.properties.contract : undefined},$defs:schemas.result.$defs}} />
<Let as="resultContract" value={JSON.stringify(promptContract)} />
{resultContract}
</Output>
21 changes: 19 additions & 2 deletions examples/adversarial-implementation/components/Ticket/Advance.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@ returns: {type: object}
A decision or contract conflict holds the ticket for its existing approval gate.
A correction clears prior verdicts. Readiness requires every selected reviewer to
PASS the same signed implementation SHA; it does not authorize delivery or merge.
Selected feedback documents remain available across reviews and corrections.

<Let as="state" value={props.pending.checkpoint} />
<Let as="result" value={props.result} />
<Let as="call" value={props.pending.call} />
<If condition={call.assignment.phase === "discovery"}>
<Phase.Next result={result} successor={result.outcome === "escalate" ? call.assignment.phase : call.assignment.continuation.phase} role={result.outcome === "escalate" ? call.role : call.assignment.continuation.role} as="next" />
<Let as="held" value={next.phase === "hold"} />
<Let as="assignment" value={state.assignment} />
<Let as="gate" value={state.gate} />
<If condition={!held}>
<Phase.Preparation from={{assignment:call.assignment,result,next}} target={next.target} as="prepared" />
<Let as="gate" value={next.target === "implementation" ? "implementation" : next.role === "planner" ? "planning" : "architect-discovery"} />
<Let as="continuation" value={gate === "planning" ? {phase:"implementation",role:"implementor"} : gate === "architect-discovery" ? {phase:"discovery",role:"planner"} : call.assignment.continuation} />
<Let as="assignment" value={{...prepared.assignment,continuation}} />
</If>
<Return value={{...state,gate,assignment,status:held ? "hold" : "running",dispatchable:!held && props.pending.execution.status !== "failed",hold:held ? {kind:result.outcome,reason:result.handoff} : null,discovery:[...(state.discovery ?? []),{role:call.role,revision:result.revision,result:props.pending.resultPath,requests:result.discoveryRequests ?? [],gaps:result.discoveryGaps ?? []}]}} />
</If>
<If condition={call.assignment.phase !== "discovery"}>
<Let as="correction" value={result.outcome === "changes_required" || result.outcome === "missing_evidence"} />
<Let as="round" value={state.round + (correction ? 1 : 0)} />
<Let as="held" value={["blocked","needs_decision","needs_discovery"].includes(result.outcome) || correction && round > props.pending.manifest.maxCorrections} />
Expand All @@ -33,5 +48,7 @@ PASS the same signed implementation SHA; it does not authorize delivery or merge
<Let as="ready" value={!held && !correction && ["pass","complete"].includes(result.outcome) && remaining.length === 0} />
<Let as="gate" value={held || result.outcome === "escalate" ? state.gate : correction ? "implementation" : ready ? "feedback-ready" : remaining[0] + "-review"} />
<Let as="status" value={held ? "hold" : ready ? "feedback_ready" : props.pending.execution.status === "failed" ? "paused" : "running"} />
<Let as="assignment" value={{...props.pending.manifest.assignment,phase:gate === "implementation" ? "implementation" : "review",assessment:reviewPolicy.assessment,reviewKind:reviewPolicy.kind,revision,priorRevision:props.pending.manifest.assignment.revision,request:result.handoff,handoffInputs:result.handoffInputs ?? [],changedPaths:props.observation.changedPaths,artifacts:[...result.artifacts,props.observation.path],evidence:result.evidence,findings:result.findings,contract:result.contract ?? props.pending.manifest.assignment.contract ?? null}} />
<Return value={{...state,status,dispatchable:!held && !ready && props.pending.execution.status !== "failed",round,gate,revision,reviews,reviewPolicy,exactApproval,exactReview,assignment,feedbackInputs:result.outcome === "complete" && call.role === "implementor" ? result.handoffInputs ?? [] : state.feedbackInputs ?? [],discovery:[...(state.discovery ?? []),...((result.discoveryRequests?.length ?? 0) + (result.discoveryGaps?.length ?? 0) > 0 ? [{role:call.role,revision:result.revision,result:props.pending.resultPath,requests:result.discoveryRequests ?? [],gaps:result.discoveryGaps ?? []}] : [])],feedback:result.outcome === "complete" && call.role === "implementor" ? [props.pending.resultPath,props.observation.path] : state.feedback,hold:held ? {kind:correction ? "correction_bound" : result.outcome,reason:result.handoff} : null}} />
<Let as="assignment" value={{...props.pending.manifest.assignment,phase:gate === "implementation" ? "implementation" : "review",assessment:reviewPolicy.assessment,reviewKind:reviewPolicy.kind,revision,priorRevision:props.pending.manifest.assignment.revision,request:result.handoff,handoffInputs:result.handoffInputs ?? [],changedPaths:props.observation.changedPaths,artifacts:[...result.artifacts,props.observation.path],evidence:result.evidence,findings:result.findings,contract:result.contract ?? state.assignment.contract ?? null}} />
<Return value={{...state,status,dispatchable:!held && !ready && props.pending.execution.status !== "failed",round,gate,revision,reviews,reviewPolicy,exactApproval,exactReview,assignment,feedbackInputs:result.outcome === "complete" && call.role === "implementor" ? [...new Set([...(state.feedbackInputs ?? []),...(state.assignment.handoffInputs ?? []),...(result.handoffInputs ?? [])])] : state.feedbackInputs ?? [],discovery:[...(state.discovery ?? []),...((result.discoveryRequests?.length ?? 0) + (result.discoveryGaps?.length ?? 0) > 0 ? [{role:call.role,revision:result.revision,result:props.pending.resultPath,requests:result.discoveryRequests ?? [],gaps:result.discoveryGaps ?? []}] : [])],feedback:result.outcome === "complete" && call.role === "implementor" ? [props.pending.resultPath,props.observation.path] : state.feedback,hold:held ? {kind:correction ? "correction_bound" : result.outcome,reason:result.handoff} : null}} />

</If>
Loading
Loading