From 42d079108662a6d6238591246e09c1832171da3d Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Tue, 3 Nov 2026 12:06:14 -0500 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20Retain=20ordinary=20planning?= =?UTF-8?q?=20discovery=20in=20Ticket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/adversarial-implementation/README.md | 37 +++++- .../components/Phase/Instructions.md | 8 +- .../components/Ticket/Advance.md | 20 ++- .../components/Ticket/Continue.md | 27 +++- .../components/Ticket/Gate.md | 2 + .../components/Ticket/Run.md | 2 +- .../components/Ticket/Schema.md | 5 +- .../components/Ticket/Settle.md | 31 ++++- .../components/Ticket/Start.md | 11 +- examples/adversarial-implementation/run.md | 24 +--- .../tests/Friction.test.md | 63 ++++++++- .../tests/Implementation.test.md | 120 +++++++++++++++--- .../tests/PlanningCase.md | 17 +++ .../tests/ProductionRole.test.md | 19 +++ .../tests/components/Fixture/Entry.md | 4 +- .../tests/components/Phase/Role.md | 26 +++- .../fixtures/initial-planning-incidents.json | 20 +++ 17 files changed, 362 insertions(+), 74 deletions(-) create mode 100644 examples/adversarial-implementation/tests/PlanningCase.md create mode 100644 examples/adversarial-implementation/tests/fixtures/initial-planning-incidents.json diff --git a/examples/adversarial-implementation/README.md b/examples/adversarial-implementation/README.md index 4d3560c4b..b690d2468 100644 --- a/examples/adversarial-implementation/README.md +++ b/examples/adversarial-implementation/README.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -346,7 +364,7 @@ Here `request` is the prepared phase request above and `documents` is the selected input map returned by ``. 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 @@ -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 @@ -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 diff --git a/examples/adversarial-implementation/components/Phase/Instructions.md b/examples/adversarial-implementation/components/Phase/Instructions.md index 6a527e323..a20116e5c 100644 --- a/examples/adversarial-implementation/components/Phase/Instructions.md +++ b/examples/adversarial-implementation/components/Phase/Instructions.md @@ -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. -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. @@ -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","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}} /> + + + !["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}} /> {resultContract} diff --git a/examples/adversarial-implementation/components/Ticket/Advance.md b/examples/adversarial-implementation/components/Ticket/Advance.md index 9c00d45b6..2176f9627 100644 --- a/examples/adversarial-implementation/components/Ticket/Advance.md +++ b/examples/adversarial-implementation/components/Ticket/Advance.md @@ -20,6 +20,20 @@ PASS the same signed implementation SHA; it does not authorize delivery or merge + + + + + + + + + + + + + + props.pending.manifest.maxCorrections} /> @@ -33,5 +47,7 @@ PASS the same signed implementation SHA; it does not authorize delivery or merge - - 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}} /> + + 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}} /> + + diff --git a/examples/adversarial-implementation/components/Ticket/Continue.md b/examples/adversarial-implementation/components/Ticket/Continue.md index a6af8cc33..d99a608f2 100644 --- a/examples/adversarial-implementation/components/Ticket/Continue.md +++ b/examples/adversarial-implementation/components/Ticket/Continue.md @@ -14,17 +14,34 @@ returns: {type: object} Continue preserves original sessions, delivered inputs and the correction bound. A held or completed checkpoint returns unchanged. Each Step joins before another -Step starts. Omitting maxSteps retains Run's initial bounded loop. +Step starts. Omitting maxSteps runs at most the initial Planner, Architect and +returned Planner journey, then the implementation loop. Further discovery pauses +with its prepared assignment. An explicit maxSteps bounds outstanding role calls. - + + + + call.assignment.phase === "discovery")} /> += 3 || discoveryCalls.length === 1 && (discoveryCalls[0].role !== "planner" || record.checkpoint.gate !== "architect-discovery") || discoveryCalls.length === 2 && (discoveryCalls[1].role !== "architect" || record.checkpoint.gate !== "planning")}> + + + + + + + + + + - + + - - + + diff --git a/examples/adversarial-implementation/components/Ticket/Gate.md b/examples/adversarial-implementation/components/Ticket/Gate.md index 9344a6f9d..5effec87a 100644 --- a/examples/adversarial-implementation/components/Ticket/Gate.md +++ b/examples/adversarial-implementation/components/Ticket/Gate.md @@ -18,6 +18,8 @@ Implementor; their actual impact selects the next required reviews. - - Continue an accepted implementation through its selected original reviewers. Use . Reopen the same unfinished REPL entry to resume; failures and unanswered decisions hold the ticket. props: diff --git a/examples/adversarial-implementation/components/Ticket/Schema.md b/examples/adversarial-implementation/components/Ticket/Schema.md index 99d47394f..a6f7723c2 100644 --- a/examples/adversarial-implementation/components/Ticket/Schema.md +++ b/examples/adversarial-implementation/components/Ticket/Schema.md @@ -5,6 +5,7 @@ props: {type: object, additionalProperties: false} returns: {type: object} --- + + + + + + + + + + +{sourceCheck.output} + + + + + + @@ -36,7 +55,7 @@ Replies are checked through the same phase contract on live execution and replay - + @@ -44,6 +63,10 @@ Replies are checked through the same phase contract on live execution and replay + + + + ```bash exec as="ancestry" git merge-base --is-ancestor {pending.manifest.assignment.revision} {revision} @@ -58,7 +81,6 @@ git merge-base --is-ancestor {pending.manifest.assignment.revision} {revision} - @@ -71,8 +93,9 @@ git merge-base --is-ancestor {pending.manifest.assignment.revision} {revision} + entry.revision === null ? [entry.artifact,entry.candidate] : [entry.artifact])]} documents={pending.documents} as="documents" /> - + {observationText} @@ -88,3 +111,5 @@ git merge-base --is-ancestor {pending.manifest.assignment.revision} {revision} + + diff --git a/examples/adversarial-implementation/components/Ticket/Start.md b/examples/adversarial-implementation/components/Ticket/Start.md index 52cc750f5..112fd0888 100644 --- a/examples/adversarial-implementation/components/Ticket/Start.md +++ b/examples/adversarial-implementation/components/Ticket/Start.md @@ -1,6 +1,6 @@ --- description: >- - Validate an accepted implementation manifest and prepare its first checkpoint. + Validate an ordinary planning or accepted implementation manifest and prepare its first checkpoint. Use . props: type: object @@ -11,7 +11,7 @@ props: returns: {type: object} --- -The ticket begins with its accepted implementation and retains three distinct +The ticket begins with ordinary planning or accepted implementation and retains three distinct original sessions. Provider selection and initialization standing come from the manifest; a result cannot replace them. @@ -29,11 +29,12 @@ manifest; a result cannot replace them. - - + + + role.session)).size !== 3}> - [name,role.initialized])),hold:null}} /> + [name,role.initialized])),hold:null}} /> diff --git a/examples/adversarial-implementation/run.md b/examples/adversarial-implementation/run.md index 4a732a250..65da06405 100644 --- a/examples/adversarial-implementation/run.md +++ b/examples/adversarial-implementation/run.md @@ -97,30 +97,10 @@ mkdir -- {directoryPath} - - - - all.findIndex(other => other.path === input.path) === index)} assignment={planning} attempt={task.directory + "/planning"} successor="implementation" nextRole="implementor" as="plan" /> - - -{execution.output} - - - - -{savedText} - - - - - -{selection.output} - documents[path])} /> - - + - + diff --git a/examples/adversarial-implementation/tests/Friction.test.md b/examples/adversarial-implementation/tests/Friction.test.md index f645f2a2f..33b5fa802 100644 --- a/examples/adversarial-implementation/tests/Friction.test.md +++ b/examples/adversarial-implementation/tests/Friction.test.md @@ -292,7 +292,7 @@ git rev-parse HEAD {child.stdout} - + @@ -308,3 +308,64 @@ git rev-parse HEAD + + + + + +```bash exec as="base" +git rev-parse HEAD +``` + + +Accepted immutable scope. + + + + +{child.stdout} + + + + +Mutable original changed after delivery. + + +{child.stdout} + + + + + + input.path === reference).content} expected="Accepted immutable scope." /> + + +{child.stdout} + + + + + input.path)} expected={architect.calls[1].resultValue.handoffInputs.filter(path => !architect.deliveredInputs["original-planner"].includes(path))} /> + + + + + + + + + +{child.stdout} + + + + + input.path)} expected={returned.calls[2].resultValue.handoffInputs.filter(path => !returned.deliveredInputs["original-architect"].includes(path))} /> + + + + + + call.sourceValue.clean && call.sourceValue.head === manifest.assignment.revision)} expected={true} /> + + diff --git a/examples/adversarial-implementation/tests/Implementation.test.md b/examples/adversarial-implementation/tests/Implementation.test.md index de7f1f5cb..93ef92824 100644 --- a/examples/adversarial-implementation/tests/Implementation.test.md +++ b/examples/adversarial-implementation/tests/Implementation.test.md @@ -38,8 +38,9 @@ git rev-parse HEAD - call.role)} expected={scenario.architecture ? ["implementor","architect","planner"] : ["implementor","planner"]} /> - call.session)} expected={scenario.architecture ? ["original-implementor","conditional-architect","original-planner"] : ["original-implementor","original-planner"]} /> + call.assignment.phase !== "discovery")} /> + call.role)} expected={scenario.architecture ? ["implementor","architect","planner"] : ["implementor","planner"]} /> + call.session)} expected={scenario.architecture ? ["original-implementor","conditional-architect","original-planner"] : ["original-implementor","original-planner"]} /> @@ -48,10 +49,10 @@ git rev-parse HEAD call.provider === task.providers[call.role])} expected={true} /> input.path === evidence).content} expected="Evidence A: accepted format behavior and focused consumer checks." /> - call.assignment.revision === work.revision)} expected={true} /> + call.assignment.revision === work.revision)} expected={true} /> - + {implementorText} @@ -59,7 +60,7 @@ git rev-parse HEAD - + {planningText} @@ -67,22 +68,22 @@ git rev-parse HEAD - + {assignmentText} - + {planText} - - input.path === plan.handoffInputs[0] && input.content.includes("bash consumer.sh"))} expected={true} /> - + + input.path === plan.handoffInputs[0] && input.content.includes("bash consumer.sh"))} expected={true} /> + input.path)} expected={plan.handoffInputs} /> - - + + - + @@ -196,13 +197,98 @@ git rev-parse HEAD {child.stdout} - - + + {resultText} - + - + + + + + + + +format() { printf '%s' "$1"; } + +```bash exec as="base" +git add api.sh +git -c commit.gpgsign=false commit -qm 'ordinary unsigned planning base' +git rev-parse HEAD +``` + + + +Accepted ordinary planning scope and frozen checks. + + + + +{child.stdout} + + + + + + call.role)} expected={["planner","architect","planner"]} /> + + + + + + [call.role,call.assignment.phase,call.initialize])} expected={[["planner","discovery",true],["architect","discovery",true],["planner","discovery",false],["implementor","implementation",true],["architect","review",false],["planner","review",false]]} /> + call.session)} expected={["original-planner","original-architect","original-planner","original-implementor","original-architect","original-planner"]} /> + call.provider === "codex")} expected={true} /> + call.sourceValue.clean && call.sourceValue.head === task.revision && call.observationValue.signature === null)} expected={true} /> + + JSON.stringify(call.assignment.contract) === JSON.stringify(contract))} expected={true} /> + + input.path === work.calls[1].resultValue.handoffInputs[0])} expected={true} /> + input.path === work.calls[2].resultValue.handoffInputs[0])} expected={true} /> + call.inputs.some(input => input.path === work.calls[2].resultValue.handoffInputs[0]))} expected={true} /> + input.path === evidence)} expected={false} /> + + + + + + + + + + + + + + + +{continuation.stdout} + + + + + +{text} + + + + +{text} + + + + + + + + + + + + + + diff --git a/examples/adversarial-implementation/tests/PlanningCase.md b/examples/adversarial-implementation/tests/PlanningCase.md new file mode 100644 index 000000000..5b4c6abfc --- /dev/null +++ b/examples/adversarial-implementation/tests/PlanningCase.md @@ -0,0 +1,17 @@ +--- +props: + type: object + properties: + record: {type: string} + required: [record] + additionalProperties: false +--- + + +{text} + + [input.path,input]))}} /> + + + + diff --git a/examples/adversarial-implementation/tests/ProductionRole.test.md b/examples/adversarial-implementation/tests/ProductionRole.test.md index f41a8491b..c9fffa34b 100644 --- a/examples/adversarial-implementation/tests/ProductionRole.test.md +++ b/examples/adversarial-implementation/tests/ProductionRole.test.md @@ -151,3 +151,22 @@ false + + + + + + + +{schemaText} + + + + + + + +{text} + incident.issue)} expected={[1075,1081]} /> + incident.validationCode === "metadata-8" && !incident.canonicalResultCreated && !incident.implementationStarted && !incident.rawRewritten && incident.responseCorrections === 0 && incident.source.startsWith("/private/tmp/"))} expected={true} /> + diff --git a/examples/adversarial-implementation/tests/components/Fixture/Entry.md b/examples/adversarial-implementation/tests/components/Fixture/Entry.md index 51825eb5e..db6a68a0a 100644 --- a/examples/adversarial-implementation/tests/components/Fixture/Entry.md +++ b/examples/adversarial-implementation/tests/components/Fixture/Entry.md @@ -2,7 +2,7 @@ props: type: object properties: - entry: {enum: [phase, continue, run, delivery-case]} + entry: {enum: [phase, continue, run, delivery-case, planning-case]} value: {type: object} raw: {type: string} taskPath: {type: [string, 'null'], default: null} @@ -20,7 +20,7 @@ returns: {type: object} ```bash exec as="location" pwd -P ``` - "'" + value.replaceAll("'","'\"'\"'") + "'").join(" ")} /> + "'" + value.replaceAll("'","'\"'\"'") + "'").join(" ")} /> ```bash exec as="child" set -e diff --git a/examples/adversarial-implementation/tests/components/Phase/Role.md b/examples/adversarial-implementation/tests/components/Phase/Role.md index fd926c5e1..c1808365e 100644 --- a/examples/adversarial-implementation/tests/components/Phase/Role.md +++ b/examples/adversarial-implementation/tests/components/Phase/Role.md @@ -23,7 +23,7 @@ props: - input.path),inputs:props.inputs,request:assignment.request,phase:assignment.phase}} /> + input.path),inputs:props.inputs,request:assignment.request,phase:assignment.phase,contract:assignment.contract}} /> Use the existing format API for the remaining consumer. Remove legacy.fixture, run bash consumer.sh, and return its signed feedback commit. @@ -34,8 +34,26 @@ printf '%s' 'Evidence B: mutable original after planning.' > {evidencePath} ``` - - + + + +Changed during read-only discovery. + + + + + + + +```bash exec as="otherRevision" +git rev-parse HEAD^ +``` + + + + + + @@ -74,7 +92,7 @@ git rev-parse HEAD - + diff --git a/examples/adversarial-implementation/tests/fixtures/initial-planning-incidents.json b/examples/adversarial-implementation/tests/fixtures/initial-planning-incidents.json new file mode 100644 index 000000000..f70857dc5 --- /dev/null +++ b/examples/adversarial-implementation/tests/fixtures/initial-planning-incidents.json @@ -0,0 +1,20 @@ +[ + { + "issue": 1075, + "source": "/private/tmp/xmd-host-absolute-1075-20261102/workflow-adoption/initial-planning-hold-reconciliation.json", + "validationCode": "metadata-8", + "canonicalResultCreated": false, + "implementationStarted": false, + "responseCorrections": 0, + "rawRewritten": false + }, + { + "issue": 1081, + "source": "/private/tmp/xmd-standard-acp-1081-20261102-1/normal-launch-1/planner-reconciliation.json", + "validationCode": "metadata-8", + "canonicalResultCreated": false, + "implementationStarted": false, + "responseCorrections": 0, + "rawRewritten": false + } +] From 9ca22e47d368d153557093a3e86044acd629e37c Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Tue, 3 Nov 2026 13:00:46 -0500 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9A=A1=20Reduce=20initial=20planning=20j?= =?UTF-8?q?ourney=20process=20startup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/Implementation.test.md | 86 +---------------- .../tests/components/Fixture/Execution.md | 29 ++++++ .../components/Fixture/InitialPlanning.md | 92 +++++++++++++++++++ 3 files changed, 126 insertions(+), 81 deletions(-) create mode 100644 examples/adversarial-implementation/tests/components/Fixture/Execution.md create mode 100644 examples/adversarial-implementation/tests/components/Fixture/InitialPlanning.md diff --git a/examples/adversarial-implementation/tests/Implementation.test.md b/examples/adversarial-implementation/tests/Implementation.test.md index 93ef92824..2458aa166 100644 --- a/examples/adversarial-implementation/tests/Implementation.test.md +++ b/examples/adversarial-implementation/tests/Implementation.test.md @@ -209,86 +209,10 @@ git rev-parse HEAD - - - - -format() { printf '%s' "$1"; } - -```bash exec as="base" -git add api.sh -git -c commit.gpgsign=false commit -qm 'ordinary unsigned planning base' -git rev-parse HEAD +'} /> + "'" + value.replaceAll("'","'\"'\"'") + "'").join(" ")} /> +```bash exec as="cases" +{runner} {caseArguments} ``` - - - -Accepted ordinary planning scope and frozen checks. - - - - -{child.stdout} - - - - - - call.role)} expected={["planner","architect","planner"]} /> - - - - - - [call.role,call.assignment.phase,call.initialize])} expected={[["planner","discovery",true],["architect","discovery",true],["planner","discovery",false],["implementor","implementation",true],["architect","review",false],["planner","review",false]]} /> - call.session)} expected={["original-planner","original-architect","original-planner","original-implementor","original-architect","original-planner"]} /> - call.provider === "codex")} expected={true} /> - call.sourceValue.clean && call.sourceValue.head === task.revision && call.observationValue.signature === null)} expected={true} /> - - JSON.stringify(call.assignment.contract) === JSON.stringify(contract))} expected={true} /> - - input.path === work.calls[1].resultValue.handoffInputs[0])} expected={true} /> - input.path === work.calls[2].resultValue.handoffInputs[0])} expected={true} /> - call.inputs.some(input => input.path === work.calls[2].resultValue.handoffInputs[0]))} expected={true} /> - input.path === evidence)} expected={false} /> - - - - - - - - - - - - - - - -{continuation.stdout} - - - - - -{text} - - - - -{text} - - - - - - - - - - - - - + diff --git a/examples/adversarial-implementation/tests/components/Fixture/Execution.md b/examples/adversarial-implementation/tests/components/Fixture/Execution.md new file mode 100644 index 000000000..4b957fd37 --- /dev/null +++ b/examples/adversarial-implementation/tests/components/Fixture/Execution.md @@ -0,0 +1,29 @@ +--- +props: + type: object + properties: + entry: {enum: [run, continue]} + value: {type: object} + repository: {type: string} + root: {type: string} + steps: {type: integer, minimum: 1} + required: [entry, value, repository, root] + additionalProperties: false +returns: {type: object} +--- + + +```bash exec as="location" +pwd -P +``` + + + + + + + + + +{receipt} + diff --git a/examples/adversarial-implementation/tests/components/Fixture/InitialPlanning.md b/examples/adversarial-implementation/tests/components/Fixture/InitialPlanning.md new file mode 100644 index 000000000..0afc1a239 --- /dev/null +++ b/examples/adversarial-implementation/tests/components/Fixture/InitialPlanning.md @@ -0,0 +1,92 @@ +--- +props: + type: object + properties: + root: {type: string} + required: [root] + additionalProperties: false +--- + + + + + + +format() { printf '%s' "$1"; } + +```bash exec as="base" +git add api.sh +git -c commit.gpgsign=false commit -qm 'ordinary unsigned planning base' +git rev-parse HEAD +``` + + + +Accepted ordinary planning scope and frozen checks. + + + + +{child.stdout} + + + + + + call.role)} expected={["planner","architect","planner"]} /> + + + + + + [call.role,call.assignment.phase,call.initialize])} expected={[["planner","discovery",true],["architect","discovery",true],["planner","discovery",false],["implementor","implementation",true],["architect","review",false],["planner","review",false]]} /> + call.session)} expected={["original-planner","original-architect","original-planner","original-implementor","original-architect","original-planner"]} /> + call.provider === "codex")} expected={true} /> + call.sourceValue.clean && call.sourceValue.head === task.revision && call.observationValue.signature === null)} expected={true} /> + + JSON.stringify(call.assignment.contract) === JSON.stringify(contract))} expected={true} /> + + input.path === work.calls[1].resultValue.handoffInputs[0])} expected={true} /> + input.path === work.calls[2].resultValue.handoffInputs[0])} expected={true} /> + call.inputs.some(input => input.path === work.calls[2].resultValue.handoffInputs[0]))} expected={true} /> + input.path === evidence)} expected={false} /> + + + + + + + + + + + + + + + +{continuation.stdout} + + + + + +{text} + + + + +{text} + + + + + + + + + + + + + From 08c7e9ccbebfdc616f747eb68ec3f3cfad86ff7c Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Tue, 3 Nov 2026 14:07:16 -0500 Subject: [PATCH 3/4] test: reduce remaining workflow journey startup --- .../tests/Implementation.test.md | 205 +--------------- .../components/Fixture/Implementation.md | 227 ++++++++++++++++++ 2 files changed, 229 insertions(+), 203 deletions(-) create mode 100644 examples/adversarial-implementation/tests/components/Fixture/Implementation.md diff --git a/examples/adversarial-implementation/tests/Implementation.test.md b/examples/adversarial-implementation/tests/Implementation.test.md index 2458aa166..dcdbfc656 100644 --- a/examples/adversarial-implementation/tests/Implementation.test.md +++ b/examples/adversarial-implementation/tests/Implementation.test.md @@ -7,209 +7,8 @@ printf '%s' "$XMD_EXAMPLE_COMMAND" ``` - - - - - -format() { printf '%s' "$1"; } - -```bash exec as="base" -git add api.sh -git commit -qm 'existing API' -git rev-parse HEAD -``` - - -Evidence A: accepted format behavior and focused consumer checks. - - - - - - -{child.stdout} - - - - call.assignment.phase !== "discovery")} /> - call.role)} expected={scenario.architecture ? ["implementor","architect","planner"] : ["implementor","planner"]} /> - call.session)} expected={scenario.architecture ? ["original-implementor","conditional-architect","original-planner"] : ["original-implementor","original-planner"]} /> - - - - - - call.provider === task.providers[call.role])} expected={true} /> - - input.path === evidence).content} expected="Evidence A: accepted format behavior and focused consumer checks." /> - call.assignment.revision === work.revision)} expected={true} /> - - - -{implementorText} - - - - - - - -{planningText} - - - - - - - -{assignmentText} - - -{planText} - - - - input.path === plan.handoffInputs[0] && input.content.includes("bash consumer.sh"))} expected={true} /> - - - input.path)} expected={plan.handoffInputs} /> - - - - - - - - - input.path === evidence).content} expected="Evidence A: accepted format behavior and focused consumer checks." /> - input.path === evidence).content} expected="Evidence A: accepted format behavior and focused consumer checks." /> - - - - - - - - - - - - - - - - - -```bash exec as="observed" -git rev-parse HEAD -``` - - - - -{initialText} - - - - -Uncommitted partial source. -Preserve this existing record. - - -{child.stdout} - - - - - - - - -```bash exec as="absent" -test -d {missingPath} -``` - - - - - - - - - - -```bash exec as="observed" -git rev-parse HEAD -``` - - - -Accepted scope except any named cancellation choice. - - - - - - - - -{child.stdout} - - - - - - - - - - - - - - -```bash exec as="observed" -git rev-parse HEAD -``` - - - -Accepted initial scope and checks. - - - - - -{child.stdout} - - - -{resultText} - - - - - - - - - -'} /> + +'} /> "'" + value.replaceAll("'","'\"'\"'") + "'").join(" ")} /> ```bash exec as="cases" {runner} {caseArguments} diff --git a/examples/adversarial-implementation/tests/components/Fixture/Implementation.md b/examples/adversarial-implementation/tests/components/Fixture/Implementation.md new file mode 100644 index 000000000..6a18edfe2 --- /dev/null +++ b/examples/adversarial-implementation/tests/components/Fixture/Implementation.md @@ -0,0 +1,227 @@ +--- +props: + type: object + properties: + root: {type: string} + command: {type: string} + required: [root, command] + additionalProperties: false +--- + + + + + + + + + +format() { printf '%s' "$1"; } + +```bash exec as="base" +git add api.sh +git commit -qm 'existing API' +git rev-parse HEAD +``` + + +Evidence A: accepted format behavior and focused consumer checks. + + + + + + + + + + + +{child.stdout} + + + + call.assignment.phase !== "discovery")} /> + call.role)} expected={scenario.architecture ? ["implementor","architect","planner"] : ["implementor","planner"]} /> + call.session)} expected={scenario.architecture ? ["original-implementor","conditional-architect","original-planner"] : ["original-implementor","original-planner"]} /> + + + + + + call.provider === task.providers[call.role])} expected={true} /> + + input.path === evidence).content} expected="Evidence A: accepted format behavior and focused consumer checks." /> + call.assignment.revision === work.revision)} expected={true} /> + + + +{implementorText} + + + + + + + +{planningText} + + + + + + + +{assignmentText} + + +{planText} + + + + input.path === plan.handoffInputs[0] && input.content.includes("bash consumer.sh"))} expected={true} /> + + + input.path)} expected={plan.handoffInputs} /> + + + + + + + + + input.path === evidence).content} expected="Evidence A: accepted format behavior and focused consumer checks." /> + input.path === evidence).content} expected="Evidence A: accepted format behavior and focused consumer checks." /> + + + + + + + + + + + + + + + + + +```bash exec as="observed" +git rev-parse HEAD +``` + + + + +{initialText} + + + + +Uncommitted partial source. +Preserve this existing record. + + + + + + + +{child.stdout} + + + + + + + + +```bash exec as="absent" +test -d {missingPath} +``` + + + + + + + + + + +```bash exec as="observed" +git rev-parse HEAD +``` + + + +Accepted scope except any named cancellation choice. + + + + + + + + +{child.stdout} + + + + + + + + + + + + + + +```bash exec as="observed" +git rev-parse HEAD +``` + + + +Accepted initial scope and checks. + + + + + +{child.stdout} + + + +{resultText} + + + + + + + + + + + From 00a5349200d74192fa3378f788d4f237b8582b24 Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Tue, 3 Nov 2026 16:21:42 -0500 Subject: [PATCH 4/4] fix: retain accepted plan across implementation handoffs --- .../components/Ticket/Advance.md | 3 +- .../tests/Friction.test.md | 86 +++++++++++++++++++ .../tests/components/Phase/Role.md | 28 +++++- 3 files changed, 112 insertions(+), 5 deletions(-) diff --git a/examples/adversarial-implementation/components/Ticket/Advance.md b/examples/adversarial-implementation/components/Ticket/Advance.md index 2176f9627..892ec4ce4 100644 --- a/examples/adversarial-implementation/components/Ticket/Advance.md +++ b/examples/adversarial-implementation/components/Ticket/Advance.md @@ -16,6 +16,7 @@ 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. @@ -48,6 +49,6 @@ PASS the same signed implementation SHA; it does not authorize delivery or merge - 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}} /> + 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}} /> diff --git a/examples/adversarial-implementation/tests/Friction.test.md b/examples/adversarial-implementation/tests/Friction.test.md index 33b5fa802..acff6eaf1 100644 --- a/examples/adversarial-implementation/tests/Friction.test.md +++ b/examples/adversarial-implementation/tests/Friction.test.md @@ -369,3 +369,89 @@ git rev-parse HEAD call.sourceValue.clean && call.sourceValue.head === manifest.assignment.revision)} expected={true} /> + + + + + +format() { printf '%s' "$1"; } + +```bash exec as="base" +git add api.sh +git commit -qm 'existing API' +git rev-parse HEAD +``` + + + +Accepted plan retention contract. + + + + +{child.stdout} + + + + + + +{child.stdout} + + call.resultValue === undefined)}> + [call.role,call.resultValue?.outcome])} expected={[["planner","complete"],["implementor","complete"],["architect","pass"],["planner","changes_required"]]} /> + + + + + + + +{text} + + input.path === planPath)} expected={[plan]} /> + input.path === implementationPath)} expected={[implementation]} /> + + + + + +```bash exec as="mutated" +printf '%s' 'Mutable plan file changed after capture.' > {quotedPlan} +``` + + + +{child.stdout} + + + + + + + +{child.stdout} + + + + + call.initialize)} expected={[true,true,true,false,false,false,false]} /> + call.session)} expected={["original-planner","original-implementor","original-architect","original-planner","original-implementor","original-architect","original-planner"]} /> + + + + call.role === role).flatMap(call => call.inputs)} /> + input.path === planPath)} expected={[plan]} /> + input.path === implementationPath)} expected={[implementation]} /> + input.path === correctedPath)} expected={[finished.documents[correctedPath]]} /> + + + +{text} + + + + input.path === planPath)} expected={[]} /> + + + diff --git a/examples/adversarial-implementation/tests/components/Phase/Role.md b/examples/adversarial-implementation/tests/components/Phase/Role.md index c1808365e..fc6d64bcb 100644 --- a/examples/adversarial-implementation/tests/components/Phase/Role.md +++ b/examples/adversarial-implementation/tests/components/Phase/Role.md @@ -14,6 +14,7 @@ props: --- + @@ -53,7 +54,7 @@ git rev-parse HEAD^ - + @@ -66,6 +67,12 @@ resize narrow . ./api.sh test "$(format consumer)" = consumer + +. ./api.sh +test "$(format consumer)" = consumer +printf '%s' '' + + ```bash exec as="check" bash consumer.sh ``` @@ -73,7 +80,7 @@ bash consumer.sh format() { printf '%s' "$1"; } unvalidated() { printf '%s' changed; } - + ```bash exec as="retired" git rm -q legacy.fixture ``` @@ -91,8 +98,21 @@ git rev-parse HEAD - - + + + + + + + +Corrected implementation evidence: bash consumer.sh passed. +Initial implementation evidence: bash consumer.sh passed. + +Correct the implementation while retaining its accepted plan. + + + +