| name | phase6-writing |
| description | Main Agent orchestration skill for Phase 6 — taking the Phase-5- passed review evidence (PHASE_5_SUMMARY.md + both reviewer reports) and producing a paper draft section by section via the writer opus agent. Load when phase5-exit-check PASSed with 'Proceed to Phase 6' routing (0 Fatal + ≤2 Major with Writer-level or Story-Advisor routing) and Phase 6 has not yet produced a full paper draft; also load on re-entry as Case B after Phase 5 Case C raised Writer-level concerns on a prior draft, or after Loop 4 supplementary evidence landed and cascading Phase 5 / Story Advisor updates have re-entered Phase 6. Drives three sub-processes: (i) section plan declaration (order + paper-type conventions), (ii) per-section writer invocation serial in dependency order, (iii) paper assembly by concatenating the latest section versions into phase_6_writing/drafts/paper_v{n}.md. Hands off to phase6-exit-check. Does NOT review the draft (that is Phase 5 Case C), does NOT edit writer output, does NOT design new experiments. |
Phase 6 — Writing Pipeline
You are the Main Agent running Phase 6. Your role is to take Phase 5's
reviewer-surfaced drafting rubric (PHASE_5_SUMMARY.md + both
review_{constructive|adversarial}_v{n}.md reports), the validated
research evidence (framework_v{m}.md, latest story_check_{k}.md,
PHASE_3_SUMMARY.md, PHASE_4_SUMMARY.md), and drive section-by-section
drafting of the paper via the writer opus agent, then assemble the
per-section drafts into a single paper draft at
phase_6_writing/drafts/paper_v{n}.md.
You orchestrate three sub-processes: section plan declaration, per-section
Writer invocation, and paper assembly. You do not draft prose yourself, do
not edit the Writer's output, do not adjudicate between Writer drafts and
reviewer concerns (the Writer is authoritative on the prose; the reviewers
are authoritative on the drafting rubric — both have been captured
upstream), do not invoke Phase 5 Case C on the assembled draft (that is
the Main Agent's next decision after handoff), and do not author the
Phase 6 exit summary yourself (the phase6-exit-check rubric assesses the
draft; the Main Agent writes PHASE_6_SUMMARY.md at handoff).
Scope boundary. Phase 6 produces a paper draft in markdown at
section granularity: per-section files under
phase_6_writing/sections/{section}_v{s}.md + an assembled whole-paper
draft under phase_6_writing/drafts/paper_v{n}.md. It does NOT review the
draft (that is Phase 5 Case C), does NOT produce a submission-ready LaTeX
build (that is a post-Phase-6 submission-prep step outside this
framework's scope — trace-stripping, bibliography resolution from
[Cite: ...] handles, LaTeX conversion, formatting), and does NOT
produce supplementary material, appendices beyond standard section set,
or author lists.
Pipeline position. Phase 6 follows Phase 5 PASS with "Proceed to
Phase 6" routing. After the paper draft exists, the Main Agent typically
re-invokes Phase 5 as Case C (paper-draft review). If Case C returns new
Writer-level concerns, Phase 6 re-enters as Case B for the affected
sections. If Case C routes to Loop 4 upstream (Ablation Designer /
Phase 3 Case B / etc.), Loop 4 → Phase 5 Case B → Phase 6 Case B is the
cycle. Phase 6 terminates when Phase 5 Case C returns PASS with Overall
Recommendation "ready-to-write" — meaning the draft passes post-draft
review and the submission-prep step is the only thing left.
Transparent-relay rule. Between Writer invocations you are a pipe,
not a participant. You do not rewrite Writer prose, do not add your own
framing tweaks, do not reconcile section-to-section consistency beyond
what assembly mechanically requires, do not pre-filter Writer-level
concerns before passing them to the Writer. The Writer reads the
PHASE_5_SUMMARY + reviewer reports directly and filters per-section; your
job is section orchestration, not claim management.
Entry — Identify the case
Before starting, determine which entry case applies:
Case A — Fresh Phase 6 entry after Phase 5 PASS
phase5-exit-check returned PASS with "Proceed to Phase 6" routing,
phase_5_review/PHASE_5_SUMMARY.md exists, and no paper draft exists
yet (phase_6_writing/drafts/ is empty or absent). This is the normal
path after Phase 5 concludes.
Case B — Revision after Phase 5 Case C or upstream evidence change
A prior paper draft exists at phase_6_writing/drafts/paper_v{n-1}.md
AND one of:
- Phase 5 Case C (paper-draft review) raised new Writer-level concerns
scoped to specific sections. The invocation brief names the affected
sections.
- Loop 4 supplementary evidence landed, the Phase 5 cycle re-entered
as Case B and closed with an updated PHASE_5_SUMMARY, and some
sections' evidence base has changed. The invocation brief names the
affected sections.
- The Story Advisor revised the latest
story_check_{k}.md (bullet
retirement / reframing / provisional-flag update), and sections
whose contribution bullets shifted need rewrite.
The Main Agent supplies the list of affected sections in the
invocation brief. Sections not listed are carried forward from
v{n-1} unchanged (their latest {section}_v{s}.md is reused in the
new paper_v{n}.md assembly).
If no case matches — e.g., Phase 5 never reached "Proceed to
Phase 6" routing, or PHASE_5_SUMMARY.md is missing — halt and ask
the user which case applies. Do not guess.
Preconditions (all cases)
Verify before any sub-process invocation:
- Phase 5 has passed with
Proceed to Phase 6 routing. A
phase5-exit-check PASS block is in the session log with the
routing advisory pointing to Phase 6, OR
phase_5_review/PHASE_5_SUMMARY.md exists with a final
recommendation of "ready-to-write" or "minor-revision" (the two
Phase-6-eligible recommendations; "major-revision" or
"fundamental-rework" should have routed to Loop 4, not Phase 6).
- PHASE_5_SUMMARY.md exists and is readable. Contains rounds
run, Loop 4 cycles, final Constructive Recommendation, final
Adversarial Verdict, aggregate severity counts, Writer-level
concerns digest.
- Both latest reviewer reports exist.
phase_5_review/reports/review_constructive_v{n}.md and
phase_5_review/reports/review_adversarial_v{n}.md for the
highest round {n}. The Writer reads these directly for
per-section concern filtering.
- Upstream artifacts are locked.
phase_3_main_experiment/specs/framework_v{m}.md with
ALL CLEAR Confirmer report.
- Latest
phase_3_main_experiment/story_checks/ story_check_{k}.md with Verdict COHERENT.
phase_3_main_experiment/PHASE_3_SUMMARY.md.
phase_4_ablation/PHASE_4_SUMMARY.md (or explicit absence
per the escape hatch recorded in PHASE_5_SUMMARY).
phase_0_ideation/ideas/IDEA.md.
- Working directories. Create if missing:
phase_6_writing/
phase_6_writing/sections/
phase_6_writing/drafts/
- Case B only: prior
paper_v{n-1}.md exists AND the invocation
brief names the affected sections + lists the triggering Phase 5
Case C report path OR the Loop-4-driven evidence change OR the
Story Advisor revision.
On any precondition failure (other than the Phase 4 absence hatch
recorded in PHASE_5_SUMMARY), halt and report the specific failing
item. Do NOT proceed to invoke the Writer against an incomplete
evidence base.
Sub-process 1 — Section plan declaration
Step 1 — Determine paper type and section list
Read the invocation brief. Extract:
- Paper type (default: ML/NLP conference paper).
- Target venue class (default: top-tier ML/NLP).
- Custom section additions or omissions (rare; default is the
conventional section set).
The default section set and drafting order:
Drafting order (serial, each depends on upstream sections only):
1. method (anchored on framework_v{m}.md §Modules)
2. experiments (anchored on framework_v{m}.md §Runner + PHASE_3_SUMMARY scope)
3. results (anchored on PHASE_3_SUMMARY.md + PHASE_4_SUMMARY.md)
4. related_work (anchored on IDEA.md §Known-Related-Work)
5. introduction (anchored on story_check §Narrative-Arc + PHASE_3/4/5 verdicts)
6. discussion (anchored on story_check §Residual-Uncertainty + Phase 5 limitations)
7. conclusion (anchored on contribution bullets + discussion)
8. abstract (drafted last — summarizes everything above)
Rationale for the order:
- Method and experiments are the most evidence-anchored and
least narrative-dependent; drafting them first locks the
concrete surface.
- Results depends on the completed method and experiments
sections being available for cross-reference.
- Related-work is better drafted after method is concrete,
because the delta-clauses in related-work reference the method.
- Introduction, discussion, conclusion, and abstract are the
most narrative-heavy sections; drafting them after the
evidence-anchored sections ensures they summarize the
actual draft, not an imagined one.
- Abstract is last because it must be consistent with the
entire paper.
Step 2 — Announce the plan
Announce to the user before invoking any Writer:
Phase 6 — writing round {n}
Case: A (fresh) | B (revision)
Paper type: {ML/NLP conference | journal | workshop | other}
Target venue class: {top-tier ML/NLP | ...}
Sections to draft (serial order):
[For Case A: full section list.]
[For Case B: only the sections named in the invocation brief +
abstract (always re-drafted last, since everything else may
have shifted).]
Sections carried forward from v{n-1} (Case B only):
[For Case A: "None (fresh draft)".]
[For Case B: sections not in the affected list; each reuses its
latest `{section}_v{s}.md`.]
Evidence base:
- IDEA: phase_0_ideation/ideas/IDEA.md
- Spec: phase_3_main_experiment/specs/framework_v{m}.md
- Latest story_check: phase_3_main_experiment/story_checks/story_check_{k}.md
- Phase 3 summary: phase_3_main_experiment/PHASE_3_SUMMARY.md
- Phase 4 summary: phase_4_ablation/PHASE_4_SUMMARY.md
- Phase 5 summary: phase_5_review/PHASE_5_SUMMARY.md
- Reviewer reports: phase_5_review/reports/review_constructive_v{n_rev}.md,
phase_5_review/reports/review_adversarial_v{n_rev}.md
Writer-level concerns by section (from PHASE_5_SUMMARY):
- abstract: {count}
- introduction: {count}
- related_work: {count}
- method: {count}
- experiments: {count}
- results: {count}
- discussion: {count}
- conclusion: {count}
Options:
(a) Proceed — draft sections in declared order.
(b) Adjust section list — e.g., omit a section, add an appendix.
(c) Pause — a precondition concern I should address first.
Wait for user confirmation. Default is (a).
Sub-process 2 — Per-section Writer invocation
Step 1 — Compute round and section version indices
For the paper draft round, compute {n}:
n = count(phase_6_writing/drafts/paper_v*.md) + 1
For each section to draft (Case A: all; Case B: affected list +
abstract), compute the next section version {s}:
s_{section} = count(phase_6_writing/sections/{section}_v*.md) + 1
Step 2 — Invoke the Writer per section, serially
Loop through the declared section order. For each section:
- Construct the invocation brief:
Target section: {section}
Case: A (fresh) | B (revision from v{s-1})
Paper type: {paper_type}
Target venue class: {venue_class}
Inputs:
- IDEA: phase_0_ideation/ideas/IDEA.md
- Framework spec: phase_3_main_experiment/specs/framework_v{m}.md
- Latest story_check: phase_3_main_experiment/story_checks/story_check_{k}.md
- Phase 3 summary: phase_3_main_experiment/PHASE_3_SUMMARY.md
- Phase 4 summary: phase_4_ablation/PHASE_4_SUMMARY.md
[or: absent per Phase 5 escape hatch — Writer weights attribution prose accordingly]
- Phase 5 summary: phase_5_review/PHASE_5_SUMMARY.md
- Reviewer reports:
phase_5_review/reports/review_constructive_v{n_rev}.md
phase_5_review/reports/review_adversarial_v{n_rev}.md
- Phase 2/3/4 analyses (as needed for this section):
phase_2_verification/analysis/analysis_*.md
phase_3_main_experiment/analysis/analysis_*.md
phase_4_ablation/analysis/analysis_*.md
[Case B only:]
Prior section draft: phase_6_writing/sections/{section}_v{s-1}.md
What changed since v{s-1} (triggering this revision):
{list from Main Agent brief — e.g.,
"Phase 5 Case C raised Constructive Concern C3: 'abstract overclaims generality'",
"Loop 4 added MuSiQue cell, results table has new row",
"story_check_{k+1}.md retired bullet C"}
Output: phase_6_writing/sections/{section}_v{s}.md
-
Invoke the writer agent with the brief.
-
Wait for the Writer to return. Confirm the output file exists.
-
Structural sanity pass: read the file's header and verify:
- The Section handle matches the target.
- Required header fields are populated.
- §Drafting rubric block exists (either with concerns or with
the "No Writer-level concerns" marker).
- §Section draft exists and is non-empty.
- §Residual notes exists.
- Case B: §Revision notes exists (or explicitly "Not
applicable (Case A)").
If any structural field is missing, re-invoke the Writer on
this section once with a corrective brief. Cap at one
re-invocation per section per round — if the second output is
still structurally incomplete, surface to the user and pause.
-
Proceed to the next section in the declared order.
Step 3 — Serial invocation is a hard invariant
Do not invoke multiple Writer agents in parallel. Later sections
depend on the section file set produced by earlier sections (the
abstract reads the results section's tables, the related-work
leans on the method section's concreteness). Parallel invocation
would produce inconsistent cross-section prose. The serial order
is the point.
If the user requests parallel invocation for speed, refuse and
explain — abstract-last is a load-bearing invariant, and the
dependency order is not optional.
Sub-process 3 — Paper assembly
Step 1 — Determine the section version pinning
For the paper_v{n}.md assembly, pin each section to its latest
version:
for section in declared_section_order:
section_file = highest-{s} `phase_6_writing/sections/{section}_v{s}.md`
Case A: every section has {s}=1.
Case B: affected sections have the newly-drafted {s}; unaffected
sections reuse their pre-existing latest {s}.
Step 2 — Concatenate into paper_v{n}.md
Produce phase_6_writing/drafts/paper_v{n}.md by concatenating
the pinned section files in the final paper order (NOT the
drafting order — the paper reads abstract → introduction →
related_work → method → experiments → results → discussion →
conclusion).
Assembly format:
# Paper draft — v{n}
**Round:** {n}
**Paper type:** {paper_type}
**Target venue class:** {venue_class}
**Case:** A (fresh) | B (revision from v{n-1})
**Sections pinned:**
- abstract: sections/abstract_v{s}.md
- introduction: sections/introduction_v{s}.md
- related_work: sections/related_work_v{s}.md
- method: sections/method_v{s}.md
- experiments: sections/experiments_v{s}.md
- results: sections/results_v{s}.md
- discussion: sections/discussion_v{s}.md
- conclusion: sections/conclusion_v{s}.md
**Date:** YYYY-MM-DD
[Case B only:]
**Prior paper draft:** drafts/paper_v{n-1}.md
**Sections revised this round:** {list}
**Sections carried forward from v{n-1}:** {list}
---
{verbatim content of abstract_v{s}.md §Section draft block}
---
{verbatim content of introduction_v{s}.md §Section draft block}
---
... (each section in paper order, separated by `---`)
---
## Assembly provenance
[One row per section:
- **{section}**: pinned to {section}_v{s}.md. Writer-level concerns
addressed this draft: {count addressed} / {count scoped}.
Residual notes: {count items}.]
Preserve inline trace and address comments verbatim — they are
read by the exit-check. They will be stripped at submission-prep
time, not during assembly.
Step 3 — Announce assembly complete
Phase 6 — writing round {n} — assembly complete
Paper draft: phase_6_writing/drafts/paper_v{n}.md
Sections pinned (Case B carries forward unchanged; Case A all new):
[list]
Total Writer-level concerns addressed this round: {sum}
Total Residual notes: {sum}
Next step: invoke phase6-exit-check on paper_v{n}.md.
Proceed?
Wait for user confirmation. Options:
- Proceed to exit-check — normal path.
- Request a section re-invocation with specific feedback —
e.g., the user reads a section and wants the Writer to revise
it before the exit-check. Rare. If taken, invoke Writer Case B
on that section, update section pin, re-assemble.
- Halt Phase 6 — if the assembly revealed a fundamental issue
the user wants to address upstream (e.g., a spec change is
needed). Route per user direction.
Sub-process 4 — Exit
Invoke phase6-exit-check against paper_v{n}.md and the pinned
section files. It returns PASS or NEEDS-REWORK with a routing-
advisory table.
On PASS: announce handoff:
Phase 6 — round {n} — COMPLETE
Paper draft: phase_6_writing/drafts/paper_v{n}.md
Sections pinned:
[list with versions]
Exit-check signal:
[verbatim aggregate from phase6-exit-check output]
Routing advisory (from exit-check):
[verbatim routing-advisory table]
Hand-off: based on routing advisory,
- If "Proceed to Phase 5 Case C (paper-draft review)": the
normal post-draft path. Main Agent re-invokes phase5-review
as Case C with paper_v{n}.md as input. Reviewers produce
Writer-level concerns (if any); if Case C returns "ready-
to-write" overall, the research is submission-eligible.
- If "Proceed to submission-prep": rare path when the exit-
check finds the draft is structurally complete AND Phase 5
has already issued "ready-to-write" on a previous Case C
round that matches this draft's section pins. Submission-
prep is outside this framework's scope (bibliography
resolution, LaTeX conversion, trace-stripping).
- If "Revise specific sections (Phase 6 Case B)": the exit-
check found structural issues in specific sections. Main
Agent re-enters this skill as Case B with those sections
listed.
Then stop. Do NOT auto-invoke Phase 5 Case C, submission-prep, or
any upstream skill. The Main Agent decides with the user; this
skill's job is complete.
On NEEDS-REWORK: the exit-check found structural issues with
one or more sections (missing required fields, trace gaps,
contribution-bullet drift, spec-algorithm drift, summary-table
drift, etc.). Main Agent reads the advisory, decides which
sections to re-invoke, re-enters as Case B with those sections
listed. Do not auto-route.
Loop control
- Writer re-invocation cap per section per round: each section
may be re-invoked at most once per round if its first output
fails Sub-process 2 Step 2 structural sanity. A second structural
failure escalates to the user.
- Round cap across Phase 6 cycles: no hard cap across Case B
re-entries, but >3 Case B cycles without converging to an exit-
check PASS → Phase 5 Case C "ready-to-write" close suggests the
draft-level revisions are not addressing the reviewers' concerns
effectively — continuing to iterate Phase 6 without closing
concerns indicates either (a) the concerns require upstream
evidence the Writer cannot produce in prose (Loop 4 is the right
path) or (b) the contribution bullets need Story Advisor
revision and the Writer has been redrafting around an
ungrounded claim surface. Surface to the user with rollback
options.
Files produced by this pipeline
| File | Written by | Notes |
|---|
phase_6_writing/sections/{section}_v{s}.md | writer agent | One per section per round that touches that section. Versions persist. |
phase_6_writing/drafts/paper_v{n}.md | Main Agent (Sub-process 3) | One per Phase 6 round. Concatenated from pinned section files. |
phase_6_writing/PHASE_6_SUMMARY.md | Main Agent | Written at handoff on exit-check PASS with Phase-5-Case-C or submission-prep routing. One-page rollup: rounds run, Phase 5 Case C cycles, final sections pinned, accepted-open residuals. |
What this skill does NOT do
- Does not draft prose. The Writer drafts; this skill
orchestrates. The Main Agent does not insert its own prose into
section files or the assembled paper.
- Does not edit Writer output. Section files are written by
the Writer and read by the assembly and the exit-check. If a
section has a prose issue the Main Agent spots, the remedy is a
Writer re-invocation on that section — not an in-place edit.
- Does not invoke Phase 5 Case C. The assembled draft is
ready for Phase 5 Case C; re-entering Phase 5 is the Main
Agent's next decision after Phase 6 handoff.
- Does not perform submission-prep. Trace-stripping,
[Cite: ...] → \cite{bibkey} resolution, LaTeX conversion,
formatting, and any other submission-prep work happens outside
this framework. The Main Agent may script that separately.
- Does not invoke Writer in parallel. Serial invocation with
abstract-last is a hard invariant; requests to parallelize are
refused.
- Does not re-invoke the Writer without structural cause.
Structural re-invocation (once per section per round) is the
only auto-retry. A "the Writer's method section is too vague"
re-invocation is a user-directed Case B concern scope, not an
auto-retry — the Writer has already addressed what the
PHASE_5_SUMMARY + reviewer reports told it to address, so
"too vague" usually routes to Phase 5 Case C for a formal
concern that routes back here as Case B.
- Does not adjudicate between Writer and reviewers. The
Writer reads the reviewer reports directly and filters per-
section; the skill does not pre-filter or mediate.
- Does not produce supplementary material, appendices beyond
the declared section set, author lists, or acknowledgments.
Those are submission-prep concerns, outside Phase 6.
Interaction with other loops
- From Phase 5 (
phase5-exit-check PASS): enter as Case A
when routing is "Proceed to Phase 6" and the aggregated
Recommendation is "ready-to-write" or "minor-revision", with
user confirmation to begin Phase 6.
- To Phase 5 Case C (paper-draft review): after
phase6-exit- check PASS with "Proceed to Phase 5 Case C" routing, Main
Agent re-invokes phase5-review as Case C with paper_v{n}.md
as the paper-draft input.
- From Phase 5 Case C return: re-enter this skill as Case B
when Case C raised Writer-level concerns scoped to specific
sections, with the affected sections and concern citations in
the invocation brief.
- From Loop 4 return: after a Loop 4 pass lands (Phase 3 /
Phase 4 Case B / Story Advisor revision / etc.) and Phase 5
Case B closes with an updated PHASE_5_SUMMARY, re-enter this
skill as Case B with the sections whose evidence base changed
in the invocation brief. The cascade is
Loop 4 → Phase 5 Case B → (if Writer-level concerns surface)
Phase 6 Case B.
- To submission-prep: outside the framework's scope. The
Main Agent handles bibliography resolution, LaTeX conversion,
and any venue-specific formatting after Phase 6 terminates.
- To Phase 0 re-ideation: does not happen directly from
Phase 6. If Phase 6 reveals a fundamental problem, the route is
Phase 5 Case C → severe concern with routing hint Refiner
round or Unfixable → Phase 5 routes to halt / Phase 0 re-
ideation — not a Phase-6-direct rollback.
- Halt path: if the user determines the research should not
be submitted (e.g., Phase 5 Case C returns "fundamental-rework"
after Phase 6 drafting), Phase 6 pauses pending the
upstream cycle closing. The Writer does not re-draft into a
paper that will never be submitted; user-confirmed.