@orderful/droid 0.19.0 → 0.21.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.
@@ -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
+ ```
@@ -0,0 +1,213 @@
1
+ # Adding Topics
2
+
3
+ Detailed procedure for capturing explored codebase areas as institutional knowledge.
4
+
5
+ ## When to Use
6
+
7
+ - After a deep exploration of a codebase area
8
+ - User asks to save/capture exploration
9
+ - `/codex add topic {name}` command
10
+ - Converting ad-hoc research into persistent knowledge
11
+
12
+ ## The Value
13
+
14
+ Topics turn ephemeral exploration into institutional memory:
15
+ - Next time someone needs to understand this area, context is ready
16
+ - AI can load it instantly instead of re-exploring
17
+ - Freshness tracking ensures it stays current
18
+
19
+ ## Procedure
20
+
21
+ ### 1. Determine Topic Name
22
+
23
+ From user input or infer from exploration:
24
+ - Use kebab-case: `organization-hierarchy`, `webhook-processing`
25
+ - Be specific but concise
26
+
27
+ ### 2. Gather Content
28
+
29
+ From the current conversation/exploration, extract:
30
+ - **Overview:** What is this area of the codebase?
31
+ - **Key Concepts:** Important terms, patterns, relationships
32
+ - **Architecture:** How components fit together
33
+ - **Key Files:** Important files and their purposes
34
+ - **Common Patterns:** Recurring patterns in this area
35
+ - **Gotchas:** Things to watch out for
36
+
37
+ ### 3. Determine Metadata
38
+
39
+ Ask user or infer:
40
+ - **Confidence:** How thorough was the exploration?
41
+ - `high` - Comprehensive, covered most aspects
42
+ - `medium` - Good coverage but may have gaps
43
+ - `low` - Quick exploration, definitely incomplete
44
+ - **Codebase paths:** Which directories/files were explored?
45
+
46
+ ### 4. Read Template
47
+
48
+ ```bash
49
+ cat {codex_repo}/templates/TOPIC.md
50
+ ```
51
+
52
+ ### 5. Create Topic File
53
+
54
+ ```bash
55
+ # Create the file
56
+ touch {codex_repo}/topics/{name}.md
57
+ ```
58
+
59
+ Fill in content:
60
+
61
+ ```markdown
62
+ ---
63
+ title: {Topic Title}
64
+ type: topic
65
+ created: {today}
66
+ updated: {today}
67
+ confidence: {high|medium|low}
68
+ source: exploration
69
+ codebase_paths:
70
+ - {path/explored/1}
71
+ - {path/explored/2}
72
+ ---
73
+
74
+ # {Topic Title}
75
+
76
+ ## Overview
77
+
78
+ {Brief description of this area of the codebase}
79
+
80
+ ## Key Concepts
81
+
82
+ ### {Concept 1}
83
+
84
+ {Explanation}
85
+
86
+ ### {Concept 2}
87
+
88
+ {Explanation}
89
+
90
+ ## Architecture
91
+
92
+ {How components fit together}
93
+
94
+ ```
95
+ {Diagram or structure if helpful}
96
+ ```
97
+
98
+ ## Key Files
99
+
100
+ | File | Purpose |
101
+ |------|---------|
102
+ | `{path/to/file}` | {What it does} |
103
+
104
+ ## Common Patterns
105
+
106
+ {Patterns used in this area}
107
+
108
+ ## Gotchas
109
+
110
+ - {Thing to watch out for}
111
+ - {Another gotcha}
112
+
113
+ ## Related
114
+
115
+ - {Links to related topics, PRDs, or external docs}
116
+ ```
117
+
118
+ ### 6. Create Branch and PR
119
+
120
+ ```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"
129
+ ```
130
+
131
+ ### 7. Confirm to User
132
+
133
+ ```
134
+ ✅ Added topic: {name}
135
+
136
+ 📚 {codex_repo}/topics/{name}.md
137
+ Confidence: {confidence}
138
+ Paths covered: {codebase_paths}
139
+
140
+ PR: {pr_url}
141
+ (Auto-merges for new files)
142
+
143
+ Next time someone asks about {topic}, I can load this context instantly.
144
+ ```
145
+
146
+ ## Example
147
+
148
+ **User:** (after exploring organization hierarchy) `/codex add topic organization-hierarchy`
149
+
150
+ **Result:**
151
+
152
+ ```markdown
153
+ ---
154
+ title: Organization Hierarchy
155
+ type: topic
156
+ created: 2026-01-07
157
+ updated: 2026-01-07
158
+ confidence: high
159
+ source: exploration
160
+ codebase_paths:
161
+ - apps/platform-api/src/modules/organization/
162
+ - libs/shared/src/types/organization.ts
163
+ ---
164
+
165
+ # Organization Hierarchy
166
+
167
+ ## Overview
168
+
169
+ Orderful's multi-tenant organization structure with parent-child relationships, enabling enterprise customers to manage multiple business units under a single account.
170
+
171
+ ## Key Concepts
172
+
173
+ ### Organization
174
+
175
+ The top-level entity. Has settings, billing, users.
176
+
177
+ ### Child Organizations
178
+
179
+ Organizations can have children, creating a hierarchy. Children inherit some settings from parents.
180
+
181
+ ### Organization Context
182
+
183
+ Request-scoped context determining which org's data to access.
184
+
185
+ ## Architecture
186
+
187
+ ```
188
+ Organization (parent)
189
+ ├── Organization (child 1)
190
+ │ └── Organization (grandchild)
191
+ └── Organization (child 2)
192
+ ```
193
+
194
+ ## Key Files
195
+
196
+ | File | Purpose |
197
+ |------|---------|
198
+ | `organization.entity.ts` | TypeORM entity with parent/child relations |
199
+ | `organization.service.ts` | Business logic for org operations |
200
+ | `organization-context.middleware.ts` | Sets org context from request |
201
+
202
+ ## Common Patterns
203
+
204
+ - Always check org context before data access
205
+ - Use `organizationId` foreign key on tenant-scoped entities
206
+ - Hierarchy queries use recursive CTEs
207
+
208
+ ## Gotchas
209
+
210
+ - Child orgs don't automatically inherit all parent settings
211
+ - Deleting a parent doesn't cascade to children (soft delete)
212
+ - API keys are scoped to single org, not hierarchy
213
+ ```
@@ -147,6 +147,7 @@ for f in $(npm root -g)/@orderful/droid/dist/tools/*/TOOL.yaml; do echo "---"; c
147
147
  | **brain** | Collaborative scratchpad for planning and research |
148
148
  | **coach** | Learning-mode AI - scaffolds don't implement, questions don't fix |
149
149
  | **code-review** | Code review with specialized agents and confidence scoring |
150
+ | **codex** | Shared organizational knowledge - PRDs, tech designs, patterns, topics |
150
151
  | **comments** | Inline conversations using @droid/@user markers |
151
152
  | **project** | Project context for persistent AI memory across sessions |
152
153
 
@@ -170,6 +171,12 @@ Comprehensive code review using specialized agents. Reviews PRs, staged changes,
170
171
  **Commands:** `/code-review`
171
172
  **Agents:** edi-standards-reviewer, error-handling-reviewer, test-coverage-analyzer, type-reviewer
172
173
 
174
+ #### codex
175
+ Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Load project context, search across the codex, capture decisions during implementation.
176
+
177
+ **Commands:** `/codex`, `/codex projects`, `/codex search`, `/codex decision`, `/codex add topic`
178
+ **Requires:** gh CLI, orderful-codex repo cloned locally
179
+
173
180
  #### comments
174
181
  Enable inline conversations using @droid/@user markers. Tag @droid to ask the AI, AI responds with @{your-name}. Ideal for code review notes and async collaboration.
175
182
 
@@ -215,6 +222,7 @@ Run `droid` to see all available tools or install new ones.
215
222
  | brain | Planning and research scratchpad with `/brain` commands |
216
223
  | coach | Learning-mode AI that asks questions instead of giving answers |
217
224
  | code-review | PR review with specialized agents |
225
+ | codex | Shared knowledge - PRDs, tech designs, patterns, topics |
218
226
  | comments | Inline @droid/@user conversations in any file |
219
227
  | project | Persistent project context across sessions |
220
228
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orderful/droid",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "AI workflow toolkit for sharing skills, commands, and agents across the team",
5
5
  "type": "module",
6
6
  "bin": {