experiment
Run reproducible code trials to compare changes against a baseline, capture metrics and verdicts, and preserve the evidence as persistent memory.
Instructions
Measure ideas instead of arguing them: a tree of experiments with real runs.
WHEN TO USE: when a question can only be settled by running code - is this faster, more accurate, smaller, more stable - and the answer should outlive the session. Not for ordinary edits; use agit to checkpoint those. AFTER THIS: conclude() every result you judged, so it becomes a memory with its evidence attached.
Think of recipes. The baseline is the recipe you have and the one way you taste it (the command). Each experiment copies a recipe and changes one thing. You always taste the same way, you never scribble on a recipe you already tasted, and the next round starts from the winner.
The lab lives in .icn-lab/ (gitignored), fully separate from agit and from the user's .git. It enforces the rules rather than suggesting them:
One command for every experiment, fixed once anything is measured. Vary code and config on a child, never the command or env vars.
An experiment freezes once a run answers it. commit then refuses; put the next idea on a child. A crash answered nothing, so the node stays editable, but two unanswered failures in a row need force=True.
A run executes the committed snapshot in its own folder, never the editable checkout, and refuses while the checkout has uncommitted edits. Report results by printing lines like
ICN_METRIC loss=0.4312.
Grow the tree downward: siblings are the co-equal options of ONE decision; the next decision goes under that round's winner. tree() warns about a flat fan (everything under the root) and a noodle (a chain of one-child links).
Actions:
init create the lab. Snapshots the working tree as the baseline.
Needs command. title defaults to 'baseline'.
tree every experiment with its state, verdict, latest run and
metrics, the focal node, and tree-shape warnings.
create new experiment. Needs title; hypothesis is what you expect.
parent defaults to the focal node (latest winner, else the
baseline).
checkout a folder with the experiment's code, to edit. Returns path.
commit commit that folder onto the experiment. Refused when frozen.
diff the experiment's change against its parent, or against.
run launch a detached run of the committed code. Survives this
server exiting. timeout_seconds bounds it.
status one run (run=) or one experiment (exp=) in detail.
log a run's output. tail bytes from the end, or from offset.
wait block up to wait_seconds (max 600) until a run finishes.
Returns on the FIRST finish so you can judge it and refill.
cancel stop a run and everything it started.
runs recent runs, all or for one experiment.
conclude judge a finished run: verdict win | loss | inconclusive |
void. win, loss and inconclusive freeze the experiment and
write an ICN memory (decision, failed_attempt, rationale)
carrying the run's commit, command, exit code, metrics and
the change against the parent. win also promotes it. void
says the run answered nothing (needs note) and unfreezes.
promote make a measured experiment the parent for the next round.
apply bring a measured experiment's code into the working tree:
the whole lineage from the baseline, applied only if those
files still match the baseline. The memories describing
that lineage are re-verified against the new code, and any
other memory the change put under review is listed.
set_command change the command. Only before anything is measured.
It ties into the rest of ICN: a conclusion links to its parent's conclusion (LED_TO), so investigate(action='why') tells the story of how the code got here; caused_by= links it to what motivated it, such as a paper(action='remember') memory; workspace(action='open') lists finished runs still waiting for a verdict.
Read a run's log before concluding: status alone is not evidence.
Args: action: one of the actions above. exp: experiment id or slug. run: run id. title: for init and create. hypothesis: for init and create - the expected effect, in a sentence. parent: for create - experiment id or slug to branch from. command: for init and set_command. message: for commit. against: for diff - compare with this experiment instead of the parent. verdict: for conclude. note: for conclude - what the result means, in your own words. timeout_seconds: for run. 0 means no limit. wait_seconds: for wait. tail: for log - bytes to return. offset: for log - start byte instead of the tail. force: for run - launch past the consecutive-failure cap. limit: for runs. caused_by: for conclude - memory ids that motivated this experiment, e.g. the paper memory that suggested it. Same shape as record(). root: repository path. Defaults to the server's working directory.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "experiment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exp | No | ||
| run | No | ||
| note | No | ||
| root | No | ||
| tail | No | ||
| force | No | ||
| limit | No | ||
| title | No | ||
| action | No | tree | |
| offset | No | ||
| parent | No | ||
| against | No | ||
| command | No | ||
| message | No | ||
| verdict | No | ||
| caused_by | No | ||
| hypothesis | No | ||
| wait_seconds | No | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||