homunculus-code 0.3.4 → 0.4.1
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/README.md +5 -5
- package/bin/init.js +3 -3
- package/commands/{hm-setup.md → hm-goal.md} +53 -11
- package/commands/hm-night.md +85 -48
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,23 +160,23 @@ Homunculus — Self-evolving AI Assistant
|
|
|
160
160
|
✓ Created homunculus/ directory structure
|
|
161
161
|
✓ Added evolution rules
|
|
162
162
|
✓ Copied evolution scripts
|
|
163
|
-
✓ Added slash commands (/hm-
|
|
163
|
+
✓ Added slash commands (/hm-goal, /hm-night, /hm-status)
|
|
164
164
|
✓ Configured observation hook
|
|
165
165
|
|
|
166
166
|
Done! Homunculus is installed.
|
|
167
167
|
|
|
168
168
|
Next steps:
|
|
169
169
|
1. Run claude to open Claude Code
|
|
170
|
-
2. Type /hm-
|
|
170
|
+
2. Type /hm-goal to define your goals (AI-guided)
|
|
171
171
|
3. Type /hm-night to run your first evolution cycle
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
### 2. Define Your Goals
|
|
175
175
|
|
|
176
|
-
Open Claude Code and type `/hm-
|
|
176
|
+
Open Claude Code and type `/hm-goal`. Claude will have a short conversation with you to understand your project and goals, then generate your `architecture.yaml` automatically.
|
|
177
177
|
|
|
178
178
|
```
|
|
179
|
-
> /hm-
|
|
179
|
+
> /hm-goal
|
|
180
180
|
|
|
181
181
|
Claude: What kind of project is this?
|
|
182
182
|
You: A SaaS app for team collaboration
|
|
@@ -215,7 +215,7 @@ The observation hook watches your usage automatically. As patterns emerge:
|
|
|
215
215
|
```
|
|
216
216
|
/hm-night Run an evolution cycle
|
|
217
217
|
/hm-status Check evolution progress
|
|
218
|
-
/hm-
|
|
218
|
+
/hm-goal Refine your goals anytime
|
|
219
219
|
/eval-skill Evaluate a specific skill
|
|
220
220
|
/improve-skill Auto-improve a skill
|
|
221
221
|
/evolve Converge instincts into skills
|
package/bin/init.js
CHANGED
|
@@ -76,7 +76,7 @@ This project uses Homunculus for goal-driven evolution.
|
|
|
76
76
|
- **Goal Tree**: \`architecture.yaml\` — defines goals, metrics, and health checks
|
|
77
77
|
- **Instincts**: \`homunculus/instincts/personal/\` — auto-extracted patterns
|
|
78
78
|
- **Skills**: \`homunculus/evolved/skills/\` — tested, versioned knowledge
|
|
79
|
-
- **Commands**: \`/hm-
|
|
79
|
+
- **Commands**: \`/hm-goal\` (define goals) | \`/hm-night\` (evolution cycle) | \`/hm-status\` (dashboard)
|
|
80
80
|
`;
|
|
81
81
|
|
|
82
82
|
if (fs.existsSync(claudeDest)) {
|
|
@@ -106,7 +106,7 @@ This project uses Homunculus for goal-driven evolution.
|
|
|
106
106
|
// 5. Copy slash commands
|
|
107
107
|
if (fs.existsSync(COMMANDS_DIR)) {
|
|
108
108
|
copyDir(COMMANDS_DIR, path.join(projectDir, '.claude', 'commands'));
|
|
109
|
-
console.log(' \x1b[32m✓\x1b[0m Added slash commands (/hm-
|
|
109
|
+
console.log(' \x1b[32m✓\x1b[0m Added slash commands (/hm-goal, /hm-night, /hm-status)');
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// 6. Configure Claude Code hooks
|
|
@@ -157,7 +157,7 @@ This project uses Homunculus for goal-driven evolution.
|
|
|
157
157
|
console.log('');
|
|
158
158
|
console.log(' Next steps:');
|
|
159
159
|
console.log(' 1. Run \x1b[1mclaude\x1b[0m to open Claude Code');
|
|
160
|
-
console.log(' 2. Type \x1b[1m/hm-
|
|
160
|
+
console.log(' 2. Type \x1b[1m/hm-goal\x1b[0m to define your goals (AI-guided)');
|
|
161
161
|
console.log(' 3. Type \x1b[1m/hm-night\x1b[0m to run your first evolution cycle');
|
|
162
162
|
console.log('');
|
|
163
163
|
}
|
|
@@ -1,25 +1,67 @@
|
|
|
1
|
-
# /hm-
|
|
1
|
+
# /hm-goal — View or Define Your Goal Tree
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
If `architecture.yaml` exists, display the current goal tree and ask if changes are needed.
|
|
4
|
+
If it doesn't exist, guide the user through creating one.
|
|
4
5
|
|
|
5
6
|
**Always communicate in English** regardless of user's global Claude settings.
|
|
6
7
|
|
|
7
8
|
## Behavior
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
### Mode Detection
|
|
11
|
+
|
|
12
|
+
Check if `architecture.yaml` exists in the project root.
|
|
13
|
+
|
|
14
|
+
- **Exists** → Show Mode
|
|
15
|
+
- **Doesn't exist** → Create Mode
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Show Mode (architecture.yaml exists)
|
|
20
|
+
|
|
21
|
+
### Step 1: Read and display
|
|
22
|
+
|
|
23
|
+
Read `architecture.yaml` and present the goal tree visually:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
🎯 Your Goal Tree
|
|
27
|
+
├── code_quality — Ship fewer bugs
|
|
28
|
+
│ ├── testing — Every change has tests
|
|
29
|
+
│ │ └── realized_by: skills/tdd-workflow.md ✓
|
|
30
|
+
│ └── review — Catch issues before merge
|
|
31
|
+
│ └── realized_by: # will evolve ○
|
|
32
|
+
├── productivity — Move faster
|
|
33
|
+
│ └── debugging — Find root causes faster
|
|
34
|
+
│ └── realized_by: agents/debugger.md ✓
|
|
35
|
+
└── knowledge — Stay current
|
|
36
|
+
└── tool_updates — Track useful updates
|
|
37
|
+
└── realized_by: # will evolve ○
|
|
38
|
+
|
|
39
|
+
3 goals / 5 sub-goals
|
|
40
|
+
2 implemented (✓) / 3 waiting to evolve (○)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Step 2: Ask
|
|
44
|
+
|
|
45
|
+
> "Want to add, remove, or change any goals?"
|
|
46
|
+
|
|
47
|
+
- If yes → make the changes, update `architecture.yaml`
|
|
48
|
+
- If no → done
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Create Mode (no architecture.yaml)
|
|
10
53
|
|
|
11
54
|
**CRITICAL: Ask ONE question at a time. Wait for the answer before asking the next. Never batch multiple questions in one message.**
|
|
12
55
|
|
|
13
56
|
### Step 1: Ask about the project (ONE question)
|
|
14
57
|
|
|
15
|
-
Start with:
|
|
16
58
|
> "What kind of project is this? (e.g., web app, CLI tool, API, personal project)"
|
|
17
59
|
|
|
18
60
|
Wait for answer.
|
|
19
61
|
|
|
20
62
|
### Step 2: Ask about pain points (ONE question)
|
|
21
63
|
|
|
22
|
-
Based on their answer
|
|
64
|
+
Based on their answer:
|
|
23
65
|
> "What do you spend the most time on that you wish was better? (e.g., debugging, testing, deployment, keeping up with updates)"
|
|
24
66
|
|
|
25
67
|
Wait for answer.
|
|
@@ -30,7 +72,7 @@ Based on their answer, ask ONE more targeted question. Examples:
|
|
|
30
72
|
- "If your AI assistant could fix one thing overnight, what would it be?"
|
|
31
73
|
- "What breaks most often in your workflow?"
|
|
32
74
|
|
|
33
|
-
Adapt
|
|
75
|
+
Adapt based on what they already told you. Wait for answer.
|
|
34
76
|
|
|
35
77
|
### Step 4: Propose goals
|
|
36
78
|
|
|
@@ -68,15 +110,15 @@ Write the file using the Write tool.
|
|
|
68
110
|
```
|
|
69
111
|
✅ architecture.yaml created with N goals!
|
|
70
112
|
|
|
71
|
-
Your system is ready to evolve.
|
|
72
|
-
|
|
73
|
-
trigger an evolution cycle.
|
|
113
|
+
Your system is ready to evolve. Run /hm-night to start
|
|
114
|
+
your first evolution cycle.
|
|
74
115
|
```
|
|
75
116
|
|
|
76
117
|
## Rules
|
|
77
118
|
|
|
78
|
-
- **ONE question per message. Never ask two questions at once.**
|
|
119
|
+
- **ONE question per message in Create Mode. Never ask two questions at once.**
|
|
79
120
|
- Keep the whole setup under 5 back-and-forth messages
|
|
80
121
|
- Generate PRACTICAL goals, not abstract ones
|
|
81
122
|
- Don't overwhelm — 3-5 top-level goals is ideal
|
|
82
|
-
-
|
|
123
|
+
- In Show Mode, show realized_by status (✓ = file exists, ○ = not yet)
|
|
124
|
+
- Goals can always be refined by running `/hm-goal` again
|
package/commands/hm-night.md
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
# /hm-night — Run One Evolution Cycle
|
|
2
2
|
|
|
3
|
-
Run the full evolution pipeline: health check →
|
|
3
|
+
Run the full evolution pipeline: health check → evolve → research → report.
|
|
4
4
|
|
|
5
5
|
**Always communicate in English** regardless of user's global Claude settings.
|
|
6
6
|
|
|
7
|
+
## Core Principle
|
|
8
|
+
|
|
9
|
+
**Goals are stable. Implementations are diverse.** When suggesting improvements, consider ALL implementation types — not just skills:
|
|
10
|
+
|
|
11
|
+
| Type | When to suggest |
|
|
12
|
+
|------|----------------|
|
|
13
|
+
| Skill | Behavioral knowledge Claude should follow |
|
|
14
|
+
| Agent | Task needs specialized model/tools/prompt |
|
|
15
|
+
| Hook | Should trigger automatically on events |
|
|
16
|
+
| Script | Automation that runs independently |
|
|
17
|
+
| Rule | Claude Code behavioral constraint |
|
|
18
|
+
| Command | Workflow the user triggers manually |
|
|
19
|
+
| Cron/LaunchAgent | Needs to run on a schedule |
|
|
20
|
+
| MCP | Needs external service integration |
|
|
21
|
+
|
|
22
|
+
Always pick the **right tool for the job**, not default to skills.
|
|
23
|
+
|
|
7
24
|
## Behavior
|
|
8
25
|
|
|
9
|
-
|
|
26
|
+
Run through all 5 phases systematically.
|
|
10
27
|
|
|
11
28
|
### Phase 1: Health Check
|
|
12
29
|
|
|
@@ -18,71 +35,91 @@ You are the Homunculus nightly evolution agent. Run through all 5 phases systema
|
|
|
18
35
|
[1/5] Health Check
|
|
19
36
|
code_quality: ✅ healthy (tests passing)
|
|
20
37
|
productivity: ⚠️ no health check defined
|
|
21
|
-
|
|
38
|
+
ai_news: ○ not implemented yet
|
|
22
39
|
```
|
|
23
40
|
|
|
24
|
-
### Phase 2: Scan
|
|
41
|
+
### Phase 2: Scan Evolved Assets
|
|
25
42
|
|
|
26
|
-
|
|
27
|
-
2. If instincts exist, check for pruning candidates (run `node scripts/prune-instincts.js` if it exists)
|
|
28
|
-
3. Report count and any archival suggestions
|
|
29
|
-
```
|
|
30
|
-
[2/5] Instincts
|
|
31
|
-
12 active / 5 archived
|
|
32
|
-
△ 2 candidates for archival (low confidence)
|
|
33
|
-
```
|
|
43
|
+
Check ALL evolved artifacts, not just skills:
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
1. **Instincts**: Count in `homunculus/instincts/personal/` and `archived/`
|
|
46
|
+
2. **Skills**: Count in `homunculus/evolved/skills/`, run evals if specs exist
|
|
47
|
+
3. **Agents**: Count in `homunculus/evolved/agents/`
|
|
48
|
+
4. **Scripts**: Check `scripts/` for automation
|
|
49
|
+
5. **Hooks**: Check `.claude/settings.json` for configured hooks
|
|
50
|
+
6. **Commands**: Check `.claude/commands/` for slash commands
|
|
51
|
+
7. **Rules**: Check `.claude/rules/` for behavioral rules
|
|
36
52
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
Report:
|
|
54
|
+
```
|
|
55
|
+
[2/5] Evolved Assets
|
|
56
|
+
Instincts: 12 active / 5 archived
|
|
57
|
+
Skills: 2 (all 100% eval)
|
|
58
|
+
Agents: 1 (debugger)
|
|
59
|
+
Hooks: 3 configured
|
|
60
|
+
Commands: 6 available
|
|
61
|
+
Rules: 2 active
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If skills have eval specs, run `/eval-skill` and report pass rates.
|
|
46
65
|
|
|
47
|
-
### Phase
|
|
66
|
+
### Phase 3: Research & Suggest
|
|
48
67
|
|
|
49
|
-
1.
|
|
50
|
-
2.
|
|
51
|
-
3. Look for goals with failing health checks — these need attention
|
|
52
|
-
4. Suggest improvements:
|
|
68
|
+
1. Scan `architecture.yaml` for goals where `realized_by` is empty or `# will evolve`
|
|
69
|
+
2. For each unimplemented goal, suggest the **most appropriate implementation type**:
|
|
53
70
|
```
|
|
54
|
-
[
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
→ Suggestion:
|
|
71
|
+
[3/5] Research
|
|
72
|
+
Goals without implementation:
|
|
73
|
+
|
|
74
|
+
ai_news → Suggestion: a SCRIPT that fetches from RSS/APIs
|
|
75
|
+
+ a CRON job to run it daily
|
|
76
|
+
(not a skill — this needs to run independently)
|
|
77
|
+
|
|
78
|
+
code_review → Suggestion: a HOOK on pre-commit
|
|
79
|
+
(not a skill — should be automated, not behavioral)
|
|
80
|
+
|
|
81
|
+
debugging → Suggestion: an AGENT with specialized tools
|
|
82
|
+
(not a script — needs AI reasoning)
|
|
58
83
|
```
|
|
59
84
|
|
|
85
|
+
3. For goals with failing health checks, suggest fixes using the right implementation type
|
|
86
|
+
|
|
87
|
+
### Phase 4: Act (if possible)
|
|
88
|
+
|
|
89
|
+
If there are simple improvements that can be made right now:
|
|
90
|
+
- Prune outdated instincts (`node scripts/prune-instincts.js --apply`)
|
|
91
|
+
- Improve failing skills (`/improve-skill`)
|
|
92
|
+
- Create a suggested script or hook if straightforward
|
|
93
|
+
|
|
94
|
+
Report what was done.
|
|
95
|
+
|
|
60
96
|
### Phase 5: Report
|
|
61
97
|
|
|
62
98
|
Generate a summary report and save to `homunculus/reports/YYYY-MM-DD.md`:
|
|
63
99
|
|
|
64
100
|
```
|
|
65
101
|
[5/5] Evolution Report — 2026-03-22
|
|
66
|
-
|
|
67
|
-
│ Goals:
|
|
68
|
-
│
|
|
69
|
-
│
|
|
70
|
-
│
|
|
71
|
-
│ Actions taken:
|
|
72
|
-
│ - Pruned 2 outdated instincts
|
|
73
|
-
│ -
|
|
74
|
-
│
|
|
75
|
-
│ Suggestions:
|
|
76
|
-
│ -
|
|
77
|
-
│ -
|
|
78
|
-
|
|
102
|
+
┌──────────────────────────────────────────────┐
|
|
103
|
+
│ Goals: 5 (2 healthy, 1 new, 2 todo) │
|
|
104
|
+
│ Assets: 2 skills, 1 agent, 3 hooks │
|
|
105
|
+
│ Instincts: 12 active / 5 archived │
|
|
106
|
+
│ │
|
|
107
|
+
│ Actions taken: │
|
|
108
|
+
│ - Pruned 2 outdated instincts │
|
|
109
|
+
│ - Created scripts/fetch-news.sh │
|
|
110
|
+
│ │
|
|
111
|
+
│ Suggestions: │
|
|
112
|
+
│ - code_review: add pre-commit hook │
|
|
113
|
+
│ - debugging: create specialized agent │
|
|
114
|
+
│ - Add health checks to 2 goals │
|
|
115
|
+
└──────────────────────────────────────────────┘
|
|
79
116
|
```
|
|
80
117
|
|
|
81
|
-
##
|
|
118
|
+
## Rules
|
|
82
119
|
|
|
120
|
+
- **Don't default to skills for everything** — match implementation to the goal's nature
|
|
83
121
|
- Actually RUN health check commands (don't just read them)
|
|
84
122
|
- Actually RUN eval-skill if eval specs exist (don't skip)
|
|
85
|
-
- If a skill fails eval, attempt `/improve-skill` (max 2 rounds)
|
|
86
123
|
- Save the report to `homunculus/reports/`
|
|
87
|
-
- Be concise —
|
|
88
|
-
- If
|
|
124
|
+
- Be concise — dashboard style, not essay
|
|
125
|
+
- If fresh system: suggest the FIRST concrete implementation to build (pick the easiest win)
|