willoscar/writer-selfloop
|
npx skills add https://github.com/WILLOSCAR/research-units-pipeline-skills --skill writer-selfloop
Purpose: make writing converge without rewriting the whole paper.
This is the writing self-healing loop:
Treat the gate as a router, not as a reason to rewrite everything.
If you do not run the helper script, you can still execute this skill by reading sections/*.md + packs and writing output/WRITER_SELFLOOP_TODO.md manually in the same PASS/FAIL style.
Mission: make the draft converge by fixing only failing units and routing issues upstream when needed.
Do:
Avoid:
Mission: connect a visible writing failure to the earliest upstream fix.
Do:
Avoid:
You are the writing manager for a survey draft.
Your job is to make the draft converge by fixing only what fails, and by routing issues to the earliest responsible artifact.
Rules:
- If a section fails because the evidence is thin or out-of-scope pressure is high, do NOT pad prose.
Route upstream to evidence-selfloop (notes/bindings/packs) and unblock the substrate.
- If a section fails because the prose is templated (narration openers, slide navigation, repeated disclaimer spam), rewrite locally.
- Never change citation keys during rewrites; keep scope local.
Working style:
- small, auditable edits
- one failing file at a time
- every fix either (a) improves argument moves, or (b) restores paper voice
sections/ + sections/sections_manifest.jsonl)sections/sections_manifest.jsonl (expected files + allowed citations)sections/*.md (the actual prose units)outline/writer_context_packs.jsonl (preferred per-H3 pack)outline/evidence_bindings.jsonlcitations/ref.bibOptional routing context:
output/EVIDENCE_SELFLOOP_TODO.md (if evidence gaps are already known)outline/subsection_briefs.jsonl, outline/chapter_briefs.jsonloutput/WRITER_SELFLOOP_TODO.md (report-class; always written)1) Run the gate
sections/sections_manifest.jsonl and the actual sections/*.md files.2) Read the TODO report
output/WRITER_SELFLOOP_TODO.md and identify the failing file paths.outline/writer_context_packs.jsonl.outline/subsection_briefs.jsonl; for chapter-level context (leads/throughlines), consult outline/chapter_briefs.jsonl.3) Triage (writing vs evidence)
Route upstream (run evidence-selfloop) when:
output/EVIDENCE_SELFLOOP_TODO.md already indicates missing anchors/comparisons for the same subsectionoutline/writer_context_packs.jsonl is too thin to satisfy argument moves without guessingoutline/evidence_bindings.jsonlRewrite locally when:
4) Use the right playbook for the failing file type
sections/abstract.md, sections/S<sec_id>.md for Intro/Related Work, sections/discussion.md, sections/conclusion.md): use front-matter-writer.sections/S<sec_id>_lead.md): use chapter-lead-writer.sections/S<sub_id>.md): use subsection-writer (draft) or subsection-polisher (local fix).5) Keep scope + citations stable
citations/ref.bib.outline/evidence_bindings.jsonl (prefer subsection-first).6) Rerun the gate until PASS
After PASS (merge-aware voice safety):
style-harmonizer -> opener-variator ->section-logic-polisher -> paragraph-curator ->
evaluation-anchor-checker -> final argument-selfloop snapshot -> optional
transition-weaver -> section-merger -> post-merge-voice-gate.
post-merge-voice-gate FAILs with source: transitions, transitioninsertion was explicitly enabled; fix outline/transitions.md and re-merge.
After PASS (mandatory style hygiene for all survey-family profiles):
output/WRITER_SELFLOOP_TODO.md and read ## Style Smells.style-harmonizer on the listed sections/*.md files.overview narration, then runopener-variator on the listed files.
Two limitations ...), run limitation-weaver on the listed files.evaluation-anchor-checker on thesettled H3 files, then regenerate the argument/manifest snapshot.
tension_statement + thesis from the pack to rewrite paragraph 1 (end with the thesis).comparison_cards to write explicit A-vs-B contrast sentences.evaluation_anchor_minimal / protocol snippets to add task/metric/constraint context.Narration opener -> content claim:
This subsection surveys ...Slide navigation -> argument bridge:
Next, we move from X to Y.Having established X, we can now examine how Y changes the trade-offs under comparable protocols.Meta \"survey should\" -> literature-facing observation:
Therefore, survey comparisons should ...Across reported protocols, ... varies, which makes ... fragile unless ...Disclaimer spam -> one policy paragraph + local caveat only when needed:
Stop and route upstream if:
The writer gate emits short issue codes. Treat them as routers and stop trying to pad prose around missing evidence.
First classify failures:
evidence-selfloop).Quick map (common codes):
missing_sections_manifest, empty_sections_manifest, sections_missing_files: run subsection-writer (create missing files + refresh manifest).sections_h3_has_headings: remove headings; H3 bodies are body-only.sections_intro_*, sections_related_work_*: rewrite front matter via front-matter-writer (dense positioning + one methodology note).sections_h3_too_few_paragraphs, sections_h3_too_short: if the pack is rich, expand by executing contrasts + eval anchor + limitation; if the pack is thin, route to evidence-selfloop.sections_h3_missing_contrast: add explicit A-vs-B using comparison_cards; if cards are missing, route to evidence-selfloop (briefs/packs).sections_h3_missing_eval_anchor, sections_h3_missing_cited_numeric: add minimal protocol context (task/metric/constraint) in the same paragraph; if unknown, route upstream or weaken the claim.sections_h3_missing_limitation: add a subsection-specific limitation; if none exists in the pack, route upstream.sections_h3_narration_template_opener, sections_h3_slide_narration, sections_contains_pipeline_voice: rewrite openers/bridges to paper voice (no navigation commentary).sections_h3_evidence_policy_disclaimer_spam: delete repeats; keep evidence policy once in front matter.sections_cites_missing_in_bib: rerun citation-verifier (do not invent keys).sections_cites_outside_mapping: rewrite to in-scope OR fix mapping/bindings (C2/C4) and rebuild packs; do not patch in the merged draft.sections_h3_sparse_citations: if scope allows, plan adds via citation-diversifier then apply via citation-injector; if scope is too tight, expand mapping/bindings upstream.uv run python .codex/skills/writer-selfloop/scripts/run.py --workspace <workspace>--workspace <dir>--unit-id <U###>--inputs <semicolon-separated>--outputs <semicolon-separated>--checkpoint <C#>sections/*.md:uv run python .codex/skills/writer-selfloop/scripts/run.py --workspace <workspace>Take willoscar/writer-selfloop from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.