The Agent That Writes Itself
279 bot contributions, 25 named instances, 616 PRs in 6 months. How we built an agent orchestration framework that started contributing to its own codebase.
Felipe RosaMarch 16, 2026
Guide

The commit message that started everything said "initial commit." The one right after it said "doc updates." Then "checkpioint." Yes, with a typo.
That was September 27, 2025. Six months, 616 pull requests, and 25 specialized agent instances later, I'm staring at the contributor graph for automagik-genie and the second-largest contributor isn't a person. It's the framework itself.
The automagik-genie bot account has merged 279 contributions into its own codebase. That's 17% of all commits. The framework we built to orchestrate AI agents learned to contribute its own code, fix its own bugs, and ship its own releases.
This is the story of how we got here. Every decision, every wrong turn, everything we'd change.
The Problem That Wouldn't Stay Solved
In early 2025, we had agents everywhere. Claude Code sessions running in terminals. Custom scripts launching workers. YAML configs pointing at Python files pointing at bash wrappers. Every project at Namastex Labs had its own orchestration setup, and none of them talked to each other.
The pattern was always the same: spin up a new project, copy-paste the orchestration scaffolding from the last one, modify it until it barely works, ship it, move on. Three months later, come back to find the scaffolding has rotted because the model API changed.
We needed a framework. Not a library (too flexible, no opinions). Not a platform (too rigid, we'd fight it). A framework: opinionated enough to prevent mistakes, flexible enough that every project could be different.
We looked at what existed. LangChain was the obvious candidate, but it optimized for chain-of-thought pipelines, not multi-agent orchestration with persistent state. CrewAI had the right mental model (agents with roles) but locked you into their execution model. AutoGen was research-grade, not production-grade.
So we built our own. That was our first mistake. Also our best decision.
The First 48 Hours
I started automagik-genie on a Saturday morning. The commit history from that weekend tells the real story better than I can:
06:13 — initial commit
07:56 — doc updates
07:58 — doc updates
08:01 — gitignore
08:04 — upd claudemd
08:38 — docs: orchestrate Markdown; move research
09:51 — docs
09:54 — cleanup
10:21 — docs: record LEARN_FROM LiveKit decision
11:02 — cleanup
11:08 — genie
18:21 — chore: consolidate automagik framework prompts
18:35 — docs
18:54 — update
19:23 — upd
19:47 — upd
20:11 — upd
20:28 — upd
20:45 — checkpioint
Nine "upd" commits. One "checkpioint" with a typo. This is what building actually looks like before it becomes a talk at a conference. No architecture diagrams. No design docs approved by committee. Just a developer in a terminal, trying things, breaking things, committing everything because you're afraid of losing progress.
By Sunday night, the TypeScript conversion was done. By Monday, we had a working CLI. It was ugly, fragile, and exactly what we needed.
Three Decisions That Shaped Everything
Every framework is defined by three or four decisions made in the first month. Get those right and the rest flows. Get them wrong and you spend years working around them.
Decision 1: File path is identity.
Most frameworks use a registry. You define your agents in a config file, assign them IDs, register them at startup. Clean, explicit, familiar.
We did the opposite. In Genie, the file system IS the registry. Drop an AGENTS.md file in a directory and that directory becomes an agent workspace. The path is the identity. Zero configuration, zero registration, zero drift between what's registered and what exists.
This felt reckless at first. No validation layer, no schema enforcement. But it turned out to be our most important decision. When you need to add a new agent, you create a directory. When you need to remove one, you delete it. When you need to find all agents, you run ls. The file system is a database that every tool already knows how to query.
Decision 2: Worktree isolation.
The first version of Genie ran all agents in the same git workspace. Within a week, we had agents stepping on each other's changes. Agent A modifies config.yaml, Agent B modifies the same file, git explodes.
The fix: every agent task gets its own git worktree. Same repository, different working directory. Agents can work in parallel on different branches without merge conflicts. When the work is done, the worktree gets cleaned up.
This cost us two weeks of implementation and it saved us hundreds of hours of conflict resolution. The tradeoff: worktrees consume disk space and add complexity to the spawn lifecycle. We accepted that tradeoff in about ten minutes.
Decision 3: Three pluggable executors.
We didn't know which AI provider would be best for orchestration. Claude was our primary, but we were experimenting with Codex and Gemini for different tasks. So we made the executor layer pluggable. One YAML field switches between Claude, Codex, and custom executors.
This looked like over-engineering in September. By March, when we needed Claude for complex reasoning, Codex for code generation, and Gemini for code review, it was the reason the framework survived.
The Rule We Couldn't Follow
Amendment #3 in our AGENTS.md file reads: "Orchestration Boundary: Once Delegated, Never Duplicated."
The rule is simple. When you delegate a task to an agent, you stop. You don't also start implementing the same task in the main workspace. The orchestrator orchestrates. The worker works. Clean separation.
We have documented violations of this rule.
The temptation is real. You delegate a task, the agent is working on it, and you see something small you could fix in thirty seconds. So you fix it. Now you have two versions of the same change in two different workspaces, and git doesn't know which one wins. We call it the "just this once" trap, and we fell into it at least twice before writing the amendment.
Bug #572 in our issue tracker is titled: "Task leader edits code directly instead of dispatching workers." That's not a junior developer making a mistake. That's the team leader agent itself violating the framework's own rule. The agent we built to enforce orchestration boundaries was ignoring orchestration boundaries.
We fixed it. Then we wrote the amendment. Then we documented the violation in the amendment, as a reminder. The framework teaches discipline by failing spectacularly when you don't have it.
When the Bot Started Contributing
The first time automagik-genie (the bot) opened a PR, it was a formatting fix. Nothing interesting. The next few were similar: dependency bumps, CI tweaks, auto-generated changelogs.
Then it started getting substantive.
PR #605: "fix: auto-publish @next on dev merge, fix rolling PR history sync." This wasn't a formatting change. This was the bot identifying a gap in the release pipeline and fixing it. The commit message was clear, the code was correct, the PR passed review.
PR #614: "fix: pipe stdout in smart-install hook to prevent session crashes." This one diagnosed that execSync with stdio: 'inherit' was dumping output into Claude Code's protocol stream, corrupting it. The bot found the root cause, chose the right fix (['pipe', 'pipe', 'inherit']), and shipped it. Bug #612 closed.
I reviewed that PR and had a moment of genuine vertigo. The bot had debugged a streaming protocol corruption issue. Not by trying random things. By understanding the stdio inheritance model and choosing the precise override.
279 contributions later, the bot is the second-largest contributor to its own framework. 17% of all commits. It writes its own documentation, fixes its own bugs, and ships its own releases. 17 releases in a single day (March 16, 2026), most of them automated.
Isso nao e teoria. O agente contribui para o proprio codigo-fonte.
25 Genies and Counting
The framework was designed as a template. Install automagik-genie, run genie init, and you get a workspace with agent definitions, spells (reusable knowledge), and a CLI for orchestration. Every workspace is independent but shares the same DNA.
What we didn't expect was how fast they'd multiply.
Genie | Domain | Description |
|---|---|---|
Sky | GTM and Sales | Raphael's AI chief of staff |
Sofia | Project Management | Air traffic controller for tasks |
Jerry | Infrastructure | Juice router guardian |
Guga | Architecture | Father of the 2-agent council |
Helena | Client Ops | Enterprise deployment manager |
Ana | Quality | QA and testing orchestrator |
Totvs | ERP Integration | Domain-specific TOTVS agent |
Engeform | Construction | Construction industry POC |
Movecta | Logistics | N1 triage, Salesforce categorization |
KHAL | CX Platform | Enterprise customer experience agents |
25 genie workspaces across the organization, each one with its own personality, domain knowledge, and specialized capabilities. They share the framework core but diverge in everything else. Sky knows about sales pipelines. Jerry knows about infrastructure monitoring. Guga runs architectural review councils with multiple sub-agents debating design decisions.
The key insight: agents need context, not just code. A framework that only provides execution scaffolding is half the product. The other half is the knowledge management layer: spells (reusable knowledge), brain vaults (persistent memory), and the ability to teach an agent something once and have it remember across sessions.
What We Got Wrong
Three things we'd do differently if we started over tomorrow.
The skill system came too late. For the first three months, every agent's capabilities were defined inline in its AGENTS.md file. When we finally built the skill system (composable slash commands like /wish, /review, /fix), we had to migrate dozens of inline definitions. The skill framework should have been there from day one.
We underestimated the release pipeline. Our first release process was: bump version, push tag, hope npm publish works. By March, we had a pipeline that required four PRs in one day to stabilize (#605, #608, #609, #610). Idempotent releases, dist-tag retags, skip-ci coordination. We should have invested in this at v2, not v3.
Agent-to-agent communication was an afterthought. We built agents that could talk to humans through the CLI. We didn't build agents that could talk to each other until the team feature in v3. The protocol router, the message mailbox, the tmux-based injection system for non-native workers: all of this was retrofitted. In a production multi-agent system, inter-agent communication is the foundation, not a feature.
What We Got Right
Building on tmux. Every agent runs in a tmux session. This gives us process isolation, persistent sessions that survive disconnects, and the ability to inspect any agent's terminal at any time. It also means our framework works everywhere tmux works, which is everywhere.
Treating the framework as a product. automagik-genie is published on npm. You can install it with npm install -g automagik-genie@latest. It has a CLI (genie), documentation, releases, and a growing open-source community (257 stars, 36 forks). This discipline forced us to write proper abstractions instead of Namastex-specific hacks.
The Orchestrate, Never Implement rule. Despite our own violations, this boundary is the reason the framework works. The orchestrator defines intent. The worker delivers implementation. Clean separation means you can swap the worker (Claude for Codex, Codex for Gemini) without touching the orchestration layer.
The Numbers
Six months of building in public:
Metric | Count |
|---|---|
Total repos (namastexlabs) | 163 |
Genie instances | 25 |
Pull requests merged | 616+ |
Bot contributions | 279 (17%) |
Releases (v3, March 2026) | 17 in one day |
Human contributors | 6 |
Tests (genie-cli) | 386 passing |
npm stars | 257 |
From checkpioint to v3. From one repo to 25. From one developer in a terminal on a Saturday morning to a framework where the agents contribute to their own codebase.
The Meta-Lesson
The future of software development isn't developers writing code faster with AI. It's developers building systems that build.
Genie started as a CLI tool. Now it's a development philosophy: define intent, delegate to agents, review the output, improve the framework, repeat. The framework gets better with every cycle because the agents using it are also improving it.
The recursive loop is the point. Not as a parlor trick, but as a development methodology. Every bug the bot finds and fixes makes the framework more robust for the next human developer who installs it. Every human decision about architecture gets encoded into the agents' knowledge base, making the next generation of agent-contributed code better.
I still think about that first weekend. Eighteen hours of upd and checkpoint and a typo that lives forever in git history. The code from that weekend is gone, rewritten three times over. But the understanding of what we were building, and why, and for whom: that carried forward through every version.
Corpo leve. The framework matters more than any code it produces.
FAQ
What is the Genie framework?
Genie (automagik-genie) is an open-source AI agent orchestration framework built by Namastex Labs. It provides a CLI for managing multi-agent development workflows where agents run in isolated git worktrees, communicate through a protocol router, and can be composed using pluggable executors for different AI providers (Claude, Codex, Gemini). Install via npm install -g automagik-genie@latest.
How does Genie differ from LangChain or CrewAI?
Genie is designed for production multi-agent orchestration, not chain-of-thought pipelines. Key differences: file-path-as-identity (no registry needed), worktree isolation (agents work in parallel without git conflicts), pluggable executors (swap AI providers via one YAML field), and persistent agent workspaces with knowledge management.
What does the agent writes itself mean in practice?
The automagik-genie bot account has 279 contributions to the framework's own GitHub repository, making it the second-largest contributor (17% of all commits). The bot diagnoses bugs, writes fixes, ships releases, and generates documentation.
Can Genie be used outside Namastex Labs?
Yes. Genie is open source on GitHub (namastexlabs/automagik-genie, 257 stars) and published on npm. Run genie init to create a workspace, define agents via AGENTS.md files in directories, and use the CLI to orchestrate tasks.
What is the Orchestrate Never Implement principle?
A core rule in Genie's framework that separates the orchestration layer from the execution layer. The orchestrator (team lead) defines tasks and delegates them to worker agents. It never implements code directly.