homunculus-code 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/CONTRIBUTING.md +56 -0
- package/LICENSE +21 -0
- package/README.md +443 -0
- package/bin/init.js +317 -0
- package/commands/eval-skill.md +48 -0
- package/commands/evolve.md +67 -0
- package/commands/improve-skill.md +50 -0
- package/core/evaluate-session.js +173 -0
- package/core/observe.sh +51 -0
- package/core/prune-instincts.js +159 -0
- package/docs/nightly-agent.md +130 -0
- package/examples/reference/README.md +47 -0
- package/examples/reference/architecture.yaml +886 -0
- package/examples/reference/evolved-agents/assistant-explorer.md +86 -0
- package/examples/reference/evolved-agents/shell-debugger.md +108 -0
- package/examples/reference/evolved-agents/tdd-runner.md +112 -0
- package/examples/reference/evolved-evals/api-system-diagnosis.eval.yaml +125 -0
- package/examples/reference/evolved-evals/assistant-system-management.eval.yaml +123 -0
- package/examples/reference/evolved-evals/claude-code-reference.eval.yaml +394 -0
- package/examples/reference/evolved-evals/development-verification-patterns.eval.yaml +117 -0
- package/examples/reference/evolved-evals/multi-agent-design-patterns.eval.yaml +151 -0
- package/examples/reference/evolved-evals/shell-automation-patterns.eval.yaml +209 -0
- package/examples/reference/evolved-evals/tdd-workflow.eval.yaml +191 -0
- package/examples/reference/evolved-evals/workflows.eval.yaml +148 -0
- package/examples/reference/evolved-skills/api-system-diagnosis.md +234 -0
- package/examples/reference/evolved-skills/assistant-system-management.md +199 -0
- package/examples/reference/evolved-skills/development-verification-patterns.md +243 -0
- package/examples/reference/evolved-skills/multi-agent-design-patterns.md +259 -0
- package/examples/reference/evolved-skills/shell-automation-patterns.md +347 -0
- package/examples/reference/evolved-skills/tdd-workflow.md +272 -0
- package/examples/reference/evolved-skills/workflows.md +237 -0
- package/package.json +25 -0
- package/templates/CLAUDE.md.template +36 -0
- package/templates/architecture.template.yaml +41 -0
- package/templates/rules/evolution-system.md +29 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Contributing to Homunculus
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing! Here's how you can help.
|
|
4
|
+
|
|
5
|
+
## Ways to Contribute
|
|
6
|
+
|
|
7
|
+
### Share Your Evolution
|
|
8
|
+
The most valuable contribution: **show us what your system evolved into.** Open a Discussion in the "Show & Tell" category with:
|
|
9
|
+
- How long you've been running Homunculus
|
|
10
|
+
- What goals you defined
|
|
11
|
+
- What the system generated (instincts, skills, agents)
|
|
12
|
+
- Anything surprising
|
|
13
|
+
|
|
14
|
+
### Report Issues
|
|
15
|
+
Found a bug? Open an issue with:
|
|
16
|
+
- What you expected
|
|
17
|
+
- What happened
|
|
18
|
+
- Steps to reproduce
|
|
19
|
+
- Your environment (OS, Node version, Claude Code version)
|
|
20
|
+
|
|
21
|
+
### Improve Documentation
|
|
22
|
+
- Fix typos or unclear explanations
|
|
23
|
+
- Add examples from your experience
|
|
24
|
+
- Translate to other languages
|
|
25
|
+
|
|
26
|
+
### Contribute Code
|
|
27
|
+
1. Fork the repo
|
|
28
|
+
2. Create a feature branch
|
|
29
|
+
3. Make your changes
|
|
30
|
+
4. Test with `npx homunculus-code init` in a fresh directory
|
|
31
|
+
5. Open a PR
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/JavanC/Homunculus.git
|
|
37
|
+
cd Homunculus
|
|
38
|
+
|
|
39
|
+
# Test the init wizard
|
|
40
|
+
mkdir /tmp/test-project && cd /tmp/test-project
|
|
41
|
+
node ~/Homunculus/bin/init.js
|
|
42
|
+
|
|
43
|
+
# Test with --yes flag (non-interactive)
|
|
44
|
+
node ~/Homunculus/bin/init.js --yes
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Code Style
|
|
48
|
+
|
|
49
|
+
- Plain JavaScript (no TypeScript, no build step)
|
|
50
|
+
- Node.js 18+ features OK
|
|
51
|
+
- Shell scripts: `#!/usr/bin/env bash` + `set -euo pipefail`
|
|
52
|
+
- Keep it simple — this is a seed, not a framework
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Javan Chen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
# Homunculus for Claude Code
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://docs.anthropic.com/en/docs/claude-code)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
|
|
7
|
+
**Stop tuning your AI. Let it tune itself.**
|
|
8
|
+
|
|
9
|
+
You spend hours tweaking prompts, writing rules, researching new features, configuring tools. Homunculus flips this: define your goals, and the system evolves itself — skills, agents, hooks, scripts, everything — while you focus on actual work.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx homunculus-code init
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
One command. Answer a few questions. Start using Claude Code. Your assistant begins evolving.
|
|
16
|
+
|
|
17
|
+
> **Proof it works:** One developer ran this system for 15 days. It auto-generated 168 behavioral patterns, converged them into 7 tested skills, created 3 specialized agents, 15 commands, and 19 automation scripts. The nightly agent alone made 134 commits across 11 nights — improving the system while the developer slept. [See results →](#real-world-results)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Why
|
|
22
|
+
|
|
23
|
+
Every Claude Code power user hits the same wall:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Week 1: "Claude is amazing!"
|
|
27
|
+
Week 2: "Let me add some rules and hooks..."
|
|
28
|
+
Week 3: "I need skills, agents, MCP servers, custom commands..."
|
|
29
|
+
Week 4: "I spend more time configuring Claude than using it."
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Sound familiar? Even with tools like OpenClaw that can generate new skills, you're still the one deciding *what* to improve, *when* to improve it, and *whether* the improvement actually worked. The AI can write code, but it can't set its own direction.
|
|
33
|
+
|
|
34
|
+
**Here's the difference:**
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Without Homunculus: With Homunculus:
|
|
38
|
+
|
|
39
|
+
You notice tests keep failing Goal tree detects test_pass_rate dropped
|
|
40
|
+
→ You research testing patterns → Nightly agent auto-evolves tdd skill
|
|
41
|
+
→ You write a pre-commit skill → Eval confirms 100% pass
|
|
42
|
+
→ You test it manually → Morning report: "Fixed. Here's what changed."
|
|
43
|
+
→ It breaks after a Claude update → Next update? System re-evaluates and adapts
|
|
44
|
+
→ You fix it again... → You slept through all of this
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## The Core Idea: Goal Tree
|
|
50
|
+
|
|
51
|
+
Most AI tools optimize locally — "you did X, so I'll remember X." Homunculus optimizes **globally** — toward goals you define in a tree:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
🎯 My AI Assistant
|
|
55
|
+
┌──────────┼──────────┐
|
|
56
|
+
│ │ │
|
|
57
|
+
Code Quality Speed Knowledge
|
|
58
|
+
┌───┴───┐ │ ┌───┴───┐
|
|
59
|
+
Testing Review Tasks Research Memory
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Each node defines **why** it exists, **how** to measure it, and **what** currently implements it:
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
# architecture.yaml — from the reference system
|
|
66
|
+
autonomous_action:
|
|
67
|
+
purpose: "Act without waiting for human commands"
|
|
68
|
+
goals:
|
|
69
|
+
nightly_research:
|
|
70
|
+
purpose: "Discover better approaches while developer sleeps"
|
|
71
|
+
realized_by: heartbeat/heartbeat.sh # a shell script
|
|
72
|
+
health_check:
|
|
73
|
+
command: "test $(find logs/ -mtime -1 | wc -l) -gt 0"
|
|
74
|
+
expected: "nightly agent ran in last 24h"
|
|
75
|
+
|
|
76
|
+
task_management:
|
|
77
|
+
purpose: "Track and complete tasks autonomously"
|
|
78
|
+
realized_by: quest-board/server.js # a web app
|
|
79
|
+
metrics:
|
|
80
|
+
- name: forge_completion_rate
|
|
81
|
+
healthy: "> 70%"
|
|
82
|
+
|
|
83
|
+
continuous_evolution:
|
|
84
|
+
purpose: "Improve over time without human intervention"
|
|
85
|
+
goals:
|
|
86
|
+
pattern_extraction:
|
|
87
|
+
purpose: "Learn from every session"
|
|
88
|
+
realized_by: scripts/evaluate-session.js # a Node script
|
|
89
|
+
skill_aggregation:
|
|
90
|
+
purpose: "Converge patterns into tested skills"
|
|
91
|
+
realized_by: homunculus/evolved/skills/ # evolved artifacts
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The `realized_by` field can point to **anything**:
|
|
95
|
+
|
|
96
|
+
| Type | Example | When to use |
|
|
97
|
+
|------|---------|-------------|
|
|
98
|
+
| Skill | `skills/tdd-workflow.md` | Behavioral knowledge |
|
|
99
|
+
| Agent | `agents/code-reviewer.md` | Specialized AI subagent |
|
|
100
|
+
| Hook | `hooks/pre-commit.sh` | Automated trigger |
|
|
101
|
+
| Script | `scripts/deploy.sh` | Shell automation |
|
|
102
|
+
| Cron | `launchd/nightly-check.plist` | Scheduled task |
|
|
103
|
+
| MCP | `mcp-servers/github` | External integration |
|
|
104
|
+
| Rule | `rules/security.md` | Claude Code behavioral rule |
|
|
105
|
+
| Command | `commands/quality-gate.md` | Slash command workflow |
|
|
106
|
+
|
|
107
|
+
**Goals are stable. Implementations evolve.** The same goal can go from a mental note → instinct → skill → hook → agent. The system replaces and upgrades implementations while keeping goals intact.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## How It Evolves
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
You use Claude Code normally
|
|
115
|
+
│
|
|
116
|
+
┌───────────┼───────────┐
|
|
117
|
+
▼ ▼ ▼
|
|
118
|
+
Observe Health Check Research
|
|
119
|
+
(hooks) (goal tree) (nightly)
|
|
120
|
+
│ │ │
|
|
121
|
+
└───────────┼───────────┘
|
|
122
|
+
▼
|
|
123
|
+
┌────────────┐
|
|
124
|
+
│ Evolve │ Goals stay the same.
|
|
125
|
+
│ ────────── │ Implementations get better.
|
|
126
|
+
│ Extract │
|
|
127
|
+
│ Converge │
|
|
128
|
+
│ Eval │
|
|
129
|
+
│ Replace │
|
|
130
|
+
└────────────┘
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Three inputs, one engine:**
|
|
134
|
+
|
|
135
|
+
1. **Observe** — hooks watch your tool usage, extract recurring patterns into "instincts"
|
|
136
|
+
2. **Health check** — the goal tree identifies which goals are unhealthy → focus there
|
|
137
|
+
3. **Research** — a nightly agent scans for better approaches and proposes experiments
|
|
138
|
+
|
|
139
|
+
The evolution engine then:
|
|
140
|
+
- Extracts behavioral patterns → **instincts** (confidence-scored, auto-decay)
|
|
141
|
+
- Converges related instincts → **skills** (tested with eval specs)
|
|
142
|
+
- Evaluates and improves skills → **eval → improve loop** until 100% pass
|
|
143
|
+
- Proposes replacements → instinct becomes hook, script becomes agent
|
|
144
|
+
- Prunes outdated implementations → automatic archival
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Quick Start
|
|
149
|
+
|
|
150
|
+
### 1. Install
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npx homunculus-code init
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The wizard asks you a few questions and sets everything up:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
🧬 Homunculus — Self-evolving AI Assistant
|
|
160
|
+
|
|
161
|
+
? What's your project name? my-app
|
|
162
|
+
? What's your main goal? Build a reliable SaaS product
|
|
163
|
+
|
|
164
|
+
✅ Created homunculus/ structure
|
|
165
|
+
✅ Generated architecture.yaml with your goals
|
|
166
|
+
✅ Added observation hook to Claude Code
|
|
167
|
+
✅ Copied evolution scripts
|
|
168
|
+
|
|
169
|
+
Done! Start using Claude Code. Your assistant will evolve.
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 2. Use Claude Code Normally
|
|
173
|
+
|
|
174
|
+
That's it. The system observes, extracts, and evolves in the background. Check progress anytime:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
claude "/eval-skill" # Run skill evaluations
|
|
178
|
+
claude "/improve-skill" # Auto-improve a skill
|
|
179
|
+
claude "/evolve" # Converge instincts into skills
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 3. Refine Your Goals (Optional)
|
|
183
|
+
|
|
184
|
+
As you use the system, refine `architecture.yaml` — add sub-goals, metrics, and health checks. The more specific your goals, the smarter the evolution.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Key Concepts
|
|
189
|
+
|
|
190
|
+
### Goal Tree (`architecture.yaml`)
|
|
191
|
+
|
|
192
|
+
The central nervous system. Every goal has a purpose, metrics, and health checks. The evolution system reads this to decide **what** to improve and **how** to measure success.
|
|
193
|
+
|
|
194
|
+
### Instincts
|
|
195
|
+
|
|
196
|
+
Small behavioral patterns auto-extracted from your usage. They have confidence scores that grow with reinforcement and decay over time (half-life: 90 days). Think of them as the system's "muscle memory."
|
|
197
|
+
|
|
198
|
+
### Skills
|
|
199
|
+
|
|
200
|
+
When multiple instincts cover the same area, they converge into a skill — a tested, versioned knowledge module. Every skill has an eval spec with scenario tests. Skills that fail eval get automatically improved.
|
|
201
|
+
|
|
202
|
+
### Eval Specs
|
|
203
|
+
|
|
204
|
+
Scenario-based tests for skills. Each scenario defines context, expected behavior, and anti-patterns. The system runs evals and auto-improves until 100% pass rate.
|
|
205
|
+
|
|
206
|
+
### Replaceable Implementations
|
|
207
|
+
|
|
208
|
+
The core principle: **same goal, evolving implementation.**
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
Goal: "Catch bugs before merge"
|
|
212
|
+
|
|
213
|
+
v1: instinct → "remember to run tests"
|
|
214
|
+
v2: skill → tdd-workflow.md (with eval spec)
|
|
215
|
+
v3: hook → pre-commit.sh (automated)
|
|
216
|
+
v4: agent → code-reviewer.md (AI-powered)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Nightly Agent
|
|
222
|
+
|
|
223
|
+
This is what makes the system truly autonomous. Without it, you'd still need to manually run `/eval-skill`, `/improve-skill`, `/evolve`. The nightly agent **does all of that for you** while you sleep.
|
|
224
|
+
|
|
225
|
+
A scheduled agent (via `launchd` on macOS or `cron` on Linux) runs a heartbeat loop every night:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
You go to sleep
|
|
229
|
+
│
|
|
230
|
+
▼
|
|
231
|
+
┌──────────────────────────────────────────────┐
|
|
232
|
+
│ Nightly Agent (heartbeat loop) │
|
|
233
|
+
│ │
|
|
234
|
+
│ 1. Health Check │
|
|
235
|
+
│ Scan goal tree → which goals are red? │
|
|
236
|
+
│ │
|
|
237
|
+
│ 2. Evolve │
|
|
238
|
+
│ Run /eval-skill on all skills │
|
|
239
|
+
│ Run /improve-skill on failing ones │
|
|
240
|
+
│ Converge new instincts → skills │
|
|
241
|
+
│ Prune outdated instincts │
|
|
242
|
+
│ │
|
|
243
|
+
│ 3. Research │
|
|
244
|
+
│ Scan tech news, changelogs, community │
|
|
245
|
+
│ "Is there a better way to achieve X?" │
|
|
246
|
+
│ │
|
|
247
|
+
│ 4. Experiment │
|
|
248
|
+
│ Generate hypotheses from weak goals │
|
|
249
|
+
│ Run experiments in isolated worktrees │
|
|
250
|
+
│ Merge if passed, discard if failed │
|
|
251
|
+
│ │
|
|
252
|
+
│ 5. Report │
|
|
253
|
+
│ Generate morning report │
|
|
254
|
+
└──────────────────────────────────────────────┘
|
|
255
|
+
│
|
|
256
|
+
▼
|
|
257
|
+
You wake up to a smarter assistant + a report
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Here's what a real morning report looks like:**
|
|
261
|
+
|
|
262
|
+
```markdown
|
|
263
|
+
## Morning Report — 2026-03-22
|
|
264
|
+
|
|
265
|
+
### What Changed Overnight
|
|
266
|
+
- Improved skill: claude-code-reference v4.6 → v4.8
|
|
267
|
+
(added coverage for CC v2.1.77-80 features)
|
|
268
|
+
- Archived 3 outdated instincts (covered by evolved skills)
|
|
269
|
+
- New experiment passed: eval noise threshold set to 5pp
|
|
270
|
+
|
|
271
|
+
### Goal Health
|
|
272
|
+
- continuous_evolution: ✅ healthy (7 skills, all 100% eval)
|
|
273
|
+
- code_quality: ✅ healthy (148/148 tests passing)
|
|
274
|
+
- resource_awareness: ⚠️ attention (context usage trending up)
|
|
275
|
+
→ Queued experiment: split large skill into chapters
|
|
276
|
+
|
|
277
|
+
### Research Findings
|
|
278
|
+
- Claude Code v2.1.81: new --bare flag could speed up headless mode
|
|
279
|
+
→ Experiment queued for tomorrow night
|
|
280
|
+
- New pattern detected in community: writer/reviewer agent separation
|
|
281
|
+
→ Instinct created, will converge if reinforced
|
|
282
|
+
|
|
283
|
+
### Suggested Actions (for you)
|
|
284
|
+
- Review 2 knowledge card candidates from overnight research
|
|
285
|
+
- Approve experiment: context reduction via skill splitting
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
In our reference system, the nightly agent produced **134 commits across 11 nights** — evolving skills, running experiments, researching Claude Code updates, and archiving outdated patterns. All without any human input.
|
|
289
|
+
|
|
290
|
+
The nightly agent is what turns Homunculus from "a tool you use" into "a system that grows on its own."
|
|
291
|
+
|
|
292
|
+
See [docs/nightly-agent.md](docs/nightly-agent.md) for setup.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Real-World Results
|
|
297
|
+
|
|
298
|
+
Built and tested on a real personal AI assistant. In **15 days** (starting from zero):
|
|
299
|
+
|
|
300
|
+
| What evolved | Count | Details |
|
|
301
|
+
|-------------|-------|---------|
|
|
302
|
+
| Instincts | **168** | 84 active + 84 auto-archived (system prunes itself) |
|
|
303
|
+
| Skills | **7** | All 100% eval pass rate (93 test scenarios) |
|
|
304
|
+
| Subagents | **3** | Auto-extracted from repetitive main-thread patterns |
|
|
305
|
+
| Slash commands | **15** | Workflow automations (forge-dev, quality-gate, eval...) |
|
|
306
|
+
| Scripts | **19** | Session lifecycle, health checks, evolution reports |
|
|
307
|
+
| Hooks | **11** | Observation, compaction, quality gates |
|
|
308
|
+
| Rules | **6** | Core patterns, evolution system, knowledge management |
|
|
309
|
+
| Scheduled agents | **4** | Nightly heartbeat, Discord bridge, daily news, trading |
|
|
310
|
+
| ADRs | **8** | Architecture decision records |
|
|
311
|
+
| Experiments | **13** | Structured A/B tests with pass/fail tracking |
|
|
312
|
+
| Goal tree | **9 goals / 46+ sub-goals** | Each with health checks and metrics |
|
|
313
|
+
| Total commits | **1,235** | System iterates fast |
|
|
314
|
+
|
|
315
|
+
The nightly agent alone: **134 commits across 11 nights**.
|
|
316
|
+
|
|
317
|
+
[See the full reference implementation →](examples/reference/)
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## What Makes This Different
|
|
322
|
+
|
|
323
|
+
| | Homunculus | OpenClaw | Cursor Rules | Claude Memory |
|
|
324
|
+
|---|---|---|---|---|
|
|
325
|
+
| **Goal-driven** | Goal tree with metrics + health checks | No | No | No |
|
|
326
|
+
| **Learns from usage** | Auto-observation → instincts → skills | Skill generation | Manual | Auto-memory |
|
|
327
|
+
| **Quality control** | Eval specs + scenario tests | None | None | None |
|
|
328
|
+
| **Autonomous overnight** | Nightly agent: eval + improve + research + experiment | No | No | No |
|
|
329
|
+
| **Self-improving** | Eval → improve → replace loop | Partial | No | No |
|
|
330
|
+
| **Meta-evolution** | Evolution mechanism evolves itself | No | No | No |
|
|
331
|
+
| **Implementation agnostic** | Skills, agents, hooks, scripts, MCP, cron... | Skills only | Rules only | Memory only |
|
|
332
|
+
|
|
333
|
+
OpenClaw is great at generating skills on demand. Homunculus goes further: it decides *what* to improve based on goal health, *validates* improvements with evals, and does it all *autonomously* overnight. They solve different problems — OpenClaw is a power tool, Homunculus is an operating system for evolution.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## What Gets Generated
|
|
338
|
+
|
|
339
|
+
After `npx homunculus-code init`:
|
|
340
|
+
|
|
341
|
+
```
|
|
342
|
+
your-project/
|
|
343
|
+
├── architecture.yaml # Your goal tree (the brain)
|
|
344
|
+
├── homunculus/
|
|
345
|
+
│ ├── instincts/
|
|
346
|
+
│ │ ├── personal/ # Auto-extracted patterns
|
|
347
|
+
│ │ └── archived/ # Auto-pruned old patterns
|
|
348
|
+
│ ├── evolved/
|
|
349
|
+
│ │ ├── skills/ # Converged, tested knowledge
|
|
350
|
+
│ │ ├── agents/ # Specialized subagents
|
|
351
|
+
│ │ └── evals/ # Skill evaluation specs
|
|
352
|
+
│ └── experiments/ # A/B test tracking
|
|
353
|
+
├── .claude/
|
|
354
|
+
│ ├── rules/
|
|
355
|
+
│ │ └── evolution-system.md # How Claude should evolve
|
|
356
|
+
│ └── commands/
|
|
357
|
+
│ ├── eval-skill.md # /eval-skill
|
|
358
|
+
│ ├── improve-skill.md # /improve-skill
|
|
359
|
+
│ └── evolve.md # /evolve
|
|
360
|
+
└── scripts/
|
|
361
|
+
├── observe.sh # Observation hook
|
|
362
|
+
├── evaluate-session.js # Pattern extraction
|
|
363
|
+
└── prune-instincts.js # Automatic cleanup
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Advanced: Meta-Evolution
|
|
369
|
+
|
|
370
|
+
The evolution mechanism itself evolves:
|
|
371
|
+
|
|
372
|
+
- **Instinct survival rate** too low? → Automatically raise extraction thresholds
|
|
373
|
+
- **Eval discrimination** too low? → Add harder boundary scenarios
|
|
374
|
+
- **Skill convergence** too slow? → Adjust aggregation triggers
|
|
375
|
+
|
|
376
|
+
Tracked via three metrics:
|
|
377
|
+
1. `instinct_survival_rate` — % of instincts that survive 14 days
|
|
378
|
+
2. `skill_convergence` — time from first instinct to evolved skill
|
|
379
|
+
3. `eval_discrimination` — % of eval scenarios that actually distinguish between versions
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Requirements
|
|
384
|
+
|
|
385
|
+
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) v2.1.70+
|
|
386
|
+
- Node.js 18+
|
|
387
|
+
- macOS or Linux
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## FAQ
|
|
392
|
+
|
|
393
|
+
<details>
|
|
394
|
+
<summary><strong>Is this only for Claude Code?</strong></summary>
|
|
395
|
+
|
|
396
|
+
The concepts (goal tree, eval-driven evolution, replaceable implementations) are tool-agnostic. The current implementation targets Claude Code hooks and commands, but the core pipeline could be adapted to other AI harnesses.
|
|
397
|
+
</details>
|
|
398
|
+
|
|
399
|
+
<details>
|
|
400
|
+
<summary><strong>Does it cost extra API credits?</strong></summary>
|
|
401
|
+
|
|
402
|
+
The observation hook is lightweight (no API calls). Instinct extraction uses a short Claude call per session (~$0.01). The nightly agent is optional and budget-configurable.
|
|
403
|
+
</details>
|
|
404
|
+
|
|
405
|
+
<details>
|
|
406
|
+
<summary><strong>Can I use my existing CLAUDE.md and rules?</strong></summary>
|
|
407
|
+
|
|
408
|
+
Yes. `npx homunculus-code init` adds to your project without overwriting existing files. Your current setup becomes the starting point for evolution.
|
|
409
|
+
</details>
|
|
410
|
+
|
|
411
|
+
<details>
|
|
412
|
+
<summary><strong>How is this different from Claude Code's built-in memory?</strong></summary>
|
|
413
|
+
|
|
414
|
+
Claude's memory records facts. Homunculus evolves *behavior* — tested skills, automated hooks, specialized agents — all driven by goals you define, with quality gates that prevent regression.
|
|
415
|
+
</details>
|
|
416
|
+
|
|
417
|
+
<details>
|
|
418
|
+
<summary><strong>How does this compare to OpenClaw?</strong></summary>
|
|
419
|
+
|
|
420
|
+
OpenClaw is excellent at generating skills on demand — it's a powerful tool. Homunculus solves a different problem: autonomous, goal-directed evolution. It decides what needs improving (via goal health), validates improvements (via evals), and does the work overnight (via the nightly agent). You could use both — OpenClaw for on-demand skill generation, Homunculus for the autonomous evolution layer on top.
|
|
421
|
+
</details>
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Philosophy
|
|
426
|
+
|
|
427
|
+
> "Your AI assistant should be a seed, not a statue."
|
|
428
|
+
|
|
429
|
+
Stop spending your evenings tuning AI. Plant a seed, define your goals, and let it grow. The more you use it, the better it gets — and it tells you exactly how and why through eval scores, goal health checks, and morning reports.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Contributing
|
|
434
|
+
|
|
435
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
436
|
+
|
|
437
|
+
## License
|
|
438
|
+
|
|
439
|
+
MIT
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
**Built by [Javan](https://github.com/JavanC) and his self-evolving AI assistant.**
|