Brainpedia turns your Obsidian vault into an AI brain that other agents pay you to query


All useful AI knowledge today sits behind three corporate APIs (OpenAI, Anthropic, Google). You cannot own a domain-specialty model, sell verifiable access to your expertise, or compose multiple specialty AIs together without renting from Big AI. The agent economy is short on supply.
Each Brain is a 0G iNFT (ERC-7857) you mint from your Obsidian vault. Notes get compiled into wiki articles by Claude (in-context), uploaded to 0G Storage as a merkle-rooted snapshot, and the iNFT carries the root.
You set a per-query price (stored as a human-readable ENS text record like 0.001 OG), the Brain runs inference on 0G Compute (TEE-attested Qwen 2.5 7B), and returns cited answers.
Other agents discover you via ENS subnames (yourname.bpedia.eth), authenticate via TTL ENS subname access tokens (agent7af.client.bpedia.eth), and route over Gensyn AXL P2P. A Mixture-of-Brains query fans out to N Brains in parallel with an LLM-routed topic shortcut.
The synthesis is pay-to-read: the orchestrator returns a plan plus per-brain redacted metadata, the agent settles each brain's sticker price in a single RoyaltyDistributor.distribute tx, and only then does the server verify the on-chain Distributed events and unlock the cached synthesis.
Every layer of the marketplace is on-chain:
Live Now @ https://brainpedia.up.railway.app
Install the published MCP server with a single command, no clone: claude mcp add-json brainpedia '...' --scope user ``
Point it at your Obsidian vault either by filesystem path or via the Local REST API plugin (no path needed, auto-discovers from your running Obsidian instance)
Say "Set up my Brain" inside Claude Code
Permissionless self-mint via BrainMinter, no involvement from us required. Each Brain owner pockets every query fee directly to their own wallet.
There was no reference implementation for stitching iNFTs, ENS access tokens, P2P routing, and MCP into one coherent system. Each layer's docs assume you are using it standalone.
0G
Brain.sol (ERC-7857 iNFT) on Galileo for ownership and per-query payment, plus BrainMinter (a permissionless wrapper that owns Brain.sol and exposes mintToSender, so any teammate can self-mint a brain to their own wallet without our involvement) and RoyaltyDistributor for one-tx multi-Brain settlement at sticker price (each responding brain receives exactly its advertised brain.price_query).
0G Storage covers the KV layer for live edits and the Log layer for merkle-rooted snapshots that bind into the iNFT.
0G Compute is accessed via the official broker SDK with Qwen 2.5 7B. Every per-brain answer is TEE-attested, plus a separate TEE-attested orchestrator-synthesis call fuses the per-brain answers into one coherent response.
ENS (Sepolia)
Two custom Solidity 0.8.26 registrars (SubnameRegistrar and AccessTokenRegistrar) using the standard setSubnodeRecord plus setText flow, with setApprovalForAll on both the Registry and the Public Resolver (the Resolver maintains a separate operator allowlist, easy to miss).
brain.price_query is stored in human-readable form (0.001 OG) so users inspecting the record on sepolia.app.ens.domains see the price directly, not raw wei.
Gensyn AXL
Each Brain runs its own axl daemon (Yggdrasil-based) with its own Ed25519 peer id, registered with the Python mcp_router.py on port 9003. Cross-Brain calls are POST /mcp/{peer_id}/brainpedia.brain over real P2P. The web /api/query route also routes through AxlClient when AXL_API_URL is set.
Pay-to-Read Enforcement The mixture API is two-phase:
sessionId, returns a redacted plan plus per-brain metadata plus the sticker-priced payment planRoyaltyDistributor.distribute in one tx, then re-calls with sessionId and txHashDistributed events, confirms each (tokenId, amount) from the cached plan was paid, and only then releases the synthesis. There is no honor-system path.Anthropic MCP TypeScript SDK
7 client tools shipped to npm as brainpedia-mcp so users can install with one command (claude mcp add-json) and drop straight into Claude Code:
with per-call vaultRootPath` so Claude can ask which user folder to compileupload_articlesfinalize_brain with auto-filled brain.compute_urlsync_vaultquery_brainquery_mixture for phase 1settle_mixture for phase 1.5 plus phase 2
The split between query_mixture and settle_mixture lets the host LLM surface the cost to the user and wait for explicit confirmation between calls. No silent settlements.Obsidian
setup_brain reads vaults two ways:
BRAINPEDIA_DEFAULT_VAULT_PATH)OBSIDIAN_REST_API_URL (defaults to http://localhost:27123)
The hosted demo runs Obsidian plus the plugin in a KasmVNC container on Railway, exposing the REST endpoint via a Railway TCP proxy. Per-user folders inside the shared vault are scoped via OBSIDIAN_VAULT_PATH (env default) or the per-call vaultRootPath argument the LLM passes when the user picks their handle.
