| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Structured memory retrieval for AI agents that returns evidence paths, not just top-k chunks. Think navigable memory in a memory-palace-style sense: a graph you can walk, not only a flat similarity list.
Memory Path Engine is a research-first prototype for moving beyond flat retrieval. Instead of treating memory as an unordered vector index, it models memory as typed nodes, edges, weights, and replayable paths so a system can retrieve, traverse, and explain how it reached an answer.
This repository is aimed at people exploring agent memory, graph-aware retrieval, and explainable evidence chains across more than one document shape.
Bundled markdown packs are ingested into an in-memory graph (MemoryNode / MemoryEdge, with weights). Retrievers return a MemoryPath: a composed answer plus ordered steps you can inspect. The CLI demo exercises exactly this path end to end.
Memory Palace v1 adds a parallel domain (memory_engine.memory): MemoryPalace, typed memories, and PalaceRecallResult (retrieved items + routes + activation snapshot). It maps to the same MemoryStore via palace_to_store, so existing retriever modes are unchanged. See docs/architecture.md for the compatibility picture.
examples/*_pack ──▶ ingest ──▶ MemoryStore (typed graph)
│
┌──────────────┼──────────────┐
▼ ▼ ▼
BaselineTopK other modes WeightedGraph
(flat answers) in `retrieve` (path + scores)
│
▼
stitched answer + replayable step list
Most RAG systems still look like this:
This repo explores a different question:
Can we retrieve a memory path instead of only retrieving similar chunks?
The prototype is built around three ideas:
Maintainers: configure the GitHub link-card image using docs/social-preview.md (docs/assets/open-graph-cover.png).
Install the project in editable mode:
python -m pip install --no-build-isolation -e .Run the test suite:
python -m unittest discover -s tests -vRun the runbook demo:
python -m memory_engine.demo --scenario runbookTerminal-style capture of real stdout (refresh with python scripts/generate_runbook_demo_terminal_svg.py; latency_ms may differ run to run):
Run the contract comparison demo:
python -m memory_engine.demo --scenario contractRun the HotpotQA tiny benchmark sanity check:
python scripts/run_hotpotqa_benchmark.pyRun the LongMemEval tiny benchmark sanity check:
python scripts/run_longmemeval_benchmark.pyPrint compact v1 palace metadata (spaces, routes, memory kinds) per case:
python scripts/run_longmemeval_benchmark.py --v1-recall-summaryGenerate a fixed-format Layer B report (path/route/space/lifecycle/activation snapshot):
python scripts/generate_layer_b_report.py --output "benchmarks/structured_memory/layer_b_report.json" --markdown-output "benchmarks/structured_memory/layer_b_report.md"Download the official HotpotQA dev distractor file for local benchmark runs:
python scripts/download_hotpotqa.pyDownload the cleaned LongMemEval-S file for local benchmark runs:
python scripts/download_longmemeval.pypython -m memory_engine.demo prints a small banner, the query, then path-aware output: a BEST ANSWER line built from the winning walk, and a REPLAY PATH with one line per hop (node id, score, via=<edge type>) plus short scoring reasons on the following lines. With --scenario contract, a BASELINE block (flat top-k answers) appears above the path-aware section for the same query.
Representative runbook excerpt (answer line shortened; latency and hop scores can vary slightly between runs):
========================================================================
Memory Path Engine | demo
scenario: runbook
========================================================================
-------------------------------- QUERY ---------------------------------
What should we do if rollback does not recover the API after a
deployment incident?
----------------- PATH-AWARE weighted graph retrieval -----------------
BEST ANSWER
… stitched runbook units … [latency_ms=…]
REPLAY PATH
1. 01_api_incident_runbook:5 | score=0.500 | via=seed
seed hit semantic=0.501
2. 01_api_incident_runbook:4 | score=0.299 | via=next_unit
expanded at hop 1 total=0.299 exception=0.450 contradiction=0.000
========================================================================
The runbook demo loads incident and recovery procedures, then asks a multi-step operational question:
What should we do if rollback does not recover the API after a deployment incident?
The output includes:
For a representative stdout excerpt, see What you will see (under Quick start).
The contract demo runs the same query through a baseline retriever and the weighted graph retriever. Stdout shows flat top-k answers first, then the path-aware best answer and replay steps, so you can compare shapes of evidence without relying on a single aggregate metric.
| Retriever | What it emphasizes | Useful for |
|---|---|---|
| lexical baseline | keyword overlap | simple lookups and sanity checks |
| embedding baseline | semantic similarity | paraphrases and fuzzy matches |
| structure-only traversal | graph connectivity | linked evidence exploration |
| weighted graph retrieval | structure plus importance weighting | multi-hop retrieval with replayable evidence |
| activation spreading v1 | explicit propagation with decay | graph diffusion experiments |
The core is meant to stay domain-agnostic. The current examples use both contract-like documents and runbooks because together they stress:
If the retrieval and replay ideas cannot survive across these document types, they are unlikely to generalize well to other structured knowledge domains.
The first milestone tests three claims:
The retrieval stack separates:
That separation makes it possible to compare lexical baseline, embedding baseline, structure-only traversal, and weighted graph retrieval without rewriting the main search loop.
The evaluation layer can emit detailed per-question reports, which is useful for miss analysis and ablation debugging instead of relying only on a single aggregate score.
The repository also includes a dedicated structured benchmark bounded context with:
The benchmark story is intentionally split into three layers:
Current run matrix:
For suggested GitHub topic tags (About section), see docs/github-topics.md.
MIT. See LICENSE.
| Back | FazBrowse Home | New Git URL |