# TODO

Dump anything here.

---

## Self-Feedback Inbox

### [prompt-modularization] Phase 3 — migrate remaining builders to `composeUnitContext` v2

**Context:** Phase 1 (fragment infrastructure, 17-prompt Working Directory deduplication) and
Phase 2 (5 stub manifests for deploy/smoke-production/release/rollback/challenge) shipped in
commit `ca5d869e3`. 9 of 26 unit types are now fully manifest-driven via `composeInlinedContext`.

**What's blocked and why:**

Migrating the remaining 17 builders to `composeInlinedContext` (v1) is the wrong path because:
1. `inlineKnowledgeScoped` and `inlineGraphSubgraph` are NOT in `ARTIFACT_KEYS` — these
   artifacts would remain imperative and undeclared in every manifest, making manifests
   structurally unreliable descriptions of actual builder behavior.
2. Injecting knowledge/graph at the right position in the composed string requires fragile
   sentinel-string searches (e.g., `body.lastIndexOf("### Task Summary:")`). This pattern
   is already untested in the 2 migrated complex builders (`research-milestone`, `complete-slice`).
3. `composeUnitContext` (v2) in `unit-context-composer.js` already has `computed`, `prepend`,
   and `excerpt` support — knowledge and graph inlining maps cleanly to `computed` entries.
   Migrating to v1 now creates a half-migration state that must be undone when v2 lands.

**Recommended next slice:**
1. Add `"knowledge"` and `"graph"` to `ARTIFACT_KEYS` in `unit-context-manifest.js`.
2. Register them as `computed` entries in relevant `UNIT_MANIFESTS` entries.
3. Wire one builder (e.g., `buildResearchSlicePrompt`) through `composeUnitContext` v2 as pilot.
4. Add position-assertion tests to already-migrated complex builders (`research-milestone`,
   `complete-slice`) to guard against silent ordering degradation.
5. Then migrate remaining builders in batches: slice builders → milestone builders → execute-task.

**Note on `prompt-cache-optimizer.js`:** Entirely dead code — `optimizeForCaching()`,
`estimateCacheSavings()`, `computeCacheHitRate()` have zero importers. `reorderForCaching()`
is wired at `phases-unit.js:519` but no `cache_control` markers are written to outgoing
requests. Remove the file or wire it in the same slice that adds `cache_control` breakpoints.

---
