- This repo expects agents to use the
programming-practicesskill at all times. - Spec-driven development:
spec.mdis the source of truth for behavior and design. Read it before changing code. Do not deviate without discussion. - Use Conventional Commits formatting for commit messages.
- Before committing code changes, review the diff with the user and get approval for the commit.
- Check
PROGRESS.mdto check if there are any ongoing tasks. - For audits, treat open
TODO.mditems as already-known issues and focus findings on new gaps unless the user asks to re-check known debt. - Keep
TODO.mdminimal and current; remove completed items instead of accumulating history.
src/index.tsβ startup, providers, settings, AGENTS.md/skills loading, theme assembly, shared app state.src/agent.tsβ streaming model loop, tool dispatch, agent events.src/tools.tsβ built-in tools and truncation logic.src/session.tsβ SQLite persistence, turn numbering, undo/fork, prompt history, cumulative stats.src/prompt.ts,src/skills.tsβ prompt assembly and external context discovery/loading.src/ui.tsβ cel-tui lifecycle and top-level orchestration.src/ui/agent.tsβ input submission, streaming state, agent-loop wiring.src/ui/commands.tsβ slash commands and Select overlays.src/ui/conversation.ts,src/ui/status.ts,src/ui/input.ts,src/ui/help.ts,src/ui/overlay.tsβ focused rendering/helpers.
- Runtime: Bun. Use
bun run,bun test,bun install,bunx. - Toolchain split: prettier formats, biome lints + sorts imports. CI runs
bun test,bun run check,bun run format, andbun run typecheck. Lefthook runs the same steps sequentially. - App data dir:
~/.config/mini-coder/. - Published CLI entrypoint is
mcviabin/mc.tsβsrc/index.ts. Do not pointpackage.json#binatdist/unless publish actually produces it. - For self-review or audit passes, use mini-coder in headless mode from the repo root, e.g.
mc -p "review the current diff". - All exports need JSDoc; interface fields get single-line JSDoc. See
session.tsfor the pattern. - Dependency references:
- pi-ai:
~/src/pi-mono/packages/ai/(src/types.ts,src/stream.ts,src/utils/oauth/,src/providers/faux.ts) - cel-tui:
~/src/cel-tui/(~/src/cel-tui/spec.md,examples/chat.ts)
- pi-ai:
- Release instructions live here now; do not rely on
.agents/skills/release. - This repo does not have a build step. Do not run
bun run buildfor releases. - The published package ships the checked-in Bun launcher (
bin/mc.ts), runtime source (src/index.ts), andREADME.mdso npm shows the package docs. The release-time publishability check isbun pm pack --dry-run --ignore-scripts. - Before mutating anything for a release:
- ensure the current branch is
main - ensure
git status --porcelainis empty - run
git fetch origin --tagsand ensureHEADmatchesorigin/main - read
package.jsonto capture the packagenameand releaseversion - if
package.jsonis already ahead of npm, treat that version as the intended release version and do not bump again unless the user explicitly asks - ensure
git tag v<version>does not already exist locally or on origin - ensure
npm view <name>@<version> versiondoes not already exist
- ensure the current branch is
- Release verification suite:
bun testbun run checkbun run formatbun run typecheckbun pm pack --dry-run --ignore-scriptsand confirm the packed file list includesREADME.md
- Pre-release docs sync:
- audit
README.mdagainstspec.mdand the current command/CLI sources (src/input.ts,src/ui/help.ts,src/cli.ts,src/headless.ts,package.json) - update
README.mdonmainfirst - update the
gh-pagesbranch in a separategit worktree - sync
README.md,spec.md, andAGENTS.mdinto thatgh-pagesworktree so the branch does not keep stale repo docs - update
gh-pages/index.htmlso its install, features, commands, and headless-mode copy matches the repo docs and current behavior - review the
gh-pagesdiff before committing or pushing it
- audit
- Release flow:
- if the version needs to change, update only
package.json - review the diff with the user before committing
- commit with
chore: release v<version> - create an annotated tag
v<version> - push
mainand the exact tag explicitly - run
npm publish --ignore-scripts - verify the publish with
npm view <name>@<version> version
- if the version needs to change, update only
- If any check fails, stop and report the failure instead of improvising around it.
- No inline
importcalls, duplicated helpers, dead code, or speculative abstractions. - Performance matters. Prefer fast paths.
- Don't over-optimize, let the problems reveal themselves first.
- Study dependency examples, types, and tsconfig before integrating them. Match their patterns instead of fighting them.
- Use dependency-defined types, not weaker substitutes. Do not hide type/config mismatches with casts or ignores.
- For UI work, verify both light/dark terminal legibility and let the layout engine size things.
- Don't add future-facing
biome-ignore,@ts-ignore, or impossible type guards. - Event APIs must carry the data handlers need; do not reconstruct it from unrelated state.
- Async callbacks must catch returned promises.
- In cel-tui
onKeyPress, returnfalseonly for keys you explicitly intercept. Escape often needsonBlur, notonKeyPress. - When adding provider/tool options, trace them through the full call chain (for example
apiKeyintostreamSimple). - UI/info messages may live in the persisted log and in
state.messages, but they must stay marked as UI-only (role: "ui",turn = NULL) and always be filtered out of model context. - Prompt context has explicit reload boundaries: AGENTS.md content and discovered skills are stable within a session and should refresh only at boundaries like
/newor CWD change. - Tool safety truncation and UI
/verbosepreview are separate layers. Do not conflate them. - Avoid accretive growth. When a file starts absorbing unrelated behavior, split it at a real seam instead of appending more helpers. Prefer explicit state ownership over module globals, shared helpers over copy-modify text/state logic, and typed boundaries over
Record<string, unknown>plus downstream casts. - Before 1.0, prefer correct/simple semantics over speculative compatibility shims, but call out intentional breaking changes.
- TUI changes need real terminal validation in
tmux; passing tests is not enough. - Stay within the agreed TODO scope. Do not pull in adjacent items without discussion.
- Don't write tests that call real git commands.
- For test work, read and follow the
testing-practicesskill, not just the generic coding guidance. - Don't add brittle tests that pin incidental wording, formatting, colors, layout, render-tree plumbing, tokenizer scopes, or other implementation-shaped output unless that exact output is the actual contract.
- In UI tests, prefer real input paths and user-visible outcomes over poking
props.onKeyPress, focus internals, or syntax-theme objects directly.