Skip to content
Draft
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
33 changes: 26 additions & 7 deletions examples/adversarial-implementation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,32 @@ from claiming readiness or merging independently.

## Prepare requests without metadata repair turns

These rules apply to separate phase requests and Ticket role calls.
`Phase.Request` renders the complete prompt before entering an Agent, including
initial repository instructions, role instructions, assignment, selected text and
response schema. A missing selected component or input fails there; a packet
above 256000 characters refuses before provider dispatch. The selected evidence
keeps its separate 64000-character bound; the complete-prompt ceiling also accommodates
mandatory initialization instructions and the response schema. Nothing is truncated.
These rules apply to separate phase requests and Ticket role calls. Codex authors
prose committed to workflow documents, including guides, component instructions
and prompt templates. Claude roles may write internal runtime handoffs, hold
prompts and summaries.
`Phase.Run` freezes the submission guide in its reserved attempt directory.
`Phase.Request` checks that guide and prepares the phase prompt before entering
an Agent. The prompt includes initial repository and role instructions,
the assignment, selected text and an absolute reference to `submission-guide.md`
in the attempt directory. The guide contains the complete submission instructions
and the current role- and phase-specific JSON contract. Read it before returning
any result, including an early blocker, source conflict or unanswered decision.
The same retained native call reads the file and returns the result; staging the
guide adds no model call.

The guide and its hash receipt are runner-owned. Preparation refuses occupied
paths and confirms that the published text is readable under current File
permissions and protection. After saving each raw reply, the workflow verifies
the guide and receipt against the expected submission instructions before it
accepts a result or starts a correction. Missing, unreadable or changed files
hold the attempt with its raw reply preserved. Corrections retain their existing
inline repair packet, original session and allowance.

A missing selected component or input fails before provider dispatch. A prompt
above 256000 characters refuses without truncation. The guide has its own
256000-character and UTF-8-byte bounds. Selected evidence keeps its separate
64000-character allowance; moving submission instructions does not enlarge it.
Provider configuration and client compatibility retain their existing checks before a turn starts.
No paid prompt probes installation or repairs launch metadata.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ shasum -a 256 -- {quoted}/request.json {quoted}/diagnostic.json {quoted}/origina
<Phase.Role role={props.role} session={props.session} assignment={props.assignment} initialize={false} plannerProvider={props.plannerProvider} implementationProvider={props.implementationProvider} inputs={[]} correction={packet} as="raw" />
<Let as="rawPath" value={directory + "/raw.txt"} />
<Dir path={directory}><File path="raw.txt">{raw}</File></Dir>
<Phase.SubmissionGuide repository={props.assignment.repository} directory={props.attempt} mode="check"><Phase.SubmissionInstructions role={props.role} assignment={props.assignment} /></Phase.SubmissionGuide>
<Phase.Response assignment={props.assignment} text={raw} role={props.role} profile={props.profile} as="checked" />
<If condition={checked.ok}>
<Phase.Correspondence established={frozen} value={checked.value} role={props.role} phase={props.assignment.phase} as="correspondence" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ props:
default: []
assignment:
type: object
submission:
type: object
initialize:
type: boolean
default: false
required:
- role
- assignment
- submission
additionalProperties: false
---

Expand All @@ -44,7 +47,9 @@ You remain the retained repository {props.role}. The previous owner's request is

Do not draft, create or edit PR or issue titles or descriptions. The Sidekick running Codex owns that metadata and publication. Return technical decisions, code and evidence only; API documentation stays within the design assignment. Describe user-directed amendments separately from implementation defects, cite the recorded approval evidence and keep the existing correction allowances. This restriction also applies when a general role guide mentions opening a draft PR.

Execute the assigned phase through its stated deliverables. An assigned test or artifact that has not yet been written is remaining work. Continue it within this call. Use blocked only for a concrete external condition you cannot resolve within the assignment: quota, permission, provider failure, unavailable external dependency or genuinely missing input. Supply blocker.kind, reason, unblockCondition and evidence references. A source or design conflict returns needs_discovery; an unanswered human choice returns needs_decision. Use the supplied handoff, artifact paths and evidence first. Store every new plan, handoff, report, candidate and command receipt under assignment.artifactDirectory, the phase directory in this ticket workspace. Keep the source checkout and native cwd unchanged. Historical/source references retain their original locations; do not move or rewrite them. Return absolute references to new artifacts. Leave the runner-owned assignment.json, raw.txt, result.json, status.json and event files unchanged. Tie additional reads to a missing fact or an affected invariant. Reopen earlier conclusions when a named change invalidates them. State the missing fact when the assignment is insufficient. Retain mandatory repository and role requirements.
Codex authors prose committed to workflow documents, including guides, component instructions and prompt templates. Claude roles may write internal runtime handoffs, hold prompts and summaries. If your selected provider is Claude and the assignment needs workflow-document prose that Codex has not supplied, return needs_discovery with the required authoring work.

Execute the assigned phase through its stated deliverables. An assigned test or artifact that has not yet been written is remaining work. Continue it within this call. Use blocked only for a concrete external condition you cannot resolve within the assignment: quota, permission, provider failure, unavailable external dependency or genuinely missing input. Supply blocker.kind, reason, unblockCondition and evidence references. A source or design conflict returns needs_discovery; an unanswered human choice returns needs_decision. Use the supplied handoff, artifact paths and evidence first. Store every new plan, handoff, report, candidate and command receipt under assignment.artifactDirectory, the phase directory in this ticket workspace. Keep the source checkout and native cwd unchanged. Preserve first failures, command receipts and the exact source inputs actually tested. An uncommitted candidate needs its own retained identity; a base HEAD is not its tested revision. Historical/source references retain their original locations; do not move or rewrite them. Return absolute references to new artifacts. Leave the runner-owned assignment.json, raw.txt, result.json, status.json, submission-guide.md, submission-guide.json and event files unchanged. Tie additional reads to a missing fact or an affected invariant. Reopen earlier conclusions when a named change invalidates them. State the missing fact when the assignment is insufficient. Retain mandatory repository and role requirements.

<If condition={props.assignment.phase === "discovery"}>
Resolve the assigned design or planning question. Return the bounded proposal or accepted plan and the next owner's exact request. Return needs_decision for an unanswered human decision. Existing design and plan approval gates still apply.
Expand Down Expand Up @@ -95,26 +100,10 @@ Recorded inputs:
Prepared assignment:
<Json value={props.assignment} />

Return assessment on completed implementation, changes_required, missing_evidence and escalate. For changes_required or missing_evidence, assess only the finite correction being requested, not the original feature. Keep already settled responsibilities closed; a missing test witness does not by itself reopen the production architecture. Completed implementation likewise reports the actual correction rather than inheriting the whole feature scope. Assess actual impact: mechanical, architecture and acceptance booleans; one short impact reason and individual evidence references, plus risk:null unless a concrete consequential uncertainty or risk needs additional reasoning. For high effort, risk contains its own short reason and supporting evidence. Merely touching concurrency, cancellation, durable state, replay or a public boundary is not that reason. Test-only changes can affect acceptance. A mechanical assessment has no architecture, acceptance or complexity impact. New non-mechanical feature work includes Planner acceptance; correction work requires only affected responsibilities. Keep evidence references in artifacts or already recorded documents. Do not request a reviewer or reasoning effort in prose to override this assessment.

Return escalate only from medium Discovery or Review when a concrete newly discovered risk or uncertainty prevents completing this assignment. Keep the same revision and impact flags, supply risk with the specific reason and supporting evidence, and leave the checkout clean. The workflow resumes the same original role/session at high. High cannot escalate again. Implementation uses its assigned provider/effort and returns needs_discovery for a scope conflict.

The workflow supplies omitted phase and work, the assigned revision for read-only phases, and the accepted continuation for complete/pass. Explicit conflicting metadata is refused. Implementation must report the actual resulting revision; evidence must name the inputs actually tested.

Return next.phase and next.role explicitly when the outcome changes the prepared route. For complete/pass, copy assignment.continuation exactly; completed implementation routing is derived from the returned assessment and replaces that predicted continuation. For escalate, copy the current phase and role; the workflow derives and checks that same-owner continuation. For changes_required or missing_evidence, select implementation/implementor. For needs_discovery with apiConflict, select discovery/planner; otherwise select discovery/architect. For blocked or needs_decision, select hold/null. The program verifies this gate before another role can run; ready is a phase-loop result, not delivery approval.

Keep summary to 1200 characters. Address handoff to next.role, or ROOT when next.phase is hold/ready. Write only that owner's next bounded action and necessary artifact references in at most 250 words and 1800 characters. Put command receipts in evidence and detailed reports in artifact files. Select only the short documents the next owner needs in handoffInputs. Each selected handoffInputs path must appear in your returned artifacts or the already recorded documents. A file existing on disk alone does not make it a recorded document. Keep full test logs, patches and historical ledgers in artifacts; listing an artifact does not send its contents. The selected-input limit is 64000 UTF-16 units for the recipient's entire owed packet, including undelivered accepted inputs and role guides. Use the recipient's recorded remaining allowance for new handoff material. Keep binding clauses, their conditions, exceptions, commands, identities and unresolved findings exact; reference full supporting artifacts. Ticket.Prepare checks the actual packet before dispatch and retains its receipt. This selected-input allowance is separate from the 256000-character complete-prompt ceiling. Use a new reference for changed contents. The workflow supplies accepted inputs once per retained role; do not request their repetition without a named change. Do not repeat the summary, command list, prior prompts, full plan, contract packet or narrative history in handoff. Omit blocker outside blocked outcomes.

Reference individual UTF-8 text or JSON files in artifacts, evidence and handoffInputs. Do not return a directory or binary path as a document reference: the workflow reads each reference as a text file. For a group of files, save a text index naming the individual files and return that index.

Before returning, check the required fields, assigned work/phase, actual revision, next role and phase, and character limits against the contract below. Omit optional metadata you cannot establish instead of guessing.

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="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}
Submission guide:
Read the frozen UTF-8 file at {props.submission.path} before returning any result,
including an early blocker, source conflict or unanswered decision. Use the same
native call to read it and return the result; no separate formatting turn is
scheduled. It contains the complete submission instructions and the exact JSON
contract for this role and phase. Leave the guide and its receipt unchanged.
</Output>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ props:
returns: {type: string}
---

<Let as="request"><If condition={props.correction === null}><Phase.Instructions inputs={props.inputs} role={props.role} assignment={props.assignment} initialize={props.initialize} /><Else><Phase.CorrectionInstructions correction={props.correction} /></Else></If></Let>
<Phase.SubmissionGuide repository={props.assignment.repository} directory={props.assignment.artifactDirectory} mode="check" as="submission"><Phase.SubmissionInstructions role={props.role} assignment={props.assignment} /></Phase.SubmissionGuide>
<Let as="request"><If condition={props.correction === null}><Phase.Instructions inputs={props.inputs} role={props.role} assignment={props.assignment} initialize={props.initialize} submission={submission} /><Else><Phase.CorrectionInstructions correction={props.correction} /></Else></If></Let>
<If condition={request.length > 256000}><Fail message={"The complete phase prompt exceeds 256000 characters (actual " + request.length + "), including mandatory instructions and selected evidence. Selected inputs: " + props.inputs.map(input => input.path + " (" + input.content.length + ")").join(", ") + ". Preserve the prepared assignment and reduce the request before dispatch; nothing was truncated or sent. No provider prompt began."} /></If>
<Return value={request} />
2 changes: 2 additions & 0 deletions examples/adversarial-implementation/components/Phase/Run.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,14 @@ mkdir -- {quotedAttempt}
</If>
<Dir path={attempt}><File path="assignment.json"><Json value={assignment} /></File></Dir>
<Phase.Event attempt={attempt} stage="started" assignment={assignment} role={props.role} as="started" />
<Phase.SubmissionGuide repository={assignment.repository} directory={attempt}><Phase.SubmissionInstructions role={props.role} assignment={assignment} /></Phase.SubmissionGuide>
<Phase.Role inputs={props.inputs} role={props.role} session={props.session} assignment={assignment} initialize={props.initialize} plannerProvider={props.plannerProvider} implementationProvider={props.implementationProvider} as="raw" />
<Dir path={attempt}><File path="raw.txt">{raw}</File></Dir>
<Phase.Profile role={props.role} assessment={assignment.assessment} plannerProvider={props.plannerProvider} implementationProvider={props.implementationProvider} as="deliveredProfile" />
<Ticket.Fingerprint inputs={props.inputs} as="sentInputs" />
<Dir path={attempt}><File path="delivery.json"><Json value={{schema:"role-input-delivery.v1",role:props.role,session:props.session,provider:deliveredProfile.provider,profile:deliveredProfile,initialize:props.initialize,inputs:sentInputs,raw:attempt + "/raw.txt"}} /></File></Dir>
<Phase.Event attempt={attempt} stage="reply-saved" assignment={assignment} role={props.role} as="replied" />
<Phase.SubmissionGuide repository={assignment.repository} directory={attempt} mode="check"><Phase.SubmissionInstructions role={props.role} assignment={assignment} /></Phase.SubmissionGuide>
<Phase.Correct assignment={assignment} raw={raw} role={props.role} session={props.session} attempt={attempt} plannerProvider={props.plannerProvider} implementationProvider={props.implementationProvider} inputs={props.inputs} profile={props.responseProfile} maxResponseCorrections={props.maxResponseCorrections} as="accepted" />
<Let as="result" value={accepted.result} />
<Dir path={attempt}><File path="result.json"><Json value={result} /></File></Dir>
Expand Down
Loading
Loading