CueMap Rust Engine: High-performance temporal-associative memory store
1.8K
High-performance temporal-associative memory store that mimics the brain's recall mechanism.
CueMap implements a Continuous Gradient Algorithm inspired by biological memory:
Built with Rust for maximum performance and reliability.
CueMap introduces deep biological inspiration into the deterministic recall engine:
Given partial cues, the engine recalls the whole memory by maintaining an incremental cue co-occurrence matrix. This expansion happens strictly at retrieval-time and can be toggled off via disable_pattern_completion: true for pure deterministic matching.
Experiences are automatically chunked into episodes. Memories created in close temporal proximity with high cue overlap are tagged with episode:<id>, allowing the engine to recall entire "storylines" from a single member. Can be disabled per-request via disable_temporal_chunking: true.
Not all memories are created equal. The engine calculates a Salience Multiplier based on cue density, reinforcement frequency, and rare cue combinations. Salient memories persist longer in the "warm" cache and rank higher than routine events. Can be disabled per-recall via disable_salience_bias: true.
Old, highly overlapping memories are periodically merged into summarized "gist" memories. This process is strictly additive: it keeps the original high-resolution memories intact as Ground Truth while creating new consolidated summaries to aid high-level recall. Can be toggled at retrieval via disable_systems_consolidation: true.
Every recall result now includes a Match Integrity score. This internal diagnostic combines intersection strength, reinforcement history, and context agreement to tell you how structurally reliable a specific recall result is.
To bridge the gap between user queries and stored memories, CueMap integrates WordNet lookups during cue generation. This allows the engine to propose synonym-rich cues, ensuring that a memory tagged with "payment" is retrievable via "transaction" or "billing".
docker build -f Dockerfile.production -t cuemap/engine .
docker run -p 8080:8080 cuemap/engine
CueMap includes a lightweight, embedded visualization dashboard with real-time insights.
Access it directly at: http://localhost:8080/ui (requires running with --features ui)
CueMap includes a Self-Learning Agent that automatically watches local directories, extracts structured "facts", and ingests them into your memory store.
On startup, if --agent-dir is provided, CueMap initializes the Self-Learning Agent.
LLM_ENABLED=true, it ensures Ollama is ready with chosen model for deep fact extraction from documents.# Point CueMap at your project
./target/release/cuemap-rust --agent-dir ~/projects/my-app
# The agent will automatically:
# 1. Structural Chunking (Python, Rust, JS/TS, Go, Java, PHP, HTML, CSS).
# - Recursive tree-sitter extraction captures 'name:Calculator', 'selector:.btn', etc.
# 2. Document & Data Parsing (PDF, Word, Excel, JSON, CSV, YAML, XML).
# - Extracts headers, keys, and metadata as grounded structural cues, in addition to cues inferred from content.
# 3. LLM Fact Extraction (optional) to propose semantic cues.
# 4. Immediate ingestion into the memory store.
CueMap provides complete project isolation with automatic persistence:
X-Project-ID header.CueMap runs in multi-tenant mode by default. Simply specify a project ID in your requests.
# Start server
./target/release/cuemap-rust --port 8080
# Add memory to project
curl -X POST http://localhost:8080/memories \
-H "X-Project-ID: my-project" \
-H "Content-Type: application/json" \
-d '{"content": "Important data", "cues": ["test"]}'
# Stop server (Ctrl+C) - auto-saves all projects
# Restart server - auto-loads all projects
# Data persists across restarts!
Snapshots are automatically managed:
./data/snapshots/ (configurable via --data-dir){project-id}.bin, {project-id_lexicon}.bin, {project-id_aliases}.binSecure your CueMap instance with API key authentication.
Set an API key via environment variable:
# Single API key
CUEMAP_API_KEY=your-secret-key ./target/release/cuemap-rust --port 8080
# Multiple API keys (comma-separated)
CUEMAP_API_KEYS=key1,key2,key3 ./target/release/cuemap-rust --port 8080
Include the API key in the X-API-Key header:
# Without auth (fails if enabled)
curl http://localhost:8080/stats
# Response: Missing X-API-Key header
# With correct key
curl -H "X-API-Key: your-secret-key" -H "X-Project-ID: default" http://localhost:8080/stats
# Response: {"total_memories": 1000, ...}
# With wrong key
curl -H "X-API-Key: wrong-key" -H "X-Project-ID: default" http://localhost:8080/stats
# Response: Invalid API key
Python:
from cuemap import CueMap
# With authentication
client = CueMap(
url="http://localhost:8080",
api_key="your-secret-key"
)
client.add("Memory", cues=["test"])
TypeScript:
import CueMap from 'cuemap';
const client = new CueMap({
url: 'http://localhost:8080',
apiKey: 'your-secret-key'
});
await client.add('Memory', ['test']);
docker run -p 8080:8080 \
-e CUEMAP_API_KEY=your-secret-key \
cuemap/engine
Tests performed on Real-World Data (Wikipedia Articles), processing full natural language sentences with the complete NLP pipeline.
Hardware: MacBook Pro M1 Max (64GB RAM), Single-node, 3x cues per x memories.
*Measures the time to parse a raw sentence and extract semantic cues.
| Dataset Scale | Avg Latency | P50 (Median) | P99 (Stability) | Throughput | Scaling |
|---|---|---|---|---|---|
| 10,000 | 2.29 ms | 1.91 ms | 11.24 ms | ~436 ops/s | ā |
| 100,000 | 2.06 ms | 2.08 ms | 29.74 ms | ~327 ops/s | š¢ Flat |
| 1,000,000 | 2.34 ms | 2.00 ms | 10.91 ms | ~427 ops/s | š¢ O(1) |
Observation: Ingestion latency is effectively O(1). Increasing the dataset size by 100x (10k $\rightarrow$ 1M) resulted in zero latency penalty (2.00ms flat).
Measures the time to parse a query, perform pattern completion (context expansion), and intersect the semantic graph.
| Dataset Scale | Operation | Avg Latency | P50 (Median) | P99 (Tail) |
|---|---|---|---|---|
| 100,000 | Smart Recall (With PC) | 5.17 ms | 4.25 ms | 13.08 ms |
| Raw Recall (No PC) | 4.33 ms | 4.19 ms | 11.10 ms | |
| 1,000,000 | Smart Recall (With PC) | 11.57 ms | 10.97 ms | 26.17 ms |
| Raw Recall (No PC) | 7.18 ms | 6.65 ms | 15.82 ms |
Key Metrics:
CueMap can automatically propose cues for your memories using Semantic Engine or LLMs
No LLM required! By default, CueMap uses its internal Semantic Engine (WordNet) and Global Context to generate cues instantly.
# 1. Start CueMap (no Ollama needed)
./target/release/cuemap-rust
# 2. Add memory in natural language
curl -X POST http://localhost:8080/memories \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"content": "The payments service is down due to a timeout.",
"cues": []
}'
# Internal Engine proposes: ["payment", "service", "timeout", "outage", "failure", "payment_service", ...]
For deeper reasoning or document summarization, you can enable Ollama:
Configuration:
CUE_GEN_STRATEGY=default (Uses internal Semantic Engine. Set to ollama to force LLM usage).LLM_ENABLED=true|false (Default: false)LLM_PROVIDER=ollama (Default if LLM Strategy is selected).OLLAMA_URL=http://localhost:11434 (default)# Basic manual cues
curl -X POST http://localhost:8080/memories \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"content": "API Rate Limit Policy: 1000/min",
"cues": ["api", "rate_limit", "policy"]
}'
# Auto-generate cues via semantic engine (default) or LLM (if configured)
curl -X POST http://localhost:8080/memories \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"content": "The payments service is down due to a timeout.",
"cues": []
}'
curl -X POST http://localhost:8080/recall \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"cues": ["api", "rate_limit"],
"limit": 10
}'
curl -X POST http://localhost:8080/recall \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"query_text": "payments service timeout",
"limit": 10,
"explain": true
}'
Returns memories matching tokens mapped via the local Lexicon CueMap. Use "explain": true to see how the query was normalized and expanded.
curl -X PATCH http://localhost:8080/memories/{id}/reinforce \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"cues": ["important", "urgent"]
}'
Reinforcement is used to boost the relevance of a memory. It is a way to tell CueMap that a memory is important and should be recalled more often. It's on by default but you can manually reinforce a memory through API.
curl -H "X-Project-ID: default" http://localhost:8080/memories/{id}
curl -H "X-Project-ID: default" http://localhost:8080/stats
Manage synonyms and semantic mappings deterministically.
curl -X POST http://localhost:8080/aliases \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"from": "pay",
"to": "service:payment",
"weight": 0.9
}'
curl -X POST http://localhost:8080/aliases/merge \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"cues": ["bill", "invoice", "statement"],
"to": "service:billing"
}'
# Reverse lookup: Find all aliases for "service:payment"
curl -H "X-Project-ID: default" "http://localhost:8080/aliases?cue=service:payment"
curl -X POST http://localhost:8080/projects \
-H "Content-Type: application/json" \
-d '{"project_id": "my-project"}'
curl http://localhost:8080/projects
curl -X DELETE "http://localhost:8080/projects/default"
View incoming (tokens mapping to this cue) and outgoing (synonyms/hypernyms) edges.
curl "http://localhost:8080/lexicon/inspect/service:payment"
Manually connect a token to a canonical cue.
curl -X POST http://localhost:8080/lexicon/wire \
-H "Content-Type: application/json" \
-d '{
"token": "stripe",
"canonical": "service:payment"
}'
Remove a specific token from the lexicon.
curl -X DELETE "http://localhost:8080/lexicon/entry/cue:stripe"
Get all synonyms for a cue.
curl "http://localhost:8080/lexicon/synonyms/service:payment"
Extract content from a web page and ingest it.
curl -X POST http://localhost:8080/ingest/url \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com"
}'
Ingest text directly, simulating a file.
curl -X POST http://localhost:8080/ingest/content \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"content": "The quick brown fox jumps over the lazy dog.",
"filename": "fox.txt"
}'
Upload a file for processing by the Agent (supports Text, PDF, JSON, etc. if Agent is configured).
curl -X POST http://localhost:8080/ingest/file \
-H "X-Project-ID: default" \
--form "file=@/path/to/document.pdf"
curl -X POST http://localhost:8080/recall/grounded \
-H "X-Project-ID: default" \
-H "Content-Type: application/json" \
-d '{
"query_text": "Why is the server down?",
"token_budget": 500,
"limit": 10
}'
The "Hallucination Guardrail" module. Deterministically greedy-fills a token budget with the highest-scoring memories and produces a verifiable context block for LLM prompt injection.
Response:
{
"verified_context": "[VERIFIED CONTEXT] (1) Fact... Rules:...",
"proof": {
"trace_id": "966579b1-...",
"selected": [...],
"excluded_top": [...]
},
"engine_latency_ms": 1.45
}
To prevent prompt injection and guarantee data provenance, grounded recall responses now include a cryptographic signature.
The verified_context block is signed using HMAC-SHA256 (key: CUEMAP_SECRET_KEY). Clients can verify this signature to ensure the context hasn't been tampered with or fabricated by a man-in-the-middle or hallucinatory process before reaching the LLM.
{
"verified_context": "...",
"signature": "sha256:9b2d..."
}
Note: Diagrams available in GitHub Repositoryā .
Note: Diagrams available in GitHub Repositoryā .
Note: Diagrams available in GitHub Repositoryā .
Note: Diagrams available in GitHub Repositoryā .
The agent transforms your local filesystem into a semantic knowledge base with zero manual effort.
file:<path>:<hash>) to prevent memory duplication and ensure stale memories are pruned.CueMap bridges the gap between unstructured text and structured recall without relying on slow, non-deterministic vector search.
The Lexicon is a self-learning inverted index that maps natural language tokens to canonical cues.
Training Phase (automatic background job):
Note: Diagrams available in GitHub Repositoryā .
Resolution Phase (query time):
Note: Diagrams available in GitHub Repositoryā .
š„ Training Data:
Memory 1: "The payments service is experiencing high latency"
cues: ["service:payment", "status:slow"]
Memory 2: "Payment processing timeout error on checkout"
cues: ["service:payment", "error:timeout"]
Memory 3: "Database timeout causing payment failures"
cues: ["error:timeout", "component:database"]
š Lexicon State (simplified):
tok:payment ā [service:payment (2x), ...]
tok:timeout ā [error:timeout (2x), ...]
phr:payment_processing ā [service:payment]
phr:processing_timeout ā [error:timeout]
š Query: "payment timeout"
Tokenized: ["tok:payment", "tok:timeout", "phr:payment_timeout"]
Lexicon Recall:
- tok:payment matches ā service:payment (strong)
- tok:timeout matches ā error:timeout (strong)
- phr:payment_timeout matches ā nothing (no exact bigram)
ā
Result: ["service:payment", "error:timeout"]
| Factor | Impact | Example |
|---|---|---|
| Consistent terminology | ā High | Always use "payment" not "pay", "payments", "paid" |
| Rich training data | ā High | 100s of memories per cue |
| Token overlap | ā High | Query uses same words as content |
| Synonym handling | ā ļø Needs aliases | "pay" vs "payment" requires alias |
| Sparse data | ā Low | Only 1-2 memories per cue |
| Novel vocabulary | ā Low | Query uses completely new terms |
By making the Lexicon itself a CueMapEngine, ambiguous words automatically resolve based on your actual usage patterns through recency, intersection, and reinforcement:
Example: The word "run" has multiple meanings
Your System (DevOps focused):
Memory 1: "Pipeline run failed on deployment stage"
cues: ["ci:pipeline", "status:failed"]
Memory 2: "Container run terminated unexpectedly"
cues: ["container:docker", "status:terminated"]
Memory 3: "Cron job run completed successfully"
cues: ["job:cron", "status:success"]
Lexicon learns:
tok:run ā [ci:pipeline (most recent), container:docker, job:cron]
š Query: "run failed"
Lexicon Recall:
- tok:run matches ā ci:pipeline (position 0, most recent)
ā container:docker (position 1)
ā job:cron (position 2)
- tok:failed matches ā status:failed (strong)
Intersection + Recency scoring:
- ci:pipeline: high (recent, frequently reinforced if you query pipelines often)
- container:docker: medium
- job:cron: lower
ā
Result: ["ci:pipeline", "status:failed"]
š” If you were a fitness app instead, "run" would map to ["activity:running", "sport:cardio"]
based on YOUR domain's usage - same algorithm, different training data!
The Lexicon adapts to your domain's semantics automatically. No manual disambiguation rules needed!
Not all matches are equal. CueMap introduces a sophisticated weighting engine:
payments-service ā service:payments.Writes are instantaneous. Intelligence is eventual.
POST /memories returns a success ID with basic and cleaned cues.Debug your search relevance with the explain=true flag.
{
"explain": {
"query_cues": ["payments"],
"expanded_cues": [
["payments", 1.0],
["service:payments", 0.85]
]
},
"results": [
{
"content": "...",
"score": 145.2,
"explain": {
"intersection_weighted": 1.85,
"recency_component": 0.5
}
}
]
}
AGPLv3 - See LICENSE for details
For commercial licensing (closed-source SaaS), contact: [email protected]ā
Content type
Image
Digest
sha256:2d5ad504cā¦
Size
79.4 MB
Last updated
about 2 months ago
docker pull cuemap/engine