Skip to content

feat: opt-in 0G Router brain (CompletionTransport seam, Direct default) - #6

Closed
alkautsarf wants to merge 1 commit into
mainfrom
feat/router-brain
Closed

alkautsarf wants to merge 1 commit into
mainfrom
feat/router-brain

Conversation

@alkautsarf

Copy link
Copy Markdown
Member

What

Adds the 0G Router as an opt-in second inference door, behind a provider-agnostic CompletionTransport seam. Direct (0G serving-broker) stays the default and is bit-identical — og-compute.test and all 8 brain tests are unchanged.

  • Direct (default): 0G serving-broker, ethers, EIP-712 per-request vouchers, drainable on-chain ledger.
  • Router (opt-in via brain.providerKind: 'router'): router-api.0g.ai/v1, OpenAI-compatible, Bearer sk-, headless SIWE self-auth, prepaid Payment Layer credit.

How it stays sovereign

The Router sk- is agent-derived — the agent self-signs SIWE with its own private key → wallet JWT → mints its own mk-/sk- keys → self-deposits on-chain to the Payment Layer. No human-dashboard key, no stored third-party secret beyond the regenerable, sealed-encrypted sk-.

Safety theme (Router deposits are NON-recoverable)

The Payment Layer has no user withdraw (only admin withdrawUnallocated), so every money path is conservative:

  • Router auto-topup is explicit opt-in (economy.autoTopup.enabled), not default-on.
  • topup --router guards on providerKind === 'router' + mainnet-only.
  • Auto-topup waits for the deposit receipt + in-flight guard (no double-deposit on a stale balance read) + daily-cap-notify-once.
  • Sub-minimum / NaN deposit amounts are rejected before any RPC.
  • Credit errors are 4xx-scoped (a 5xx outage never tells the operator to deposit non-recoverable credit).

Verification

  • Phases 1-5 built + a 52-agent /code-review --fix pass (11 fixed, 3 deferred-non-fatal).
  • Gates: typecheck 0, unit 1366/0, forge 124/0, lint clean.
  • Live $0 Router inference proof + live mainnet deposit tx (0 → 0.1 0G) + anima init Router tmux smoke (caught + fixed a phantom-ledger-prompt bug).

Scope

Default OFF. Direct path untouched. specter (#4) + enigma (#6) unaffected until they deliberately anima upgrade after a release.

https://claude.ai/code/session_01PQ6KBM8gAanXLCFrm4zU7g

Adds the 0G Router (router-api.0g.ai, OpenAI-compatible, headless SIWE, prepaid Payment Layer credit) as a second inference door beside Direct, opt-in via brain.providerKind:'router'. Direct stays the default and is bit-identical (og-compute + all 8 brain tests unmodified). New CompletionTransport seam (Direct/Router transports), config + picker + 4 build sites, sealed sk-/mk- custody (operator-blob, env-redacted, never serialized), Payment Layer deposit + auto-topup + 'anima topup --router'.

Review hardening: Router auto-topup is explicit opt-in (non-recoverable, never default-ON); topup --router gated on providerKind + mainnet; auto-topup deposit waits for receipt + in-flight guard (no double-deposit); compaction strips MiniMax <think> + reprovisions on 401; credit-error mapping scoped to 4xx (no false topup hint on 5xx); init shows Router funding guidance; status/Telegram surface the Router brain + credit errors; sub-minimum deposit amounts rejected; 'anima model' preserves brain tuning fields.

Claude-Session: https://claude.ai/code/session_01PQ6KBM8gAanXLCFrm4zU7g
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
anima Ready Ready Preview, Comment Jun 18, 2026 6:05am

@alkautsarf

Copy link
Copy Markdown
Member Author

Shipped to main as commit a76b231 and tagged v0.25.0 (release CI publishing all 7 @s0nderlabs/anima-* packages now). Merged via squash into main during the seal pipeline rather than the GitHub merge button, so it shows as closed rather than merged. Pre-merge review: 29-agent rigorous pass (SHIP, 0 blockers) + seal pipeline (lint/typecheck clean, 1366 unit / 124 forge, security clean). The feat/router-brain branch is retained.

@alkautsarf alkautsarf closed this Jun 18, 2026
@alkautsarf
alkautsarf deleted the feat/router-brain branch June 18, 2026 10:40

This branch was successfully deployed

1 active deployment
Preview — 8b0e39c0 Deployed Jun 18, 2026 by vercel[bot]
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