|
| 1 | +# Plan: Implement Drafting and Editing Capabilities |
| 2 | + |
| 3 | +This plan outlines the implementation of `/draft` and `/revise` commands to assist users in writing detailed white papers or research articles by leveraging existing project context and research. |
| 4 | + |
| 5 | +## Objective |
| 6 | +Enable a structured drafting and editing workflow that reuses existing subagents and follows a multi-phase process for content generation and refinement. |
| 7 | + |
| 8 | +## Architectural Impact |
| 9 | +- **Agent Refactoring**: Generalizes the `reporter` agent to be used across different contexts (research reports, white papers, etc.). |
| 10 | +- **New Subagent**: Introduces an `editor` subagent specialized in linguistic and structural quality. |
| 11 | +- **New Commands**: Adds `/draft` for interactive content generation and `/revise` for iterative refinement. |
| 12 | +- **Workflow Integration**: Connects research, planning, and drafting into a cohesive pipeline. |
| 13 | + |
| 14 | +## File Operations |
| 15 | + |
| 16 | +### Modify |
| 17 | +- `.gemini/agents/reporter.md`: Generalize the prompt to handle any source material and target files. |
| 18 | + |
| 19 | +### Create |
| 20 | +- `.gemini/agents/editor.md`: New subagent for structural and linguistic review. |
| 21 | +- `.gemini/commands/draft.toml`: New command for the drafting workflow. |
| 22 | +- `.gemini/commands/revise.toml`: New command for the revision workflow. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Step-by-Step Execution |
| 27 | + |
| 28 | +### Step 1: Refactor the `reporter` Subagent |
| 29 | +Update `.gemini/agents/reporter.md` to be agnostic of specific file names (like `report.md`) or directories (like `research/`). |
| 30 | +- **Action**: Modify `.gemini/agents/reporter.md`. |
| 31 | +- **Changes**: Use general terms like "source materials" and "target document" instead of hardcoded paths. The caller (the main command) will provide specific context in its instructions. |
| 32 | + |
| 33 | +### Step 2: Create the `editor` Subagent |
| 34 | +Implement a new subagent specialized in refining drafts. |
| 35 | +- **Action**: Create `.gemini/agents/editor.md`. |
| 36 | +- **Role**: A Professional Editor focusing on grammar, structure, and technical writing style. |
| 37 | +- **Tools**: `read_file`, `replace`, `list_directory`. |
| 38 | + |
| 39 | +### Step 3: Implement the `/draft` Command |
| 40 | +Define the multi-phase workflow for drafting. |
| 41 | +- **Action**: Create `.gemini/commands/draft.toml`. |
| 42 | +- **Phase 1 (Context Gathering)**: Search for existing context in `research/`, `plans/`, `TASKS.md`, and `journal/`. If no context is found, redirect the user to `/plan` or `/research`. |
| 43 | +- **Phase 2 (Title & Location)**: Propose a title and path (e.g., `drafts/<title>.md`) and seek user approval. |
| 44 | +- **Phase 3 (Outline Creation)**: Generate an initial outline, present it for user review, and refine based on feedback. |
| 45 | +- **Phase 4 (Initialization)**: Create the skeleton file with placeholders for each section. |
| 46 | +- **Phase 5 (Section-by-Section Drafting)**: Iteratively call the `reporter` subagent to fill each section using the gathered context. |
| 47 | +- **Phase 6 (Conclusion)**: Summarize the result and suggest `/revise`. |
| 48 | + |
| 49 | +### Step 4: Implement the `/revise` Command |
| 50 | +Define the workflow for refining an existing draft. |
| 51 | +- **Action**: Create `.gemini/commands/revise.toml`. |
| 52 | +- **Phase 1 (File Selection)**: Prompt the user to select a file for revision. |
| 53 | +- **Phase 2 (Analysis)**: Use the `editor` subagent to perform a structural and linguistic audit. |
| 54 | +- **Phase 3 (Interactive Revision)**: Present findings and proposed changes to the user; apply improvements upon approval using `replace`. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## Testing Strategy |
| 59 | + |
| 60 | +### 1. Functional Testing of `/draft` |
| 61 | +- **Context Discovery**: Run `/draft` when `research/` or `plans/` are empty. Verify it suggests running `/plan` or `/research`. |
| 62 | +- **Context Gathering**: Run `/draft` with existing research data. Verify it correctly identifies and summarizes the sources. |
| 63 | +- **Interactive Outline**: Verify the `ask_user` loop for outline approval works as expected. |
| 64 | +- **Iterative Drafting**: Verify that `reporter` correctly fills placeholders with detailed prose instead of summaries. |
| 65 | + |
| 66 | +### 2. Functional Testing of `/revise` |
| 67 | +- **Analysis**: Verify that the `editor` subagent identifies grammatical issues or awkward phrasing in a provided draft. |
| 68 | +- **Refinement**: Verify that approved changes are correctly applied to the target file. |
| 69 | +- **Style Adherence**: Check if the output follows technical writing standards (active voice, clarity, etc.). |
| 70 | + |
| 71 | +### 3. Integration Testing |
| 72 | +- **End-to-End Workflow**: Conduct a full cycle: `/research` -> `/plan` -> `/draft` -> `/revise`. Ensure the transitions between stages are smooth and context is preserved. |
| 73 | +- **File Integrity**: Ensure that `replace` operations do not corrupt the markdown structure or accidentally delete sections. |
0 commit comments