Codex Document Flow
Purpose
- Create and maintain PRD/ADR/Design/Plan documents without subagents.
- Keep explicit stop/approval tag pairs before phase transitions.
Execution Contract
This skill follows the non-entry execution contract standard.
Required contract_extensions: mode, target_docs.
See codex-execution-contract.md and non-entry-execution-contract-template.md for full rules.
input:
objective: "Update design and plan docs for feature X"
contract_extensions: { mode: "update", target_docs: ["docs/design/feature-x-design.md", "docs/plans/feature-x-plan.md"] }
output:
status: "completed"
quality_gate:
gate_id: "document-alignment-check"
gate_type: "document"
trigger: "post-document review"
criteria:
- "Target documents are updated"
- "Document set is internally consistent"
result: "pass"
evidence:
- "Target docs aligned"
blockers: []
branching:
on_pass: "handoff"
on_fail: "revise"
max_cycles: 2
contract_extensions: { mode: "update", target_docs: ["docs/design/feature-x-design.md", "docs/plans/feature-x-plan.md"] }
Contract Compliance
- Emit structured output compliant with
codex-execution-contract.md.
- Always include baseline output fields:
status, summary, changed_files, tests, quality_gate, blockers, next_actions.
- Validate required input fields from
../workflow-entry/references/non-entry-execution-contract-template.md (objective, scope, constraints, acceptance_criteria, allowed_commands, sandbox_mode) before proceeding.
- Echo required skill extensions in
contract_extensions: mode, target_docs.
- Treat missing required fields as contract violations and regenerate output before handoff.
- On contract violation (missing/invalid field, invalid status value, or missing extension keys): do not proceed; emit status: blocked with violation description in blockers.
- Reference:
non-entry-execution-contract-template.md.
Modes
create: new document generation.
update: modify existing documents while preserving rationale and change history.
reverse: generate documents from current codebase behavior.
Phase Rules
- Requirements first: clarify goals, constraints, success criteria.
- Decide scale and required documents.
- Create documents using
documentation-criteria templates.
- Run quality and consistency review.
- Emit
[Stop: pre-design-approval] + [Approve: design-approval] before moving to the next phase.
Required Document Matrix
| Scale |
Required docs |
| Small |
simplified plan, optional design note |
| Medium |
Design Doc + Work Plan |
| Large |
PRD + Design Doc + Work Plan, ADR when needed |
Reverse-Engineering Flow
- Discover scope from existing code and modules.
- Draft PRD from observable behavior.
- Draft Design Doc from architecture and data flow.
- Run consistency check between docs and code observations.
- Present unresolved ambiguities as explicit questions.
Update-Doc Flow
- Identify target docs and reasons for change.
- Apply updates in smallest coherent unit.
- Re-run consistency review across related docs.
- Produce concise change summary and emit
[Stop: pre-design-approval] + [Approve: design-approval].
Hard Stop Points
- Requirements are contradictory.
- Existing code behavior conflicts with requested spec and no decision is provided.
- Architecture-impacting changes are requested without ADR-level decision.
Quality Gate Evidence
- This executor owns
quality_gate emission and branching using quality-gate-evidence-template.md.
- Emit canonical fields:
gate_id, gate_type, trigger, criteria, result, evidence, blockers, branching.
- Use
gate_type: document for document quality and completeness checks.
- Normalize local statuses into
result: pass|fail|blocked before handoff.
- If
result: blocked, emit [Stop: quality-gate-failed] and pause for escalation handling.
Stop/Approval Protocol
Use canonical markers: [Stop: <Gate Name>].
Classify every stop as approval_gate or escalation_gate.
At each stop, emit a full gate record: gate_name, gate_type, trigger, ask_method, required_user_action, resume_if, fallback_if_rejected.
Default ask_method is AskUserQuestion.
Resume an approval_gate only with explicit user approved: true; resume an escalation_gate only after user direction or reroute.
Respect batch boundary: document phases stay human-gated, and transitions into implementation require [Stop: pre-implementation-approval].
Enforce max_revision_cycles: 2; overflow requires human intervention.
Agent-local document review approvals never replace user approvals.
Stop points for this skill:
[Stop: pre-design-approval] (approval_gate)
[Stop: pre-implementation-approval] (approval_gate)
[Stop: high-risk-change] (approval_gate)
[Stop: requirement-change-detected] (escalation_gate)
[Stop: quality-gate-failed] (escalation_gate)
[Stop: revision-limit-reached] (escalation_gate)
Full protocol and payload schema: ../workflow-entry/references/stop-approval-section-template.md.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: codex-document-flow3description: Document-centered workflow for design, planning, reverse-engineering, and updates using Codex skills only. Replaces document-focused subagent chains. Use when this capability is needed.4---56# Codex Document Flow78## Purpose910- Create and maintain PRD/ADR/Design/Plan documents without subagents.11- Keep explicit stop/approval tag pairs before phase transitions.1213## Execution Contract1415This skill follows the non-entry execution contract standard.16Required `contract_extensions`: `mode`, `target_docs`.17See [`codex-execution-contract.md`](../workflow-entry/references/codex-execution-contract.md) and [`non-entry-execution-contract-template.md`](../workflow-entry/references/non-entry-execution-contract-template.md) for full rules.1819```yaml20input:21 objective: "Update design and plan docs for feature X"22 contract_extensions: { mode: "update", target_docs: ["docs/design/feature-x-design.md", "docs/plans/feature-x-plan.md"] }23output:24 status: "completed"25 quality_gate:26 gate_id: "document-alignment-check"27 gate_type: "document"28 trigger: "post-document review"29 criteria:30 - "Target documents are updated"31 - "Document set is internally consistent"32 result: "pass"33 evidence:34 - "Target docs aligned"35 blockers: []36 branching:37 on_pass: "handoff"38 on_fail: "revise"39 max_cycles: 240 contract_extensions: { mode: "update", target_docs: ["docs/design/feature-x-design.md", "docs/plans/feature-x-plan.md"] }41```4243## Contract Compliance4445- Emit structured output compliant with [`codex-execution-contract.md`](../workflow-entry/references/codex-execution-contract.md).46- Always include baseline output fields: `status`, `summary`, `changed_files`, `tests`, `quality_gate`, `blockers`, `next_actions`.47- Validate required input fields from `../workflow-entry/references/non-entry-execution-contract-template.md` (objective, scope, constraints, acceptance_criteria, allowed_commands, sandbox_mode) before proceeding.48- Echo required skill extensions in `contract_extensions`: `mode`, `target_docs`.49- Treat missing required fields as contract violations and regenerate output before handoff.50- On contract violation (missing/invalid field, invalid status value, or missing extension keys): do not proceed; emit status: blocked with violation description in blockers.51- Reference: [`non-entry-execution-contract-template.md`](../workflow-entry/references/non-entry-execution-contract-template.md).5253## Modes5455- `create`: new document generation.56- `update`: modify existing documents while preserving rationale and change history.57- `reverse`: generate documents from current codebase behavior.5859## Phase Rules60611. Requirements first: clarify goals, constraints, success criteria.622. Decide scale and required documents.633. Create documents using `documentation-criteria` templates.644. Run quality and consistency review.655. Emit `[Stop: pre-design-approval]` + `[Approve: design-approval]` before moving to the next phase.6667## Required Document Matrix6869| Scale | Required docs |70|---|---|71| Small | simplified plan, optional design note |72| Medium | Design Doc + Work Plan |73| Large | PRD + Design Doc + Work Plan, ADR when needed |7475## Reverse-Engineering Flow76771. Discover scope from existing code and modules.782. Draft PRD from observable behavior.793. Draft Design Doc from architecture and data flow.804. Run consistency check between docs and code observations.815. Present unresolved ambiguities as explicit questions.8283## Update-Doc Flow84851. Identify target docs and reasons for change.862. Apply updates in smallest coherent unit.873. Re-run consistency review across related docs.884. Produce concise change summary and emit `[Stop: pre-design-approval]` + `[Approve: design-approval]`.8990## Hard Stop Points9192- Requirements are contradictory.93- Existing code behavior conflicts with requested spec and no decision is provided.94- Architecture-impacting changes are requested without ADR-level decision.9596## Quality Gate Evidence9798- This executor owns `quality_gate` emission and branching using [`quality-gate-evidence-template.md`](../workflow-entry/references/quality-gate-evidence-template.md).99- Emit canonical fields: `gate_id`, `gate_type`, `trigger`, `criteria`, `result`, `evidence`, `blockers`, `branching`.100- Use `gate_type: document` for document quality and completeness checks.101- Normalize local statuses into `result: pass|fail|blocked` before handoff.102- If `result: blocked`, emit `[Stop: quality-gate-failed]` and pause for escalation handling.103104## Stop/Approval Protocol105106Use canonical markers: `[Stop: <Gate Name>]`.107Classify every stop as `approval_gate` or `escalation_gate`.108At each stop, emit a full gate record: `gate_name`, `gate_type`, `trigger`, `ask_method`, `required_user_action`, `resume_if`, `fallback_if_rejected`.109Default `ask_method` is `AskUserQuestion`.110Resume an `approval_gate` only with explicit user `approved: true`; resume an `escalation_gate` only after user direction or reroute.111Respect batch boundary: document phases stay human-gated, and transitions into implementation require `[Stop: pre-implementation-approval]`.112Enforce `max_revision_cycles: 2`; overflow requires human intervention.113Agent-local document review approvals never replace user approvals.114115Stop points for this skill:116- `[Stop: pre-design-approval]` (`approval_gate`)117- `[Stop: pre-implementation-approval]` (`approval_gate`)118- `[Stop: high-risk-change]` (`approval_gate`)119- `[Stop: requirement-change-detected]` (`escalation_gate`)120- `[Stop: quality-gate-failed]` (`escalation_gate`)121- `[Stop: revision-limit-reached]` (`escalation_gate`)122123Full protocol and payload schema: [`../workflow-entry/references/stop-approval-section-template.md`](../workflow-entry/references/stop-approval-section-template.md).124125---126> Converted and distributed by [TomeVault](https://tomevault.io/claim/ssaattww) — claim your Tome and manage your conversions.127<!-- tomevault:4.0:skill_md:2026-04-14 -->