aicodeman 0.2.8
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 +403 -0
- package/dist/ai-checker-base.d.ts +175 -0
- package/dist/ai-checker-base.d.ts.map +1 -0
- package/dist/ai-checker-base.js +424 -0
- package/dist/ai-checker-base.js.map +1 -0
- package/dist/ai-idle-checker.d.ts +53 -0
- package/dist/ai-idle-checker.d.ts.map +1 -0
- package/dist/ai-idle-checker.js +141 -0
- package/dist/ai-idle-checker.js.map +1 -0
- package/dist/ai-plan-checker.d.ts +52 -0
- package/dist/ai-plan-checker.d.ts.map +1 -0
- package/dist/ai-plan-checker.js +103 -0
- package/dist/ai-plan-checker.js.map +1 -0
- package/dist/bash-tool-parser.d.ts +191 -0
- package/dist/bash-tool-parser.d.ts.map +1 -0
- package/dist/bash-tool-parser.js +598 -0
- package/dist/bash-tool-parser.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +460 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/buffer-limits.d.ts +59 -0
- package/dist/config/buffer-limits.d.ts.map +1 -0
- package/dist/config/buffer-limits.js +74 -0
- package/dist/config/buffer-limits.js.map +1 -0
- package/dist/config/map-limits.d.ts +40 -0
- package/dist/config/map-limits.d.ts.map +1 -0
- package/dist/config/map-limits.js +52 -0
- package/dist/config/map-limits.js.map +1 -0
- package/dist/file-stream-manager.d.ts +148 -0
- package/dist/file-stream-manager.d.ts.map +1 -0
- package/dist/file-stream-manager.js +351 -0
- package/dist/file-stream-manager.js.map +1 -0
- package/dist/hooks-config.d.ts +31 -0
- package/dist/hooks-config.d.ts.map +1 -0
- package/dist/hooks-config.js +115 -0
- package/dist/hooks-config.js.map +1 -0
- package/dist/image-watcher.d.ts +86 -0
- package/dist/image-watcher.d.ts.map +1 -0
- package/dist/image-watcher.js +275 -0
- package/dist/image-watcher.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/mux-factory.d.ts +13 -0
- package/dist/mux-factory.d.ts.map +1 -0
- package/dist/mux-factory.js +19 -0
- package/dist/mux-factory.js.map +1 -0
- package/dist/mux-interface.d.ts +145 -0
- package/dist/mux-interface.d.ts.map +1 -0
- package/dist/mux-interface.js +9 -0
- package/dist/mux-interface.js.map +1 -0
- package/dist/plan-orchestrator.d.ts +123 -0
- package/dist/plan-orchestrator.d.ts.map +1 -0
- package/dist/plan-orchestrator.js +500 -0
- package/dist/plan-orchestrator.js.map +1 -0
- package/dist/prompts/index.d.ts +9 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +9 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/planner.d.ts +14 -0
- package/dist/prompts/planner.d.ts.map +1 -0
- package/dist/prompts/planner.js +83 -0
- package/dist/prompts/planner.js.map +1 -0
- package/dist/prompts/research-agent.d.ts +10 -0
- package/dist/prompts/research-agent.d.ts.map +1 -0
- package/dist/prompts/research-agent.js +143 -0
- package/dist/prompts/research-agent.js.map +1 -0
- package/dist/push-store.d.ts +41 -0
- package/dist/push-store.d.ts.map +1 -0
- package/dist/push-store.js +168 -0
- package/dist/push-store.js.map +1 -0
- package/dist/ralph-config.d.ts +67 -0
- package/dist/ralph-config.d.ts.map +1 -0
- package/dist/ralph-config.js +134 -0
- package/dist/ralph-config.js.map +1 -0
- package/dist/ralph-loop.d.ts +124 -0
- package/dist/ralph-loop.d.ts.map +1 -0
- package/dist/ralph-loop.js +418 -0
- package/dist/ralph-loop.js.map +1 -0
- package/dist/ralph-tracker.d.ts +1081 -0
- package/dist/ralph-tracker.d.ts.map +1 -0
- package/dist/ralph-tracker.js +3343 -0
- package/dist/ralph-tracker.js.map +1 -0
- package/dist/respawn-controller.d.ts +1182 -0
- package/dist/respawn-controller.d.ts.map +1 -0
- package/dist/respawn-controller.js +2754 -0
- package/dist/respawn-controller.js.map +1 -0
- package/dist/run-summary.d.ts +123 -0
- package/dist/run-summary.d.ts.map +1 -0
- package/dist/run-summary.js +325 -0
- package/dist/run-summary.js.map +1 -0
- package/dist/session-lifecycle-log.d.ts +36 -0
- package/dist/session-lifecycle-log.d.ts.map +1 -0
- package/dist/session-lifecycle-log.js +101 -0
- package/dist/session-lifecycle-log.js.map +1 -0
- package/dist/session-manager.d.ts +97 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +224 -0
- package/dist/session-manager.js.map +1 -0
- package/dist/session.d.ts +686 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +2025 -0
- package/dist/session.js.map +1 -0
- package/dist/state-store.d.ts +189 -0
- package/dist/state-store.d.ts.map +1 -0
- package/dist/state-store.js +730 -0
- package/dist/state-store.js.map +1 -0
- package/dist/subagent-watcher.d.ts +345 -0
- package/dist/subagent-watcher.d.ts.map +1 -0
- package/dist/subagent-watcher.js +1469 -0
- package/dist/subagent-watcher.js.map +1 -0
- package/dist/task-queue.d.ts +108 -0
- package/dist/task-queue.d.ts.map +1 -0
- package/dist/task-queue.js +235 -0
- package/dist/task-queue.js.map +1 -0
- package/dist/task-tracker.d.ts +306 -0
- package/dist/task-tracker.d.ts.map +1 -0
- package/dist/task-tracker.js +488 -0
- package/dist/task-tracker.js.map +1 -0
- package/dist/task.d.ts +73 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +177 -0
- package/dist/task.js.map +1 -0
- package/dist/team-watcher.d.ts +53 -0
- package/dist/team-watcher.d.ts.map +1 -0
- package/dist/team-watcher.js +313 -0
- package/dist/team-watcher.js.map +1 -0
- package/dist/templates/case-template.md +461 -0
- package/dist/templates/claude-md.d.ts +26 -0
- package/dist/templates/claude-md.d.ts.map +1 -0
- package/dist/templates/claude-md.js +74 -0
- package/dist/templates/claude-md.js.map +1 -0
- package/dist/tmux-manager.d.ts +181 -0
- package/dist/tmux-manager.d.ts.map +1 -0
- package/dist/tmux-manager.js +1405 -0
- package/dist/tmux-manager.js.map +1 -0
- package/dist/transcript-watcher.d.ts +110 -0
- package/dist/transcript-watcher.d.ts.map +1 -0
- package/dist/transcript-watcher.js +338 -0
- package/dist/transcript-watcher.js.map +1 -0
- package/dist/tunnel-manager.d.ts +54 -0
- package/dist/tunnel-manager.d.ts.map +1 -0
- package/dist/tunnel-manager.js +251 -0
- package/dist/tunnel-manager.js.map +1 -0
- package/dist/types.d.ts +1139 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +215 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/buffer-accumulator.d.ts +111 -0
- package/dist/utils/buffer-accumulator.d.ts.map +1 -0
- package/dist/utils/buffer-accumulator.js +172 -0
- package/dist/utils/buffer-accumulator.js.map +1 -0
- package/dist/utils/claude-cli-resolver.d.ts +26 -0
- package/dist/utils/claude-cli-resolver.d.ts.map +1 -0
- package/dist/utils/claude-cli-resolver.js +78 -0
- package/dist/utils/claude-cli-resolver.js.map +1 -0
- package/dist/utils/cleanup-manager.d.ts +165 -0
- package/dist/utils/cleanup-manager.d.ts.map +1 -0
- package/dist/utils/cleanup-manager.js +274 -0
- package/dist/utils/cleanup-manager.js.map +1 -0
- package/dist/utils/index.d.ts +19 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/lru-map.d.ts +140 -0
- package/dist/utils/lru-map.d.ts.map +1 -0
- package/dist/utils/lru-map.js +234 -0
- package/dist/utils/lru-map.js.map +1 -0
- package/dist/utils/nice-wrapper.d.ts +13 -0
- package/dist/utils/nice-wrapper.d.ts.map +1 -0
- package/dist/utils/nice-wrapper.js +17 -0
- package/dist/utils/nice-wrapper.js.map +1 -0
- package/dist/utils/opencode-cli-resolver.d.ts +21 -0
- package/dist/utils/opencode-cli-resolver.d.ts.map +1 -0
- package/dist/utils/opencode-cli-resolver.js +67 -0
- package/dist/utils/opencode-cli-resolver.js.map +1 -0
- package/dist/utils/regex-patterns.d.ts +64 -0
- package/dist/utils/regex-patterns.d.ts.map +1 -0
- package/dist/utils/regex-patterns.js +74 -0
- package/dist/utils/regex-patterns.js.map +1 -0
- package/dist/utils/stale-expiration-map.d.ts +159 -0
- package/dist/utils/stale-expiration-map.d.ts.map +1 -0
- package/dist/utils/stale-expiration-map.js +277 -0
- package/dist/utils/stale-expiration-map.js.map +1 -0
- package/dist/utils/string-similarity.d.ts +108 -0
- package/dist/utils/string-similarity.d.ts.map +1 -0
- package/dist/utils/string-similarity.js +189 -0
- package/dist/utils/string-similarity.js.map +1 -0
- package/dist/utils/token-validation.d.ts +39 -0
- package/dist/utils/token-validation.d.ts.map +1 -0
- package/dist/utils/token-validation.js +59 -0
- package/dist/utils/token-validation.js.map +1 -0
- package/dist/utils/type-safety.d.ts +33 -0
- package/dist/utils/type-safety.d.ts.map +1 -0
- package/dist/utils/type-safety.js +35 -0
- package/dist/utils/type-safety.js.map +1 -0
- package/dist/web/public/app.js +491 -0
- package/dist/web/public/app.js.br +0 -0
- package/dist/web/public/app.js.gz +0 -0
- package/dist/web/public/index.html +1675 -0
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/manifest.json +8 -0
- package/dist/web/public/mobile.css +1 -0
- package/dist/web/public/mobile.css.br +0 -0
- package/dist/web/public/mobile.css.gz +0 -0
- package/dist/web/public/ralph-wizard.js +1037 -0
- package/dist/web/public/ralph-wizard.js.br +0 -0
- package/dist/web/public/ralph-wizard.js.gz +0 -0
- package/dist/web/public/styles.css +1 -0
- package/dist/web/public/styles.css.br +0 -0
- package/dist/web/public/styles.css.gz +0 -0
- package/dist/web/public/sw.js +67 -0
- package/dist/web/public/sw.js.br +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/upload.html +155 -0
- package/dist/web/public/upload.html.br +0 -0
- package/dist/web/public/upload.html.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js +1 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.br +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js +1 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.br +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js +2 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.br +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css +209 -0
- package/dist/web/public/vendor/xterm.css.br +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js +9 -0
- package/dist/web/public/vendor/xterm.min.js.br +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/schemas.d.ts +479 -0
- package/dist/web/schemas.d.ts.map +1 -0
- package/dist/web/schemas.js +448 -0
- package/dist/web/schemas.js.map +1 -0
- package/dist/web/server.d.ts +207 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +5784 -0
- package/dist/web/server.js.map +1 -0
- package/package.json +110 -0
- package/scripts/postinstall.js +390 -0
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
# CLAUDE.md - Project Configuration
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
Copy these files to your new project:
|
|
5
|
+
- `CLAUDE.md` → project root
|
|
6
|
+
- `.claude/settings.json` → `.claude/settings.json`
|
|
7
|
+
|
|
8
|
+
Then update the Project Overview section below.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Project Overview
|
|
13
|
+
<!-- Update this section with project-specific details -->
|
|
14
|
+
- **Project Name**: [PROJECT_NAME]
|
|
15
|
+
- **Description**: [PROJECT_DESCRIPTION]
|
|
16
|
+
- **Tech Stack**: [TECHNOLOGIES_USED]
|
|
17
|
+
- **Last Updated**: [DATE]
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Codeman Environment
|
|
22
|
+
|
|
23
|
+
This session is managed by **Codeman** and runs within a tmux session.
|
|
24
|
+
|
|
25
|
+
**Important**: Check for `CODEMAN_MUX=1` environment variable to confirm.
|
|
26
|
+
- Do NOT attempt to kill your own tmux session
|
|
27
|
+
- The session persists across disconnects - your work is safe
|
|
28
|
+
- Token usage, costs, and background tasks are tracked externally
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Work Principles
|
|
33
|
+
|
|
34
|
+
### Autonomy
|
|
35
|
+
Full permissions granted. Act decisively without asking - read, write, edit, execute freely.
|
|
36
|
+
|
|
37
|
+
### Git Discipline
|
|
38
|
+
- **Commit after every meaningful change** - never batch unrelated work
|
|
39
|
+
- Use conventional commits: `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`
|
|
40
|
+
- Commit message = what changed + why (not how)
|
|
41
|
+
|
|
42
|
+
### Documentation
|
|
43
|
+
- Update README.md when adding features or changing setup
|
|
44
|
+
- Update this file's session log after work sessions
|
|
45
|
+
- Keep docs in sync with code changes
|
|
46
|
+
|
|
47
|
+
### Thinking
|
|
48
|
+
Extended thinking is enabled. Use deep reasoning for complex architectural decisions, difficult bugs, and multi-file changes.
|
|
49
|
+
|
|
50
|
+
### Task Tracking (TodoWrite)
|
|
51
|
+
**ALWAYS use TodoWrite** to track tasks. This is non-negotiable for anything beyond trivial single-step work.
|
|
52
|
+
|
|
53
|
+
**When to use TodoWrite:**
|
|
54
|
+
- Multi-step tasks (3+ steps)
|
|
55
|
+
- Bug fixes requiring investigation
|
|
56
|
+
- Feature implementations
|
|
57
|
+
- Any work where progress tracking helps
|
|
58
|
+
- When the user provides multiple requests
|
|
59
|
+
|
|
60
|
+
**How to use it:**
|
|
61
|
+
1. **Before starting**: Break down the work into discrete todos
|
|
62
|
+
2. **During work**: Mark each todo `in_progress` before starting, `completed` when done
|
|
63
|
+
3. **One at a time**: Only ONE todo should be `in_progress` at any moment
|
|
64
|
+
4. **Immediately**: Mark todos complete the moment they're done - don't batch
|
|
65
|
+
|
|
66
|
+
**Why this matters:**
|
|
67
|
+
- Gives the user visibility into your progress
|
|
68
|
+
- Prevents forgetting tasks mid-work
|
|
69
|
+
- Creates accountability checkpoints
|
|
70
|
+
- Makes complex work manageable
|
|
71
|
+
|
|
72
|
+
**Example workflow:**
|
|
73
|
+
```
|
|
74
|
+
User: "Add user authentication with JWT"
|
|
75
|
+
|
|
76
|
+
→ TodoWrite:
|
|
77
|
+
- [ ] Research existing auth patterns in codebase
|
|
78
|
+
- [ ] Implement JWT token generation
|
|
79
|
+
- [ ] Add login endpoint
|
|
80
|
+
- [ ] Add token validation middleware
|
|
81
|
+
- [ ] Add protected route example
|
|
82
|
+
- [ ] Write tests
|
|
83
|
+
|
|
84
|
+
→ Mark "Research existing auth patterns" as in_progress
|
|
85
|
+
→ Do the research
|
|
86
|
+
→ Mark as completed, mark next as in_progress
|
|
87
|
+
→ Continue until all done
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Anti-patterns to avoid:**
|
|
91
|
+
- Starting work without creating todos first
|
|
92
|
+
- Having multiple todos `in_progress` simultaneously
|
|
93
|
+
- Batching completions at the end
|
|
94
|
+
- Skipping TodoWrite for "simple" multi-step tasks
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## When to Use Agents
|
|
99
|
+
|
|
100
|
+
**Explore agent**: Codebase investigation, finding files, understanding architecture
|
|
101
|
+
```
|
|
102
|
+
"Use explore agent to find all authentication-related code"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Parallel agents**: Independent tasks that don't conflict
|
|
106
|
+
```
|
|
107
|
+
"Research auth, database, and API modules in parallel using separate agents"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Background execution**: Long-running operations (tests, builds)
|
|
111
|
+
```
|
|
112
|
+
"Run the test suite in the background while I continue"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Sequential chaining**: When second task depends on first
|
|
116
|
+
```
|
|
117
|
+
"Use code-reviewer to find issues, then use fixer to resolve them"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Planning Mode (Automatic)
|
|
123
|
+
|
|
124
|
+
**Automatically enter planning mode** when ANY of these conditions apply:
|
|
125
|
+
- Multi-file changes (3+ files affected)
|
|
126
|
+
- Architectural decisions
|
|
127
|
+
- Unclear or evolving requirements
|
|
128
|
+
- Risk mitigation on core systems
|
|
129
|
+
- New feature implementation
|
|
130
|
+
- Refactoring existing functionality
|
|
131
|
+
|
|
132
|
+
**Do NOT ask** whether to enter planning mode - just enter it when conditions are met.
|
|
133
|
+
|
|
134
|
+
Planning mode flow: read-only exploration → create plan → get approval → execute.
|
|
135
|
+
|
|
136
|
+
**Skip planning mode** only for:
|
|
137
|
+
- Single-file bug fixes
|
|
138
|
+
- Typo corrections
|
|
139
|
+
- Simple config changes
|
|
140
|
+
- Tasks with explicit step-by-step instructions from user
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Ralph Wiggum Loop (Autonomous Work Mode)
|
|
145
|
+
|
|
146
|
+
Ralph loops enable persistent, autonomous work on large tasks. When active, you continue iterating until completion criteria are met or the loop is cancelled.
|
|
147
|
+
|
|
148
|
+
### Starting a Ralph Loop
|
|
149
|
+
- Start: `/ralph-loop:ralph-loop`
|
|
150
|
+
- Cancel: `/ralph-loop:cancel-ralph`
|
|
151
|
+
- Help: `/ralph-loop:help`
|
|
152
|
+
|
|
153
|
+
### Time-Aware Loops
|
|
154
|
+
|
|
155
|
+
When the user specifies a **minimum duration** (e.g., "optimize for 8 hours", "work on this for 2 hours"), the loop becomes time-aware:
|
|
156
|
+
|
|
157
|
+
**At loop start:**
|
|
158
|
+
```bash
|
|
159
|
+
# Record start time
|
|
160
|
+
date +%s > /tmp/ralph_start_time
|
|
161
|
+
echo "Loop started at $(date)"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Check elapsed time periodically:**
|
|
165
|
+
```bash
|
|
166
|
+
START=$(cat /tmp/ralph_start_time)
|
|
167
|
+
NOW=$(date +%s)
|
|
168
|
+
ELAPSED_HOURS=$(echo "scale=2; ($NOW - $START) / 3600" | bc)
|
|
169
|
+
echo "Elapsed: $ELAPSED_HOURS hours"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Time-aware behavior:**
|
|
173
|
+
1. Complete all primary tasks from the user's prompt
|
|
174
|
+
2. After primary tasks done, check elapsed time
|
|
175
|
+
3. If minimum duration NOT reached:
|
|
176
|
+
- **Do NOT output completion phrase**
|
|
177
|
+
- Self-generate additional related tasks
|
|
178
|
+
- Continue working until minimum time elapsed
|
|
179
|
+
4. Only output completion phrase when:
|
|
180
|
+
- ALL primary tasks complete AND
|
|
181
|
+
- Minimum duration reached (or exceeded)
|
|
182
|
+
|
|
183
|
+
**Self-generating additional tasks when time remains:**
|
|
184
|
+
- Code optimization (performance, readability, DRY)
|
|
185
|
+
- Test coverage improvements
|
|
186
|
+
- Edge case handling
|
|
187
|
+
- Error message improvements
|
|
188
|
+
- Documentation gaps
|
|
189
|
+
- Security hardening
|
|
190
|
+
- Accessibility improvements
|
|
191
|
+
- Code cleanup and dead code removal
|
|
192
|
+
- Dependency updates
|
|
193
|
+
- Type safety improvements
|
|
194
|
+
|
|
195
|
+
**Example time-aware prompt:**
|
|
196
|
+
```
|
|
197
|
+
"Optimize the API endpoints for the next 4 hours. Focus on performance first,
|
|
198
|
+
then code quality. Minimum runtime: 4 hours."
|
|
199
|
+
Completion phrase: <promise>TIME_COMPLETE</promise>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Time-aware loop behavior:**
|
|
203
|
+
```
|
|
204
|
+
[Start loop, record timestamp]
|
|
205
|
+
[Complete primary optimization tasks - 2 hours elapsed]
|
|
206
|
+
[Check time: 2/4 hours - NOT done yet]
|
|
207
|
+
[Self-generate: "Add caching to database queries"]
|
|
208
|
+
[Self-generate: "Optimize N+1 queries"]
|
|
209
|
+
[Self-generate: "Add request batching"]
|
|
210
|
+
[Continue working... 4.5 hours elapsed]
|
|
211
|
+
[Check time: 4.5/4 hours - minimum reached]
|
|
212
|
+
[All tasks complete, tests pass]
|
|
213
|
+
<promise>TIME_COMPLETE</promise>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### How You Know You're in a Ralph Loop
|
|
217
|
+
|
|
218
|
+
The user started the loop with a prompt containing:
|
|
219
|
+
- Clear task requirements
|
|
220
|
+
- A **completion phrase** (e.g., `<promise>COMPLETE</promise>`)
|
|
221
|
+
- **Optional: minimum duration** (e.g., "for the next 4 hours")
|
|
222
|
+
- Iteration limits (handled by the system)
|
|
223
|
+
|
|
224
|
+
Your job: Keep working until ALL requirements are verifiably done AND minimum time reached (if specified), then output the exact completion phrase.
|
|
225
|
+
|
|
226
|
+
### Core Behaviors During Ralph Loop
|
|
227
|
+
|
|
228
|
+
**1. Work Incrementally**
|
|
229
|
+
- Complete one sub-task at a time
|
|
230
|
+
- Verify it works before moving to the next
|
|
231
|
+
- Don't try to do everything in one pass
|
|
232
|
+
|
|
233
|
+
**2. Commit Frequently**
|
|
234
|
+
- Commit after each meaningful completion
|
|
235
|
+
- Creates recovery points if something breaks
|
|
236
|
+
- Shows progress in git history
|
|
237
|
+
```
|
|
238
|
+
git add . && git commit -m "feat(auth): add token refresh endpoint"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**3. Self-Correct Relentlessly**
|
|
242
|
+
```
|
|
243
|
+
Loop:
|
|
244
|
+
1. Implement/fix
|
|
245
|
+
2. Run tests
|
|
246
|
+
3. If tests fail → read error, fix, go to 1
|
|
247
|
+
4. Run linter
|
|
248
|
+
5. If lint errors → fix, go to 1
|
|
249
|
+
6. Commit
|
|
250
|
+
7. Continue to next task
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**4. Track Progress**
|
|
254
|
+
Update the session log in this file as you complete tasks:
|
|
255
|
+
```markdown
|
|
256
|
+
| Date | Tasks Completed | Files Changed | Notes |
|
|
257
|
+
|------|-----------------|---------------|-------|
|
|
258
|
+
| YYYY-MM-DD | Add auth endpoint | auth.ts, routes.ts | Tests passing |
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**5. Use Git History When Stuck**
|
|
262
|
+
If something isn't working:
|
|
263
|
+
```bash
|
|
264
|
+
git log --oneline -10
|
|
265
|
+
git diff HEAD~1
|
|
266
|
+
```
|
|
267
|
+
See what you already tried. Don't repeat failed approaches.
|
|
268
|
+
|
|
269
|
+
**6. Completion Phrase = Contract**
|
|
270
|
+
Only output the completion phrase (e.g., `<promise>COMPLETE</promise>`) when:
|
|
271
|
+
- ALL requirements from the original prompt are done
|
|
272
|
+
- ALL tests pass
|
|
273
|
+
- ALL linting passes
|
|
274
|
+
- Changes are committed
|
|
275
|
+
|
|
276
|
+
**Never output the completion phrase early.** The loop only ends when you say it's done.
|
|
277
|
+
|
|
278
|
+
### What Makes Good Completion Criteria
|
|
279
|
+
|
|
280
|
+
The user should provide criteria that are:
|
|
281
|
+
- **Verifiable**: Tests pass, lint clean, build succeeds
|
|
282
|
+
- **Measurable**: "5 endpoints", "all files in src/", "zero errors"
|
|
283
|
+
- **Binary**: Done or not done, no ambiguity
|
|
284
|
+
|
|
285
|
+
If the original prompt has vague criteria, ask clarifying questions before starting heavy work.
|
|
286
|
+
|
|
287
|
+
### Self-Correction Pattern (Include in Your Work)
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
FOR EACH TASK:
|
|
291
|
+
1. Implement the change
|
|
292
|
+
2. Run tests (npm test, pytest, go test, cargo test, etc.)
|
|
293
|
+
- If fail → read error, fix, retry
|
|
294
|
+
3. Run linter (npm run lint, ruff, golangci-lint, etc.)
|
|
295
|
+
- If fail → fix, go to step 2
|
|
296
|
+
4. Verify manually if needed
|
|
297
|
+
5. Commit with descriptive message
|
|
298
|
+
6. Update session log
|
|
299
|
+
7. Move to next task
|
|
300
|
+
|
|
301
|
+
WHEN ALL TASKS DONE:
|
|
302
|
+
1. Run full test suite
|
|
303
|
+
2. Run full lint
|
|
304
|
+
3. Verify build succeeds
|
|
305
|
+
4. Review all changes: git diff main
|
|
306
|
+
5. Only then output completion phrase
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Example: How to Think During Ralph Loop
|
|
310
|
+
|
|
311
|
+
**Original prompt**: "Add CRUD endpoints for todos with validation"
|
|
312
|
+
|
|
313
|
+
**Your approach**:
|
|
314
|
+
```
|
|
315
|
+
Task breakdown:
|
|
316
|
+
- [ ] GET /todos (list)
|
|
317
|
+
- [ ] POST /todos (create with validation)
|
|
318
|
+
- [ ] GET /todos/:id (single)
|
|
319
|
+
- [ ] PUT /todos/:id (update with validation)
|
|
320
|
+
- [ ] DELETE /todos/:id
|
|
321
|
+
- [ ] Tests for all endpoints
|
|
322
|
+
|
|
323
|
+
Starting with GET /todos...
|
|
324
|
+
[implement]
|
|
325
|
+
[test - passes]
|
|
326
|
+
[commit: "feat(todos): add GET /todos endpoint"]
|
|
327
|
+
[update session log]
|
|
328
|
+
|
|
329
|
+
Moving to POST /todos...
|
|
330
|
+
[implement]
|
|
331
|
+
[test - fails: validation not working]
|
|
332
|
+
[fix validation]
|
|
333
|
+
[test - passes]
|
|
334
|
+
[commit: "feat(todos): add POST /todos with validation"]
|
|
335
|
+
[update session log]
|
|
336
|
+
|
|
337
|
+
...continue until all done...
|
|
338
|
+
|
|
339
|
+
Final verification:
|
|
340
|
+
[npm test - all pass]
|
|
341
|
+
[npm run lint - clean]
|
|
342
|
+
[npm run build - succeeds]
|
|
343
|
+
|
|
344
|
+
<promise>COMPLETE</promise>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### When to NOT Output Completion Phrase
|
|
348
|
+
|
|
349
|
+
- Tests are failing (even one)
|
|
350
|
+
- Lint errors exist
|
|
351
|
+
- Build is broken
|
|
352
|
+
- You skipped a requirement
|
|
353
|
+
- You're unsure if something works
|
|
354
|
+
- **Minimum duration not reached** (for time-aware loops)
|
|
355
|
+
|
|
356
|
+
Instead: Fix the issue, verify, then complete. For time-aware loops: generate more tasks and keep improving until minimum time elapsed.
|
|
357
|
+
|
|
358
|
+
### RALPH_STATUS Block (Required During Ralph Loop)
|
|
359
|
+
|
|
360
|
+
At the **END of every response** during a Ralph Loop, output this structured status block:
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
---RALPH_STATUS---
|
|
364
|
+
STATUS: IN_PROGRESS | COMPLETE | BLOCKED
|
|
365
|
+
TASKS_COMPLETED_THIS_LOOP: <number>
|
|
366
|
+
FILES_MODIFIED: <number>
|
|
367
|
+
TESTS_STATUS: PASSING | FAILING | NOT_RUN
|
|
368
|
+
WORK_TYPE: IMPLEMENTATION | TESTING | DOCUMENTATION | REFACTORING
|
|
369
|
+
EXIT_SIGNAL: false | true
|
|
370
|
+
RECOMMENDATION: <one line summary of what to do next>
|
|
371
|
+
---END_RALPH_STATUS---
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Rules:**
|
|
375
|
+
- Output this block at the end of **every** response, no exceptions
|
|
376
|
+
- Set `EXIT_SIGNAL` to `true` ONLY when ALL tasks are verifiably done
|
|
377
|
+
- Set `STATUS` to `BLOCKED` when you need human intervention
|
|
378
|
+
- Do NOT continue with busy work when `EXIT_SIGNAL` should be `true`
|
|
379
|
+
- Do NOT forget the status block — it is required for loop tracking
|
|
380
|
+
|
|
381
|
+
### Testing Limits
|
|
382
|
+
|
|
383
|
+
- **LIMIT testing to ~20% of total effort** per loop
|
|
384
|
+
- PRIORITIZE: Implementation > Documentation > Tests
|
|
385
|
+
- Only write tests for NEW functionality
|
|
386
|
+
- Do NOT refactor existing tests unless broken
|
|
387
|
+
- Do NOT run tests repeatedly without implementing new features
|
|
388
|
+
|
|
389
|
+
### Exit Scenarios (When to Set EXIT_SIGNAL)
|
|
390
|
+
|
|
391
|
+
| Scenario | STATUS | EXIT_SIGNAL | Action |
|
|
392
|
+
|----------|--------|-------------|--------|
|
|
393
|
+
| All tasks completed, tests pass | COMPLETE | true | Output completion phrase |
|
|
394
|
+
| No work remaining, specs done | COMPLETE | true | Output completion phrase |
|
|
395
|
+
| Making normal progress | IN_PROGRESS | false | Continue to next task |
|
|
396
|
+
| Test-only loop (no implementation) | IN_PROGRESS | false | Warn and shift to implementation |
|
|
397
|
+
| Stuck on same error repeatedly | BLOCKED | false | Describe blocker, request help |
|
|
398
|
+
| Needs human decision/intervention | BLOCKED | false | Describe what's needed |
|
|
399
|
+
|
|
400
|
+
**Anti-patterns to avoid:**
|
|
401
|
+
- Setting `EXIT_SIGNAL: true` when tests are failing
|
|
402
|
+
- Continuing to work when all tasks are genuinely done (busy work)
|
|
403
|
+
- Running the same failing test repeatedly without changing approach
|
|
404
|
+
- Adding features not in the original specifications
|
|
405
|
+
- Refactoring working code instead of completing assigned tasks
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Code Standards
|
|
410
|
+
|
|
411
|
+
### Before Writing
|
|
412
|
+
- Read existing code in the area you're modifying
|
|
413
|
+
- Follow existing patterns and conventions
|
|
414
|
+
- Check for similar implementations to reference
|
|
415
|
+
|
|
416
|
+
### During Implementation
|
|
417
|
+
- Keep changes focused and minimal
|
|
418
|
+
- Don't over-engineer
|
|
419
|
+
- Write tests for new functionality
|
|
420
|
+
|
|
421
|
+
### After Implementation
|
|
422
|
+
- Run tests
|
|
423
|
+
- Update docs if needed
|
|
424
|
+
- Commit with descriptive message
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## Hooks Awareness
|
|
429
|
+
|
|
430
|
+
This project may have hooks that auto-format code after writes or validate operations. If a tool call behaves unexpectedly, hooks are likely the cause. Continue working - they're intentional.
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## Session Log
|
|
435
|
+
|
|
436
|
+
| Date | Tasks Completed | Files Changed | Notes |
|
|
437
|
+
|------|-----------------|---------------|-------|
|
|
438
|
+
| [DATE] | Project created | CLAUDE.md | Initial setup |
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## Current Task Queue
|
|
443
|
+
|
|
444
|
+
### Active Ralph Loop
|
|
445
|
+
**Status**: Not Active
|
|
446
|
+
**Completion Phrase**: -
|
|
447
|
+
|
|
448
|
+
### Pending Tasks
|
|
449
|
+
- [ ] <!-- Add tasks here -->
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Implementation Plans
|
|
454
|
+
|
|
455
|
+
<!-- Document plans before major implementations -->
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## Notes & Decisions
|
|
460
|
+
|
|
461
|
+
<!-- Track important decisions and context -->
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CLAUDE.md template generation
|
|
3
|
+
*
|
|
4
|
+
* Generates CLAUDE.md configuration files for new Codeman projects.
|
|
5
|
+
* Reads the bundled case-template.md and performs placeholder substitution.
|
|
6
|
+
* Supports custom templates via settings.json override.
|
|
7
|
+
*
|
|
8
|
+
* @module templates/claude-md
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Generates a CLAUDE.md configuration file for a new project.
|
|
12
|
+
*
|
|
13
|
+
* Priority order for template resolution:
|
|
14
|
+
* 1. Custom template via `templatePath` parameter (from settings.json)
|
|
15
|
+
* 2. Bundled `case-template.md` (shipped with the project)
|
|
16
|
+
* 3. Minimal fallback (if bundled template is missing)
|
|
17
|
+
*
|
|
18
|
+
* Placeholders replaced: [PROJECT_NAME], [PROJECT_DESCRIPTION], [DATE]
|
|
19
|
+
*
|
|
20
|
+
* @param caseName - The project/case name to use in the template
|
|
21
|
+
* @param description - Optional project description (defaults to "A new project")
|
|
22
|
+
* @param templatePath - Optional path to a custom template file (from settings.json)
|
|
23
|
+
* @returns The generated CLAUDE.md content
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateClaudeMd(caseName: string, description?: string, templatePath?: string): string;
|
|
26
|
+
//# sourceMappingURL=claude-md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuBH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAE,MAAW,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAyB1G"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CLAUDE.md template generation
|
|
3
|
+
*
|
|
4
|
+
* Generates CLAUDE.md configuration files for new Codeman projects.
|
|
5
|
+
* Reads the bundled case-template.md and performs placeholder substitution.
|
|
6
|
+
* Supports custom templates via settings.json override.
|
|
7
|
+
*
|
|
8
|
+
* @module templates/claude-md
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import { dirname, join } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const BUNDLED_TEMPLATE_PATH = join(__dirname, 'case-template.md');
|
|
15
|
+
const MINIMAL_FALLBACK = `# CLAUDE.md - Project Configuration
|
|
16
|
+
|
|
17
|
+
## Project Overview
|
|
18
|
+
- **Project Name**: [PROJECT_NAME]
|
|
19
|
+
- **Description**: [PROJECT_DESCRIPTION]
|
|
20
|
+
- **Last Updated**: [DATE]
|
|
21
|
+
|
|
22
|
+
## Session Log
|
|
23
|
+
|
|
24
|
+
| Date | Tasks Completed | Files Changed | Notes |
|
|
25
|
+
|------|-----------------|---------------|-------|
|
|
26
|
+
| [DATE] | Project created | CLAUDE.md | Initial setup |
|
|
27
|
+
`;
|
|
28
|
+
/**
|
|
29
|
+
* Generates a CLAUDE.md configuration file for a new project.
|
|
30
|
+
*
|
|
31
|
+
* Priority order for template resolution:
|
|
32
|
+
* 1. Custom template via `templatePath` parameter (from settings.json)
|
|
33
|
+
* 2. Bundled `case-template.md` (shipped with the project)
|
|
34
|
+
* 3. Minimal fallback (if bundled template is missing)
|
|
35
|
+
*
|
|
36
|
+
* Placeholders replaced: [PROJECT_NAME], [PROJECT_DESCRIPTION], [DATE]
|
|
37
|
+
*
|
|
38
|
+
* @param caseName - The project/case name to use in the template
|
|
39
|
+
* @param description - Optional project description (defaults to "A new project")
|
|
40
|
+
* @param templatePath - Optional path to a custom template file (from settings.json)
|
|
41
|
+
* @returns The generated CLAUDE.md content
|
|
42
|
+
*/
|
|
43
|
+
export function generateClaudeMd(caseName, description = '', templatePath) {
|
|
44
|
+
const date = new Date().toISOString().split('T')[0];
|
|
45
|
+
// 1. Try custom template from settings.json
|
|
46
|
+
if (templatePath && existsSync(templatePath)) {
|
|
47
|
+
try {
|
|
48
|
+
const template = readFileSync(templatePath, 'utf-8');
|
|
49
|
+
return replacePlaceholders(template, caseName, description, date);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
console.error(`Failed to read custom template from ${templatePath}:`, err);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// 2. Try bundled template
|
|
56
|
+
if (existsSync(BUNDLED_TEMPLATE_PATH)) {
|
|
57
|
+
try {
|
|
58
|
+
const template = readFileSync(BUNDLED_TEMPLATE_PATH, 'utf-8');
|
|
59
|
+
return replacePlaceholders(template, caseName, description, date);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
console.error(`Failed to read bundled template from ${BUNDLED_TEMPLATE_PATH}:`, err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// 3. Minimal fallback
|
|
66
|
+
return replacePlaceholders(MINIMAL_FALLBACK, caseName, description, date);
|
|
67
|
+
}
|
|
68
|
+
function replacePlaceholders(template, caseName, description, date) {
|
|
69
|
+
return template
|
|
70
|
+
.replace(/\[PROJECT_NAME\]/g, caseName)
|
|
71
|
+
.replace(/\[PROJECT_DESCRIPTION\]/g, description || 'A new project')
|
|
72
|
+
.replace(/\[DATE\]/g, date);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=claude-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-md.js","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAElE,MAAM,gBAAgB,GAAG;;;;;;;;;;;;CAYxB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,cAAsB,EAAE,EAAE,YAAqB;IAChG,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,4CAA4C;IAC5C,IAAI,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACrD,OAAO,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QACpE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,uCAAuC,YAAY,GAAG,EAAE,GAAG,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAED,0BAA0B;IAC1B,IAAI,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,YAAY,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;YAC9D,OAAO,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QACpE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,wCAAwC,qBAAqB,GAAG,EAAE,GAAG,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAED,sBAAsB;IACtB,OAAO,mBAAmB,CAAC,gBAAgB,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB,EAAE,QAAgB,EAAE,WAAmB,EAAE,IAAY;IAChG,OAAO,QAAQ;SACZ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;SACtC,OAAO,CAAC,0BAA0B,EAAE,WAAW,IAAI,eAAe,CAAC;SACnE,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC"}
|