Ouroboros

ai, claude-code, agents, self-improvement, open-source

Claude Code that improves itself

Ouroboros runs silently in the background of every Claude Code session. When significant code changes happen, it debates itself โ€” Proposer/Critic/Judge โ€” and refines its own working rules based on what actually works.

No configuration. No commands. It just runs.


What it does

Debate Engine

Every significant code change triggers a three-way critique:

  1. Proposer โ€” makes the case for the approach
  2. Critic โ€” challenges it, finds weaknesses
  3. Judge โ€” synthesizes into a concrete recommendation

The outcome updates the adversarial rulebook. Better decisions compound over time.

Adversarial Rulebook

A self-modifying set of code quality rules. Rules that lead to good outcomes get reinforced. Rules that don’t get flagged for revision. The system learns what works in this codebase.

Amnesia Manager

Strategic memory compression. Ouroboros tracks what context is worth keeping across sessions and what can be safely dropped. Signal-to-noise stays high even in long-running projects.

Fork Manager

Parallel approach comparison. When there are multiple valid solutions, Ouroboros can spin up isolated forks, compare outcomes, and recommend the winner.


Installation

Ouroboros is installed per-project, not globally. It integrates with Claude Code’s settings system.

1
2
3
git clone https://github.com/headlessmode/ouroboros
cd ouroboros
python run_ouroboros.py --install /path/to/your/project

This:

  1. Copies the system prompt to .claude/
  2. Registers session hooks in .claude/settings.json
  3. Initializes state files in .ouroboros/

From that point on, every Claude Code session in that project has Ouroboros active.


Architecture

.ouroboros/
โ”œโ”€โ”€ config.json              # System bounds
โ”œโ”€โ”€ system_prompt.md         # Always-active context
โ”œโ”€โ”€ observer/                # Central state + task queue
โ”œโ”€โ”€ scripts/                 # Debate, rules, amnesia, forks
โ”œโ”€โ”€ debate/                  # Debate engine state
โ”œโ”€โ”€ adversarial/             # Self-improving critique rules
โ”œโ”€โ”€ amnesia/                 # Memory compression policies
โ”œโ”€โ”€ telemetry/               # Outcomes and metrics
โ””โ”€โ”€ forks/                   # Parallel strategy comparisons

Free and open source

Ouroboros is MIT licensed. Install it, fork it, modify it.

Development notes and architecture decisions documented at headlessmode.com/journal.

Source on GitHub โ†’