@@ -48,12 +48,12 @@
4848
4949 We test our logic at the boundaries. Never test dependencies (pi-ai, cel-tui, bun:sqlite). Never use mocks or stubs.
5050
51-**Tools** (`tools.ts` — `shell`, `edit`; `readImage` deferred to Phase 3):
51+**Tools** (`tools.ts` — `shell`, `edit`, `readImage`):
5252
5353 - `edit`: exact-text match/replace, multi-match failure, missing text failure, new file creation, parent dir creation, existing-file guard, line ending preservation (LF/CRLF), UTF-8 handling, relative/absolute path resolution.
5454 - `shell`: stdout/stderr capture, exit code passthrough, output truncation (head + tail with marker), abort signal, cwd propagation.
5555 - `truncateOutput`: pure function — within limit, head+tail+marker, no overlap, empty/single-line/exact-limit edge cases.
56-- `readImage` (Phase 3): base64 encoding, mime type detection, unsupported format rejection, missing file handling.
56+- `readImage`: base64 encoding, mime type detection, unsupported format rejection, missing file handling, relative/absolute path resolution.
5757
5858 **Git** (`git.ts`):
5959
@@ -83,10 +83,16 @@ We test our logic at the boundaries. Never test dependencies (pi-ai, cel-tui, bu
8383 **Agent loop** (`agent.ts`):
8484
8585 - Use pi-ai's `faux` provider for end-to-end loop tests.
86-- Verify: tool calls are executed, messages are appended in correct order, turns are numbered, interrupt preserves partial response, context limit triggers compaction.
86+- Verify: tool calls are executed, messages are appended in correct order, turns are numbered, interrupt preserves partial response, error handling, unknown tool self-correction, length stop reason.
8787
88-**Input parsing**:
88+**Input parsing** (`input.ts`):
8989
90-- `/skill:name rest of message` → skill body + "rest of message".
91-- `/command` detection and routing.
92-- Image path detection (entire input is an image path that exists and has a valid extension).
90+- `/command` detection and routing (all 11 commands, case-sensitive, unknown commands fall through).
91+- `/skill:name rest of message` → skill name + user text extraction.
92+- Image path detection (entire input is an existing image path with valid extension, requires `supportsImages` opt-in).
93+- Priority ordering: commands > skills > images > plain text.
94+
95+**Theme** (`theme.ts`):
96+
97+- Default theme has all required keys (9 terminal palette colors).
98+- `mergeThemes` applies partial overrides left-to-right without mutating the base.