Contents
- 01Start From Zero and Choose the Right Surface
- 02Turn Intent Into Verifiable Work
- 03Configure Codex and Teach It the Project
- 04Bound Authority With Sandbox and Approvals
- 05Make the Change and Prove It
- 06Work Across Environments and Worktrees
- 07Delegate With Subagents
- 08Build the Extension Stack
- 09Automate, Embed, and Run Long Work Safely
- 10Capstone: From Command to Receipt
Turn Intent Into Verifiable Work
Translate domain expertise into a task contract, establish current repository truth, and give Codex a finish line it can prove rather than guess.
By the end
A source-backed repository map and a complete task packet containing the user outcome, scope, constraints, acceptance cases, evidence, and stop conditions.
Domain expertise is the starting material
You do not need to know the implementation to specify valuable work. You do need to explain who experiences the problem, what decision or action is difficult today, which information matters, and what a trustworthy result looks like. That is domain judgment, and it is often harder to replace than syntax knowledge.
Codex can inspect a codebase and propose implementation details. It cannot safely decide an unstated business rule, permission policy, financial threshold, or customer promise. Separate the decisions you own from the technical questions the agent may investigate. Mark unknowns instead of allowing fluent guesses to become requirements.
Write a task contract
A useful task contract names the outcome, user, starting evidence, allowed scope, constraints, non-goals, acceptance cases, required proof, and conditions that require a pause. It does not prescribe every line of code. It tells Codex what must remain true while leaving room to discover the best local implementation.
Include examples where language is ambiguous. For a status workflow, specify allowed transitions and one rejected transition. For a report, provide a representative input and the expected shape. For an interface, name the critical user journey and responsive states. Examples convert taste and business logic into material that can be tested.
Establish repository truth before proposing change
Ask Codex to inspect the repository's own instructions, manifest, entry points, relevant data model, neighboring implementation patterns, tests, and current Git state. Require exact paths. A README can describe the intended system, while the current source and runtime may tell a different story. Label each conclusion confirmed, inferred, or unknown.
Trace one vertical path instead of cataloging every file. Follow the user's action into the interface, through logic, into state or an integration, and back to the visible response. This gives technical pieces a purpose and reveals the smallest set of responsibilities the change must cross.
- Interface: what the user sees or manipulates.
- Logic: the rules that interpret the action.
- State: information that must survive or be shared.
- Integration: a boundary to another service or data source.
- Identity: who is allowed to see or do what.
- Proof: the test, log, receipt, or observation that confirms the result.
Build an evidence ladder
Different questions require different proof. A typecheck can show that TypeScript agrees with the program's types. A unit test can show that one function handles a known case. A browser run can show that a user can complete the actual flow. A provider receipt can show which release was deployed. None proves all the others.
State the minimum evidence required before implementation begins. High-risk work needs negative cases as well as happy paths: an unauthorized user is rejected, a duplicate event is harmless, a missing value produces a clear error, or a failed publish leaves the previous release available. Evidence should follow the risk, not a generic checklist.
Define stop conditions and decision owners
A strong task tells Codex when it may make a reasonable implementation assumption and when it must pause. Pause when two product interpretations lead to meaningfully different behavior, when the requested action affects an external person or production system, when a secret or new permission is required, or when existing user work overlaps the necessary files.
Do not turn every small uncertainty into a meeting. Give the agent authority to resolve local, reversible implementation details that preserve the contract. The goal is bounded autonomy: freedom inside an explicit box, with escalation at the edges.
Working reference
Commands and patterns
Capture repository facts
git rev-parse --show-toplevel git branch --show-current git status --short git log --oneline -8
These read-only checks establish location, branch, unfinished work, and recent context before a plan is trusted.
Codex orientation prompt before implementation
Work read-only first. Read the applicable AGENTS.md files and current Git status. Trace how a user saves notification settings from interface to validation, persistence, identity checks, and visible confirmation. Cite exact files and symbols. Mark each conclusion confirmed, inferred, or unknown. Do not edit until I approve a task contract and evidence plan.
Replace the example workflow with the real one. This prompt gives Codex a specific vertical path, evidence format, and stop boundary instead of asking it to 'understand the codebase.'
When the happy path breaks
Failure modes
Symptom
Codex builds something polished that solves the wrong workflow.
Likely cause
The request described a feature name but omitted the user, decision, business rules, and acceptance examples.
Recovery
Return to the task contract. Define the real user outcome, representative cases, rejected cases, and observable finish line before further implementation.
Symptom
The plan cites architecture that does not exist in the repository.
Likely cause
Common software patterns or stale documentation were presented as current project facts.
Recovery
Require exact file, symbol, configuration, or command evidence for each claim and label unverified assumptions separately.
Symptom
The implementation passes a unit test but fails in the actual interface.
Likely cause
The evidence plan covered one code layer rather than the complete user journey.
Recovery
Add an end-to-end or browser-level check for the critical path and connect lower-level tests to the risks they are meant to prove.
Symptom
Work stops constantly for trivial questions or proceeds through consequential ambiguity.
Likely cause
The task has no explicit boundary between local implementation judgment and decisions owned by a human.
Recovery
Add a decision-rights section: assumptions Codex may make, events that require a pause, and the owner of each unresolved question.
Hands-on lab
Trace and specify one business workflow
Choose a workflow you understand deeply and turn it into a technically grounded task contract without implementing it yet.
- 01Write the user, current pain, desired decision or action, and measurable outcome in plain language.
- 02Ask Codex to trace the closest existing workflow through interface, logic, state, identity, and integrations with file references.
- 03Record confirmed facts, inferences, unknowns, and any existing uncommitted files in the path.
- 04Define allowed scope, non-goals, business rules, representative examples, and negative cases.
- 05Choose proof for source, automated behavior, user flow, and deployment only where those layers are relevant.
- 06Add stop conditions and identify the owner of each unresolved decision.
Deliverable: A repository-backed task packet another agent or engineer could implement without inventing product decisions.
Reusable artifact
Verifiable task contract
A reusable specification that converts business intent into bounded, testable engineering work.
Problem: [what is difficult today and for whom] Outcome: [observable result after the change] Current evidence: [files, screenshots, logs, examples, user reports] Confirmed system path: [interface -> logic -> state -> integration -> proof] Allowed scope: [files, services, data, environments] Non-goals: [related work intentionally excluded] Rules and examples: [business logic + representative cases] Negative cases: [what must be rejected or fail safely] Constraints: [compatibility, accessibility, security, performance, brand] Acceptance checks: [specific pass/fail statements] Evidence required: [commands, tests, screenshots, receipts] Codex may decide: [local reversible details] Pause and ask when: [authority or product boundary]
Before you move on
Receipt checklist
- The task names a user outcome rather than only an implementation activity.
- One existing workflow is traced with exact repository evidence.
- Rules include representative and negative examples.
- Acceptance checks cover the highest-risk user and system behaviors.
- Unknowns, assumptions, and human decision owners are explicit before implementation.
Primary sources
