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:map; 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
/map Skill: Generate Project Architecture Diagram
Purpose
Automatically scan the project structure and generate ARCHITECTURE.md with a module relationship diagram using Mermaid.
Execution Steps
Read existing ARCHITECTURE.md
- If
ARCHITECTURE.md exists at the project root, read it first
- This helps preserve any existing documentation and allows you to update rather than overwrite
Scan project structure
- Use Glob to find major directories:
find . -maxdepth 2 -type d -not -path '*/\.*' -not -path '*/node_modules/*' -not -path '*/__pycache__/*'
- For each top-level directory (src/, lib/, app/, components/, etc.), identify:
- What it contains (modules, libraries, features)
- Its primary responsibility
- Key files or sub-modules within it
Identify modules and dependencies
- Scan key files with Grep/Read to understand module structure
- Map logical dependencies (imports, API calls, shared state)
- Identify which modules depend on which others
- Look for: package.json, setup.py, .go files, main entry points
Generate Mermaid diagram
Write ARCHITECTURE.md
Create or update ARCHITECTURE.md at the project root
Structure:
# Project Architecture
## Overview
[1-2 sentence high-level description of what the project does]
## Directory Structure
### src/
[Description of what this directory contains]
- Key files: file1.ts, file2.ts
### lib/
[Description]
- Key files: ...
[... repeat for each top-level directory ...]
## Module Relationships
```mermaid
[Your generated Mermaid graph]
Key Components
Module Name
- Location: src/module/
- Responsibility: What this module does
- Exports: Key functions/classes
- Depends on: Other modules it uses
[... repeat for each major module ...]
Data Flow
[Optional: describe how data flows through the system, if applicable]
```
Keep descriptions concise (1-3 lines per section)
Focus on "why" not "what" — what problem does each module solve?
Report success
- Tell the user: "Updated ARCHITECTURE.md"
- If the diagram is complex, add a note about what the diagram shows
Implementation Notes
- Diagram scope: Show the 5-10 most important modules, not every single file
- Avoid noise: Don't include vendored code (node_modules, venv, .git)
- Update strategy: If ARCHITECTURE.md exists, preserve existing descriptions and update the diagram + file list
- Language: Use English for all documentation
- Mermaid syntax: Use valid Mermaid graph TD syntax; test the diagram visually if possible
Success Criteria
✓ ARCHITECTURE.md exists at project root
✓ Diagram renders without syntax errors
✓ All major modules are represented
✓ Dependencies are correctly shown
✓ Descriptions are clear and concise
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: map3description: Scan project structure and generate ARCHITECTURE.md with a Mermaid module relationship diagram. Use when user says "/map".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:map`; 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# /map Skill: Generate Project Architecture Diagram3233## Purpose34Automatically scan the project structure and generate `ARCHITECTURE.md` with a module relationship diagram using Mermaid.3536## Execution Steps37381. **Read existing ARCHITECTURE.md**39 - If `ARCHITECTURE.md` exists at the project root, read it first40 - This helps preserve any existing documentation and allows you to update rather than overwrite41422. **Scan project structure**43 - Use Glob to find major directories: `find . -maxdepth 2 -type d -not -path '*/\.*' -not -path '*/node_modules/*' -not -path '*/__pycache__/*'`44 - For each top-level directory (src/, lib/, app/, components/, etc.), identify:45 - What it contains (modules, libraries, features)46 - Its primary responsibility47 - Key files or sub-modules within it48493. **Identify modules and dependencies**50 - Scan key files with Grep/Read to understand module structure51 - Map logical dependencies (imports, API calls, shared state)52 - Identify which modules depend on which others53 - Look for: package.json, setup.py, .go files, main entry points54554. **Generate Mermaid diagram**56 - Create a `graph TD` (top-down) Mermaid diagram showing:57 - Each major module as a node (use clear, short names)58 - Arrows showing dependencies: `ModuleA --> ModuleB` means ModuleA imports/uses ModuleB59 - Group related modules if they form a subsystem60 - Keep the diagram readable (max ~10-15 nodes for clarity)61 - Example structure:62 ```63 graph TD64 API["API Layer"]65 DB["Database"]66 Auth["Authentication"]67 UI["Frontend"]6869 UI --> API70 API --> Auth71 API --> DB72 Auth --> DB73 ```74755. **Write ARCHITECTURE.md**76 - Create or update `ARCHITECTURE.md` at the project root77 - **Structure**:78 ```markdown79 # Project Architecture8081 ## Overview82 [1-2 sentence high-level description of what the project does]8384 ## Directory Structure8586 ### src/87 [Description of what this directory contains]88 - Key files: file1.ts, file2.ts8990 ### lib/91 [Description]92 - Key files: ...9394 [... repeat for each top-level directory ...]9596 ## Module Relationships9798 ```mermaid99 [Your generated Mermaid graph]100 ```101102 ## Key Components103104 ### Module Name105 - **Location**: src/module/106 - **Responsibility**: What this module does107 - **Exports**: Key functions/classes108 - **Depends on**: Other modules it uses109110 [... repeat for each major module ...]111112 ## Data Flow113 [Optional: describe how data flows through the system, if applicable]114 ```115 - Keep descriptions concise (1-3 lines per section)116 - Focus on "why" not "what" — what problem does each module solve?1171186. **Report success**119 - Tell the user: "Updated ARCHITECTURE.md"120 - If the diagram is complex, add a note about what the diagram shows121122## Implementation Notes123124- **Diagram scope**: Show the 5-10 most important modules, not every single file125- **Avoid noise**: Don't include vendored code (node_modules, venv, .git)126- **Update strategy**: If ARCHITECTURE.md exists, preserve existing descriptions and update the diagram + file list127- **Language**: Use English for all documentation128- **Mermaid syntax**: Use valid Mermaid graph TD syntax; test the diagram visually if possible129130## Success Criteria131132✓ ARCHITECTURE.md exists at project root133✓ Diagram renders without syntax errors134✓ All major modules are represented135✓ Dependencies are correctly shown136✓ Descriptions are clear and concise137138139---140141## Completion Status142143- ✅ **DONE** — task completed successfully144- ⚠ **DONE_WITH_CONCERNS** — completed but with caveats to note145- ❌ **BLOCKED** — cannot proceed; write details to `.clade/blockers.md`146- ❓ **NEEDS_CONTEXT** — missing information; use AskUserQuestion147148**3-strike rule:** If the same approach fails 3 times, switch to BLOCKED — do not retry indefinitely.149150## Delivery completion151152If this workflow changes files or external state:153154- Inspect the real final state before responding, including `git status` for a155 repository task.156- Never report `DONE` while task-owned changes are uncommitted. Use or continue157 `$clade:delivery` and create a repository-compliant checkpoint or preserve158 the work when committing is unavailable.159- When the user request or trusted repository policy makes publication,160 deployment, or live verification part of the task, do not silently downgrade161 the result to local-only work.162- If a required delivery transition lacks authority, credentials, a destination,163 or reachable external state, report `BLOCKED` or `NEEDS_CONTEXT` rather than164 appending a "not committed/pushed/deployed" caveat after `DONE`.