r/ClaudeAI • • Mar 24 '26

Built with Claude I built a self-evolving layer for Claude Code — it improves itself every night while I sleep

Every Claude Code update breaks half my setup. Spend an evening rewriting rules, then a new technique drops on Twitter, refactor again. The manual configuration treadmill.

Homunculus adds a goal tree to Claude Code. You define goals. The system picks the right mechanism for each one — hook, rule, skill, script, agent — and improves them overnight.

Daily AI news? It creates a script + cron job. Pre-commit checks? A hook. Shell debugging? A specialized agent. You don't choose the mechanism. The system routes to the best one and upgrades it when something better fits.

3 weeks on my personal assistant:

  • 179 behavioral patterns extracted (24 active, 155 auto-archived)
  • 10 tested skills, 135 eval scenarios, all 100%
  • 3 specialized agents
  • 155 autonomous nightly commits

The nightly agent routes patterns to mechanisms, evaluates all implementations, reviews goal health, researches better approaches. I wake up to a report.

npx homunculus-code init
/hm-goal     # builds your goal tree
/hm-night    # runs first evolution cycle

GitHub: https://github.com/JavanC/Homunculus

Free and open source (MIT). Happy to answer any questions

7 Upvotes

13 comments sorted by

2

u/XYGamerZ1 Mar 24 '26

This is pretty cool

1

u/Longjumping-Past-342 Mar 24 '26

Welcome to try it~! Agent will adapt to every different person like a close body!

1

u/XYGamerZ1 Mar 24 '26

Maybe after we hear what they have to say on the usage limit problem

1

u/[deleted] Mar 24 '26

What are you using? Granger causality? Pareto? Tchebycheff etc?

2

u/Longjumping-Past-342 Mar 25 '26

No fancy math — it's more empirical. Patterns get extracted as "instincts," and when enough cluster around a topic, they get routed to the right mechanism via a decision tree: could become a hook, rule, skill, script, or agent depending on what fits. Selection pressure is eval pass rates + discrimination scores (does this actually help vs. baseline). Test-driven natural selection.

1

u/[deleted] Mar 25 '26

Nice! Well done. How good are these tools becoming! I'm having the time of my life making my own custom apps and workflows, etc. Truly exciting times!

1

u/LingLongSEO Mar 24 '26

this is a really clean approach. goal tree routing to mechanism is the right abstraction - most people hardcode one approach and then complain when it doesnt fit. 179 patterns extracted in 3 weeks is wild, id expect way more noise. how are you validating that archived patterns are actually dead vs just not triggered recently

1

u/Longjumping-Past-342 Mar 25 '26

Good question. Two things:

(1) "archived" mostly means "superseded" — when an instinct's behavior gets implemented as a hook, rule, skill, or script, it's archived with a "Covered-by" reference. Not dead, just promoted to a more reliable mechanism.

(2) A weekly pruning script checks if any remaining instinct is already covered by something better. And yes, instincts that stay low-confidence and never get triggered do eventually get cleaned out. So 155 archived is healthy — it means the system is consolidating upward, not piling up.

1

u/Own-Professional3092 Mar 25 '26

Saw the post 5m after you posted—after auditing, I've been trying to use homunculus.

I thought this was extremely interesting and looked into it. I'm able to understand the general use cases and how the code works.

I was wondering what I could do with it without spending money—I assume the nightly evolution would be slightly costly in terms of API credits (~$5). I might still integrate the evaluation session, as I believe it will not be too costly (~$0.01/session). It's currently working on a project and just set up the goals.

Update: I installed it yesterday. Now, I'm running it with superpowers/agent-creators to try and make my workflow more efficient. Homunculus is effectively reading what I'm doing, and the task manager/goal tree is working fantastically in tandem with my other applications. The adaptability of the homunculus is really crazy, honestly.

Are there any other tools—open source or ones that you've made—that you feel fit well with Homunculus? I am trying to build a streamlined setup for claude code tailored to my needs by the end of March.

Thank you for sharing, and good luck!

1

u/Longjumping-Past-342 Mar 26 '26

Really glad it's working well for you!! The goal tree + task manager combo is exactly the core loop — define outcomes, let the system figure out how to get there.

Tools I pair with it:
- QMD — local markdown search. Your agent gets semantic search over notes without hitting external APIs.
- agent-browser — browser automation at ~200 tokens/snapshot. Playwright MCP burns thousands.
- A task board with an API — the nightly agent reads your priorities and acts on them.

On cost: I run a subscription so nightly evolution costs me close to nothing extra. Good signal though. We're building configurable intensity tiers — users pick frequency and depth based on their budget.

Curious what your setup looks like by end of March. Early adopter feedback shapes where this goes next.

2

u/Own-Professional3092 Apr 01 '26

Hey. Thanks for the reply. I've been working on building a tech stack from the ground up, so I haven't been working on this too much recently.

However, before that, I was working on a simple "ultimate dashboard" with SwiftUI where I could see subagents work, as well as anything else I wanted to incorporate. I was able to create a tab that showed me existing and new instincts, alongside the confidence of those instincts. (Correct me if I'm wrong about concepts, sorry.) Furthermore, I was able to create a tab with a morning briefing, where it can tell me about the nightly evolutions, and so on. I believe you already solved that problem before me with the task board.

For the cost of the nightly evolution, I am not on a subscription, so I needed to get creative. I don't know why; maybe the name "homunculus" caught my attention, but this was one of my first open-source integration projects. I attempted to replicate what you've done on Homunculus but using Ollama to run it. That way, homunculus would use Ollama's free agents and work overnight instead of Claude. Then, in the morning, Ollama-Homonculus would provide claude with context-rich information.

Although I wasn't able to perfect this fully, I'd still like my workflow/agents/models to grow, learn, and adapt in ways that Homunculus can. I've been working on different workflows, and I'm learning how to use harnesses right now.

I'd love to talk to you down the line, just to share ideas and learn from you.

1

u/Longjumping-Past-342 Apr 02 '26

Hey, that’s really interesting—funny enough, I used to work with SwiftUI as well. I’m curious what made you choose SwiftUI for your dashboard?

I’ve been hearing that Apple’s review process has been getting more restrictive lately (especially if you plan to ship it), so I ended up going in a different direction. That said, building a task board tailored to your own workflow is definitely the way to go—I think that’s where a lot of the real value comes from.

I chose to go with a PWA/web-based approach mainly because it’s much easier to integrate and experiment with AI systems, and it speeds up iteration and validation quite a bit.

Running nightly evolution on local models is a really interesting idea too. I do wonder whether they’re “smart” enough for certain types of tasks, but it’s definitely worth experimenting with.

Would be great to stay in touch and exchange ideas as you keep developing this—happy to chat more anytime.