|
| 1 | +# Plan: Improve `/draft` Command and Evolve `writer` Agent |
| 2 | + |
| 3 | +This plan outlines the migration and enhancement of the legacy `reporter` agent into a more capable `writer` agent, and the corresponding upgrade of the `/draft` command to handle both initial content generation and a new, review-driven "Refinement Phase." |
| 4 | + |
| 5 | +## Objective |
| 6 | +Promote the `reporter` agent to `writer` and upgrade the `/draft` command to implement a full feedback loop. This allows the `writer` agent to ingest `.review.md` files (generated by the `/review` command) and apply suggested improvements directly to the target file. |
| 7 | + |
| 8 | +## Architecture |
| 9 | +- **Agent Evolution:** The `reporter` agent is renamed to `writer`, expanding its role from section expansion to sophisticated refinement and style alignment. |
| 10 | +- **Feedback Loop:** This change closes the loop between the non-destructive `/review` command and the content generation process. |
| 11 | +- **Direct Refinement:** The `/draft` command will include a dedicated "Refinement Phase" that uses the `writer` agent to apply suggested changes from a `.review.md` file directly to the target document. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Detailed Workflow |
| 16 | + |
| 17 | +### Phase 1: Context & Mode Selection |
| 18 | +- **Analyze Request:** Identify the target file for drafting or refinement. |
| 19 | +- **Check for Review:** Search for a corresponding `<filename>.review.md` file. |
| 20 | +- **Branching Logic:** |
| 21 | + - **Initial Drafting:** If no review exists, follow the current Outline -> Skeleton -> Expansion workflow. |
| 22 | + - **Refinement Mode:** If a review exists, initiate the Refinement Phase. |
| 23 | + |
| 24 | +### Phase 2: Initial Drafting (Existing Workflow) |
| 25 | +- **Outline Creation:** Generate a detailed Markdown outline based on the Style Guide. |
| 26 | +- **Skeleton Initialization:** Create a target file with placeholders. |
| 27 | +- **Section-by-Section Drafting:** Use the `writer` agent to fill placeholders with detailed prose. |
| 28 | + |
| 29 | +### Phase 3: Refinement Phase (New Mode) |
| 30 | +- **Goal:** Apply suggested improvements from a `.review.md` file. |
| 31 | +- **Action:** The `/draft` command reads the target file and its `.review.md` sidecar. |
| 32 | +- **Agent Invocation:** Invoke the `writer` agent with instructions to process the review findings. |
| 33 | +- **Direct Modification:** The `writer` agent identifies suggested changes (Structural, Substance, or Linguistic) and uses the `replace` tool to update the target file directly. |
| 34 | +- **Consistency Check:** Ensure the modifications maintain a consistent tone and adhere to the Style Guide. |
| 35 | + |
| 36 | +### Finalization |
| 37 | +- **Summary:** Notify the user that the draft has been updated or refined. |
| 38 | +- **Next Steps:** Suggest a final `/review` if significant changes were made. |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Implementation Steps |
| 43 | + |
| 44 | +### Step 1: Agent Evolution (Rename & Refactor) |
| 45 | +1. **Rename File:** Move `.gemini/agents/reporter.md` to `.gemini/agents/writer.md`. |
| 46 | +2. **Update Agent Definition:** |
| 47 | + - Change name from `reporter` to `writer`. |
| 48 | + - Update the prompt to reflect its role as a "Full-Blown Writer" capable of both original composition and deep refinement. |
| 49 | + - Explicitly instruct the agent on how to interpret and apply findings from `.review.md` files using the `replace` tool. |
| 50 | + |
| 51 | +### Step 2: Upgrade `/draft` Command (`.gemini/commands/draft.toml`) |
| 52 | +1. **Update References:** Change all calls from `reporter` to `writer`. |
| 53 | +2. **Implement Branching:** Update the prompt to check for `.review.md` files and offer a "Refinement Mode." |
| 54 | +3. **Refine Refinement Logic:** Provide clear instructions for the `writer` agent to perform direct, surgical updates during the Refinement Phase. |
| 55 | + |
| 56 | +### Step 3: Global Alignment |
| 57 | +1. **Documentation:** Update `docs/user-guide.md` and `docs/design.md` to reflect the new agent name and workflow. |
| 58 | +2. **Cross-References:** Update mentions of "reporter" in `README.md`, `TASKS.md`, and `CHANGELOG.md`. |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Verification Strategy |
| 63 | + |
| 64 | +### 1. Functional Testing |
| 65 | +- **Initial Draft:** Verify `/draft` still works for new documents using the renamed `writer` agent. |
| 66 | +- **Refinement Detection:** Ensure `/draft` correctly identifies a `.review.md` file and enters Refinement Mode. |
| 67 | +- **Direct Replacement:** Confirm the `writer` agent successfully uses `replace` to apply a suggestion from a review file. |
| 68 | + |
| 69 | +### 2. Quality Audit |
| 70 | +- **Style Consistency:** Verify that refined sections still adhere to the project's Style Guide. |
| 71 | +- **Technical Depth:** Ensure the `writer` agent maintains a high level of technical detail (7-8/10) during both drafting and refinement. |
0 commit comments