atom-agent 0.3.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 — 2026-09-08
4
+
5
+ - Agentic loop: 30-step budget (`ATOM_MAX_TOOL_STEPS`), todo-completion
6
+ guard, verification gate, goal pinning against truncation
7
+ - Permissions: normal/yolo modes, session trust (`/trust`), scoped
8
+ allow/deny rules (`/allow`, `/deny`, `/rules`), read-only plan mode
9
+ (`/plan`)
10
+ - Safety: automatic file snapshots with `/rewind` (files / conversation /
11
+ both), stale-read guard on edits
12
+ - Context: history budgets, auto/manual compaction, per-turn environment
13
+ block, session save/resume
14
+ - Providers: 7 adapters (opencode-zen, openai, anthropic, deepseek, mistral,
15
+ google-gemini, openai-compatible); default model `deepseek-v4-pro`
16
+ - Tools: 13 local executors incl. background bash, web search/fetch,
17
+ session todo list with live TUI panel
18
+ - Docs: full user manual in `documentation/`, minimal `AGENTS.md`
19
+ project instructions
20
+
21
+ ## 0.2.0
22
+
23
+ - Agentic harness parity: tools, todos, Esc-stop, thinking UI, packaging
24
+
25
+ ## 0.1.0
26
+
27
+ - Early experiment: agentic TUI chatbot on OpenCode Zen
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 beast-ofcourse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # ⚛ Atom — a minimal AI coding agent for your terminal
2
+
3
+ [![npm version](https://img.shields.io/npm/v/atom-agent.svg)](https://www.npmjs.com/package/atom-agent)
4
+ [![license](https://img.shields.io/npm/l/atom-agent.svg)](LICENSE)
5
+
6
+ ```
7
+ █████╗ ████████╗ ██████╗ ███╗ ███╗
8
+ ██╔══██╗╚══██╔══╝██╔═══██╗████╗ ████║
9
+ ███████║ ██║ ██║ ██║██╔████╔██║
10
+ ██╔══██║ ██║ ██║ ██║██║╚██╔╝██║
11
+ ██║ ██║ ██║ ╚██████╔╝██║ ╚═╝ ██║
12
+ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
13
+ ```
14
+
15
+ Atom is a small, fast, **agentic** terminal chatbot: it doesn't just answer —
16
+ it runs an **observe → act → inspect → adjust** loop with **13 real,
17
+ locally-executed tools** (files, shell, web), streaming output, and an
18
+ interactive Ink TUI. Powered by [OpenCode Zen](https://opencode.ai/docs/zen)
19
+ as the model provider. Zero ceremony: one key, one command, you're chatting
20
+ with an agent that can read your code, edit it, run it, and search the web.
21
+
22
+ ## Documentation
23
+
24
+ Full docs live in [`documentation/`](documentation/index.md), same layout as opencode and claude code guides. Start here, then go deep:
25
+
26
+ - [Getting Started](documentation/getting-started.md) — install, key setup, first run
27
+ - [CLI and TUI](documentation/cli.md) — slash commands, keyboard, status line
28
+ - [Tools](documentation/tools.md) — the 13 local executors, caps, background tasks
29
+ - [Providers and Models](documentation/providers.md) — 7 providers, endpoints, key resolution
30
+ - [Permissions and Modes](documentation/permissions.md) — normal/yolo, trust, allow/deny rules
31
+ - [Skills](documentation/skills.md) — discovery, frontmatter contract, auto-invoke
32
+ - [Sessions](documentation/sessions.md) — persistence, resume, clear, rewind
33
+ - [Compaction and Token Display](documentation/compaction.md) — auto-compact, manual compact, footer format
34
+ - [Configuration](documentation/configuration.md) — env vars, auth file, AGENTS.md layering
35
+ - [Development](documentation/development.md) — scripts, structure, tests, build
36
+ - [Troubleshooting](documentation/troubleshooting.md) — auth, models, approvals, TUI fixes
37
+
38
+ ## Quickstart
39
+
40
+ Install the published-style package (global install gives you the `atom`
41
+ binary):
42
+
43
+ ```bash
44
+ npm i -g atom-agent
45
+ atom
46
+ ```
47
+
48
+ Or run from source:
49
+
50
+ ```bash
51
+ npm install
52
+ ```
53
+
54
+ Get a key at [opencode.ai/auth](https://opencode.ai/auth), then:
55
+
56
+ ```powershell
57
+ $env:OPENCODE_ZEN_API_KEY="sk-your-key"
58
+ npm start
59
+ ```
60
+
61
+ That's it. Type `/` to see every command. Full command reference: [CLI and TUI](documentation/cli.md).
62
+
63
+ ## What Atom can do
64
+
65
+ - 🤖 **Agentic loop** — tool calls execute locally and results feed back in,
66
+ up to 30 steps per turn (`ATOM_MAX_TOOL_STEPS`, clamped 5–100), with retries on transient failures
67
+ - ⚡ **Streaming** — tokens, tool activity, and phase status render live;
68
+ reasoning streams in its own dim block above the answer draft
69
+ (transient); `Esc` stops a running response (footer shows `esc stops`
70
+ while busy)
71
+ - 🧰 **13 tools** — `read`, `write`, `edit`, `grep`, `glob`, `bash`,
72
+ `bash_output`, `websearch`, `webfetch`, `ask_question` (asks *you* things
73
+ interactively), `todowrite` / `todo_get` / `todo_update` (session task
74
+ checklist with a live TUI panel)
75
+ - 🛡️ **Normal / YOLO modes** — `Tab` toggles. Normal auto-runs reads but
76
+ asks before writes/shell (`y` once · `a` always · `t` trust all · `n` deny);
77
+ `/trust` toggles a session trust tier (one approval covers the whole task,
78
+ status shows `+trust`, never saved). YOLO never asks
79
+ - 🗺️ **Plan mode** — `/plan` enters a read-only mode for risky work:
80
+ exploration (`read`/`grep`/`glob`/web/todos/`ask_question`) runs free while
81
+ `write`/`edit`/`bash` are blocked pre-execution with a replan note (never a
82
+ prompt). `Tab` never enters/exits plan, `/yolo`·`/trust` can't punch through
83
+ it, `/deny` still wins. Exiting `/plan` approves the recorded todo checklist
84
+ into implementation (lands in normal, never yolo)
85
+ - ⌨️ **Slash commands** — `/model` (interactive model picker), `/provider`
86
+ (provider + key picker, keys in `~/.atom/auth.json`), `/effort`
87
+ (reasoning-effort picker), `/tools`, `/help`, `/mode`, `/yolo`, `/trust`, `/plan`, `/clear`,
88
+ `/exit` — plus `/`-autocomplete as you type
89
+ - 📊 **Status line** — provider · model · session token usage (`token:
90
+ (P%) NK`: NK is the cumulative spend in K, P% is the current context load
91
+ over the model's verified window — last `prompt_tokens`, else the
92
+ 4ch/token estimate; bare `token: NK` where no window is verified,
93
+ `token: n/a` until reported — never estimated) · reasoning · mode, plus
94
+ live phase/elapsed/waiting while busy. It is the sole info bar: there is
95
+ no persistent header, only the launch-time banner art.
96
+ - 🗜️ **Context compaction** — auto-compacts at ~83% of the verified window
97
+ (`ATOM_COMPACT_PCT` percent, 50–95) plus manual `/compact [focus text]`
98
+ (structured summary, tools disabled, newest tail kept, thrash guard).
99
+ - 📖 **AGENTS.md-aware** — Atom loads your project's `AGENTS.md` into its
100
+ system prompt, so it knows your tools, rules, and permission model
101
+ - 🔓 **No path sandbox** — file tools read/write anywhere on the computer
102
+ (absolute paths and `..` escapes allowed, including sensitive locations
103
+ like `~/.ssh/` — treat contents as untrusted, never exfiltrate or commit
104
+ secrets); the permission mode is the control plane. Everything is capped
105
+ and truncated
106
+
107
+ ## Tools
108
+
109
+ Full reference: [Tools](documentation/tools.md) plus [Permissions and Modes](documentation/permissions.md).
110
+
111
+ | Tool | What it does | Permission (normal mode) |
112
+ |---|---|---|
113
+ | `read` | Read files / list directories | auto |
114
+ | `grep` / `glob` | Search contents / find files | auto |
115
+ | `websearch` | Keyless web search (discovery) | auto |
116
+ | `webfetch` | Fetch pages as markdown/text/html (retrieval) | auto |
117
+ | `write` / `edit` | Create / exact-match-patch files | asks |
118
+ | `bash` | Shell commands (cwd, timeout, truncated) | asks |
119
+ | `bash_output` | Poll a background shell task | auto |
120
+ | `todowrite` / `todo_get` / `todo_update` | Session task checklist (live panel) | auto |
121
+ | `ask_question` | Interactive picker for clarifications | n/a (is interaction) |
122
+
123
+ ### Scoped permission rules
124
+
125
+ Beyond all-or-nothing trust: `/allow <tool[:glob]>` pre-approves matching
126
+ `write`/`edit`/`bash` calls for the session (no prompt — e.g. `/allow
127
+ bash:npm test*`, `/allow write:src/**`; bare `/allow bash` matches any args),
128
+ and `/deny <tool[:glob]>` refuses matching calls before execution (the model
129
+ sees the standard denial result and replans). **Deny wins over `/trust`,
130
+ yolo, `[a]lways`, and skill grants.** `/rules` lists the session rules,
131
+ `/rules clear` wipes them. Rules are in-memory only (like `/trust`, never
132
+ saved); globs use `*` (any sequence) and `?` (one char), matched against the
133
+ tool's primary string (command for `bash`, path for `write`/`edit` — the same
134
+ primary shown in the `⚙` audit line, which still renders for every
135
+ auto-approved call).
136
+
137
+ ## Models & provider
138
+
139
+ Full reference: [Providers and Models](documentation/providers.md) plus [Configuration](documentation/configuration.md).
140
+
141
+ Atom talks to 7 providers behind one UI (opencode `/connect` mirror,
142
+ manual-key only — no OAuth). Pick with `/provider`, paste a key once
143
+ (validated, stored in `~/.atom/auth.json`, `0600` on POSIX), chat.
144
+ Switching provider keeps session history text; system prompt stays.
145
+ `/model` lists the active provider's live models (curated fallback on any
146
+ failure). `/effort` sends `reasoning_effort` only for opencode-zen
147
+ supported models; elsewhere kept but never sent.
148
+
149
+ ### Model-choice policy
150
+
151
+ The zen default is `deepseek-v4-pro` — picked from the live `/models` list
152
+ for reliable multi-step tool use (tool calls + reasoning effort supported).
153
+ Free models (`big-pickle`, `mimo-v2.5-free`, …) stay selectable via `/model`
154
+ for quick single-turn questions. Override any time with `/model` or
155
+ `OPENCODE_ZEN_MODEL`.
156
+
157
+ | Provider | Key env (wins over stored) | Endpoint | Notes |
158
+ |---|---|---|---|
159
+ | opencode-zen | `OPENCODE_ZEN_API_KEY` | `https://opencode.ai/zen/v1/chat/completions` | OpenAI-compatible chat/completions default; key at https://opencode.ai/auth |
160
+ | openai | `OPENAI_API_KEY` | `https://api.openai.com/v1/chat/completions` | OpenAI-compatible; key at https://platform.openai.com/api-keys |
161
+ | anthropic | `ANTHROPIC_API_KEY` | `https://api.anthropic.com/v1/messages` | Messages API (`x-api-key` + `anthropic-version: 2023-06-01`, `max_tokens` 4096); key at https://console.anthropic.com/settings/keys |
162
+ | deepseek | `DEEPSEEK_API_KEY` | `https://api.deepseek.com/chat/completions` | OpenAI-compatible (no `/v1` prefix); key at https://platform.deepseek.com/api_keys |
163
+ | mistral | `MISTRAL_API_KEY` | `https://api.mistral.ai/v1/chat/completions` | OpenAI-compatible; key at https://console.mistral.ai/api-keys |
164
+ | google-gemini | `GEMINI_API_KEY` (alias `GOOGLE_API_KEY`) | `https://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent?alt=sse` (`:generateContent` fallback) | `x-goog-api-key`; key at https://aistudio.google.com/apikey |
165
+ | openai-compatible | stored key only | stored baseURL (`/chat/completions` appended iff missing) | additionally prompts baseURL (must be http(s)); live `/models` authoritative |
166
+
167
+ Keys: never printed full (masked `…last4`), never logged, never in fixtures (tests use `"test-key"`).
168
+
169
+ ## Develop
170
+
171
+ Full guide: [Development](documentation/development.md). Fixes start at [Troubleshooting](documentation/troubleshooting.md).
172
+
173
+ ```bash
174
+ npm start # run the TUI from source (needs a TTY)
175
+ npm test # vitest suite (fully mocked — never hits live APIs)
176
+ npm run typecheck
177
+ npm run build # emit dist/ (the `atom` binary entry is dist/cli.js)
178
+ ```
179
+
180
+ Env knobs: `OPENCODE_ZEN_API_KEY` (or stored zen key via `/provider`), `OPENCODE_ZEN_MODEL`,
181
+ `OPENCODE_ZEN_ENDPOINT`, `OPENCODE_AGENTS_PATH`, `ATOM_COMPACT_PCT` (auto-compact percent, 50–95),
182
+ `ATOM_MAX_TOOL_STEPS` (tool rounds per turn, default 30, clamped 5–100),
183
+ plus per-provider key env vars above.
184
+ `~/.atom/auth.json` holds pasted keys (`{version:1, providers:{"<id>":{apiKey, baseURL?}}}`, `0600` POSIX).
185
+
186
+ ```
187
+ .
188
+ ├── src/
189
+ │ ├── cli.tsx # entry: --help, always starts TUI (missing key guides to /provider)
190
+ │ ├── App.tsx # Ink TUI: transcript, pickers, modes (/plan /trust), approvals, status line
191
+ │ ├── zen.ts # agentic loop (budgets, todo/verification guards) + provider dispatch + SSE
192
+ │ ├── tools.ts # 13 local tool executors + function schemas (read/write/edit/grep/glob/bash/…)
193
+ │ ├── permissions.ts # allow/deny rule matcher backing /allow /deny /rules
194
+ │ ├── snapshots.ts # pre-mutation file snapshots backing /rewind
195
+ │ ├── skills.ts # skill discovery backing /skills
196
+ │ ├── env-block.ts # per-turn cwd/git/node environment block
197
+ │ ├── providers.ts # 7-provider registry (kind/endpoint/env/default + fallback models)
198
+ │ ├── auth.ts # ~/.atom/auth.json store (env wins, 0600 POSIX)
199
+ │ ├── adapters.ts # anthropic/gemini translation + SSE + models-list parsing + key validation
200
+ │ ├── compact.ts # context compaction: load/trigger math, split, summary POST (tools off)
201
+ │ ├── session.ts # session save/resume
202
+ │ ├── context-windows.ts # curated per-model context windows + `token: (P%) NK` format
203
+ │ └── system.ts # base system prompt (long-horizon operating contract)
204
+ ├── dist/ # `npm run build` output (`atom` runs dist/cli.js; gitignored, shipped in the tarball)
205
+ ├── tests/ # fully mocked (never live APIs; keys use "test-key")
206
+ ├── documentation/ # user manual (getting started → troubleshooting)
207
+ ├── AGENTS.md # agent instructions overlay (loaded at startup, minimal)
208
+ ├── tsconfig.build.json # build-only config (src -> dist)
209
+ └── .env.example # env template (never commit a real key)
210
+ ```
211
+
212
+ ## License
213
+
214
+ MIT — see [LICENSE](LICENSE).