This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
TIM (The Inference Mesh) is a peer-to-peer network for sharing spare inference capacity. It routes inference requests to available nodes that can be local models (Ollama, LMStudio, llama.cpp), API keys (OpenAI, Anthropic, Google), or subscription headroom.
Core Philosophy: "We route inference requests. That's it." The network handles routing, discovery, reputation. Clients own context, orchestration, tool execution, and sandboxing.
Specification phase only. No implementation code exists yet. The project is being designed before coding begins.
- Full specification: specs/tim-overview.md
- Research notes: specs/gemini-research.md
- Unit of work: Single request/response pair (stateless at network layer)
- API: OpenAI Completions API compatible with optional
X-Tim-*headers for routing hints - Language: Rust recommended (rust-libp2p has best maturity)
- Transport: libp2p + QUIC with DCUtR for NAT traversal
- Discovery: Kademlia DHT (slow path) + GossipSub (fast path for capacity)
- Identity: Public key cryptography (node ID = hash of public key)
- Reputation: EigenTrust++ with spot-check verification probes
- Provider: Has inference capacity, serves requests
- Consumer: Sends requests to the mesh
- Relay: Routes traffic, participates in discovery (no inference)
Use tmp/ at the project root for scratch files.