---
name: "Extract shared test helpers (test_ctx, write_story_file, make_api)"
agent: "coder-opus"
---

# Refactor 444: Extract shared test helpers (test_ctx, write_story_file, make_api)

## Current State

- TBD

## Desired State

Several test helper functions are copy-pasted across many test modules: `test_ctx` (10 copies across http/ modules), `write_story_file` (5 copies across chat/commands/ and matrix/), `make_api` (5 copies across http/ modules), `setup_project` (3 copies in io/). Extract each into a shared `#[cfg(test)]` utility module so test scaffolding is maintained in one place.

## Acceptance Criteria

- [ ] test_ctx has a single shared definition used by all 10 http test modules
- [ ] write_story_file has a single shared definition used by all 5 callers
- [ ] make_api has a single shared definition used by all 5 callers
- [ ] setup_project has a single shared definition used by all 3 callers
- [ ] All private copies in individual test modules are removed

## Out of Scope

- TBD
