Spec-Driven Development in Codex¶
This guide explains how to run AI-Parrot's Spec-Driven Development (SDD) flow from Codex.
The older Claude Code flow used slash commands from .claude/commands/. In
Codex, the shared repository workflow is exposed as repo-scoped skills under
.agents/skills/. Invoke them with $sdd-* from a Codex chat, or select them
through /skills.
Quick Map¶
| Claude command | Codex skill | Purpose |
|---|---|---|
/sdd-brainstorm |
$sdd-brainstorm |
Explore a feature idea, compare options, and write a brainstorm. |
/sdd-proposal |
$sdd-proposal |
Research a Jira issue, inline request, or notes file before writing a spec. |
/sdd-spec |
$sdd-spec |
Convert a brainstorm, proposal, or direct request into a formal spec. |
/sdd-task |
$sdd-task |
Decompose an approved spec into atomic task files and a per-spec index. |
/sdd-start |
$sdd-start |
Implement and close one task inside the feature worktree. |
/sdd-done |
$sdd-done |
Verify, push, open or describe the PR, and clean up the worktree. |
The autonomous implementation agent is configured at:
Use it by asking Codex to delegate the feature to sdd-worker, for example:
Codex Surfaces¶
AI-Parrot uses three Codex surfaces for this workflow:
| Surface | Path | Role |
|---|---|---|
| Repo guidance | AGENTS.md |
Always-loaded project rules, safety protocol, and coding standards. |
| Repo skills | .agents/skills/sdd-*/SKILL.md |
Reusable SDD workflows invoked as $sdd-*. |
| Custom agent | .codex/agents/sdd-worker.toml |
Specialized autonomous worker for SDD task execution. |
The .agent/ directory still contains project context and legacy Antigravity
workflow files. Codex-specific SDD entry points are the .agents/skills/ files
and .codex/agents/sdd-worker.toml.
If a newly added skill or agent does not appear in Codex, restart the Codex
session and run /skills or /agent again.
End-to-End Flow¶
$sdd-proposal or $sdd-brainstorm
|
v
$sdd-spec
|
v
review spec and set status: approved
|
v
$sdd-task
|
v
cd .claude/worktrees/<feature-worktree>
|
v
$sdd-start TASK-NNN
|
v
repeat until all tasks are done, or delegate to sdd-worker
|
v
$sdd-done FEAT-NNN
The worktree directory is still .claude/worktrees/ for compatibility with the
existing SDD scripts and task indexes. Codex uses .codex/agents/ only for
custom agent configuration.
Start From A Ticket Or Bug Report¶
Use $sdd-proposal when the source is thin and the repository probably has more
context than the request:
$sdd-proposal NAV-8421
$sdd-proposal "Nextstop module does not generate the PDF"
$sdd-proposal docs/notes/pdf-failure.md --mode=investigation
The proposal flow:
- Resolves the source from Jira, inline text, or a file.
- Runs wiki-first and codebase research.
- Persists findings under
sdd/state/<FEAT-ID>/. - Produces
sdd/proposals/<slug>.proposal.md. - Recommends the next step, usually
$sdd-spec.
Use --resume FEAT-NNN to continue a previously interrupted proposal run.
Start From A Feature Idea¶
Use $sdd-brainstorm for greenfield or design-heavy features:
The brainstorm flow asks for:
- Flow type:
featureorhotfix. - Base branch: usually
dev,stagingduring a release freeze, ormainfor hotfixes only. - At least two rounds of requirements and tradeoff questions.
It then researches the codebase, compares at least three approaches, recommends one, and writes:
Write The Spec¶
Use $sdd-spec to create the formal specification:
The spec is the single source of truth. It must include:
- problem statement and goals
- architectural design
- module breakdown
- test specification
- acceptance criteria
- Codebase Contract
- worktree strategy
- open questions
If a brainstorm or proposal exists, $sdd-spec consumes it as authoritative
input. Resolved questions marked [x] are carried forward and must not be
re-asked.
Before writing the spec, the flow resolves and validates:
Rules:
type: featuredefaults tobase_branch: dev.type: featuremay usestagingduring a release freeze.type: featuremust not usemain.type: hotfixmust usemain.
For feature specs, $sdd-spec reserves the formal FEAT-NNN through:
python -m scripts.sdd.reserve_ids --kind feature --count 1 --base-branch <base_branch> --label <feature-slug>
Do not hand-compute feature IDs.
Generate Tasks¶
After reviewing the spec, set:
Then run:
This skill:
- Syncs the spec's
base_branch. - Decomposes the spec into atomic tasks.
- Reserves
TASK-NNNIDs for feature work. - Writes task files to
sdd/tasks/active/. - Writes or updates the per-spec index at
sdd/tasks/index/<feature-slug>.json. - Commits only the task files and index.
- Creates the feature worktree under
.claude/worktrees/.
Task IDs are reserved with:
python -m scripts.sdd.reserve_ids --kind task --count <N> --base-branch <base_branch> --label <feature-slug>
Do not hand-compute task IDs.
Implement One Task¶
Move into the generated worktree:
Then run:
$sdd-start does not stop after a kickoff summary. It must continue through
implementation unless a stop condition is reached.
The worker must:
- read the task and spec
- verify the task's Codebase Contract
- modify only files listed by the task
- run the task's acceptance checks
- commit the implementation files
- close the task with
scripts/sdd/close_task.sh - fill the task Completion Note
- commit the SDD state update
Use this command for a single task when you want tight control over each step.
Implement A Whole Feature With sdd-worker¶
For unattended implementation, ask Codex to delegate to the custom agent:
The sdd-worker agent:
- resolves the feature from
sdd/tasks/index/*.json - syncs the base branch
- creates or reuses the feature worktree
- implements tasks in dependency order
- commits after each task
- updates SDD state in the same worktree branch
- runs an adversarial review before pushing
- pushes the feature branch
It also supports task-scoped JSON briefs:
In task-scoped mode it implements only that task and does not touch unrelated task state.
Use /agent or /subagents in Codex to inspect spawned agent threads while
they run.
Close The Feature¶
Run closeout from the main repository, not from inside the worktree:
$sdd-done FEAT-NNN
$sdd-done FEAT-NNN --dry-run
$sdd-done FEAT-NNN --force
$sdd-done FEAT-NNN --resolve-jira
$sdd-done verifies:
- current branch matches the spec's
base_branch - the command is not running inside
.claude/worktrees/ - the feature worktree exists
- every task has commit and file evidence
It then stamps verification into the worktree's per-spec index, pushes the feature branch, and opens a PR for feature flows.
For feature work, the default closeout opens a PR against dev, staging, or
the configured parent branch. Use --merge only when direct merge is
intentional.
For hotfix work, $sdd-done never merges directly to main and never pushes
to main. It prints the manual gh pr create --base main ... command. After
that PR is merged, use --sync-down only if the automatic sync workflow did
not propagate the hotfix to staging and dev.
Artifact Locations¶
| Artifact | Path |
|---|---|
| Brainstorms | sdd/proposals/<slug>.brainstorm.md |
| Proposals | sdd/proposals/<slug>.proposal.md |
| Proposal research state | sdd/state/<FEAT-ID>/ |
| Specs | sdd/specs/<slug>.spec.md |
| Active tasks | sdd/tasks/active/TASK-NNN-<slug>.md |
| Completed tasks | sdd/tasks/completed/TASK-NNN-<slug>.md |
| Per-spec task index | sdd/tasks/index/<slug>.json |
| Worktrees | .claude/worktrees/<branch-name>/ |
| Codex SDD skills | .agents/skills/sdd-*/SKILL.md |
| Codex worker agent | .codex/agents/sdd-worker.toml |
Safety Rules¶
Keep these rules intact when running the flow:
- Commit the output of each SDD stage before creating or using worktrees.
- Do not use
git add .orgit add -Afor SDD state commits. - Do not update task state in the main repo while implementing inside a worktree.
- Do not touch files outside the task scope without updating the task or asking the user.
- Do not invent imports, symbols, or dependencies. Verify with wiki,
rg, and source reads. - Store persisted test logs under
artifacts/logs/. - Do not run
$sdd-taskor$sdd-donefrom inside a worktree. - Do not direct-merge hotfixes to
main.
Common Recipes¶
Ticket-driven feature:
$sdd-proposal NAV-8036
$sdd-spec nav-8036-<slug>
# edit spec status to approved
$sdd-task sdd/specs/nav-8036-<slug>.spec.md
cd .claude/worktrees/feat-<FEAT-ID>-nav-8036-<slug>
$sdd-start TASK-NNN
# repeat tasks
cd ../../..
$sdd-done FEAT-NNN --resolve-jira
Greenfield feature:
$sdd-brainstorm batch-embedding-pipeline -- "Batch embeddings with resumable checkpoints."
$sdd-spec batch-embedding-pipeline
# edit spec status to approved
$sdd-task sdd/specs/batch-embedding-pipeline.spec.md
Use the sdd-worker agent to implement FEAT-NNN.
$sdd-done FEAT-NNN
Hotfix:
$sdd-proposal NAV-9001 --mode=investigation
$sdd-spec nav-9001-pdf-hotfix --type hotfix --base-branch main
# usually skip task decomposition for very small hotfixes
Use the sdd-worker agent to implement the hotfix spec.
$sdd-done NAV-9001
Related Documentation¶
- SDD Workflow
- SDD Guide
- SDD Platform
AGENTS.md.agents/skills/sdd-*/SKILL.md.codex/agents/sdd-worker.toml