Final Compile & Check — Compile the complete paper with make paper, verify all references/citations resolve, check word count, and update STATE.md to "ready for submission". Trigger: /aw-finalize
Purpose: Final compilation and quality check for a complete academic paper manuscript.
Trigger: /aw-finalize — execute after all sections, tables, figures, and abstract are complete.
Working directory: manuscripts/{slug}/ (slug = paper project directory name)
cd manuscripts/{slug}
If no slug is provided, infer from the current working directory or prompt the user.
make clean
make paper
Capture the exit code of make paper.
Read the contents of main.log (generated during compilation). Extract and display the first 5 lines of any error messages found.
grep "Undefined reference" main.log
List any unresolved \ref keys found in the log.
grep "Citation" main.blg
List any unresolved \cite keys found in the bibliography log.
Count words from the compiled manuscript. Preferred method:
# Count words in all .tex section files
wc -w sections/*.tex
Alternative if PDF is available:
# Extract text from PDF and count
pdftotext manuscript.pdf - | wc -w
Target range: 7000–8500 words. Note any deviation.
test -f abstract.tex && test -s abstract.tex
Check that abstract.tex exists and has non-zero content.
Check that all required sections exist:
test -f sections/introduction.tex
test -f sections/related-work.tex
test -f sections/methodology.tex
test -f sections/experiment.tex
test -f sections/results.tex
test -f sections/discussion.tex
test -f sections/conclusion.tex
List any missing sections.
If all checks pass, update STATE.md in the project root to mark phase status as "ready for submission".
# Update STATE.md phase status
# Look for a phase/status field and update it
If checks fail, update STATE.md to note remaining issues.
| Check | Method | If Fail |
|---|---|---|
make paper exit code | bash $? | Show first 5 error lines from .log |
| No Undefined reference | grep "Undefined reference" main.log | List missing \ref keys |
| No unresolved citations | grep "Citation" main.blg | List missing \cite keys |
| Word count 7000–8500 | wc -w sections/*.tex or PDF extract | Note deviation from target |
| Abstract present | test -f abstract.tex | Warn that abstract is missing |
| All 7 sections | test -f sections/{section}.tex | List missing sections |
Generate and display the following markdown report at the end:
# Final Check Report
**Compile:** ✅ No errors | ❌ Failed
**Errors:** (if any, first 5 lines from .log)
**Undefined refs:** (if any)
**Unresolved citations:** (if any)
**Word count:** N / 8000 (target)
**Abstract:** ✅ Present | ❌ Missing
**Sections:** ✅ All 7 present | ❌ Missing: [list]
**Status:** Ready for submission | N issues found
make paper exits with code 0If all criteria are met: update STATE.md to "ready for submission".
If any criterion fails: report the failures clearly and leave STATE.md unchanged.