meld
Deterministic context management for AI agents. Meld tracks your codebase state using Merkle trees and stores AI-generated context frames linked to each file and directory.
Why meld?
AI agents need context about your code. Traditional approaches require expensive full-codebase scans or semantic search. Meld provides:
- Instant invalidation — Hash comparison detects changes in O(1)
- Fast lookups — Retrieve context for any file without scanning
- Immutable history — Context frames are append-only and verifiable
- Multi-agent support — Multiple agents can read/write context independently
Installation
Quick Start
# Initialize meld in your project
# Scan the filesystem to build the tree
# Check workspace status
# Generate context for the codebase
Core Commands
Workspace
Context
Agents
Agents are LLM-powered workers that generate context frames.
Providers
Providers are LLM backends (OpenAI, Anthropic, Ollama, etc.).
Configuration
Meld uses XDG directories:
| Purpose | Location |
|---|---|
| Config | ~/.config/meld/ |
| Agents | ~/.config/meld/agents/*.toml |
| Providers | ~/.config/meld/providers/*.toml |
| Prompts | ~/.config/meld/prompts/*.md |
| Data | ~/.local/share/meld/workspaces/<hash>/ |
| Logs | Platform state directory, e.g. $XDG_STATE_HOME/meld/ on Linux |
Logging
Logging is on by default and writes to a file under the platform state directory (e.g. $XDG_STATE_HOME/meld/.../meld.log on Linux). Use --quiet to disable logging, or --log-file <path> / MERKLE_LOG_FILE to set the log file path. Configure level, format, and output in [logging] in your config file.
Workspace config
Create .meld/config.toml in your project root:
[]
= ".meld/store"
= ".meld/frames"
[]
= true
= "info"
= "text"
= "file"
How It Works
Merkle Tree
Meld builds a Merkle tree of your filesystem. Each file and directory gets a deterministic NodeID based on its content and path. When files change, only affected hashes update — enabling instant change detection.
Context Frames
Context frames are immutable blobs of AI-generated information attached to nodes. Each frame has:
- FrameID — Content-addressed hash
- Basis — The NodeID it describes
- Content — The actual context (summaries, analysis, etc.)
Frames are append-only. New context creates new frames; history is preserved.
Agents & Providers
- Agent — Defines the prompt and role (Reader or Writer)
- Provider — The LLM backend that executes the prompt
Writer agents generate context frames. Reader agents can query context but not write.
Architecture
Filesystem
↓
Merkle Tree (deterministic hashing)
↓
NodeRecord Store (fast lookups)
↓
Context Frames (AI-generated, append-only)
↓
Frame Heads (latest frame per node)
↓
Context Views (bounded retrieval)
Development
# Run tests
# Build release
# Run with verbose logging
License
MIT OR Apache-2.0