@cluesmith/codev 1.1.0 → 1.2.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/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +19 -0
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
- package/dist/agent-farm/commands/cleanup.js +18 -1
- package/dist/agent-farm/commands/cleanup.js.map +1 -1
- package/dist/agent-farm/commands/consult.d.ts +16 -0
- package/dist/agent-farm/commands/consult.d.ts.map +1 -0
- package/dist/agent-farm/commands/consult.js +51 -0
- package/dist/agent-farm/commands/consult.js.map +1 -0
- package/dist/agent-farm/commands/open.js +6 -6
- package/dist/agent-farm/commands/open.js.map +1 -1
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +51 -42
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/commands/start.d.ts.map +1 -1
- package/dist/agent-farm/commands/start.js +9 -14
- package/dist/agent-farm/commands/start.js.map +1 -1
- package/dist/agent-farm/commands/util.js +2 -2
- package/dist/agent-farm/commands/util.js.map +1 -1
- package/dist/agent-farm/db/errors.d.ts +4 -0
- package/dist/agent-farm/db/errors.d.ts.map +1 -1
- package/dist/agent-farm/db/errors.js +8 -0
- package/dist/agent-farm/db/errors.js.map +1 -1
- package/dist/agent-farm/servers/dashboard-server.js +125 -71
- package/dist/agent-farm/servers/dashboard-server.js.map +1 -1
- package/dist/agent-farm/servers/open-server.d.ts +9 -0
- package/dist/agent-farm/servers/open-server.d.ts.map +1 -0
- package/dist/agent-farm/servers/{annotate-server.js → open-server.js} +17 -15
- package/dist/agent-farm/servers/open-server.js.map +1 -0
- package/dist/agent-farm/servers/tower-server.js +4 -7
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/state.d.ts +5 -0
- package/dist/agent-farm/state.d.ts.map +1 -1
- package/dist/agent-farm/state.js +17 -0
- package/dist/agent-farm/state.js.map +1 -1
- package/dist/agent-farm/types.d.ts +1 -1
- package/dist/agent-farm/types.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.js +13 -7
- package/dist/agent-farm/utils/config.js.map +1 -1
- package/dist/agent-farm/utils/port-registry.d.ts +1 -1
- package/dist/agent-farm/utils/port-registry.d.ts.map +1 -1
- package/dist/agent-farm/utils/port-registry.js +1 -1
- package/dist/agent-farm/utils/port-registry.js.map +1 -1
- package/dist/agent-farm/utils/shell.d.ts +19 -0
- package/dist/agent-farm/utils/shell.d.ts.map +1 -1
- package/dist/agent-farm/utils/shell.js +28 -0
- package/dist/agent-farm/utils/shell.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +33 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt.d.ts +3 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +31 -25
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/consult/index.d.ts +3 -2
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +128 -54
- package/dist/commands/consult/index.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +88 -36
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/eject.d.ts +18 -0
- package/dist/commands/eject.d.ts.map +1 -0
- package/dist/commands/eject.js +149 -0
- package/dist/commands/eject.js.map +1 -0
- package/dist/commands/import.d.ts +16 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +278 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +32 -27
- package/dist/commands/init.js.map +1 -1
- package/dist/lib/projectlist-parser.d.ts +70 -0
- package/dist/lib/projectlist-parser.d.ts.map +1 -0
- package/dist/lib/projectlist-parser.js +200 -0
- package/dist/lib/projectlist-parser.js.map +1 -0
- package/dist/lib/skeleton.d.ts +41 -0
- package/dist/lib/skeleton.d.ts.map +1 -0
- package/dist/lib/skeleton.js +110 -0
- package/dist/lib/skeleton.js.map +1 -0
- package/dist/lib/templates.d.ts +2 -1
- package/dist/lib/templates.d.ts.map +1 -1
- package/dist/lib/templates.js +11 -10
- package/dist/lib/templates.js.map +1 -1
- package/package.json +5 -4
- package/{templates → skeleton}/DEPENDENCIES.md +3 -48
- package/skeleton/bin/agent-farm +7 -0
- package/skeleton/docs/commands/agent-farm.md +469 -0
- package/skeleton/docs/commands/codev.md +253 -0
- package/skeleton/docs/commands/consult.md +286 -0
- package/skeleton/docs/commands/overview.md +108 -0
- package/skeleton/maintain/.gitkeep +2 -0
- package/{templates → skeleton}/protocols/experiment/protocol.md +2 -2
- package/skeleton/protocols/maintain/protocol.md +502 -0
- package/skeleton/protocols/maintain/templates/maintenance-run.md +64 -0
- package/{templates → skeleton}/protocols/spider/protocol.md +9 -9
- package/{templates/protocols/spider-solo → skeleton/protocols/spider}/templates/plan.md +22 -1
- package/{templates/protocols/spider-solo → skeleton/protocols/spider}/templates/spec.md +30 -1
- package/skeleton/protocols/tick/protocol.md +277 -0
- package/skeleton/resources/lessons-learned.md +30 -0
- package/skeleton/resources/workflow-reference.md +242 -0
- package/skeleton/roles/architect.md +283 -0
- package/{templates → skeleton}/roles/builder.md +2 -0
- package/skeleton/roles/review-types/impl-review.md +56 -0
- package/skeleton/roles/review-types/integration-review.md +68 -0
- package/skeleton/roles/review-types/plan-review.md +59 -0
- package/skeleton/roles/review-types/pr-ready.md +72 -0
- package/skeleton/roles/review-types/spec-review.md +55 -0
- package/skeleton/templates/lessons-learned.md +28 -0
- package/{templates → skeleton}/templates/projectlist.md +17 -16
- package/dist/agent-farm/servers/annotate-server.d.ts +0 -9
- package/dist/agent-farm/servers/annotate-server.d.ts.map +0 -1
- package/dist/agent-farm/servers/annotate-server.js.map +0 -1
- package/templates/agents/architecture-documenter.md +0 -189
- package/templates/agents/codev-updater.md +0 -276
- package/templates/agents/spider-protocol-updater.md +0 -118
- package/templates/annotate.html +0 -903
- package/templates/bin/agent-farm +0 -18
- package/templates/bin/annotate-server.js +0 -140
- package/templates/dashboard-split.html +0 -1679
- package/templates/dashboard.html +0 -149
- package/templates/protocols/maintain/protocol.md +0 -235
- package/templates/protocols/spider/templates/plan.md +0 -169
- package/templates/protocols/spider/templates/review.md +0 -207
- package/templates/protocols/spider/templates/spec.md +0 -140
- package/templates/protocols/spider-solo/protocol.md +0 -619
- package/templates/protocols/tick/protocol.md +0 -250
- package/templates/roles/architect.md +0 -230
- package/templates/tower.html +0 -1032
- /package/{templates/AGENTS.md → skeleton/AGENTS.md.template} +0 -0
- /package/{templates/CLAUDE.md → skeleton/CLAUDE.md.template} +0 -0
- /package/{templates → skeleton}/bin/codev-doctor +0 -0
- /package/{templates → skeleton}/builders.md +0 -0
- /package/{templates → skeleton}/config.json +0 -0
- /package/{templates → skeleton}/plans/.gitkeep +0 -0
- /package/{templates → skeleton}/protocols/experiment/templates/notes.md +0 -0
- /package/{templates/protocols/spider-solo → skeleton/protocols/spider}/templates/review.md +0 -0
- /package/{templates → skeleton}/protocols/tick/templates/plan.md +0 -0
- /package/{templates → skeleton}/protocols/tick/templates/review.md +0 -0
- /package/{templates → skeleton}/protocols/tick/templates/spec.md +0 -0
- /package/{templates → skeleton}/reviews/.gitkeep +0 -0
- /package/{templates → skeleton}/roles/consultant.md +0 -0
- /package/{templates → skeleton}/specs/.gitkeep +0 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
# MAINTAIN Protocol
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
MAINTAIN is a periodic maintenance protocol for keeping codebases healthy. Unlike SPIDER/TICK (which have sequential phases), MAINTAIN is a **task list** where tasks can run in parallel and some require human review.
|
|
6
|
+
|
|
7
|
+
**Core Principle**: Regular maintenance prevents technical debt accumulation.
|
|
8
|
+
|
|
9
|
+
**Key Documents**: MAINTAIN is responsible for keeping these living documents accurate and consistent:
|
|
10
|
+
- `codev/resources/arch.md` - Architecture documentation (how the system works)
|
|
11
|
+
- `codev/resources/lessons-learned.md` - Extracted wisdom from reviews
|
|
12
|
+
|
|
13
|
+
Any builder can update these files during development, but MAINTAIN ensures they stay consistent with the actual codebase.
|
|
14
|
+
|
|
15
|
+
## When to Use MAINTAIN
|
|
16
|
+
|
|
17
|
+
- When the user/architect requests it
|
|
18
|
+
- Before a release (clean slate for shipping)
|
|
19
|
+
- Quarterly maintenance window
|
|
20
|
+
- After completing a major feature
|
|
21
|
+
- When the codebase feels "crusty"
|
|
22
|
+
|
|
23
|
+
## Execution Model
|
|
24
|
+
|
|
25
|
+
MAINTAIN is executed by a Builder, spawned by the Architect:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Architect: "Time for maintenance"
|
|
29
|
+
↓
|
|
30
|
+
af spawn --protocol maintain
|
|
31
|
+
↓
|
|
32
|
+
Builder works through task list
|
|
33
|
+
↓
|
|
34
|
+
PR with maintenance changes
|
|
35
|
+
↓
|
|
36
|
+
Architect reviews → Builder merges
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Prerequisites
|
|
40
|
+
|
|
41
|
+
Before starting MAINTAIN:
|
|
42
|
+
1. Check `codev/maintain/` for last maintenance run
|
|
43
|
+
2. Note the base commit from that run
|
|
44
|
+
3. Focus on changes since that commit: `git log --oneline <base-commit>..HEAD`
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Maintenance Files
|
|
49
|
+
|
|
50
|
+
Each maintenance run creates a numbered file in `codev/maintain/`:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
codev/maintain/
|
|
54
|
+
├── 0001.md
|
|
55
|
+
├── 0002.md
|
|
56
|
+
└── ...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Template**: `codev/protocols/maintain/templates/maintenance-run.md`
|
|
60
|
+
|
|
61
|
+
The file records:
|
|
62
|
+
- Base commit (starting point)
|
|
63
|
+
- Tasks completed
|
|
64
|
+
- Findings and deferred items
|
|
65
|
+
- Summary
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Task List
|
|
70
|
+
|
|
71
|
+
### Code Hygiene Tasks
|
|
72
|
+
|
|
73
|
+
| Task | Parallelizable | Human Review? | Description |
|
|
74
|
+
|------|----------------|---------------|-------------|
|
|
75
|
+
| Remove dead code | Yes | No | Delete unused functions, imports, unreachable code |
|
|
76
|
+
| Remove unused dependencies | Yes | Yes | Check package.json/requirements.txt for unused packages |
|
|
77
|
+
| Clean unused flags | Yes | No | Remove feature flags that are always on/off |
|
|
78
|
+
| Fix flaky tests | No | Yes | Investigate and fix intermittently failing tests |
|
|
79
|
+
| Update outdated dependencies | Yes | Yes | Bump dependencies with breaking change review |
|
|
80
|
+
| Identify duplicate code | Yes | Yes | Find repeated patterns that should be utility functions |
|
|
81
|
+
|
|
82
|
+
**Tools**:
|
|
83
|
+
```bash
|
|
84
|
+
# TypeScript/JavaScript
|
|
85
|
+
npx ts-prune # Find unused exports
|
|
86
|
+
npx depcheck # Find unused dependencies
|
|
87
|
+
npx jscpd . # Find copy-paste code (optional)
|
|
88
|
+
|
|
89
|
+
# Python
|
|
90
|
+
ruff check --select F401 # Find unused imports
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Documentation Sync Tasks
|
|
94
|
+
|
|
95
|
+
| Task | Parallelizable | Human Review? | Description |
|
|
96
|
+
|------|----------------|---------------|-------------|
|
|
97
|
+
| Update arch.md | Yes | No | Sync architecture doc with actual codebase |
|
|
98
|
+
| Generate lessons-learned.md | Yes | Yes | Extract wisdom from review documents |
|
|
99
|
+
| Sync CLAUDE.md ↔ AGENTS.md | Yes | No | Ensure both files match |
|
|
100
|
+
| Prune documentation | Yes | Yes | Remove obsolete info, keep CLAUDE.md/README.md under 400 lines |
|
|
101
|
+
| Check spec/plan/review consistency | Yes | Yes | Find specs without reviews, plans that don't match code |
|
|
102
|
+
| Remove stale doc references | Yes | No | Delete references to deleted code/files |
|
|
103
|
+
|
|
104
|
+
### Project Tracking Tasks
|
|
105
|
+
|
|
106
|
+
| Task | Parallelizable | Human Review? | Description |
|
|
107
|
+
|------|----------------|---------------|-------------|
|
|
108
|
+
| Update projectlist.md status | Yes | No | Update project statuses |
|
|
109
|
+
| Archive terminal projects | Yes | No | Move completed/abandoned to terminal section |
|
|
110
|
+
|
|
111
|
+
### Framework Tasks
|
|
112
|
+
|
|
113
|
+
| Task | Parallelizable | Human Review? | Description |
|
|
114
|
+
|------|----------------|---------------|-------------|
|
|
115
|
+
| Run codev update | No | Yes | Update codev framework to latest version |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Task Details
|
|
120
|
+
|
|
121
|
+
### Update arch.md
|
|
122
|
+
|
|
123
|
+
Scan the actual codebase and update `codev/resources/arch.md`:
|
|
124
|
+
|
|
125
|
+
**Discovery phase**:
|
|
126
|
+
1. `git log --oneline <base-commit>..HEAD` - what changed since last maintenance
|
|
127
|
+
2. `ls -R` key directories to find new files/modules
|
|
128
|
+
3. `grep` for new exports, classes, key functions
|
|
129
|
+
4. Review new/modified specs: `git diff <base-commit>..HEAD --name-only -- codev/specs/`
|
|
130
|
+
5. Review new/modified plans: `git diff <base-commit>..HEAD --name-only -- codev/plans/`
|
|
131
|
+
|
|
132
|
+
**Update arch.md**:
|
|
133
|
+
1. Verify directory structure matches documented structure
|
|
134
|
+
2. Update component descriptions for changed modules
|
|
135
|
+
3. Add new utilities/helpers discovered
|
|
136
|
+
4. Remove references to deleted code
|
|
137
|
+
5. Update technology stack if dependencies changed
|
|
138
|
+
6. Document new integration points or APIs
|
|
139
|
+
7. Capture architectural decisions from new specs/plans
|
|
140
|
+
|
|
141
|
+
**Primary sources** (specs/plans):
|
|
142
|
+
- Architectural decisions from specs
|
|
143
|
+
- Component relationships from plans
|
|
144
|
+
- Design rationale and tradeoffs
|
|
145
|
+
|
|
146
|
+
**Secondary sources** (code):
|
|
147
|
+
- File locations and their purpose
|
|
148
|
+
- Key functions/classes and what they do
|
|
149
|
+
- Data flow and dependencies
|
|
150
|
+
- Configuration options
|
|
151
|
+
- CLI commands and flags
|
|
152
|
+
|
|
153
|
+
**What NOT to include**:
|
|
154
|
+
- Implementation details that change frequently
|
|
155
|
+
- Line numbers (they go stale)
|
|
156
|
+
- Full API documentation (use JSDoc/docstrings for that)
|
|
157
|
+
|
|
158
|
+
**Primary Purpose**: arch.md should enable a developer (or AI agent) to rapidly understand the entire system - not just file locations, but **how things actually work**.
|
|
159
|
+
|
|
160
|
+
**Recommended Document Structure**:
|
|
161
|
+
```markdown
|
|
162
|
+
# Project Architecture
|
|
163
|
+
|
|
164
|
+
## Overview
|
|
165
|
+
[High-level description: what the system does, core design philosophy, 2-3 sentences]
|
|
166
|
+
|
|
167
|
+
## Quick Start for Developers
|
|
168
|
+
[The fastest path to understanding: "To understand X, read Y first"]
|
|
169
|
+
|
|
170
|
+
## Technology Stack
|
|
171
|
+
[Technologies, frameworks, key dependencies with versions]
|
|
172
|
+
|
|
173
|
+
## Directory Structure
|
|
174
|
+
[Complete directory tree with explanations for each major directory]
|
|
175
|
+
|
|
176
|
+
## Major Components
|
|
177
|
+
|
|
178
|
+
### [Component Name] (e.g., Agent Farm)
|
|
179
|
+
- **Purpose**: What problem it solves
|
|
180
|
+
- **Location**: path/to/component
|
|
181
|
+
- **How It Works**:
|
|
182
|
+
- Step-by-step explanation of the mechanism
|
|
183
|
+
- Key technologies used (e.g., "uses tmux for terminal multiplexing")
|
|
184
|
+
- Runtime behavior (e.g., "spawns a tmux session per builder")
|
|
185
|
+
- State management (e.g., "state stored in SQLite at .agent-farm/state.db")
|
|
186
|
+
- **Key Files**:
|
|
187
|
+
- `file.ts` - does X
|
|
188
|
+
- `other.ts` - handles Y
|
|
189
|
+
- **Configuration**: How to customize behavior
|
|
190
|
+
- **Common Operations**: Examples of typical usage
|
|
191
|
+
|
|
192
|
+
[Repeat for each major component - be thorough about HOW, not just WHAT]
|
|
193
|
+
|
|
194
|
+
## Utility Functions & Helpers
|
|
195
|
+
### [Utility Category]
|
|
196
|
+
- **File**: path/to/utility.ts
|
|
197
|
+
- **Functions**: `functionName()` - Description and use case
|
|
198
|
+
- **When to Use**: Guidance on appropriate usage
|
|
199
|
+
|
|
200
|
+
## Data Flow
|
|
201
|
+
[How data moves through the system, with concrete examples]
|
|
202
|
+
|
|
203
|
+
## Key Design Decisions
|
|
204
|
+
[Important architectural choices and their rationale - the WHY]
|
|
205
|
+
|
|
206
|
+
## Integration Points
|
|
207
|
+
[External services, APIs, databases, and how they connect]
|
|
208
|
+
|
|
209
|
+
## Development Patterns
|
|
210
|
+
[Common patterns used throughout the codebase]
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Critical: The "How It Works" Requirement**
|
|
214
|
+
|
|
215
|
+
For each major component, arch.md MUST explain the implementation mechanism, not just the purpose. Examples of good vs bad:
|
|
216
|
+
|
|
217
|
+
| Bad (just WHAT) | Good (includes HOW) |
|
|
218
|
+
|-----------------|---------------------|
|
|
219
|
+
| "Agent Farm manages builders" | "Agent Farm spawns builders in isolated git worktrees. Each builder runs in a tmux session (named `builder-{id}`). The dashboard uses ttyd to expose terminals via HTTP on ports 4201-4299. State is persisted in SQLite." |
|
|
220
|
+
| "Consult tool queries AI models" | "Consult shells out to external CLIs (gemini-cli, codex, claude). It writes the consultant role to a temp file, sets environment variables, and streams stdout/stderr back to the user." |
|
|
221
|
+
|
|
222
|
+
This level of detail enables rapid onboarding and debugging.
|
|
223
|
+
|
|
224
|
+
**Content Quality Standards**:
|
|
225
|
+
- **Be Specific**: Include exact file paths, actual function names, concrete examples
|
|
226
|
+
- **Maintain Accuracy**: Cross-reference specs/plans with actual implementation; flag discrepancies
|
|
227
|
+
- **Optimize for Quick Understanding**: Use clear hierarchy, highlight commonly used components
|
|
228
|
+
- **Stay Current**: Reflect actual state, not aspirational; remove deprecated components
|
|
229
|
+
|
|
230
|
+
**Special Attention Areas**:
|
|
231
|
+
|
|
232
|
+
1. **Utility Functions** (critical for productivity):
|
|
233
|
+
- Document every utility function with exact location
|
|
234
|
+
- Explain what each does and when to use it
|
|
235
|
+
- Include parameter types and return types
|
|
236
|
+
|
|
237
|
+
2. **Directory Structure** (often first thing referenced):
|
|
238
|
+
- Keep directory tree up-to-date and complete
|
|
239
|
+
- Explain purpose of each major directory
|
|
240
|
+
- Highlight where specific types of files should be placed
|
|
241
|
+
|
|
242
|
+
3. **Integration Points** (critical for understanding system boundaries):
|
|
243
|
+
- Document all external dependencies and APIs
|
|
244
|
+
- Explain how different parts connect
|
|
245
|
+
- Note special configuration requirements
|
|
246
|
+
|
|
247
|
+
**Quality Assurance Before Finalizing**:
|
|
248
|
+
- [ ] All file paths are correct and current
|
|
249
|
+
- [ ] All documented functions actually exist
|
|
250
|
+
- [ ] Directory structure matches reality
|
|
251
|
+
- [ ] Architectural decisions are accurately represented
|
|
252
|
+
- [ ] Document is internally consistent
|
|
253
|
+
|
|
254
|
+
**Constraints**:
|
|
255
|
+
- Never invent structure - only document what exists or is in specs/plans
|
|
256
|
+
- Never make architectural decisions - document them, don't make them
|
|
257
|
+
- Always verify documentation against actual implementation
|
|
258
|
+
|
|
259
|
+
### Generate lessons-learned.md
|
|
260
|
+
|
|
261
|
+
Extract actionable wisdom from review documents into `codev/resources/lessons-learned.md`:
|
|
262
|
+
|
|
263
|
+
**Discovery phase**:
|
|
264
|
+
1. Find new/modified reviews: `git diff <base-commit>..HEAD --name-only -- codev/reviews/`
|
|
265
|
+
2. Read each new/modified review file
|
|
266
|
+
|
|
267
|
+
**Extract from reviews**:
|
|
268
|
+
1. Read all files in `codev/reviews/`
|
|
269
|
+
2. Extract lessons that are:
|
|
270
|
+
- Actionable (not just "we learned X")
|
|
271
|
+
- Durable (still relevant)
|
|
272
|
+
- General (applicable beyond one project)
|
|
273
|
+
3. Organize by topic (Testing, Architecture, Process, etc.)
|
|
274
|
+
4. Link back to source review
|
|
275
|
+
5. Prune outdated lessons
|
|
276
|
+
|
|
277
|
+
**Template**:
|
|
278
|
+
```markdown
|
|
279
|
+
# Lessons Learned
|
|
280
|
+
|
|
281
|
+
## Testing
|
|
282
|
+
- [From 0001] Always use XDG sandboxing in tests to avoid touching real $HOME
|
|
283
|
+
- [From 0009] Verify dependencies actually export what you expect
|
|
284
|
+
|
|
285
|
+
## Architecture
|
|
286
|
+
- [From 0008] Single source of truth beats distributed state
|
|
287
|
+
- [From 0031] SQLite with WAL mode handles concurrency better than JSON files
|
|
288
|
+
|
|
289
|
+
## Process
|
|
290
|
+
- [From 0001] Multi-agent consultation catches issues humans miss
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Sync CLAUDE.md ↔ AGENTS.md
|
|
294
|
+
|
|
295
|
+
Ensure both instruction files contain the same content:
|
|
296
|
+
|
|
297
|
+
1. Diff the two files
|
|
298
|
+
2. Identify divergence
|
|
299
|
+
3. Update the stale one to match
|
|
300
|
+
4. Both should be identical (per AGENTS.md standard)
|
|
301
|
+
|
|
302
|
+
### Prune Documentation
|
|
303
|
+
|
|
304
|
+
**CRITICAL: Documentation pruning requires JUSTIFICATION for every deletion.**
|
|
305
|
+
|
|
306
|
+
Size targets (~400 lines for CLAUDE.md/README.md) are **guidelines, not mandates**. Never sacrifice clarity or important content just to hit a line count.
|
|
307
|
+
|
|
308
|
+
**Before deleting ANY content, document:**
|
|
309
|
+
1. **What** is being removed (quote or summarize)
|
|
310
|
+
2. **Why** it's being removed:
|
|
311
|
+
- `OBSOLETE` - References deleted code/features
|
|
312
|
+
- `DUPLICATIVE` - Same info exists elsewhere (cite location)
|
|
313
|
+
- `MOVED` - Relocated to another file (cite new location)
|
|
314
|
+
- `VERBOSE` - Can be condensed without losing meaning
|
|
315
|
+
3. **Decision** - Delete, move, or keep with note
|
|
316
|
+
|
|
317
|
+
**Create a deletion log in your maintenance file:**
|
|
318
|
+
```markdown
|
|
319
|
+
## Documentation Changes
|
|
320
|
+
|
|
321
|
+
### arch.md
|
|
322
|
+
| Section | Action | Reason |
|
|
323
|
+
|---------|--------|--------|
|
|
324
|
+
| "Old API docs" | DELETED | OBSOLETE - API removed in v1.2 |
|
|
325
|
+
| "Installation" | MOVED | To INSTALL.md for brevity |
|
|
326
|
+
| "Architecture patterns" | KEPT | Still relevant, referenced by builders |
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Files to review**:
|
|
330
|
+
- `codev/resources/arch.md` - remove references to deleted code/modules
|
|
331
|
+
- `codev/resources/lessons-learned.md` - remove outdated lessons
|
|
332
|
+
- `CLAUDE.md` / `AGENTS.md` - target ~400 lines (guideline, not hard limit)
|
|
333
|
+
- `README.md` - target ~400 lines (guideline, not hard limit)
|
|
334
|
+
|
|
335
|
+
**Conservative approach**:
|
|
336
|
+
- When in doubt, KEEP the content
|
|
337
|
+
- If unsure, ASK the architect before deleting
|
|
338
|
+
- Prefer MOVING over DELETING
|
|
339
|
+
- Never delete "development patterns" or "best practices" sections without explicit approval
|
|
340
|
+
|
|
341
|
+
**What to extract (move, don't delete)**:
|
|
342
|
+
- Detailed command references → `codev/docs/commands/`
|
|
343
|
+
- Protocol details → `codev/protocols/*/protocol.md`
|
|
344
|
+
- Tool configuration → `codev/resources/`
|
|
345
|
+
|
|
346
|
+
**What to ALWAYS keep in CLAUDE.md**:
|
|
347
|
+
- Git prohibitions and safety rules
|
|
348
|
+
- Critical workflow instructions
|
|
349
|
+
- Protocol selection guidance
|
|
350
|
+
- Consultation requirements
|
|
351
|
+
- Links to detailed docs
|
|
352
|
+
|
|
353
|
+
**Good candidates for deletion from CLAUDE.md**:
|
|
354
|
+
- Content duplicated elsewhere (e.g., in protocol files, role files, docs/)
|
|
355
|
+
- **When removing duplicated content**: Replace with a pointer to the canonical location
|
|
356
|
+
```markdown
|
|
357
|
+
## Consult Tool
|
|
358
|
+
|
|
359
|
+
See `codev/docs/commands/consult.md` for full documentation.
|
|
360
|
+
```
|
|
361
|
+
- This keeps CLAUDE.md as an index/guide rather than duplicating detailed docs
|
|
362
|
+
|
|
363
|
+
### Remove Dead Code
|
|
364
|
+
|
|
365
|
+
Use static analysis to find and remove unused code:
|
|
366
|
+
|
|
367
|
+
1. Run analysis tools (ts-prune, depcheck, ruff)
|
|
368
|
+
2. Review findings for false positives
|
|
369
|
+
3. Use `git rm` to remove confirmed dead code
|
|
370
|
+
4. Commit with descriptive message
|
|
371
|
+
|
|
372
|
+
**Important**: Use `git rm`, not `rm`. Git history preserves deleted files.
|
|
373
|
+
|
|
374
|
+
### Update Dependencies
|
|
375
|
+
|
|
376
|
+
Review and update outdated dependencies:
|
|
377
|
+
|
|
378
|
+
1. Run `npm outdated` or equivalent
|
|
379
|
+
2. Categorize updates:
|
|
380
|
+
- Patch: Safe to auto-update
|
|
381
|
+
- Minor: Review changelog
|
|
382
|
+
- Major: Requires human review for breaking changes
|
|
383
|
+
3. Update and test
|
|
384
|
+
4. Document any migration steps
|
|
385
|
+
|
|
386
|
+
### Run codev update
|
|
387
|
+
|
|
388
|
+
Update the codev framework to the latest version:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
codev update
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
This updates protocols, templates, and agents while preserving your specs, plans, and reviews.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Validation
|
|
399
|
+
|
|
400
|
+
After completing tasks, validate the codebase:
|
|
401
|
+
|
|
402
|
+
- [ ] All tests pass
|
|
403
|
+
- [ ] Build succeeds
|
|
404
|
+
- [ ] No import/module errors
|
|
405
|
+
- [ ] Documentation links resolve
|
|
406
|
+
- [ ] Linter passes
|
|
407
|
+
|
|
408
|
+
If validation fails, investigate and fix before creating PR.
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## 3-Way Review (Before PR)
|
|
413
|
+
|
|
414
|
+
After completing all tasks and validation, run a 3-way consultation review:
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
# Run all three in parallel
|
|
418
|
+
consult --model gemini --type impl-review pr <branch-name> &
|
|
419
|
+
consult --model codex --type impl-review pr <branch-name> &
|
|
420
|
+
consult --model claude --type impl-review pr <branch-name> &
|
|
421
|
+
wait
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**Focus areas for maintenance review:**
|
|
425
|
+
- Are deletions justified and documented?
|
|
426
|
+
- Is arch.md accurate and complete?
|
|
427
|
+
- Are lessons-learned.md entries actionable?
|
|
428
|
+
- Any regressions or side effects?
|
|
429
|
+
|
|
430
|
+
**Verdicts:**
|
|
431
|
+
- All APPROVE → Create PR
|
|
432
|
+
- Any REQUEST_CHANGES → Address feedback, re-run review
|
|
433
|
+
- Conflicting opinions → Use judgment, document decision
|
|
434
|
+
|
|
435
|
+
Only create the PR after the 3-way review passes.
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Rollback Strategy
|
|
440
|
+
|
|
441
|
+
### For code changes
|
|
442
|
+
```bash
|
|
443
|
+
# Git history preserves everything
|
|
444
|
+
git log --all --full-history -- path/to/file
|
|
445
|
+
git checkout <commit>~1 -- path/to/file
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### For untracked files
|
|
449
|
+
Move to `codev/maintain/.trash/YYYY-MM-DD/` before deleting. Retained for 30 days.
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Commit Messages
|
|
454
|
+
|
|
455
|
+
```
|
|
456
|
+
[Maintain] Remove 5 unused exports
|
|
457
|
+
[Maintain] Update arch.md with new utilities
|
|
458
|
+
[Maintain] Generate lessons-learned.md
|
|
459
|
+
[Maintain] Sync CLAUDE.md with AGENTS.md
|
|
460
|
+
[Maintain] Update dependencies (patch)
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Governance
|
|
466
|
+
|
|
467
|
+
MAINTAIN is an **operational protocol**, not a feature development protocol:
|
|
468
|
+
|
|
469
|
+
| Document | Required? |
|
|
470
|
+
|----------|-----------|
|
|
471
|
+
| Spec | No |
|
|
472
|
+
| Plan | No |
|
|
473
|
+
| Review | No |
|
|
474
|
+
| 3-Way Consultation | **Yes** (before creating PR) |
|
|
475
|
+
|
|
476
|
+
**Exception**: If MAINTAIN reveals need for architectural changes, those should follow SPIDER.
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## Best Practices
|
|
481
|
+
|
|
482
|
+
1. **Don't be aggressive**: When in doubt, KEEP the content. It's easier to delete later than to recover lost knowledge.
|
|
483
|
+
2. **Check git blame**: Understand why code/docs exist before removing
|
|
484
|
+
3. **Run full test suite**: Not just affected tests
|
|
485
|
+
4. **Group related changes**: One commit per logical change
|
|
486
|
+
5. **Document EVERY deletion**: Include what, why, and where (if moved)
|
|
487
|
+
6. **Ask when unsure**: Consult architect before removing "important-looking" content
|
|
488
|
+
7. **Prefer moving over deleting**: Extract to another file rather than removing entirely
|
|
489
|
+
8. **Size targets are guidelines**: Never sacrifice clarity to hit a line count
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## Anti-Patterns
|
|
494
|
+
|
|
495
|
+
1. **Aggressive rewriting without explanation**: "I condensed it" is not a reason
|
|
496
|
+
2. **Deleting without documenting why**: Every deletion needs justification in the maintenance file
|
|
497
|
+
3. **Hitting line count targets at all costs**: 400 lines is a guideline, not a mandate
|
|
498
|
+
4. **Removing "patterns" or "best practices" sections**: These are high-value content
|
|
499
|
+
5. **Deleting everything the audit finds**: Review each item individually
|
|
500
|
+
6. **Skipping validation**: "It looked dead/obsolete" is not validation
|
|
501
|
+
7. **Using `rm` instead of `git rm`**: Lose history
|
|
502
|
+
8. **Making changes the architect can't review**: Big deletions need clear explanations
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Maintenance Run NNNN
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- **Date**: YYYY-MM-DD
|
|
5
|
+
- **Base Commit**: (commit hash at start)
|
|
6
|
+
- **PR**: #NNN
|
|
7
|
+
- **Scope**: full | code-only | docs-only
|
|
8
|
+
|
|
9
|
+
## Changes Since Last Run
|
|
10
|
+
|
|
11
|
+
<!-- Auto-generated summary of commits since last maintenance -->
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
git log --oneline <last-maint-commit>..HEAD
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Tasks Completed
|
|
18
|
+
|
|
19
|
+
### Code Hygiene
|
|
20
|
+
- [ ] Dead code removal
|
|
21
|
+
- [ ] Unused dependencies
|
|
22
|
+
- [ ] Dependency updates
|
|
23
|
+
- [ ] Test maintenance
|
|
24
|
+
|
|
25
|
+
### Documentation
|
|
26
|
+
- [ ] arch.md sync
|
|
27
|
+
- [ ] lessons-learned.md generation
|
|
28
|
+
- [ ] CLAUDE.md / AGENTS.md sync
|
|
29
|
+
- [ ] Documentation pruning (obsolete content, size limits)
|
|
30
|
+
|
|
31
|
+
### Framework
|
|
32
|
+
- [ ] codev update
|
|
33
|
+
- [ ] projectlist.md status updates
|
|
34
|
+
|
|
35
|
+
## Findings
|
|
36
|
+
|
|
37
|
+
<!-- Notable discoveries during maintenance -->
|
|
38
|
+
|
|
39
|
+
## Documentation Changes
|
|
40
|
+
|
|
41
|
+
<!-- REQUIRED: Log all documentation deletions/moves with justification -->
|
|
42
|
+
|
|
43
|
+
### arch.md
|
|
44
|
+
| Section | Action | Reason |
|
|
45
|
+
|---------|--------|--------|
|
|
46
|
+
| (example) | KEPT/MOVED/DELETED | (justification) |
|
|
47
|
+
|
|
48
|
+
### CLAUDE.md
|
|
49
|
+
| Section | Action | Reason |
|
|
50
|
+
|---------|--------|--------|
|
|
51
|
+
| (example) | KEPT/MOVED/DELETED | (justification) |
|
|
52
|
+
|
|
53
|
+
### README.md
|
|
54
|
+
| Section | Action | Reason |
|
|
55
|
+
|---------|--------|--------|
|
|
56
|
+
| (example) | KEPT/MOVED/DELETED | (justification) |
|
|
57
|
+
|
|
58
|
+
## Deferred
|
|
59
|
+
|
|
60
|
+
<!-- Items discovered but deferred to next run, with reason -->
|
|
61
|
+
|
|
62
|
+
## Summary
|
|
63
|
+
|
|
64
|
+
<!-- Brief summary of what was accomplished -->
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# SPIDER Protocol
|
|
2
2
|
|
|
3
|
+
> **Quick Reference**: See `codev/resources/workflow-reference.md` for stage diagrams and common commands.
|
|
4
|
+
|
|
3
5
|
## Prerequisites
|
|
4
6
|
|
|
5
7
|
**Required for Multi-Agent Consultation**:
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- Option 1: "Would you like help installing Zen MCP server?"
|
|
10
|
-
- Option 2: "Use spider-solo protocol instead (no multi-agent consultation)"
|
|
8
|
+
- The `consult` CLI must be available (installed with `npm install -g @cluesmith/codev`)
|
|
9
|
+
- At least one consultation backend: `claude`, `gemini-cli`, or `codex`
|
|
10
|
+
- Check with: `codev doctor` or `consult --help`
|
|
11
11
|
|
|
12
12
|
## Protocol Configuration
|
|
13
13
|
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
Multi-agent consultation is **ENABLED BY DEFAULT** when using SPIDER protocol.
|
|
18
18
|
|
|
19
19
|
**DEFAULT AGENTS:**
|
|
20
|
-
- **GPT-5**: Primary reviewer for architecture, feasibility, and code quality
|
|
20
|
+
- **GPT-5 Codex**: Primary reviewer for architecture, feasibility, and code quality
|
|
21
21
|
- **Gemini Pro**: Secondary reviewer for completeness, edge cases, and alternative approaches
|
|
22
22
|
|
|
23
23
|
**DISABLING CONSULTATION:**
|
|
24
|
-
|
|
24
|
+
To run SPIDER without consultation, say "without consultation" when starting work.
|
|
25
25
|
|
|
26
26
|
**CUSTOM AGENTS:**
|
|
27
27
|
The user can specify different agents by saying: "use SPIDER with consultation from [agent1] and [agent2]"
|
|
@@ -490,8 +490,8 @@ Execute for each phase in the plan. This is a strict cycle that must be complete
|
|
|
490
490
|
- Enhance documentation
|
|
491
491
|
|
|
492
492
|
3. **Update Architecture Documentation**
|
|
493
|
-
-
|
|
494
|
-
-
|
|
493
|
+
- Update `codev/resources/arch.md` with new modules, utilities, or architectural changes
|
|
494
|
+
- Follow guidance in MAINTAIN protocol's "Update arch.md" task for structure and standards
|
|
495
495
|
- Ensure arch.md reflects current codebase state
|
|
496
496
|
|
|
497
497
|
4. **Revision Requirements** (MANDATORY)
|
|
@@ -166,4 +166,25 @@ Phase 1 ──→ Phase 2 ──→ Phase 3
|
|
|
166
166
|
| [Date] | [What changed] | [Why] | [Who] |
|
|
167
167
|
|
|
168
168
|
## Notes
|
|
169
|
-
[Additional context, assumptions, or considerations]
|
|
169
|
+
[Additional context, assumptions, or considerations]
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Amendment History
|
|
174
|
+
|
|
175
|
+
This section tracks all TICK amendments to this plan. TICKs modify both the spec and plan together as an atomic unit.
|
|
176
|
+
|
|
177
|
+
<!-- When adding a TICK amendment, add a new entry below this line in chronological order -->
|
|
178
|
+
|
|
179
|
+
<!--
|
|
180
|
+
### TICK-001: [Amendment Title] (YYYY-MM-DD)
|
|
181
|
+
|
|
182
|
+
**Changes**:
|
|
183
|
+
- [Phase added]: [Description of new phase]
|
|
184
|
+
- [Phase modified]: [What was updated]
|
|
185
|
+
- [Implementation steps]: [New steps added]
|
|
186
|
+
|
|
187
|
+
**Review**: See `reviews/####-name-tick-001.md`
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
-->
|
|
@@ -137,4 +137,33 @@ Note: All consultation feedback has been incorporated directly into the relevant
|
|
|
137
137
|
- [ ] Expert AI Consultation Complete
|
|
138
138
|
|
|
139
139
|
## Notes
|
|
140
|
-
[Any additional context or considerations not covered above]
|
|
140
|
+
[Any additional context or considerations not covered above]
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Amendments
|
|
145
|
+
|
|
146
|
+
This section tracks all TICK amendments to this specification. TICKs are lightweight changes that refine an existing spec rather than creating a new one.
|
|
147
|
+
|
|
148
|
+
<!-- When adding a TICK amendment, add a new entry below this line in chronological order -->
|
|
149
|
+
|
|
150
|
+
<!--
|
|
151
|
+
### TICK-001: [Amendment Title] (YYYY-MM-DD)
|
|
152
|
+
|
|
153
|
+
**Summary**: [One-line description of what changed]
|
|
154
|
+
|
|
155
|
+
**Problem Addressed**:
|
|
156
|
+
[Why this amendment was needed - what gap or issue in the original spec]
|
|
157
|
+
|
|
158
|
+
**Spec Changes**:
|
|
159
|
+
- [Section modified]: [What changed and why]
|
|
160
|
+
- [New section added]: [Purpose]
|
|
161
|
+
|
|
162
|
+
**Plan Changes**:
|
|
163
|
+
- [Phase added/modified]: [Description]
|
|
164
|
+
- [Implementation steps]: [What was updated]
|
|
165
|
+
|
|
166
|
+
**Review**: See `reviews/####-name-tick-001.md`
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
-->
|