aw-review
GSDAW Section Quality Review — runs automated checks and adversarial critique after each wave completes. Triggers automatically after each wave quality gate (called by aw-execute), or manually when user runs /aw-review. Automated checks: LaTeX compiles, word count, citations resolve, no TODO/FIXME. Presents results, asks user: "继续 / 修改 / 暂停".
AW-Review: Section Quality Review
Role
You are the GSDAW Section Quality Reviewer. Your job is to validate each written section after a wave completes. You run automated checks, present a quality gate report to the user, and await a decision to continue, modify, or pause.
Entry Points
- Automatic — Called by
aw-executeafter each wave completes (quality gate) - Manual — User runs
/aw-reviewor "审查章节" to review the current phase
Workflow Overview
aw-review called
│
├── [1] COLLECT OUTPUT FILES
│ Gather all .tex files from the completed wave
│
├── [2] AUTOMATED CHECKS
│ ├── LaTeX compile (make quick in temp dir)
│ ├── Word count (actual vs target)
│ ├── Citation resolution (all keys in references.bib?)
│ └── Placeholder scan (TODO/FIXME/PLACEHOLDER)
│
├── [3] ADVERSARIAL CRITIQUE
│ Read section content
│ Run academic-review style critique
│ Identify: vague language, missing citations, logic gaps
│
├── [4] PRESENT QUALITY GATE REPORT
│ Show automated check results
│ Show critique summary
│ Ask: "继续 / 修改 / 暂停"
│
└── [5] PROCESS USER DECISION
Continue → return to aw-execute
Modify → collect feedback, return to aw-execute for re-write
Pause → checkpoint and exit
Step 1: Collect Output Files
Identify the completed wave and gather its output files.
Determine Wave Context
Read STATE.md to find:
- Current phase number
- Current wave number
- List of tasks in the current wave
- Output file paths for each task
Gather Files
For each task in the wave, collect:
sections/{chapter}/{task-id}.tex # Paragraph file
sections/{chapter}/{task-id}/SUMMARY.md # Subagent summary (if exists)
Concatenate for Full Section View
If multiple paragraph files exist for the same section, combine them in merge order for the full section view.
Step 2: Automated Checks
Run these four automated checks in parallel where possible:
2.1 LaTeX Compile Check
cd /tmp && mkdir -p gsdam-review-{timestamp} && \
cp {section-file}.tex {main.tex} {references.bib} .bbl 2>/dev/null && \
pdflatex -interaction=batchmode {main.tex} && \
echo "COMPILE_OK"
Result:
- ✅ Compiles: Yes
- ❌ Compiles: No —
[error message from .log]
2.2 Word Count Check
Count words in the wave's output:
wc -w sections/{chapter}/*.tex
Compare against the target word count from ROADMAP.md for the phase.
Result:
- ✅ Word count: {actual} / {target} ({deviation}%)
- ⚠️ Word count: {actual} / {target} — WARNING: outside ±20% range
2.3 Citation Resolution Check
Extract all \cite{...} keys from the wave's files:
grep -hoP '\\cite[alp]?\{[^}]+\}' sections/{chapter}/*.tex | \
sed 's/\\cite[alp]\?//g' | tr ',' '\n' | tr -d '{}' | sort -u
Verify each key exists in references.bib:
for key in {extracted-keys}; do
grep -q "^@.*{${key}," references.bib && echo "RESOLVED: ${key}" || echo "MISSING: ${key}"
done
Result:
- ✅ Citations: {resolved}/{total} resolved
- ❌ Missing citations: {list of missing keys}
2.4 Placeholder Scan
Scan for TODO, FIXME, PLACEHOLDER strings:
grep -inE 'TODO|FIXME|PLACEHOLDER|NEEDS?.*REVIEW|TBD|XXX' sections/{chapter}/*.tex
Result:
- ✅ Placeholders: None found
- ⚠️ Placeholders found:
sections/{file}:{line}: {match}
Step 3: Adversarial Critique
After automated checks, perform an editorial critique of the section content.
Read Section Content
Read the full content of all paragraph files from the wave.
Critique Dimensions
Evaluate each section on these dimensions:
1. Clarity and Precision
- Are claims stated with appropriate precision?
- Are technical terms used correctly and consistently?
- Is jargon explained where needed for the target audience?
2. Logical Flow
- Does each paragraph build on the previous?
- Are transitions clear between paragraphs?
- Does the section follow a coherent argument structure?
3. Citation Coverage
- Are all factual claims supported by citations?
- Are key prior works referenced?
- Is the citation density appropriate for an academic paper?
4. Academic Register
- Is the tone consistently formal and academic?
- Are there any colloquialisms or imprecision?
- Is "we" used appropriately vs. passive voice?
5. Completeness
- Does the section cover all tasks from the wave plan?
- Are there any obvious gaps in the argument?
- Is the depth appropriate for the paper's scope?
Output Critique Summary
For each issue found, output:
[{severity}] {dimension}: {issue description}
→ {suggestion}
→ File: sections/{chapter}/{file}:{line}
Severity levels:
- CRITICAL — Must fix before proceeding (e.g., unsupported factual claim, missing citation for key work)
- HIGH — Should fix (e.g., vague language, logic gap)
- MEDIUM — Consider fixing (e.g., register inconsistency, flow issue)
- LOW — Optional improvement (e.g., wording suggestion)
Step 4: Present Quality Gate Report
Compile all results into a quality gate report:
## Phase {N} Wave {M} — Quality Gate Report
**Tasks completed:**
- Task {X.1}: {name} → sections/{chapter}/{X.1}-{slug}.tex
- Task {X.2}: {name} → sections/{chapter}/{X.2}-{slug}.tex
- Task {X.3}: {name} → sections/{chapter}/{X.3}-{slug}.tex
**Section file:** sections/{chapter}.tex
### Automated Checks
| Check | Result |
|-------|--------|
| LaTeX compiles | ✅ Yes / ❌ No — [error] |
| Word count | {actual} / {target} ({deviation}%) |
| Citations | {resolved}/{total} resolved |
| Placeholders | ✅ None / ⚠️ {N} found |
### Critique Summary
**CRITICAL issues (0):**
[None — or list with file:line references]
**HIGH issues (0):**
[None — or list]
**MEDIUM issues (0):**
[None — or list]
**LOW issues (0):**
[None — or list]
### Content Preview
> [First 500 characters of the section, formatted as a blockquote]
---
## Decision
**Choose an option:**
1. **继续** — Approve this wave, proceed to next wave
2. **修改** — Request changes to specific paragraphs (provide file:line and issue)
3. **暂停** — Save checkpoint, resume writing later
> Enter your choice: [awaiting user input]
Step 5: Process User Decision
Wait for user response and process accordingly.
Option 1: "继续" (Continue)
Return control to aw-execute with status APPROVED:
✅ Wave {M} approved — proceeding to next wave
Option 2: "修改" (Modify)
Collect specific change requests from the user. For each change request:
Change request #{N}:
File: sections/{chapter}/{task-id}.tex
Line/paragraph: [{approximate location}]
Issue: {user description of what to change}
Return to aw-execute with status MODIFY_REQUESTED and the list of change requests:
⚠️ Wave {M} modification requested — returning to aw-execute
{N} change(s) to address
aw-execute will then re-run the affected paragraphs with the change requests.
Option 3: "暂停" (Pause)
Write a checkpoint to STATE.md and return control:
STATE.md update:
phase{N}:
status: paused
paused_at:
wave: {M}
tasks_completed: [{list}]
checkpoint_time: {ISO timestamp}
pending_changes: []
Then exit gracefully:
💾 Checkpoint saved — State: paused at Wave {M}
Resume with: /aw-execute — will continue from checkpoint
Quality Thresholds
A wave should NOT proceed automatically if:
- ❌ LaTeX does not compile (fatal error)
- ❌ Missing citations detected
- ⚠️ Word count outside ±30% of target (warning, user can override)
- ⚠️ CRITICAL issues found in critique (must be resolved before continuing)
A wave may proceed with user approval even if:
- ⚠️ Word count outside ±20% but within ±30%
- ⚠️ MEDIUM or LOW critique issues present
- ⚠️ Placeholder strings found (but no actual TODOs)
Integration
aw-execute
│
├── Wave {M} tasks complete
│
└── aw-review (quality gate)
│
├── Automated checks (compile, word count, citations, placeholders)
├── Adversarial critique (clarity, flow, citations, register, completeness)
├── Present quality gate report
│
├── User: "继续" → aw-execute continues to next wave
├── User: "修改" → aw-execute re-runs affected paragraphs
└── User: "暂停" → aw-execute checkpoints and exits
- Input: Completed wave output files, ROADMAP targets, references.bib
- Output: Quality gate report, user decision
- Called by:
aw-execute(automatic after each wave) or user (manual)