GrayMatter: The Memory System for AI Agents

GrayMatter is the durable, relational memory substrate that transforms AI agents from stateless models into intelligent, context-aware systems that learn, adapt, and improve over time.
The Problem
Traditional AI agents suffer from three critical limitations:
- Transient context: Information lives in prompt windows and evaporates between sessions
- Opacity: Memory is a black box—you can't see, measure, or improve retrieval quality
- Waste: Agents repeat contextual work, hallucinate over forgotten preferences, and accumulate low-signal data
The Solution
GrayMatter flips the script: Memory is not a side effect of prompts; it's a first-class system.
- Durable: Memories are stored in PostgreSQL, not prompt windows
- Queryable: Rich REST APIs for creating, reading, updating, and searching memories
- Measurable: Dashboard metrics show hit rate, utilization, cost, and recommendations
- Operationally managed: Compact, reindex, prune, expand—like a relational database
- Secure: Encryption, ACLs, audit trails for sensitive data
- Cost-controlled: Prepaid credits for every operation (read, write, compute)
The 4D Memory Matrix
GrayMatter organizes memory along four orthogonal dimensions:
| Dimension | Description | Example |
|---|---|---|
| Objects | Typed, durable memory atoms (FACT, PREFERENCE, INSTRUCTION, INSIGHT, ARTIFACT) | "Always use idempotency keys for payment mutations" |
| Properties | Structured data, formulas, derived fields, confidence scores | Title, text, tags, metadata, embeddings |
| Relationships | Graph links: references, contradicts, suggests, causality | "This newer instruction supersedes that older one" |
| Time | Temporal snapshots, diffs, replay for root-cause analysis | "What was true when?", "what changed while I was offline?" |
Core Capabilities
📊 Measure: Context Quality
Watch real-time metrics on the /graymatter-memory dashboard:
- Hit Rate: % of queries returning relevant results (target: >90%)
- Context Utilization: % of stored memory actively used (target: 60-80%)
- Waste: % of memory matching queries but not used (target: <20%)
- Burn Rate: Credits spent per session (optimize for lowest cost)
🎯 Act: Operational Decisions
Execute high-ROI memory operations:
- COMPACT: Consolidate and deduplicate entries (cost: 10 credits, saves 10-20% space)
- REINDEX: Rebuild semantic indexes (cost: 15 credits, improves hit rate 5-10%)
- PRUNE: Remove stale, low-confidence entries (cost: 5 credits, frees up space)
- EXPAND: Increase capacity when demand sustained (cost: 2 credits per increment)
💰 Control: Cost Economics
Ledger-based prepaid credits:
| Operation | Cost | Purpose |
|---|---|---|
| Read entry | Runtime configured | Query and retrieve memory |
| Write entry | Runtime configured | Create or update memory |
| Compact | Runtime configured | Optimize storage and preserve an auditable action record |
| Reindex | Runtime configured | Refresh semantic index metadata |
| Prune | Runtime configured | Remove stale, duplicate, or low-signal entries |
| Expand | Runtime configured | Record capacity-expansion intent and checkpoint context |
Set automatic top-ups at thresholds. Monitor burn rate for cost anomalies.
Where It Lives in Product
/graymatter-memory(authenticated): Operational dashboard, stats, memory operations/credits/{accountId}(authenticated): Credit balance, usage history, payment methods/buy-credits(unauthenticated): Purchase prepaid credit packages/graymatter/activate(unauthenticated): Dedicated GrayMatter signup/activation funnel with attribution context/graymatter/credits(unauthenticated): Dedicated GrayMatter recharge entrypoint that routes to buy-credits with activation context- REST API (
/v1/memory/*): Memory runtime operations and compatibility aliases - Generated ThorAPI TypeScript clients (
src/thorapi): Source-of-truth entity CRUD and model contracts - Server & Controls Guide (read the implementation guide): Exact server-side flow, frontend controls, agent usage, tips, gotchas, and FAQ
- SWARM Protocol (v0.1 spec, JSON schema): Durable coordination contract for Codex, OpenClaw, Valor, Valklaw, ValorIDE, Claude, ValkyrAI native agents, workflows, CRM, CMS, deployments, and audit events. Agents register in the Agent Directory before they broadcast SwarmOps presence.
- Integrations: ValkyrAI workflows, ValorIDE agents, external systems
Common Use Cases
1. Support Agents with Contextual Intelligence
Store issue patterns, solutions, customer preferences. Agents retrieve relevant context before responding. Hit rate improves 30-40%, resolution time drops 50%.
2. Business Analysts Auto-Generating Pitch Decks
Store market intelligence, company profiles, winning pitch patterns. Agents assemble data-driven decks in 30 min vs. 4 hours of manual work.
3. Agents Continuously Learning
Store execution logs, successful patterns, failure modes. Each run improves the next: success rate increases 20%+ over 12 weeks.
4. Multi-Agent Coordination
Agents share a common memory namespace. Agent 1 researches a market, writes findings. Agent 2 reads findings, runs competitive analysis. Agent 3 builds go-to-market strategy. Chain of thought is coherent and fast.
For real-time coordination, use the GrayMatter SWARM Protocol as the canonical event contract. WebSocket/STOMP is the live bus; GrayMatter is the durable replay and audit layer.
5. Compliance & Audit Trail
Store decisions with full reasoning, signatures, principal IDs. Regulators can inspect the why behind every agent decision. Immutable, timestamped, non-repudiation.
Documentation
📄️ GrayMatter
Memory intelligence for context quality, retrieval precision, and spend-aware operation.
📄️ Architecture & Design
Technical foundation, memory model, and 4D matrix architecture behind GrayMatter.
📄️ Memory Operations and Credits
Practical operations playbook for GrayMatter memory quality and usage economics.
📄️ API Reference
Complete REST API and SDKs for GrayMatter memory operations, queries, and administration.
📄️ Server & Controls Guide
Exact GrayMatter server-side behavior, frontend controls, agent setup, usage guidance, gotchas, and FAQ.
📄️ Developer Integration Guide
How to integrate GrayMatter memory into your agents, workflows, and applications.
📄️ Operational Playbook
Day-to-day operational procedures, monitoring, and administration of GrayMatter memory systems.
📄️ Use Cases & Real-World Patterns
Real-world examples and battle-tested patterns for deploying GrayMatter across different AI agent and workflow scenarios.
📄️ FAQ & Troubleshooting
Common questions, troubleshooting guides, and solutions for GrayMatter memory issues.
📄️ Quick Reference
Quick reference card for GrayMatter API endpoints, SDKs, and common operations.
📄️ GrayMatter SWARM Protocol
Canonical GrayMatter-backed SWARM protocol contract for coordinating agents, IDEs, workflows, CRM, CMS, deployments, and audit state.
📄️ TrustFabric Launch Kit
Buyer-facing GrayMatter TrustFabric narrative, proof strip, one-pager, FAQ, demo script, and technical proof links.
📄️ Activation Fastlane
First-run readiness path for hosted GrayMatter activation, demos, and reviewer-safe validation.
📄️ Memory Fabric
How GrayMatter provides durable semantic memory over a governed relational object graph.
📄️ Runtime Trust
Provable runtime evidence, key custody, and ThorAPI-native trust objects for GrayMatter-backed systems.
📄️ ValorIDE Memory Integration
How ValorIDE uses GrayMatter for durable user, organization, and project memory.