Document adversarial implementation workflow WIP - #181
Conversation
PR #181: Document adversarial implementation workflow WIP11 files, +2787 / -0 Scope🔴 PR has 2787 lines changed. Split into focused PRs. 🟡 2787 lines changed. PRs under 400 receive more thorough review. Structural✅ No structural bloat detected. Slop✅ Slop indicators look low. Static Analysis✅ Oxlint found no issues. CorrectnessNo extraneous code patterns detected. |
End-goal implementation audit — 2026-08-02Reviewed PR head The target remains coherent: the user owns material decisions; planner and implementor converge through evidence; workflow state and environmental effects are explicit; agents do not own Git, GitHub, or workspace effects; and every live resource is scope-owned. Settled contracts to fold into the target documentsThese are documentation updates, not missing product features.
Shipped foundation available to the end goal
The document-level logic in Missing feature checklist for the complete workflowWorkflow identity, artifacts, and resumption
Stage execution and user continuation
Workspace ownership
Enforceable sandbox and permissions
Deterministic Git and GitHub effects
End-to-end workflow contract
Not blockers for this workflow
This checklist should shrink as features land. A settled contract updates the target documents and moves to the shipped foundation; only capabilities absent from the runtime remain unchecked. |
Current delivery mapThe root document is the workflow. A durable workflow run may continue through multiple document executions. Each issue remains an independently reviewable stop point. Living target and shipped document logic
Workflow identity and environment foundations
#199 and #227 can proceed independently. #218 is designed and stacks on PR #341 until #289 merges. Persistence and workspace composition
Workspace state is retained across completion, failure, cancellation, and interruption; scope teardown releases only ephemeral provider attachments. Point-in-time snapshots, rollback, and training export are not prerequisites for normal resumption. Deterministic Git and GitHub effects
Authority, composition, and certification
Dependency spine#298 is superseded by #291, which owns durable lookup, Implementors validate authorized slices. Taras settles #227, #290 exhaustion, and #302's term and installation architecture before those stories are delegated. #218's product decisions are recorded in the issue; its implementor validates that design rather than choosing a replay or provider model. |
Parallel delivery mapCurrent at PR head Parallel wavesShared-code collision rulesMaximum useful initial concurrency is three implementation lanes ( |
8d90204 to
503b114
Compare
Milestone story mapCreated the Adversarial implementation workflow milestone. Every task in the approved delivery sequence now has a canonical story:
PR #181 itself is also attached to the milestone as the living end-goal artifact. Each new story records scope, observable acceptance criteria, dependencies, and its sequence position. Existing stories #199, #203, #218, and #227 remain canonical rather than being duplicated. |
1a01e58 to
014447b
Compare
Fresh head on current main — #292Replaced the stale head The markup did not runEvery stage passed props through expression props as This is #305, still open — "Expression-valued component props can read The error model reaches the stagesA stage component is split by its
One claim I did not repeat: Stale claims removed
VocabularyCollapsed onto the concepts #289, #291 and #298 authorize — artifact ledger, artifact version, run identity, pinned source revision, stop reason, terminal record, stage boundary, declared inputs, cross-process continuation — replacing the four names these files used for a ledger and the three for a run. Engine state is described as scoped to the operation that owns it, with no module-scoped registry. Missing capabilities cite the issue that supplies them (#289, #291, #293, #294, #295, #296, #297, #298, #300, #302) rather than saying only "not implemented". ClassificationShipped: Evidence
Gates: Outstanding before merge#203 is still open and is an input to this target, not something this PR closes. Before merge this branch rebases onto the |
The adversarial implementation workflow target was written against a main that predates the error-model rules (#315), the error vocabulary rename (#317), error-model semantics (#319), and operation-scoped state (#325). It asserted `<CollectFailures>` as structural syntax, "the unresolved diagnostic", and a durable layer that "replays recorded results" — none of which describe main. This re-derives it on 7d7bdf2. The error model reaches the documents. A stage component is split by its `<Output>` boundary: the region inside runs under the `output` error mode, everything outside is documentation and runs under `throw`, which no `<PrintErrors>` region replaces. So a stage returns a complete validated result or it fails, keeping only what it had already rendered — the final `<Parse>` in each repair loop is a real gate. `throwOnError` is load-bearing for the same reason: without it a failed prompt records its failure and returns its text, raising nothing to decide. The markup did not run. Every stage passed props through expression props as `agent={props.planner}`, which fails on main with `props is not defined` — an expression prop reads the bare binding while text interpolation reads the namespace. Unifying them is #305, whose acceptance includes expression props reading `props.name`. 22 sites are corrected to the spelling main supports, and the asymmetry is recorded with the issue that removes it. Vocabulary is collapsed onto the concepts #289, #291, and #298 authorize: artifact ledger, artifact version, run identity, pinned source revision, stop reason, terminal record, stage boundary, declared inputs, and cross-process continuation, in place of the four names these files used for a ledger and the three for a run. Missing capabilities now cite the issue that supplies them rather than saying only "not implemented", and replay is described as reaching the state execution resumes from, never as the continuation itself. Planning-loop exhaustion stays open. It is recorded against #290, which pins the behavior; this change reports `verdict.passed` and does not call an exhausted loop converged. Evidence: `inspectDocument` parses all 9 frontmatters and compiles both schema kinds; `compileParseSchema` compiles all 5 embedded draft-07 schemas; `inspectComponent` resolves 21 shipped and 5 repository names and confirms 9 missing ones unresolved; `InstructionFiles` runs end to end against the repository's own AGENTS.md.
Rebased onto 511776e. #326 closed #203 by proving the two projection lifetimes with real modifiers — L8 for a projected `persist` resource and Q14 for a projected daemon — which were the acceptance criteria this target had the weakest evidence for. Projected content keeping its caller's bindings while its live effects belong to the component invocation is now stated as shipped, along with why it matters: a process a stage starts stops before the workspace it ran in is removed, which is the ordering `<Worktree>` (#293) is built on. `architecture.md` is authoritative on the error model, so the `output` row reads "fails the run; `<PrintErrors>` can print instead" as the registry states it. The engine does not do that yet — an outer boundary ends the run instead, whether the failure arose in the region itself or in content projected into it — so the discrepancy is classified as missing and filed as #327 rather than allowed to redefine the settled contract. No stage writes `<PrintErrors>`, so nothing here depends on it. The distinction the target does keep is the one the registry makes: a `throw` decision is the mode a boundary cannot replace. Every stage's parsing sits in documentation, so the final `<Parse>` is a gate for that reason and not because printing is unavailable.
014447b to
68733d7
Compare
Rebased onto
|
…entory `<UserCheckpoint>` captured `elicitation.proceed` and then returned only rendered prose, so a caller had nothing to branch on. `start.md` invoked `Planning` and `Implementation` unconditionally and the two stages branched on the planner verdict alone: a user answering `proceed: false` could not stop anything. That contradicts the central user-authority contract and #290's acceptance. `<UserCheckpoint>` now declares `returns` and binds a schema-validated decision — `proceed` plus the assessment fields a later prompt quotes. One `decisionSchema` serves both paths: `<Elicit>` binds it when the assessment reports a material choice, and an explicit `<Parse>` binds `"proceed": true` with its reason when there is none, so continuation is represented rather than inferred from absent elicitation data. Every affected transition is gated — a declined handoff does not start Planning, a declined authorization does not start Implementation, a declined review neither revises nor accepts, and a declined acceptance finishes as rejected rather than falling into the accepted branch. Nesting is what the language supports; it is not stopping. The run still expands to `<Output>` and completes, with no clean halt at a stage boundary and no stop reason recorded for one. That is classified as missing under #298 over #289 rather than described as enforcement. Two engine limitations surfaced while proving this and are filed rather than worked around silently. `<Content />` is substituted only at a body's top level or directly inside `<Output>`, never nested inside a `<Prompt>` (#328) — `Discovery` and `UserCheckpoint` used exactly that shape and could not expand, so both now take the material as a prop. And a binding made inside a Markdown component's projected content does not escape to its caller, while the same binding inside a registered function component does; the harness had to account for that to test the real components. artifacts.md claimed every listed result was JSON declared inline. It is corrected into three kinds: `PlannerHandoff` and `ImplementationPlan` are prose with no schema and cannot gate anything; the four parsed results are described using only fields their inline schemas declare; and `UserDecision` is the checkpoint's declared return, with the actor and timestamp that would make it auditable marked missing under #291. Discrimination over the shipped subset, with a turn-recording stub agent: a declined checkpoint records 1 agent turn and neither stage runs; the authorized path records 2 and both run; a no-material-choice assessment records 2 and proceeds on its explicit `<Parse>` branch while a declining answer in scope is never consulted.
…on text Three claims did not match what the documents do. `artifacts.md` still said nothing consumes the pull-request handle. The boundary is now stated exactly: `Implementation` consumes all of it internally, `start.md` never receives it — what crosses the stage boundary is the verdict and the decision — and the artifact ledger records the effect independently (#291). The specification said both text components do their work in documentation. Only `Discovery` does. `InstructionFiles` puts its `<Each>` and `<File>` reads inside `<Output>`, and probing that case corrected a second assumption in the same sentence: `<File>` prints its own failures, so an unreadable instruction file is decided as a printed error before the region's `output` mode sees it. The run continues; what stops the caller is the binding rule, since `as` refuses a body holding a printed error and `instructions` stays unbound. `start.md` gains the same qualifier, because "an undecided error fails the run" is only true of undecided ones. The user checkpoint did not carry what the PR claimed it did. The planner prompt rendered each review's body; `checkpointMaterial` rendered only the author, state, and head. A user approving a change has to read the original objection, not the planner's summary of it, so the body is now in both. The earlier probe missed this because it asserted the review *author* on the checkpoint material and the *body* only on the prompt — an assertion too weak to see the omission it was meant to cover. Discrimination now asserts the body on both surfaces. Dropping any category reddens both symmetrically, and dropping the body from the checkpoint alone reddens the checkpoint while the prompt stays green — the exact shape of the defect.
All four blockers addressed — head
|
| Omitted | Planner prompt | Checkpoint material |
|---|---|---|
| none | body / comment / check all pass | body / comment / check all pass |
reviews |
body fails | body fails |
comments |
comment fails | comment fails |
checks |
check fails | check fails |
review.body from checkpoint only |
passes | fails — the shape of the shipped defect |
Sweep and verification
All eleven files and the PR body swept for the three stale claim families — "nothing consumes" the handle, text work running in documentation, and a complete snapshot reaching both surfaces: clean.
- Document probes: ALL CHECKS PASS — 9 frontmatters parse, 5 embedded schemas compile, 21 shipped + 5 repository names resolve, 9 missing unresolved
git diff --checkagainst511776e: no whitespace errorsdeno task fmt·lint(0 errors) ·check·test(349 passed, 0 failed) ·check:jsr(Success Dry run complete) ·pnpm exec tsc --project tsconfig.node.json --noEmit(exit 0)- All ten PR checks green: composability, deploy, jsr, lint, review, site, smoke, test-bun, test-deno, test-node
`checkpointMaterial` presented the pull request and the verdict but not the two things approval actually sets in motion. When a verdict fails, approval sends `verdict.revisionPrompt` to the implementor, and the checkpoint never showed it. A `defer` disposition sends the complete finding to `<Issue>`, including `finding.evidence`, and the checkpoint showed only the title, disposition, and description. That contradicts the document's own rule. `proceed: true` authorizes the exact transition and the exact effects presented for assessment, which means nothing if the material omits them: a user could approve revision instructions and issue evidence they had never read. `Planning` already showed its revision prompt; `Implementation` did not. Both are now in the material, unchanged and unsummarized — the literal `verdict.revisionPrompt`, and each finding's evidence rendered beneath it with a nested `<Each>`. The explanatory text in the component and the specification says why, rather than asserting that approval covers effects it never displayed. Discrimination gains distinct markers for both. The baseline asserts they reach the checkpoint, that the revision prompt the implementor receives carries the same value, and that `<Issue>` receives the same complete finding — the stub now records what it was passed. Removing either field from the checkpoint reddens exactly its own assertion while the effect assertions stay green, which is the shape of the leak: the effect still fires, the user just never saw it.
Approval now shows every effect it performs — head
|
| checkpoint: revisionPrompt | checkpoint: evidence | implementor receives same prompt | issue receives full finding | |
|---|---|---|---|---|
| baseline | ok | ok | ok (prompt-7, "Revise the implementation") |
ok |
revisionPrompt removed from checkpoint |
FAIL | ok | ok | ok |
evidence removed from checkpoint |
ok | FAIL | ok | ok |
| restored | ok | ok | ok | ok |
The two effect columns stay green under both mutations, which is exactly the shape of the leak being closed: the effect fires either way; the only thing that changes is whether the user saw it before authorizing it.
The issue stub confirms what it received:
{"disposition":"defer","title":"t","description":"d","evidence":["EVIDENCE-MARKER"]}Sweep
Implementation.md, the specification, and the PR body now describe what the markup renders. The "same consequential content" claim states what each surface carries and why they differ: the checkpoint omits a check's link and adds the revision prompt and finding evidence, because those are what an approval performs rather than what the review consumed.
Verification
- Document probes: ALL CHECKS PASS — 9 frontmatters, 5 embedded schemas, 21 shipped + 5 repository + 9 unresolved names
git diff --checkagainst511776e: no whitespace errorsdeno task fmt·lint(0 errors) ·check·test(349 passed, 0 failed) ·check:jsr·tsc(exit 0)- All ten PR checks green: composability, deploy, jsr, lint, review, site, smoke, test-bun, test-deno, test-node
Workspace-direction milestone auditThis review follows the provider-backed Workspace decision in #218 and the host-topology decision opened as #346. It records recommendations only; it does not authorize implementors to rewrite product scope, and no issue below was closed or edited by this audit. VerdictThe milestone’s end goal remains relevant. No open story is wholly obsolete at the product-outcome level. The new direction does invalidate or unset several implementation mechanisms:
Keep essentially as written
Keep the outcome, amend the issue before delegation
Living targetPR #181 remains the correct end-goal artifact but is intentionally stale until #292 updates it. Its
Do not merge #181 merely because its current checks pass; its purpose is semantic alignment with the settled architecture. Completed foundationsKeep the completed items in the milestone as delivery history:
Proposed dependency shapeThe exact graph after #346 depends on its selected topology, but the current map should no longer say #218 can proceed independently of #289 or that it should stack on #341. #341 has merged. Implementation of #199 and #291 can overlap because the scanner and policy already exist, but neither should claim final cross-runtime certification until #346 establishes whether a Cloudflare Workers runtime is part of the supported execution surface. |
Adversarial Implementation dependency-map deltaThe Workspace path now includes an evidence-producing spike: #347 tests whether XMD can remain a single-download executable while supervising a bundled local |
Adversarial Implementation dependency-map deltaThe Workspace topology decision now has two evidence paths: #349 tests whether Deno can own the persistent SQLite Workspace directly while reusing Cloudflare's DOFS and FUSE layers. It compares real FUSE and the userspace shim independently, and compares its portability, durability, security, and maintenance boundary against PR #348's bundled-workerd result. |
Adversarial Implementation dependency map — Workspace design revisionPR #358 captures the design decisions produced by #346 and the Workspace interview. It changes the implementation path materially: Evidence and decisions
Current implementation pathRelevance audit
No implementation issue should independently re-decide Workspace explicitness, filesystem restoration, topology, Agent write authority or transaction granularity. Those changes now require an architecture/spec revision first. |
Worker Shell topology delta — INCLUDE#357 / PR #362 resolves the final optional topology gate positively. One Worker Shell invocation satisfies The initial local capability set therefore includes Workspace-scoped Worker Shell through Production implementation moves to #363 with four constraints that are no longer open design questions:
Updated path: PR #358 records the accepted architecture and observable contract. #357 closes when its evidence PR is accepted. |
Correction: spike evidence remains outside production mainPRs #350 and #353 were accidentally merged while their stack was being collapsed. PR #364 reverts both squash commits, restoring main exactly to its pre-spike tree. PR #362 remains an unmerged 20-file proof stacked on the #351 evidence branch. The disposition is:
Do not merge the spike source trees as prerequisites for #363. Production work consumes their measured contracts and may selectively adapt proven code under the repository's normal architecture and dependency rules. |
Adversarial Implementation issue reconciliation after #358The authoritative production dependency map now lives in #218. The retained Workspace foundation is sequenced as: The missing production stories are now explicit:
Stale contracts were reconciled in #199, #227, #290–#295, #297, #299–#302. In particular, the plan no longer uses #357 is closed with an INCLUDE verdict. PR #362 remains unmerged experimental evidence; #363 owns production Worker Shell after #365/#366. PRs #350 and #353 likewise remain unmerged evidence. |
Why
We need a concrete, inspectable version of the planner–implementor–human-decider workflow before automating it. The workflow must keep final decisions with the user, make agent handoffs explicit, and move workspace and pull-request effects out of probabilistic agent behavior.
What changes
Before:
The agent vision described composable agents, but it did not show the complete adversarial implementation loop or the environmental data passed between its stages.
After:
The repository contains a conceptual workflow specification and an executable-Markdown-shaped sketch of the full loop. Supporting documents expand the planner handoff, plan convergence, user involvement gate, implementation review, runtime lifecycle, deterministic artifacts, and currently missing primitives.
Stage boundaries are structured, not prose.
InstructionFilesandDiscoveryare text components.UserCheckpoint,Planning, andImplementationdeclarereturns: each resolves a user decision that its caller has to gate on, and a caller cannot branch on rendered prose.PlanningandImplementationreturn their prose, the parsed verdict fields, and the completeUserDecisionthey resolved — the sources, with nothing derived from them.start.mdcomputes each gate where it uses it:A precomputed
authorizedfield would be a second copy of that answer, and no return schema can require the copy to agree with its sources, so a record pairing a declining decision with an approving flag would validate. The same two fields tell a decline (proceedfalse) from a review that reached its bound still failing (proceedtrue,verdictPassedfalse); neither advances, and the eventual policy for the second stays unresolved under #290.Neither stage returns the pull-request handle, but
Implementationconsumes it in full.<PullRequest>(#295) resolves number, URL, head and base identities, state, reviews, comments, and checks.runtime.mddenies agent network access, so whatever the prompt does not render is invisible to the review — the stage therefore renders every category (reviews with their bodies, comments, checks) explicitly, each collection iterated with<Each>and never stringified, into both the planner prompt and the checkpoint material the user reads. The two surfaces carry the same consequential content: a user approving the change reads the original objections, not the planner's summary of them. The checkpoint omits only a check's link, and carries two things the review prompt has no reason to — the focused revision prompt an approval sends to the implementor, and each finding's evidence, since adeferdisposition turns that finding into a durable issue.proceed: trueauthorizes the exact effects presented for assessment, which only means something if the material shows them. The prompt names the revision under review: the diff atheadShaagainstbaseSha, with a verdict describing that head alone, so a moved head requires a fresh review.The member field names within reviews, comments, and checks are #295's to settle; this document depends on that schema rather than defining a competing one. What is settled here is that the planner receives the complete snapshot.
The handle stays internal because
start.mdgates on the verdict and decision rather than on pull-request state, and the artifact ledger (#291) records the effect independently. A return field typedstringwould let a conforming<PullRequest>perform its durable effects and only then fail the stage's return validation.How it works
The workflow works outside in: it first establishes observable, independently reviewable boundaries, then implements smaller PRs within those boundaries. Review findings that would derail the active chain become explicit follow-up issues when deferral is safe.
Review guide
Start with:
workflows/adversarial-implementation/start.mdThen review:
specs/adversarial-implementation-workflow.mdfor the behavioral contract and role boundaries.workflows/adversarial-implementation/Discovery.md,Planning.md, andUserCheckpoint.mdfor the planning loop and the user gate.workflows/adversarial-implementation/Implementation.mdfor PR-chain review and follow-up issue handling.workflows/adversarial-implementation/InstructionFiles.mdfor instruction materialization.workflows/adversarial-implementation/primitives.md,artifacts.md, andruntime.mdfor shipped syntax, missing capabilities, and lifecycle rules.specs/markdown-agents-vision.mdfor workflow-owned artifacts and the laterxmd playdirection.Look carefully at:
main, and whether every unshipped capability is marked as such;What must stay true
How to verify it
inspectDocumentparses every frontmatter block and compiles its declared prop and return schemas through currentmain;compileParseSchemacompiles every embedded draft-07 schema;inspectComponentconfirms each name resolves to what the target claims it does.Planning,Implementation, andUserCheckpointand stubbing only the agent transport and the three deterministic components that do not exist: a declined plan review reaches no authorization question and no implementation effect; a declined pull-request review creates no deferred issue and reaches no acceptance question; a failed verdict with approval performs the revision turn and reaches the next stage only after a later passing verdict; an exhausted loop reaches neither. Moving<Issue>ahead of its approval, bypassing a caller gate, or reducing either structured return to text each changes an observed result.git diff --check origin/main...HEADverifies that the diff contains no whitespace errors.Scope
Included
xmd playas a later layer built on the automated implementation loop.Intentionally unchanged
New abstractions
<Worktree>,<File>,<PullRequest>, and<Issue>describe deterministic environmental effects needed by multiple workflow stages.<Elicit>, schema parsing, and conditional control flow have all shipped; the target now describes their settled contracts rather than proposing them.Risks and limitations
<Workflow>,<Stage>,<Worktree>,<Sandbox>,<Commit>,<PullRequest>, and<Issue>do not exist, and neither does sidecar run history or cross-process stage resumption.InstructionFiles,Discovery,Planning, andUserCheckpointis written entirely in shipped syntax. The gating behavior is exercised here against the real documents; proving the loop end to end against real agents is Prove the shipped adversarial-planning document logic #290.<Output>and completes, with no clean halt at a stage boundary and no recorded stop reason. That is Add Stage execution and cross-process manual continuation #298 over Add contextual workflow runs with pinned commits #289.<Content />does not substitute inside a<Prompt>(<Content /> is not substituted when nested inside another element in a component body #328), soDiscoveryandUserCheckpointtake their material as a prop. An outer<PrintErrors>does not print anoutputdecision (An outer <PrintErrors> does not print a failure an <Output> region decided #327);architecture.mdremains authoritative and the target describes the contract, not the current behavior.Scope confirmation