Baseline
This skill establishes the reference system the quest will compare against.
The target is one trustworthy baseline line, not an endless reproduction diary.
Interaction discipline
- Follow the shared interaction contract injected by the system prompt.
- Keep ordinary setup and debugging updates concise.
- Use richer milestone updates only when the baseline becomes trusted, caveated, blocked, waived, or route-changing.
- Hard execution rule: every terminal command in this stage must go through
bash_exec; do not use any other terminal path for setup, reproduction, monitoring, verification, Git, Python, package-manager, or file-inspection commands.
- Prefer
bash_exec for setup, reproduction, monitoring, and verification commands so the baseline line stays durable and auditable.
Tool discipline
- Do not use native
shell_command / command_execution in this skill.
- All 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 generic git smoke test is needed outside the quest repo, use
bash_exec(...) in an isolated scratch repository.
Non-negotiable rules
- no fabricated metrics, logs, run status, or success claims
- do not skip baseline steps or silently simplify the route when that would change trust or comparability
- do not claim a baseline is ready before verification is complete
- do not infer missing commands, scripts, or parameters when the uncertainty could change the result
- any unavoidable guess must be written down explicitly with expected impact
- use web search for discovering papers or repos, but use
artifact.arxiv(paper_id=..., full_text=False) for actually reading a source arXiv paper when it exists
- set
full_text=True only when the short form is insufficient
- for Python baselines, environment setup should be standardized around
uv
Stage purpose
The baseline stage should produce a usable reference point through one of four routes:
- attach an existing reusable baseline
- import a reusable baseline package
- reproduce a baseline from source
- repair a broken or stale baseline
Keep the classic control flow:
- analysis
- setup
- execution
- verification
These are control gates, not paperwork walls.
Quick workflow
- Read the source paper and source repo first, or record exactly what is missing and why.
- Choose the lightest trustworthy route: attach, import, reproduce, or repair.
- Start with the fast path whenever the current baseline object, command path, and acceptance target are already clear enough to validate cheaply.
- Before substantial baseline setup, code edits, or a real baseline run, create
PLAN.md and CHECKLIST.md; short-form files are enough for simple fast-path work.
- Keep one dominant phase visible: analysis -> setup -> execution -> verification.
- Prefer one clean implementation pass, one smoke test, and then one normal baseline run.
- Retry only when smoke, verification, or runtime evidence shows a concrete failure or incompatibility.
- Close the stage by confirming or waiving the gate, then hand off with a concise
1-2 sentence summary of trust status and next anchor.
Fast-path first
Default to the lightest baseline path that can still establish a trustworthy comparison.
Default to a fast path when it can establish trust with less work.
Fast path is the default when any of the following is true:
requested_baseline_ref or confirmed_baseline_ref already points to the active baseline object
- the route is clearly
attach or import
- the repo entrypoint, dataset or split, and metric contract are already concrete enough to validate cheaply
- reproduction requires no meaningful code changes and the main uncertainty is only whether the command still runs
Fast path means:
- do not restart broad baseline discovery by default
- do not front-load a full codebase audit when the entrypoint is already concrete
- use a minimal
PLAN.md, a minimal CHECKLIST.md, one bounded smoke test when needed, and then one real validation or run
- default to reuse-and-verify when runtime already attached a concrete baseline
Escalate from fast path to fuller audit only when:
- the paper and repo disagree materially
- the real run or eval entrypoint is unclear
- code changes are likely required
- the contract spans multiple metrics, datasets, subtasks, or splits that still need interpretation
- the same failure class reappears after one documented autonomous fix
- the quest is trying to publish a reusable global baseline rather than only clear the current gate
Use when
- no credible baseline exists yet
- the current baseline is unverified or stale
- the user already has a baseline package that should be attached or imported
- a reproduction failed earlier and now needs repair
- the quest resumed and the baseline trust state is unclear
Do not use when
- the quest already has a verified active baseline and the next move is ideation or execution
- the user explicitly waived the baseline gate and that waiver is durably recorded
Stage gate
Do not proceed to comparison-heavy downstream work unless one of the following is durably true:
- a baseline has been attached and accepted
- a baseline has been imported and accepted
- a baseline reproduction has completed and been verified
- an explicit waiver decision exists with a clear reason
Operationally:
- call
artifact.confirm_baseline(...) once the accepted baseline root and trusted comparison contract are clear
- call
artifact.waive_baseline(...) when the quest must continue without a baseline
- attach, import, or publish alone do not open the downstream gate
Required plan and checklist
Before substantial baseline setup, code edits, or a real baseline run, create a quest-visible PLAN.md and CHECKLIST.md.
- Use
references/baseline-plan-template.md as the canonical structure for PLAN.md.
- Use
references/baseline-checklist-template.md as the canonical structure for CHECKLIST.md.
analysis_plan.md and REPRO_CHECKLIST.md remain acceptable compatibility alias files when an older quest already depends on them.
- For fast-path attach/import/prebound validation or a simple reproduce path with no expected code changes, short-form
PLAN.md and CHECKLIST.md are enough.
- The plan should put the user's explicit requirements and non-negotiable constraints first.
- Then record the chosen route, source identity, command path, expected outputs, acceptance condition, safe efficiency levers, main risks, and fallback.
- If the route, commands, source package, fallback path, or trust judgment changes materially, revise
PLAN.md before continuing.
- Once the route is concrete, stop reshaping code and commands speculatively.
Default retry discipline:
- do not rerun the same unchanged smoke command just to reconfirm the same fact
- treat one autonomous retry for the same failure class as the normal upper bound
- if the same failure class appears again, switch explicitly into
repair, record blocked, or route through decision
Required durable outputs
The baseline stage should usually leave behind:
- a baseline directory under
baselines/local/ or baselines/imported/
PLAN.md and CHECKLIST.md
- a verification note or report
- command, config, environment, and metrics pointers
- a baseline artifact
- a confirmed baseline gate via
artifact.confirm_baseline(...), or an explicit waiver via artifact.waive_baseline(...)
- an optional registry publication if the baseline is reusable beyond this quest
For simple attach/import flows or a straightforward reproduce flow, do not stall just to precreate every optional note file.
Useful optional notes:
setup.md
execution.md
verification.md
STRUCTURE.md when the layout is non-obvious
File-by-file contract
PLAN.md or compatibility alias analysis_plan.md is the required route contract before substantial setup, code edits, or a real run; it should state the route, source identity, command path, expected outputs, acceptance condition, main risks, and fallback.
CHECKLIST.md or compatibility alias REPRO_CHECKLIST.md is the required living state tracker; it should show whether the baseline object, smoke decision, real run decision, and final accept / block / waive outcome are explicit.
setup.md is optional unless environment or layout choices are non-trivial; if used, record the working directory, environment route, important config paths, source revision, and notable setup deviations.
execution.md is optional unless the run is long, multi-step, or rerun-heavy; if used, record the launched commands, durable log paths, checkpoints, exit state, and any reruns or repairs.
verification.md is optional as a filename but required in substance before acceptance or blocked closeout; either this file or an equivalent report should record trusted metrics, expected-versus-observed comparison, caveats, canonical output paths, and the next anchor.
STRUCTURE.md becomes required when the workspace layout, mounts, symlinks, or generated outputs are non-obvious or meant for reuse; it should map the important directories and say which paths are canonical.
attachment.yaml is required for attached or imported baselines under baselines/imported/; preserve source identity, selected variant when relevant, and attachment provenance there.
<baseline_root>/json/metric_contract.json is the canonical accepted comparison contract; once the baseline is accepted, do not leave the authoritative metric surface only in chat, memory, or prose.
Result/metric.md is scratch-only; it may help during execution, but it is never the final source of truth.
Minimum stability rules:
- before the first real run, leave one durable note with the chosen route, expected command path, target outputs, and main risks
- after each smoke test or real run, record what actually happened and whether the route still looks viable
- before acceptance, leave a clear verification note and baseline gate decision
- every accepted baseline should leave one accepted baseline artifact
- every blocked baseline line should leave one blocked report and one next-step decision
- if one rolling note is enough for a simple baseline line, use it
Durable path contract
Use the real runtime paths consistently.
Quest-local paths:
- reproduced baseline root:
<quest_root>/baselines/local/<baseline_id>/
- attached or imported baseline root:
<quest_root>/baselines/imported/<baseline_id>/
- attachment record:
<quest_root>/baselines/imported/<baseline_id>/attachment.yaml
- canonical baseline metric contract JSON:
<baseline_root>/json/metric_contract.json
- baseline artifact record:
<quest_root>/artifacts/baselines/<artifact_id>.json
- baseline reports:
<quest_root>/artifacts/reports/<artifact_id>.json
- confirmed baseline reference:
quest.yaml -> confirmed_baseline_ref
Global reusable registry paths:
- baseline registry index:
~/DeepScientist/config/baselines/index.jsonl
- canonical baseline entry:
~/DeepScientist/config/baselines/entries/<baseline_id>.yaml
Baseline id and variant rules
baseline_id should be short, stable, and filesystem-safe
- use letters, digits,
., _, or -
- do not use spaces,
/, \\, or ..
- if one codebase contains multiple comparable baselines, prefer one
baseline_id with structured variants instead of inventing many near-duplicate entries
- when variants exist, keep
default_variant_id, baseline_variants, and per-variant metric summaries stable enough that later experiment and write stages can cite them directly
Do not invent parallel durable locations when these runtime contracts already exist.
Do not leave the authoritative metric contract only in chat, memory, or prose once the baseline is accepted.
If a baseline is reproduced only because an analysis campaign needs an extra comparator:
- still place it under the normal baseline roots
- treat it as a supplementary analysis baseline unless the quest explicitly promotes it into the canonical gate
- do not call
artifact.confirm_baseline(...) for that supplementary case unless the quest truly intends to replace the canonical baseline
Multi-baseline policy
One quest may legitimately need more than one baseline.
- explicitly mark which baseline is the primary downstream comparator
- distinguish primary comparison baselines from fallback or infrastructure baselines
- if several baselines are credible, record why the chosen primary baseline is the fairest paper-facing comparator
- do not leave later stages guessing which baseline is authoritative
Route order
Prefer this order:
- attach
- import
- reproduce
- repair
Prefer reuse over redundant reproduction.
Workflow
Phase 1. Analysis
Before running anything substantial, determine:
- exact task
- dataset and split contract
- metric contract
- source baseline identity
- source code path
- expected run command or evaluation path
- expected paper or repo numbers when they exist
- local resource constraints
Default analysis discipline:
- read the source paper and source repo first
- if runtime already exposes a matching
requested_baseline_ref or confirmed_baseline_ref, validate that concrete object before restarting broad discovery
- identify the real run or evaluation entrypoint
- identify the dataset or split and metric contract
- identify likely environment blockers
- define the cheapest credible smoke test
Escalate to a fuller audit only when the command path is unclear, the repo is large or confusing, repair mode is active, or custom code changes look likely.
When the fuller audit is necessary, capture only what later stages truly need:
- major entry scripts, configs, and modules
- end-to-end data flow
- evaluation path and metric computation path
- obvious environment assumptions
- obvious bottlenecks or incompatibilities
If the source paper is available, record:
- the core algorithm in compact, implementation-faithful form
- the main reported numbers
- the main weaknesses or bottlenecks likely to matter for this quest
You may inspect local feasibility with shell-based checks for OS, GPU, CPU, RAM, disk, Python version, and whether uv is available.
The analysis phase should leave behind a concrete plan rather than only conversational intent.
Phase 2. Setup
Prepare the selected route:
- attach: validate the selected baseline id and variant
- import: place the imported baseline metadata under the quest and confirm the package is readable
- reproduce: prepare the baseline work directory, commands, config pointers, and environment notes
- repair: identify the precise broken point before rerunning blindly
For Python baselines, standardize environment setup around uv.
Python environment rule: use uv
- if the repo already contains
uv.lock or a solid pyproject.toml, use uv sync
- otherwise create a local virtual environment with
uv venv
- install dependencies with
uv pip install ...
- run setup, smoke tests, and real commands through
uv run ...
Practical rules:
- prefer a quest-local or baseline-local
.venv
- prefer
uv run python ... or uv run bash ... over relying on shell activation state
- if a specific interpreter is required, make it explicit with
uv venv --python 3.11 or uv run --python 3.11 ...
- if CUDA, PyTorch, JAX, or custom wheels require a special index URL, keep that install under
uv pip
- only accept a non-
uv route when there is a concrete blocker that cannot be resolved locally
Common uv patterns:
uv sync
uv venv --python 3.11
uv pip install -r requirements.txt
uv run python scripts/smoke_test.py
uv run python train.py --config ...
Setup should record:
- baseline id and source identity
- working directory
- config files
- command template
- expected outputs
- known deviations from paper or source
- the chosen
uv route and Python version
Fallbacks:
- if Hugging Face access is blocked, record and try an approved local mirror such as ModelScope when that does not change the comparison meaning
- if a quest already depends on
analysis_plan.md or REPRO_CHECKLIST.md, keep the compatibility alias explicit rather than splitting truth across two active plans
Phase 3. Execution
Run only the work required to establish the baseline credibly.
Execution rules:
- keep commands auditable
- keep logs durable
- avoid uncontrolled side experiments during baseline establishment
- checkpoint only explainable, minimal code changes
- prefer equivalence-preserving efficiency gains such as larger safe batch size, cache reuse, checkpoint resume, and parallel downloads or workers
- do not use an efficiency lever if it changes accepted baseline meaning, effective evaluation contract, or trust judgment
Long-running execution discipline:
- run one bounded smoke test before a substantial baseline reproduction
- once the smoke test passes, launch the real baseline reproduction with
bash_exec(mode='detach', ...)
- monitor by forward progress instead of by short-window completion anxiety
- do not report final success until the command actually finished and the expected result files exist
- if you need to recover ids or inspect session state, use
bash_exec(mode='history') or bash_exec(mode='list')
bash_exec(mode='read', id=...) returns the full saved log when it is 2000 lines or fewer; for longer logs, inspect omitted middle windows with start and tail
- during monitoring, prefer
bash_exec(mode='read', id=..., tail_limit=..., order='desc'), and after the first read prefer incremental checks with after_seq=last_seen_seq
- use
silent_seconds, progress_age_seconds, signal_age_seconds, and watchdog_overdue as the default staleness clues
- if a run is clearly invalid, wedged, or superseded, stop it with
bash_exec(mode='kill', id=..., wait=true, timeout_seconds=...), document why, and relaunch cleanly
- do not let more than the
30-minute visibility bound pass without a real inspection and a next expected update time
- when the baseline code is under your control, prefer a throttled
tqdm progress reporter and periodic __DS_PROGRESS__ markers when feasible
Keep retries bounded:
- one smoke test is the default
- one autonomous fix-and-retry for the same failure class is the normal upper bound
- if the same failure class returns, stop looping
Phase 4. Verification
Verification is mandatory before baseline acceptance.
Verify:
- the run actually finished
- the reported metrics came from the intended dataset and split
- the metric definitions match the quest contract
- the result is comparable to the paper, source repo, or selected target
- any deviations are explicitly stated
Classify the outcome as one of:
verified_match
verified_close
verified_diverged
broken
Verification must explicitly separate:
- likely implementation mismatch
- environment mismatch
- data or split mismatch
- expected stochastic variance
- unexplained divergence
Verification should answer:
- whether the baseline is trustworthy enough for downstream comparison
- whether the result is reusable beyond this quest
- whether another repair or rerun is justified
- whether the line should stop here and hand off
A verification report should be self-contained enough that a later stage can answer:
- what was used
- how it was obtained: attach, import, reproduce, or repair
- what commands and configs were used
- what metrics are trusted
- what caveats remain
- whether the result is reusable beyond this quest
Baseline comparability contract
The baseline stage is not complete just because something ran.
It is complete when later stages can compare against it fairly.
Before declaring a baseline usable, make the comparability contract explicit:
- task identity
- dataset identity and version
- split contract
- preprocessing boundary
- evaluation script or evaluation path
- required metric keys
- metric directions
- seed policy when relevant
- source commit or source package identity
- known deviations from the source reference
Unless the user explicitly specifies otherwise, treat the original paper's evaluation protocol as the canonical baseline contract.
If any of these fields are still materially unknown, do not pretend the baseline is a clean downstream reference.
For the fuller checklist and verdict meanings, read references/comparability-contract.md.
Feasibility and trust classes
Before acceptance, classify feasibility as one of:
full_reproducible
degraded_but_acceptable
blocked
And classify downstream trust as one of:
verified
partially_verified
operational_but_incomparable
failed
Do not silently upgrade a degraded or merely operational result into a normal trusted baseline.
Minimum baseline artifact content
The accepted baseline artifact should include at least:
baseline_id
baseline_kind
path
task
dataset
primary_metric
metrics_summary
environment
source
summary
If variants exist, also include:
default_variant_id
baseline_variants
Metric-contract rules:
- if the accepted baseline contract includes multiple metrics, datasets, subtasks, or splits, record all of them in
<baseline_root>/json/metric_contract.json
- keep
primary_metric as the headline metric only; do not let it erase the rest of the comparison surface
- when confirming a baseline, submit the canonical
metrics_summary as a flat top-level dictionary keyed by the paper-facing metric ids
- every canonical baseline metric entry should include
description, either derivation or origin_path, and source_ref
- if the paper reports both aggregate and per-dataset or per-task results, preserve both whenever feasible through
metrics_summary plus structured rows rather than one cherry-picked scalar
- if the source package already has a richer leaderboard table, structured result file, or
json/metric_contract.json, reuse that richer contract instead of hand-writing a thinner one that keeps only one averaged scalar
Result/metric.md is optional temporary scratch memory only; reconcile against it before calling artifact.confirm_baseline(...), but do not treat it as a required durable file
Publication and reuse
Use the registry deliberately, not as an afterthought.
If the result is reusable beyond the current quest:
- publish it through
artifact.publish_baseline(...)
- ensure the payload includes identity, provenance, trusted metrics, and any variant structure
- set
publish_global: true only when verification is complete and reuse is justified
If the current quest should reuse an existing baseline:
- attach it through
artifact.attach_baseline(...)
- preserve the selected
baseline_id
- preserve the selected
variant_id when one is used
- keep the attachment durable under
baselines/imported/
If runtime state already includes requested_baseline_ref or a matching confirmed_baseline_ref:
- default to reuse-and-verify, not rediscovery
- treat a creation-time pre-bound baseline as the active starting point unless you find a concrete incompatibility
- do not rerun broad baseline scouting or full reproduction just because the stage name is
baseline
For a clearer attach/import/reproduce/repair rubric, read references/route-selection.md.
For reusable-package expectations, read references/publishable-baseline-package.md.
Workspace and branch rules
- treat the baseline workspace as a system-managed reproduction surface, not an unrelated sandbox
- avoid creating a nested authoritative Git lifecycle inside the baseline workspace
- use the quest branch unless isolation is genuinely needed
- if baseline setup is risky or intrusive, prepare an isolated branch or worktree first and record why
- do not proliferate branches without a reason
Memory rules
Stage-start requirement:
- by default, begin every baseline pass with
memory.list_recent(scope='quest', limit=5)
- then run at least one baseline-relevant
memory.search(...) before new baseline analysis, repair, or rerun work
- fast-path exception: if the quest already exposes a clear
requested_baseline_ref or confirmed_baseline_ref and the immediate task is only to validate or reattach that concrete baseline, you may skip broad retrieval
Write memory only for reusable lessons such as:
- paper-to-code mismatch notes
- environment incidents
- dataset quirks
- verification caveats
- attach vs import vs reproduce vs repair rationale
When calling memory.write(...), pass tags as an array like ["stage:baseline", "baseline:<baseline_id>", "type:repro-lesson"], not as one comma-joined string.
Stage-end requirement:
- if baseline work produced a durable reproduction lesson, verification caveat, environment incident, or route rationale, write at least one
memory.write(...) before leaving the stage
Artifact rules
Typical artifact sequence:
progress for long-running setup or execution checkpoints
report for analysis notes or verification notes
decision for route choice, blocked routing, or accept/reject/rerun/repair calls
baseline only for an accepted baseline record
For stable field shapes, read references/artifact-payload-examples.md.
The baseline handoff should make these items obvious:
baseline_id
baseline_variant_id when relevant
- route used: attach, import, reproduce, or repair
- trusted metrics
- canonical metric contract JSON path
- verification outcome
- reusable or quest-local only
- canonical output paths
- main caveats
- recommended next anchor
If this packet is not obvious from the accepted artifact plus verification note, the baseline line is not stable enough yet.
Failure and blocked handling
Do not hide failures.
If blocked, record the class explicitly:
missing_source
missing_code
missing_metric_contract
environment_infeasible
command_unknown
run_failed
verification_failed
A blocked result must state:
- what failed
- what was tried
- which paths or logs show the issue
- whether the next best move is attach, import, retry, repair, reset, or ask the user
Reasonable autonomous fixes before escalation:
- missing module or dependency
- wrong dataset path
- permission errors on scripts
- reasonable batch-size reductions for OOM
- obvious environment activation mistakes
If a fix would change confirmed scope, metrics, permissions, or resource assumptions, stop and return to analysis rather than applying it silently.
Exit criteria
Exit the baseline stage once one of the following is durably true:
- a baseline is attached and accepted
- an imported baseline is accepted
- a reproduced baseline is verified and accepted
- a broken route has been declared blocked and a next decision is recorded
Typical next anchors:
idea
experiment in tightly scoped follow-on cases
decision if the baseline line remains contested
1---
2name: ds-baseline
3description: Use when a quest needs to attach, import, reproduce, repair, verify, compare, or publish a baseline and its metrics.
4skill_role: stage
5license: MIT
6metadata:
7 author: ResearAI/DeepScientist
8 version: "1.0.0"
9---
10
11# Baseline
12
13This skill establishes the reference system the quest will compare against.
14The target is one trustworthy baseline line, not an endless reproduction diary.
15
16## Interaction discipline
17
18- Follow the shared interaction contract injected by the system prompt.
19- Keep ordinary setup and debugging updates concise.
20- Use richer milestone updates only when the baseline becomes trusted, caveated, blocked, waived, or route-changing.
21- Hard execution rule: every terminal command in this stage must go through `bash_exec`; do not use any other terminal path for setup, reproduction, monitoring, verification, Git, Python, package-manager, or file-inspection commands.
22- Prefer `bash_exec` for setup, reproduction, monitoring, and verification commands so the baseline line stays durable and auditable.
23
24## Tool discipline
25
26- **Do not use native `shell_command` / `command_execution` in this skill.**
27- **All shell, CLI, Python, bash, node, git, npm, uv, and environment work must go through `bash_exec(...)`.**
28- **For git work inside the current quest repository or worktree, prefer `artifact.git(...)` before raw shell git commands.**
29- **If a generic git smoke test is needed outside the quest repo, use `bash_exec(...)` in an isolated scratch repository.**
30
31## Non-negotiable rules
32
33- no fabricated metrics, logs, run status, or success claims
34- do not skip baseline steps or silently simplify the route when that would change trust or comparability
35- do not claim a baseline is ready before verification is complete
36- do not infer missing commands, scripts, or parameters when the uncertainty could change the result
37- any unavoidable guess must be written down explicitly with expected impact
38- use web search for discovering papers or repos, but use `artifact.arxiv(paper_id=..., full_text=False)` for actually reading a source arXiv paper when it exists
39- set `full_text=True` only when the short form is insufficient
40- for Python baselines, environment setup should be standardized around `uv`
41
42## Stage purpose
43
44The baseline stage should produce a usable reference point through one of four routes:
45
461. attach an existing reusable baseline
472. import a reusable baseline package
483. reproduce a baseline from source
494. repair a broken or stale baseline
50
51Keep the classic control flow:
52
531. analysis
542. setup
553. execution
564. verification
57
58These are control gates, not paperwork walls.
59
60## Quick workflow
61
621. Read the source paper and source repo first, or record exactly what is missing and why.
632. Choose the lightest trustworthy route: attach, import, reproduce, or repair.
643. Start with the fast path whenever the current baseline object, command path, and acceptance target are already clear enough to validate cheaply.
654. Before substantial baseline setup, code edits, or a real baseline run, create `PLAN.md` and `CHECKLIST.md`; short-form files are enough for simple fast-path work.
665. Keep one dominant phase visible: analysis -> setup -> execution -> verification.
676. Prefer one clean implementation pass, one smoke test, and then one normal baseline run.
687. Retry only when smoke, verification, or runtime evidence shows a concrete failure or incompatibility.
698. Close the stage by confirming or waiving the gate, then hand off with a concise `1-2` sentence summary of trust status and next anchor.
70
71## Fast-path first
72
73Default to the lightest baseline path that can still establish a trustworthy comparison.
74Default to a fast path when it can establish trust with less work.
75
76Fast path is the default when any of the following is true:
77
78- `requested_baseline_ref` or `confirmed_baseline_ref` already points to the active baseline object
79- the route is clearly `attach` or `import`
80- the repo entrypoint, dataset or split, and metric contract are already concrete enough to validate cheaply
81- reproduction requires no meaningful code changes and the main uncertainty is only whether the command still runs
82
83Fast path means:
84
85- do not restart broad baseline discovery by default
86- do not front-load a full codebase audit when the entrypoint is already concrete
87- use a minimal `PLAN.md`, a minimal `CHECKLIST.md`, one bounded smoke test when needed, and then one real validation or run
88- default to reuse-and-verify when runtime already attached a concrete baseline
89
90Escalate from fast path to fuller audit only when:
91
92- the paper and repo disagree materially
93- the real run or eval entrypoint is unclear
94- code changes are likely required
95- the contract spans multiple metrics, datasets, subtasks, or splits that still need interpretation
96- the same failure class reappears after one documented autonomous fix
97- the quest is trying to publish a reusable global baseline rather than only clear the current gate
98
99## Use when
100
101- no credible baseline exists yet
102- the current baseline is unverified or stale
103- the user already has a baseline package that should be attached or imported
104- a reproduction failed earlier and now needs repair
105- the quest resumed and the baseline trust state is unclear
106
107## Do not use when
108
109- the quest already has a verified active baseline and the next move is ideation or execution
110- the user explicitly waived the baseline gate and that waiver is durably recorded
111
112## Stage gate
113
114Do not proceed to comparison-heavy downstream work unless one of the following is durably true:
115
116- a baseline has been attached and accepted
117- a baseline has been imported and accepted
118- a baseline reproduction has completed and been verified
119- an explicit waiver decision exists with a clear reason
120
121Operationally:
122
123- call `artifact.confirm_baseline(...)` once the accepted baseline root and trusted comparison contract are clear
124- call `artifact.waive_baseline(...)` when the quest must continue without a baseline
125- attach, import, or publish alone do not open the downstream gate
126
127## Required plan and checklist
128
129Before substantial baseline setup, code edits, or a real baseline run, create a quest-visible `PLAN.md` and `CHECKLIST.md`.
130
131- Use `references/baseline-plan-template.md` as the canonical structure for `PLAN.md`.
132- Use `references/baseline-checklist-template.md` as the canonical structure for `CHECKLIST.md`.
133- `analysis_plan.md` and `REPRO_CHECKLIST.md` remain acceptable compatibility alias files when an older quest already depends on them.
134- For fast-path attach/import/prebound validation or a simple reproduce path with no expected code changes, short-form `PLAN.md` and `CHECKLIST.md` are enough.
135- The plan should put the user's explicit requirements and non-negotiable constraints first.
136- Then record the chosen route, source identity, command path, expected outputs, acceptance condition, safe efficiency levers, main risks, and fallback.
137- If the route, commands, source package, fallback path, or trust judgment changes materially, revise `PLAN.md` before continuing.
138- Once the route is concrete, stop reshaping code and commands speculatively.
139
140Default retry discipline:
141
142- do not rerun the same unchanged smoke command just to reconfirm the same fact
143- treat one autonomous retry for the same failure class as the normal upper bound
144- if the same failure class appears again, switch explicitly into `repair`, record `blocked`, or route through `decision`
145
146## Required durable outputs
147
148The baseline stage should usually leave behind:
149
150- a baseline directory under `baselines/local/` or `baselines/imported/`
151- `PLAN.md` and `CHECKLIST.md`
152- a verification note or report
153- command, config, environment, and metrics pointers
154- a baseline artifact
155- a confirmed baseline gate via `artifact.confirm_baseline(...)`, or an explicit waiver via `artifact.waive_baseline(...)`
156- an optional registry publication if the baseline is reusable beyond this quest
157
158For simple attach/import flows or a straightforward reproduce flow, do not stall just to precreate every optional note file.
159
160Useful optional notes:
161
162- `setup.md`
163- `execution.md`
164- `verification.md`
165- `STRUCTURE.md` when the layout is non-obvious
166
167## File-by-file contract
168
169- `PLAN.md` or compatibility alias `analysis_plan.md` is the required route contract before substantial setup, code edits, or a real run; it should state the route, source identity, command path, expected outputs, acceptance condition, main risks, and fallback.
170- `CHECKLIST.md` or compatibility alias `REPRO_CHECKLIST.md` is the required living state tracker; it should show whether the baseline object, smoke decision, real run decision, and final accept / block / waive outcome are explicit.
171- `setup.md` is optional unless environment or layout choices are non-trivial; if used, record the working directory, environment route, important config paths, source revision, and notable setup deviations.
172- `execution.md` is optional unless the run is long, multi-step, or rerun-heavy; if used, record the launched commands, durable log paths, checkpoints, exit state, and any reruns or repairs.
173- `verification.md` is optional as a filename but required in substance before acceptance or blocked closeout; either this file or an equivalent report should record trusted metrics, expected-versus-observed comparison, caveats, canonical output paths, and the next anchor.
174- `STRUCTURE.md` becomes required when the workspace layout, mounts, symlinks, or generated outputs are non-obvious or meant for reuse; it should map the important directories and say which paths are canonical.
175- `attachment.yaml` is required for attached or imported baselines under `baselines/imported/`; preserve source identity, selected variant when relevant, and attachment provenance there.
176- `<baseline_root>/json/metric_contract.json` is the canonical accepted comparison contract; once the baseline is accepted, do not leave the authoritative metric surface only in chat, memory, or prose.
177- `Result/metric.md` is scratch-only; it may help during execution, but it is never the final source of truth.
178
179Minimum stability rules:
180
181- before the first real run, leave one durable note with the chosen route, expected command path, target outputs, and main risks
182- after each smoke test or real run, record what actually happened and whether the route still looks viable
183- before acceptance, leave a clear verification note and baseline gate decision
184- every accepted baseline should leave one accepted baseline artifact
185- every blocked baseline line should leave one blocked report and one next-step decision
186- if one rolling note is enough for a simple baseline line, use it
187
188## Durable path contract
189
190Use the real runtime paths consistently.
191
192Quest-local paths:
193
194- reproduced baseline root: `<quest_root>/baselines/local/<baseline_id>/`
195- attached or imported baseline root: `<quest_root>/baselines/imported/<baseline_id>/`
196- attachment record: `<quest_root>/baselines/imported/<baseline_id>/attachment.yaml`
197- canonical baseline metric contract JSON: `<baseline_root>/json/metric_contract.json`
198- baseline artifact record: `<quest_root>/artifacts/baselines/<artifact_id>.json`
199- baseline reports: `<quest_root>/artifacts/reports/<artifact_id>.json`
200- confirmed baseline reference: `quest.yaml -> confirmed_baseline_ref`
201
202Global reusable registry paths:
203
204- baseline registry index: `~/DeepScientist/config/baselines/index.jsonl`
205- canonical baseline entry: `~/DeepScientist/config/baselines/entries/<baseline_id>.yaml`
206
207## Baseline id and variant rules
208
209- `baseline_id` should be short, stable, and filesystem-safe
210- use letters, digits, `.`, `_`, or `-`
211- do not use spaces, `/`, `\\`, or `..`
212- if one codebase contains multiple comparable baselines, prefer one `baseline_id` with structured variants instead of inventing many near-duplicate entries
213- when variants exist, keep `default_variant_id`, `baseline_variants`, and per-variant metric summaries stable enough that later `experiment` and `write` stages can cite them directly
214
215Do not invent parallel durable locations when these runtime contracts already exist.
216Do not leave the authoritative metric contract only in chat, memory, or prose once the baseline is accepted.
217
218If a baseline is reproduced only because an analysis campaign needs an extra comparator:
219
220- still place it under the normal baseline roots
221- treat it as a supplementary analysis baseline unless the quest explicitly promotes it into the canonical gate
222- do not call `artifact.confirm_baseline(...)` for that supplementary case unless the quest truly intends to replace the canonical baseline
223
224## Multi-baseline policy
225
226One quest may legitimately need more than one baseline.
227
228- explicitly mark which baseline is the primary downstream comparator
229- distinguish primary comparison baselines from fallback or infrastructure baselines
230- if several baselines are credible, record why the chosen primary baseline is the fairest paper-facing comparator
231- do not leave later stages guessing which baseline is authoritative
232
233## Route order
234
235Prefer this order:
236
2371. attach
2382. import
2393. reproduce
2404. repair
241
242Prefer reuse over redundant reproduction.
243
244## Workflow
245
246### Phase 1. Analysis
247
248Before running anything substantial, determine:
249
250- exact task
251- dataset and split contract
252- metric contract
253- source baseline identity
254- source code path
255- expected run command or evaluation path
256- expected paper or repo numbers when they exist
257- local resource constraints
258
259Default analysis discipline:
260
261- read the source paper and source repo first
262- if runtime already exposes a matching `requested_baseline_ref` or `confirmed_baseline_ref`, validate that concrete object before restarting broad discovery
263- identify the real run or evaluation entrypoint
264- identify the dataset or split and metric contract
265- identify likely environment blockers
266- define the cheapest credible smoke test
267
268Escalate to a fuller audit only when the command path is unclear, the repo is large or confusing, repair mode is active, or custom code changes look likely.
269
270When the fuller audit is necessary, capture only what later stages truly need:
271
272- major entry scripts, configs, and modules
273- end-to-end data flow
274- evaluation path and metric computation path
275- obvious environment assumptions
276- obvious bottlenecks or incompatibilities
277
278If the source paper is available, record:
279
280- the core algorithm in compact, implementation-faithful form
281- the main reported numbers
282- the main weaknesses or bottlenecks likely to matter for this quest
283
284You may inspect local feasibility with shell-based checks for OS, GPU, CPU, RAM, disk, Python version, and whether `uv` is available.
285
286The analysis phase should leave behind a concrete plan rather than only conversational intent.
287
288## Phase 2. Setup
289
290Prepare the selected route:
291
292- attach: validate the selected baseline id and variant
293- import: place the imported baseline metadata under the quest and confirm the package is readable
294- reproduce: prepare the baseline work directory, commands, config pointers, and environment notes
295- repair: identify the precise broken point before rerunning blindly
296
297For Python baselines, standardize environment setup around `uv`.
298
299### Python environment rule: use `uv`
300
301- if the repo already contains `uv.lock` or a solid `pyproject.toml`, use `uv sync`
302- otherwise create a local virtual environment with `uv venv`
303- install dependencies with `uv pip install ...`
304- run setup, smoke tests, and real commands through `uv run ...`
305
306Practical rules:
307
308- prefer a quest-local or baseline-local `.venv`
309- prefer `uv run python ...` or `uv run bash ...` over relying on shell activation state
310- if a specific interpreter is required, make it explicit with `uv venv --python 3.11` or `uv run --python 3.11 ...`
311- if CUDA, PyTorch, JAX, or custom wheels require a special index URL, keep that install under `uv pip`
312- only accept a non-`uv` route when there is a concrete blocker that cannot be resolved locally
313
314Common `uv` patterns:
315
316- `uv sync`
317- `uv venv --python 3.11`
318- `uv pip install -r requirements.txt`
319- `uv run python scripts/smoke_test.py`
320- `uv run python train.py --config ...`
321
322Setup should record:
323
324- baseline id and source identity
325- working directory
326- config files
327- command template
328- expected outputs
329- known deviations from paper or source
330- the chosen `uv` route and Python version
331
332Fallbacks:
333
334- if Hugging Face access is blocked, record and try an approved local mirror such as ModelScope when that does not change the comparison meaning
335- if a quest already depends on `analysis_plan.md` or `REPRO_CHECKLIST.md`, keep the compatibility alias explicit rather than splitting truth across two active plans
336
337## Phase 3. Execution
338
339Run only the work required to establish the baseline credibly.
340
341Execution rules:
342
343- keep commands auditable
344- keep logs durable
345- avoid uncontrolled side experiments during baseline establishment
346- checkpoint only explainable, minimal code changes
347- prefer equivalence-preserving efficiency gains such as larger safe batch size, cache reuse, checkpoint resume, and parallel downloads or workers
348- do not use an efficiency lever if it changes accepted baseline meaning, effective evaluation contract, or trust judgment
349
350Long-running execution discipline:
351
352- run one bounded smoke test before a substantial baseline reproduction
353- once the smoke test passes, launch the real baseline reproduction with `bash_exec(mode='detach', ...)`
354- monitor by forward progress instead of by short-window completion anxiety
355- do not report final success until the command actually finished and the expected result files exist
356- if you need to recover ids or inspect session state, use `bash_exec(mode='history')` or `bash_exec(mode='list')`
357- `bash_exec(mode='read', id=...)` returns the full saved log when it is `2000 lines or fewer`; for longer logs, inspect omitted middle windows with `start` and `tail`
358- during monitoring, prefer `bash_exec(mode='read', id=..., tail_limit=..., order='desc')`, and after the first read prefer incremental checks with `after_seq=last_seen_seq`
359- use `silent_seconds`, `progress_age_seconds`, `signal_age_seconds`, and `watchdog_overdue` as the default staleness clues
360- if a run is clearly invalid, wedged, or superseded, stop it with `bash_exec(mode='kill', id=..., wait=true, timeout_seconds=...)`, document why, and relaunch cleanly
361- do not let more than the `30-minute visibility bound` pass without a real inspection and a `next expected update time`
362- when the baseline code is under your control, prefer a throttled `tqdm` progress reporter and periodic `__DS_PROGRESS__` markers when feasible
363
364Keep retries bounded:
365
366- one smoke test is the default
367- one autonomous fix-and-retry for the same failure class is the normal upper bound
368- if the same failure class returns, stop looping
369
370## Phase 4. Verification
371
372Verification is mandatory before baseline acceptance.
373
374Verify:
375
376- the run actually finished
377- the reported metrics came from the intended dataset and split
378- the metric definitions match the quest contract
379- the result is comparable to the paper, source repo, or selected target
380- any deviations are explicitly stated
381
382Classify the outcome as one of:
383
384- `verified_match`
385- `verified_close`
386- `verified_diverged`
387- `broken`
388
389Verification must explicitly separate:
390
391- likely implementation mismatch
392- environment mismatch
393- data or split mismatch
394- expected stochastic variance
395- unexplained divergence
396
397Verification should answer:
398
399- whether the baseline is trustworthy enough for downstream comparison
400- whether the result is reusable beyond this quest
401- whether another repair or rerun is justified
402- whether the line should stop here and hand off
403
404A verification report should be self-contained enough that a later stage can answer:
405
406- what was used
407- how it was obtained: attach, import, reproduce, or repair
408- what commands and configs were used
409- what metrics are trusted
410- what caveats remain
411- whether the result is reusable beyond this quest
412
413## Baseline comparability contract
414
415The baseline stage is not complete just because something ran.
416It is complete when later stages can compare against it fairly.
417
418Before declaring a baseline usable, make the comparability contract explicit:
419
420- task identity
421- dataset identity and version
422- split contract
423- preprocessing boundary
424- evaluation script or evaluation path
425- required metric keys
426- metric directions
427- seed policy when relevant
428- source commit or source package identity
429- known deviations from the source reference
430
431Unless the user explicitly specifies otherwise, treat the original paper's evaluation protocol as the canonical baseline contract.
432If any of these fields are still materially unknown, do not pretend the baseline is a clean downstream reference.
433For the fuller checklist and verdict meanings, read `references/comparability-contract.md`.
434
435## Feasibility and trust classes
436
437Before acceptance, classify feasibility as one of:
438
439- `full_reproducible`
440- `degraded_but_acceptable`
441- `blocked`
442
443And classify downstream trust as one of:
444
445- `verified`
446- `partially_verified`
447- `operational_but_incomparable`
448- `failed`
449
450Do not silently upgrade a degraded or merely operational result into a normal trusted baseline.
451
452## Minimum baseline artifact content
453
454The accepted baseline artifact should include at least:
455
456- `baseline_id`
457- `baseline_kind`
458- `path`
459- `task`
460- `dataset`
461- `primary_metric`
462- `metrics_summary`
463- `environment`
464- `source`
465- `summary`
466
467If variants exist, also include:
468
469- `default_variant_id`
470- `baseline_variants`
471
472Metric-contract rules:
473
474- if the accepted baseline contract includes multiple metrics, datasets, subtasks, or splits, record all of them in `<baseline_root>/json/metric_contract.json`
475- keep `primary_metric` as the headline metric only; do not let it erase the rest of the comparison surface
476- when confirming a baseline, submit the canonical `metrics_summary` as a flat top-level dictionary keyed by the paper-facing metric ids
477- every canonical baseline metric entry should include `description`, either `derivation` or `origin_path`, and `source_ref`
478- if the paper reports both aggregate and per-dataset or per-task results, preserve both whenever feasible through `metrics_summary` plus structured rows rather than one cherry-picked scalar
479- if the source package already has a richer leaderboard table, structured result file, or `json/metric_contract.json`, reuse that richer contract instead of hand-writing a thinner one that keeps only one averaged scalar
480- `Result/metric.md` is optional temporary scratch memory only; reconcile against it before calling `artifact.confirm_baseline(...)`, but do not treat it as a required durable file
481
482## Publication and reuse
483
484Use the registry deliberately, not as an afterthought.
485
486If the result is reusable beyond the current quest:
487
488- publish it through `artifact.publish_baseline(...)`
489- ensure the payload includes identity, provenance, trusted metrics, and any variant structure
490- set `publish_global: true` only when verification is complete and reuse is justified
491
492If the current quest should reuse an existing baseline:
493
494- attach it through `artifact.attach_baseline(...)`
495- preserve the selected `baseline_id`
496- preserve the selected `variant_id` when one is used
497- keep the attachment durable under `baselines/imported/`
498
499If runtime state already includes `requested_baseline_ref` or a matching `confirmed_baseline_ref`:
500
501- default to reuse-and-verify, not rediscovery
502- treat a creation-time pre-bound baseline as the active starting point unless you find a concrete incompatibility
503- do not rerun broad baseline scouting or full reproduction just because the stage name is `baseline`
504
505For a clearer attach/import/reproduce/repair rubric, read `references/route-selection.md`.
506For reusable-package expectations, read `references/publishable-baseline-package.md`.
507
508## Workspace and branch rules
509
510- treat the baseline workspace as a system-managed reproduction surface, not an unrelated sandbox
511- avoid creating a nested authoritative Git lifecycle inside the baseline workspace
512- use the quest branch unless isolation is genuinely needed
513- if baseline setup is risky or intrusive, prepare an isolated branch or worktree first and record why
514- do not proliferate branches without a reason
515
516## Memory rules
517
518Stage-start requirement:
519
520- by default, begin every baseline pass with `memory.list_recent(scope='quest', limit=5)`
521- then run at least one baseline-relevant `memory.search(...)` before new baseline analysis, repair, or rerun work
522- fast-path exception: if the quest already exposes a clear `requested_baseline_ref` or `confirmed_baseline_ref` and the immediate task is only to validate or reattach that concrete baseline, you may skip broad retrieval
523
524Write memory only for reusable lessons such as:
525
526- paper-to-code mismatch notes
527- environment incidents
528- dataset quirks
529- verification caveats
530- attach vs import vs reproduce vs repair rationale
531
532When calling `memory.write(...)`, pass `tags` as an array like `["stage:baseline", "baseline:<baseline_id>", "type:repro-lesson"]`, not as one comma-joined string.
533
534Stage-end requirement:
535
536- if baseline work produced a durable reproduction lesson, verification caveat, environment incident, or route rationale, write at least one `memory.write(...)` before leaving the stage
537
538## Artifact rules
539
540Typical artifact sequence:
541
542- `progress` for long-running setup or execution checkpoints
543- `report` for analysis notes or verification notes
544- `decision` for route choice, blocked routing, or accept/reject/rerun/repair calls
545- `baseline` only for an accepted baseline record
546
547For stable field shapes, read `references/artifact-payload-examples.md`.
548
549The baseline handoff should make these items obvious:
550
551- `baseline_id`
552- `baseline_variant_id` when relevant
553- route used: attach, import, reproduce, or repair
554- trusted metrics
555- canonical metric contract JSON path
556- verification outcome
557- reusable or quest-local only
558- canonical output paths
559- main caveats
560- recommended next anchor
561
562If this packet is not obvious from the accepted artifact plus verification note, the baseline line is not stable enough yet.
563
564## Failure and blocked handling
565
566Do not hide failures.
567
568If blocked, record the class explicitly:
569
570- `missing_source`
571- `missing_code`
572- `missing_metric_contract`
573- `environment_infeasible`
574- `command_unknown`
575- `run_failed`
576- `verification_failed`
577
578A blocked result must state:
579
580- what failed
581- what was tried
582- which paths or logs show the issue
583- whether the next best move is attach, import, retry, repair, reset, or ask the user
584
585Reasonable autonomous fixes before escalation:
586
587- missing module or dependency
588- wrong dataset path
589- permission errors on scripts
590- reasonable batch-size reductions for OOM
591- obvious environment activation mistakes
592
593If a fix would change confirmed scope, metrics, permissions, or resource assumptions, stop and return to analysis rather than applying it silently.
594
595## Exit criteria
596
597Exit the baseline stage once one of the following is durably true:
598
599- a baseline is attached and accepted
600- an imported baseline is accepted
601- a reproduced baseline is verified and accepted
602- a broken route has been declared blocked and a next decision is recorded
603
604Typical next anchors:
605
606- `idea`
607- `experiment` in tightly scoped follow-on cases
608- `decision` if the baseline line remains contested