mini-coder 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/mc.js +648 -682
- package/docs/KNOWN_ISSUES.md +1 -0
- package/docs/design-decisions.md +2 -45
- package/docs/mini-coder.1.md +3 -8
- package/docs/superpowers/plans/2026-03-30-anthropic-oauth-removal.md +61 -0
- package/docs/superpowers/specs/2026-03-30-anthropic-oauth-removal-design.md +47 -0
- package/package.json +1 -1
package/docs/KNOWN_ISSUES.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- AI SDK expands `claude-3-5-haiku` → dated variant that Zen doesn't serve (404).
|
|
6
6
|
- Shell tool: model can `tmux kill-session` the host tmux session if names collide (e.g. audit skill creates session named "audit" matching the user's). Not a code bug — the skill/model just picks a conflicting name. Mitigate via skill wording or session name prefixing.
|
|
7
|
+
- Shell tool output truncation only stops reading stdout/stderr; it does not terminate the underlying process yet. Commands that emit a lot of output and then keep running can still block until they exit or hit timeout.
|
|
7
8
|
|
|
8
9
|
## Features
|
|
9
10
|
|
package/docs/design-decisions.md
CHANGED
|
@@ -1,49 +1,6 @@
|
|
|
1
1
|
# Design Decisions
|
|
2
2
|
|
|
3
|
-
Documenting why mini-coder makes certain architectural choices — especially where we intentionally diverge from
|
|
4
|
-
|
|
5
|
-
## Why not ToolLoopAgent?
|
|
6
|
-
|
|
7
|
-
**Decision:** Use `streamText` directly instead of the AI SDK's `ToolLoopAgent`.
|
|
8
|
-
|
|
9
|
-
`ToolLoopAgent` is a convenience wrapper that manages the tool-call loop, context, and stopping conditions. Mini-coder needs explicit control over every aspect it abstracts away:
|
|
10
|
-
|
|
11
|
-
- **Streaming event rendering** — We yield granular `TurnEvent`s (text deltas, tool calls, tool results, reasoning, context-pruned notifications) as they arrive from `fullStream`. The reporter renders them append-only into the terminal in real time. `ToolLoopAgent` gives you the final result; we need the firehose.
|
|
12
|
-
- **ESC interrupt mid-turn** — An `AbortController` is wired through to `streamText`'s `signal`. On ESC, we abort, preserve partial messages, and append an interrupt stub so the LLM retains context. `ToolLoopAgent` doesn't expose this kind of mid-stream abort-and-preserve behavior.
|
|
13
|
-
- **Custom context pruning** — After every turn, `SessionRunner` runs `applyContextPruning` + `compactToolResultPayloads` on the in-memory history. This is rolling, per-turn pruning that must not break prompt caching. `ToolLoopAgent`'s built-in context management doesn't match these constraints.
|
|
14
|
-
- **Per-step DB persistence** — Each turn's messages are saved to SQLite with a turn index as they complete. The in-memory `coreHistory` diverges from the DB history (pruned vs. full). `ToolLoopAgent` has no hook for this.
|
|
15
|
-
- **Provider-specific caching annotations** — `annotateToolCaching` adds caching metadata to the tool set based on the model string, injected directly into the `streamText` call.
|
|
16
|
-
- **No step/tool-call limits** — Per the design: "No max steps or tool call limits — user can interrupt." `ToolLoopAgent` defaults to `stopWhen: stepCountIs(20)`.
|
|
17
|
-
|
|
18
|
-
**Summary:** `ToolLoopAgent` reduces boilerplate for simple request→response agents. Mini-coder is a shell-first coding agent where the loop _is_ the product. Using `ToolLoopAgent` would mean fighting the abstraction at every turn.
|
|
19
|
-
|
|
20
|
-
## Why no cross-session memory?
|
|
21
|
-
|
|
22
|
-
**Decision:** No agent-managed persistent memory across sessions. The repo and user-authored config files are the memory.
|
|
23
|
-
|
|
24
|
-
The AI SDK offers several memory approaches (Anthropic memory tool, Mem0, Letta, custom tools) that let agents save facts and recall them in future conversations. We intentionally don't use any of these.
|
|
25
|
-
|
|
26
|
-
### What we have instead
|
|
27
|
-
|
|
28
|
-
- **Within-session persistence** — Full message history saved to SQLite per-turn, sessions resumable via `/session`.
|
|
29
|
-
- **Context pruning** — `applyContextPruning` and `applyStepPruning` strip old reasoning/tool-calls to fit context windows without breaking prompt caching.
|
|
30
|
-
- **Static cross-session context** — `AGENTS.md`/`CLAUDE.md` files loaded into the system prompt. This is user-curated project knowledge, not agent-managed memory.
|
|
31
|
-
- **Skills** — Reusable instruction sets discoverable via `/` autocomplete.
|
|
32
|
-
|
|
33
|
-
### Why not agent-written memory?
|
|
34
|
-
|
|
35
|
-
We considered having the agent write to `~/.agents/AGENTS.md` for cross-session recall. Rejected because:
|
|
36
|
-
|
|
37
|
-
- **Intrusive** — `~/.agents/` is the user's space. Agent writes would mix generated noise with intentional configuration, creating surprises ("where did this line come from?").
|
|
38
|
-
- **Violates conventions** — `AGENTS.md`/`CLAUDE.md` are community standards meant to be human-authored instructions _to_ the agent, not an agent scratchpad. Using them as memory inverts the relationship.
|
|
39
|
-
- **Safety conflict** — Our own system prompt requires confirmation before irreversible actions. Silently modifying a user's global config violates that principle.
|
|
40
|
-
- **Complexity** — Memory adds storage, retrieval, relevance ranking, and non-determinism. The design philosophy is performance first, minimal setup.
|
|
41
|
-
|
|
42
|
-
### If we ever want this
|
|
43
|
-
|
|
44
|
-
A dedicated `~/.config/mini-coder/memories.md` that's clearly agent-owned and separate from user config would be the right path — not overloading existing community standards.
|
|
45
|
-
|
|
46
|
-
**Summary:** For a coding agent that operates on a repo, the repo _is_ the memory. Users who want cross-session context write it in `AGENTS.md` themselves — that's an intentional act, not an LLM side effect.
|
|
3
|
+
Documenting why mini-coder makes certain architectural choices — especially where we intentionally diverge from common patterns.
|
|
47
4
|
|
|
48
5
|
## Why no tool-call permissions?
|
|
49
6
|
|
|
@@ -63,7 +20,7 @@ A coding agent runs dozens of shell commands per task. Requiring approval for ea
|
|
|
63
20
|
|
|
64
21
|
### Isolation is a separate concern
|
|
65
22
|
|
|
66
|
-
Sandboxing is a real need, but it belongs at the OS/container level — not inside the agent. Tools like [nono](https://nono.sh/) provide proper filesystem and network isolation that the LLM cannot circumvent. This is defense in depth done right: the agent runs unrestricted inside a sandbox that enforces actual boundaries.
|
|
23
|
+
Sandboxing is a real need, but it belongs at the OS/container level — not inside the agent. Tools like [Anthropic Sandbox Runtime (`srt`)](https://github.com/anthropic-experimental/sandbox-runtime) and [nono](https://nono.sh/) provide proper filesystem and network isolation that the LLM cannot circumvent. This is defense in depth done right: the agent runs unrestricted inside a sandbox that enforces actual boundaries.
|
|
67
24
|
|
|
68
25
|
### Our approach
|
|
69
26
|
|
package/docs/mini-coder.1.md
CHANGED
|
@@ -73,14 +73,11 @@ _prompt_
|
|
|
73
73
|
`/mcp remove` _name_
|
|
74
74
|
: Remove MCP server.
|
|
75
75
|
|
|
76
|
-
`/review`
|
|
77
|
-
: Review recent changes (global skill, auto-created at first run).
|
|
78
|
-
|
|
79
76
|
`/login`
|
|
80
77
|
: Show OAuth login status.
|
|
81
78
|
|
|
82
79
|
`/login` _provider_
|
|
83
|
-
: Login via OAuth (opens browser for device flow). Currently supports `
|
|
80
|
+
: Login via OAuth (opens browser for device flow). Currently supports `openai`.
|
|
84
81
|
|
|
85
82
|
`/logout` _provider_
|
|
86
83
|
: Clear saved OAuth tokens.
|
|
@@ -169,15 +166,13 @@ Skills are reusable instruction files at `.agents/skills/<name>/SKILL.md`.
|
|
|
169
166
|
`description`
|
|
170
167
|
: Help text.
|
|
171
168
|
|
|
172
|
-
Skills are
|
|
169
|
+
Skills are auto discovered. To load explicitly:
|
|
173
170
|
|
|
174
171
|
- `/skill-name` in prompts (injects body as a user message).
|
|
175
172
|
- **listSkills** / **readSkill** tools at runtime.
|
|
176
173
|
|
|
177
174
|
Local discovery walks up from cwd to the git worktree root.
|
|
178
175
|
|
|
179
|
-
A default **review** skill is created at `~/.agents/skills/review/SKILL.md` on first run if it doesn't exist. It can be customized or shadowed locally.
|
|
180
|
-
|
|
181
176
|
## CONFIGURATION
|
|
182
177
|
|
|
183
178
|
Config roots: `.agents/`, `.claude/` — local (repo) or global (`~/`).
|
|
@@ -216,7 +211,7 @@ Config roots: `.agents/`, `.claude/` — local (repo) or global (`~/`).
|
|
|
216
211
|
## FILES
|
|
217
212
|
|
|
218
213
|
`~/.config/mini-coder/`
|
|
219
|
-
: App data directory (sessions.db,
|
|
214
|
+
: App data directory (sessions.db, with tables for error and other logs).
|
|
220
215
|
|
|
221
216
|
`.agents/` or `.claude/`
|
|
222
217
|
: Config directories for skills and context files.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Anthropic OAuth Removal Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** Remove Claude Code subscription OAuth support without affecting Anthropic API-key access or Zen Claude models.
|
|
6
|
+
|
|
7
|
+
**Architecture:** Delete the Anthropic OAuth provider registration and stop consulting Anthropic OAuth state in discovery/model-info paths. Preserve all direct `ANTHROPIC_API_KEY` behavior and Anthropic-family handling needed by Zen and direct API use.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Bun, TypeScript, bun:test, SQLite-backed auth storage, AI SDK providers.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### Task 1: Track the work and lock the user-facing contract
|
|
14
|
+
|
|
15
|
+
**Files:**
|
|
16
|
+
|
|
17
|
+
- Modify: `TODO.md`
|
|
18
|
+
- Reference: `docs/superpowers/specs/2026-03-30-anthropic-oauth-removal-design.md`
|
|
19
|
+
|
|
20
|
+
- [ ] **Step 1: Update TODO.md with active work item**
|
|
21
|
+
- [ ] **Step 2: Keep TODO.md current as tasks complete**
|
|
22
|
+
|
|
23
|
+
### Task 2: Write failing tests for Anthropic OAuth removal
|
|
24
|
+
|
|
25
|
+
**Files:**
|
|
26
|
+
|
|
27
|
+
- Modify: `src/llm-api/providers-resolve.test.ts`
|
|
28
|
+
- Modify: `src/llm-api/model-info.test.ts`
|
|
29
|
+
- Create: `src/session/oauth/auth-storage.test.ts`
|
|
30
|
+
|
|
31
|
+
- [ ] **Step 1: Add a test asserting OAuth providers list only OpenAI**
|
|
32
|
+
- [ ] **Step 2: Add tests asserting Anthropic discovery requires `ANTHROPIC_API_KEY`**
|
|
33
|
+
- [ ] **Step 3: Run focused tests to verify they fail for the expected reason**
|
|
34
|
+
|
|
35
|
+
### Task 3: Remove Anthropic OAuth registration and discovery usage
|
|
36
|
+
|
|
37
|
+
**Files:**
|
|
38
|
+
|
|
39
|
+
- Delete: `src/session/oauth/anthropic.ts`
|
|
40
|
+
- Modify: `src/session/oauth/auth-storage.ts`
|
|
41
|
+
- Modify: `src/llm-api/providers.ts`
|
|
42
|
+
- Modify: `src/llm-api/model-info.ts`
|
|
43
|
+
- Modify: `src/llm-api/model-info-fetch.ts`
|
|
44
|
+
|
|
45
|
+
- [ ] **Step 1: Remove the Anthropic OAuth provider from auth storage**
|
|
46
|
+
- [ ] **Step 2: Remove Anthropic OAuth-based provider discovery/autodiscovery**
|
|
47
|
+
- [ ] **Step 3: Remove Anthropic OAuth-based model list fetching**
|
|
48
|
+
- [ ] **Step 4: Run the focused tests and make them pass**
|
|
49
|
+
|
|
50
|
+
### Task 4: Update CLI/docs and finish verification
|
|
51
|
+
|
|
52
|
+
**Files:**
|
|
53
|
+
|
|
54
|
+
- Modify: `src/cli/commands-help.ts`
|
|
55
|
+
- Modify: `docs/mini-coder.1.md`
|
|
56
|
+
- Modify: `TODO.md`
|
|
57
|
+
|
|
58
|
+
- [ ] **Step 1: Remove Anthropic OAuth mentions from help/manpage**
|
|
59
|
+
- [ ] **Step 2: Run formatting if needed**
|
|
60
|
+
- [ ] **Step 3: Run focused tests, then broader verification commands**
|
|
61
|
+
- [ ] **Step 4: Clear the completed TODO item**
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Anthropic OAuth Removal Design
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Remove Claude Code subscription OAuth support from mini-coder while preserving:
|
|
6
|
+
|
|
7
|
+
- direct Anthropic API key support via `ANTHROPIC_API_KEY`
|
|
8
|
+
- Anthropic-family models served through Opencode Zen (`zen/claude-*`)
|
|
9
|
+
|
|
10
|
+
## Approved behavior
|
|
11
|
+
|
|
12
|
+
- `anthropic` is removed completely from the user-facing OAuth surface.
|
|
13
|
+
- `/login anthropic` is no longer supported and behaves like any unknown provider.
|
|
14
|
+
- `/logout anthropic` is no longer documented or advertised as a supported path.
|
|
15
|
+
- Existing saved Anthropic OAuth rows in SQLite are ignored; no migration or cleanup is required.
|
|
16
|
+
- Anthropic remains available through `ANTHROPIC_API_KEY`.
|
|
17
|
+
- Zen-backed Claude models remain available and unchanged.
|
|
18
|
+
|
|
19
|
+
## Approach
|
|
20
|
+
|
|
21
|
+
Use a narrow OAuth-only removal:
|
|
22
|
+
|
|
23
|
+
1. Remove the Anthropic OAuth provider module and provider registration.
|
|
24
|
+
2. Stop consulting Anthropic OAuth state during provider discovery and model-info refresh visibility.
|
|
25
|
+
3. Keep direct Anthropic provider resolution via `ANTHROPIC_API_KEY`.
|
|
26
|
+
4. Keep Anthropic-family request handling and Zen backend routing unchanged.
|
|
27
|
+
5. Update tests and docs to match the new OAuth surface.
|
|
28
|
+
|
|
29
|
+
## Files in scope
|
|
30
|
+
|
|
31
|
+
- `src/session/oauth/anthropic.ts` — delete
|
|
32
|
+
- `src/session/oauth/auth-storage.ts` — unregister Anthropic OAuth
|
|
33
|
+
- `src/llm-api/providers.ts` — stop treating Anthropic OAuth as connected
|
|
34
|
+
- `src/llm-api/model-info.ts` — stop treating Anthropic OAuth as a refresh/visibility source
|
|
35
|
+
- `src/llm-api/model-info-fetch.ts` — stop fetching Anthropic models via OAuth tokens
|
|
36
|
+
- `src/cli/commands-help.ts` — remove Anthropic OAuth example text
|
|
37
|
+
- `docs/mini-coder.1.md` — document OpenAI-only OAuth support
|
|
38
|
+
- tests around provider discovery/model info — update to be deterministic and Anthropic-OAuth-free
|
|
39
|
+
|
|
40
|
+
## Risks and mitigations
|
|
41
|
+
|
|
42
|
+
- Risk: accidentally breaking direct Anthropic API-key support.
|
|
43
|
+
- Mitigation: keep direct provider resolver and add/update tests that verify `ANTHROPIC_API_KEY` still wins.
|
|
44
|
+
- Risk: accidentally breaking Zen Claude behavior.
|
|
45
|
+
- Mitigation: avoid touching Anthropic-family routing/caching code used for Zen.
|
|
46
|
+
- Risk: stale Anthropic OAuth tokens still affecting behavior.
|
|
47
|
+
- Mitigation: remove all Anthropic OAuth checks from discovery and model fetching paths.
|