Experiment
Use this skill for the main evidence-producing runs of the quest.
Interaction discipline
- Follow the shared interaction contract injected by the system prompt.
- For ordinary active work, prefer a concise progress update once work has crossed roughly 6 tool calls with a human-meaningful delta, and do not drift beyond roughly 12 tool calls or about 8 minutes without a user-visible update.
- Keep ordinary subtask completions concise. When a main experiment actually finishes or reaches a stage-significant checkpoint, upgrade to a richer
artifact.interact(kind='milestone', reply_mode='threaded', ...) report rather than another short progress line.
- That richer experiment-stage milestone report should normally cover: what run finished, the headline result versus baseline or expectation, the main caveat, and the exact recommended next action.
- That richer milestone report is still normally non-blocking. If the next route is already justified locally, continue automatically after reporting rather than idling for acknowledgment.
- If the active communication surface is QQ and QQ milestone media is enabled in config, a completed main experiment may attach one summary PNG to that richer milestone update.
- That PNG should be a connector-facing report chart, not a raw debug plot and not a draft paper figure.
- Do not auto-send every training curve, per-step plot, or intermediate slice image.
- Preferred connector-chart palettes are Morandi-like and restrained:
sage-clay: #E7E1D6, #B7A99A, #7F8F84 for the default QQ summary look
mist-stone: #F3EEE8, #D8D1C7, #8A9199 for conservative summaries
dust-rose: #F2E9E6, #D8C3BC, #B88C8C for secondary comparisons only
- Connector-facing chart requirements:
- white or near-white background
- low saturation, no neon colors
- one primary accent plus one neutral comparison color whenever possible
- simple legend, light grid, readable labels, and no dashboard clutter
- summarize only the evidence needed for the milestone
- Default chart choice:
- line chart for training / budget / step trends
- bar chart for a small number of categorical end-point comparisons
- point-range chart when uncertainty or seed spread matters
- If the figure encodes ordered magnitude, use a sequential muted palette; if it encodes signed delta around a reference, use a diverging muted palette with a neutral midpoint.
- Avoid rainbow / jet-like colormaps, 3D effects, and over-annotated dashboards.
- If the chart may later be reused in the paper, export a vector copy (
pdf or svg) alongside the connector png.
- If the figure matters beyond transient debugging, open
figure-polish/SKILL.md and follow its render-inspect-revise workflow before treating the image as final.
- If plotting in Python, reuse the fixed Morandi plotting starter from the system prompt rather than inventing a new bright style for each run.
- If the runtime starts an auto-continue turn with no new user message, continue from the current run state, logs, artifacts, and active requirements instead of replaying the previous user turn.
- Progress message templates are references only. Adapt to the actual context and vary wording so messages feel human, respectful, and non-robotic.
- If a threaded user reply arrives, interpret it relative to the latest experiment progress update before assuming the task changed completely.
- Hard execution rule: every terminal command in this stage must go through
bash_exec; do not use any other terminal path for smoke tests, real runs, Git, Python, package-manager, or file-inspection commands.
- Prefer
bash_exec for experiment commands so each run gets a durable session id, quest-local log folder, and later read/list/kill control.
- For meaningful long-running runs, include the estimated next reply time or next check-in window whenever it is defensible.
Tool discipline
- Do not use native
shell_command / command_execution in this skill.
- All smoke tests, real runs, shell, CLI, Python, bash, node, git, npm, uv, and environment work must go through
bash_exec(...).
- For git work inside the current quest repository or worktree, prefer
artifact.git(...) before raw shell git commands.
- If a scratch repository or isolated test environment is needed, create and drive it through
bash_exec(...), not native shell tools.
Stage purpose
The experiment stage should turn a selected idea into auditable evidence.
It should preserve the strongest old experiment-planning and execution discipline:
- define the run contract before execution
- keep the run comparable to baseline
- capture configs, commands, logs, and metrics
- report both success and failure honestly
- route the next action through an explicit decision
The experiment stage is not just "run code".
It is the stage that converts an idea contract into evidence that other stages can trust.
It is also the stage that should decide the next route once the measured result exists.
Within the user's explicit constraints, maximize valid evidence per unit time and compute.
Prefer equivalence-preserving efficiency upgrades first: larger safe batch size, mixed precision, gradient accumulation, dataloader workers, cache reuse, checkpoint resume, precomputed features, and smaller pilots.
If a proposed efficiency change alters optimization dynamics, effective budget, or baseline comparability, treat it as a real experiment change and record it as such.
Use references/evidence-ladder.md when deciding whether the current package is merely executable, solid enough to carry the main claim, or already in the stage where broader polish is justified.
Completing one main run is not quest completion.
After reporting the run, keep moving to iterate, analyze, write, or finalize unless a genuine blocking decision remains.
When the quest is algorithm-first, treat experiment as the execution surface of optimize, not as the terminal goal of the workflow.
After a measured result, the default next move is frontier review and optimize-side route selection rather than paper packaging.
Quick workflow
Treat this as the short run-order summary. The detailed run contract, execution rules, and recording rules remain in Workflow.
- Restate the selected idea in
1-2 sentences and confirm the baseline comparison contract.
- Before substantial code edits or the real main run, create
PLAN.md and CHECKLIST.md.
- Materialize or confirm a dedicated child
run/* branch/worktree for this main experiment line; one durable main experiment should map to one run branch and one Canvas node.
- Use
PLAN.md to lock the concrete run path, and use CHECKLIST.md as the living control surface while planning, implementing, pilot testing, running, and validating.
- Run a bounded smoke test or pilot before the real long run, then launch the real run with durable logging and monitor it through
bash_exec.
- Once the route is concrete, prefer one clean implementation pass, one bounded smoke or pilot run, and then one normal main run; retry only after a concrete failure, invalidity, or genuinely new evidence justifies another attempt.
- Revise the plan if implementation, comparability, runtime, or route assumptions change materially, and close each real main-run milestone with a concise
1-2 sentence summary that says what was tested, whether performance improved / worsened / stayed mixed, and the exact next action.
Non-negotiable rules
- Do not fabricate metrics, logs, claims, or improvement narratives.
- Do not introduce a new dataset or silently change splits or evaluation protocol.
- Do not change metric definitions or evaluation logic unless the change is explicitly justified and durably recorded.
- Do not stop after a quick sanity run if the agreed goal is a real experiment.
- Do not claim success before durable artifacts exist and the acceptance gate passes.
- Implement the claimed mechanism, not a convenient shortcut that changes the theory.
- Keep the baseline reference read-only.
- Avoid asking the user to fix the environment unless there is no credible agent-side path left.
- Do not record a durable main experiment from an idea branch, quest root branch, or paper branch as if that were the final result node; every durable main experiment should land on its own
run/* branch.
- After each
artifact.record_main_experiment(...), route from the measured result:
- if paper mode is enabled, decide whether to strengthen evidence, analyze, or write
- if paper mode is disabled, prefer iterate / revise-idea / branch over default writing
- In algorithm-first work, after each main run, return to
optimize or decision for frontier review before launching another large run.
Experiment mental guardrails
- Baseline reproduction is not wasted time; untrusted comparison is wasted time.
- Failed runs are still data when the delta and diagnosis are recorded clearly.
- Suspiciously good results deserve the same skepticism as obvious failures.
- Change less, learn more.
- If a retry does not add new evidence, it is budget burn rather than progress.
Use when
- a baseline is accepted
- an idea has been selected
- the evaluation contract is explicit
- the quest is ready for implementation and measurement
Do not use when
- the baseline gate is unresolved
- the idea stage still has unresolved tradeoffs
- the main need is writing or follow-up analysis rather than a main run
Preconditions and gate
Before a main run starts, confirm:
- selected idea or hypothesis
- baseline reference
- dataset and split
- primary metric
- stop condition
- resource budget
- dedicated
run/* target branch or isolated worktree for this exact main experiment
- exact output location
- required metric keys for acceptance
- minimal experiment and abandonment condition from the idea stage
If any of these are materially unknown, stop and resolve them through decision.
Required plan and checklist
Before substantial implementation work or a real main run, create a quest-visible PLAN.md and CHECKLIST.md.
- Use
references/main-experiment-plan-template.md as the canonical structure for PLAN.md.
- Use
references/main-experiment-checklist-template.md as the canonical structure for CHECKLIST.md.
PLAN.md should lead with the selected idea summarized in 1-2 sentences, put the user's explicit requirements and non-negotiable constraints first, and then make the run contract concrete: baseline and comparability rules, safe efficiency levers, code touchpoints, minimal code-change map, smoke / pilot path, full-run path, fallback options, monitoring and sleep rules, expected outputs, and a revision log.
CHECKLIST.md is the living execution list; update it during planning, implementation, smoke testing, main execution, validation, and every material route change.
- If the code path, comparability contract, runtime strategy, or execution route changes materially, revise
PLAN.md before spending more code or compute.
- The later
RUN.md, summary.md, and artifact payloads remain required outputs, but PLAN.md and CHECKLIST.md are the canonical planning-and-control surface before and during execution.
- Once
PLAN.md makes the implementation route concrete, do not keep reshaping code and commands speculatively. The normal default is one bounded smoke or pilot run and then one real run, with retries only after a documented failure, invalidity, or new evidence that changes the expected outcome.
Working-boundary rules
Only modify the active quest workspace for this experiment line.
- treat the accepted baseline workspace as read-only
- do not derive branch or worktree assumptions from guesswork
- keep all durable outputs inside the quest
- if the runtime gives an explicit worktree path, use it exactly
Resource and environment rules
- Follow the explicit resource assignment if one exists.
- If GPU assignment is explicit, respect it exactly and record it in the run manifest.
- Do not silently consume extra GPUs or broaden resource scope.
- Capture enough environment information that the run can later be reconstructed.
- If a new dependency appears necessary, record it as a risk and prefer a fallback if possible.
Truth sources
Use:
- idea-stage outputs
- baseline artifacts
- current codebase and configs
- recent decisions
- task and metric contract
- shell logs and generated outputs from the actual run
bash_exec session ids, progress markers, and exported logs from the actual run
- the selected idea handoff contract
- incident or failure-pattern memory from earlier runs
Do not claim run success without durable outputs.
Required durable outputs
A meaningful experiment pass should leave behind:
- a run directory under
artifacts/experiment/<run_id>/ or the quest-equivalent canonical location
artifact_manifest.json
run_manifest.json
metrics.json
metrics.md
summary.md
runlog.summary.md
- durable command, config, and log pointers
- exported shell log, typically
bash.log
- a run artifact with explicit deltas versus baseline
- a decision about what should happen next
Recommended additional files:
claim_validation.md
- environment snapshot files such as:
- Python version
- package freeze
- GPU info when applicable
- a live execution note or rolling run log when the experiment spans multiple implementation or execution steps
run_manifest.json should capture at least:
run_id
- quest / branch context
- baseline reference or commit
- full commands
- config paths and key resolved hyperparameters
- dataset identifier or version
- seeds
- environment snapshot paths
- start time, end time, and final status
If a command needed for environment capture is unavailable, record that gap in the manifest and summary.
Workflow
1. Define the run contract
Before implementation or execution, state:
run_id
- experiment tier:
auxiliary/dev or main/test
- research question
- null hypothesis
- alternative hypothesis
- hypothesis
- baseline id or variant
- metric targets
- expected changed files
- expected outputs
- stop condition
- compute or runtime budget
- minimal experiment
- abandonment condition
- strongest alternative hypothesis
- exact metric keys that will decide success or failure
Prefer to write this contract first in PLAN.md using references/main-experiment-plan-template.md, then keep the current execution state visible in CHECKLIST.md using references/main-experiment-checklist-template.md.
For substantial runs, also record the following seven experiment fields early and keep them updated during execution:
- research question
- research type
- research objective
- experimental setup
- experimental results
- experimental analysis
- experimental conclusions
If the run contract changes materially later, record the change durably.
Treat the run contract as a research question contract, not only an execution checklist.
Before coding, be able to explain:
- why this run is the best current route rather than the main alternatives
- what observation would count as a real answer to the research question
- what result would force a downgrade, retry, or route change
- what confounder would make the run non-comparable even if it finishes successfully
If multiple candidate experiment packages exist, prefer the one with the best balance of:
- technical feasibility
- research importance
- methodological rigor
Do not choose a package only because it sounds ambitious.
For paper-facing lines, default to this evidence ladder:
auxiliary/dev
- clarify parameters, settings, mechanisms, or diagnostics
main/test
- carry the core comparison the paper will rely on
minimum -> solid -> maximum
- first make the result executable and comparable
- then make it strong enough to carry the claim
- only then spend effort on broader supporting polish
2. Run a preflight check
Before editing or executing:
- confirm the dataset path, version, and split contract
- confirm the baseline metrics reference
- if durable state exposes
active_baseline_metric_contract_json, read that JSON file before planning commands or comparisons
- treat
active_baseline_metric_contract_json as the default authoritative baseline comparison contract unless you record a concrete reason to override it
- confirm the selected idea claim and code-level plan
- look up prior incidents or repeated failure patterns when available
- confirm output directories and naming
- confirm that the intended run still matches the current quest decision
If a repeated failure pattern already exists, apply the mitigation first and record that choice.
Also confirm before comparison work:
- the baseline verification is trustworthy enough
- the planned comparison still uses the same metric contract
- the metric keys and primary metric still match
active_baseline_metric_contract_json when that file is available
- every main experiment submission still covers all required baseline metric ids from
active_baseline_metric_contract_json; extra metrics are allowed, but missing required metrics are not
- the required baseline metrics still use the same evaluation code and metric definitions; if an extra evaluator is genuinely necessary, record it as supplementary output rather than replacing the canonical comparator
- if the run is
main/test and superiority is likely to be claimed, define the significance-testing plan before execution rather than after seeing the numbers
- if
Result/metric.md was used during the run, treat it as optional scratch memory only and reconcile it against the final submitted metrics before artifact.record_main_experiment(...)
Before you begin a substantial run, send a concise threaded artifact.interact(kind='progress', ...) update naming:
- the run contract you are about to execute
- the main evidence it is testing
- the expected durable outputs
- the next checkpoint for reporting back
2.1 Diagnostic mode trigger
Switch from ordinary execution mode into diagnosis mode when any of the following becomes true:
- two retries in a row add no new evidence or no interpretable delta
- the baseline gap is much larger than expected and the cause is unclear
- the metrics are suspiciously strong, suspiciously identical to baseline, or highly unstable
- logs, checkpoints, or intermediate outputs conflict with the claimed behavior
In diagnosis mode:
- stop brute-force retrying
- prefer the smallest discriminative test that can separate competing hypotheses
- resolve obvious environment or data-contract issues before launching another comparison run
- make the diagnosis goal explicit: explain the behavior, not just "try something else"
3. Confirm the execution workspace
The normal experiment workspace is the current active idea worktree returned by artifact.submit_idea(...).
- do not create a fresh manual branch for the main experiment unless recovery or debugging truly requires it
- implement and run inside the current active idea workspace
- if the idea package changes materially before execution, submit a new durable idea branch with
artifact.submit_idea(mode='create', lineage_intent='continue_line'|'branch_alternative', ...) instead of silently mutating the old node
- after a real main run finishes, record it with
artifact.record_main_experiment(...) before moving to analysis or writing
- once that durable main result exists, treat the branch as a fixed round node; a later new optimization round should usually compare foundations and create a new
continue_line child branch or branch_alternative sibling-like branch
- after
artifact.record_main_experiment(...), if QQ milestone media is enabled and the metrics are stable enough to summarize honestly, prefer one concise summary PNG over multiple attachments
4. Implement the minimum required change
Implementation rules:
- keep the change hypothesis-bound
- prefer small, explainable edits
- avoid unrelated cleanup during a main run
- record which files matter for later review
- preserve theory fidelity between the idea claim and the code change
- add robustness checks when the mechanism risks NaN, inf, or unstable behavior
- implement according to the current
PLAN.md instead of repeatedly improvising a new method after each small observation
- avoid repeated code churn between the smoke test and the real run unless the smoke test exposes a specific problem that the next change is meant to fix
Prefer to complete one experiment cleanly before expanding to the next, unless parallel execution is explicitly justified and isolated.
For substantial experiment packages, the default is one experiment at a time, with each one reaching a recoverable recorded state before the next begins.
Retry-delta discipline:
- unless the current state is completely non-executable, change only one major variable per retry
- if broader recovery is unavoidable, record exactly which layer changed: data, preprocessing, model, objective, optimization, evaluation, or environment
- before each retry, state the expected effect and the fastest falsification signal
- if the retry produced no interpretable delta, do not treat it as meaningful evidence about the underlying research hypothesis
5. Execute the run
Run with auditable commands and durable outputs.
Execution rules:
- use non-interactive commands
- prefer
bash_exec instead of ephemeral shell invocations
- use the intended dataset and split
- keep logs durable
- report progress for long runs
- avoid silent metric-definition changes
- do not drift away from
active_baseline_metric_contract_json silently when that file exists
- avoid silently changing the baseline comparison recipe
- run the full agreed evaluation, not only a smoke test
You may do a quick sanity run first, but if the stage goal is a real experiment you must continue to the real evaluation unless the run is blocked and recorded.
Pilot-before-scale rule:
- start with a bounded pilot when the modification is non-trivial
- use the pilot to catch implementation mistakes early
- record pilot outcomes explicitly
- do not mistake pilot success for final evidence
Incremental-recording rule:
- do not wait until the end to reconstruct the run from memory
- update the durable run note after:
- contract definition
- important code changes
- pilot validation
- full execution checkpoints
- post-run analysis
- update
CHECKLIST.md alongside those durable notes so the current execution frontier is obvious without replaying the whole log
- include timestamps when they materially help reconstruction
- preserve failed attempts, anomalies, and partial outcomes rather than overwriting them
Last-known-good rule:
- keep track of the most recent state that was executable, comparable, and explainable
- when a new attempt breaks that state, debug forward from the last-known-good point instead of stacking more speculative edits on top of the broken state
- if the last-known-good state is unclear, reconstruct it before spending more budget on new hypotheses
5.1 Long-running command protocol
For commands that may run longer than a few minutes:
- before the real long run, execute a bounded smoke test or pilot that validates command paths, outputs, and basic metrics
- once the smoke test passes, launch the real run with
bash_exec(mode='detach', ...) and normally leave timeout_seconds unset for that long run
- monitor through durable logs rather than only live terminal output
bash_exec(mode='read', id=...) returns the full rendered log when it is 2000 lines or fewer; for longer logs it returns the first 500 lines plus the last 1500 lines and a hint to inspect omitted sections with start and tail
- if the middle of a long saved log matters, inspect that omitted region with
bash_exec(mode='read', id=..., start=..., tail=...)
- use
bash_exec(mode='list') and bash_exec(mode='read', id=..., tail_limit=..., order='desc') to monitor or revisit managed commands while focusing on the newest evidence first
- after the first read, prefer
bash_exec(mode='read', id=..., after_seq=last_seen_seq, tail_limit=..., order='asc') so later checks only fetch new evidence
- if you need to recover ids or sanity-check the active session ordering, use
bash_exec(mode='history')
- launch important runs with a structured
comment such as {stage, goal, action, expected_signal, next_check}
- use
silent_seconds, progress_age_seconds, signal_age_seconds, and watchdog_overdue from bash_exec(mode='list'|'read', ...) as your default watchdog signals
- use an explicit wait-and-check loop such as:
- wait about
60s, then inspect logs
- wait about
120s, then inspect logs
- wait about
300s, then inspect logs
- wait about
600s, then inspect logs
- wait about
1800s, then inspect logs
- then keep checking about every
1800s while the run is still active
- if needed, use an explicit bounded wait such as
bash_exec(command='sleep 60', mode='await', timeout_seconds=70) or bash_exec(mode='await', id=..., timeout_seconds=...) between checks
- canonical sleep choice:
- if you only need wall-clock waiting between checks, use
bash_exec(command='sleep N', mode='await', timeout_seconds=N+buffer, ...)
- keep a real buffer on that sleep timeout; do not set
timeout_seconds exactly equal to N
- if you are waiting on an already running managed session, prefer
bash_exec(mode='await', id=..., timeout_seconds=...) instead of starting a new sleep command
- after every completed sleep / await cycle, inspect logs first; only send
artifact.interact(kind='progress', ...) when the user-visible state, frontier, blocker status, or ETA materially changed
- after the first meaningful signal and then at real checkpoints (e.g., completion, recovery, blocker, or a materially widened comparable surface), keep those progress updates going rather than waiting silently
- if the run is clearly invalid, wedged, or superseded, stop it with
bash_exec(mode='kill', id=..., wait=true, timeout_seconds=...); if it must die immediately, add force=true, record the reason, fix the issue, and relaunch cleanly
- do not report completion until logs and output files both confirm completion
Always preserve the managed bash_exec log and export it into the experiment artifact directory when the run artifact is written.
5.2 Progress marker protocol
Long loops should emit structured progress markers rather than noisy raw progress bars.
- use single-line JSON progress markers
- keep them throttled
- treat them as UI signals, not narrative prose
- do not paste raw progress lines into summaries
- when possible include
eta in seconds and next_reply_at or next_check_at so web/TUI can show the next expected update
If you control the code, prefer a throttled tqdm-style progress reporter for the run itself and pair it with concise structured __DS_PROGRESS__ lines when feasible so monitoring remains machine-readable.
6. Validate the outputs
After the run, verify:
- outputs correspond to the intended code/config
- metrics are complete and interpretable
- comparison to baseline is fair
- any failure mode or confounder is visible
- required metric keys are present and finite
- the result can be mapped back to the original claim
- the summary states a clear go or no-go recommendation
Create a durable claim-validation record that maps:
- claim
- metric key
- expected direction
- observed result
- verdict:
supported
refuted
inconclusive
Also verify baseline comparability before claiming deltas:
- was the baseline verification stable?
- was the evaluation path the same?
- are the compared metric keys identical?
- if the run is claim-carrying, are the significance results or uncertainty estimates strong enough for main-text use?
- do known caveats make the delta weaker than it first appears?
7. Record the run
Every meaningful main run must be recorded through artifact.record_main_experiment(...).
That call is responsible for writing:
experiments/main/<run_id>/RUN.md
experiments/main/<run_id>/RESULT.json
- the durable
run artifact payload
- baseline comparisons
- breakthrough status derived by the system
artifact.record_main_experiment(...) should include at least:
run_id
- title
- hypothesis
- setup
- execution
- results
- conclusion
- baseline reference
metrics_summary
metric_rows when available
- the metric contract actually used
- verdict
- evidence paths
- changed files
- relevant config paths when applicable
evaluation_summary with exactly these six fields:
takeaway
claim_update
baseline_relation
comparability
failure_mode
next_action
Use evaluation_summary as the short structured judgment layer on top of the longer narrative fields:
takeaway: one sentence the next reader can reuse directly
claim_update: strengthens, weakens, narrows, or neutral
baseline_relation: better, worse, mixed, or not_comparable
comparability: high, medium, or low
failure_mode: none, implementation, evaluation, environment, or direction
next_action: the immediate route such as continue, revise_idea, analysis_campaign, write, or stop
After artifact.record_main_experiment(...) succeeds, do not assume the same branch should absorb the next round by default.
Interpret the measured result first, then either:
- launch analysis from this branch, or
- compare candidate foundations and create the next child research branch
Use artifact.create_analysis_campaign(...) only when the extra slices have clear academic or claim-level value relative to their resource cost.
If the main need is simply to continue optimization from a measured result, prefer a new durable child idea branch instead of an expensive analysis package by reflex.
If the extra work should happen on an older durable branch rather than the current head, first switch the runtime back there with artifact.activate_branch(...), then launch the analysis campaign from that activated workspace.
When artifact.record_main_experiment(...) succeeds, send a richer threaded artifact.interact(kind='milestone', ...) update rather than a generic one-line progress ping.
Lead that milestone with a concise 1-2 sentence outcome summary before expanding into more detail.
That milestone should state:
- the research question that was tested
- the primary result and baseline delta
- whether the run supports, weakens, or leaves the idea inconclusive
- the main caveat or confidence note that still matters
- the exact recommended next move
Do not treat a main run as durably complete until artifact.record_main_experiment(...) succeeds.
Recommended per-run documentation fields:
- research question
- research type
- research objective
- experimental setup
- experimental results
- experimental analysis
- experimental conclusions
These seven fields should be progressively filled as the run advances, not only at final packaging time.
RUN.md should make it easy for later stages to answer:
- what changed?
- how can this run be reproduced?
- what are the main results?
- why did it work or fail?
- what should happen next?
When the run is analysis-heavy or meant to fill a writing evidence gap, prefer a structured summary with:
- research question
- research type
- objective and success criteria
- setup
- results
- analysis
- conclusion
Recording rules:
- record results incrementally, not only at the end
- include timestamps when helpful
- include failed attempts, partial runs, and unexpected outcomes
- do not leave placeholder sections for later if the information is already known
- report exactly what happened, not what you hoped would happen
8. Decide the next move
The experiment stage should normally end with one of:
- continue the current line
- branch a new line
- launch an analysis campaign
- move to writing
- reset or stop
Do not let the stage end without an explicit next direction.
If analysis is selected, record why the expected information gain is strong enough to justify the added compute, time, or annotation budget.
Run-quality rules
A credible main run should satisfy:
- comparable against baseline
- method change is knowable from code and config
- metric source is durable
- outcome can be explained by the intended intervention or its failure
- commands, configs, and seeds are reconstructable
- environment context is reconstructable
- frontend or later readers can trace code and diff context to command, logs, and metrics
If the result is confounded, say so directly.
Acceptance gate
Before marking the run complete, verify all of the following:
- all required baseline metric keys are present
- the reported comparison contract still matches
active_baseline_metric_contract_json when that file exists
- metric values are finite numbers
- claim-to-metric traceability is recorded
- run manifest includes exact command, config, seed, and environment snapshot
- the summary states go or no-go and why
- artifacts are sufficient for another stage to reconstruct the run
If these checks fail, record the run as partial or blocked rather than pretending it is complete.
Memory rules
Stage-start requirement:
- begin every experiment pass with
memory.list_recent(scope='quest', limit=5)
- then run at least one experiment-relevant
memory.search(...) before a new run, retry, or material execution change
- if several idea or experiment lines exist, narrow retrieval to the current
idea_id, branch, and run_id; do not casually reuse memory from another idea line unless you are explicitly comparing lines
Write to memory only when the lesson is reusable, such as:
- experiment failure patterns
- stable implementation lessons
- evaluation pitfalls
- validated mechanism scope and caveats
The canonical record of the run itself belongs in artifact, not only in memory.
Preferred memory usage:
- quest
ideas:
- the current idea contract and claim boundary
- quest
decisions:
- run-scope choices
- retry or branch decisions
- stop conditions that must not drift
- quest
episodes:
- failed runs
- debugging episodes
- suspicious-result investigations
- repeated infrastructure or resource failures
- quest
knowledge:
- validated mechanism scope
- evaluation caveats
- stable implementation lessons worth reusing in later runs of this quest
- global
knowledge:
- reusable debugging heuristics
- stable reproducibility lessons
- cross-quest experiment design playbooks
- global
templates:
- run-manifest patterns
- claim-validation templates
- experiment summary templates
Use tags to refine retrieval when helpful, for example:
stage:experiment
type:failure-pattern
type:metric-contract
type:claim-validation
topic:<mechanism>
When calling memory.write(...), pass tags as an array like ["stage:experiment", "type:failure-pattern", "topic:<mechanism>"], not as one comma-joined string.
Recommended read timing:
- before the first run:
- consult quest
ideas, decisions, and relevant knowledge
- before a retry:
- search quest
episodes first
- before changing execution strategy materially:
- after suspicious results:
- consult recent
episodes and stable debugging knowledge
Stage-end requirement:
- successful runs should leave at least one reusable knowledge note if the lesson generalizes
- failed or partial runs should leave an incident note when the failure pattern is reusable
- every experiment
memory.write(...) must state whether the outcome was success, partial, or failure
- every experiment
memory.write(...) should also include the current idea_id, branch, and run_id so later retrieval does not mix different experiment lines
Artifact rules
Typical artifact sequence:
- progress artifact for long runs
artifact.record_main_experiment(...) at main-run completion
- milestone or report artifact for major findings
- decision artifact to choose next stage
Preferred artifact choices:
- use
progress for long-running execution updates
- use
artifact.record_main_experiment(...) for each meaningful completed main experiment
- use
run for analysis slice records when artifact.record_analysis_slice(...) writes them
- use
report for:
- analysis-rich summaries
- suspicious-result investigations
- post-run interpretation
- use
milestone when a major stage checkpoint is reached
- use
decision for:
- continue
- branch
- analysis
- write
- reset
- stop
- use
approval when an explicit user approval is captured for an expensive or risky run change
Use artifact.checkpoint(...) when code evolution is meaningful and should be preserved in Git.
After a meaningful experiment checkpoint or completion, emit artifact.interact(kind='progress' | 'milestone', ...) so the user sees the concrete result and next step.
Failure and blocked handling
A failed main run is still useful if it is explained well.
Record:
- what was attempted
- where the failure occurred
- whether the failure is likely methodological or infrastructural
- what retry, branch, or reset is justified
- the single best next action
Prefer a primary failure type such as:
data_contract_mismatch
resource_exhausted
numeric_instability
implementation_bug
evaluation_pipeline_failure
external_dependency_blocked
direction_underperforming
Also classify the broader failure layer when possible:
- implementation
- evaluation
- environment
- direction
Do not collapse these into one bucket.
A direction should only be treated as failing when repeated, well-instrumented evidence still points to underperformance after implementation, evaluation, and environment explanations have been checked.
Blocked experiment states commonly include:
- missing baseline reference
- unknown metric contract
- environment failure
- run failed before producing metrics
- metrics produced but not comparable
When results are suspicious, such as identical to baseline, implausibly perfect, or inconsistent across repeats, diagnose systematically:
- fix the subset and seeds
- isolate preprocessing, tokenization, model init, training, and evaluation one by one
- compare intermediate outputs on the same inputs
- align inputs first, then outputs, then metrics
Default diagnosis loop:
- collect the concrete failure or anomaly cases
- identify the last-known-good comparable state
- define the smallest delta between working and broken states
- write
2-4 concrete hypotheses
- run the cheapest discriminative check before another full retry
Exit criteria
Exit the experiment stage once one of the following is durably true:
- a main run is completed and recorded
- the run failed and the blocker is durably recorded
- the next step is clearly
analysis-campaign, write, another experiment, or reset
1---2name: ds-experiment3description: Use when a quest is ready for a concrete implementation pass or a main experiment run tied to a selected idea and an accepted baseline.4license: MIT5---6
7# Experiment
8
9Use this skill for the main evidence-producing runs of the quest.
10
11## Interaction discipline
12
13- Follow the shared interaction contract injected by the system prompt.
14- For ordinary active work, prefer a concise progress update once work has crossed roughly 6 tool calls with a human-meaningful delta, and do not drift beyond roughly 12 tool calls or about 8 minutes without a user-visible update.
15- Keep ordinary subtask completions concise. When a main experiment actually finishes or reaches a stage-significant checkpoint, upgrade to a richer `artifact.interact(kind='milestone', reply_mode='threaded', ...)` report rather than another short progress line.
16- That richer experiment-stage milestone report should normally cover: what run finished, the headline result versus baseline or expectation, the main caveat, and the exact recommended next action.
17- That richer milestone report is still normally non-blocking. If the next route is already justified locally, continue automatically after reporting rather than idling for acknowledgment.
18- If the active communication surface is QQ and QQ milestone media is enabled in config, a completed main experiment may attach one summary PNG to that richer milestone update.
19- That PNG should be a connector-facing report chart, not a raw debug plot and not a draft paper figure.
20- Do not auto-send every training curve, per-step plot, or intermediate slice image.
21- Preferred connector-chart palettes are Morandi-like and restrained:
22 - `sage-clay`: `#E7E1D6`, `#B7A99A`, `#7F8F84` for the default QQ summary look
23 - `mist-stone`: `#F3EEE8`, `#D8D1C7`, `#8A9199` for conservative summaries
24 - `dust-rose`: `#F2E9E6`, `#D8C3BC`, `#B88C8C` for secondary comparisons only
25- Connector-facing chart requirements:
26 - white or near-white background
27 - low saturation, no neon colors
28 - one primary accent plus one neutral comparison color whenever possible
29 - simple legend, light grid, readable labels, and no dashboard clutter
30 - summarize only the evidence needed for the milestone
31- Default chart choice:
32 - line chart for training / budget / step trends
33 - bar chart for a small number of categorical end-point comparisons
34 - point-range chart when uncertainty or seed spread matters
35- If the figure encodes ordered magnitude, use a sequential muted palette; if it encodes signed delta around a reference, use a diverging muted palette with a neutral midpoint.
36- Avoid rainbow / jet-like colormaps, 3D effects, and over-annotated dashboards.
37- If the chart may later be reused in the paper, export a vector copy (`pdf` or `svg`) alongside the connector `png`.
38- If the figure matters beyond transient debugging, open `figure-polish/SKILL.md` and follow its render-inspect-revise workflow before treating the image as final.
39- If plotting in Python, reuse the fixed Morandi plotting starter from the system prompt rather than inventing a new bright style for each run.
40- If the runtime starts an auto-continue turn with no new user message, continue from the current run state, logs, artifacts, and active requirements instead of replaying the previous user turn.
41- Progress message templates are references only. Adapt to the actual context and vary wording so messages feel human, respectful, and non-robotic.
42- If a threaded user reply arrives, interpret it relative to the latest experiment progress update before assuming the task changed completely.
43- Hard execution rule: every terminal command in this stage must go through `bash_exec`; do not use any other terminal path for smoke tests, real runs, Git, Python, package-manager, or file-inspection commands.
44- Prefer `bash_exec` for experiment commands so each run gets a durable session id, quest-local log folder, and later `read/list/kill` control.
45- For meaningful long-running runs, include the estimated next reply time or next check-in window whenever it is defensible.
46
47## Tool discipline
48
49- **Do not use native `shell_command` / `command_execution` in this skill.**
50- **All smoke tests, real runs, shell, CLI, Python, bash, node, git, npm, uv, and environment work must go through `bash_exec(...)`.**
51- **For git work inside the current quest repository or worktree, prefer `artifact.git(...)` before raw shell git commands.**
52- **If a scratch repository or isolated test environment is needed, create and drive it through `bash_exec(...)`, not native shell tools.**
53
54## Stage purpose
55
56The experiment stage should turn a selected idea into auditable evidence.
57It should preserve the strongest old experiment-planning and execution discipline:
58
59- define the run contract before execution
60- keep the run comparable to baseline
61- capture configs, commands, logs, and metrics
62- report both success and failure honestly
63- route the next action through an explicit decision
64
65The experiment stage is not just "run code".
66It is the stage that converts an idea contract into evidence that other stages can trust.
67It is also the stage that should decide the next route once the measured result exists.
68Within the user's explicit constraints, maximize valid evidence per unit time and compute.
69Prefer equivalence-preserving efficiency upgrades first: larger safe batch size, mixed precision, gradient accumulation, dataloader workers, cache reuse, checkpoint resume, precomputed features, and smaller pilots.
70If a proposed efficiency change alters optimization dynamics, effective budget, or baseline comparability, treat it as a real experiment change and record it as such.
71
72Use `references/evidence-ladder.md` when deciding whether the current package is merely executable, solid enough to carry the main claim, or already in the stage where broader polish is justified.
73
74Completing one main run is not quest completion.
75After reporting the run, keep moving to iterate, analyze, write, or finalize unless a genuine blocking decision remains.
76
77When the quest is algorithm-first, treat `experiment` as the execution surface of `optimize`, not as the terminal goal of the workflow.
78After a measured result, the default next move is frontier review and optimize-side route selection rather than paper packaging.
79
80## Quick workflow
81
82Treat this as the short run-order summary. The detailed run contract, execution rules, and recording rules remain in `Workflow`.
83
841. Restate the selected idea in `1-2` sentences and confirm the baseline comparison contract.
852. Before substantial code edits or the real main run, create `PLAN.md` and `CHECKLIST.md`.
863. Materialize or confirm a dedicated child `run/*` branch/worktree for this main experiment line; one durable main experiment should map to one run branch and one Canvas node.
874. Use `PLAN.md` to lock the concrete run path, and use `CHECKLIST.md` as the living control surface while planning, implementing, pilot testing, running, and validating.
885. Run a bounded smoke test or pilot before the real long run, then launch the real run with durable logging and monitor it through `bash_exec`.
896. Once the route is concrete, prefer one clean implementation pass, one bounded smoke or pilot run, and then one normal main run; retry only after a concrete failure, invalidity, or genuinely new evidence justifies another attempt.
907. Revise the plan if implementation, comparability, runtime, or route assumptions change materially, and close each real main-run milestone with a concise `1-2` sentence summary that says what was tested, whether performance improved / worsened / stayed mixed, and the exact next action.
91
92## Non-negotiable rules
93
94- Do not fabricate metrics, logs, claims, or improvement narratives.
95- Do not introduce a new dataset or silently change splits or evaluation protocol.
96- Do not change metric definitions or evaluation logic unless the change is explicitly justified and durably recorded.
97- Do not stop after a quick sanity run if the agreed goal is a real experiment.
98- Do not claim success before durable artifacts exist and the acceptance gate passes.
99- Implement the claimed mechanism, not a convenient shortcut that changes the theory.
100- Keep the baseline reference read-only.
101- Avoid asking the user to fix the environment unless there is no credible agent-side path left.
102- Do not record a durable main experiment from an idea branch, quest root branch, or paper branch as if that were the final result node; every durable main experiment should land on its own `run/*` branch.
103- After each `artifact.record_main_experiment(...)`, route from the measured result:
104 - if paper mode is enabled, decide whether to strengthen evidence, analyze, or write
105 - if paper mode is disabled, prefer iterate / revise-idea / branch over default writing
106- In algorithm-first work, after each main run, return to `optimize` or `decision` for frontier review before launching another large run.
107
108## Experiment mental guardrails
109
110- Baseline reproduction is not wasted time; untrusted comparison is wasted time.
111- Failed runs are still data when the delta and diagnosis are recorded clearly.
112- Suspiciously good results deserve the same skepticism as obvious failures.
113- Change less, learn more.
114- If a retry does not add new evidence, it is budget burn rather than progress.
115
116## Use when
117
118- a baseline is accepted
119- an idea has been selected
120- the evaluation contract is explicit
121- the quest is ready for implementation and measurement
122
123## Do not use when
124
125- the baseline gate is unresolved
126- the idea stage still has unresolved tradeoffs
127- the main need is writing or follow-up analysis rather than a main run
128
129## Preconditions and gate
130
131Before a main run starts, confirm:
132
133- selected idea or hypothesis
134- baseline reference
135- dataset and split
136- primary metric
137- stop condition
138- resource budget
139- dedicated `run/*` target branch or isolated worktree for this exact main experiment
140- exact output location
141- required metric keys for acceptance
142- minimal experiment and abandonment condition from the idea stage
143
144If any of these are materially unknown, stop and resolve them through `decision`.
145
146## Required plan and checklist
147
148Before substantial implementation work or a real main run, create a quest-visible `PLAN.md` and `CHECKLIST.md`.
149
150- Use `references/main-experiment-plan-template.md` as the canonical structure for `PLAN.md`.
151- Use `references/main-experiment-checklist-template.md` as the canonical structure for `CHECKLIST.md`.
152- `PLAN.md` should lead with the selected idea summarized in `1-2` sentences, put the user's explicit requirements and non-negotiable constraints first, and then make the run contract concrete: baseline and comparability rules, safe efficiency levers, code touchpoints, minimal code-change map, smoke / pilot path, full-run path, fallback options, monitoring and sleep rules, expected outputs, and a revision log.
153- `CHECKLIST.md` is the living execution list; update it during planning, implementation, smoke testing, main execution, validation, and every material route change.
154- If the code path, comparability contract, runtime strategy, or execution route changes materially, revise `PLAN.md` before spending more code or compute.
155- The later `RUN.md`, `summary.md`, and artifact payloads remain required outputs, but `PLAN.md` and `CHECKLIST.md` are the canonical planning-and-control surface before and during execution.
156- Once `PLAN.md` makes the implementation route concrete, do not keep reshaping code and commands speculatively. The normal default is one bounded smoke or pilot run and then one real run, with retries only after a documented failure, invalidity, or new evidence that changes the expected outcome.
157
158## Working-boundary rules
159
160Only modify the active quest workspace for this experiment line.
161
162- treat the accepted baseline workspace as read-only
163- do not derive branch or worktree assumptions from guesswork
164- keep all durable outputs inside the quest
165- if the runtime gives an explicit worktree path, use it exactly
166
167## Resource and environment rules
168
169- Follow the explicit resource assignment if one exists.
170- If GPU assignment is explicit, respect it exactly and record it in the run manifest.
171- Do not silently consume extra GPUs or broaden resource scope.
172- Capture enough environment information that the run can later be reconstructed.
173- If a new dependency appears necessary, record it as a risk and prefer a fallback if possible.
174
175## Truth sources
176
177Use:
178
179- idea-stage outputs
180- baseline artifacts
181- current codebase and configs
182- recent decisions
183- task and metric contract
184- shell logs and generated outputs from the actual run
185- `bash_exec` session ids, progress markers, and exported logs from the actual run
186- the selected idea handoff contract
187- incident or failure-pattern memory from earlier runs
188
189Do not claim run success without durable outputs.
190
191## Required durable outputs
192
193A meaningful experiment pass should leave behind:
194
195- a run directory under `artifacts/experiment/<run_id>/` or the quest-equivalent canonical location
196- `artifact_manifest.json`
197- `run_manifest.json`
198- `metrics.json`
199- `metrics.md`
200- `summary.md`
201- `runlog.summary.md`
202- durable command, config, and log pointers
203- exported shell log, typically `bash.log`
204- a run artifact with explicit deltas versus baseline
205- a decision about what should happen next
206
207Recommended additional files:
208
209- `claim_validation.md`
210- environment snapshot files such as:
211 - Python version
212 - package freeze
213 - GPU info when applicable
214- a live execution note or rolling run log when the experiment spans multiple implementation or execution steps
215
216`run_manifest.json` should capture at least:
217
218- `run_id`
219- quest / branch context
220- baseline reference or commit
221- full commands
222- config paths and key resolved hyperparameters
223- dataset identifier or version
224- seeds
225- environment snapshot paths
226- start time, end time, and final status
227
228If a command needed for environment capture is unavailable, record that gap in the manifest and summary.
229
230## Workflow
231
232### 1. Define the run contract
233
234Before implementation or execution, state:
235
236- `run_id`
237- experiment tier: `auxiliary/dev` or `main/test`
238- research question
239- null hypothesis
240- alternative hypothesis
241- hypothesis
242- baseline id or variant
243- metric targets
244- expected changed files
245- expected outputs
246- stop condition
247- compute or runtime budget
248- minimal experiment
249- abandonment condition
250- strongest alternative hypothesis
251- exact metric keys that will decide success or failure
252
253Prefer to write this contract first in `PLAN.md` using `references/main-experiment-plan-template.md`, then keep the current execution state visible in `CHECKLIST.md` using `references/main-experiment-checklist-template.md`.
254
255For substantial runs, also record the following seven experiment fields early and keep them updated during execution:
256
2571. research question
2582. research type
2593. research objective
2604. experimental setup
2615. experimental results
2626. experimental analysis
2637. experimental conclusions
264
265If the run contract changes materially later, record the change durably.
266
267Treat the run contract as a research question contract, not only an execution checklist.
268Before coding, be able to explain:
269
270- why this run is the best current route rather than the main alternatives
271- what observation would count as a real answer to the research question
272- what result would force a downgrade, retry, or route change
273- what confounder would make the run non-comparable even if it finishes successfully
274
275If multiple candidate experiment packages exist, prefer the one with the best balance of:
276
277- technical feasibility
278- research importance
279- methodological rigor
280
281Do not choose a package only because it sounds ambitious.
282
283For paper-facing lines, default to this evidence ladder:
284
285- `auxiliary/dev`
286 - clarify parameters, settings, mechanisms, or diagnostics
287- `main/test`
288 - carry the core comparison the paper will rely on
289- `minimum -> solid -> maximum`
290 - first make the result executable and comparable
291 - then make it strong enough to carry the claim
292 - only then spend effort on broader supporting polish
293
294### 2. Run a preflight check
295
296Before editing or executing:
297
298- confirm the dataset path, version, and split contract
299- confirm the baseline metrics reference
300- if durable state exposes `active_baseline_metric_contract_json`, read that JSON file before planning commands or comparisons
301- treat `active_baseline_metric_contract_json` as the default authoritative baseline comparison contract unless you record a concrete reason to override it
302- confirm the selected idea claim and code-level plan
303- look up prior incidents or repeated failure patterns when available
304- confirm output directories and naming
305- confirm that the intended run still matches the current quest decision
306
307If a repeated failure pattern already exists, apply the mitigation first and record that choice.
308
309Also confirm before comparison work:
310
311- the baseline verification is trustworthy enough
312- the planned comparison still uses the same metric contract
313- the metric keys and primary metric still match `active_baseline_metric_contract_json` when that file is available
314- every main experiment submission still covers all required baseline metric ids from `active_baseline_metric_contract_json`; extra metrics are allowed, but missing required metrics are not
315- the required baseline metrics still use the same evaluation code and metric definitions; if an extra evaluator is genuinely necessary, record it as supplementary output rather than replacing the canonical comparator
316- if the run is `main/test` and superiority is likely to be claimed, define the significance-testing plan before execution rather than after seeing the numbers
317- if `Result/metric.md` was used during the run, treat it as optional scratch memory only and reconcile it against the final submitted metrics before `artifact.record_main_experiment(...)`
318
319Before you begin a substantial run, send a concise threaded `artifact.interact(kind='progress', ...)` update naming:
320
321- the run contract you are about to execute
322- the main evidence it is testing
323- the expected durable outputs
324- the next checkpoint for reporting back
325
326### 2.1 Diagnostic mode trigger
327
328Switch from ordinary execution mode into diagnosis mode when any of the following becomes true:
329
330- two retries in a row add no new evidence or no interpretable delta
331- the baseline gap is much larger than expected and the cause is unclear
332- the metrics are suspiciously strong, suspiciously identical to baseline, or highly unstable
333- logs, checkpoints, or intermediate outputs conflict with the claimed behavior
334
335In diagnosis mode:
336
337- stop brute-force retrying
338- prefer the smallest discriminative test that can separate competing hypotheses
339- resolve obvious environment or data-contract issues before launching another comparison run
340- make the diagnosis goal explicit: explain the behavior, not just "try something else"
341
342### 3. Confirm the execution workspace
343
344The normal experiment workspace is the current active idea worktree returned by `artifact.submit_idea(...)`.
345
346- do not create a fresh manual branch for the main experiment unless recovery or debugging truly requires it
347- implement and run inside the current active idea workspace
348- if the idea package changes materially before execution, submit a new durable idea branch with `artifact.submit_idea(mode='create', lineage_intent='continue_line'|'branch_alternative', ...)` instead of silently mutating the old node
349- after a real main run finishes, record it with `artifact.record_main_experiment(...)` before moving to analysis or writing
350- once that durable main result exists, treat the branch as a fixed round node; a later new optimization round should usually compare foundations and create a new `continue_line` child branch or `branch_alternative` sibling-like branch
351- after `artifact.record_main_experiment(...)`, if QQ milestone media is enabled and the metrics are stable enough to summarize honestly, prefer one concise summary PNG over multiple attachments
352
353### 4. Implement the minimum required change
354
355Implementation rules:
356
357- keep the change hypothesis-bound
358- prefer small, explainable edits
359- avoid unrelated cleanup during a main run
360- record which files matter for later review
361- preserve theory fidelity between the idea claim and the code change
362- add robustness checks when the mechanism risks NaN, inf, or unstable behavior
363- implement according to the current `PLAN.md` instead of repeatedly improvising a new method after each small observation
364- avoid repeated code churn between the smoke test and the real run unless the smoke test exposes a specific problem that the next change is meant to fix
365
366Prefer to complete one experiment cleanly before expanding to the next, unless parallel execution is explicitly justified and isolated.
367For substantial experiment packages, the default is one experiment at a time, with each one reaching a recoverable recorded state before the next begins.
368
369Retry-delta discipline:
370
371- unless the current state is completely non-executable, change only one major variable per retry
372- if broader recovery is unavoidable, record exactly which layer changed: data, preprocessing, model, objective, optimization, evaluation, or environment
373- before each retry, state the expected effect and the fastest falsification signal
374- if the retry produced no interpretable delta, do not treat it as meaningful evidence about the underlying research hypothesis
375
376### 5. Execute the run
377
378Run with auditable commands and durable outputs.
379
380Execution rules:
381
382- use non-interactive commands
383- prefer `bash_exec` instead of ephemeral shell invocations
384- use the intended dataset and split
385- keep logs durable
386- report progress for long runs
387- avoid silent metric-definition changes
388- do not drift away from `active_baseline_metric_contract_json` silently when that file exists
389- avoid silently changing the baseline comparison recipe
390- run the full agreed evaluation, not only a smoke test
391
392You may do a quick sanity run first, but if the stage goal is a real experiment you must continue to the real evaluation unless the run is blocked and recorded.
393
394Pilot-before-scale rule:
395
396- start with a bounded pilot when the modification is non-trivial
397- use the pilot to catch implementation mistakes early
398- record pilot outcomes explicitly
399- do not mistake pilot success for final evidence
400
401Incremental-recording rule:
402
403- do not wait until the end to reconstruct the run from memory
404- update the durable run note after:
405 - contract definition
406 - important code changes
407 - pilot validation
408 - full execution checkpoints
409 - post-run analysis
410- update `CHECKLIST.md` alongside those durable notes so the current execution frontier is obvious without replaying the whole log
411- include timestamps when they materially help reconstruction
412- preserve failed attempts, anomalies, and partial outcomes rather than overwriting them
413
414Last-known-good rule:
415
416- keep track of the most recent state that was executable, comparable, and explainable
417- when a new attempt breaks that state, debug forward from the last-known-good point instead of stacking more speculative edits on top of the broken state
418- if the last-known-good state is unclear, reconstruct it before spending more budget on new hypotheses
419
420### 5.1 Long-running command protocol
421
422For commands that may run longer than a few minutes:
423
424- before the real long run, execute a bounded smoke test or pilot that validates command paths, outputs, and basic metrics
425- once the smoke test passes, launch the real run with `bash_exec(mode='detach', ...)` and normally leave `timeout_seconds` unset for that long run
426- monitor through durable logs rather than only live terminal output
427- `bash_exec(mode='read', id=...)` returns the full rendered log when it is 2000 lines or fewer; for longer logs it returns the first 500 lines plus the last 1500 lines and a hint to inspect omitted sections with `start` and `tail`
428- if the middle of a long saved log matters, inspect that omitted region with `bash_exec(mode='read', id=..., start=..., tail=...)`
429- use `bash_exec(mode='list')` and `bash_exec(mode='read', id=..., tail_limit=..., order='desc')` to monitor or revisit managed commands while focusing on the newest evidence first
430- after the first read, prefer `bash_exec(mode='read', id=..., after_seq=last_seen_seq, tail_limit=..., order='asc')` so later checks only fetch new evidence
431- if you need to recover ids or sanity-check the active session ordering, use `bash_exec(mode='history')`
432- launch important runs with a structured `comment` such as `{stage, goal, action, expected_signal, next_check}`
433- use `silent_seconds`, `progress_age_seconds`, `signal_age_seconds`, and `watchdog_overdue` from `bash_exec(mode='list'|'read', ...)` as your default watchdog signals
434- use an explicit wait-and-check loop such as:
435 - wait about `60s`, then inspect logs
436 - wait about `120s`, then inspect logs
437 - wait about `300s`, then inspect logs
438 - wait about `600s`, then inspect logs
439 - wait about `1800s`, then inspect logs
440 - then keep checking about every `1800s` while the run is still active
441- if needed, use an explicit bounded wait such as `bash_exec(command='sleep 60', mode='await', timeout_seconds=70)` or `bash_exec(mode='await', id=..., timeout_seconds=...)` between checks
442- canonical sleep choice:
443 - if you only need wall-clock waiting between checks, use `bash_exec(command='sleep N', mode='await', timeout_seconds=N+buffer, ...)`
444 - keep a real buffer on that sleep timeout; do not set `timeout_seconds` exactly equal to `N`
445 - if you are waiting on an already running managed session, prefer `bash_exec(mode='await', id=..., timeout_seconds=...)` instead of starting a new sleep command
446- after every completed sleep / await cycle, inspect logs first; only send `artifact.interact(kind='progress', ...)` when the user-visible state, frontier, blocker status, or ETA materially changed
447- after the first meaningful signal and then at real checkpoints (e.g., completion, recovery, blocker, or a materially widened comparable surface), keep those progress updates going rather than waiting silently
448- if the run is clearly invalid, wedged, or superseded, stop it with `bash_exec(mode='kill', id=..., wait=true, timeout_seconds=...)`; if it must die immediately, add `force=true`, record the reason, fix the issue, and relaunch cleanly
449- do not report completion until logs and output files both confirm completion
450
451Always preserve the managed `bash_exec` log and export it into the experiment artifact directory when the run artifact is written.
452
453### 5.2 Progress marker protocol
454
455Long loops should emit structured progress markers rather than noisy raw progress bars.
456
457- use single-line JSON progress markers
458- keep them throttled
459- treat them as UI signals, not narrative prose
460- do not paste raw progress lines into summaries
461- when possible include `eta` in seconds and `next_reply_at` or `next_check_at` so web/TUI can show the next expected update
462
463If you control the code, prefer a throttled `tqdm`-style progress reporter for the run itself and pair it with concise structured `__DS_PROGRESS__` lines when feasible so monitoring remains machine-readable.
464
465### 6. Validate the outputs
466
467After the run, verify:
468
469- outputs correspond to the intended code/config
470- metrics are complete and interpretable
471- comparison to baseline is fair
472- any failure mode or confounder is visible
473- required metric keys are present and finite
474- the result can be mapped back to the original claim
475- the summary states a clear go or no-go recommendation
476
477Create a durable claim-validation record that maps:
478
479- claim
480- metric key
481- expected direction
482- observed result
483- verdict:
484 - `supported`
485 - `refuted`
486 - `inconclusive`
487
488Also verify baseline comparability before claiming deltas:
489
490- was the baseline verification stable?
491- was the evaluation path the same?
492- are the compared metric keys identical?
493- if the run is claim-carrying, are the significance results or uncertainty estimates strong enough for main-text use?
494- do known caveats make the delta weaker than it first appears?
495
496### 7. Record the run
497
498Every meaningful main run must be recorded through `artifact.record_main_experiment(...)`.
499
500That call is responsible for writing:
501
502- `experiments/main/<run_id>/RUN.md`
503- `experiments/main/<run_id>/RESULT.json`
504- the durable `run` artifact payload
505- baseline comparisons
506- breakthrough status derived by the system
507
508`artifact.record_main_experiment(...)` should include at least:
509
510- `run_id`
511- title
512- hypothesis
513- setup
514- execution
515- results
516- conclusion
517- baseline reference
518- `metrics_summary`
519- `metric_rows` when available
520- the metric contract actually used
521- verdict
522- evidence paths
523- changed files
524- relevant config paths when applicable
525- `evaluation_summary` with exactly these six fields:
526 - `takeaway`
527 - `claim_update`
528 - `baseline_relation`
529 - `comparability`
530 - `failure_mode`
531 - `next_action`
532
533Use `evaluation_summary` as the short structured judgment layer on top of the longer narrative fields:
534
535- `takeaway`: one sentence the next reader can reuse directly
536- `claim_update`: `strengthens`, `weakens`, `narrows`, or `neutral`
537- `baseline_relation`: `better`, `worse`, `mixed`, or `not_comparable`
538- `comparability`: `high`, `medium`, or `low`
539- `failure_mode`: `none`, `implementation`, `evaluation`, `environment`, or `direction`
540- `next_action`: the immediate route such as `continue`, `revise_idea`, `analysis_campaign`, `write`, or `stop`
541
542After `artifact.record_main_experiment(...)` succeeds, do not assume the same branch should absorb the next round by default.
543Interpret the measured result first, then either:
544
545- launch analysis from this branch, or
546- compare candidate foundations and create the next child research branch
547
548Use `artifact.create_analysis_campaign(...)` only when the extra slices have clear academic or claim-level value relative to their resource cost.
549If the main need is simply to continue optimization from a measured result, prefer a new durable child idea branch instead of an expensive analysis package by reflex.
550If the extra work should happen on an older durable branch rather than the current head, first switch the runtime back there with `artifact.activate_branch(...)`, then launch the analysis campaign from that activated workspace.
551
552When `artifact.record_main_experiment(...)` succeeds, send a richer threaded `artifact.interact(kind='milestone', ...)` update rather than a generic one-line progress ping.
553Lead that milestone with a concise `1-2` sentence outcome summary before expanding into more detail.
554That milestone should state:
555
556- the research question that was tested
557- the primary result and baseline delta
558- whether the run supports, weakens, or leaves the idea inconclusive
559- the main caveat or confidence note that still matters
560- the exact recommended next move
561
562Do not treat a main run as durably complete until `artifact.record_main_experiment(...)` succeeds.
563
564Recommended per-run documentation fields:
565
5661. research question
5672. research type
5683. research objective
5694. experimental setup
5705. experimental results
5716. experimental analysis
5727. experimental conclusions
573
574These seven fields should be progressively filled as the run advances, not only at final packaging time.
575
576`RUN.md` should make it easy for later stages to answer:
577
578- what changed?
579- how can this run be reproduced?
580- what are the main results?
581- why did it work or fail?
582- what should happen next?
583
584When the run is analysis-heavy or meant to fill a writing evidence gap, prefer a structured summary with:
585
5861. research question
5872. research type
5883. objective and success criteria
5894. setup
5905. results
5916. analysis
5927. conclusion
593
594Recording rules:
595
596- record results incrementally, not only at the end
597- include timestamps when helpful
598- include failed attempts, partial runs, and unexpected outcomes
599- do not leave placeholder sections for later if the information is already known
600- report exactly what happened, not what you hoped would happen
601
602### 8. Decide the next move
603
604The experiment stage should normally end with one of:
605
606- continue the current line
607- branch a new line
608- launch an analysis campaign
609- move to writing
610- reset or stop
611
612Do not let the stage end without an explicit next direction.
613If analysis is selected, record why the expected information gain is strong enough to justify the added compute, time, or annotation budget.
614
615## Run-quality rules
616
617A credible main run should satisfy:
618
619- comparable against baseline
620- method change is knowable from code and config
621- metric source is durable
622- outcome can be explained by the intended intervention or its failure
623- commands, configs, and seeds are reconstructable
624- environment context is reconstructable
625- frontend or later readers can trace code and diff context to command, logs, and metrics
626
627If the result is confounded, say so directly.
628
629## Acceptance gate
630
631Before marking the run complete, verify all of the following:
632
633- all required baseline metric keys are present
634- the reported comparison contract still matches `active_baseline_metric_contract_json` when that file exists
635- metric values are finite numbers
636- claim-to-metric traceability is recorded
637- run manifest includes exact command, config, seed, and environment snapshot
638- the summary states go or no-go and why
639- artifacts are sufficient for another stage to reconstruct the run
640
641If these checks fail, record the run as partial or blocked rather than pretending it is complete.
642
643## Memory rules
644
645Stage-start requirement:
646
647- begin every experiment pass with `memory.list_recent(scope='quest', limit=5)`
648- then run at least one experiment-relevant `memory.search(...)` before a new run, retry, or material execution change
649- if several idea or experiment lines exist, narrow retrieval to the current `idea_id`, `branch`, and `run_id`; do not casually reuse memory from another idea line unless you are explicitly comparing lines
650
651Write to memory only when the lesson is reusable, such as:
652
653- experiment failure patterns
654- stable implementation lessons
655- evaluation pitfalls
656- validated mechanism scope and caveats
657
658The canonical record of the run itself belongs in `artifact`, not only in memory.
659
660Preferred memory usage:
661
662- quest `ideas`:
663 - the current idea contract and claim boundary
664- quest `decisions`:
665 - run-scope choices
666 - retry or branch decisions
667 - stop conditions that must not drift
668- quest `episodes`:
669 - failed runs
670 - debugging episodes
671 - suspicious-result investigations
672 - repeated infrastructure or resource failures
673- quest `knowledge`:
674 - validated mechanism scope
675 - evaluation caveats
676 - stable implementation lessons worth reusing in later runs of this quest
677- global `knowledge`:
678 - reusable debugging heuristics
679 - stable reproducibility lessons
680 - cross-quest experiment design playbooks
681- global `templates`:
682 - run-manifest patterns
683 - claim-validation templates
684 - experiment summary templates
685
686Use tags to refine retrieval when helpful, for example:
687
688- `stage:experiment`
689- `type:failure-pattern`
690- `type:metric-contract`
691- `type:claim-validation`
692- `topic:<mechanism>`
693
694When calling `memory.write(...)`, pass `tags` as an array like `["stage:experiment", "type:failure-pattern", "topic:<mechanism>"]`, not as one comma-joined string.
695
696Recommended read timing:
697
698- before the first run:
699 - consult quest `ideas`, `decisions`, and relevant `knowledge`
700- before a retry:
701 - search quest `episodes` first
702- before changing execution strategy materially:
703 - re-check quest `decisions`
704- after suspicious results:
705 - consult recent `episodes` and stable debugging `knowledge`
706
707Stage-end requirement:
708
709- successful runs should leave at least one reusable knowledge note if the lesson generalizes
710- failed or partial runs should leave an incident note when the failure pattern is reusable
711- every experiment `memory.write(...)` must state whether the outcome was `success`, `partial`, or `failure`
712- every experiment `memory.write(...)` should also include the current `idea_id`, `branch`, and `run_id` so later retrieval does not mix different experiment lines
713
714## Artifact rules
715
716Typical artifact sequence:
717
718- progress artifact for long runs
719- `artifact.record_main_experiment(...)` at main-run completion
720- milestone or report artifact for major findings
721- decision artifact to choose next stage
722
723Preferred artifact choices:
724
725- use `progress` for long-running execution updates
726- use `artifact.record_main_experiment(...)` for each meaningful completed main experiment
727- use `run` for analysis slice records when `artifact.record_analysis_slice(...)` writes them
728- use `report` for:
729 - analysis-rich summaries
730 - suspicious-result investigations
731 - post-run interpretation
732- use `milestone` when a major stage checkpoint is reached
733- use `decision` for:
734 - continue
735 - branch
736 - analysis
737 - write
738 - reset
739 - stop
740- use `approval` when an explicit user approval is captured for an expensive or risky run change
741
742Use `artifact.checkpoint(...)` when code evolution is meaningful and should be preserved in Git.
743After a meaningful experiment checkpoint or completion, emit `artifact.interact(kind='progress' | 'milestone', ...)` so the user sees the concrete result and next step.
744
745## Failure and blocked handling
746
747A failed main run is still useful if it is explained well.
748
749Record:
750
751- what was attempted
752- where the failure occurred
753- whether the failure is likely methodological or infrastructural
754- what retry, branch, or reset is justified
755- the single best next action
756
757Prefer a primary failure type such as:
758
759- `data_contract_mismatch`
760- `resource_exhausted`
761- `numeric_instability`
762- `implementation_bug`
763- `evaluation_pipeline_failure`
764- `external_dependency_blocked`
765- `direction_underperforming`
766
767Also classify the broader failure layer when possible:
768
769- implementation
770- evaluation
771- environment
772- direction
773
774Do not collapse these into one bucket.
775A direction should only be treated as failing when repeated, well-instrumented evidence still points to underperformance after implementation, evaluation, and environment explanations have been checked.
776
777Blocked experiment states commonly include:
778
779- missing baseline reference
780- unknown metric contract
781- environment failure
782- run failed before producing metrics
783- metrics produced but not comparable
784
785When results are suspicious, such as identical to baseline, implausibly perfect, or inconsistent across repeats, diagnose systematically:
786
7871. fix the subset and seeds
7882. isolate preprocessing, tokenization, model init, training, and evaluation one by one
7893. compare intermediate outputs on the same inputs
7904. align inputs first, then outputs, then metrics
791
792Default diagnosis loop:
793
7941. collect the concrete failure or anomaly cases
7952. identify the last-known-good comparable state
7963. define the smallest delta between working and broken states
7974. write `2-4` concrete hypotheses
7985. run the cheapest discriminative check before another full retry
799
800## Exit criteria
801
802Exit the experiment stage once one of the following is durably true:
803
804- a main run is completed and recorded
805- the run failed and the blocker is durably recorded
806- the next step is clearly `analysis-campaign`, `write`, another `experiment`, or `reset`