xonecas.io
64875
Mc

mini-coder / commit 2a33a2a

docs: add implementation plan and repo context for next sessions

xonecas2026-04-04 2a33a2adbb0bbccc56276c15ea9d0663b6b4ff23 parent f146748

2 files changed

AGENTS.md+18−1
@@ -5,9 +5,26 @@
55 - Use Conventional Commits formatting for commit messages.
66 - Before committing code changes, review the diff with the user and get approval for the commit.
77
8+## Repo
9+
10+- Runtime: Bun. Use `bun run` for scripts, `bun test` for tests, `bun install` for deps.
11+- `bun run check` runs the pre-commit checks (prettier, typecheck, biome lint).
12+- `bun run format` fixes formatting.
13+- App data directory: `~/.config/mini-coder/`.
14+- Key dependency source code for reference:
15+ - pi-ai: `~/src/pi-mono/packages/ai/` — LLM provider SDK. See `src/types.ts` for core types, `src/stream.ts` for streaming API, `src/utils/oauth/` for OAuth, `src/providers/faux.ts` for test provider.
16+ - cel-tui: `~/src/cel-tui/` — TUI framework. See `spec.md` for full API, `examples/chat.ts` for the chat UI pattern, `packages/components/src/markdown.ts` for Markdown component.
17+
18+## Code style
19+
20+- Do not inline `import` calls. Don't duplicate code. Don't leave dead code behind.
21+- Don't re-implement helpers that already exist, always consolidate.
22+- Keep it minimal — don't add abstractions for hypothetical futures.
23+- Performance matters. Prefer fast paths.
24+
825 ## Testing strategy
926
10-We test our logic at the boundaries. Never test dependencies (pi-ai, cel-tui, bun:sqlite).
27+We test our logic at the boundaries. Never test dependencies (pi-ai, cel-tui, bun:sqlite). Never use mocks or stubs.
1128
1229 **Tools** (`shell`, `edit`, `readImage`):
1330
TODO.md+25−0
@@ -0,0 +1,25 @@
1+# Implementation plan
2+
3+## Phase 1 — Foundation (no UI, no LLM)
4+
5+- [ ] `session.ts` — SQLite schema, CRUD, turn numbering, undo, fork, cumulative stats
6+- [ ] `tools.ts` — edit (exact-text replace, new file creation) and shell (exec, output truncation)
7+- [ ] `git.ts` — branch, dirty counts, ahead/behind, repo root detection
8+
9+## Phase 2 — Context assembly
10+
11+- [ ] `skills.ts` — SKILL.md discovery, frontmatter parsing, catalog generation, name collision resolution
12+- [ ] `prompt.ts` — AGENTS.md discovery, system prompt construction (base + AGENTS.md + skills + plugins + git footer)
13+
14+## Phase 3 — Agent loop
15+
16+- [ ] `agent.ts` — core loop: stream → handle events → execute tools → loop. Interrupt handling. Context limit / compaction.
17+- [ ] `plugins.ts` — plugin loader, init/destroy lifecycle, tool + prompt injection
18+- [ ] `readImage` tool — base64 encoding, mime detection, conditional registration
19+
20+## Phase 4 — UI
21+
22+- [ ] `ui.ts` — cel-tui layout (log + input + status bar), state management, message rendering
23+- [ ] `index.ts` — entry point, provider discovery, startup sequence, command routing
24+- [ ] Commands — `/model`, `/session`, `/new`, `/fork`, `/undo`, `/reasoning`, `/verbose`, `/login`, `/logout`, `/help`
25+- [ ] Input handling — `/skill:name` parsing, image path detection, Tab file autocomplete