Skip to content

justrach/agentlab

Repository files navigation

AgentLab

Multi-agent scientific reasoning, from intuition to testable hypothesis.

Latest Release License Built with Zig MCP Compatible

One MCP server. 38 tools. Drop it into Claude Code, Codex, or Amp — get parallel agents,
hypothesis trajectories, and sandboxed compute without leaving your editor.

Quick Start · Hypothesis Engine · Real Output · All Tools · Architecture


Fork notice: Forked from DevSwarm at ca6f0d6. Shares the agent runtime, MCP protocol, and code intelligence engine. Adds the hypothesis trajectory engine, sandboxed compute, and science-oriented agent roles.


⚡ Quick Start

Install

# Option 1: grab a binary
# → https://github.com/justrach/agentlab/releases/latest

# Option 2: build from source (requires Zig 0.15.x)
git clone https://github.com/justrach/agentlab.git && cd agentlab
zig build

Connect — add to ~/.claude.json (or Codex/Amp equivalent):

{
  "mcpServers": {
    "agentlab": {
      "command": "/path/to/agentlab",
      "args": ["--mcp"],
      "env": { "REPO_PATH": "/path/to/your/repo" }
    }
  }
}

Run /mcp to verify — 38 tools light up.


🔬 Hypothesis Engine

The core of AgentLab. Give it a rough idea, get back a structured investigation.

run_hypothesis("Gravitational particle creation can explain the baryon asymmetry of the universe")

Six phases run in sequence (phases 1–3 in parallel), each a specialized agent:

Phase Role Job
0 Formalizer Map informal terms → formal math. Symbol tables, SDEs, assumptions.
1 Existence Prover Can this work at all? Prior evidence, theoretical bounds.
2 Constraint Closer Necessary conditions, boundary cases, parameter limits.
3 Gap Finder What's missing? Critical blockers vs minor uncertainties.
4 Mechanism Designer Design the concrete mechanism. Components, invariants, failure modes.
5 Deeper Connector Connect to broader landscape — analogies, implications, open directions.

Each phase writes findings.md + compute_*.py scripts to its directory. Each run is timestamped and isolated — previous runs are never touched. A trajectory.json records timing, model, backend, and I/O sizes for every phase.

hypothesis_workspace/
├── run_20260307_054700/
│   ├── findings.md                          # final synthesis
│   ├── trajectory.json                      # per-phase traces
│   ├── phase0_formalizer/
│   │   ├── findings.md                      # symbol table, SDEs
│   │   └── compute_0.py                     # verification script
│   ├── phase1_existence_prover/
│   │   └── compute_0.py
│   ├── phase2_constraint_closer/
│   │   ├── compute_0.py
│   │   └── compute_1.py
│   ├── phase3_gap_finder/
│   │   ├── compute_0.py
│   │   └── compute_1.py
│   ├── phase4_mechanism_designer/
│   │   ├── compute_0.py
│   │   └── compute_1.py
│   └── phase5_deeper_connector/
│       └── compute_0.py
├── run_20260307_061508/                     # next run, untouched
│   └── ...

When a phase produces Python scripts, AgentLab executes them in a sandbox and feeds results forward. The synthesizer gets both the math and the numerics.


🧪 Real Output: Dissipative Baryogenesis

This isn't a toy example. AgentLab produced a complete investigation of whether gravitational particle creation can explain the baryon asymmetry (η ≈ 6.1 × 10⁻¹⁰):

Phase What it found Scripts
0 Formalized the DAF (Dissipative Axion-like Field) coupled to trace anomaly. Symbol table, risk-neutral SDEs. compute_0.py
1 Prigogine formalism gives η ~ 10⁻⁴ (overproduction) — mechanism exists but needs tuning compute_0.py
2 QCD instanton f_B decomposition → η ~ 10⁻⁶⁹ at QCD epoch (Hubble friction kills it) compute_0.py compute_1.py
3 Traced every power of H — found the Γ_EW/H gap. Goldstone sector investigated. compute_0.py compute_1.py
4 Electroweak epoch works. Exact β ≈ 6 via bisection, first-principles ζ/s. 4 UV completion models verified. compute_0.py compute_1.py
5 Proved η is y_φ-independent in adiabatic regime → universal prediction compute_0.py

Result: η = 6.1 × 10⁻¹⁰ with natural parameters (β ≈ 6, M = 10 MeV, f_φ = 100 GeV). Read the full paper →


🔧 All 38 Tools

Category Tools
Science run_hypothesis
Agents run_agent · run_swarm · run_task · review_fix_loop · run_reviewer · run_explorer · run_zig_infra
Planning decompose_feature · get_project_state · get_next_task · prioritize_issues
Issues create_issue · update_issue · close_issue · get_issue · create_issues_batch · close_issues_batch · link_issues
Git create_branch · get_current_branch · commit_with_context · push_branch · recently_changed · git_history_for
PRs create_pr · get_pr_status · list_open_prs · merge_pr · get_pr_diff · review_pr_impact
Code Intel blast_radius · relevant_context · symbol_at · find_callers · find_callees · find_dependents
Config set_repo

⚙️ Architecture

┌──────────────────────────────────────────────┐
│   Your AI Assistant (Claude / Codex / Amp)   │
└──────────────────┬───────────────────────────┘
                   │ MCP (JSON-RPC 2.0, stdio)
                   ▼
┌──────────────────────────────────────────────┐
│              AgentLab Runtime                │
│                                              │
│  ┌──────────┐ ┌──────────┐ ┌─────────────┐  │
│  │Hypothesis│ │  Swarm   │ │ Code Graph  │  │
│  │ Engine   │ │  Engine  │ │   (PPR)     │  │
│  │ 6-phase  │ │ parallel │ │ blast_radius│  │
│  └────┬─────┘ └────┬─────┘ └──────┬──────┘  │
│       └─────────────┼──────────────┘         │
│              ┌──────┴──────┐                 │
│              │  Agent SDK  │                 │
│              │ Claude/Codex│                 │
│              └─────────────┘                 │
│  ┌──────────────────────────────────────┐    │
│  │ GitHub · Git · File I/O · Sandbox    │    │
│  └──────────────────────────────────────┘    │
└──────────────────────────────────────────────┘
  • Hypothesis Engine — 6-phase trajectory. Each phase gets a specialized prompt, reads prior findings, writes compute_*.py scripts. Full run traced in trajectory.json.
  • Swarm Engine — Parallel agent orchestration. Up to 100 workers via Zig threads.
  • Code Graph — Personalized PageRank over your call graph. Powers blast radius, caller/callee analysis, dependency-aware prioritization.

Contributing

Contributions welcome. Open an issue before large PRs.

git clone https://github.com/justrach/agentlab.git && cd agentlab
zig build test

License

MIT — see LICENSE

Changelog

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages