codecruise 0.1.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/LICENSE +21 -0
- package/README.md +111 -0
- package/bin/codecruise.js +68 -0
- package/config/CLAUDE.md +107 -0
- package/config/agents/analyst.md +48 -0
- package/config/agents/architect-reviewer.md +161 -0
- package/config/agents/architect.md +119 -0
- package/config/agents/critic.md +63 -0
- package/config/agents/developer.md +96 -0
- package/config/agents/devops.md +81 -0
- package/config/agents/orchestrator.md +91 -0
- package/config/agents/planner.md +139 -0
- package/config/agents/retro.md +52 -0
- package/config/agents/reviewer.md +101 -0
- package/config/agents/security-reviewer.md +57 -0
- package/config/agents/stack/expo/AGENT.md +473 -0
- package/config/agents/stack/expo/rules/critical.md +427 -0
- package/config/agents/stack/expo/rules/native.md +455 -0
- package/config/agents/stack/expo/rules/navigation.md +445 -0
- package/config/agents/stack/expo/rules/performance.md +415 -0
- package/config/agents/stack/fastify/AGENT.md +397 -0
- package/config/agents/stack/fastify/rules/api-design.md +283 -0
- package/config/agents/stack/fastify/rules/critical.md +232 -0
- package/config/agents/stack/fastify/rules/queues.md +303 -0
- package/config/agents/stack/fastify/rules/security.md +384 -0
- package/config/agents/stack/index.yaml +48 -0
- package/config/agents/stack/nextjs/AGENT.md +421 -0
- package/config/agents/stack/nextjs/rules/components.md +413 -0
- package/config/agents/stack/nextjs/rules/critical.md +391 -0
- package/config/agents/stack/nextjs/rules/performance.md +403 -0
- package/config/agents/stack/nextjs/rules/styling.md +334 -0
- package/config/agents/stack/shared-ts/AGENT.md +384 -0
- package/config/agents/stack/shared-ts/rules/critical.md +315 -0
- package/config/agents/stack/shared-ts/rules/patterns.md +384 -0
- package/config/agents/stack/shared-ts/rules/zod.md +427 -0
- package/config/agents/tester.md +79 -0
- package/config/commands/architect-discuss.md +366 -0
- package/config/commands/architect-list.md +160 -0
- package/config/commands/architect-review.md +111 -0
- package/config/commands/architect.md +118 -0
- package/config/commands/compact.md +118 -0
- package/config/commands/companion.md +279 -0
- package/config/commands/dashboard.md +152 -0
- package/config/commands/doctor.md +227 -0
- package/config/commands/dogfood-report.md +101 -0
- package/config/commands/flags/run-autonomous.md +110 -0
- package/config/commands/flags/run-pause.md +80 -0
- package/config/commands/ingest.md +173 -0
- package/config/commands/init.md +128 -0
- package/config/commands/metrics.md +87 -0
- package/config/commands/parallel.md +320 -0
- package/config/commands/pause.md +55 -0
- package/config/commands/plan-review.md +130 -0
- package/config/commands/plan.md +216 -0
- package/config/commands/production-check.md +308 -0
- package/config/commands/refine.md +323 -0
- package/config/commands/resume.md +72 -0
- package/config/commands/retro.md +121 -0
- package/config/commands/retry.md +75 -0
- package/config/commands/role.md +310 -0
- package/config/commands/run.md +417 -0
- package/config/commands/scope.md +85 -0
- package/config/commands/setup-permissions.md +104 -0
- package/config/commands/skip.md +75 -0
- package/config/commands/spec-forge.md +213 -0
- package/config/commands/spec-help.md +194 -0
- package/config/commands/spec-patch.md +342 -0
- package/config/commands/spec-resolve.md +110 -0
- package/config/commands/spec-review.md +153 -0
- package/config/commands/status.md +114 -0
- package/config/commands/sync.md +131 -0
- package/config/commands/task.md +138 -0
- package/config/commands/verify.md +124 -0
- package/config/hooks/README.md +632 -0
- package/config/hooks/activity-log.sh +187 -0
- package/config/hooks/anti-rationalize.sh +52 -0
- package/config/hooks/capture-verification.sh +112 -0
- package/config/hooks/collect-metrics.sh +135 -0
- package/config/hooks/enforce-file-scope.sh +75 -0
- package/config/hooks/enforce-state-machine.sh +161 -0
- package/config/hooks/enforce-tdd.sh +180 -0
- package/config/hooks/format.sh +40 -0
- package/config/hooks/lib/activity-helpers.sh +162 -0
- package/config/hooks/lib/read-settings.sh +71 -0
- package/config/hooks/load-context-skills.sh +95 -0
- package/config/hooks/notify.sh +81 -0
- package/config/hooks/pre-commit.sample +35 -0
- package/config/hooks/protect-files.sh +63 -0
- package/config/hooks/track-agents.sh +41 -0
- package/config/hooks/track-commands.sh +37 -0
- package/config/hooks/track-enforcement.sh +44 -0
- package/config/hooks/track-ooda.sh +77 -0
- package/config/hooks/validate-commit-msg.sh +35 -0
- package/config/hooks/validate-plan.sh +213 -0
- package/config/hooks/verify-criteria.sh +46 -0
- package/config/hooks/verify-todo-completion.sh +140 -0
- package/config/rules/comments.md +25 -0
- package/config/rules/decision-rules.md +308 -0
- package/config/rules/hygiene.md +247 -0
- package/config/rules/pattern-detection.md +372 -0
- package/config/rules/profiles.md +193 -0
- package/config/rules/recovery.md +83 -0
- package/config/rules/scope-detection.md +213 -0
- package/config/rules/standards.md +127 -0
- package/config/rules/workflow.md +121 -0
- package/config/schemas.md +767 -0
- package/config/settings.json +195 -0
- package/config/skills/backend/SKILL.md +734 -0
- package/config/skills/database/SKILL.md +426 -0
- package/config/skills/frontend/SKILL.md +434 -0
- package/config/skills/git/SKILL.md +396 -0
- package/config/skills/index.yaml +36 -0
- package/config/skills/observability/SKILL.md +430 -0
- package/config/skills/package-dev/SKILL.md +498 -0
- package/config/skills/performance/SKILL.md +378 -0
- package/config/skills/resilience/SKILL.md +573 -0
- package/config/skills/testing/SKILL.md +398 -0
- package/config/skills/testing-patterns/SKILL.md +276 -0
- package/config/skills/typescript/SKILL.md +152 -0
- package/config/templates/CLAUDE.md +70 -0
- package/config/templates/README.md +117 -0
- package/config/templates/steering/adr-template.md +102 -0
- package/config/templates/steering/product.md +60 -0
- package/config/templates/steering/rfc-template.md +159 -0
- package/config/templates/steering/structure.md +146 -0
- package/config/templates/steering/tech.md +85 -0
- package/package.json +40 -0
- package/src/install.js +163 -0
- package/src/report.js +310 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Decision Rules
|
|
2
|
+
|
|
3
|
+
Rules that determine what happens after a TODO is executed and scored.
|
|
4
|
+
|
|
5
|
+
## Decision Flow
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
TODO Executed
|
|
9
|
+
↓
|
|
10
|
+
Verification (hooks capture real output)
|
|
11
|
+
↓
|
|
12
|
+
Scorecard Generated
|
|
13
|
+
↓
|
|
14
|
+
Decision Rules Applied
|
|
15
|
+
↓
|
|
16
|
+
Action: proceed | proceed_with_comment | retry | flag_for_human
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Score Calculation
|
|
20
|
+
|
|
21
|
+
### Component Scores (0.0 - 1.0)
|
|
22
|
+
|
|
23
|
+
**Quality Score:**
|
|
24
|
+
```
|
|
25
|
+
quality = 1.0
|
|
26
|
+
quality -= 0.3 if lint.exit_code != 0
|
|
27
|
+
quality -= 0.2 if typecheck.exit_code != 0
|
|
28
|
+
quality -= 0.4 if tests.exit_code != 0
|
|
29
|
+
quality -= 0.1 if tests.failed > 0
|
|
30
|
+
quality -= 0.05 * lint.errors (capped at 0.2)
|
|
31
|
+
quality = max(0, quality)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Alignment Score:**
|
|
35
|
+
```
|
|
36
|
+
alignment = criteria_met / criteria_total
|
|
37
|
+
alignment -= 0.1 * len(unexpected_files) (capped at 0.3)
|
|
38
|
+
alignment = max(0, alignment)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Guardrails Score:**
|
|
42
|
+
```
|
|
43
|
+
guardrails = 1.0
|
|
44
|
+
guardrails = 0.0 if no_secrets violated
|
|
45
|
+
guardrails -= 0.5 if no_new_deps violated (when set to block)
|
|
46
|
+
guardrails -= 0.2 if atomic_commit violated
|
|
47
|
+
guardrails = max(0, guardrails)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Overall Score
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
overall = (quality * 0.4) + (alignment * 0.4) + (guardrails * 0.2)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Weight rationale:**
|
|
57
|
+
- Quality (40%): Tests and lint are critical
|
|
58
|
+
- Alignment (40%): Doing what was asked matters equally
|
|
59
|
+
- Guardrails (20%): Important but binary checks
|
|
60
|
+
|
|
61
|
+
## Decision Rules
|
|
62
|
+
|
|
63
|
+
### Rule 1: Proceed
|
|
64
|
+
|
|
65
|
+
**Condition:**
|
|
66
|
+
```
|
|
67
|
+
overall >= profile.quality_threshold
|
|
68
|
+
AND guardrails.no_secrets == true
|
|
69
|
+
AND attempt <= profile.max_retries
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Action:**
|
|
73
|
+
- Mark TODO as `done`
|
|
74
|
+
- Commit changes
|
|
75
|
+
- Update progress.yaml
|
|
76
|
+
- Move to next TODO
|
|
77
|
+
|
|
78
|
+
**Output:**
|
|
79
|
+
```
|
|
80
|
+
✓ todo-1.1b-004 | 3m24s | 1 attempt | abc1234
|
|
81
|
+
[████████████░░░░░░░░] 57% feature-1.1 (8/14) | quality: 0.91
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Rule 2: Proceed with Comment
|
|
85
|
+
|
|
86
|
+
**Condition:**
|
|
87
|
+
```
|
|
88
|
+
overall >= (profile.quality_threshold - 0.1)
|
|
89
|
+
AND overall < profile.quality_threshold
|
|
90
|
+
AND guardrails.no_secrets == true
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Action:**
|
|
94
|
+
- Mark TODO as `done` with flag
|
|
95
|
+
- Commit changes with note
|
|
96
|
+
- Add to review list
|
|
97
|
+
- Move to next TODO
|
|
98
|
+
|
|
99
|
+
**Output:**
|
|
100
|
+
```
|
|
101
|
+
⚠ todo-1.1b-004 | 3m24s | 1 attempt | abc1234
|
|
102
|
+
quality: 0.78 (below 0.85 threshold)
|
|
103
|
+
flagged: alignment score low - unexpected file touched
|
|
104
|
+
[████████████░░░░░░░░] 57% feature-1.1 (8/14)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Rule 3: Retry
|
|
108
|
+
|
|
109
|
+
**Condition:**
|
|
110
|
+
```
|
|
111
|
+
overall < (profile.quality_threshold - 0.1)
|
|
112
|
+
AND attempt < profile.max_retries
|
|
113
|
+
AND guardrails.no_secrets == true
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Action:**
|
|
117
|
+
- Increment attempt counter
|
|
118
|
+
- Analyze failure reason
|
|
119
|
+
- Retry with context about what failed
|
|
120
|
+
|
|
121
|
+
**Output:**
|
|
122
|
+
```
|
|
123
|
+
↻ todo-1.1b-004 | attempt 2/3
|
|
124
|
+
reason: tests failing (3/47 failed)
|
|
125
|
+
retrying with fix context...
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Rule 4: Flag for Human
|
|
129
|
+
|
|
130
|
+
**Condition:**
|
|
131
|
+
```
|
|
132
|
+
attempt >= profile.max_retries
|
|
133
|
+
OR guardrails.no_secrets == false
|
|
134
|
+
OR user requested manual intervention
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Action:**
|
|
138
|
+
- Pause execution
|
|
139
|
+
- Present options to user
|
|
140
|
+
- Wait for input
|
|
141
|
+
|
|
142
|
+
**Output:**
|
|
143
|
+
```
|
|
144
|
+
✗ todo-1.2a-005 failed (3/3 attempts)
|
|
145
|
+
|
|
146
|
+
Last attempt:
|
|
147
|
+
quality: 0.45 | alignment: 0.70 | guardrails: 1.0
|
|
148
|
+
tests: 12 passed, 5 failed
|
|
149
|
+
lint: 3 errors
|
|
150
|
+
|
|
151
|
+
[r]etry - Try one more time
|
|
152
|
+
[s]kip - Mark as skipped, continue
|
|
153
|
+
[f]ix - I'll fix manually, then continue
|
|
154
|
+
[a]bort - Stop execution, save state
|
|
155
|
+
[d]etails - Show full error output
|
|
156
|
+
|
|
157
|
+
Choice: _
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Special Rules
|
|
161
|
+
|
|
162
|
+
### Secrets Detected (Immediate Block)
|
|
163
|
+
|
|
164
|
+
**Condition:** `guardrails.no_secrets == false`
|
|
165
|
+
|
|
166
|
+
**Action:**
|
|
167
|
+
- NEVER commit
|
|
168
|
+
- NEVER proceed
|
|
169
|
+
- Immediately flag
|
|
170
|
+
|
|
171
|
+
**Output:**
|
|
172
|
+
```
|
|
173
|
+
🚫 BLOCKED: Potential secret detected
|
|
174
|
+
|
|
175
|
+
File: src/config.ts
|
|
176
|
+
Line 23: const API_KEY = "sk-live-..."
|
|
177
|
+
|
|
178
|
+
This looks like a production API key.
|
|
179
|
+
|
|
180
|
+
Options:
|
|
181
|
+
[1] Remove secret and retry
|
|
182
|
+
[2] Add to .gitignore
|
|
183
|
+
[3] It's not a secret (override)
|
|
184
|
+
|
|
185
|
+
Choice: _
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Coverage Drop (Careful profile only)
|
|
189
|
+
|
|
190
|
+
**Condition:**
|
|
191
|
+
```
|
|
192
|
+
profile == careful
|
|
193
|
+
AND coverage_delta < -5%
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Action:**
|
|
197
|
+
- Block commit
|
|
198
|
+
- Require tests to be added
|
|
199
|
+
|
|
200
|
+
**Output:**
|
|
201
|
+
```
|
|
202
|
+
⚠ Coverage dropped from 85% to 78%
|
|
203
|
+
|
|
204
|
+
Profile 'careful' requires maintaining coverage.
|
|
205
|
+
|
|
206
|
+
Options:
|
|
207
|
+
[1] Add more tests (recommended)
|
|
208
|
+
[2] Accept coverage drop (override)
|
|
209
|
+
|
|
210
|
+
Choice: _
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### New Dependency Detected
|
|
214
|
+
|
|
215
|
+
**When `no_new_deps: ask`:**
|
|
216
|
+
```
|
|
217
|
+
📦 New dependency detected: zod@3.22.0
|
|
218
|
+
|
|
219
|
+
This TODO added a new package.
|
|
220
|
+
|
|
221
|
+
[y] Approve and continue
|
|
222
|
+
[n] Remove and retry
|
|
223
|
+
[?] Why is this needed?
|
|
224
|
+
|
|
225
|
+
Choice: _
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**When `no_new_deps: block`:**
|
|
229
|
+
```
|
|
230
|
+
🚫 New dependency blocked: zod@3.22.0
|
|
231
|
+
|
|
232
|
+
Profile 'careful' blocks new dependencies.
|
|
233
|
+
|
|
234
|
+
Options:
|
|
235
|
+
[1] Override for this TODO
|
|
236
|
+
[2] Retry without new dependency
|
|
237
|
+
|
|
238
|
+
Choice: _
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Error Analysis
|
|
242
|
+
|
|
243
|
+
When retry is triggered, analyze the failure:
|
|
244
|
+
|
|
245
|
+
### Test Failures
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
Analyzing test failures...
|
|
249
|
+
|
|
250
|
+
FAIL src/auth/login.test.ts
|
|
251
|
+
✗ should return 401 for invalid password
|
|
252
|
+
Expected: 401
|
|
253
|
+
Received: 500
|
|
254
|
+
|
|
255
|
+
Likely cause: Error handling not implemented
|
|
256
|
+
Suggestion: Add try/catch in login handler
|
|
257
|
+
|
|
258
|
+
Retrying with this context...
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Lint Errors
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
Analyzing lint errors...
|
|
265
|
+
|
|
266
|
+
error: 'user' is defined but never used (@typescript-eslint/no-unused-vars)
|
|
267
|
+
error: Missing return type on function (@typescript-eslint/explicit-function-return-type)
|
|
268
|
+
|
|
269
|
+
Retrying with fixes...
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### TypeScript Errors
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
Analyzing TypeScript errors...
|
|
276
|
+
|
|
277
|
+
error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'
|
|
278
|
+
src/utils/calc.ts:15:23
|
|
279
|
+
|
|
280
|
+
Likely cause: Type mismatch in function call
|
|
281
|
+
|
|
282
|
+
Retrying with type fix...
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Profile-Specific Behavior
|
|
286
|
+
|
|
287
|
+
| Rule | ship-fast | balanced | careful |
|
|
288
|
+
|------|-----------|----------|---------|
|
|
289
|
+
| Proceed threshold | 0.70 | 0.85 | 0.95 |
|
|
290
|
+
| Proceed with comment | 0.60-0.70 | 0.75-0.85 | 0.85-0.95 |
|
|
291
|
+
| Retry threshold | <0.60 | <0.75 | <0.85 |
|
|
292
|
+
| Max retries | 2 | 3 | 3 |
|
|
293
|
+
| Default on_error | skip | ask | ask |
|
|
294
|
+
| Coverage required | No | No | Yes (80%) |
|
|
295
|
+
|
|
296
|
+
## Integration
|
|
297
|
+
|
|
298
|
+
These rules are applied in the SCORE phase of the execution loop:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
1. TODO executed (code written)
|
|
302
|
+
2. VERIFY phase (hooks capture output)
|
|
303
|
+
3. Read .codecruise/verification/summary.json
|
|
304
|
+
4. Calculate scores
|
|
305
|
+
5. Apply decision rules (this file)
|
|
306
|
+
6. Take action (proceed/retry/flag)
|
|
307
|
+
7. Update scorecard and progress.yaml
|
|
308
|
+
```
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Code Hygiene & Cost Efficiency
|
|
2
|
+
|
|
3
|
+
## Model Selection
|
|
4
|
+
|
|
5
|
+
| Task | Model | Reason |
|
|
6
|
+
|------|-------|--------|
|
|
7
|
+
| `/status`, `/verify` | Haiku | Quick lookups |
|
|
8
|
+
| `/task`, `/compact`, `/dashboard`, `/init` | Sonnet | Scoped implementation |
|
|
9
|
+
| `/plan`, code review, planner agent, reviewer agent | Opus | Complex reasoning |
|
|
10
|
+
| Explore subagent | Haiku | Fast research |
|
|
11
|
+
| Mixed planning + execution | `opusplan` | Auto-switches (see below) |
|
|
12
|
+
|
|
13
|
+
### The `opusplan` Model Alias
|
|
14
|
+
|
|
15
|
+
Use `model: opusplan` for automatic switching:
|
|
16
|
+
|
|
17
|
+
- **Plan mode active** → Uses Opus (complex reasoning)
|
|
18
|
+
- **Execution mode** → Uses Sonnet (cost-effective)
|
|
19
|
+
|
|
20
|
+
This is ideal for commands that do both planning and implementation.
|
|
21
|
+
|
|
22
|
+
### Use Sonnet For
|
|
23
|
+
|
|
24
|
+
- Scoped, well-defined tasks
|
|
25
|
+
- Code generation with clear specs
|
|
26
|
+
- File edits with specific instructions
|
|
27
|
+
- Test writing
|
|
28
|
+
- Documentation
|
|
29
|
+
|
|
30
|
+
### Use Opus For
|
|
31
|
+
|
|
32
|
+
- Complex reasoning across multiple files
|
|
33
|
+
- Architectural decisions
|
|
34
|
+
- Debugging subtle issues
|
|
35
|
+
- Code review requiring deep analysis
|
|
36
|
+
|
|
37
|
+
### Use Haiku For
|
|
38
|
+
|
|
39
|
+
- Quick lookups (Explore subagent)
|
|
40
|
+
- Simple transformations
|
|
41
|
+
- Validation checks
|
|
42
|
+
|
|
43
|
+
## MCP Management
|
|
44
|
+
|
|
45
|
+
Context window protection is critical. Too many MCPs drain available context.
|
|
46
|
+
|
|
47
|
+
### Limits
|
|
48
|
+
|
|
49
|
+
- Configure: 20-30 MCPs total
|
|
50
|
+
- Enable: <10 per project
|
|
51
|
+
- Active tools: <80
|
|
52
|
+
|
|
53
|
+
### Per-Project Configuration
|
|
54
|
+
|
|
55
|
+
Use `disabledMcpServers` in project `.claude/settings.json`:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"disabledMcpServers": [
|
|
60
|
+
"mcp-that-isnt-needed-for-this-project"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Signs of MCP Overload
|
|
66
|
+
|
|
67
|
+
- Claude forgetting recent context
|
|
68
|
+
- Repeated questions about things already discussed
|
|
69
|
+
- Slower responses
|
|
70
|
+
- "Context limit" warnings
|
|
71
|
+
|
|
72
|
+
### Fix
|
|
73
|
+
|
|
74
|
+
1. Check enabled MCPs in settings
|
|
75
|
+
2. Disable unused ones for current project
|
|
76
|
+
3. Restart Claude Code after config changes
|
|
77
|
+
|
|
78
|
+
## Context Management
|
|
79
|
+
|
|
80
|
+
### Signs to Compact
|
|
81
|
+
|
|
82
|
+
- 15+ exchanges in conversation
|
|
83
|
+
- TODO completed
|
|
84
|
+
- Switching to different feature
|
|
85
|
+
- Context feels "fuzzy"
|
|
86
|
+
|
|
87
|
+
### Before Compacting
|
|
88
|
+
|
|
89
|
+
- Verify state persisted to files
|
|
90
|
+
- Confirm `progress.yaml` updated
|
|
91
|
+
- Commit any pending changes
|
|
92
|
+
- Note next task in compact summary
|
|
93
|
+
|
|
94
|
+
### Keep Context Lean
|
|
95
|
+
|
|
96
|
+
- Use Explore subagent for research
|
|
97
|
+
- Summarize findings, don't paste raw content
|
|
98
|
+
- Reference files by path, don't include full contents
|
|
99
|
+
- Delete outdated context
|
|
100
|
+
|
|
101
|
+
## Response Style
|
|
102
|
+
|
|
103
|
+
### Short Responses
|
|
104
|
+
|
|
105
|
+
- Checklists over paragraphs
|
|
106
|
+
- Diffs over full file contents
|
|
107
|
+
- Tables for comparisons
|
|
108
|
+
- Code blocks with highlights
|
|
109
|
+
|
|
110
|
+
### Structured Output
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
✓ TODO-003 complete
|
|
114
|
+
|
|
115
|
+
Files modified:
|
|
116
|
+
- src/auth/login.ts (added validation)
|
|
117
|
+
- tests/auth/login.test.ts (3 tests)
|
|
118
|
+
|
|
119
|
+
Quality: ✓ PASS
|
|
120
|
+
Next: TODO-004 (session management)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Git Hygiene
|
|
124
|
+
|
|
125
|
+
### Git Attribution
|
|
126
|
+
|
|
127
|
+
Never include in commit messages, PR titles, or descriptions:
|
|
128
|
+
|
|
129
|
+
- "Claude", "AI", "Anthropic", "GPT", "LLM", "Copilot"
|
|
130
|
+
- "Generated by", "Co-authored by AI", "AI-assisted"
|
|
131
|
+
- Any AI tool attribution or signatures
|
|
132
|
+
|
|
133
|
+
Write as if the human authored everything.
|
|
134
|
+
|
|
135
|
+
### Commit Messages
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
type(scope): description
|
|
139
|
+
|
|
140
|
+
body (optional - explain WHY, not WHAT)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
|
|
144
|
+
Scope: feature or component name
|
|
145
|
+
Description: imperative, lowercase, no period, max 50 chars
|
|
146
|
+
|
|
147
|
+
### PR Titles
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
type(scope): description
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Same format as commits. Examples:
|
|
154
|
+
|
|
155
|
+
- `feat(auth): add password reset flow`
|
|
156
|
+
- `fix(cart): resolve quantity update bug`
|
|
157
|
+
|
|
158
|
+
### PR Descriptions
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
## Summary
|
|
162
|
+
Brief description of what this PR does (2-3 sentences max).
|
|
163
|
+
|
|
164
|
+
## Changes
|
|
165
|
+
- Bullet list of key changes
|
|
166
|
+
- Focus on WHAT changed, not HOW
|
|
167
|
+
|
|
168
|
+
## Testing
|
|
169
|
+
- How to test these changes
|
|
170
|
+
- Any edge cases to verify
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### PR Rules
|
|
174
|
+
|
|
175
|
+
- No AI attribution (see Git Attribution above)
|
|
176
|
+
- No emojis in titles or commits
|
|
177
|
+
- Link issues: `Closes #123` or `Fixes #123`
|
|
178
|
+
|
|
179
|
+
### Atomic Commits
|
|
180
|
+
|
|
181
|
+
- One logical change per commit
|
|
182
|
+
- Tests with implementation
|
|
183
|
+
- Don't mix refactoring with features
|
|
184
|
+
|
|
185
|
+
### Branch Hygiene
|
|
186
|
+
|
|
187
|
+
- Delete merged branches
|
|
188
|
+
- Rebase feature branches on main
|
|
189
|
+
- Squash WIP commits before merge
|
|
190
|
+
|
|
191
|
+
## File Hygiene
|
|
192
|
+
|
|
193
|
+
### Don't Commit
|
|
194
|
+
|
|
195
|
+
- `node_modules/`
|
|
196
|
+
- `.env` files (use `.env.example`)
|
|
197
|
+
- Build outputs (`dist/`, `.next/`)
|
|
198
|
+
- IDE settings (unless shared)
|
|
199
|
+
- OS files (`.DS_Store`)
|
|
200
|
+
|
|
201
|
+
### Keep Clean
|
|
202
|
+
|
|
203
|
+
- Remove unused imports
|
|
204
|
+
- Delete dead code
|
|
205
|
+
- Update stale comments
|
|
206
|
+
- Remove console.logs
|
|
207
|
+
|
|
208
|
+
## Dependency Hygiene
|
|
209
|
+
|
|
210
|
+
### Before Adding
|
|
211
|
+
|
|
212
|
+
- Check bundle size impact
|
|
213
|
+
- Review maintenance status
|
|
214
|
+
- Consider native alternatives
|
|
215
|
+
- Get approval for new deps
|
|
216
|
+
|
|
217
|
+
### Regular Maintenance
|
|
218
|
+
|
|
219
|
+
- Update patch versions
|
|
220
|
+
- Review security advisories
|
|
221
|
+
- Audit unused dependencies
|
|
222
|
+
- Lock versions in production
|
|
223
|
+
|
|
224
|
+
## Token Efficiency
|
|
225
|
+
|
|
226
|
+
### In Prompts
|
|
227
|
+
|
|
228
|
+
- Be specific about scope
|
|
229
|
+
- Provide relevant context only
|
|
230
|
+
- Use file paths, not full contents
|
|
231
|
+
- Reference previous work
|
|
232
|
+
|
|
233
|
+
### In Responses
|
|
234
|
+
|
|
235
|
+
- Answer directly
|
|
236
|
+
- Skip unnecessary preamble
|
|
237
|
+
- Use formatting for clarity
|
|
238
|
+
- Summarize long outputs
|
|
239
|
+
|
|
240
|
+
### Cost Optimization
|
|
241
|
+
|
|
242
|
+
1. **Use Explore subagent** for codebase research (preserves main context)
|
|
243
|
+
2. **Reference files by path**, don't paste full contents
|
|
244
|
+
3. **Summarize findings**, don't dump raw data
|
|
245
|
+
4. **Batch related questions** in one exchange
|
|
246
|
+
5. **Run /compact** after completing a TODO or 15+ exchanges
|
|
247
|
+
6. **Use Memory MCP** to persist context across sessions (avoids re-reading)
|