xonecas.io
64875
Mc

mini-coder / commit 499bbe6

docs: update AGENTS.md, TODO.md with Phase 1 completion notes and /effort open question

xonecas2026-04-04 499bbe6684633135cd7fb349edf43daa2ce03ee7 parent 7e94453

2 files changed

AGENTS.md+9−5
@@ -32,12 +32,16 @@
3232
3333 We test our logic at the boundaries. Never test dependencies (pi-ai, cel-tui, bun:sqlite). Never use mocks or stubs.
3434
35-**Tools** (`shell`, `edit`, `readImage`):
35+**Tools** (`tools.ts` — `shell`, `edit`; `readImage` deferred to Phase 3):
3636
37-- `edit`: exact-text match/replace, multi-match failure, missing text failure, new file creation, line ending preservation, UTF-8 handling.
38-- `shell`: output truncation logic (head + tail with marker), exit code passthrough.
39-- `readImage`: base64 encoding, mime type detection, unsupported format rejection, missing file handling.
40-- Pure functions with clear inputs/outputs.
37+- `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.
38+- `shell`: stdout/stderr capture, exit code passthrough, output truncation (head + tail with marker), abort signal, cwd propagation.
39+- `truncateOutput`: pure function — within limit, head+tail+marker, no overlap, empty/single-line/exact-limit edge cases.
40+- `readImage` (Phase 3): base64 encoding, mime type detection, unsupported format rejection, missing file handling.
41+
42+**Git** (`git.ts`):
43+
44+- Real temp git repos (no mocks). Tests: outside-repo null, repo root, branch name, untracked/modified/staged counts, mixed states, ahead/behind with local bare remote, subdirectory support.
4145
4246 **Session persistence** (`session.ts`):
4347
TODO.md+11−4
@@ -6,13 +6,17 @@
66 - [x] `session.test.ts` — 20 tests against real in-memory bun:sqlite
77 - [x] `tools.ts` — `edit` (exact-text replace, new file creation) and `shell` (exec, output truncation)
88 - [x] `tools.test.ts` — 27 tests: edit (13), shell (8), truncateOutput (6)
9-- [ ] `git.ts` — branch, dirty counts, ahead/behind, repo root detection
9+- [x] `git.ts` — branch, dirty counts, ahead/behind, repo root detection (10 tests)
1010
1111 ### Notes from Phase 1
1212
1313 - `session.ts` exports: `openDatabase`, `createSession`, `getSession`, `listSessions`, `deleteSession`, `appendMessage`, `loadMessages`, `undoLastTurn`, `forkSession`, `computeStats`.
1414 - Internal row types (`SessionRow`, `MaxTurnRow`, `DataRow`) and a `SQL` constants object keep queries centralized and avoid formatter conflicts.
1515 - `@mariozechner/pi-ai` is the only runtime dependency so far. Its `Message`, `AssistantMessage`, `UserMessage`, `ToolResultMessage` types are used for session persistence.
16+- `tools.ts` exports: `executeEdit`, `executeShell`, `truncateOutput`, `editTool`, `shellTool` (pi-ai `Tool` definitions with TypeBox schemas). `ToolResult` type (`{ text, isError }`) is the common return shape.
17+- `git.ts` exports: `getGitState` → `GitState | null`. Runs 4 git commands in parallel. Internal `parseStatus` parses porcelain v1 format (uses `trim=false` to preserve leading-space column).
18+- biome `noNonNullAssertion` rule disabled globally — non-null assertions after explicit null checks are idiomatic in tests.
19+- 57 tests total across 3 files (session: 20, tools: 27, git: 10).
1620
1721 ## Phase 2 — Context assembly
1822
@@ -22,8 +26,7 @@
2226 ### Phase 2 entry points
2327
2428 - `skills.ts` depends on nothing from Phase 1. It scans directories for `SKILL.md` files, parses YAML frontmatter (name, description), resolves name collisions (project-level wins over user-level), and generates the XML catalog string for the system prompt. See spec.md "Agent Skills" section.
25-- `prompt.ts` depends on `skills.ts` and `git.ts`. It walks from CWD to scan root collecting `AGENTS.md`/`CLAUDE.md` files, assembles the full system prompt in construction order (base → AGENTS.md → skills catalog → plugin suffixes → session footer with date/cwd/git). See spec.md "System prompt" section.
26-- `git.ts` (from Phase 1) is needed by `prompt.ts` for the session footer git line.
29+- `prompt.ts` depends on `skills.ts` and `git.ts` (both done). It walks from CWD to scan root collecting `AGENTS.md`/`CLAUDE.md` files, assembles the full system prompt in construction order (base → AGENTS.md → skills catalog → plugin suffixes → session footer with date/cwd/git). See spec.md "System prompt" section.
2730
2831 ## Phase 3 — Agent loop
2932
@@ -35,5 +38,9 @@
3538
3639 - [ ] `ui.ts` — cel-tui layout (log + input + status bar), state management, message rendering
3740 - [ ] `index.ts` — entry point, provider discovery, startup sequence, command routing
38-- [ ] Commands — `/model`, `/session`, `/new`, `/fork`, `/undo`, `/reasoning`, `/verbose`, `/login`, `/logout`, `/help`
41+- [ ] Commands — `/model`, `/session`, `/new`, `/fork`, `/undo`, `/reasoning`, `/verbose`, `/login`, `/logout`, `/help`, `/effort`
3942 - [ ] Input handling — `/skill:name` parsing, image path detection, Tab file autocomplete
43+
44+## Open questions
45+
46+- **`/effort` command**: we need a command to control model reasoning effort at runtime (similar to `/model` for model switching). This is missing from `spec.md` — update the spec before implementing. Consider: should it cycle through levels (`low` → `med` → `high` → `xhigh`), show a selector, or accept an argument (`/effort high`)? How does it interact with the session's `effort` field? Status bar already shows effort — just needs the command wired up.