1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# agent686
A small coding agent for a 32-bit Debian box: one binary, six tools, line mode.
Built because the existing harnesses are TypeScript bundles that need a modern
CPU, and the target here is a Debian 12 i386 machine with 2 cores and 4 GB.
```
3.5 MiB ELF 32-bit LSB pie, Intel i386
GLIBC_2.34 required (target has 2.36)
startup ~0.8 ms
```
## Build
```sh
cargo build --release --target i686-unknown-linux-gnu
./scripts/check-glibc.sh target/i686-unknown-linux-gnu/release/agent686
```
The gate matters: the dev host's 32-bit glibc is newer than the target's, so a
dependency can silently raise the required symbol version.
## Run
```sh
export OPENCODE_API_KEY=... # or write it to ~/.config/agent686/key
./agent686 "make a calculator in C" # one turn, then exit
./agent686 # interactive
./agent686 -c # continue the most recent session
./agent686 --session <id> # resume it, or create it if the id is new
./agent686 --list # id, model, message count, age
./agent686 --show [id] # render a transcript
./agent686 --doctor # key, dirs, provider, model
./agent686 --yolo "..." # approve every tool call
```
Provider is OpenCode Go, `chat/completions`, model `deepseek-v4.1-flash` by
default. Every request carries a stable `x-opencode-session` header, which the
service uses for routing and prompt caching.
In a terminal: up/down walks history, bracketed paste arrives as one block
(multi-line is fine), ctrl-c abandons the line, ctrl-d exits.
Rate limits and transient failures retry with backoff (four attempts, `Retry-After`
honoured); a 429 that survives them explains itself instead of dumping JSON.
## Tools
`read` (numbered lines, streamed, regular files only), `write` (atomic, never
creates directories), `edit` (exact match that must be unique; CRLF files
supported), `bash` (fresh shell per call, own process group, 120 s timeout,
64 MiB output limit), `grep` (regular expression; `fixed: true` for literals),
`glob` (`*`, `?`, `**`, follows file symlinks).
Reads never prompt. The first `write`/`edit` of a session shows a diff and asks;
answering `a` allows the rest of the process. Every `bash` call asks, because
that is where `rm -rf` lives. `--yolo` skips both, and is refused in `$HOME` and
`/` unless `AGENT686_ALLOW_HOME=1`.
## Tests
```sh
cargo test # 75 tests, no network
python3 scripts/mock-provider.py & # canned SSE provider
docker run --rm --platform linux/386 \
-v "$PWD/target/i686-unknown-linux-gnu/release:/b:ro" debian:12 /b/agent686 --version
```
`tests/sse.rs` feeds the stream one byte at a time, so splits inside lines and
inside UTF-8 characters are covered. `tests/loop.rs` proves a tool call is
executed, recorded, and that a denial is returned to the model as data.
## Versioning
MAJOR for API-breaking changes, MINOR for features that do not break the
interface, PATCH for bug fixes. The interface is the CLI flags, the session file
format, the config file, and the tool schemas.
While the major version is 0, interface changes ride on MINOR and are called out
explicitly, because there is no stability promise to break yet. The `grep`
change in 0.4.0 (literal to regex) is the example. See
[CHANGELOG.md](CHANGELOG.md) and [docs/KNOWN-ISSUES.md](docs/KNOWN-ISSUES.md).
## Design notes
- [CONTEXT.md](CONTEXT.md) — what the words mean (session, turn, step, approval).
- [docs/PLAN.md](docs/PLAN.md) — decisions, non-goals, milestones, acceptance test.
- [docs/adr/0001](docs/adr/0001-dynamic-glibc-i686.md) — why dynamic glibc, not
a static binary: static glibc plus NSS modules segfaults on DNS.
- [docs/adr/0002](docs/adr/0002-append-only-sessions.md) — why history is never
rewritten: cached prompt reads are ~50× cheaper, and they require a
byte-identical prefix.
No async runtime, no full-screen TUI, no MCP, no subagents, no compaction. Those
are choices, not gaps: see the non-goals.
|