- This repository uses the DOX
AGENTS.mdhierarchy: root instructions apply everywhere, and childAGENTS.mdfiles add binding local contracts for their subtrees. - Before editing, read this file and every
AGENTS.mdon the path to each target. If a parent index points to a child that covers the target, read that child too. - If instructions conflict, the closest
AGENTS.mdcontrols local details, but child docs must not weaken root security, quality, release, or DOX rules. - After meaningful changes, update the closest owning
AGENTS.mdwhen purpose, contracts, workflows, verification, artifacts, or child indexes changed. - Keep DOX docs operational: document stable contracts and current checks, not diary notes or aspirational systems.
codebase-cliis the open-source terminal agent for Codebase. It provides an interactive TUI, headless mode, model/provider routing, tools, MCP, auth, memories, permissions, hooks, subagents, tournaments, and release packaging.
src/— TypeScript source for the CLI and all runtime subsystems.bin/— executable shim published as thecodebasebinary.dist/— generated build output; do not edit by hand.docs/— user/developer reference documentation..settings/— durable architecture, testing, and extension notes.bench/— benchmark scenarios, runner, and reports.scripts/— release/build/support automation.vscode-extension/— companion editor extension.Formula/— package-manager/release packaging assets.
- Keep the CLI safe-by-default: filesystem, shell, SSH, MCP, hooks, subagents, and git tools must validate paths, permissions, and command effects.
- Preserve cross-platform behavior for macOS/Linux/Windows unless a file explicitly scopes itself.
- Do not log API keys, OAuth tokens, refresh tokens, credentials file contents, MCP secrets, or user clipboard/image data.
- Treat tests as part of the public contract. When behavior changes, update the matching
*.test.tsfile or document the intentional gap. - Generated
dist/files are build artifacts. Source changes belong insrc/.
- Prefer small focused modules with colocated tests.
- Keep command UX plain and terminal-friendly; avoid hidden network calls or file mutations without permission flow.
- Use existing abstractions from
pipackages and local subsystem APIs rather than parallel agent/tool frameworks.
- Standard gate:
npm run check. - Type-only:
npm run typecheck. - Lint/format:
npm run lint,npm run lint:fix, ornpm run format. - Tests:
npm testor targetednpx vitest --run <file>. - Build/release packaging:
npm run build;npm run prepublishOnlybefore publishing. - Documentation-only edits:
git diff --check.
src/AGENTS.md— CLI source architecture and subsystem index.docs/AGENTS.md— user/developer docs..settings/AGENTS.md— durable project standards and planning material.bench/AGENTS.md— benchmarks.scripts/AGENTS.md— automation scripts.vscode-extension/AGENTS.md— companion VS Code extension.