Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
613eb52
docs: add v0.1 design record
hutusi Jul 10, 2026
d61768a
chore: scaffold Bun workspace monorepo with verify gate
hutusi Jul 10, 2026
bf52280
feat(protocol): JSON-RPC connection, in-proc transport, ACP-shaped types
hutusi Jul 10, 2026
2920465
feat(providers): ModelProvider interface + AI SDK v6 Anthropic adapter
hutusi Jul 10, 2026
a045840
feat(kernel): agent loop, event-sourced sessions, built-in tools, app…
hutusi Jul 10, 2026
d2e8cc5
feat(client): frontend-agnostic protocol client + session view-model …
hutusi Jul 10, 2026
907fa54
feat(cli): Ink REPL over the in-proc transport
hutusi Jul 10, 2026
22df356
fix: apply slice-1 code-review findings (cancellation, exec, validati…
hutusi Jul 10, 2026
6ad90be
feat(protocol): session/load, session/set_mode, modes, plan updates, …
hutusi Jul 10, 2026
460fe97
feat(kernel): write_file, glob, grep, and todo_write tools
hutusi Jul 10, 2026
767c91c
feat(kernel): permission rule engine, session modes, resume via log r…
hutusi Jul 10, 2026
31c9469
feat(client,cli): resume flags, session modes UI, always-allow, todo …
hutusi Jul 10, 2026
986f3d6
fix: apply slice-2 review findings (permission ordering, escapes, res…
hutusi Jul 10, 2026
8a95a16
feat(protocol): stream transport with ACP stdio framing
hutusi Jul 10, 2026
e6aafa9
feat(cli): minerva acp — host the kernel on stdio for editors
hutusi Jul 10, 2026
9b03642
feat(providers): OpenAI provider + provider/model references
hutusi Jul 10, 2026
4a19df1
feat(kernel): MCP client — external tools through the same permission…
hutusi Jul 10, 2026
11be439
feat: manual /compact + CLI command palette
hutusi Jul 10, 2026
10f49db
docs: usage guide, config reference, release script, slice status
hutusi Jul 10, 2026
93d2580
fix: local review findings for slices 3-4 (MCP env/lifecycle, client …
hutusi Jul 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
coverage/
*.log
.env
.env.*
.DS_Store
134 changes: 133 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,133 @@
# minerva
# Minerva

A cross-platform, model-agnostic code agent — a headless kernel with multiple
frontends (CLI now, GUI later).

- **Architecture**: protocol everywhere ([ACP](https://agentclientprotocol.com)
core + `minerva/*` extensions), one kernel, swappable transports (in-process,
stdio; WebSocket planned).
- **Stack**: TypeScript, Bun, Vercel AI SDK, Ink (CLI), Tauri 2 (GUI, planned).

See [docs/DESIGN.md](docs/DESIGN.md) for the design record and current status.

## Quick start

```sh
bun install
export ANTHROPIC_API_KEY="sk-ant-..."
bun run --cwd packages/cli dev
```

## Usage

```
minerva [command] [options]

Commands:
(default) Interactive terminal UI
acp Host the kernel on stdio (ACP framing) for editors

Options:
-c, --continue Resume the most recent session for this directory
-r, --resume <id> Resume a specific session
-m, --model <ref> Model as [provider/]model, e.g. openai/gpt-5.2 or
claude-opus-4-8 (bare ids default to Anthropic)
-h, --help Show help
```

Inside the TUI:

| Command | Effect |
|---|---|
| `/help` | List commands |
| `/mode [id]` | Show or set the session mode (`plan` \| `default` \| `acceptEdits` \| `auto`) |
| `/compact` | Summarize the conversation and reset the model context |
| `/sessions` | List recent sessions for this directory |
| `/new` | Start a fresh session |
| `/exit` | Quit |

`esc` cancels the running turn — including while a permission prompt is open.
Permission prompts accept `y` (allow once), `a` (allow always — persisted as a
project rule), `n` (reject), `esc` (cancel the turn).

## Providers

Model references are `provider/model`; the matching key must be exported:

| Provider | Example ref | Key |
|---|---|---|
| Anthropic (default) | `claude-opus-4-8` or `anthropic/claude-opus-4-8` | `ANTHROPIC_API_KEY` |
| OpenAI | `openai/gpt-5.2` | `OPENAI_API_KEY` |

## Configuration

Settings merge from `~/.minerva/settings.json` (global; override the root with
`MINERVA_DATA_DIR`) and `<project>/.minerva/settings.json` (project). Example:

```json
{
"defaultMode": "default",
"permissions": {
"allow": ["bash(git status)", "bash(bun test*)"],
"deny": ["read_file(secrets/*)", "bash(rm -rf *)"],
"ask": ["bash(git push*)"]
},
"mcpServers": {
"calc": { "command": "bun", "args": ["run", "./tools/mcp-calc.ts"] }
}
}
```

Permission rules are `tool` or `tool(pattern)` where `*` matches any run of
characters, `?` one character, and `\*` a literal asterisk. Precedence:
**deny** → **ask** → read-only auto-allow → **plan mode deny** → **allow** →
mode default. Rules match the bash command string or the file path; MCP tools
are named `mcp__<server>__<tool>` and are never auto-allowed.

Every session is an append-only JSONL event log under
`~/.minerva/projects/<project>/` — the audit trail and the source of truth for
`--resume`.

## Editors (ACP)

`minerva acp` hosts the kernel on stdio with ACP framing. For Zed, add an
agent server along these lines:

```json
{
"agent_servers": {
"Minerva": {
"command": "bun",
"args": ["run", "/path/to/minerva/packages/cli/src/index.tsx", "acp"]
}
}
}
```

The stdio wire contract is covered by an automated harness
(`packages/cli/test/acp.test.ts`); live Zed interop has not been validated yet.

## Development

```sh
bun run verify # typecheck + lint + all tests
bun test packages/kernel
```

The repo is a Bun workspace: `packages/protocol` (JSON-RPC + ACP types +
transports), `packages/kernel` (agent loop, sessions, tools, permissions,
MCP), `packages/providers` (model adapters), `packages/client` (shared
frontend core), `packages/cli` (Ink UI + acp host), `apps/gui` (planned).

## Release build

```sh
bun run build:release # dist/minerva, single-file executable
```

Cross-compile with `--target` (e.g. `bun-linux-x64`, `bun-windows-x64`).

> **Known issue (macOS arm64):** with Bun 1.3.12 the compiled binary comes out
> unsigned; the kernel kills unsigned arm64 binaries (SIGKILL on launch) and
> `codesign` rejects the file format for re-signing. Until this is resolved
> (try a newer Bun), run the CLI via `bun run packages/cli/src/index.tsx`.
25 changes: 25 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"files": {
"ignoreUnknown": true,
"includes": ["**", "!**/node_modules", "!**/dist"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"preset": "recommended",
"suspicious": {
"noExplicitAny": "warn"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
}
Loading