|
| 1 | +# Plan: Improve `/review` Command and `reviewer` Agent (Non-Destructive) |
| 2 | + |
| 3 | +This plan outlines the migration and enhancement of the legacy `/revise` command into a more structured, non-destructive `/review` command, supported by an upgraded `reviewer` agent. The new workflow focuses on generating a detailed sidecar review report. |
| 4 | + |
| 5 | +## Objective |
| 6 | +Transition from the basic editing workflow to a rigorous, multi-phase review process that produces a comprehensive `<filename>.review.md` file. This ensures high-level structural integrity, concrete substance, and polished linguistic quality without modifying the original source. |
| 7 | + |
| 8 | +## Architecture |
| 9 | +- **Command Migration:** Rename `.gemini/commands/revise.toml` to `.gemini/commands/review.toml`. |
| 10 | +- **Agent Migration:** Rename `.gemini/agents/editor.md` to `.gemini/agents/reviewer.md`. |
| 11 | +- **Sidecar Reporting:** Instead of using `replace`, all findings are written to a `<filename>.review.md` file. |
| 12 | +- **Workflow Orchestration:** Implements a strict sequential pipeline: **Setup -> Plan -> Phase 1 (Structural) -> Phase 2 (Substance) -> Phase 3 (Linguistic) -> Finalization**. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## Detailed Workflow |
| 17 | + |
| 18 | +### Phase 0: Setup & Style Selection |
| 19 | +- **File Selection:** Prompt the user to select a file for review. |
| 20 | +- **Style Guide:** Ask the user if they want to provide a specific style guide or instructions. If not, propose `.gemini/style-guide.md` as the default. |
| 21 | +- **Initialization:** Create/Overwrite `<filename>.review.md` with a header and metadata. |
| 22 | + |
| 23 | +### Phase 1: Review Depth Planning |
| 24 | +- **Goal:** Determine the review depth and phases based on the document's complexity and the Style Guide. |
| 25 | +- **Action:** Read the target file and the selected style guide. |
| 26 | +- **Review Plan:** Divide the review into phases (from abstract/high-level to concrete/low-level). For each phase, determine the specific points of interest and patterns to check. |
| 27 | +- **Approval:** Present the plan to the user for approval. Save the approved plan to the `.review.md` file. |
| 28 | + |
| 29 | +### Phases 1..N: Multi-Phase Review Execution |
| 30 | +For each phase (e.g., Structural, Content, Linguistic): |
| 31 | +- **Agent Invocation:** Invoke the `reviewer` agent with specific instructions for the current phase only. |
| 32 | +- **Deep Analysis:** The `reviewer` reads the style guide and the document, performing targeted `grep_search` and `read_file` calls to find specific issues (e.g., "AI-isms", passive voice, weak hooks). |
| 33 | +- **Report Generation:** The `reviewer` produces a comprehensive report for that phase, including specific examples and suggested fixes. |
| 34 | +- **Persistence:** Append the phase report to the corresponding section in `<filename>.review.md`. |
| 35 | + |
| 36 | +### Finalization |
| 37 | +- **Goal:** Notify the user and suggest next steps. |
| 38 | +- **Action:** Inform the user that the review is complete and the `.review.md` file is ready. |
| 39 | +- **Next Steps:** Suggest the user to use the `/draft` command, attaching the newly created review file to apply the desired modifications. |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Implementation Steps |
| 44 | + |
| 45 | +### Step 1: Rename and Refactor Files |
| 46 | +1. **Rename Command:** Move `.gemini/commands/revise.toml` to `.gemini/commands/review.toml`. |
| 47 | +2. **Rename Agent:** Move `.gemini/agents/editor.md` to `.gemini/agents/reviewer.md`. |
| 48 | + |
| 49 | +### Step 2: Update `reviewer` Agent (`.gemini/agents/reviewer.md`) |
| 50 | +1. **Update Name:** Change name from `editor` to `reviewer`. |
| 51 | +2. **Capabilities:** Ensure it has access to `grep_search` and `read_file`. |
| 52 | +3. **Prompt:** Update the system prompt to reflect its role as a deep critic that produces structured reports for specific review phases. |
| 53 | + |
| 54 | +### Step 3: Update `/review` Command (`.gemini/commands/review.toml`) |
| 55 | +1. **Orchestration Logic:** Rewrite the prompt to follow the non-destructive multi-phase workflow. |
| 56 | +2. **Persistence Logic:** Use `write_file` (initial) and `replace` (to append or fill sections) to manage the `<filename>.review.md` file. |
| 57 | +3. **Phase Management:** Ensure it loops through the approved phases, invoking the agent for each. |
| 58 | + |
| 59 | +### Step 4: Cross-Reference Updates |
| 60 | +1. **Update `/draft` Command:** Modify `.gemini/commands/draft.toml` to reference `/review` and mention the capability to ingest `.review.md` files. |
| 61 | +2. **README/Docs:** Update documentation to reflect the new tool and workflow. |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## Verification Strategy |
| 66 | + |
| 67 | +### 1. Functional Testing |
| 68 | +- **Non-Destructive:** Verify the original file is NEVER modified by the `/review` command. |
| 69 | +- **File Creation:** Ensure `<filename>.review.md` is correctly created and populated. |
| 70 | +- **Phase Sequence:** Confirm the command executes each phase as planned and approved. |
| 71 | + |
| 72 | +### 2. Quality Audit |
| 73 | +- **Grep Usage:** Verify the `reviewer` agent actually uses `grep_search` to find patterns (e.g., searching for "---" or specific "AI-ism" triads). |
| 74 | +- **Style Alignment:** Check that the generated review reflects the rules in the selected Style Guide. |
0 commit comments