# Issues 271 and 272 Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Make page identity and source-file resolution canonical across read and write tools, with explicit `lang` handling and machine-readable `resolved_lang` / `resolved_source_path` in migrated handlers.

**Architecture:** Build on top of `internal/contentmodel` from PR #289. First unify the resolver contract around a single canonical source-selection path, then project that identity into selected read/write handlers without trying to migrate every tool in one diff.

**Tech Stack:** Go, `internal/contentmodel`, existing `internal/site.PageResolver`, `internal/hugosite.SourceIndex`, MCP tool handlers.

---

### Phase A
- extend shared resolver primitives so both read and write code can ask the same question: "for this slug + optional lang, what is the concrete source file and canonical identity?"
- add failing tests for multilingual ambiguity and explicit language selection on both read and write paths

### Phase B
- migrate the first read-family handlers (`get_page_frontmatter`, `get_full_page_markdown`, `build_agent_context`, `diff_page`) to return `resolved_lang` / `resolved_source_path`
- keep compatibility for existing top-level fields

### Phase C
- migrate write-family handlers (`create_page`, `update_page`, `delete_page`) so:
  - `create_page` accepts `lang`
  - source resolution uses the shared resolver path
  - outputs include `resolved_lang` / `resolved_source_path`

### Phase D
- full verification, stronger-model review, draft PR for Claude
