Fracktal MCP
OfficialThis server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Fracktal MCP - Event-Sourced, Verifiable Memory for AI Agents
By GoryGrey | Gregory Betti
Fracktal MCP is a local, plug-and-play MCP server that turns every agent action-tool calls, diffs, tests, plans-into an immutable, lossless event log. Agents can resume any project with a single restore_working_set call, search through hybrid structural/lexical/vector indexes, and verify historical context via SHA256-stamped artifacts. Everything runs locally by default, with optional embeddings for semantic recall.
Why teams use Fracktal MCP
Event-sourced timeline - Every tool run, file diff, test result, decision, and checkpoint is stored as a typed event with content-addressed payloads.
Lossless & auditable - Storage is powered by the FRACKTAL recursive symbolic engine; compression is reversible and verifiable (hashes match byte-for-byte on restore).
Hybrid retrieval - Structural fingerprints (FRACKTAL symbols) are fused with BM25 lexical scoring and optional sentence-transformer embeddings, plus metadata filters.
Working-set restore - Cold-start an agent by pulling the latest checkpoint, recent diffs/logs/tests, and open decisions in one tool call.
Local-first - Runs entirely on your machine; embeddings (if enabled) can use local transformer weights. No network calls unless you opt in.
Related MCP server: Worktrail
Quick start
git clone https://github.com/GoryGrey/Fracktal-MCP.git
cd Fracktal-MCP
python -m venv .venv
# Windows PowerShell
.venv\Scripts\Activate.ps1
# macOS / Linux
# source .venv/bin/activate
pip install -e .
# run the MCP server locally
python -m mcp_server.serverConfigure your MCP client (Claude Desktop example):
{
"mcpServers": {
"fracktal-memory": {
"command": "python",
"args": ["-m", "mcp_server.server"],
"cwd": "/path/to/FRACKTAL"
}
}
}Optional embeddings (hybrid retrieval adds vectors on top of structural+BM25):
pip install sentence-transformers
export FRACKTAL_ENABLE_EMBEDDINGS=1
# optional: override model
export FRACKTAL_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2Optional extras:
pip install -e .[dev] # pytest, notebooks, formatting tools
pip install -e .[viz] # matplotlib, seaborn, plotly, graphviz
pip install -e .[full] # everything aboveStorage location can be overridden with FRACKTAL_STORAGE_DIR=/path/to/memories.
Working with any MCP-capable agent
Fracktal MCP exposes a clean tool surface so every agent (Claude Desktop, Cursor, Bespoke python loops, etc.) can persist its lifecycle without bespoke glue. See docs/mcp_usage.md for recommended prompts/policies.
Tool | Purpose |
| Raw lossless storage (notes, transcripts, artifacts). |
| Capture tool inputs/outputs + status. |
| Persist diffs or file snapshots (auto-tagged by |
| Store test metadata + logs. |
| Maintain working-set summaries & plans. |
| Filter event timeline by project/type. |
| Hybrid structural/BM25/(optional) embedding retrieval with metadata filters. |
| Return latest checkpoint + grouped recent events so an agent can resume instantly. |
Everything is scoped by project_id, session_id, event_type, tags, and optional path metadata. Use those knobs to isolate multiple repos or workloads on the same server.
Working-set restore in practice
// restore_working_set(project_id="alpha-app", recent_limit=10)
{
"project_id": "alpha-app",
"checkpoint": {
"content": "Checkpoint body ...",
"metadata": {
"summary": "After fixing login regression",
"tags": ["plan", "checkpoint"],
"timestamp": 1734417680.12,
"id": "d6f5..."
}
},
"recent_events": {
"file_diff": [
{"id": "a1b2...", "path": "src/auth.py", "summary": "File change: src/auth.py"}
],
"test_result": [
{"id": "c3d4...", "summary": "Test test_login: failed", "tags": ["tests"], "timestamp": 1734417671.44}
],
"tool_run": [
{"id": "e5f6...", "summary": "Tool pytest (failure)", "tags": ["logs", "pytest"]}
],
"note": [],
"decision": [],
"plan_update": []
},
"recent_count": 5
}An agent can immediately reload goals, the latest plan, and the precise diffs/tests/logs needed to continue coding-even after days offline.
Hybrid retrieval & metadata filters
search_memories fuses three complementary scores:
Structural - Jaccard similarity over FRACKTAL symbolic fingerprints (lossless structural understanding).
Lexical (BM25) - Default dependency; great for identifiers, error messages, stack traces.
Vector (optional embeddings) - Sentence-transformer cosine similarity for paraphrases.
Weights are tuned to favor structural matches while still surfacing lexical/vector results. Every search call supports filters: project_id, session_id, event_types, kinds, tags, path. Pass an empty query to fetch the most recent scoped events.
Testing, benchmarking, and verification
Automated tests
python -m pytestThe automated suite covers:
FRSOE primitives and lossless reconstruction.
Project-aware MCP flows including storage, filters, checkpoints, and working-set restore.
Recovery from a missing
index.jsonby rebuilding metadata from stored codices.
Stress & throughput profiling
python stress_test_demo.py --num-memories 100 --storage-dir benchmark_memories --sample-size 15100 synthetic memories stored in ~5.5s on a Windows 11 workstation (Python 3.13) -> ~18 mem/s.
0 integrity errors (perfect recall).
Semantic search latency: ~4-7 ms/query for a single-result search (structural + BM25).
Deterministic benchmark harness
python benchmarks/run_benchmarks.py --storage-dir tmp_bench --output bench_report.json
cat bench_report.jsonSample output (reproducible, uses SHA256 equality to prove lossless storage):
{
"lossless_failures": [],
"records": 5,
"memories_per_second": 20.86,
"retrieval": {
"fracktal": {"recall_at_5": 1.0, "mrr": 0.83},
"bm25_only": {"recall_at_5": 1.0, "mrr": 0.75}
}
}Use this harness in CI to catch regressions in lossless recall or hybrid ranking.
Local LLM context benchmark
With Ollama running locally, compare full-history prompting against Fracktal-assisted context retrieval:
python benchmarks/run_ollama_context_benchmark.py --model qwen2.5-coder:1.5b --output ollama_context_benchmark.json
python benchmarks/run_ollama_context_stress.py --models qwen2.5-coder:1.5b,llama3.2:1b --trials 2 --noise-profiles 24:12 80:40 --output ollama_context_stress.jsonThese scripts record actual Ollama counters such as prompt_eval_count and eval_count, so token-usage comparisons are measured from the model runtime rather than estimated offline.
Release smoke checklist
python -m pip install -e .[dev]
python -m pytest
python benchmarks/run_benchmarks.py --storage-dir tmp_bench --output bench_report.json
python -m mcp_server.serverBefore shipping, verify:
install works in a fresh virtualenv
restore_working_setreturns the expected checkpoint and recent eventsthe chosen storage directory is writable
optional embedding mode is either enabled and tested or explicitly left off
Architecture snapshot
FRACKTAL Engine (FRSOE) - Recursive symbolic ontology that produces reversible codices for every artifact (see appendix).
Event Store - Disk-backed, content-addressed JSON codices plus a metadata index (
fracktal_memories/index.json).Indexes - Symbol frequency lists, BM25 corpus, and optional embedding vectors kept in sync as events arrive.
MCP Surface -
mcp_server/server.pyexposes typed tools for storage, retrieval, event logging, checkpoints, and working-set restore.
Because everything is append-only and hashed, you can rebuild indexes safely or audit change history at any time.
Documentation
docs/mcp_usage.md - Agent integration guide, recommended tool policies, and JSON examples.
docs/concepts.md - A deeper look at FRSOE symbolism, fractal hashing, and entropy preservation.
docs/ollama_benchmark_report.md - Overnight local-model benchmark results, token-savings summary, and failure analysis.
docs/release_readiness.md - Pre-release checklist for install, verification, smoke tests, and persistence recovery.
Stress/benchmark scripts -
stress_test_demo.py,benchmarks/run_benchmarks.py.
Contributions are welcome via standard GitHub PRs; see CONTRIBUTING.md.
Appendix: FRSOE compression highlights
The MCP server is powered by the FRACKTAL Recursive Symbolic Ontology Engine (FRSOE). For completeness, the original compression characteristics are preserved below.
Compression performance
Data Type | Compression Ratio | Pattern Detection | Reconstruction |
Highly Repetitive | 6.28x | Excellent | Perfect |
Structured Data | 2.46x | Excellent | Perfect |
Mixed Content | 1.17-1.43x | Good | Perfect |
Low Repetition | 1.17x | Moderate | Perfect |
Computational efficiency
Compression speed: 0.003-0.085 s typical payloads
Reconstruction speed: 0.001-0.003 s
Memory usage: CPU-only, low overhead
Scalability: Near-linear with input size
Citation
If you use FRACKTAL in research, please cite:
@software{fracktal2024,
title={FRACKTAL: Fractal Recursive Symbolic Ontology Engine},
author={Betti, Gregory},
year={2024},
url={https://github.com/GoryGrey/Fracktal-MCP}
}License / Contact
MIT License for non-commercial use. Commercial licensing: gorygrey@protonmail.com.
GitHub: @GoryGrey
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Project memory, documentation and controlled secret access for AI coding agents.
Universal persistent memory and knowledge retrieval layer for AI agents and LLMs.
Persistent memory for AI agents: save, search and connect context across tools and sessions.
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides persistent project memory for AI coding agents, enabling context retention across sessions via event logging, briefing generation, and querying.MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to record and resume engineering work as durable, byte-exact threads of focus, decisions, evidence, and next steps.4304Functional Source , Version 1.1, ALv2 Future
- AlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to persist context across sessions by saving, searching, checkpointing, restoring, and organizing decisions, progress, files, and Git-related state.150 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to persistently save, search, and restore project context across sessions, including decisions, progress, file caches, checkpoints, and channel-based memory. It supports git-aware organization, batch operations, and shared memory across parallel sessions.150 npmMIT