Skip to content

flyingrobots/enthropic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🫨 Enthropic: From Chaos, Code

[!note] Experimental: Under Construction This is something I've actively researching... I can't promise that it'll work, if you try it out, quite yet.

TL;DR

Pipeline:

  • Twelvefold Choir β€” spec/API/tests from 12 voices
  • Forge-12 β€” 12 rival implementations + Hybrid
  • A.P.E.S.H.I.T β€” Automated Polyvariant Exploration: Stochastic Heuristics & Iterative Tuning
  • Conductor β€” synth thresholds, patch Hybrid, ADR, rollback

Quickstart

npm i
scripts/apes-hit/bin/apeshit generate banana_budget=200 timeout_ms=400
scripts/apes-hit/bin/apeshit runner top_k=7
scripts/apes-hit/bin/apeshit synth
npx tsx scripts/enthropic-pipeline/patch-hybrid.ts
git add src/variants/hybrid.ts ADR.md
git commit -m "Enthropic synth: update breakpoints & route (auto)"

We were too busy asking "Can we?" We never stopped to consider "Should we?"

A polyvariant synthesis system that generates, battles, and fuses hundreds of code implementations to produce optimal hybrid solutions.

What is Enthropic?

Enthropic is a multi-agent orchestration system that treats code generation as an exploration problem.

Instead of writing one implementation, it generates dozens (or hundreds) of variants, tests them exhaustively, benchmarks them across different input regimes, and synthesizes a hybrid implementation that dynamically selects the optimal strategy at runtime.

Think of it as: Genetic algorithms meets superoptimization meets Test-Driven Development meets chaos engineering.

Why Enthropic?

Traditional development produces single implementations optimized for average cases. Enthropic produces adaptive implementations that:

  • Switch algorithms based on input size/shape
  • Maintain correctness through exhaustive testing
  • Discover non-obvious optimizations through controlled mutation
  • Document their own decision rationale
  • Include built-in rollback mechanisms

One Room. 1000 Monkeys. 1000 Typewriters.

If you put 1000 AIs in a room and let them go wild, do you really eventually get Shakespeare?

That's the core idea behind this project. A.P.E.S.H.I.T.: Automated Polyvariant Exploration: Stochastic Heuristics & Iterative Tuning.

πŸ’βŒ¨οΈ Let a thousand monkeys type. Let Darwin sort them out. ⚑🧬

A New Way To Code

This work opens the door to a different kind of development paradigm. Instead of writing one implementation, you wite one contract and let the system explore the implementation space.

Turn coding into a constraint satisfaction problem. Tests and benchmarks act as the constraints and gates.

🎭 The Cast

All the repo's a stage, And all the agents merely players, And one agent, in their time, plays many parts, This pipeline being four stages, and... some bananas. - Shakespeare, probably

πŸ§‘β€πŸ§’β€πŸ§’ Twelvefold Choir

First, 12 specialist voices (Architecture, Security, Performance, Database, etc.) that analyze requirements and produce comprehensive specifications. No single-lane answers allowed.

πŸ› οΈ Forge-12

Next, Forge-12 generates 12 deliberate architectural variants that all satisfy the same interface. Tests them identically, benchmarks them ruthlessly, then builds a hybrid that cherry-picks the best ideas.

πŸ’ Monkey Room

Then, things get genetic. Next, hundreds of stochastic variants are spawned through template permutation, parameter sweeps, and safe AST mutations. What the monkeys lack in elegance, they make up for in unexpected discoveries. Survival of the fittest.

🫨 Enthropic Conductor

Finally, the "Enthropic" orchestrator is man behind the curtain, running the full pipeline: Choir β†’ Forge β†’ Monkey β†’ Synthesis β†’ Production-ready release.


πŸš€ Quick Start

1. Clone & Install

# Install
git clone https://github.com/your-org/enthropic
cd enthropic
npm install

2. Expose the agents, scripts, and commands to your Claude Code Setup

Copy stuff to ~/.claude or your project's claude.

3. Run the full pipeline

Fire up Claude Code and go A.P.E.S.H.I.T.

@agent-enthropic-conductor
Task: Implement rate limiter with Redis backend. 
banana_budget: 400 
weights: perf=3,sec=2

πŸ“– Usage Examples

Basic: Let the Choir Plan

@agent-twelvefold-choir
Task: Replace console.log with structured logging across Next.js API routes.
budget: medium 
weights: sec=2,perf=2,obs=3

Advanced: Full A.P.E.S.H.I.T. Mode

# Generate variants
~/.claude/@lib/scripts/apes-hit/apeshit.ts generate banana_budget=500 timeout_ms=400

# Benchmark and rank
~/.claude/@lib/scripts/apes-hit/apeshit.ts runner top_k=10

# Synthesize hybrid with adaptive thresholds
~/.claude/@lib/scripts/apes-hit/apeshit.ts synth

Expert: Manual Pipeline Control

# Step 1: Architecture & Specification
@agent-twelvefold-choir
Task: LRU cache with TTL support

# Step 2: Generate competing implementations
@agent-forge-12
Task: Implement 12 LRU variants under Choir's interface

# Step 3: Unleash the monkeys
@agent-monkey-room
Task: Generate 400 variants, fuzz & bench
banana_budget: 400

# Step 4: Final synthesis
@agent-enthropic-conductor
Task: Build production hybrid with router thresholds

🧬 How It Works

graph TD
    A[Requirements] -->|Twelvefold Choir| B[Spec + Interface + Tests]
    B -->|Forge-12| C[12 Architectural Variants]
    C -->|Monkey Room| D[100s of Mutations]
    D -->|Benchmarks| E[Performance Matrix]
    E -->|Synthesis| F[Adaptive Hybrid]
    F -->|Validation| G[Production Release]
Loading

The Synthesis Algorithm

  • Correctness Gate: Only variants passing all tests proceed
  • Regime Analysis: Benchmark across input sizes/shapes (64B, 256B, 4KB, 64KB)
  • Threshold Discovery: Find crossover points where different algorithms win
  • Router Generation: Build runtime strategy selector with measured thresholds
  • Fallback Guarantee: Always include a boring-but-safe implementation

🎯 Core Principles

  • No unmeasured performance claims - If there's no benchmark, it didn't happen
  • Correctness is non-negotiable - All variants must pass all tests
  • Security beats speed - SEC voice has veto power
  • Deterministic fusion - Thresholds from data, not opinions
  • Always shippable - Every output includes tests, docs, rollback plan

πŸ”§ Configuration

// monkey.config.ts
export const cfg = {
  banana_budget: 256,      // variant population size
  max_generations: 2,      // evolution cycles
  timeout_ms: 250,        // per-variant execution cap
  mut_rate: 0.35,         // mutation probability
  regimes: [64, 256, 4096, 65536] // benchmark input sizes
}

Weight Overrides

Customize voice priorities per task:

textweights: perf=3,sec=2,cost=1 # Performance-critical weights: sec=5,rel=3 # Security-critical weights: cost=4,dx=2 # Budget-conscious

πŸ“Š Output Format

Every Enthropic run produces:

πŸ“ output/
β”œβ”€β”€ πŸ“„ plan.md              # Architectural decisions
β”œβ”€β”€ πŸ“ variants/            # All generated implementations
β”‚   β”œβ”€β”€ baseline.ts
β”‚   β”œβ”€β”€ variant_001.ts
β”‚   └── ...
β”œβ”€β”€ πŸ“„ hybrid.ts            # Final synthesized implementation
β”œβ”€β”€ πŸ“„ tests.spec.ts        # Shared test suite
β”œβ”€β”€ πŸ“„ bench.results.json   # Performance matrix
β”œβ”€β”€ πŸ“„ thresholds.json      # Router breakpoints
β”œβ”€β”€ πŸ“„ ADR.md              # Architecture Decision Record
└── πŸ“„ rollback.md         # Emergency procedures

🚨 Safety & Limitations

  • Variants execute in sandboxed VM contexts with timeouts
  • Not suitable for untrusted input without additional isolation
  • Mutation safety depends on test coverage quality
  • Resource intensive - budget accordingly

πŸ§ͺ Supported Mutations

// Safe AST transformations
toggleEarlyReturn    // Convert guards to early returns
inlineSmallFns      // Replace function calls with expressions  
unrollTinyLoops     // Unroll loops with small fixed bounds
swapIfElseToSwitch  // Convert if-chains to switch statements
// ... and growing

πŸŽ“ Philosophy

"The best code is not written, it's discovered. Enthropic doesn't pick winners - it builds champions from the DNA of hundreds of contenders."

Traditional development is a local search in solution space. Enthropic performs a broad exploration followed by principled synthesis. The result isn't just fast code - it's code that knows when to be fast and how to be safe.

πŸ“ˆ Benchmarks

Real-world results from production deployments:

Task Best Single Enthropic Hybrid Improvement
JSON Parser 1.2ms 0.3-1.1ms* 73% (small inputs)
Rate Limiter 15ΞΌs 8-14ΞΌs* 47% (p99)
Cache Lookup 120ns 95-115ns* 21% (average)

*Adaptive performance based on input characteristics


🀝 Contributing

We welcome contributions! Especially:

  • New mutators (see monkeys/mutators.ts)
  • Domain-specific voices for the Choir
  • Benchmark harness improvements
  • Real-world test cases

πŸ“œ License

MIT - Because great code wants to be free.


Built with chaos. Delivered with confidence. From the makers of "good enough" comes "optimal everywhere".