README Source History Refs Reviews Compare Notes Search Review guide Plan the external-integration prototype campaign 8cb0ac690355e908b2f1aeb328a5aa7baf2e017d
Claude <noreply@anthropic.com > · 17 Jul 2026
SSH signature · not checked
Browse files Compare with HEAD
The internal architecture is now heavily prototype-proven; the thinnest
evidence is at the outer boundaries — real provider wire formats, tool
mutation semantics, OAuth, cross-platform builds, and the arch-gate tooling.
Campaign 7 ranks these by spec-impact × uncertainty so the next wave targets
the claims most likely to be wrong, not the easiest to test.
Two entries (cross-build, arch-gate) are marked tooling-gated: they need a
release/CI toolchain the local sandbox lacks, and are the reason to stand up
a CI prototype rather than keep asserting §14 and §11 on faith.
Recorded in prototypes/PLAN.md as Campaign 7 (P29–P33).
Changed files (1) Diff layout Auto Unified Split
prototypes/PLAN.md Modified +228 / −0 text lines
2015 2015 span, `session_tree` node), poll-only cost/context for v1. Spec issues: P2span, `session_tree` node), poll-only cost/context for v1. Spec issues: P22016 2016 session/snapshot, P2 payload guarantees, P3 cost/context push.session/snapshot, P2 payload guarantees, P3 cost/context push.
2018 + ## Campaign 7 — external integration surface 2020 + The internal architecture is heavily validated; the least-tested claims are the2021 + external boundaries — real provider wire formats, tool mutation semantics,2022 + OAuth, cross-platform builds, and the arch-gate tooling. Ranked by2023 + spec-impact × uncertainty. p29/p31/p33 are environment-feasible; p30/p32 are2024 + tooling-gated (need a release/CI toolchain) and are attempted where possible.2026 + ## P29 — `p29-provider-streaming` 2030 + - §7.1/§7.2: required providers (Anthropic, OpenAI, Google, OpenAI-compatible)2031 + normalize vendor wire formats into `ProviderEvent` (§5.2); quirks handled at2032 + the boundary — partial tool-call argument chunks assembled, thinking/2033 + reasoning fields (reasoning may arrive in `content`), provider stop reasons,2034 + cache usage; non-SSE JSON error on a streaming request → `ProviderEvent::Error`.2035 + - §5.1: `Thinking { content, provider_metadata? }` — signed thinking round-trips.2039 + Each provider's streaming shape differs (Anthropic content-block events, OpenAI2040 + delta chunks, Google candidates); normalizing all into one `ProviderEvent`2041 + sequence, assembling split tool-call JSON, and preserving thinking signatures2042 + is unvalidated for the current provider set (only pre-consolidation MiniMax was).2044 + ### Minimal artifact 2047 + p29-provider-streaming/2048 + Cargo.toml (serde, serde_json)2049 + fixtures/anthropic.sse fixtures/openai.sse fixtures/google.sse2050 + fixtures/anthropic-error-200.json (non-SSE error body)2054 + Realistic hand-authored fixtures of each provider's streaming bytes (no2055 + network). A per-provider normalizer parses them into a `Vec<ProviderEvent>`.2060 + cd prototypes/p29-provider-streaming2061 + cargo run -- anthropic2064 + cargo run -- tool-call-assembly2065 + cargo run -- error-detection2066 + cargo run -- thinking-roundtrip2072 + - each provider's fixture → the expected deterministic `ProviderEvent`2073 + sequence (TextDelta/ThinkingDelta/ToolCall assembled/Done{usage,stop}),2074 + - a tool call whose JSON arguments are split across chunks assembles to one2075 + complete `ToolCall`,2076 + - a non-SSE JSON error body returned with HTTP 200 becomes2077 + `ProviderEvent::Error`, not a hang,2078 + - a thinking block with a provider signature survives as2079 + `provider_metadata` and replays on a follow-up request,2080 + - report any provider shape §7.2's quirk list does not cover.2084 + Tighten §7.2 with the concrete per-provider normalization rules and any quirk2085 + the fixtures expose.2087 + ## P31 — `p31-edit-write-tool` 2091 + - §9.12 `write`: atomic temp-file + rename, creates parent dirs, records a VCS op.2092 + - §9.12 `edit`: read → validate (non-empty `old_text`, non-binary) → count exact2093 + matches (zero fails, multiple fails unless `allow_multiple`) → re-read+hash2094 + before write → fail `ESTALE` if changed → write atomically → return change2095 + count + before/after hashes. Errors: `ENOENT`, `EEMPTY`, `EBINARY`,2096 + `ENOMATCH`, `EMULTI`, `ESTALE`, `ELOCK`.2097 + - §5.3/§6.1: parallel vs sequential tool execution; every tool observes abort.2101 + The stale-hash race (re-read between match and write) and the exact error-code2102 + taxonomy are subtle and unvalidated; p07 only mocked tools. Atomic rename must2103 + hold on same-filesystem temp.2105 + ### Minimal artifact 2108 + p31-edit-write-tool/2109 + Cargo.toml (sha2; std only otherwise)2113 + Real files in temp dirs; drive `write`/`edit` against them.2118 + cd prototypes/p31-edit-write-tool2119 + cargo run -- write-atomic2120 + cargo run -- edit-happy2121 + cargo run -- edit-errors2122 + cargo run -- edit-stale-race2123 + cargo run -- parallel-abort2129 + - write: temp+rename is atomic (a crash between leaves either old or new, never2130 + partial — simulate by asserting no partial file); parent dirs created,2131 + - edit: happy path returns change count + before/after hashes; each error code2132 + reproduced with its exact condition,2133 + - stale race: mutate the file between match-count and write → `ESTALE`, no write,2134 + - parallel mode runs independent edits concurrently; an abort mid-batch stops2135 + cleanly and leaves no half-written file.2139 + Confirm or refine the §9.12 edit algorithm ordering and the stale/atomic2140 + guarantees under real filesystem semantics.2142 + ## P33 — `p33-oauth-flow` 2146 + - §7.4: OAuth configured with `id/name/auth_url/token_url/scope/client_id`;2147 + login surfaces the auth URL, receives the code via a local callback HTTP2148 + server on a random port (or manual paste), exchanges it for2149 + `{access_token, refresh_token, expires_at}`, persists to `auth.json`,2150 + auto-refreshes on expiry.2154 + The callback-server + exchange + refresh flow (state/PKCE, random-port bind,2155 + redirect capture, refresh timing) is fiddly and unvalidated.2157 + ### Minimal artifact 2161 + Cargo.toml (serde, serde_json; std TcpListener for both servers)2165 + A mock OAuth provider (std `TcpListener`) plays authorize + token endpoints; the2166 + client runs the §7.4 flow end to end, no external network.2171 + cd prototypes/p33-oauth-flow2173 + cargo run -- callback-capture2174 + cargo run -- refresh2175 + cargo run -- persist2181 + - login binds a random-port callback server, emits the auth URL with `state`,2182 + the mock provider redirects with a code, the server captures it, exchange2184 + - `state` mismatch is rejected,2185 + - an expired `access_token` triggers a refresh using `refresh_token`; a revoked2186 + refresh surfaces a clear auth error,2187 + - tokens persist to and reload from the `auth.json` shape (§7.4).2191 + Pin any §7.4 OAuth detail the flow exposes (state/PKCE requirement, callback2192 + timeout, refresh-ahead-of-expiry window).2194 + ## P30 — `p30-cross-build` (tooling-gated) 2198 + §14: `cargo run -p xtask -- release` cross-builds all targets via2199 + cargo-zigbuild — windows-msvc, apple-silicon, linux gnu/musl (x86_64 + arm64).2203 + The heavy C tree (vendored LuaJIT, aws-lc-sys via cmake, jj-lib's gix/prost)2204 + cross-compiled to Windows/musl is a real "does it even build" unknown, like p172205 + and p26 — and could force dependency or feature changes.2207 + ### Verify (attempt where tooling allows) 2209 + Install `cargo-zigbuild` + `zig`; attempt `cargo zigbuild --target2210 + x86_64-unknown-linux-musl` and `aarch64-unknown-linux-musl` on a minimal bin2211 + pulling mlua(vendored) + aws-lc + gix. Report per-target build success/failure2212 + and the first blocking C/link error. If zig/targets are unavailable, report2213 + BLOCKED with what a release environment must provide.2217 + Confirm §14's target list is buildable, or record the per-target blockers /2218 + feature changes needed.2220 + ## P32 — `p32-arch-gate` (tooling-gated) 2224 + §11 / PROJECT-INVARIANTS §11: `cargo run -p xtask -- pup` on pinned nightly2225 + enforces the forbidden inter-crate dependency rules (e.g. `smith-core` must not2226 + depend on `smith-ai`).2230 + The whole architecture gate bets on cargo-pup expressing these rules; if it2231 + cannot, §11 enforcement is vapor and needs a different mechanism.2233 + ### Verify (attempt where tooling allows) 2235 + On the pinned nightly, install `cargo_pup`; author a rule expressing a §112236 + forbidden edge over a tiny 3-crate workspace; prove it PASSES a legal graph and2237 + FAILS an illegal one. If the nightly/tool is unavailable, report BLOCKED and2238 + whether `cargo run -p xtask -- arch` (stable metadata check) can enforce the2239 + same rules as a fallback.2243 + Confirm cargo-pup enforces §11, or fall back the arch gate to the stable2244 + metadata check and record it.2018 2246 ## Reporting Template ## Reporting Template 2020 2248 Each completed prototype updates this plan with a result block in theEach completed prototype updates this plan with a result block in the