Ds write

From OpenLAIR/dr-claw · View interactive version

Ds write is an AI agent skill from the GitHub repository OpenLAIR/dr-claw. Use when a quest has enough evidence to draft or refine a paper, report, or research summary without inventing missing support.

How to use this skill

Skill file

Write

Use this skill to turn accepted evidence into a faithful draft, report, or paper bundle.

This skill intentionally absorbs the strongest old DeepScientist writing discipline, including:

Interaction discipline

Stage purpose

The write stage does not exist to make the quest sound finished.

It exists to test whether the current evidence can support a stable narrative.

Writing should happen on a dedicated paper/* branch/worktree derived from the source main-experiment run/* branch.

Treat that paper branch as the writing surface, and treat the parent run branch as the evidence source that writing must faithfully reflect.

Do not run new main experiments from the paper branch; if writing exposes a missing evidence requirement, route back through decision, activate_branch, experiment, or analysis-campaign.

Once an outline is selected, treat that branch/worktree as an active paper line with its own contract, not just as a late draft folder.

If the evidence is incomplete, contradictory, or too weak, the correct output is:

not a polished fiction.

For paper-like deliverables, the durable contract is outline-first, not prose-first.

The approved outline should be a real structured object, typically containing:

Treat the approved outline as the paper contract, not just a narrative sketch.

It should decide:

If the selected outline is missing those links, repair the outline and matrix before further drafting.

Prefer an author-facing outline folder under paper/outline/ with section-level files, and treat paper/selected_outline.json as the compiled compatibility view of that contract.

paper/evidence_ledger.json remains the runtime truth of what evidence actually exists and where it maps.

Writing mental guardrails

Use when

Do not use when

Preconditions and gate

Before writing seriously, confirm:

If major claims lack evidence, surface the gap first.

If the selected outline, outline folder, evidence ledger, or matrix feels underspecified, read references/outline-evidence-contract-example.md before drafting further.

For paper-facing work, use this hard order instead of drifting between surfaces:

  1. refresh the active outline folder section files first when they exist
  2. sync the compiled paper/selected_outline.json
  3. confirm paper/evidence_ledger.json reflects the same mapped evidence set
  4. only then draft, revise, review, or bundle prose

Do not draft first and promise to repair the paper contract later.

If the current blocker set is not obvious from files, call artifact.get_paper_contract_health(detail='full') before deciding whether to keep writing or to return to contract repair / supplementary work.

If the active quest status, current workspace, recent durable runs, or pending interaction state is unclear after a restart, call artifact.get_quest_state(detail='summary') first.

If the exact current brief/plan/status/summary wording matters for the current drafting decision, call artifact.read_quest_documents(...) instead of relying on prompt-injected excerpts.

If you need earlier user/assistant continuity to interpret the current writing request, call artifact.get_conversation_context(...) before changing the route.

Truth sources

Use these as the canonical evidence base:

Do not rely on memory alone for numbers.

Always prefer direct artifact paths for claims.

Do not keep drafting from remembered storyline summaries if the active paper line already has a stricter durable contract in its outline folder, selected outline, evidence ledger, experiment matrix, or paper-facing analysis mirrors.

Required durable outputs

The write stage should usually produce most of the following:

The exact paths may vary, but the structure and meaning should remain clear.

Treat the author-facing outline folder and compiled selected outline together as the authoritative blueprint for the draft.

If both exist, update the outline folder first and then keep paper/selected_outline.json synchronized as the compiled compatibility output.

Treat paper/draft.md or the equivalent working note as the running evidence ledger where useful findings, citation notes, and writing decisions are accumulated as work proceeds.

After every significant search, plot, paragraph, revision pass, or claim downgrade, update the working note and writing plan immediately so important writing state is not trapped in transient chat output.

For any substantial paper-writing line, keep paper/writing_plan.md or an equivalent durable plan detailed enough that another agent could resume from it without reconstructing the full logic from chat alone.

Also externalize the major writing reasoning into durable notes instead of leaving it only in transient chat.

At minimum, keep these up to date when they are relevant:

Prefer the same compact reasoning-note shape for those files when possible:

Also keep a compact authenticity checklist visible throughout the writing line.

At minimum, repeatedly verify:

Paper experiment matrix contract

For any paper-like writing line that has more than a trivial single-result story, create and maintain:

Use references/paper-experiment-matrix-template.md when helpful.

Use references/outline-evidence-contract-example.md when the paper line needs a concrete example of section binding, required_items, and result_table updates.

The paper experiment matrix is the planning and reporting surface for the paper line.

It is not the master truth when it disagrees with the selected outline contract or paper/evidence_ledger.json.

It exists to prevent two common failures:

The matrix is not just an “analysis list”.

It should cover the full paper-facing experiment program beyond the already-finished main run, including:

The matrix should also act as the ingestion gate for completed follow-up analysis:

The outline should be revised in lockstep with that matrix:

Case study is usually optional.

Do not let it displace stronger quantitative evidence.

Efficiency or cost experiments are not mandatory in every paper, but they should be added whenever:

Highlight-validation rule:

Typical highlight hypotheses include:

Each matrix row should normally record at least:

The matrix should also contain:

Main-text drafting gate:

remains unaddressed

This does not forbid drafting the introduction, method, or placeholders early.

It does forbid pretending the paper's experimental story is settled while the feasible experiment frontier is still open.

After every meaningful experiment outcome, even a null result or exclusion:

Do not decide the next supplementary experiment from memory alone when the matrix exists.

The matrix should be the authoritative experiment-routing surface for the paper line, and the selected outline's experimental_designs should stay consistent with that matrix rather than drifting away from it.

Before drafting any section, verify all of the following:

If any of those checks fails, stop drafting and repair the paper contract first.

Venue template selection

For paper-like writing, use a real venue template rather than improvising a blank LaTeX tree.

Bundled templates live under templates/ inside this skill and are mirrored into each quest skill bundle.

Available starting points currently include:

Selection rules:

Before durable drafting, copy the chosen template directory into the active paper workspace's paper/latex/ and keep the template's main entry file as the build root.

Then draft inside that paper/latex/ tree instead of inventing a fresh scaffold.

Preserve upstream venue files unless a real compile fix or venue-specific adaptation requires a change.

These vendored templates were imported from Orchestra-Research/AI-Research-SKILLs/20-ml-paper-writing under the MIT license for local-first use.

Read templates/DEEPSCIENTIST_NOTES.md for the local selection guide and templates/README.md for the upstream template notes.

Workflow

Phase 0. Ordering discipline

For paper-like deliverables, the safest default order is:

  1. consolidate evidence and literature
  2. activate or create the dedicated paper/* branch/worktree derived from the source run branch before durable outline selection or drafting
  3. choose the venue template from templates/, copy it into paper/latex/, and default general ML work to templates/iclr2026/ unless a stronger venue target exists
  4. if the line benefits from an explicit outline contract, record one or more outline candidates with artifact.submit_paper_outline(mode='candidate', ...)
  5. if one outline should become the durable paper contract, select or revise it with artifact.submit_paper_outline(mode='select'|'revise', ...); that selection should be treated as opening or refreshing the active paper line
  6. if the outline folder flow is enabled, create or refresh paper/outline/manifest.json and the relevant section files before stabilizing the experiments section
  7. create or refresh paper/paper_experiment_matrix.md and paper/paper_experiment_matrix.json before stabilizing the experiments section
  8. if the selected outline or matrix still exposes evidence gaps, launch an outline-bound and matrix-bound artifact.create_analysis_campaign(...) before drafting the experiments section as if it were settled
  9. after every completed follow-up slice, reopen the selected outline and confirm the corresponding result_table row now reflects the real result rather than a placeholder
  10. if the outline folder exists, immediately sync the affected section files so experiment setup, findings, and impact stay current on the paper line
  11. after that sync, confirm paper/evidence_ledger.json and the paper line summary still agree before continuing prose work
  12. plan and generate decisive figures or tables
  13. draft sections directly from the evidence and the current working outline; do not force extra outline rounds when direct drafting is clearer and safer
  14. run harsh review and revision cycles
  15. proof, package, submit artifact.submit_paper_bundle(...) when the bundle is ready, and then pass to finalize
  16. if the final paper PDF exists and QQ milestone media is enabled in config, the bundle-ready milestone may attach that PDF once

Before real drafting, force one explicit planning pass that stabilizes at least:

If these are still unstable, continue planning or route back for evidence instead of polishing prose early.

Do not rush into polished prose before evidence assembly, figure planning, and citation verification are far enough along to keep the draft honest.

If writing uncovers missing information, it is acceptable to return to focused literature search or artifact reading, but persist the findings immediately before resuming drafting.

Use web search to discover missing papers or references, and use artifact.arxiv(paper_id=..., full_text=False) when you need to actually read an arXiv paper rather than just locate it.

Only set full_text=True when the shorter view is insufficient for the needed detail.

Before treating related work coverage as adequate, run broad literature discovery and reading passes; for a normal paper-like deliverable, aim for roughly 30 to 50 verified references unless the scope clearly justifies fewer.

For substantial paper-like writing, the durable writing plan should usually include:

Treat that plan as an execution contract.

Do not let drafting quietly outrun the current evidence inventory.

For reviewer-facing structure and section-level drafting contracts, read these references when the line needs sharper paper craft:

Phase 1. Evidence assembly

Before drafting, assemble the current evidence base:

Also build an experiment inventory before outlining:

When building the matrix, do not reduce the candidate pool to “analysis experiments”.

The inventory should explicitly consider:

If the method appears to have a likely practical or deployment-facing strength, test it directly instead of burying that possibility in prose.

If the method appears to have a likely conceptual highlight, write the corresponding highlight hypothesis and treat it as something that still needs evidence rather than something to assume.

If an experiment is too weak, too tiny, or poorly comparable, do not let it silently anchor a main claim.

As a strong default, experiments with very small evaluation support, such as <=10 effective examples or similarly fragile sample counts, should not carry a main-text claim unless the user explicitly accepts that limitation and the caveat is written next to the claim.

If the draft will describe the method as a coherent proposal rather than a bag of edits:

Write down the intended claims first.

For each claim, ask:

When baseline numbers are used, also ask:

Phase 2. Evidence-gap check

If evidence is missing, weak, or contradictory:

Do not scatter many tiny gap requests unless the quest truly needs that structure.

Phase 3. Storyline and outline

The storyline should be evidence-led:

For substantial lines, keep three layers explicit:

A strong outline often benefits from a five-part story arc:

Keep the narrative discipline explicit:

Useful near-source craft heuristics from strong ML writing guidance:

Recommended writing-guide style suggestions for this stage:

When useful, reverse-engineer the story explicitly as:

And a three-part contribution frame:

Do not optimize for rhetorical drama over factual support.

Outline-construction rules:

If the deliverable is a paper or paper-like report, pressure-test the outline against a compact question set before drafting:

Also pressure-test it with a reviewer-first scan:

The outline should already imply what belongs in:

If a planned section has no credible evidence payload, shrink it before drafting instead of padding it with generic prose.

If the selected outline still requires uncollected evidence, route to an outline-bound analysis-campaign instead of drafting around the gap.

Phase 3.1 Outline selection rubric

When several outline drafts exist, choose the winner explicitly rather than by vibe.

Prefer the outline that best satisfies the following paperagent-like rubric:

  1. method fidelity
  1. evidence support
  1. story coherence
  1. research-question quality
  1. experiment ordering quality
  1. downstream draftability

When recording the selection, explain:

Do not leave this reasoning only in transient chat.

Record it in paper/outline_selection.md or a durable report/decision artifact.

Phase 4. Drafting

Draft the sections that the evidence can currently support, typically:

Method fidelity rules:

Paper-oriented drafting defaults:

Sentence- and paragraph-level clarity suggestions:

Word-choice suggestions:

After the experiments section stabilizes, revisit the introduction and contribution framing.

If the experimental outcome changed the real story, rewrite the introduction so that motivation, claimed contributions, and significance match the actual results rather than the earlier hope.

Phase 5. Citation integrity

Never generate references from memory.

A thin bibliography created from convenience searches is not acceptable.

For a normal paper-like deliverable, the default target is roughly 30 to 50 verified references unless the scope clearly justifies fewer.

Every final citation must correspond to a real paper you verified from an actual source; do not cite from memory, model recall, or unverified secondary summaries.

Use one consistent citation workflow: SEARCH -> VERIFY -> RETRIEVE -> VALIDATE -> ADD.

For discovery, use Semantic Scholar by default or Google Scholar through normal manual search / export only.

Google Scholar has no official API, so do not treat Scholar scraping as a normal automated backend.

Use Crossref / DOI, arXiv, OpenAlex, and publisher metadata as verification or metadata backfill sources around that same workflow.

Store actual bibliography entries in paper/references.bib as valid BibTeX copied or exported from Google Scholar, Semantic Scholar-linked metadata, DOI/Crossref, publisher pages, or another legitimate metadata source.

Do not hand-write BibTeX entries from scratch.

For each important citation:

  1. search from primary or reliable discovery sources
  2. verify the citation exists in at least two compatible ways when feasible
  3. prefer DOI-based BibTeX retrieval when DOI exists
  4. confirm the cited claim actually appears in the source
  5. record the citation note immediately in the draft or writing notes, and place the actual BibTeX entry in paper/references.bib
  6. if verification fails, keep an explicit placeholder and mark it unresolved

Do not hide citation uncertainty.

Do not leave search findings only in transient chat state; persist them in the working draft or writing notes immediately.

If you must touch a BibTeX entry manually, limit it to mechanical cleanup of an already exported entry rather than authoring the citation metadata yourself.

Before artifact.submit_paper_bundle(...), do one explicit reference audit for count, existence, and claim-level spot checks.

If verification remains incomplete, do not present the draft or bundle as final.

Citation resources

Use these as the normal citation-resource stack for the workflow above:

Practical role split:

Phase 6. Figures and tables

If the deliverable includes figures or tables:

Selection rules:

When generating visuals:

Each figure or table should be traceable to source artifacts.

Phase 7. Claim-evidence map and self-review

Before the full adversarial self-review, run a quick reviewer-first pass and record it in paper/reviewer_first_pass.md.

That pass should answer:

Before declaring writing complete, build a claim-evidence map.

For each key claim, record:

Also keep the related-work and figure reasoning explicit:

Then run a harsh self-review:

Also check:

The review should be section-aware.

For each serious issue, record:

The self-review output should also make the verification logic externally legible:

When useful, add explicit “questions for the author” style prompts to expose what still needs proof or clarification.

If the draft is targeting publication quality, compare against a few strong nearby papers or templates only to raise quality, never to copy unsupported claims.

Run that review with an adversarial mindset:

When the draft is substantial enough to judge rather than merely sketch, open review/SKILL.md for an independent skeptical audit before you call the paper task done.

Use that review pass to decide whether the next route is further writing, a claim downgrade, a literature audit, a baseline recovery step, or a reviewer-linked follow-up experiment campaign.

Phase 7.5. Revision loop

Do not stop after a single self-review pass.

For paper-style deliverables, a strong default is a five-pass revision loop:

  1. fix critical accuracy and evidence issues
  2. verify structural and checklist compliance
  3. repair narrative flow and logical transitions
  4. polish wording, citations, figures, and tables
  5. run a final verification pass against the original claim-evidence map

For each pass:

If the draft still fails a critical pass, do not pretend the revision loop is complete.

Phase 8. Visual proofing

If the output is paper-style:

For markdown-only deliverables, perform an equivalent rendered read-through rather than checking only source text.

During that rendered read-through, explicitly inspect the first page for title clarity, abstract readability, contribution visibility, and early figure/table effectiveness.

Phase 9. Submission gate

Before marking the writing line complete, verify:

If a critical packaging issue remains, mark the stage as blocked or warn explicitly.

Required file expectations

`claim_evidence_map.json` minimum shape

{
  "claims": [
    {
      "claim_id": "C1",
      "claim_text": "The method improves F1 on the target benchmark.",
      "support_status": "supported",
      "evidence_paths": [
        "artifacts/runs/run-main-001.json",
        "experiments/main/run-main-001/metrics.json"
      ],
      "caveats": ["Gain is strongest on split A."]
    }
  ]
}

`figure_catalog.json` minimum shape

{
  "figures": [
    {
      "id": "F1",
      "path": "paper/figures/fig1.pdf",
      "script_path": "paper/figures/generate_figures.py",
      "source_artifacts": ["artifacts/runs/run-main-001.json"],
      "claim_ids": ["C1"],
      "style_notes": {
        "grayscale_safe": true
      }
    }
  ]
}

`table_catalog.json` minimum shape

{
  "tables": [
    {
      "id": "T1",
      "path": "paper/tables/table1.tex",
      "source_artifacts": ["artifacts/runs/run-main-001.json"],
      "claim_ids": ["C1"],
      "layout_notes": {
        "overflow_checked": true
      }
    }
  ]
}

`compile_report.json` minimum shape

{
  "success": true,
  "status": "passed",
  "entry_path": "paper/main.tex",
  "pdf_path": "paper/build/paper.pdf",
  "log_path": "paper/build/latexmk.log",
  "page_images_manifest_path": "paper/proofing/page_images_manifest.json",
  "visual_recheck_completed": true
}

`page_images_manifest.json` minimum shape

{
  "pages": [
    {
      "page": 1,
      "image_path": "paper/proofing/page-001.png",
      "audit_notes": ["Main figure readable", "No visible overflow"]
    }
  ]
}

`submission_checklist.json` minimum shape

{
  "overall_status": "ready",
  "checks": [
    {
      "key": "references_integrity",
      "status": "pass",
      "notes": "Verified citations recorded."
    }
  ],
  "blocking_items": [],
  "handoff_ready": true
}

Memory rules

Stage-start requirement:

Use memory for reusable lessons only, such as:

Do not use memory as the only record of the draft state.

Preferred memory usage:

Use tags to refine meaning when helpful, for example:

When calling memory.write(...), pass tags as an array like ["stage:write", "type:writing-playbook", "type:evidence-ledger"], not as one comma-joined string.

Recommended read timing:

Write quest memory when:

Stage-end requirement:

Promote to global memory only when the lesson is clearly reusable beyond this quest.

Artifact rules

Typical artifact sequence:

Preferred artifact choices:

Keep each writing artifact tightly linked to evidence paths.

Hard integrity rules

Failure and blocked handling

Common blocked states:

Record blocked writing clearly and route the quest to the correct next step.

Extra references

Use these references when the deliverable is paper-like and you need a denser operating checklist:

Exit criteria

Exit the write stage only when one of the following is durably true:

For paper-like writing, do not treat the draft as evidence-complete enough for finalize while paper/paper_experiment_matrix.* still contains currently feasible non-optional rows that remain unresolved.

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.