@orderful/droid 0.19.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.
- package/CHANGELOG.md +13 -0
- package/dist/tools/codex/TOOL.yaml +32 -0
- package/dist/tools/codex/commands/codex.md +70 -0
- package/dist/tools/codex/skills/droid-codex/SKILL.md +266 -0
- package/dist/tools/codex/skills/droid-codex/references/creating.md +150 -0
- package/dist/tools/codex/skills/droid-codex/references/decisions.md +128 -0
- package/dist/tools/codex/skills/droid-codex/references/loading.md +163 -0
- package/dist/tools/codex/skills/droid-codex/references/topics.md +213 -0
- package/dist/tools/droid/skills/droid/SKILL.md +8 -0
- package/package.json +1 -1
- package/src/tools/codex/TOOL.yaml +32 -0
- package/src/tools/codex/commands/codex.md +70 -0
- package/src/tools/codex/skills/droid-codex/SKILL.md +266 -0
- package/src/tools/codex/skills/droid-codex/references/creating.md +150 -0
- package/src/tools/codex/skills/droid-codex/references/decisions.md +128 -0
- package/src/tools/codex/skills/droid-codex/references/loading.md +163 -0
- package/src/tools/codex/skills/droid-codex/references/topics.md +213 -0
- package/src/tools/droid/skills/droid/SKILL.md +8 -0
|
@@ -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
|
+
```
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Loading Codex Entries
|
|
2
|
+
|
|
3
|
+
Detailed procedure for loading entries from the codex.
|
|
4
|
+
|
|
5
|
+
## Search and Match
|
|
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}
|
|
15
|
+
|
|
16
|
+
# Search topics
|
|
17
|
+
ls {codex_repo}/topics/ | grep -i {name}
|
|
18
|
+
```
|
|
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
|
|
22
|
+
- Multiple matches → show list with category, let user pick
|
|
23
|
+
|
|
24
|
+
## Loading a Project
|
|
25
|
+
|
|
26
|
+
Projects are folders with multiple files:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
projects/transaction-templates/
|
|
30
|
+
├── PRD.md
|
|
31
|
+
├── TECH-DESIGN.md
|
|
32
|
+
├── DESIGN.md # Optional
|
|
33
|
+
├── CONTEXT.md # Optional, auto-generated
|
|
34
|
+
└── DECISIONS.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Procedure:**
|
|
38
|
+
|
|
39
|
+
1. List files in project folder
|
|
40
|
+
2. Show file list to user:
|
|
41
|
+
```
|
|
42
|
+
Found transaction-templates with:
|
|
43
|
+
- PRD.md (updated 2026-01-05)
|
|
44
|
+
- TECH-DESIGN.md (updated 2026-01-03)
|
|
45
|
+
- DECISIONS.md (updated 2026-01-07)
|
|
46
|
+
|
|
47
|
+
Which files should I load? (or 'all' for everything)
|
|
48
|
+
```
|
|
49
|
+
3. Load selected file(s)
|
|
50
|
+
4. Set project as **active** for scoped operations
|
|
51
|
+
5. Check freshness (see below)
|
|
52
|
+
|
|
53
|
+
## Loading a Pattern or Topic
|
|
54
|
+
|
|
55
|
+
Patterns and topics are single files:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
patterns/api-design.md
|
|
59
|
+
topics/organization-hierarchy.md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Procedure:**
|
|
63
|
+
|
|
64
|
+
1. Read the file
|
|
65
|
+
2. Check freshness
|
|
66
|
+
3. Output content
|
|
67
|
+
|
|
68
|
+
## Auto-Generating CONTEXT.md
|
|
69
|
+
|
|
70
|
+
If loading a project and no CONTEXT.md exists:
|
|
71
|
+
|
|
72
|
+
1. **Inform user:** "No CONTEXT.md found. I'll synthesise one from the available artifacts."
|
|
73
|
+
2. **Read all available files:** PRD.md, TECH-DESIGN.md, DECISIONS.md
|
|
74
|
+
3. **Generate unified summary:**
|
|
75
|
+
```markdown
|
|
76
|
+
---
|
|
77
|
+
title: {Project Name}
|
|
78
|
+
type: context
|
|
79
|
+
created: {today}
|
|
80
|
+
updated: {today}
|
|
81
|
+
confidence: high
|
|
82
|
+
source: implementation
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
# {Project Name} - Context
|
|
86
|
+
|
|
87
|
+
## Overview
|
|
88
|
+
{Synthesised from PRD problem statement + goals}
|
|
89
|
+
|
|
90
|
+
## Technical Approach
|
|
91
|
+
{Synthesised from TECH-DESIGN architecture + key decisions}
|
|
92
|
+
|
|
93
|
+
## Key Decisions
|
|
94
|
+
{Summarised from DECISIONS.md}
|
|
95
|
+
|
|
96
|
+
## Current Status
|
|
97
|
+
{Inferred from most recent updates}
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
*Auto-generated from PRD.md, TECH-DESIGN.md, and DECISIONS.md*
|
|
101
|
+
```
|
|
102
|
+
4. **Create PR:**
|
|
103
|
+
```bash
|
|
104
|
+
cd {codex_repo}
|
|
105
|
+
git checkout -b auto/context-{project-name}
|
|
106
|
+
# Write CONTEXT.md
|
|
107
|
+
git add projects/{project}/CONTEXT.md
|
|
108
|
+
git commit -F - <<EOF
|
|
109
|
+
feat: auto-generate CONTEXT.md for {project}
|
|
110
|
+
EOF
|
|
111
|
+
git push -u origin auto/context-{project-name}
|
|
112
|
+
gh pr create --title "Auto-generated CONTEXT.md for {project}" --body "Synthesised from PRD, TECH-DESIGN, and DECISIONS."
|
|
113
|
+
```
|
|
114
|
+
5. **Inform user:** "Created PR #{number} with auto-generated CONTEXT.md"
|
|
115
|
+
|
|
116
|
+
## Freshness Checking
|
|
117
|
+
|
|
118
|
+
After loading any file:
|
|
119
|
+
|
|
120
|
+
1. **Parse frontmatter** for `updated` date
|
|
121
|
+
2. **Calculate age:**
|
|
122
|
+
```
|
|
123
|
+
days_old = today - updated
|
|
124
|
+
```
|
|
125
|
+
3. **Check against threshold** (`freshness_days` from config, default 30):
|
|
126
|
+
- If `days_old > freshness_days`:
|
|
127
|
+
```
|
|
128
|
+
⚠️ This doc was last updated {updated} ({days_old} days ago).
|
|
129
|
+
Want me to verify it's still accurate?
|
|
130
|
+
```
|
|
131
|
+
4. **Check codebase changes** (if `codebase_paths` present):
|
|
132
|
+
```bash
|
|
133
|
+
cd {workspace}
|
|
134
|
+
git log --oneline --since="{updated}" -- {codebase_paths}
|
|
135
|
+
```
|
|
136
|
+
- If commits found:
|
|
137
|
+
```
|
|
138
|
+
⚠️ Files in {paths} have changed since this doc was updated.
|
|
139
|
+
Recent commits: {list}
|
|
140
|
+
Want me to review for needed updates?
|
|
141
|
+
```
|
|
142
|
+
5. **Note confidence** (if `confidence: low`):
|
|
143
|
+
```
|
|
144
|
+
ℹ️ This was a quick exploration and may be incomplete.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Output Format
|
|
148
|
+
|
|
149
|
+
After loading, output:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
📚 Loaded: {category}/{name}
|
|
153
|
+
Updated: {updated} ({days_old} days ago)
|
|
154
|
+
Confidence: {confidence}
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
{file content}
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
{freshness warnings if any}
|
|
163
|
+
```
|