Ds experiment

From OpenLAIR/dr-claw · View interactive version

Ds experiment is an AI agent skill from the GitHub repository OpenLAIR/dr-claw. 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.

How to use this skill

Skill file

Experiment

Use this skill for the main evidence-producing runs of the quest.

Interaction discipline

Tool discipline

Stage purpose

The experiment stage should turn a selected idea into auditable evidence.

It should preserve the strongest old experiment-planning and execution discipline:

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.

  1. Restate the selected idea in 1-2 sentences and confirm the baseline comparison contract.
  2. Before substantial code edits or the real main run, create PLAN.md and CHECKLIST.md.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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

Experiment mental guardrails

Use when

Do not use when

Preconditions and gate

Before a main run starts, confirm:

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.

Working-boundary rules

Only modify the active quest workspace for this experiment line.

Resource and environment rules

Truth sources

Use:

Do not claim run success without durable outputs.

Required durable outputs

A meaningful experiment pass should leave behind:

Recommended additional files:

run_manifest.json should capture at least:

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:

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:

  1. research question
  2. research type
  3. research objective
  4. experimental setup
  5. experimental results
  6. experimental analysis
  7. 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:

If multiple candidate experiment packages exist, prefer the one with the best balance of:

Do not choose a package only because it sounds ambitious.

For paper-facing lines, default to this evidence ladder:

2. Run a preflight check

Before editing or executing:

If a repeated failure pattern already exists, apply the mitigation first and record that choice.

Also confirm before comparison work:

Before you begin a substantial run, send a concise threaded artifact.interact(kind='progress', ...) update naming:

2.1 Diagnostic mode trigger

Switch from ordinary execution mode into diagnosis mode when any of the following becomes true:

In diagnosis mode:

3. Confirm the execution workspace

The normal experiment workspace is the current active idea worktree returned by artifact.submit_idea(...).

4. Implement the minimum required change

Implementation rules:

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:

5. Execute the run

Run with auditable commands and durable outputs.

Execution rules:

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:

Incremental-recording rule:

Last-known-good rule:

5.1 Long-running command protocol

For commands that may run longer than a few minutes:

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.

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:

Create a durable claim-validation record that maps:

Also verify baseline comparability before claiming deltas:

7. Record the run

Every meaningful main run must be recorded through artifact.record_main_experiment(...).

That call is responsible for writing:

artifact.record_main_experiment(...) should include at least:

Use evaluation_summary as the short structured judgment layer on top of the longer narrative fields:

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:

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:

Do not treat a main run as durably complete until artifact.record_main_experiment(...) succeeds.

Recommended per-run documentation fields:

  1. research question
  2. research type
  3. research objective
  4. experimental setup
  5. experimental results
  6. experimental analysis
  7. 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:

When the run is analysis-heavy or meant to fill a writing evidence gap, prefer a structured summary with:

  1. research question
  2. research type
  3. objective and success criteria
  4. setup
  5. results
  6. analysis
  7. conclusion

Recording rules:

8. Decide the next move

The experiment stage should normally end with one of:

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:

If the result is confounded, say so directly.

Acceptance gate

Before marking the run complete, verify all of the following:

If these checks fail, record the run as partial or blocked rather than pretending it is complete.

Memory rules

Stage-start requirement:

Write to memory only when the lesson is reusable, such as:

The canonical record of the run itself belongs in artifact, not only in memory.

Preferred memory usage:

Use tags to refine retrieval when helpful, for example:

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:

Stage-end requirement:

Artifact rules

Typical artifact sequence:

Preferred artifact choices:

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:

Prefer a primary failure type such as:

Also classify the broader failure layer when possible:

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:

When results are suspicious, such as identical to baseline, implausibly perfect, or inconsistent across repeats, diagnose systematically:

  1. fix the subset and seeds
  2. isolate preprocessing, tokenization, model init, training, and evaluation one by one
  3. compare intermediate outputs on the same inputs
  4. align inputs first, then outputs, then metrics

Default diagnosis loop:

  1. collect the concrete failure or anomaly cases
  2. identify the last-known-good comparable state
  3. define the smallest delta between working and broken states
  4. write 2-4 concrete hypotheses
  5. run the cheapest discriminative check before another full retry

Exit criteria

Exit the experiment stage once one of the following is durably true:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.