Patina
Context orchestration for AI-assisted development
Patina accumulates development wisdom like the protective layer that forms on metal—your patterns, decisions, and insights build up over time and transfer between projects.
What is Patina?
Patina solves the fundamental problem of AI-assisted development: constantly re-teaching AI assistants about your project's context, patterns, and constraints.
Core idea: Your development knowledge compounds. Session insights become beliefs, beliefs ground retrieval, retrieval enables smarter AI assistance.
Features (v0.17.0)
| Feature | Description |
|---|---|
| Semantic Search | Vector search over code, commits, beliefs, and patterns via scry |
| Structural Queries | Module inventory, call graph, imports, co-change analysis via assay |
| Epistemic Beliefs | Capture project decisions with evidence, grounding, and attack/support relationships |
| WASM Plugins | Extend Patina with WebAssembly component model plugins |
| Mother Daemon | Cross-project knowledge, hot model caching, graph routing |
| MCP Integration | Model Context Protocol server for LLM tool integration |
| Cross-Project Knowledge | Query external repos and persona knowledge across projects |
| Spec-Driven Development | Lifecycle management for specs (draft → ready → active → complete) |
| Session Tracking | Git-integrated development sessions with tagging and classification |
| Secrets Management | Age encryption with Touch ID, multi-recipient vaults |
| LLM Adapters | Claude, Gemini, and OpenCode integration |
| YOLO Devcontainers | AI-ready development environments |
Quick Start
# Install
# Initialize project
# Add an LLM adapter
# Build knowledge database (code + git + sessions)
# Build embedding projections
# Search your codebase
# Structural queries
# Get project patterns and beliefs
# Query external repos
# Check project health
Commands
Knowledge Pipeline
Supported languages: Rust, TypeScript, JavaScript, Python, Go, C, C++, Solidity, Cairo
Search & Retrieval
Semantic search (scry) — vector similarity over beliefs, patterns, commits, and code:
Structural queries (assay) — exact queries over code structure:
Context — patterns and conventions for AI assistants:
Epistemic Beliefs
Cross-Project Knowledge
Mother Daemon
WASM Plugins
Plugins use the WebAssembly Component Model (WIT interfaces). Patina ships with patina-doctor as a WASM plugin with a compiled fallback.
Session Management
Within Claude, use slash commands: /session-start, /session-update, /session-note, /session-end
Spec Lifecycle
Versioning & Release
Secrets
Project Setup
Development Environment
Measurement
Architecture
patina/
├── src/ # Rust source (~61k lines, 195 files)
│ ├── commands/ # CLI commands (27 total)
│ │ ├── scrape/ # Code, git, sessions, GitHub extraction
│ │ ├── scry/ # Semantic vector search
│ │ ├── assay/ # Structural queries (imports, callers, co-change)
│ │ ├── oxidize/ # Embedding projection training
│ │ ├── mother/ # Daemon (microserver, registry, graph)
│ │ ├── session/ # Git-integrated session management
│ │ ├── repo/ # Cross-project knowledge
│ │ ├── spec/ # Spec lifecycle management
│ │ ├── version/ # Versioning and release
│ │ ├── belief/ # Epistemic belief audit
│ │ ├── persona/ # Cross-project user knowledge
│ │ └── ... # init, doctor, secrets, yolo, eval, bench, etc.
│ ├── plugin/ # WASM plugin engine (wasmtime)
│ ├── mother/ # Daemon core (graph, children)
│ ├── retrieval/ # Oracle abstraction, RRF fusion
│ ├── mcp/ # MCP protocol, JSON-RPC server
│ ├── embeddings/ # ONNX E5-base-v2, USearch HNSW
│ ├── release/ # Release strategy and version bumping
│ ├── secrets/ # Age encryption, Keychain integration
│ ├── adapters/ # LLM adapters (Claude, Gemini, OpenCode)
│ └── ... # db, forge, git, models, scanner, workspace
├── patina-metal/ # Tree-sitter grammars, unified parser
├── patina-plugin-api/ # Guest-side WASM bindings
├── patina-command-api/ # Command world guest API
├── patina-doctor/ # Doctor as WASM plugin
├── patina-plugin-models/ # Models WASM plugin
├── patina-plugin-repos/ # Repos WASM plugin
├── layer/ # Pattern storage (Git as memory)
│ ├── core/ # Eternal principles + core beliefs
│ ├── surface/ # Active specs, architecture docs
│ │ ├── epistemic/beliefs/ # 103 epistemic beliefs
│ │ └── build/ # Specs and roadmap
│ ├── dust/ # Archived patterns
│ └── sessions/ # 657 session archives
├── .patina/
│ ├── data/
│ │ ├── patina.db # Unified eventlog + materialized views
│ │ └── embeddings/e5-base-v2/projections/
│ │ ├── semantic.* # Trained MLP weights + HNSW index
│ │ ├── temporal.*
│ │ └── dependency.*
│ └── oxidize.yaml # Projection training recipe
└── ~/.patina/
├── repos/ # External repos (cross-project knowledge)
├── layer/ # User-level beliefs and persona
└── registry.yaml # Repo registry
Data Flow
Sources Scrape Oxidize Query
─────── ────── ─────── ─────
.git/commits → patina.db → Training pairs → scry (semantic)
src/**/* (AST) → ├── eventlog → E5 embedding → assay (structural)
layer/sessions/*.md → ├── call_graph → MLP projection → context (patterns)
layer/**/beliefs/*.md → ├── co_changes→ USearch HNSW → belief audit
GitHub issues → └── code_fts (.usearch files)
Embedding Model
Patina uses E5-base-v2 (768-dim) with trained MLP projections per dimension.
| Dimension | Training Signal | Query Interface |
|---|---|---|
| Semantic | Same session = related | scry "query" (text → concepts) |
| Temporal | Same commit = related | scry --file src/foo.rs (file → co-changers) |
| Dependency | Caller/callee = related | assay callers/callees (call graph) |
Architecture: E5-base-v2 (768-dim) → trained MLP (768→1024→256) → USearch HNSW index per dimension.
Design Principles
- Pure Rust: No Python subprocess dependencies (ONNX Runtime via
ortcrate) - Local-first: SQLite + USearch, no cloud services required
- LLM-agnostic: Adapter pattern for Claude, Gemini, OpenCode
- Git as memory: Sessions and beliefs committed to repo, vectors rebuildable from source
- Spec-driven: Features start as specs, go through lifecycle, trigger releases on completion
Requirements
- Rust (edition 2021, tested on 1.90+)
- Git
- Docker (optional, for
patina yolodevcontainer generation) ghCLI (optional, for--with-issuesGitHub integration)
Development
# Build and install
# Run tests
# Pre-push checks (fmt + clippy + tests)
License
MIT License - see LICENSE file for details.