@orderful/droid 0.23.0 → 0.25.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 (53) hide show
  1. package/.eslintrc.json +6 -4
  2. package/AGENTS.md +58 -0
  3. package/CHANGELOG.md +44 -0
  4. package/README.md +11 -6
  5. package/dist/bin/droid.js +384 -170
  6. package/dist/commands/config.d.ts +15 -1
  7. package/dist/commands/config.d.ts.map +1 -1
  8. package/dist/commands/exec.d.ts +10 -0
  9. package/dist/commands/exec.d.ts.map +1 -0
  10. package/dist/commands/tui.d.ts.map +1 -1
  11. package/dist/index.js +171 -33
  12. package/dist/lib/migrations.d.ts.map +1 -1
  13. package/dist/lib/skills.d.ts.map +1 -1
  14. package/dist/tools/codex/TOOL.yaml +2 -2
  15. package/dist/tools/codex/agents/codex-document-processor.md +8 -4
  16. package/dist/tools/codex/commands/codex.md +18 -10
  17. package/dist/tools/codex/skills/droid-codex/SKILL.md +140 -67
  18. package/dist/tools/codex/skills/droid-codex/references/creating.md +13 -51
  19. package/dist/tools/codex/skills/droid-codex/references/decisions.md +15 -19
  20. package/dist/tools/codex/skills/droid-codex/references/loading.md +49 -13
  21. package/dist/tools/codex/skills/droid-codex/references/topics.md +14 -12
  22. package/dist/tools/codex/skills/droid-codex/scripts/git-finish-write.d.ts +31 -0
  23. package/dist/tools/codex/skills/droid-codex/scripts/git-finish-write.d.ts.map +1 -0
  24. package/dist/tools/codex/skills/droid-codex/scripts/git-finish-write.ts +236 -0
  25. package/dist/tools/codex/skills/droid-codex/scripts/git-preamble.d.ts +20 -0
  26. package/dist/tools/codex/skills/droid-codex/scripts/git-preamble.d.ts.map +1 -0
  27. package/dist/tools/codex/skills/droid-codex/scripts/git-preamble.ts +156 -0
  28. package/dist/tools/codex/skills/droid-codex/scripts/git-scripts.test.ts +364 -0
  29. package/dist/tools/codex/skills/droid-codex/scripts/git-start-write.d.ts +23 -0
  30. package/dist/tools/codex/skills/droid-codex/scripts/git-start-write.d.ts.map +1 -0
  31. package/dist/tools/codex/skills/droid-codex/scripts/git-start-write.ts +172 -0
  32. package/package.json +1 -1
  33. package/src/bin/droid.ts +9 -0
  34. package/src/commands/config.ts +38 -4
  35. package/src/commands/exec.ts +96 -0
  36. package/src/commands/install.ts +1 -1
  37. package/src/commands/setup.ts +6 -6
  38. package/src/commands/tui.tsx +254 -175
  39. package/src/lib/migrations.ts +103 -10
  40. package/src/lib/quotes.ts +6 -6
  41. package/src/lib/skills.ts +168 -45
  42. package/src/tools/codex/TOOL.yaml +2 -2
  43. package/src/tools/codex/agents/codex-document-processor.md +8 -4
  44. package/src/tools/codex/commands/codex.md +18 -10
  45. package/src/tools/codex/skills/droid-codex/SKILL.md +140 -67
  46. package/src/tools/codex/skills/droid-codex/references/creating.md +13 -51
  47. package/src/tools/codex/skills/droid-codex/references/decisions.md +15 -19
  48. package/src/tools/codex/skills/droid-codex/references/loading.md +49 -13
  49. package/src/tools/codex/skills/droid-codex/references/topics.md +14 -12
  50. package/src/tools/codex/skills/droid-codex/scripts/git-finish-write.ts +236 -0
  51. package/src/tools/codex/skills/droid-codex/scripts/git-preamble.ts +156 -0
  52. package/src/tools/codex/skills/droid-codex/scripts/git-scripts.test.ts +364 -0
  53. package/src/tools/codex/skills/droid-codex/scripts/git-start-write.ts +172 -0
@@ -1,6 +1,6 @@
1
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}]"
2
+ description: Shared organizational knowledge - PRDs, tech designs, patterns, domains, proposals, and explored topics
3
+ argument-hint: "[projects | domains | proposals | patterns | topics | {name} | search {query} | new {type} {name} | decision {text}]"
4
4
  allowed-tools: Read, Write, Edit, Glob, Grep, Bash(gh:*), Bash(git:*), Bash(ls:*), Bash(mkdir:*)
5
5
  ---
6
6
 
@@ -24,16 +24,23 @@ Before first use, verify:
24
24
  ## Usage
25
25
 
26
26
  ```bash
27
- /codex # Show categories (projects, patterns, topics)
27
+ /codex # Show categories (5 total)
28
28
  /codex projects # List projects
29
+ /codex domains # List domains
30
+ /codex proposals # List proposals
29
31
  /codex patterns # List patterns
30
32
  /codex topics # List topics
31
33
  /codex {name} # Load entry (searches all categories)
32
34
  /codex search {query} # Search across everything
33
- /codex new {name} # Scaffold new project from templates
35
+ /codex new {name} # Scaffold new project (shorthand)
36
+ /codex new project {name} # Scaffold new project from templates
37
+ /codex new domain {name} # Scaffold new domain entry
38
+ /codex new proposal {name} # Scaffold new proposal entry
39
+ /codex new pattern {name} # Scaffold new pattern entry
40
+ /codex new topic {name} # Scaffold new topic entry
34
41
  /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
42
+ /codex snapshot {type} {file} {name} # Import PDF/markdown to codex
43
+ /codex artifact {file} {project} # Add supporting artifact to project
37
44
  ```
38
45
 
39
46
  ## Configuration
@@ -48,8 +55,7 @@ Before first use, verify:
48
55
  Refer to the codex skill for:
49
56
  - **Loading**: How to search, handle matches, check freshness, auto-generate CONTEXT.md
50
57
  - **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
58
+ - **Creating**: How to scaffold new entries (projects, domains, proposals, patterns, topics)
53
59
 
54
60
  The skill's `references/` folder contains detailed procedures for each workflow.
55
61
 
@@ -65,6 +71,8 @@ The skill's `references/` folder contains detailed procedures for each workflow.
65
71
  # Capture a decision during implementation
66
72
  /codex decision "Using UUIDv7 for IDs because it's sortable and includes timestamp"
67
73
 
68
- # Save today's exploration as a topic
69
- /codex add topic organization-hierarchy
74
+ # Create new entries
75
+ /codex new domain partnerships
76
+ /codex new proposal caching-layer
77
+ /codex new topic organization-hierarchy
70
78
  ```
@@ -35,15 +35,54 @@ If prerequisites fail, guide user to fix:
35
35
  - Repo missing: `git clone git@github.com:orderful/orderful-codex.git {path}`
36
36
  - gh missing: `brew install gh && gh auth login`
37
37
 
38
- ## Sync Before Reading
38
+ ## Git Hygiene (CRITICAL)
39
39
 
40
- **Before any read operation** (loading, searching, listing), pull latest:
40
+ **Users should never see git complexity.** Use the deterministic scripts below - they handle all git operations silently and recover gracefully. Non-engineers use this tool - if they hit a git error, they're stuck.
41
+
42
+ ### Scripts
43
+
44
+ The codex skill includes three git scripts. **Always use these instead of raw git commands.**
45
+
46
+ | Script | Purpose | When to use |
47
+ |--------|---------|-------------|
48
+ | `git-preamble` | Ensure clean main + pull latest | Before ANY operation |
49
+ | `git-start-write` | Preamble + create branch | Before write operations |
50
+ | `git-finish-write` | Commit + PR + return to main | After write operations |
51
+
52
+ ### Read Operations (search, load, list)
53
+
54
+ ```bash
55
+ droid config codex | droid exec droid-codex git-preamble --config -
56
+ # Then proceed with the read
57
+ ```
58
+
59
+ ### Write Operations (new, decision, snapshot, artifact)
41
60
 
42
61
  ```bash
43
- git -C {codex_repo} pull --rebase --quiet
62
+ # 1. Start write (runs preamble + creates branch)
63
+ droid config codex | droid exec droid-codex git-start-write --config - --branch codex/{action}-{name}
64
+
65
+ # 2. Make your changes (write files)
66
+
67
+ # 3. Finish write (commit + PR + return to main)
68
+ droid config codex | droid exec droid-codex git-finish-write --config - \
69
+ --message "{commit message}" \
70
+ --pr-title "{PR title}" \
71
+ --pr-body "{PR description}"
44
72
  ```
45
73
 
46
- This ensures shared knowledge is always current. The pull is quiet to avoid noise, but if it fails (conflicts, network), warn the user.
74
+ The scripts return JSON with success/failure status. Check the result before proceeding.
75
+
76
+ ### Error Handling
77
+
78
+ The scripts handle errors internally:
79
+ - Silent recovery for transient issues
80
+ - Clear error messages in JSON output
81
+ - Automatic return to main even on partial failure
82
+
83
+ If a script fails, check the JSON `error` field and report a user-friendly message:
84
+ - "I hit a sync issue with the codex. Let me try again..."
85
+ - Only escalate as last resort: "The codex repo needs manual attention."
47
86
 
48
87
  ## Security
49
88
 
@@ -102,11 +141,13 @@ fi
102
141
 
103
142
  ## Categories
104
143
 
105
- The codex has three categories:
144
+ The codex has five categories:
106
145
 
107
146
  | Category | Path | Purpose |
108
147
  |----------|------|---------|
109
148
  | `projects` | `{codex_repo}/projects/` | Feature/project context (PRD, tech design, decisions) |
149
+ | `domains` | `{codex_repo}/domains/` | Business domain knowledge - the "what" and "why" |
150
+ | `proposals` | `{codex_repo}/proposals/` | Ideas and future direction - not yet committed |
110
151
  | `patterns` | `{codex_repo}/patterns/` | Cross-cutting technical patterns |
111
152
  | `topics` | `{codex_repo}/topics/` | Explored codebase areas with freshness tracking |
112
153
 
@@ -116,15 +157,21 @@ The codex has three categories:
116
157
  |---------|--------|
117
158
  | `/codex` | Show categories overview |
118
159
  | `/codex projects` | List all projects |
160
+ | `/codex domains` | List all domains |
161
+ | `/codex proposals` | List all proposals |
119
162
  | `/codex patterns` | List all patterns |
120
163
  | `/codex topics` | List all topics |
121
164
  | `/codex {name}` | Load entry (searches all categories) |
122
165
  | `/codex search {query}` | Search across everything |
123
- | `/codex new {name}` | Scaffold new project from templates |
166
+ | `/codex new {name}` | Scaffold new project (shorthand) |
167
+ | `/codex new project {name}` | Scaffold new project from templates |
168
+ | `/codex new domain {name}` | Scaffold new domain entry |
169
+ | `/codex new proposal {name}` | Scaffold new proposal entry |
170
+ | `/codex new pattern {name}` | Scaffold new pattern entry |
171
+ | `/codex new topic {name}` | Scaffold new topic entry |
124
172
  | `/codex decision {text}` | Append to active project's DECISIONS.md |
125
173
  | `/codex snapshot {type} {file} {name}` | Import PDF/markdown to codex (uses agent) |
126
174
  | `/codex artifact {file} {project}` | Add supporting artifact to project (uses agent) |
127
- | `/codex add topic {name}` | Add explored topic with freshness metadata |
128
175
 
129
176
  ## Loading an Entry
130
177
 
@@ -132,12 +179,15 @@ The codex has three categories:
132
179
 
133
180
  **Procedure:**
134
181
 
135
- 1. Search for `{name}` across all categories (fuzzy match on folder/file names)
136
- 2. If multiple matches show list, let user pick
137
- 3. If single matchload it
138
- 4. For projects with multiple files show file list, let user pick which to load
139
- 5. Check freshness (see below)
140
- 6. Output loaded content
182
+ 1. **Read `{codex_repo}/index.yaml`** - this contains all entry names and aliases for fast lookup
183
+ 2. Match `{name}` against index keys and aliases (case-insensitive, partial match)
184
+ 3. If multiple matchesshow list, let user pick
185
+ 4. If single matchload directly from the matched path
186
+ 5. For projects with multiple files → show file list, let user pick which to load
187
+ 6. Check freshness (see below)
188
+ 7. Output loaded content
189
+
190
+ **Why index?** Avoids expensive file-by-file searching. One read to find any entry by name or alias.
141
191
 
142
192
  **If no CONTEXT.md exists for a project:**
143
193
  - Synthesise unified context from PRD.md + TECH-DESIGN.md + DECISIONS.md
@@ -153,7 +203,7 @@ All codex files have frontmatter:
153
203
  ```yaml
154
204
  ---
155
205
  title: Feature Name
156
- type: prd | tech-design | context | decisions | pattern | topic
206
+ type: prd | tech-design | context | decisions | pattern | topic | domain | proposal
157
207
  status: draft | active | complete | archived
158
208
  created: 2026-01-07
159
209
  updated: 2026-01-07
@@ -164,14 +214,12 @@ codebase_paths:
164
214
  ---
165
215
  ```
166
216
 
167
- **Status values:**
217
+ **Status values (unified across all categories):**
168
218
  - `draft` - Initial capture, not ready for consumption
169
219
  - `active` - Current, being used for implementation
170
220
  - `complete` - Project shipped, kept for reference
171
221
  - `archived` - No longer relevant, kept for history
172
222
 
173
- Note: Topics use `draft | active | archived` (no "complete"). Patterns use `active | archived` (no draft phase).
174
-
175
223
  **When loading any file:**
176
224
 
177
225
  1. Parse frontmatter for `updated` date
@@ -199,36 +247,24 @@ Scoped operations (`decision`, `snapshot`) require an active project:
199
247
  **Procedure:**
200
248
 
201
249
  1. Verify active project exists (if not, prompt to select)
202
- 2. Read `{codex_repo}/projects/{active}/DECISIONS.md`
203
- 3. Append new decision with today's date:
204
- ```markdown
205
- ## {YYYY-MM-DD}: {Decision summary from text}
206
-
207
- **Context:** {Extract from conversation}
208
-
209
- **Decision:** {The decision}
210
-
211
- **Rationale:** {Why this choice}
212
- ```
250
+ 2. **Run `git-start-write`** with branch `codex/decision-{short-summary}`
251
+ 3. Read and append to `{codex_repo}/projects/{active}/DECISIONS.md`
213
252
  4. Update `updated` date in frontmatter
214
- 5. Create branch, commit, and open PR via `gh pr create`
253
+ 5. **Run `git-finish-write`** with appropriate commit message and PR title
215
254
 
216
255
  Full procedure: `references/decisions.md`
217
256
 
218
257
  ## Adding Topics
219
258
 
220
- **Trigger:** `/codex add topic {name}` or user wants to save exploration
259
+ **Trigger:** `/codex new topic {name}` or user wants to save exploration
221
260
 
222
261
  **Procedure:**
223
262
 
224
- 1. Create `{codex_repo}/topics/{name}.md`
225
- 2. Use template from `{codex_repo}/templates/TOPIC.md`
226
- 3. Fill in frontmatter:
227
- - `explored`: today's date
228
- - `confidence`: ask user or infer from exploration depth
229
- - `codebase_paths`: paths that were explored
263
+ 1. **Run `git-start-write`** with branch `codex/topic-{name}`
264
+ 2. Create `{codex_repo}/topics/{name}.md` from template
265
+ 3. Fill in frontmatter (explored, confidence, codebase_paths)
230
266
  4. Fill in content from current exploration/conversation
231
- 5. Create branch, commit, and open PR via `gh pr create`
267
+ 5. **Run `git-finish-write`** with appropriate commit message and PR title
232
268
 
233
269
  Full procedure: `references/topics.md`
234
270
 
@@ -241,21 +277,15 @@ Full procedure: `references/topics.md`
241
277
  **Procedure:**
242
278
 
243
279
  1. Determine the document type (required): `prd`, `tech-design`, `topic`, or `pattern`
244
- 2. Spawn the `codex-document-processor` agent with:
280
+ 2. **Run `git-start-write`** with branch `codex/snapshot-{name}`
281
+ 3. Spawn the `codex-document-processor` agent with:
245
282
  - File path to the source document
246
283
  - Document type
247
284
  - Project/entry name
248
285
  - Codex repo path from config
249
- 3. Agent processes the document:
250
- - Reads and extracts content
251
- - Applies appropriate frontmatter template
252
- - Writes to correct location in codex repo
253
- - Returns file path and summary
254
- 4. **Back in main conversation:** Handle git workflow
255
- - Create branch: `codex/snapshot-{name}`
256
- - Commit the new file
257
- - Push and create PR via `gh pr create`
258
- 5. Share PR link with user
286
+ 4. Agent writes the processed document to codex repo
287
+ 5. **Run `git-finish-write`** with appropriate commit message and PR title
288
+ 6. Share PR link with user
259
289
 
260
290
  **Example invocations:**
261
291
 
@@ -284,9 +314,10 @@ Artifacts are supplementary documents that support a project but aren't core doc
284
314
 
285
315
  **Procedure:**
286
316
 
287
- 1. Use the `codex-document-processor` agent with type `artifact`
288
- 2. Agent writes to `{codex_repo}/projects/{project}/artifacts/{filename}.md`
289
- 3. Handle git workflow (branch, commit, PR)
317
+ 1. **Run `git-start-write`** with branch `codex/artifact-{project}-{filename}`
318
+ 2. Use the `codex-document-processor` agent with type `artifact`
319
+ 3. Agent writes to `{codex_repo}/projects/{project}/artifacts/{filename}.md`
320
+ 4. **Run `git-finish-write`** with appropriate commit message and PR title
290
321
 
291
322
  **Example invocations:**
292
323
 
@@ -297,19 +328,63 @@ Artifacts are supplementary documents that support a project but aren't core doc
297
328
 
298
329
  Artifacts get lighter frontmatter with `type: artifact` and source like `interview`, `transcript`, `notes`, `meeting`, `research`, `spike`, or `analysis`.
299
330
 
300
- ## Creating New Projects
331
+ ## Creating New Entries
301
332
 
302
- **Trigger:** `/codex new {name}` or user wants to start new project entry
333
+ The `/codex new` command scaffolds new entries from templates:
334
+
335
+ ```bash
336
+ /codex new {name} # Shorthand for new project
337
+ /codex new project {name} # Explicit project creation
338
+ /codex new domain {name} # New domain entry
339
+ /codex new proposal {name} # New proposal entry
340
+ /codex new pattern {name} # New pattern entry
341
+ /codex new topic {name} # New topic entry
342
+ ```
343
+
344
+ ### Projects
345
+
346
+ **Trigger:** `/codex new {name}` or `/codex new project {name}`
347
+
348
+ **Procedure:**
349
+
350
+ 1. **Run `git-start-write`** with branch `codex/new-{name}`
351
+ 2. Create `{codex_repo}/projects/{name}/`
352
+ 3. Copy templates: PRD.md, TECH-DESIGN.md, DECISIONS.md
353
+ 4. Fill in frontmatter with today's date
354
+ 5. **Run `git-finish-write`** with appropriate commit message and PR title
355
+
356
+ ### Domains
357
+
358
+ **Trigger:** `/codex new domain {name}`
303
359
 
304
360
  **Procedure:**
305
361
 
306
- 1. Create `{codex_repo}/projects/{name}/`
307
- 2. Copy templates from `{codex_repo}/templates/`:
308
- - PRD.md
309
- - TECH-DESIGN.md
310
- - DECISIONS.md
362
+ 1. **Run `git-start-write`** with branch `codex/domain-{name}`
363
+ 2. Create `{codex_repo}/domains/{name}.md` from template
364
+ 3. Fill in frontmatter, guide user through sections
365
+ 4. **Run `git-finish-write`** with appropriate commit message and PR title
366
+
367
+ ### Proposals
368
+
369
+ **Trigger:** `/codex new proposal {name}`
370
+
371
+ **Procedure:**
372
+
373
+ 1. **Run `git-start-write`** with branch `codex/proposal-{name}`
374
+ 2. Create `{codex_repo}/proposals/{name}.md` from template
375
+ 3. Fill in frontmatter, guide user through sections
376
+ 4. **Run `git-finish-write`** with appropriate commit message and PR title
377
+
378
+ ### Patterns and Topics
379
+
380
+ **Trigger:** `/codex new pattern {name}` or `/codex new topic {name}`
381
+
382
+ **Procedure:**
383
+
384
+ 1. **Run `git-start-write`** with branch `codex/{pattern|topic}-{name}`
385
+ 2. Create file from template
311
386
  3. Fill in frontmatter with today's date
312
- 4. Create branch, commit, and open PR via `gh pr create`
387
+ 4. **Run `git-finish-write`** with appropriate commit message and PR title
313
388
 
314
389
  Full procedure: `references/creating.md`
315
390
 
@@ -330,12 +405,10 @@ When user runs `/project create --from codex:{name}`:
330
405
 
331
406
  ## Git Workflow
332
407
 
333
- **All codex changes must go through PRs** (main branch is protected):
334
-
335
- 1. Create branch: `codex/{action}-{name}` (e.g., `codex/decision-uuid-format`)
336
- 2. Make changes
337
- 3. Commit with descriptive message
338
- 4. Push and create PR via `gh pr create`
339
- 5. Share PR link with user
408
+ **See "Git Hygiene (CRITICAL)" section above.** All codex changes go through PRs (main branch is protected).
340
409
 
341
- Safe changes (new files, decision appends) are auto-merged by GitHub Action. Modifications to existing content require review.
410
+ **Key points:**
411
+ - Always run the preamble before any operation (ensures clean main + latest)
412
+ - Write operations: branch → commit → PR → **return to main**
413
+ - Safe changes (new files, decision appends) auto-merge via GitHub Action
414
+ - Never leave the repo on a feature branch
@@ -28,15 +28,18 @@ A project named '{name}' already exists. Did you mean to load it?
28
28
  → /codex {name}
29
29
  ```
30
30
 
31
- ### 3. Create Project Directory
31
+ ### 3. Start Write Operation
32
32
 
33
33
  ```bash
34
- mkdir -p {codex_repo}/projects/{name}
34
+ droid config codex | droid exec droid-codex git-start-write --config - --branch codex/new-{name}
35
35
  ```
36
36
 
37
- ### 4. Copy Templates
37
+ This runs the git preamble (ensures clean main + pulls latest) and creates the branch.
38
+
39
+ ### 4. Create Project Directory and Copy Templates
38
40
 
39
41
  ```bash
42
+ mkdir -p {codex_repo}/projects/{name}
40
43
  cp {codex_repo}/templates/PRD.md {codex_repo}/projects/{name}/
41
44
  cp {codex_repo}/templates/TECH-DESIGN.md {codex_repo}/projects/{name}/
42
45
  cp {codex_repo}/templates/DECISIONS.md {codex_repo}/projects/{name}/
@@ -56,19 +59,17 @@ If user provides context, fill in what we know:
56
59
  - TECH-DESIGN.md: Any architectural decisions mentioned
57
60
  - DECISIONS.md: Leave as template (decisions come during impl)
58
61
 
59
- ### 7. Create Branch and PR
62
+ ### 7. Finish Write Operation
60
63
 
61
64
  ```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"
65
+ droid config codex | droid exec droid-codex git-finish-write --config - \
66
+ --message "feat(codex): scaffold {name} project" \
67
+ --pr-title "New project: {name}" \
68
+ --pr-body "Scaffold for {name} project"
70
69
  ```
71
70
 
71
+ This commits, pushes, creates PR, and returns to main.
72
+
72
73
  ### 8. Confirm to User
73
74
 
74
75
  ```
@@ -109,42 +110,3 @@ Next steps:
109
110
 
110
111
  Want me to help fill in any of these based on what we've discussed?
111
112
  ```
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
- ```
@@ -39,15 +39,19 @@ I'll add this decision. Can you clarify:
39
39
  - Were there alternatives you considered?
40
40
  ```
41
41
 
42
- ### 3. Read Existing DECISIONS.md
42
+ ### 3. Start Write Operation
43
43
 
44
44
  ```bash
45
- cat {codex_repo}/projects/{active}/DECISIONS.md
45
+ droid config codex | droid exec droid-codex git-start-write --config - --branch codex/decision-{short-summary}
46
46
  ```
47
47
 
48
- ### 4. Append New Decision
48
+ ### 4. Read and Update DECISIONS.md
49
+
50
+ ```bash
51
+ cat {codex_repo}/projects/{active}/DECISIONS.md
52
+ ```
49
53
 
50
- Add at the end, before the template marker:
54
+ Append new decision at the end:
51
55
 
52
56
  ```markdown
53
57
  ---
@@ -68,26 +72,18 @@ Add at the end, before the template marker:
68
72
  - {Expected outcomes, trade-offs}
69
73
  ```
70
74
 
71
- ### 5. Update Frontmatter
72
-
73
- Update the `updated` field to today's date.
75
+ Update the `updated` field in frontmatter to today's date.
74
76
 
75
- ### 6. Create Branch and PR
77
+ ### 5. Finish Write Operation
76
78
 
77
79
  ```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
80
+ droid config codex | droid exec droid-codex git-finish-write --config - \
81
+ --message "decision({active}): {summary}" \
82
+ --pr-title "Decision: {summary}" \
83
+ --pr-body "{full decision text}"
88
84
  ```
89
85
 
90
- ### 7. Confirm to User
86
+ ### 6. Confirm to User
91
87
 
92
88
  ```
93
89
  ✅ Added decision to {active}/DECISIONS.md:
@@ -4,23 +4,44 @@ Detailed procedure for loading entries from the codex.
4
4
 
5
5
  ## Search and Match
6
6
 
7
- 1. **Get codex repo path** from `~/.droid/skills/codex/overrides.yaml`
8
- 2. **Search all categories** for `{name}`:
9
- ```bash
10
- # Search projects
11
- ls {codex_repo}/projects/ | grep -i {name}
12
-
13
- # Search patterns
14
- ls {codex_repo}/patterns/ | grep -i {name}
7
+ **IMPORTANT:** Use the index file for fast lookups. This avoids expensive file-by-file searching.
15
8
 
16
- # Search topics
17
- ls {codex_repo}/topics/ | grep -i {name}
9
+ 1. **Get codex repo path** from `~/.droid/skills/codex/overrides.yaml`
10
+ 2. **Read the index file** at `{codex_repo}/index.yaml`:
11
+ ```yaml
12
+ # index.yaml structure
13
+ projects:
14
+ partnership-automation:
15
+ title: "Partnership Automation & Sample Transaction Engine"
16
+ aliases: ["transaction-templates", "template-transactions"]
17
+ patterns:
18
+ jsdoc-config-directives:
19
+ title: "JSDoc @config Directives"
20
+ aliases: ["config-directives", "comment-directives"]
21
+ topics:
22
+ handlebars-template-security:
23
+ title: "Handlebars Template Security"
24
+ aliases: []
25
+ domains: {}
26
+ proposals: {}
18
27
  ```
19
- 3. **Handle matches:**
20
- - No matches → "No codex entry found for '{name}'. Did you mean one of these?" + list recent entries
21
- - Single match proceed to load
28
+ 3. **Match `{name}` against the index:**
29
+ - Check each entry's key (folder/file name)
30
+ - Check each entry's `aliases` array
31
+ - Match is case-insensitive and supports partial matching
32
+ - Example: "template transactions" matches `partnership-automation` via alias "template-transactions"
33
+ 4. **Handle matches:**
34
+ - No matches → "No codex entry found for '{name}'. Did you mean one of these?" + suggest entries from index
35
+ - Single match → proceed to load from the matched category/path
22
36
  - Multiple matches → show list with category, let user pick
23
37
 
38
+ **Fallback:** If `index.yaml` doesn't exist, fall back to directory scanning:
39
+ ```bash
40
+ ls {codex_repo}/projects/ | grep -i {name}
41
+ ls {codex_repo}/domains/ | grep -i {name}
42
+ # ... etc
43
+ ```
44
+
24
45
  ## Loading a Project
25
46
 
26
47
  Projects are folders with multiple files:
@@ -50,6 +71,21 @@ projects/transaction-templates/
50
71
  4. Set project as **active** for scoped operations
51
72
  5. Check freshness (see below)
52
73
 
74
+ ## Loading a Domain or Proposal
75
+
76
+ Domains and proposals are single files:
77
+
78
+ ```
79
+ domains/partnerships.md
80
+ proposals/caching-layer.md
81
+ ```
82
+
83
+ **Procedure:**
84
+
85
+ 1. Read the file
86
+ 2. Check freshness
87
+ 3. Output content
88
+
53
89
  ## Loading a Pattern or Topic
54
90
 
55
91
  Patterns and topics are single files:
@@ -43,13 +43,19 @@ Ask user or infer:
43
43
  - `low` - Quick exploration, definitely incomplete
44
44
  - **Codebase paths:** Which directories/files were explored?
45
45
 
46
- ### 4. Read Template
46
+ ### 4. Start Write Operation
47
+
48
+ ```bash
49
+ droid config codex | droid exec droid-codex git-start-write --config - --branch codex/topic-{name}
50
+ ```
51
+
52
+ ### 5. Read Template
47
53
 
48
54
  ```bash
49
55
  cat {codex_repo}/templates/TOPIC.md
50
56
  ```
51
57
 
52
- ### 5. Create Topic File
58
+ ### 6. Create Topic File
53
59
 
54
60
  ```bash
55
61
  # Create the file
@@ -115,20 +121,16 @@ codebase_paths:
115
121
  - {Links to related topics, PRDs, or external docs}
116
122
  ```
117
123
 
118
- ### 6. Create Branch and PR
124
+ ### 7. Finish Write Operation
119
125
 
120
126
  ```bash
121
- cd {codex_repo}
122
- git checkout -b codex/topic-{name}
123
- git add topics/{name}.md
124
- git commit -F - <<EOF
125
- topic: add {name}
126
- EOF
127
- git push -u origin codex/topic-{name}
128
- gh pr create --title "Topic: {name}" --body "New topic from codebase exploration"
127
+ droid config codex | droid exec droid-codex git-finish-write --config - \
128
+ --message "topic: add {name}" \
129
+ --pr-title "Topic: {name}" \
130
+ --pr-body "New topic from codebase exploration"
129
131
  ```
130
132
 
131
- ### 7. Confirm to User
133
+ ### 8. Confirm to User
132
134
 
133
135
  ```
134
136
  ✅ Added topic: {name}