diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-15 03:11:22 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-15 03:11:22 +0100 |
| commit | 343f2a8a6148b8004d6f4d74fb779b4f30c9686a (patch) | |
| tree | 2ea1ddab346565309da644517c3478d2a9096e55 /docs/PLAN.md | |
| parent | M0: streaming provider, SSE decoder, mock provider, i686 build gate (diff) | |
| download | agent686-343f2a8a6148b8004d6f4d74fb779b4f30c9686a.tar.gz agent686-343f2a8a6148b8004d6f4d74fb779b4f30c9686a.zip | |
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
Diffstat (limited to 'docs/PLAN.md')
| -rw-r--r-- | docs/PLAN.md | 71 |
1 files changed, 46 insertions, 25 deletions
diff --git a/docs/PLAN.md b/docs/PLAN.md index 2766664..b1273b1 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md | |||
| @@ -73,37 +73,58 @@ Verified: `cargo test` 8/8; 2.0 MB stripped i686 binary, max symbol | |||
| 73 | streams correctly; `scripts/check-glibc.sh` passes and fails as expected; | 73 | streams correctly; `scripts/check-glibc.sh` passes and fails as expected; |
| 74 | `scripts/mock-provider.py` gives a no-key provider for manual work. | 74 | `scripts/mock-provider.py` gives a no-key provider for manual work. |
| 75 | 75 | ||
| 76 | **M1 — Sessions, status line, abort.** JSONL append/load, session id, `--continue`, | 76 | **M1 — Sessions, status line, abort.** ✅ Done. |
| 77 | `--resume <id>`, status line, SIGINT handling. | 77 | |
| 78 | *Done when:* a turn survives `kill -9` between steps, `--continue` resumes it, and | 78 | JSONL append/load, session id, `--continue`, `--session <id>`, status line, |
| 79 | Ctrl-C returns the prompt without losing the transcript. | 79 | SIGINT handling (first Ctrl-C aborts the turn, second exits). Verified: a |
| 80 | 80 | 9-step turn writes 19 lines (header + 18 messages, reasoning stored under | |
| 81 | **M2 — Read-side tools and edits.** `read`, `write`, `edit`, `grep`, `glob`, the | 81 | `_reasoning`), `--continue` replays all 18 messages and answers from history |
| 82 | agent loop, tool-call accumulation, the approval prompt with diff. | 82 | without reading files. |
| 83 | *Done when:* a canned mock session writes a C file, greps it, edits it, and the | 83 | |
| 84 | transcript replays byte-identically. | 84 | **M2 — Read-side tools and edits.** ✅ Done. |
| 85 | 85 | ||
| 86 | **M3 — `bash`.** Command execution, timeout, output capping, per-call approval, | 86 | `read`, `write`, `edit`, `grep`, `glob`, the agent loop, tool-call accumulation, |
| 87 | head/tail rendering. | 87 | diff preview plus approval. Verified by `tests/tools.rs` (uniqueness, ambiguity |
| 88 | *Done when:* the mock session compiles the C file and handles a non-zero exit as | 88 | with line numbers, no implicit `mkdir`, truncation, glob `**`, grep case) and |
| 89 | data rather than an error. | 89 | `tests/loop.rs` (tool call executed and recorded; a denial returned as data). |
| 90 | 90 | The approval prompt was also driven through a real pty. | |
| 91 | **M4 — Prompt and input.** System prompt, environment block, `AGENTS.md` | 91 | |
| 92 | snapshot, `/paste`, TTY detection, real-API smoke test. | 92 | **M3 — `bash`.** ✅ Done. |
| 93 | *Done when:* one real turn against OpenCode Go works end to end. | 93 | |
| 94 | 94 | Fresh shell per call, 120 s timeout that kills the process, capped output | |
| 95 | **M5 — Target gate.** `scripts/check-glibc.sh` (max symbol version ≤ 2.36), | 95 | (64 KiB head, 16 KiB tail), exit code or signal reported. Verified: exit codes, |
| 96 | `cargo check --target i686` clean, release run inside | 96 | timeout, missing `cwd`, and real `gcc` invocations. |
| 97 | `docker run --platform linux/386 debian:12`, binary copied to the i386 box. | 97 | |
| 98 | *Done when:* the acceptance test runs there. | 98 | **M4 — Prompt and input.** ✅ Done. |
| 99 | |||
| 100 | System prompt with cwd/platform/arch/branch, `AGENTS.md` snapshot frozen at | ||
| 101 | session start with a change warning, `/paste`, TTY-aware colour. Verified | ||
| 102 | against the live API: streaming, tool calls, `reasoning_content`, usage and | ||
| 103 | `opencode.allowance` in the final chunk, and a 401 surfaced as | ||
| 104 | `api_key_expired`. | ||
| 105 | |||
| 106 | **M5 — Target gate.** ✅ Done. | ||
| 107 | |||
| 108 | `scripts/check-glibc.sh` (required symbols ≤ 2.36; weak symbols such as glibc | ||
| 109 | 2.39's `pidfd_spawnp` are reported but ignored, since they resolve to NULL). | ||
| 110 | 2.0 MB stripped i686 binary, `GLIBC_2.34` required. Verified by running the | ||
| 111 | whole acceptance test inside `--platform linux/386 debian:12`. | ||
| 99 | 112 | ||
| 100 | ## Acceptance test (v1) | 113 | ## Acceptance test (v1) |
| 101 | 114 | ||
| 102 | > "Make a simple calculator in C" — run on the i386 box, from an empty directory. | 115 | > "Make a simple calculator in C" — run on the i386 box, from an empty directory. |
| 103 | 116 | ||
| 104 | Exercises `write` (create files), `bash` (compile, run), `read` (inspect what it | 117 | Exercises `write` (create files), `bash` (compile, run), `read` (inspect what it |
| 105 | wrote), and terminates on its own. Success is: it compiles, it runs, it does | 118 | wrote), and terminates on its own. |
| 106 | addition and division, and it did not need more than a handful of files. | 119 | |
| 120 | Two runs, both with `--yolo`: | ||
| 121 | |||
| 122 | | Where | Steps | Wall | Allowance | Result | | ||
| 123 | |---|---|---|---|---| | ||
| 124 | | x86-64 dev host | 9 | 55.7 s | $0.000214 | `calc.c` (115 lines), clean `-Wall -Wextra` build, 18 cases tested | | ||
| 125 | | `linux/386 debian:12` | 8 | 32.1 s | $0.000182 | `calc.c` + `Makefile`, `3 + 4 = 7`, `7 / 2 = 3.5`, `5 / 0` → error, exit 1 | | ||
| 126 | |||
| 127 | Independently rebuilt and re-run outside the agent both times. | ||
| 107 | 128 | ||
| 108 | ## Layout | 129 | ## Layout |
| 109 | 130 | ||
