From 343f2a8a6148b8004d6f4d74fb779b4f30c9686a Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 15 Nov 2026 03:11:22 +0100 Subject: M1-M5: sessions, six tools, approvals, prompt, Ctrl-C, target gate - append-only JSONL sessions with --continue/--session; reasoning stored, stripped on replay - read/write/edit/grep/glob + bash with timeout and capped output - diff-preview approval for the first edit of a session, per-call approval for bash - system prompt frozen per session with AGENTS.md snapshot and change warning - SIGINT aborts the turn, second Ctrl-C exits - glibc gate ignores weak symbols; verified in linux/386 debian:12 - acceptance test (calculator in C) passes on both x86-64 and i386 --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..562058a --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +# 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. + +``` +2.0 MB ELF 32-bit LSB pie, Intel i386 +GLIBC_2.34 required (target has 2.36) +``` + +## 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, one prompt per line +./agent686 -c # continue the most recent session +./agent686 --session # resume a specific one +./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. + +## Tools + +`read` (numbered lines), `write` (never creates directories), `edit` (exact +match, must be unique), `bash` (fresh shell per call, 120 s timeout, capped +output), `grep` (literal, recursive), `glob` (`*`, `?`, `**`). + +Reads never prompt. The first `write`/`edit` of a session shows a diff and asks; +answering `a` allows the rest of the session. Every `bash` call asks, because +that is where `rm -rf` lives. + +## Tests + +```sh +cargo test # 19 tests, no network +python3 scripts/mock-provider.py & # canned SSE provider +docker run --rm --platform linux/386 debian:12 /b/agent686 # target-shaped gate +``` + +`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. + +## 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 TUI, no MCP, no subagents, no compaction. Those are +choices, not gaps: see the non-goals. -- cgit v1.2.3