pre-publish
Run every scan registered in reviewer_complaints.md against the current manuscript. The ship-blocker gate — a book does not ship until this passes. Combines /prose-scan, /de-ai-audit, codex/agy continuity, voice & citation-grounding checks, and any custom scans the writer has registered based on pas
Install
mkdir -p .claude/skills/pre-publish && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16464" && unzip -o skill.zip -d .claude/skills/pre-publish && rm skill.zipInstalls to .claude/skills/pre-publish
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Run every scan registered in reviewer_complaints.md against the current manuscript. The ship-blocker gate — a book does not ship until this passes. Combines /prose-scan, /de-ai-audit, codex/agy continuity, voice & citation-grounding checks, and any custom scans the writer has registered based on past reader feedback.About this skill
/pre-publish
You are running the Pre-Publish Gate. Every complaint a reader has ever logged in reviewer_complaints.md becomes a scan here. The book does not ship until this passes.
Input
$ARGUMENTS: Optional — scope. Default is the whole manuscript (manuscript/chapters/*.mdsorted).
Procedure
Step 1: Load the complaint registry
Read reviewer_complaints.md. For every entry that has a Scan method field, extract:
- Category
- Short complaint summary
- The exact scan to run
If there are fewer than 3 real complaints logged, note it to the user but proceed — this skill also runs the baseline scans.
Step 2: Enumerate chapter files
ls manuscript/chapters/*.md
If the list is empty, stop and ask the user where chapters live.
Step 3: Run baseline scans on every chapter
For each chapter:
-
/prose-scan— dialogue placeholder (CRITICAL), sentence-opener variance, burstiness, echo, sensory ratio, transition velocity, dialogue beats.- Invoke:
bash .claude/scripts/prose-scan.sh manuscript/chapters/<file> - Record: CRITICAL / HIGH / MEDIUM counts per chapter.
- Invoke:
-
/de-ai-audit— structural AI tells and vocabulary clusters (Claude-side, per chapter).- Record grade and any hits.
Step 4: Run manuscript-level scans (review-engine contract)
These run on the versioned review-engine contract (reference/MODEL_SELECTION_GUIDE.md §5), not the sunset Gemini CLI. Engine order: codex (PRIMARY, off-session-safe) → mcp__antigravity__agy_ask (in-session fast path) → agy CLI fed inline text (fallback) → loud SKIPPED/visible-fail per tier below.
Failure semantics are tiered — this is the gate's reliability contract:
- Continuity is REQUIRED-tier. It degrades codex → agy-inline → and if no engine can run, it is reported UNVERIFIED (BLOCKED), not SKIPPED-and-passed. A required full-manuscript check that cannot run is a visible non-pass — never a silent green.
- Voice and Logic are OPTIONAL-tier. If no engine runs, mark them SKIPPED and let the gate pass on the rest.
Preflight — probe in contract order:
bash -c 'source .claude/scripts/lib/cli-check.sh; cli_available codex || cli_available agy'
In-session, prefer the manuscript-review workflow (Workflow({ name: "manuscript-review", args: [<chapter paths>] }) after globbing manuscript/chapters/*.md) — it runs codex + agy (via the antigravity MCP) per chapter and aggregates with context/CITATIONS.md grounding flags. Off-session / CLI path, run the three checks against whichever engine probed available. Route output to a file, then Read it — large output gets truncated/swallowed inline:
- continuity-audit →
reviews/continuity.md - voice-lint →
reviews/voice.md - logic-check →
reviews/logic.md
continuity-audit(REQUIRED) — state attributes, name introductions, knowledge graph.- codex:
mkdir -p reviews && codex exec --sandbox read-only "<continuity prompt>; read manuscript/chapters/*.md in order" > reviews/continuity.md 2> reviews/continuity.err - agy fallback (inline only — never let agy open files):
TEXT=$(cat manuscript/chapters/*.md); timeout 30m agy --dangerously-skip-permissions -p "Below is the manuscript inline (do not open files). <continuity prompt>. CHAPTER TEXT: $TEXT"→ writesreviews/continuity.md.
- codex:
voice-lint(optional) — character voice differentiation againstdocs/characters.md.logic-check(optional) — plot logic and timeline.
Citation grounding (fail-closed). Cross-check every specific factual claim flagged by the workflow (needs_citation_check) against context/CITATIONS.md. Any release-critical specific claim left pending/disputed in the ledger is a Blocker — it halts the ship, it does not merely annotate the report. This is the gate against the twice-shipped fabrication bug; never trust a reviewer's "VERIFIED."
codex-review(optional editorial second opinion) — probe first withbash -c 'source .claude/scripts/lib/cli-check.sh; cli_available codex'. If available, run/codex-reviewfor a full-book editorial pass (structure, pacing, voice, line-edit craft); its output is written toreviews/codex_review.mdby the script. Codex's CRITICAL/HIGH findings feed the Blockers / High-priority buckets below; its MEDIUM/LOW feed the lower sections. Ifcodexis unavailable, skip this step cleanly (note it as SKIPPED, same as the Gemini scans).
Step 4.4: Verify every AI-auditor finding before you trust it
This applies to every finding from the review engine (continuity/voice/logic) and codex.
- Quote-verify before action [non-skippable]. An LLM auditor can fabricate a citation — flag a "contradiction" against a quote that doesn't exist in the chapter, or call an internally-consistent passage a continuity break. Before a finding goes in the Gate Report (and certainly before anyone fixes it), open the cited file and confirm the quoted text actually appears and means what the finding claims. A finding is a lead, not a fact. Drop or downgrade any finding that fails verification, and note it as "unverified — cited text not found."
- Two independent reviewers; divergence is signal. agy (Antigravity) and codex run on different engines and contexts on purpose — they routinely catch different real problems. When they disagree, investigate the delta; do not average it. A finding only one of them raised is not automatically noise (it is often the real catch); a finding only one of them cleared is not automatically safe.
Step 4.5: Mechanical artifact & integrity scans
These protect the shipped artifact and the manuscript-wide consistency that per-chapter prose scans never see. Each is backed by a script under .claude/scripts/; run it, route output to a file, and Read it.
- Render check (the build artifact is the product). Build the epub and assert it renders correctly — prose scans pass green while the shipped file is silently broken.
Asserts: TOC lists every chapter, 0 literalbash .claude/scripts/render-check.sh# Chapterheadings leaked into the body, 0 stray<hr>rules, scene breaks present. Any failure is a Blocker (a buyer sees it even though the markdown looked clean). - Canon / number-name residue sweep. After any retcon or rename, the old values must be gone everywhere, not just in the chapter you rewrote.
Expect zero hits on superseded strings and confirm the replacement strings appear where the topic is discussed. Any superseded-string hit is a Blocker.bash .claude/scripts/residue-sweep.sh # reads build/residue_terms.txt: superseded -> replacement - Persona / editorial-token bleed sweep. Author-persona names and drafting tokens must never appear in the prose as in-world text.
Greps prose for persona tokens and editorial markers (bash .claude/scripts/token-bleed-scan.sh # reads build/persona_tokens.txtScene N,Movement A/B,TODO, stray "since Ch 2"-style cross-refs). Any hit is a Blocker — it is a fourth-wall break, and a numeric/token sweep catches what prose-reading reviewers slide past. - Name-similarity check. Flag any two active cast names within a <3-letter edit distance (e.g. Brin vs Bren) — readers conflate them. Cross-check the cast list in
context/FACTS_SHEET.md. Near-collisions are High-priority (resolve before publishing).
Step 5: Run registered complaint scans
For each complaint with a Scan method from Step 1:
- Execute the scan (regex, grep, review-engine prompt, or skill invocation as registered).
- Record: hit count, chapter locations, severity assessment.
- If the complaint says "Fixed in rev X", still run it — confirming the fix stuck is the whole point.
Step 6: Synthesize the Gate Report
Output this format:
# Pre-Publish Gate Report
**Manuscript:** [slug from book.yaml]
**Scan date:** [today]
**Chapters scanned:** [N]
**Total words:** [N]
## Gate Status
[PASSED / FAILED]
- Baseline scans: [PASSED / FAILED — details]
- Continuity (REQUIRED): [PASSED / FAILED / UNVERIFIED — no engine available = BLOCKER]
- Citation grounding (REQUIRED): [PASSED / FAILED — N ungrounded specific claims = BLOCKER]
- Voice: [PASSED / FAILED / SKIPPED — no engine available]
- Logic: [PASSED / FAILED / SKIPPED — no engine available]
- Editorial (codex): [PASSED / FAILED / SKIPPED — codex unavailable]
- Render check (artifact): [PASSED / FAILED]
- Residue sweep: [PASSED / FAILED — N superseded-string hits]
- Persona/token bleed: [PASSED / FAILED — N hits]
- Name-similarity: [PASSED / FLAGGED — pairs]
- Registered complaints: [X/Y passed]
## Blockers (must fix before shipping)
### CRITICAL from /prose-scan
[chapter, line, finding]
### Continuity failures
[from continuity-audit — verified per Step 4.4]
### Artifact / integrity failures
[render-check failures, residue-sweep superseded-string hits, persona/token-bleed hits — from Step 4.5]
### Logged-complaint regressions
[Any complaint from reviewer_complaints.md whose scan fired. These are things readers already caught once; shipping them again is worse than shipping a new bug.]
## High-priority (fix before publishing, not hard blockers)
[HIGH findings from /prose-scan, voice-lint drift, de-ai-audit C grades]
## Medium / Low (fix-if-you-have-time)
[Lower-severity findings, summarized]
## Numbers that changed since last publish
If previous run data is available in `build/pre_publish_log.json`, compare:
- CRITICAL count: [prev] → [now]
- Registered-complaint hits: [prev] → [now]
- Overall pass rate: [prev] → [now]
Step 7: Decision Gate
If any Blocker (CRITICAL, continuity failure, continuity UNVERIFIED with no engine available, ungrounded release-critical specific claim, or logged-complaint regression) is present:
**"Pre-publish gate FAILED. [N] blockers listed above. Fix them or e
Content truncated.