@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.
- package/CHANGELOG.md +19 -0
- package/dist/tools/codex/TOOL.yaml +33 -0
- package/dist/tools/codex/agents/codex-document-processor.md +137 -0
- package/dist/tools/codex/commands/codex.md +70 -0
- package/dist/tools/codex/skills/droid-codex/SKILL.md +314 -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 +33 -0
- package/src/tools/codex/agents/codex-document-processor.md +137 -0
- package/src/tools/codex/commands/codex.md +70 -0
- package/src/tools/codex/skills/droid-codex/SKILL.md +314 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @orderful/droid
|
|
2
2
|
|
|
3
|
+
## 0.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#111](https://github.com/Orderful/droid/pull/111) [`c14a3e2`](https://github.com/Orderful/droid/commit/c14a3e2acbf7a87052c9d5dba251502b8be067f9) Thanks [@frytyler](https://github.com/frytyler)! - Add codex-document-processor agent for importing documents to the codex. The agent handles PDF/markdown processing, frontmatter generation, and file writing - keeping the main conversation context lean during document imports.
|
|
8
|
+
|
|
9
|
+
## 0.20.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#109](https://github.com/Orderful/droid/pull/109) [`1014243`](https://github.com/Orderful/droid/commit/10142438bcd75723027d12ec7bdc23f012643ee3) Thanks [@frytyler](https://github.com/frytyler)! - Add codex tool for shared organizational knowledge
|
|
14
|
+
|
|
15
|
+
New tool providing access to the orderful-codex repo containing PRDs, tech designs, patterns, and explored topics. Features include:
|
|
16
|
+
- Load project context with `/codex {name}`
|
|
17
|
+
- Search across all categories
|
|
18
|
+
- Capture decisions during implementation
|
|
19
|
+
- Add explored topics with freshness tracking
|
|
20
|
+
- Auto-generate CONTEXT.md from project artifacts
|
|
21
|
+
|
|
3
22
|
## 0.19.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
- codex-document-processor
|
|
14
|
+
|
|
15
|
+
dependencies: []
|
|
16
|
+
|
|
17
|
+
# Prerequisites checked on install
|
|
18
|
+
prerequisites:
|
|
19
|
+
- name: gh
|
|
20
|
+
description: GitHub CLI for PR workflows
|
|
21
|
+
check: "gh --version"
|
|
22
|
+
install_hint: "brew install gh && gh auth login"
|
|
23
|
+
|
|
24
|
+
config_schema:
|
|
25
|
+
codex_repo:
|
|
26
|
+
type: string
|
|
27
|
+
description: Path to local orderful-codex repository (required)
|
|
28
|
+
required: true
|
|
29
|
+
default: "~/src/github.com/orderful-codex"
|
|
30
|
+
freshness_days:
|
|
31
|
+
type: number
|
|
32
|
+
description: Days before showing staleness warning
|
|
33
|
+
default: 30
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-document-processor
|
|
3
|
+
description: "Process documents (PDF, markdown) into codex-ready markdown with proper frontmatter. Use when importing files to the codex - handles extraction, formatting, and writing to the correct location."
|
|
4
|
+
tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Glob
|
|
8
|
+
color: yellow
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a document processor for the Orderful codex. Your job is to transform source documents (PDFs, markdown files) into properly structured codex entries.
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
You will receive:
|
|
16
|
+
1. **File path** - The source document to process
|
|
17
|
+
2. **Document type** - One of: `prd`, `tech-design`, `topic`, `pattern`
|
|
18
|
+
3. **Project/entry name** - Where this should be stored in the codex
|
|
19
|
+
4. **Codex repo path** - The local path to orderful-codex repository
|
|
20
|
+
|
|
21
|
+
## Validation (Do This First)
|
|
22
|
+
|
|
23
|
+
Before processing, validate all inputs:
|
|
24
|
+
|
|
25
|
+
1. **Document type** - Must be one of: `prd`, `tech-design`, `topic`, `pattern`. Reject anything else.
|
|
26
|
+
2. **File path** - Must exist and be readable. Use Read tool to verify.
|
|
27
|
+
3. **Project/entry name** - Must be safe for filesystem paths:
|
|
28
|
+
- Only allow: alphanumeric, dashes, underscores
|
|
29
|
+
- **Reject** if contains: `..`, `/`, `\`, or any shell metacharacters (`$`, backtick, `|`, `;`, `&`, `>`, `<`)
|
|
30
|
+
- If invalid, return error immediately (do not attempt to sanitize)
|
|
31
|
+
4. **Codex repo path** - Must exist and contain expected structure
|
|
32
|
+
|
|
33
|
+
If any validation fails, return an error (see Error Handling below).
|
|
34
|
+
|
|
35
|
+
## Process
|
|
36
|
+
|
|
37
|
+
### 1. Read Source Document
|
|
38
|
+
|
|
39
|
+
Read the file at the provided path. For PDFs, extract all text content. For markdown, read as-is.
|
|
40
|
+
|
|
41
|
+
### 2. Extract Key Information
|
|
42
|
+
|
|
43
|
+
From the content, identify:
|
|
44
|
+
- **Title** - The document/feature name
|
|
45
|
+
- **Main content** - The substantive information
|
|
46
|
+
- **Codebase paths** (if tech-design) - Any code paths mentioned
|
|
47
|
+
- **Source** - Default to `confluence` for PRDs/tech-designs, `exploration` for topics
|
|
48
|
+
- **Status** - Default based on type:
|
|
49
|
+
- PRD/tech-design: `draft` (new imports start as drafts)
|
|
50
|
+
- Topic/pattern: `active` (explorations are immediately usable)
|
|
51
|
+
|
|
52
|
+
### 3. Read and Apply Frontmatter Template
|
|
53
|
+
|
|
54
|
+
**Read the template from the codex repo** - don't hardcode frontmatter structure:
|
|
55
|
+
|
|
56
|
+
| Type | Template Path |
|
|
57
|
+
|------|---------------|
|
|
58
|
+
| `prd` | `{codex_repo}/templates/PRD.md` |
|
|
59
|
+
| `tech-design` | `{codex_repo}/templates/TECH-DESIGN.md` |
|
|
60
|
+
| `topic` | `{codex_repo}/templates/TOPIC.md` |
|
|
61
|
+
| `pattern` | `{codex_repo}/templates/PATTERN.md` (if exists, else use TOPIC.md) |
|
|
62
|
+
|
|
63
|
+
1. Read the appropriate template file
|
|
64
|
+
2. Extract its frontmatter structure
|
|
65
|
+
3. Fill in the values:
|
|
66
|
+
- `title` → extracted title
|
|
67
|
+
- `created` / `explored` → today's date (YYYY-MM-DD)
|
|
68
|
+
- `updated` → today's date (YYYY-MM-DD)
|
|
69
|
+
- `status` → `draft` for PRD/tech-design, `active` for topic/pattern
|
|
70
|
+
- `codebase_paths` → extracted paths, or omit if none found
|
|
71
|
+
- Keep other fields from template as-is
|
|
72
|
+
|
|
73
|
+
This ensures frontmatter stays in sync with the codex repo's templates.
|
|
74
|
+
|
|
75
|
+
### 4. Structure Content
|
|
76
|
+
|
|
77
|
+
Transform the source content into the codex format:
|
|
78
|
+
- Preserve the original information and structure where sensible
|
|
79
|
+
- Use markdown headings, lists, and tables appropriately
|
|
80
|
+
- Remove any PDF artifacts or formatting noise
|
|
81
|
+
- Keep the content substantive - don't pad with empty template sections
|
|
82
|
+
|
|
83
|
+
### 5. Write Output
|
|
84
|
+
|
|
85
|
+
Write the processed markdown to the correct location:
|
|
86
|
+
|
|
87
|
+
| Type | Output Path |
|
|
88
|
+
|------|-------------|
|
|
89
|
+
| `prd` | `{codex_repo}/projects/{name}/PRD.md` |
|
|
90
|
+
| `tech-design` | `{codex_repo}/projects/{name}/TECH-DESIGN.md` |
|
|
91
|
+
| `topic` | `{codex_repo}/topics/{name}.md` |
|
|
92
|
+
| `pattern` | `{codex_repo}/patterns/{name}.md` |
|
|
93
|
+
|
|
94
|
+
Create the directory if it doesn't exist.
|
|
95
|
+
|
|
96
|
+
**If file already exists:** Return an error. Do not overwrite without explicit confirmation from the main conversation. The error response should indicate the file exists so the user can decide whether to proceed.
|
|
97
|
+
|
|
98
|
+
### 6. Return Result
|
|
99
|
+
|
|
100
|
+
Return a brief JSON summary:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"status": "success",
|
|
105
|
+
"file_path": "/path/to/written/file.md",
|
|
106
|
+
"title": "Extracted document title",
|
|
107
|
+
"type": "prd",
|
|
108
|
+
"summary": "One sentence describing what was processed"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Important Notes
|
|
113
|
+
|
|
114
|
+
- **Preserve substance over form** - The goal is to capture the document's information, not perfectly replicate its layout
|
|
115
|
+
- **Don't invent content** - Only include information that exists in the source document
|
|
116
|
+
- **Handle missing sections gracefully** - If the source doesn't have a section (e.g., no "Testing Strategy"), omit it rather than leaving empty placeholders
|
|
117
|
+
- **Omit empty frontmatter fields** - If `codebase_paths` can't be determined, omit the field entirely rather than using placeholders
|
|
118
|
+
- **Canadian spelling** - Use behaviour, colour, etc.
|
|
119
|
+
|
|
120
|
+
## Error Handling
|
|
121
|
+
|
|
122
|
+
If anything fails, return an error response instead of the success format:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"status": "error",
|
|
127
|
+
"error_type": "validation_failed" | "file_not_found" | "extraction_failed" | "file_exists" | "write_failed",
|
|
128
|
+
"message": "Human-readable description of what went wrong"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Error types:**
|
|
133
|
+
- `validation_failed` - Invalid document type, unsafe name, or missing codex repo
|
|
134
|
+
- `file_not_found` - Source file doesn't exist or isn't readable
|
|
135
|
+
- `extraction_failed` - Couldn't extract meaningful content from the document
|
|
136
|
+
- `file_exists` - Target file already exists (user must confirm overwrite)
|
|
137
|
+
- `write_failed` - Couldn't write to target location (permissions, disk space, etc.)
|
|
@@ -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,314 @@
|
|
|
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 {type} {file} {name}` | Import PDF/markdown to codex (uses agent) |
|
|
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
|
+
status: draft | active | complete | archived
|
|
157
|
+
created: 2026-01-07
|
|
158
|
+
updated: 2026-01-07
|
|
159
|
+
confidence: high | medium | low
|
|
160
|
+
source: confluence | exploration | implementation
|
|
161
|
+
codebase_paths:
|
|
162
|
+
- apps/platform-api/src/...
|
|
163
|
+
---
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Status values:**
|
|
167
|
+
- `draft` - Initial capture, not ready for consumption
|
|
168
|
+
- `active` - Current, being used for implementation
|
|
169
|
+
- `complete` - Project shipped, kept for reference
|
|
170
|
+
- `archived` - No longer relevant, kept for history
|
|
171
|
+
|
|
172
|
+
Note: Topics use `draft | active | archived` (no "complete"). Patterns use `active | archived` (no draft phase).
|
|
173
|
+
|
|
174
|
+
**When loading any file:**
|
|
175
|
+
|
|
176
|
+
1. Parse frontmatter for `updated` date
|
|
177
|
+
2. Calculate days since update
|
|
178
|
+
3. If > `freshness_days` (default 30):
|
|
179
|
+
- Warn: "This doc was last updated {date} ({n} days ago). Want me to verify it's still accurate?"
|
|
180
|
+
4. If `codebase_paths` present:
|
|
181
|
+
- Check if those paths have commits since `updated` date
|
|
182
|
+
- If yes: "Files in {paths} have changed since this doc was updated. Want me to review?"
|
|
183
|
+
5. If `confidence: low`:
|
|
184
|
+
- Note: "This was a quick exploration and may be incomplete"
|
|
185
|
+
|
|
186
|
+
## Active Project Tracking
|
|
187
|
+
|
|
188
|
+
Scoped operations (`decision`, `snapshot`) require an active project:
|
|
189
|
+
|
|
190
|
+
- When user loads a project via `/codex {project-name}`, set it as active
|
|
191
|
+
- Store active project name in session context
|
|
192
|
+
- If scoped operation called with no active project → show project list, let user pick
|
|
193
|
+
|
|
194
|
+
## Adding Decisions
|
|
195
|
+
|
|
196
|
+
**Trigger:** `/codex decision {text}` or user wants to capture a decision
|
|
197
|
+
|
|
198
|
+
**Procedure:**
|
|
199
|
+
|
|
200
|
+
1. Verify active project exists (if not, prompt to select)
|
|
201
|
+
2. Read `{codex_repo}/projects/{active}/DECISIONS.md`
|
|
202
|
+
3. Append new decision with today's date:
|
|
203
|
+
```markdown
|
|
204
|
+
## {YYYY-MM-DD}: {Decision summary from text}
|
|
205
|
+
|
|
206
|
+
**Context:** {Extract from conversation}
|
|
207
|
+
|
|
208
|
+
**Decision:** {The decision}
|
|
209
|
+
|
|
210
|
+
**Rationale:** {Why this choice}
|
|
211
|
+
```
|
|
212
|
+
4. Update `updated` date in frontmatter
|
|
213
|
+
5. Create branch, commit, and open PR via `gh pr create`
|
|
214
|
+
|
|
215
|
+
Full procedure: `references/decisions.md`
|
|
216
|
+
|
|
217
|
+
## Adding Topics
|
|
218
|
+
|
|
219
|
+
**Trigger:** `/codex add topic {name}` or user wants to save exploration
|
|
220
|
+
|
|
221
|
+
**Procedure:**
|
|
222
|
+
|
|
223
|
+
1. Create `{codex_repo}/topics/{name}.md`
|
|
224
|
+
2. Use template from `{codex_repo}/templates/TOPIC.md`
|
|
225
|
+
3. Fill in frontmatter:
|
|
226
|
+
- `explored`: today's date
|
|
227
|
+
- `confidence`: ask user or infer from exploration depth
|
|
228
|
+
- `codebase_paths`: paths that were explored
|
|
229
|
+
4. Fill in content from current exploration/conversation
|
|
230
|
+
5. Create branch, commit, and open PR via `gh pr create`
|
|
231
|
+
|
|
232
|
+
Full procedure: `references/topics.md`
|
|
233
|
+
|
|
234
|
+
## Importing Documents
|
|
235
|
+
|
|
236
|
+
**Trigger:** `/codex snapshot {type} {file} {name}` or user wants to add a file to the codex
|
|
237
|
+
|
|
238
|
+
**IMPORTANT:** Always use the `codex-document-processor` agent to process documents. This keeps the main conversation context lean by offloading heavy document processing.
|
|
239
|
+
|
|
240
|
+
**Procedure:**
|
|
241
|
+
|
|
242
|
+
1. Determine the document type (required): `prd`, `tech-design`, `topic`, or `pattern`
|
|
243
|
+
2. Spawn the `codex-document-processor` agent with:
|
|
244
|
+
- File path to the source document
|
|
245
|
+
- Document type
|
|
246
|
+
- Project/entry name
|
|
247
|
+
- Codex repo path from config
|
|
248
|
+
3. Agent processes the document:
|
|
249
|
+
- Reads and extracts content
|
|
250
|
+
- Applies appropriate frontmatter template
|
|
251
|
+
- Writes to correct location in codex repo
|
|
252
|
+
- Returns file path and summary
|
|
253
|
+
4. **Back in main conversation:** Handle git workflow
|
|
254
|
+
- Create branch: `codex/snapshot-{name}`
|
|
255
|
+
- Commit the new file
|
|
256
|
+
- Push and create PR via `gh pr create`
|
|
257
|
+
5. Share PR link with user
|
|
258
|
+
|
|
259
|
+
**Example invocations:**
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Explicit snapshot command
|
|
263
|
+
/codex snapshot prd ~/Downloads/transaction-templates-prd.pdf transaction-templates
|
|
264
|
+
|
|
265
|
+
# Natural language (still uses the agent)
|
|
266
|
+
"Add this PRD to the transaction-templates project" + attach file
|
|
267
|
+
"Import this tech design to generic-scenario-testing"
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The agent handles: PDF reading, content extraction, frontmatter generation, file writing.
|
|
271
|
+
The main conversation handles: git branch, commit, PR creation, user interaction.
|
|
272
|
+
|
|
273
|
+
## Creating New Projects
|
|
274
|
+
|
|
275
|
+
**Trigger:** `/codex new {name}` or user wants to start new project entry
|
|
276
|
+
|
|
277
|
+
**Procedure:**
|
|
278
|
+
|
|
279
|
+
1. Create `{codex_repo}/projects/{name}/`
|
|
280
|
+
2. Copy templates from `{codex_repo}/templates/`:
|
|
281
|
+
- PRD.md
|
|
282
|
+
- TECH-DESIGN.md
|
|
283
|
+
- DECISIONS.md
|
|
284
|
+
3. Fill in frontmatter with today's date
|
|
285
|
+
4. Create branch, commit, and open PR via `gh pr create`
|
|
286
|
+
|
|
287
|
+
Full procedure: `references/creating.md`
|
|
288
|
+
|
|
289
|
+
## Integration with /project
|
|
290
|
+
|
|
291
|
+
The codex holds **shared** organizational knowledge. The `/project` skill holds **personal** working memory.
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
/codex transaction-templates → load shared context
|
|
295
|
+
/project create --from codex:{name} → seed personal PROJECT.md
|
|
296
|
+
/codex publish → promote learnings back (future)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
When user runs `/project create --from codex:{name}`:
|
|
300
|
+
1. Load the codex entry
|
|
301
|
+
2. Extract key context for personal PROJECT.md
|
|
302
|
+
3. Create project in user's projects_dir
|
|
303
|
+
|
|
304
|
+
## Git Workflow
|
|
305
|
+
|
|
306
|
+
**All codex changes must go through PRs** (main branch is protected):
|
|
307
|
+
|
|
308
|
+
1. Create branch: `codex/{action}-{name}` (e.g., `codex/decision-uuid-format`)
|
|
309
|
+
2. Make changes
|
|
310
|
+
3. Commit with descriptive message
|
|
311
|
+
4. Push and create PR via `gh pr create`
|
|
312
|
+
5. Share PR link with user
|
|
313
|
+
|
|
314
|
+
Safe changes (new files, decision appends) are auto-merged by GitHub Action. Modifications to existing content require review.
|