@orderful/droid 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/bin/droid.js +189 -82
  3. package/dist/index.js +175 -72
  4. package/dist/lib/config.d.ts.map +1 -1
  5. package/dist/lib/migrations.d.ts +30 -0
  6. package/dist/lib/migrations.d.ts.map +1 -0
  7. package/dist/lib/skill-config.d.ts.map +1 -1
  8. package/dist/lib/skills.d.ts.map +1 -1
  9. package/dist/lib/types.d.ts +10 -0
  10. package/dist/lib/types.d.ts.map +1 -1
  11. package/dist/tools/brain/TOOL.yaml +1 -1
  12. package/dist/tools/coach/TOOL.yaml +1 -1
  13. package/dist/tools/codex/TOOL.yaml +32 -0
  14. package/dist/tools/codex/commands/codex.md +70 -0
  15. package/dist/tools/codex/skills/droid-codex/SKILL.md +266 -0
  16. package/dist/tools/codex/skills/droid-codex/references/creating.md +150 -0
  17. package/dist/tools/codex/skills/droid-codex/references/decisions.md +128 -0
  18. package/dist/tools/codex/skills/droid-codex/references/loading.md +163 -0
  19. package/dist/tools/codex/skills/droid-codex/references/topics.md +213 -0
  20. package/dist/tools/comments/TOOL.yaml +1 -1
  21. package/dist/tools/droid/skills/droid/SKILL.md +8 -0
  22. package/dist/tools/project/TOOL.yaml +1 -1
  23. package/package.json +1 -1
  24. package/src/lib/config.ts +13 -2
  25. package/src/lib/migrations.test.ts +163 -0
  26. package/src/lib/migrations.ts +182 -0
  27. package/src/lib/skill-config.ts +3 -1
  28. package/src/lib/skills.ts +10 -1
  29. package/src/lib/types.ts +11 -0
  30. package/src/tools/brain/TOOL.yaml +1 -1
  31. package/src/tools/coach/TOOL.yaml +1 -1
  32. package/src/tools/codex/TOOL.yaml +32 -0
  33. package/src/tools/codex/commands/codex.md +70 -0
  34. package/src/tools/codex/skills/droid-codex/SKILL.md +266 -0
  35. package/src/tools/codex/skills/droid-codex/references/creating.md +150 -0
  36. package/src/tools/codex/skills/droid-codex/references/decisions.md +128 -0
  37. package/src/tools/codex/skills/droid-codex/references/loading.md +163 -0
  38. package/src/tools/codex/skills/droid-codex/references/topics.md +213 -0
  39. package/src/tools/comments/TOOL.yaml +1 -1
  40. package/src/tools/droid/skills/droid/SKILL.md +8 -0
  41. package/src/tools/project/TOOL.yaml +1 -1
package/src/lib/types.ts CHANGED
@@ -54,6 +54,7 @@ export interface DroidConfig {
54
54
  git_username: string;
55
55
  platforms: Record<string, PlatformConfig>;
56
56
  auto_update?: AutoUpdateConfig;
57
+ migrations?: Record<string, string>; // tool name -> last migrated version
57
58
  }
58
59
 
59
60
  // Legacy config structure for migration
@@ -120,6 +121,16 @@ export interface SkillOverrides {
120
121
  [key: string]: string | boolean | number;
121
122
  }
122
123
 
124
+ /**
125
+ * Tool migration function
126
+ * Should be idempotent - safe to run multiple times
127
+ */
128
+ export interface Migration {
129
+ version: string;
130
+ description: string;
131
+ up: (configDir: string) => Promise<void> | void;
132
+ }
133
+
123
134
  /**
124
135
  * Tool manifest structure (TOOL.yaml)
125
136
  */
@@ -1,6 +1,6 @@
1
1
  name: brain
2
2
  description: "Your scratchpad (or brain) - a collaborative space for planning and research. Create docs with /brain plan, /brain research, or /brain review. Use @mentions for async discussion. Docs persist across sessions."
3
- version: 0.2.2
3
+ version: 0.2.3
4
4
  status: beta
5
5
 
6
6
  includes:
@@ -1,6 +1,6 @@
1
1
  name: coach
2
2
  description: "Learning-mode AI assistance - AI as coach, not crutch. Use /coach plan for co-authored planning, /coach scaffold for structure with hints, /coach review for Socratic questions."
3
- version: 0.1.2
3
+ version: 0.1.3
4
4
  status: beta
5
5
 
6
6
  includes:
@@ -0,0 +1,32 @@
1
+ name: codex
2
+ description: "Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Use when loading project context, searching codex, capturing decisions, or adding explored topics."
3
+ version: 0.1.0
4
+ status: beta
5
+
6
+ includes:
7
+ skills:
8
+ - name: droid-codex
9
+ required: true
10
+ commands:
11
+ - codex
12
+ agents: []
13
+
14
+ dependencies: []
15
+
16
+ # Prerequisites checked on install
17
+ prerequisites:
18
+ - name: gh
19
+ description: GitHub CLI for PR workflows
20
+ check: "gh --version"
21
+ install_hint: "brew install gh && gh auth login"
22
+
23
+ config_schema:
24
+ codex_repo:
25
+ type: string
26
+ description: Path to local orderful-codex repository (required)
27
+ required: true
28
+ default: "~/src/github.com/orderful-codex"
29
+ freshness_days:
30
+ type: number
31
+ description: Days before showing staleness warning
32
+ default: 30
@@ -0,0 +1,70 @@
1
+ ---
2
+ description: Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics
3
+ argument-hint: "[projects | patterns | topics | {name} | search {query} | new {name} | decision {text} | add topic {name}]"
4
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash(gh:*), Bash(git:*), Bash(ls:*), Bash(mkdir:*)
5
+ ---
6
+
7
+ # /codex
8
+
9
+ Entry point for shared organizational knowledge. See the **codex skill** for full behaviour.
10
+
11
+ > Context is AI's multiplier. This is Orderful's.
12
+
13
+ ## Arguments
14
+
15
+ $ARGUMENTS
16
+
17
+ ## Prerequisites
18
+
19
+ Before first use, verify:
20
+
21
+ 1. **Repo cloned** at configured `codex_repo` path
22
+ 2. **gh CLI** installed and authenticated
23
+
24
+ ## Usage
25
+
26
+ ```bash
27
+ /codex # Show categories (projects, patterns, topics)
28
+ /codex projects # List projects
29
+ /codex patterns # List patterns
30
+ /codex topics # List topics
31
+ /codex {name} # Load entry (searches all categories)
32
+ /codex search {query} # Search across everything
33
+ /codex new {name} # Scaffold new project from templates
34
+ /codex decision {text} # Append to active project's DECISIONS.md
35
+ /codex snapshot {file} {name} # Import PDF/markdown to project
36
+ /codex add topic {name} # Add explored topic with freshness metadata
37
+ ```
38
+
39
+ ## Configuration
40
+
41
+ **ALWAYS read `~/.droid/skills/codex/overrides.yaml` first.**
42
+
43
+ - `codex_repo` - Path to local orderful-codex repository (required)
44
+ - `freshness_days` - Days before showing staleness warning (default: 30)
45
+
46
+ ## Behaviour
47
+
48
+ Refer to the codex skill for:
49
+ - **Loading**: How to search, handle matches, check freshness, auto-generate CONTEXT.md
50
+ - **Decisions**: How to append to active project's DECISIONS.md
51
+ - **Topics**: How to capture explored codebase areas with freshness metadata
52
+ - **Creating**: How to scaffold new projects from templates
53
+
54
+ The skill's `references/` folder contains detailed procedures for each workflow.
55
+
56
+ ## Examples
57
+
58
+ ```bash
59
+ # Load project context
60
+ /codex transaction-templates
61
+
62
+ # Search for webhook-related content
63
+ /codex search webhook
64
+
65
+ # Capture a decision during implementation
66
+ /codex decision "Using UUIDv7 for IDs because it's sortable and includes timestamp"
67
+
68
+ # Save today's exploration as a topic
69
+ /codex add topic organization-hierarchy
70
+ ```
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: droid-codex
3
+ description: "Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Use when loading project context ('load transaction-templates'), searching codex ('search webhook'), capturing decisions ('codex decision'), or adding explored topics ('add topic'). User prompts like 'check the codex', 'what's in the codex about X', 'load the PRD for Y'."
4
+ globs:
5
+ - "**/PRD.md"
6
+ - "**/TECH-DESIGN.md"
7
+ - "**/CONTEXT.md"
8
+ - "**/DECISIONS.md"
9
+ alwaysApply: false
10
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash(gh:*), Bash(git:*), Bash(ls:*), Bash(mkdir:*)
11
+ ---
12
+
13
+ # Codex Skill
14
+
15
+ > Context is AI's multiplier. This is Orderful's.
16
+
17
+ Shared organizational knowledge for humans and droids alike. Product requirements documents, tech designs, patterns, and explored topics - structured for AI-assisted development.
18
+
19
+ ## Prerequisites
20
+
21
+ Before using codex, verify:
22
+
23
+ 1. **Repo cloned:** Check if `codex_repo` path exists
24
+ 2. **gh CLI:** Required for PR workflows (CONTEXT.md auto-generation)
25
+
26
+ ```bash
27
+ # Check repo exists
28
+ ls -la {codex_repo}
29
+
30
+ # Check gh CLI
31
+ gh --version
32
+ ```
33
+
34
+ If prerequisites fail, guide user to fix:
35
+ - Repo missing: `git clone git@github.com:orderful/orderful-codex.git {path}`
36
+ - gh missing: `brew install gh && gh auth login`
37
+
38
+ ## Sync Before Reading
39
+
40
+ **Before any read operation** (loading, searching, listing), pull latest:
41
+
42
+ ```bash
43
+ git -C {codex_repo} pull --rebase --quiet
44
+ ```
45
+
46
+ This ensures shared knowledge is always current. The pull is quiet to avoid noise, but if it fails (conflicts, network), warn the user.
47
+
48
+ ## Security
49
+
50
+ ### Input Validation
51
+
52
+ **Always validate user-provided names before using in paths:**
53
+
54
+ ```bash
55
+ # REJECT names containing path traversal attempts
56
+ if [[ "{name}" == *".."* ]] || [[ "{name}" == *"/"* ]]; then
57
+ echo "Invalid name: must not contain '..' or '/'"
58
+ exit 1
59
+ fi
60
+
61
+ # REJECT names with shell metacharacters
62
+ if [[ "{name}" =~ [\$\`\|\;\&\>\<] ]]; then
63
+ echo "Invalid name: contains unsafe characters"
64
+ exit 1
65
+ fi
66
+ ```
67
+
68
+ ### Safe Git Commits
69
+
70
+ **Use heredoc for commit messages to prevent injection:**
71
+
72
+ ```bash
73
+ # GOOD - safe from injection
74
+ git commit -F - <<EOF
75
+ decision({active}): {summary}
76
+ EOF
77
+
78
+ # BAD - vulnerable to injection
79
+ git commit -m "decision({active}): {summary}"
80
+ ```
81
+
82
+ ### Access Control
83
+
84
+ **Check repo access before attempting write operations:**
85
+
86
+ ```bash
87
+ # Verify push access before making changes
88
+ if ! git -C {codex_repo} push --dry-run 2>/dev/null; then
89
+ echo "Error: No push access to codex repo. Check your permissions."
90
+ exit 1
91
+ fi
92
+ ```
93
+
94
+ ## Configuration
95
+
96
+ **ALWAYS read `~/.droid/skills/codex/overrides.yaml` first.**
97
+
98
+ | Setting | Default | Description |
99
+ |---------|---------|-------------|
100
+ | `codex_repo` | `~/src/github.com/orderful-codex` | Path to local codex repo |
101
+ | `freshness_days` | `30` | Days before staleness warning |
102
+
103
+ ## Categories
104
+
105
+ The codex has three categories:
106
+
107
+ | Category | Path | Purpose |
108
+ |----------|------|---------|
109
+ | `projects` | `{codex_repo}/projects/` | Feature/project context (PRD, tech design, decisions) |
110
+ | `patterns` | `{codex_repo}/patterns/` | Cross-cutting technical patterns |
111
+ | `topics` | `{codex_repo}/topics/` | Explored codebase areas with freshness tracking |
112
+
113
+ ## Commands
114
+
115
+ | Command | Action |
116
+ |---------|--------|
117
+ | `/codex` | Show categories overview |
118
+ | `/codex projects` | List all projects |
119
+ | `/codex patterns` | List all patterns |
120
+ | `/codex topics` | List all topics |
121
+ | `/codex {name}` | Load entry (searches all categories) |
122
+ | `/codex search {query}` | Search across everything |
123
+ | `/codex new {name}` | Scaffold new project from templates |
124
+ | `/codex decision {text}` | Append to active project's DECISIONS.md |
125
+ | `/codex snapshot {file} {name}` | Import PDF/markdown to project |
126
+ | `/codex add topic {name}` | Add explored topic with freshness metadata |
127
+
128
+ ## Loading an Entry
129
+
130
+ **Trigger:** `/codex {name}` or user asks to load/check codex for something
131
+
132
+ **Procedure:**
133
+
134
+ 1. Search for `{name}` across all categories (fuzzy match on folder/file names)
135
+ 2. If multiple matches → show list, let user pick
136
+ 3. If single match → load it
137
+ 4. For projects with multiple files → show file list, let user pick which to load
138
+ 5. Check freshness (see below)
139
+ 6. Output loaded content
140
+
141
+ **If no CONTEXT.md exists for a project:**
142
+ - Synthesise unified context from PRD.md + TECH-DESIGN.md + DECISIONS.md
143
+ - Create branch, commit CONTEXT.md, open PR
144
+ - Inform user: "I've created a CONTEXT.md summarising this project - PR #{number}"
145
+
146
+ Full procedure: `references/loading.md`
147
+
148
+ ## Freshness Checking
149
+
150
+ All codex files have frontmatter:
151
+
152
+ ```yaml
153
+ ---
154
+ title: Feature Name
155
+ type: prd | tech-design | context | decisions | pattern | topic
156
+ created: 2026-01-07
157
+ updated: 2026-01-07
158
+ confidence: high | medium | low
159
+ source: confluence | exploration | implementation
160
+ codebase_paths:
161
+ - apps/platform-api/src/...
162
+ ---
163
+ ```
164
+
165
+ **When loading any file:**
166
+
167
+ 1. Parse frontmatter for `updated` date
168
+ 2. Calculate days since update
169
+ 3. If > `freshness_days` (default 30):
170
+ - Warn: "This doc was last updated {date} ({n} days ago). Want me to verify it's still accurate?"
171
+ 4. If `codebase_paths` present:
172
+ - Check if those paths have commits since `updated` date
173
+ - If yes: "Files in {paths} have changed since this doc was updated. Want me to review?"
174
+ 5. If `confidence: low`:
175
+ - Note: "This was a quick exploration and may be incomplete"
176
+
177
+ ## Active Project Tracking
178
+
179
+ Scoped operations (`decision`, `snapshot`) require an active project:
180
+
181
+ - When user loads a project via `/codex {project-name}`, set it as active
182
+ - Store active project name in session context
183
+ - If scoped operation called with no active project → show project list, let user pick
184
+
185
+ ## Adding Decisions
186
+
187
+ **Trigger:** `/codex decision {text}` or user wants to capture a decision
188
+
189
+ **Procedure:**
190
+
191
+ 1. Verify active project exists (if not, prompt to select)
192
+ 2. Read `{codex_repo}/projects/{active}/DECISIONS.md`
193
+ 3. Append new decision with today's date:
194
+ ```markdown
195
+ ## {YYYY-MM-DD}: {Decision summary from text}
196
+
197
+ **Context:** {Extract from conversation}
198
+
199
+ **Decision:** {The decision}
200
+
201
+ **Rationale:** {Why this choice}
202
+ ```
203
+ 4. Update `updated` date in frontmatter
204
+ 5. Create branch, commit, and open PR via `gh pr create`
205
+
206
+ Full procedure: `references/decisions.md`
207
+
208
+ ## Adding Topics
209
+
210
+ **Trigger:** `/codex add topic {name}` or user wants to save exploration
211
+
212
+ **Procedure:**
213
+
214
+ 1. Create `{codex_repo}/topics/{name}.md`
215
+ 2. Use template from `{codex_repo}/templates/TOPIC.md`
216
+ 3. Fill in frontmatter:
217
+ - `explored`: today's date
218
+ - `confidence`: ask user or infer from exploration depth
219
+ - `codebase_paths`: paths that were explored
220
+ 4. Fill in content from current exploration/conversation
221
+ 5. Create branch, commit, and open PR via `gh pr create`
222
+
223
+ Full procedure: `references/topics.md`
224
+
225
+ ## Creating New Projects
226
+
227
+ **Trigger:** `/codex new {name}` or user wants to start new project entry
228
+
229
+ **Procedure:**
230
+
231
+ 1. Create `{codex_repo}/projects/{name}/`
232
+ 2. Copy templates from `{codex_repo}/templates/`:
233
+ - PRD.md
234
+ - TECH-DESIGN.md
235
+ - DECISIONS.md
236
+ 3. Fill in frontmatter with today's date
237
+ 4. Create branch, commit, and open PR via `gh pr create`
238
+
239
+ Full procedure: `references/creating.md`
240
+
241
+ ## Integration with /project
242
+
243
+ The codex holds **shared** organizational knowledge. The `/project` skill holds **personal** working memory.
244
+
245
+ ```
246
+ /codex transaction-templates → load shared context
247
+ /project create --from codex:{name} → seed personal PROJECT.md
248
+ /codex publish → promote learnings back (future)
249
+ ```
250
+
251
+ When user runs `/project create --from codex:{name}`:
252
+ 1. Load the codex entry
253
+ 2. Extract key context for personal PROJECT.md
254
+ 3. Create project in user's projects_dir
255
+
256
+ ## Git Workflow
257
+
258
+ **All codex changes must go through PRs** (main branch is protected):
259
+
260
+ 1. Create branch: `codex/{action}-{name}` (e.g., `codex/decision-uuid-format`)
261
+ 2. Make changes
262
+ 3. Commit with descriptive message
263
+ 4. Push and create PR via `gh pr create`
264
+ 5. Share PR link with user
265
+
266
+ Safe changes (new files, decision appends) are auto-merged by GitHub Action. Modifications to existing content require review.
@@ -0,0 +1,150 @@
1
+ # Creating New Projects
2
+
3
+ Detailed procedure for scaffolding new project entries in the codex.
4
+
5
+ ## When to Use
6
+
7
+ - Starting work on a new feature/project
8
+ - `/codex new {name}` command
9
+ - User asks to create a codex entry for something new
10
+
11
+ ## Procedure
12
+
13
+ ### 1. Determine Project Name
14
+
15
+ From user input:
16
+ - Use kebab-case: `transaction-templates`, `audit-logging`
17
+ - Should match how the team refers to the feature
18
+
19
+ ### 2. Check for Existing Entry
20
+
21
+ ```bash
22
+ ls {codex_repo}/projects/ | grep -i {name}
23
+ ```
24
+
25
+ If exists:
26
+ ```
27
+ A project named '{name}' already exists. Did you mean to load it?
28
+ → /codex {name}
29
+ ```
30
+
31
+ ### 3. Create Project Directory
32
+
33
+ ```bash
34
+ mkdir -p {codex_repo}/projects/{name}
35
+ ```
36
+
37
+ ### 4. Copy Templates
38
+
39
+ ```bash
40
+ cp {codex_repo}/templates/PRD.md {codex_repo}/projects/{name}/
41
+ cp {codex_repo}/templates/TECH-DESIGN.md {codex_repo}/projects/{name}/
42
+ cp {codex_repo}/templates/DECISIONS.md {codex_repo}/projects/{name}/
43
+ ```
44
+
45
+ ### 5. Update Frontmatter
46
+
47
+ In each file, update:
48
+ - `title`: Project name (Title Case)
49
+ - `created`: Today's date
50
+ - `updated`: Today's date
51
+
52
+ ### 6. Optionally Pre-Fill Content
53
+
54
+ If user provides context, fill in what we know:
55
+ - PRD.md: Problem statement, goals if discussed
56
+ - TECH-DESIGN.md: Any architectural decisions mentioned
57
+ - DECISIONS.md: Leave as template (decisions come during impl)
58
+
59
+ ### 7. Create Branch and PR
60
+
61
+ ```bash
62
+ cd {codex_repo}
63
+ git checkout -b codex/new-{name}
64
+ git add projects/{name}/
65
+ git commit -F - <<EOF
66
+ feat(codex): scaffold {name} project
67
+ EOF
68
+ git push -u origin codex/new-{name}
69
+ gh pr create --title "New project: {name}" --body "Scaffold for {name} project"
70
+ ```
71
+
72
+ ### 8. Confirm to User
73
+
74
+ ```
75
+ ✅ Created codex project: {name}
76
+
77
+ 📁 {codex_repo}/projects/{name}/
78
+ ├── PRD.md (template - fill in requirements)
79
+ ├── TECH-DESIGN.md (template - fill in technical design)
80
+ └── DECISIONS.md (ready for decisions during implementation)
81
+
82
+ PR: {pr_url}
83
+ (Auto-merges for new projects)
84
+
85
+ Next steps:
86
+ 1. Fill in PRD.md with product requirements
87
+ 2. Fill in TECH-DESIGN.md with technical approach
88
+ 3. Use `/codex decision` to capture decisions as you implement
89
+ ```
90
+
91
+ ## Example
92
+
93
+ **User:** `/codex new audit-logging`
94
+
95
+ **Result:**
96
+
97
+ ```
98
+ ✅ Created codex project: audit-logging
99
+
100
+ 📁 ~/src/github.com/orderful-codex/projects/audit-logging/
101
+ ├── PRD.md (template - fill in requirements)
102
+ ├── TECH-DESIGN.md (template - fill in technical design)
103
+ └── DECISIONS.md (ready for decisions during implementation)
104
+
105
+ Next steps:
106
+ 1. Fill in PRD.md with product requirements
107
+ 2. Fill in TECH-DESIGN.md with technical approach
108
+ 3. Use `/codex decision` to capture decisions as you implement
109
+
110
+ Want me to help fill in any of these based on what we've discussed?
111
+ ```
112
+
113
+ ## With Pre-Existing Context
114
+
115
+ If the user has already discussed the feature:
116
+
117
+ **User:** "We're building audit logging to track all API changes for compliance. It'll use an event sourcing pattern."
118
+
119
+ **User:** `/codex new audit-logging`
120
+
121
+ **Result:** (PRD.md pre-filled with discussed context)
122
+
123
+ ```markdown
124
+ ---
125
+ title: Audit Logging
126
+ type: prd
127
+ created: 2026-01-07
128
+ updated: 2026-01-07
129
+ confidence: medium
130
+ source: implementation
131
+ ---
132
+
133
+ # Audit Logging - PRD
134
+
135
+ ## Problem Statement
136
+
137
+ Need to track all API changes for compliance requirements.
138
+
139
+ ## Goals
140
+
141
+ - Track all API changes
142
+ - Support compliance auditing
143
+ - {More goals to be defined}
144
+
145
+ ## Non-Goals
146
+
147
+ - {To be defined}
148
+
149
+ ...
150
+ ```
@@ -0,0 +1,128 @@
1
+ # Adding Decisions
2
+
3
+ Detailed procedure for capturing decisions during implementation.
4
+
5
+ ## When to Use
6
+
7
+ - User explicitly asks to record a decision
8
+ - `/codex decision {text}` command
9
+ - During implementation when a significant choice is made
10
+
11
+ ## Prerequisites
12
+
13
+ - **Active project** must be set (from previous `/codex {project}` load)
14
+ - If no active project, prompt user to select one first
15
+
16
+ ## Procedure
17
+
18
+ ### 1. Verify Active Project
19
+
20
+ ```
21
+ If no active project:
22
+ "No project is currently active. Which project should I add this decision to?"
23
+ → List projects, let user pick
24
+ → Set as active
25
+ ```
26
+
27
+ ### 2. Parse Decision Text
28
+
29
+ From the user's input, extract:
30
+ - **Summary:** Brief title for the decision
31
+ - **Context:** What situation prompted this?
32
+ - **Decision:** What was decided?
33
+ - **Rationale:** Why this choice?
34
+
35
+ If any parts are unclear, ask:
36
+ ```
37
+ I'll add this decision. Can you clarify:
38
+ - What prompted this decision?
39
+ - Were there alternatives you considered?
40
+ ```
41
+
42
+ ### 3. Read Existing DECISIONS.md
43
+
44
+ ```bash
45
+ cat {codex_repo}/projects/{active}/DECISIONS.md
46
+ ```
47
+
48
+ ### 4. Append New Decision
49
+
50
+ Add at the end, before the template marker:
51
+
52
+ ```markdown
53
+ ---
54
+
55
+ ## {YYYY-MM-DD}: {Summary}
56
+
57
+ **Context:** {What situation prompted this decision?}
58
+
59
+ **Decision:** {What was decided?}
60
+
61
+ **Rationale:** {Why this choice over alternatives?}
62
+
63
+ **Alternatives Considered:**
64
+ - {Alternative 1} - {Why rejected}
65
+ - {Alternative 2} - {Why rejected}
66
+
67
+ **Consequences:**
68
+ - {Expected outcomes, trade-offs}
69
+ ```
70
+
71
+ ### 5. Update Frontmatter
72
+
73
+ Update the `updated` field to today's date.
74
+
75
+ ### 6. Create Branch and PR
76
+
77
+ ```bash
78
+ cd {codex_repo}
79
+ git checkout -b codex/decision-{short-summary}
80
+ git add projects/{active}/DECISIONS.md
81
+ git commit -F - <<EOF
82
+ decision({active}): {summary}
83
+ EOF
84
+ git push -u origin codex/decision-{short-summary}
85
+ gh pr create --title "Decision: {summary}" --body-file - <<EOF
86
+ {full decision text}
87
+ EOF
88
+ ```
89
+
90
+ ### 7. Confirm to User
91
+
92
+ ```
93
+ ✅ Added decision to {active}/DECISIONS.md:
94
+ "{summary}"
95
+
96
+ PR: {pr_url}
97
+ (Auto-merges for append-only changes)
98
+ ```
99
+
100
+ ## Example
101
+
102
+ **User:** `/codex decision "Using UUIDv7 for all new IDs because it's sortable and includes timestamp"`
103
+
104
+ **Active project:** transaction-templates
105
+
106
+ **Result appended to DECISIONS.md:**
107
+
108
+ ```markdown
109
+ ---
110
+
111
+ ## 2026-01-07: Using UUIDv7 for ID Generation
112
+
113
+ **Context:** Need to choose ID format for new transaction template records.
114
+
115
+ **Decision:** Use UUIDv7 for all new IDs.
116
+
117
+ **Rationale:** UUIDv7 is sortable (timestamp-based prefix) and includes creation timestamp, making it ideal for ordered data and debugging.
118
+
119
+ **Alternatives Considered:**
120
+ - UUIDv4 - Random, not sortable, no timestamp
121
+ - Auto-increment - Database-specific, exposes record count
122
+ - ULID - Similar benefits but less standard
123
+
124
+ **Consequences:**
125
+ - IDs will be longer than auto-increment (36 chars)
126
+ - Natural ordering by creation time
127
+ - No database sequence dependencies
128
+ ```