Academic Language Polisher (academic-language-polisher)
Transform academic drafts into grammatically accurate, register-calibrated, terminology-consistent, and semantically faithful manuscripts with sentence-level provenance and mechanical safety checks.
Core Guarantees
- 改得对 (Accurate Grammar & Syntax): Fix subject-verb agreement, tense/voice mismatches, articles, prepositions, singular/plural, dangling modifiers, collocations, punctuation, and sentence boundaries rather than masking errors with paraphrase.
- 说得像 (Register Calibration & Full-Text Terminology Lock): Adapt tone cleanly to
journal_article,thesis_dissertation,grant_proposal,reviewer_response,english_abstract, orbilingual_zh_en; lock glossary terms andFull Term (ACR)first-occurrence conventions across all sections. - 没改坏 (Zero Meaning Drift & Protected-Span Conservation): Conserve every number, physical unit, math/LaTeX block, citation marker, figure/table/equation cross-ref, negation/conditional/quantifier polarity, causality vs. correlation distinction, and epistemic hedge strength (
may!=proves). - 讲得清 (Auditable Sentence-Level Track Changes): Deliver the complete editable manuscript plus per-sentence
original,polished, word-level diff, controllededit_types, and concreterationale, while surfacing glossary conflicts and ambiguous edits for human confirmation.
Runtime Paths & Budget Discipline
Resolve $SKILL_DIR automatically before executing any step:
SKILL_DIR="${SKILL_DIR:-/skills/weekly-skill}"
[ -d "$SKILL_DIR/scripts" ] || SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd)"
mkdir -p /app/work /app/output
- Inputs:
/input/case.json,/input/task.md(or./task.md), and actual manuscript/glossary/style files under/input/. Always read actual files rather than guessing from labels. - Trigger Guard: If
/input/task.mdis purely a factual/conceptual Q&A asking no editing, rewriting, proofreading, or polishing, do NOT rewrite text; output an honestnot_applicable_qastatus inresult.json. - Budget Discipline (64 requests / 900 s): Read
/app/work/polish_brief.mdand/app/work/glossary_resolved.jsonfirst rather than re-dumping giant raw files; save an early partial checkpoint at Step 3.
6-Step Execution Workflow
Step 1: Inspect Case Contract, Genre, Format & Inputs
python3 "$SKILL_DIR/scripts/inspect_case.py" \
--input-dir /input \
--out /app/work/case_plan.json
Read /app/work/case_plan.json (and /input/task.md) to confirm case_id, all output_contract fields, detected genre, language, edit_intensity, manuscript_files, glossary_files, missing_referenced_files, and is_non_polish_qa.
Step 2: Segment Manuscript, Mine Terminology & Pre-Audit Diagnostics
python3 "$SKILL_DIR/scripts/analyze_manuscript.py" \
--case-plan /app/work/case_plan.json \
--out-dir /app/work
Produces:
/app/work/source_segments.json: Lossless paragraph/sentence segmentation (P001.S01...) withprotected_spans(numbers/units, LaTeX math, citations, cross-refs, chemical formulas), hedge tier (1..5), causality/negation markers, and diagnostic flags./app/work/glossary_resolved.json: Merged user glossaries, detectedglossary_conflicts[], minedFull Term (ACR)definitions, and cross-section variant drifts./app/work/polish_brief.md: Compact token-efficient brief for authoring.
Step 3: Save Early Honest Partial Checkpoint
Persist an honest baseline checkpoint immediately so budget exhaustion or corrupt inputs never leave /app/output/result.json empty:
python3 "$SKILL_DIR/scripts/assemble_output.py" \
--case-plan /app/work/case_plan.json \
--segments /app/work/source_segments.json \
--glossary /app/work/glossary_resolved.json \
--checkpoint partial \
--out-dir /app/output
- Short-Circuit Exceptions: If
is_non_polish_qaistrue, or all manuscript files are missing/encrypted/corrupt, do NOT fabricate edits; finalize an honestnot_applicable_qaorunable_to_determineresult.jsonexplaining exact causes inuncertaintyandlimitations.
Step 4: Author Sentence-Level Edits (/app/work/polished_payload.json)
Read /app/work/polish_brief.md, /app/work/glossary_resolved.json, and $SKILL_DIR/resources/genre_style_guides.json. Process /app/work/source_segments.json in ordered batches (20–30 sentences per batch for long texts) and write /app/work/polished_payload.json conforming to $SKILL_DIR/resources/payload_schema.json:
- Include every
sentence_idin exact order with verbatimoriginalandpolished. - Apply minimal editing: leave already sound sentences unchanged (
"changed": false,"polished" == "original"); do NOT perform wholesale paragraph rewrites unless Chinglish/translationese explicitly requires structural reordering. - Keep every protected span (
numbers_units,math_latex,citations,cross_refs,chemical_symbols) intact. - Preserve epistemic hedge strength and correlation-vs-causation polarity.
- Enforce every non-conflicting canonical term in
glossary_resolved.json; for any conflicting glossary entries (glossary_conflicts[]), keep original text or pick the dominant convention consistently, setneeds_human_confirmation: true, and add an item toauthor_confirmation_items[]. - Assign valid
edit_types[](from$SKILL_DIR/resources/payload_schema.json) and specific, verifiablerationalefor every changed sentence. - Populate
contract_overridesifcase_plan.json["output_contract"]defines custom keys beyond standard semantic roles.
Step 5: 8-Axis Mechanical Verification & Self-Correction Loop
python3 "$SKILL_DIR/scripts/verify_polish.py" \
--payload /app/work/polished_payload.json \
--segments /app/work/source_segments.json \
--glossary /app/work/glossary_resolved.json \
--case-plan /app/work/case_plan.json \
--out /app/work/verification_report.json
Inspect /app/work/verification_report.json. Fix every ERROR (missing/reordered sentences, altered numbers/units/citations/LaTeX, unauthorized hedge-tier upgrades, correlation-to-causation shifts, negation flips, glossary violations, empty rationales, unbalanced delimiters, undisclosed conflicts) in /app/work/polished_payload.json and re-run verify_polish.py until "passed": true (exit code 0).
Step 6: Assemble Verified Deliverables
python3 "$SKILL_DIR/scripts/assemble_output.py" \
--case-plan /app/work/case_plan.json \
--segments /app/work/source_segments.json \
--glossary /app/work/glossary_resolved.json \
--payload /app/work/polished_payload.json \
--verification /app/work/verification_report.json \
--checkpoint final \
--out-dir /app/output \
--strict
Verify /app/output/ contains result.json (with case_id and every output_contract key), polished_manuscript.md (plus .tex/.docx and rendered PDF/PNG previews when applicable), redline_diff.md, change_log.csv, change_log.md, glossary_table.md, and audit_and_confirmation_report.md.