Clade for Codex
This workflow runs directly in Codex. Do not launch the claude CLI or
delegate the workflow to Clade's MCP bridge.
Codex compatibility rules:
- Plugin skills are namespaced. Invoke this workflow explicitly as
$clade:incident; a bare $name does not select the installed Clade plugin.
- Read the nearest
AGENTS.md files for repository instructions. If a project
has only CLAUDE.md, treat it as legacy project guidance and read it too.
- Store new Clade working state under
.clade/ (or ~/.clade/ for personal
state). Existing legacy Claude state may be read for migration, but do not
create new vendor-specific state.
- A
/skill-name reference means the corresponding Codex
$clade:skill-name plugin skill, or the same workflow invoked naturally when
explicit skill invocation is not available.
- Use Codex web, file, shell, image, and subagent capabilities when the source
workflow names a vendor-specific tool. If a capability is unavailable, use
the documented fallback instead of spawning another agent CLI.
- Paths such as
<plugin-root>/... are relative to the installed Clade plugin
containing this SKILL.md; resolve that root before invoking a helper.
Canonical Clade workflow
/incident Skill: Structured Incident Logging
Overview
This skill helps you systematically capture incidents, analyze their root causes, and extract lessons learned to prevent future recurrence.
Workflow
Step 1: Gather Incident Details
If the user provided a description with /incident <description>, use that. Otherwise, ask the user:
- What went wrong? (the symptom, the failure, what the user observed)
- What was the context? (what was being done, what changed, what was the state)
- What was the impact? (did it affect production, other users, how long did it last)
Step 2: Perform Root Cause Analysis
Once you have the details, conduct a structured RCA:
- Immediate cause: What directly caused the failure? (e.g., missing validation, race condition, config not deployed)
- Root cause: Why was the immediate cause present? (e.g., code not tested, config drift, async task not awaited)
- Category: Classify the root cause into one of these categories:
settings-disconnect: Config defined but not wired, loaded, or called
edge-case: Untested input, OS-specific behavior, empty/null/first-run state
async-race: TOCTOU (time-of-check-time-of-use), stale closures, missing locks, zombie processes
security: Unsanitized input, leaked secrets, missing auth/validation
deploy-gap: Source differs from deployed, config not reloaded, code defined but not called at runtime
Step 3: Write Incident Entry
Create or update .clade/incidents.md with a new entry:
## Incident — {date: YYYY-MM-DD}
**What:** {1-2 sentence symptom - what went wrong}
**Context:** {1-2 sentences - what was being done, what changed}
**Root cause:** {1-2 sentences - why did it happen, which category}
**Fix applied:** {how was it resolved, if immediate fix exists}
**Prevention:** {what should prevent this next time - concrete steps, not vague}
Example:
## Incident — 2026-02-26
**What:** API endpoint returned 500 on startup, database connection string missing from error response.
**Context:** Deploying to production with new secrets management; assumed .env would be loaded from system but it wasn't.
**Root cause:** Secrets loading hook defined in config but never called during server startup. [deploy-gap]
**Fix applied:** Added explicit `await loadSecrets()` call in server init before database connect.
**Prevention:** Add startup checklist: (1) required envvars defined, (2) all config-loading hooks executed, (3) test startup on fresh container.
Step 4: Extract Corrective Rule (Optional)
If the incident reveals a pattern worth remembering, offer to append a rule to corrections/rules.md:
Format:
- [YYYY-MM-DD] {domain} ({root-cause-category}): {do this} instead of {not this}
Example:
- [2026-02-26] deploy (deploy-gap): Call `loadSecrets()` explicitly in server init — not rely on framework autoload
Ask the user if they want to add the rule. If yes, append it to the file. If no, skip.
Step 5: Confirm and Close
Once the incident entry is written, print:
✓ Incident logged to .clade/incidents.md — [link to timestamp]
If a rule was added:
✓ Corrective rule added to corrections/rules.md
Implementation Notes
- Keep it concise: Incident entries should be scannable — one incident per date.
- Date format: Use YYYY-MM-DD (e.g., 2026-02-27).
- Prevention is key: The "Prevention" section is the most valuable part — it should be concrete and actionable, not vague.
- Root cause category is required for rule extraction — it helps organize lessons by type.
- If .clade/incidents.md doesn't exist, create it with a header:
# Incident Log\n\n.
- If corrections/rules.md doesn't exist, create it with a header:
# Correction Rules\n\n.
User Interaction Model
- User runs
/incident with optional description: /incident "API timeout during batch job"
- If no description, ask for what/context/impact
- Conduct RCA together (ask clarifying questions if needed)
- Write the incident entry to
.clade/incidents.md
- Append the prevention work to
TODO.md. The entry's Prevention field is
already the follow-up task; a postmortem whose prevention lives only in an
incidents file is a postmortem nobody acts on. One checkbox per preventable
cause, each naming the file or gate that would have caught it. Say so if
there is genuinely nothing to prevent — that is a finding, not an omission.
- Offer to extract a rule — get user confirmation before appending
- Confirm logging is complete, and name the TODO items you added
Completion Status
- ✅ DONE — task completed successfully
- ⚠ DONE_WITH_CONCERNS — completed but with caveats to note
- ❌ BLOCKED — cannot proceed; write details to
.clade/blockers.md
- ❓ NEEDS_CONTEXT — missing information; use AskUserQuestion
3-strike rule: If the same approach fails 3 times, switch to BLOCKED — do not retry indefinitely.
Delivery completion
If this workflow changes files or external state:
- Inspect the real final state before responding, including
git status for a
repository task.
- Never report
DONE while task-owned changes are uncommitted. Use or continue
$clade:delivery and create a repository-compliant checkpoint or preserve
the work when committing is unavailable.
- When the user request or trusted repository policy makes publication,
deployment, or live verification part of the task, do not silently downgrade
the result to local-only work.
- If a required delivery transition lacks authority, credentials, a destination,
or reachable external state, report
BLOCKED or NEEDS_CONTEXT rather than
appending a "not committed/pushed/deployed" caveat after DONE.
1---2name: incident-23description: Incident response mode — diagnose a production issue, write a postmortem, add follow-up tasks to TODO.md. Use when user says "/incident [description]".4---56# Clade for Codex78This workflow runs **directly in Codex**. Do not launch the `claude` CLI or9delegate the workflow to Clade's MCP bridge.1011Codex compatibility rules:1213- Plugin skills are namespaced. Invoke this workflow explicitly as14 `$clade:incident`; a bare `$name` does not select the installed Clade plugin.15- Read the nearest `AGENTS.md` files for repository instructions. If a project16 has only `CLAUDE.md`, treat it as legacy project guidance and read it too.17- Store new Clade working state under `.clade/` (or `~/.clade/` for personal18 state). Existing legacy Claude state may be read for migration, but do not19 create new vendor-specific state.20- A `/skill-name` reference means the corresponding Codex21 `$clade:skill-name` plugin skill, or the same workflow invoked naturally when22 explicit skill invocation is not available.23- Use Codex web, file, shell, image, and subagent capabilities when the source24 workflow names a vendor-specific tool. If a capability is unavailable, use25 the documented fallback instead of spawning another agent CLI.26- Paths such as `<plugin-root>/...` are relative to the installed Clade plugin27 containing this `SKILL.md`; resolve that root before invoking a helper.2829## Canonical Clade workflow3031# /incident Skill: Structured Incident Logging3233## Overview34This skill helps you systematically capture incidents, analyze their root causes, and extract lessons learned to prevent future recurrence.3536## Workflow3738### Step 1: Gather Incident Details39If the user provided a description with `/incident <description>`, use that. Otherwise, ask the user:40- **What went wrong?** (the symptom, the failure, what the user observed)41- **What was the context?** (what was being done, what changed, what was the state)42- **What was the impact?** (did it affect production, other users, how long did it last)4344### Step 2: Perform Root Cause Analysis45Once you have the details, conduct a structured RCA:46- **Immediate cause**: What directly caused the failure? (e.g., missing validation, race condition, config not deployed)47- **Root cause**: Why was the immediate cause present? (e.g., code not tested, config drift, async task not awaited)48- **Category**: Classify the root cause into one of these categories:49 - `settings-disconnect`: Config defined but not wired, loaded, or called50 - `edge-case`: Untested input, OS-specific behavior, empty/null/first-run state51 - `async-race`: TOCTOU (time-of-check-time-of-use), stale closures, missing locks, zombie processes52 - `security`: Unsanitized input, leaked secrets, missing auth/validation53 - `deploy-gap`: Source differs from deployed, config not reloaded, code defined but not called at runtime5455### Step 3: Write Incident Entry56Create or update `.clade/incidents.md` with a new entry:5758```markdown59## Incident — {date: YYYY-MM-DD}60**What:** {1-2 sentence symptom - what went wrong}61**Context:** {1-2 sentences - what was being done, what changed}62**Root cause:** {1-2 sentences - why did it happen, which category}63**Fix applied:** {how was it resolved, if immediate fix exists}64**Prevention:** {what should prevent this next time - concrete steps, not vague}65```6667Example:68```markdown69## Incident — 2026-02-2670**What:** API endpoint returned 500 on startup, database connection string missing from error response.71**Context:** Deploying to production with new secrets management; assumed .env would be loaded from system but it wasn't.72**Root cause:** Secrets loading hook defined in config but never called during server startup. [deploy-gap]73**Fix applied:** Added explicit `await loadSecrets()` call in server init before database connect.74**Prevention:** Add startup checklist: (1) required envvars defined, (2) all config-loading hooks executed, (3) test startup on fresh container.75```7677### Step 4: Extract Corrective Rule (Optional)78If the incident reveals a pattern worth remembering, offer to append a rule to `corrections/rules.md`:7980Format:81```82- [YYYY-MM-DD] {domain} ({root-cause-category}): {do this} instead of {not this}83```8485Example:86```87- [2026-02-26] deploy (deploy-gap): Call `loadSecrets()` explicitly in server init — not rely on framework autoload88```8990Ask the user if they want to add the rule. If yes, append it to the file. If no, skip.9192### Step 5: Confirm and Close93Once the incident entry is written, print:9495```96✓ Incident logged to .clade/incidents.md — [link to timestamp]97```9899If a rule was added:100```101✓ Corrective rule added to corrections/rules.md102```103104---105106## Implementation Notes107108- **Keep it concise**: Incident entries should be scannable — one incident per date.109- **Date format**: Use YYYY-MM-DD (e.g., 2026-02-27).110- **Prevention is key**: The "Prevention" section is the most valuable part — it should be concrete and actionable, not vague.111- **Root cause category** is required for rule extraction — it helps organize lessons by type.112- **If .clade/incidents.md doesn't exist**, create it with a header: `# Incident Log\n\n`.113- **If corrections/rules.md doesn't exist**, create it with a header: `# Correction Rules\n\n`.114115---116117## User Interaction Model1181191. User runs `/incident` with optional description: `/incident "API timeout during batch job"`1202. If no description, ask for what/context/impact1213. Conduct RCA together (ask clarifying questions if needed)1224. Write the incident entry to `.clade/incidents.md`1235. **Append the prevention work to `TODO.md`.** The entry's Prevention field is124 already the follow-up task; a postmortem whose prevention lives only in an125 incidents file is a postmortem nobody acts on. One checkbox per preventable126 cause, each naming the file or gate that would have caught it. Say so if127 there is genuinely nothing to prevent — that is a finding, not an omission.1286. Offer to extract a rule — get user confirmation before appending1297. Confirm logging is complete, and name the TODO items you added130131132---133134## Completion Status135136- ✅ **DONE** — task completed successfully137- ⚠ **DONE_WITH_CONCERNS** — completed but with caveats to note138- ❌ **BLOCKED** — cannot proceed; write details to `.clade/blockers.md`139- ❓ **NEEDS_CONTEXT** — missing information; use AskUserQuestion140141**3-strike rule:** If the same approach fails 3 times, switch to BLOCKED — do not retry indefinitely.142143## Delivery completion144145If this workflow changes files or external state:146147- Inspect the real final state before responding, including `git status` for a148 repository task.149- Never report `DONE` while task-owned changes are uncommitted. Use or continue150 `$clade:delivery` and create a repository-compliant checkpoint or preserve151 the work when committing is unavailable.152- When the user request or trusted repository policy makes publication,153 deployment, or live verification part of the task, do not silently downgrade154 the result to local-only work.155- If a required delivery transition lacks authority, credentials, a destination,156 or reachable external state, report `BLOCKED` or `NEEDS_CONTEXT` rather than157 appending a "not committed/pushed/deployed" caveat after `DONE`.