Knowledge Document Composer
Use this skill to turn structured source material into a finished document.
Core workflow:
- Before processing any pack or derived artifact, require a current
gate_receipt.jsonandanalysis_receipt.json. File existence and an oldsource_statusare not sufficient. - Read references/source-gate.md and apply it as a hard gate before writing commitments, source reconstruction, claim inventory, argument flow, or final prose.
- Load only the source artifacts allowed by the source gate, such as
source_analysis_pack.md, legacyvideo_analysis_pack.md, clean_transcript, concepts, examples, claims, source_logic, and logic_graph. - Read references/artifact-schema.md before writing intermediate or final artifacts.
- Read references/workflow.md for the detailed stage process.
- Prefer
kw audit --project-root <project>so planning output is followed bycomposer_receipt.json. Direct runner output is not deliverable until that receipt binds it to the current analysis receipt. - Build a commitment file that captures the source status, source's core question, thesis, narrative spine, document goal, final language, audience, must-preserve evidence, and expansion boundaries.
- Reconstruct the source's argument flow, examples, concept transitions, and language logic before drafting only when the source gate permits that reconstruction.
- Build a claim map that separates Source, Inference, and Extension content, and never upgrade degraded or secondary material into Source claims.
- Read references/report-template.md before drafting a report.
- Prefer
kw compose --project-root <project>. It validates the composer receipt, runs the final writer, and writesfinal_report_receipt.jsonbound to the quality gate and report hash. - Use scripts/final_report_auditor.py independently when checking a manually edited report candidate. It must reject secondary-only/degraded intake, unregistered Source claims, missing Source / Inference / Extension separation, and missing partial-scope labels.
- Draft, critique, revise, and then read references/quality-gates.md before final delivery. If the user did not specify a final language, use the current conversation language and treat language mismatch as a quality failure.
- Output the final document and supporting maps only in the report mode allowed by the source gate.
Runner guidance:
- Use scripts/document_composer_runner.py as the first document-composer runner for audited source workflows. It consumes
source_analysis_pack.mdwhen present, otherwise legacy10_video/video_analysis_pack.md, plus00_source/source_status.json,05_gap_check/evidence_audit.json,05_gap_check/evidence_map.json,05_gap_check/claim_source_audit.json, inventory, source logic, and gap check artifacts, then writes20_document/composer_intake.json,commitments.md,source_reconstruction.md,claim_map.json,expansion_plan.md,report_outline.md, andquality_check.md. - Treat
document_composer_runner.pyas an intake-to-outline gate, not as a full writing engine. It intentionally does not createdraft_report.mdorfinal_report.md; those require the draft, critique, revision, and final quality-gate workflow. - Use scripts/final_report_writer.py as the normal planning-to-final runner. It consumes
20_document/composer_intake.json,commitments.md,source_reconstruction.md,claim_map.json,expansion_plan.md, andreport_outline.md, then writesdraft_report.md,critique.md,revised_report.md,quality_gate.json, refreshedquality_check.md, and, only if approved,final_report.md. - Use scripts/final_report_auditor.py for an independent final gate. It writes
quality_gate.jsonwithapproved_for_final_report,report_scope, gate statuses, blocking gates, checked files, and source claim ids used. - If the upstream source status is blocked, failed, secondary-only, degraded, missing primary material, the evidence audit has errors, required evidence sidecars are missing, or
claim_source_audit.jsonhas blocking claims, do not use the normal document runner to create full-report planning artifacts. - If
source_statusissource_partial, the final report may be approved only as a visible partial-scope report. - If
source_statusissecondary_only,source_blocked,source_failed, ordegraded_report_only, the final writer and auditor must not create a normalfinal_report.md. - Do not read provider or
00_acquisitionoutput directly. Composer only consumes source-gated packs and planning artifacts. - Do not repair source status or upgrade metadata/search/snippet artifacts into Source claims.
- Do not export or present a final report when its final receipt is missing,
stale, or hash-mismatched, even if
final_report.mdexists.
Required reference order:
- references/source-gate.md
- references/artifact-schema.md
- references/workflow.md
- references/report-template.md
- references/quality-gates.md