# Phase 4 ## Step 1 — Deep codebase analysis Use the Agent tool with `model: "haiku"` and `subagent_type: "Explore"` with thoroughness "very thorough" to: - Map every file that will be created or modified - Identify dependency order between changes - Find existing test patterns - Note migration requirements ## Step 2 — Create plan Use the Agent tool with `model: "opus"` and `subagent_type: "general-purpose"` to design the implementation plan based on: - The feature description from the `` comment - Full Q&A history from all session comments - Codebase exploration results - The project's existing patterns (DDD layers, aggregate repos, hand-written SQL, Watermill messaging, etc.) The plan must produce content for three wiki page types (see `templates/` for format): ### Feature page content - Problem summary - Design decisions - Task dependency graph (ASCII) - Tasks table with IDs and titles ### Sub-task pages content (one per task: T01, T02, ...) - Description of what the task accomplishes - Files created/modified - Dependencies and parallel tasks - Detailed changes with code sketches ## Step 3 — Publish wiki pages Wiki page naming: - **Feature page**: `feature--` where `` is kebab-case issue title (max 40 chars) - **Sub-task pages**: `feature---t` (e.g. `feature-12-user-auth-t01`) For each page, use `mcp__gitea__create_wiki_page` with: - `owner`, `repo` - `title`: the page name - `content_base64`: page content **base64-encoded** - `message`: descriptive commit message To base64-encode, use Bash: `echo -n '' | base64 -w0` If a page already exists (tool errors), use `mcp__gitea__update_wiki_page` instead with `pageName` set to the page name. ## Step 4 — Update README wiki page Check if a `README` wiki page exists via `mcp__gitea__get_wiki_page` (`pageName: "README"`). - If it does not exist, create it using the `templates/readme.md` format with the current feature as the first row. - If it exists, decode its content, append a new row for this feature to the table, and update it. Feature table row format: ``` | | [](<issue_url>) | Planning | [Wiki](<feature_wiki_url>) | ``` ## Step 5 — Post plan link as comment Construct the wiki URL: `https://<GITEA_HOST>/<owner>/<repo>/wiki/<page-name>` (GITEA_HOST is `git.marlerino-apps.io`) Post a comment on the issue: ```markdown <!-- mpns-feature-bot --> # Implementation Plan Published to wiki: [<feature-page-name>](<feature-wiki-url>) ## Tasks - [ ] T01: [<task title>](<t01-wiki-url>) - [ ] T02: [<task title>](<t02-wiki-url>) ... ``` Tell the user: "Implementation plan published to wiki. Link posted on the issue."