Skip to content

feat: integrate protocol corpus and offline Wallet Kernel spending controls - #4

Merged
Aznatkoiny merged 167 commits into
mainfrom
codex/agent-spend-control-implementation
Aug 2, 2026
Merged

feat: integrate protocol corpus and offline Wallet Kernel spending controls#4
Aznatkoiny merged 167 commits into
mainfrom
codex/agent-spend-control-implementation

Conversation

@Aznatkoiny

Copy link
Copy Markdown
Owner

Scope

This is a draft integration PR. It combines the accumulated protocol design and spike corpus from the implementation branch with the new offline Wallet Kernel spending-control slice. Because public main and the implementation work began as separate histories, the PR is intentionally broad: 341 files, not only the final 109-file Wallet Kernel commit.

The public website, root README, and assets are preserved exactly from main through merge d55220b. This PR does not reframe the website around the wallet yet.

Wallet Kernel delivered

  • durable SQLite wallet authority, secure storage, locking, recovery, and reconciliation
  • budgets, policy decisions, approval queue, exact one-time permits, intents, and signed receipts
  • Agent enrollment, credential isolation, operator API and CLI, and local operator console
  • Pi 0.80.6 approval and resume for model and Skill calls through the spend-control proxy
  • deterministic and CDP wallet adapter contracts, Base Sepolia observer, and x402 v2 exact-payment transport
  • offline evidence builder and verifier, release-integrity checks, systemd artifacts, and no-secret scanning

Honest launch boundary

This is an offline deterministic product slice, not a commercial or live-testnet launch. No funds moved, no live CDP call ran, and no Base Sepolia transaction was submitted. Live composition remains deliberately fail-closed with LIVE_LAUNCH_NOT_READY, and testnet evidence remains EVIDENCE_TESTNET_NOT_RUN. The website reframe stays gated on reproducible testnet evidence.

Verification

Clean commit 80672cd on locally available Node 24.18.0:

  • Wallet Kernel focused suite: 1,139 passed, 0 failed, 2 skipped
  • legacy Pi e2e: 41 of 41 checks passed
  • evidence tests: 24 of 24 passed
  • prototype tests: 23 of 23 passed
  • tracked-secret scan: 397 files, valid
  • protected CONTEXT, PRD, and ADR corpus unchanged by the Wallet Kernel commit

The clean full suite reached 1,455 passed, 4 failed, and 4 skipped; all four failures were sandbox EPERM errors from prohibited loopback listeners. An independent source-worktree run before the final no-secret false-positive adjustment passed 1,460 tests with 3 explicit skips. Exact Node 24.18.1 and Linux systemd qualification remain pending in GitHub Actions.

Review gates

  • confirm that the intentionally accumulated 341-file integration scope belongs in main
  • require exact Node 24.18.1 and Linux CI evidence
  • keep live deployment and commercial claims blocked until customer-hosted composition and funded Base Sepolia evidence exist

Aznatkoiny and others added 30 commits July 11, 2026 12:29
Snapshot of all design docs (CONTEXT.md, PRD, 6 ADRs, feasibility
report + red-team), the executed fork-economics prototype, and the
phase0 Story registration implementation (write path not yet run).

Committed immediately after an adversarial premise review so all
future edits to the evidence corpus are attributable — the red-team
vs findings.json provenance question can never recur.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Validated in brainstorming after the adversarial premise review:
closed-mode compensation/attribution layer becomes the terminal
product; the Wielder is a wallet, not a harness; inference payments
are the demand-side wedge. Includes the full document change spec
and the testnet spike design.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Proves ADR-0008 by construction: the Wielder-side protocol footprint
is a single ~150-line paying proxy (402 -> sign EIP-3009 -> retry).
Mock collar hosts the repo's own skill behind x402, credentials are
single-use (replay -> 409), output-only responses, and splits are
computed by the actual prototype settlement engine. Offline e2e:
20 checks green with zero network, keys, or funds.

Manual steps remain: faucet-fund the Base Sepolia wallet, testnet
run against x402.org/facilitator, pi extension live demo (RUNBOOK.md).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements docs/plans/2026-07-11-reframe-and-pi-wielder-design.md §3
in full, verified by three adversarial checkers (29 findings, 18
actionable, all fixed):

- CONTEXT.md: Carta-for-AI-work-artifacts identity; Wielder = wallet;
  Collar added to the glossary; ambiguities updated
- PRD: "Phase 1 is the terminal state by design"; demand-side wedge
  (inference installs the rail, skills ride it; Pi-Wielder spike named
  as validation); GPT Store precedent; skill-depreciation analysis;
  kill-criterion 7 (platform-native marketplace); Wielder-side
  trust-minimized renames; gate-leak SLO + key-custody design;
  Merkle beneficiary-verifiable meter as Phase-1 requirement;
  "when Sam quits" vesting/clawback inputs; education deferred
- ADRs: status headers on all; ADR-0001 amended (artifact scarcity is
  not economic scarcity); ADR-0002/0006 amended to match; new
  ADR-0007 (closed-mode layer terminal) and ADR-0008 (Wielder is a
  wallet)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Four agent-doable tasks handed to the codex/prd-execution session:
repair the CMA latency spike, make the phase0 write path one command,
build the clone-economics spike, re-run fork economics with the free
re-author branch. Human-only steps (wallet funding, LOIs, counsel)
explicitly excluded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two paid legs through the paying proxy against the live x402.org
facilitator: real settlements (txHashes recorded), on-chain balances
reconcile to the cent, measured payment overhead ~781ms/call
(facilitator-dominated). Feeds the PRD spike list item 13.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
First real numbers for two kill-criteria: CMA cold-start 2.5s p50 to
first answer token (KC2 does not fire); live 6-pair distillation FAILED
all critical fidelity gates while costing $1.58 with 8-invocation
break-even (KC4: economics protect nothing, fidelity is the moat;
high-N unknown). Education-mode deferral confirmed by the free
re-author model. Codex review: zero must-fix across six commits.

Harness fixes en route to the measurement: raw distillation output
persisted pre-validation, SKILL.md format stated in the distill
prompt, whole-response-only fence unwrapping, any-heading validator.
prototype gains a package.json for its SDK dependency.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
No secrets were ever committed (full-history scan, all refs). This
applies the preventive fixes: .env.* variants and run artifacts
gitignored, third-party skill installs ignored with an exception for
our own skill, vendor doc snapshots (.archive) removed as
redistribution-unsafe, absolute local paths relativized in
findings.json, account-scoped bench IDs reworded out of the prototype
README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Five LinkedIn posts (buyer register, no crypto vocabulary), three X
threads + cold-start engagement playbook + six spacers, Show HN draft
with prepared answers to the five hardest questions, 57s demo-clip
storyboard, launch runbook, and the day-by-day calendar (Day 0 =
repo flip). All copy audited: securities-language sweep, factual
overreach corrected against measured numbers, authenticity pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ential

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pi v0.80.6 crashes with 'undefined.includes' when model entries lack
the input modality array; schema per pi's docs/custom-provider.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pi's openai-completions client requires streaming responses; the spike
gateway returned buffered JSON, so pi discarded four PAID answers
($0.164 of testnet USDC — a live demonstration of the paid-but-
unusable-response failure mode). The gateway now replays the completed
answer as compliant SSE when stream:true; the proxy forwards upstream
content-type and tolerates non-JSON bodies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
String(m.content) on pi's array-of-parts content sent Claude literally
'[object Object]' (two paid calls proved it on the session ledger).
Normalize string/array content everywhere, translate OpenAI tools <->
Anthropic tool_use/tool_result with role merging, carry tool_calls
through the synthesized SSE, and stop forwarding stream:true upstream.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Answers "crypto-enabled skills.sh?" (no — ADR-0007 holds; all four
steelmanned critiques bind) and "distribute like MCP/A2A?" (yes — MCP
playbook applied: adoption kit, neutral org, two named adopters before
the word "standard", settlement-gated registry as protocol surface).
Grounded in a 6-agent web+repo research sweep (2026-07-15) and an
adversarial fact-check pass; 12 defects corrected before commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U2V9gsyEvYTSoZL4YkWYio
Closes design-doc step 4 (promised 2026-07-11, RUNBOOK 'what stays
manual'). Dated amendments only, caveats preserved:
- KC2: cold ~2.5s / warm ~1.5s (n=3) measured 2026-07-12 — does not
  fire at first bound; production-n distribution still open.
- KC4: N=6 first measurement ($1.58 attack, modeled 8-invocation
  break-even, all fidelity gates failed) — marked do-NOT-cite-as-resolved.
- Pi-Wielder spike marked executed: ~781ms x402 overhead (n=1, testnet),
  on-chain reconciliation exact, live pi v0.80.6 demo 2026-07-15
  (8 paid streaming calls); p50/p95 at n≈30 + gpt leg still pending.
- Education: fork-economics re-run 2026-07-12 recorded as negative
  everywhere the PRD said 'deferred pending re-run' — only restructured
  forms (living content / direct licensing) remain live.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U2V9gsyEvYTSoZL4YkWYio
…freshed

- docs/ops/kc7-platform-marketplace-review.md: the PRD-mandated monthly
  review now exists with a named owner and its first logged review
  (2026-07-15: no trigger; adjacent watchlist noted).
- Campaign plan: Day-0 slip recorded (repo still private 07-15, no
  pre-flight log) with proposed re-anchor Day 0 = Thu 07-16 preserving
  weekday semantics; X reply routine starts immediately.
- docs/marketing/artifacts/: raw 402 response + reconciled ledger render
  pre-captured for X posts 1-2.
- Fresh handoff (2026-07-15) supersedes the completed 07-11 handoff;
  AGENTS.md assignment pointer updated.
- Hygiene: scratch-site-check.mjs deleted per its own header (live-site
  pointer preserved in the handoff); .pi/ gitignored as an install artifact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U2V9gsyEvYTSoZL4YkWYio
Closes the spike's promised p50/p95 measurement and runs the gpt leg for
the first time. 50 paid calls against the real Base Sepolia facilitator,
wallet reconciled on-chain to the cent (19.299 -> 16.129 USDC).

Bench surfaced and fixed a real gateway bug: newer OpenAI models reject
max_tokens (400 unsupported_parameter); the gateway now translates it to
max_completion_tokens — without this, pi's gpt leg 500s in the live demo.

Two failure modes recorded in the README: pay-then-fail (10 calls settled
then 500'd upstream, $0.87 burned — buyer's risk under pay-first-then-run)
and settled-but-rejected (1/50 settled on-chain yet returned 402 when the
facilitator response to the seller failed; ~4% testnet flake overall).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U2V9gsyEvYTSoZL4YkWYio
…ar re-anchored

- Ground truth recorded: Post 1 shipped Mon 07-13 (= Day 0) with the repo
  link 404ing; pre-flight PASSED 07-15 (fresh clone e2e green, secrets
  CLEAN); repo synced (public 84f8da4) and flipped public, verified
  logged-out. Today = Day 2.
- Revamped calendar in campaign-plan §2 (launch thread Thu 07-23, Show HN
  Tue 07-28); original table kept as superseded reference; kit overrides
  acknowledged explicitly.
- All queued copy refreshed to the n=48 distribution (p50 731ms / p95
  1206ms) with cold-start scoped to its n=3 measurement; N=6 clone caveats
  untouched; Show HN text gains the two failure modes.
- Four new compliance-checked X artifacts (distribution, pay-then-fail,
  settled-but-rejected, pi session ledger) + live-endpoint 402 capture.
- Metrics daily log started in hn-and-demo §3 with honest slip note;
  Day-2 row reconciles 57 settlements / $3.211 to the cent.
- pi-wielder README: pi session corrected to 7 calls / $0.287 (8th ledger
  entry was the pre-demo smoke test) — caught by the verify pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U2V9gsyEvYTSoZL4YkWYio
Aznatkoiny and others added 27 commits July 18, 2026 16:50
Merge the verified payment, execution, accounting, attestation, evidence, and public-surface hardening into codex/prd-execution.
@Aznatkoiny
Aznatkoiny marked this pull request as ready for review August 2, 2026 20:24
@Aznatkoiny
Aznatkoiny merged commit 2f7225d into main Aug 2, 2026
1 check passed
@Aznatkoiny
Aznatkoiny deleted the codex/agent-spend-control-implementation branch August 4, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant