An autonomous hypothesis-driven research system for deep learning model and system optimization.
magic-machine is a research lead for empirical optimization work.
Give it an objective, for example, reduce Vision Transformer inference latency while preserving accuracy on NVIDIA AGX Orin, and it works through the research process:
- Understand the objective, metrics, guards, and constraints.
- The research lead forms falsifiable hypotheses; thestaff researcher challenges them.
- Cold executors run one experiment each, parallelized aggressively across free resources.
- The verifier checks measurements against artifacts, provenance, comparability, and noise.
- Results are kept, discarded, confirmed, or abandoned; findings shape the next cycle.
The system can continue working unattended for hours. You can drop in, inspect the evidence, redirect the research, or let it proceed.
The goal is not to automate a sequence of experiments. It is to automate the empirical research process.
Prerequisites: Claude Code, Kiseki (or adapt to any other experiment tracking tool), and Python 3 with PyYAML.
git clone <this repo> ~/src/magic-machine
cd ~/src/magic-machine
mkdir -p scripts && cp -n config/scripts/* scripts/ && chmod +x scripts/*
mkdir -p ~/.claude/skills ~/.claude/agents
for s in magic-machine experiment setup; do
ln -sfn "$PWD/skills/$s" ~/.claude/skills/"$s"
done
for a in executor verifier staff-researcher; do
ln -sf "$PWD/agents/$a.md" ~/.claude/agents/"$a.md"
done
Then, in an agent session:
Read skills/setup/SKILL.md and set this machine up.
Setup writes env.toml, hooks.py, and rules.md under ~/.config/magic-machine/ / ~/research/ and validates the installation with a smoke test.
cp -r templates/project ~/research/my-project
mkdir -p ~/research/my-project/{notes,state/decisions}
Define the research objective and evaluation criteria in project.toml:
schema = 1
name = "my-project"
objective = """
Optimize model inference performance while preserving accuracy.
"""
gates = []
constraints = [
"Must run on the target device at batch size 1",
"FP16 baseline must remain unchanged",
]
[[metric]]
measure = "median GPU latency in ms"
better = "lower"
target = 18.0
[[guard]]
measure = "validation accuracy"
relation = ">="
value = 0.90
Start from the research workspace:
cd ~/research
claude --dangerously-skip-permissions
Then:
/magic-machine Project: my-project. Run the pre-flight, then keep going unattended.
Interrupted runs resume cleanly: decisions and state live in files, not in chat.