Persistent context for AI coding agents. No cloud. Just markdown.
Project description
poma-memory
Your AI agent loses context every session. poma-memory gives it back.
AI coding agents (Claude Code, Cursor, Copilot) accumulate valuable project knowledge — decisions, architecture notes, task history — in markdown files (.claude/, .cursor/, .github/copilot/). But when context windows fill up or sessions restart, that knowledge becomes invisible. Grep finds strings; it doesn't understand structure.
poma-memory indexes those markdown files and returns complete, readable context — not disconnected snippets. When you search for "auth middleware", you get the matching paragraph plus its parent headings and surrounding context, assembled into a coherent cheatsheet with [...] gap markers. The result reads like a compressed version of the original document.
No POMA account or API key required. Free, local, open-source.
The Problem
Standard search (grep, embeddings over flat chunks) breaks document structure:
- Orphaned content — a paragraph arrives without its heading, so the agent doesn't know what section it belongs to
- Lost hierarchy — a nested list item loses its parent context
- Fragment soup — five hits from the same file come back as five disconnected blocks instead of one readable summary
For agent memory files — which are deeply hierarchical by design — this means the agent retrieves text but not understanding.
The Solution
poma-memory preserves the full document hierarchy during chunking. Every retrieval unit is a root-to-leaf path through the heading tree, so results always carry complete context. Multiple hits from the same file are merged into a single cheatsheet.
This is an open-source extraction of POMA's heuristic chunking engine, optimized for the clean, consistent markdown that AI agents produce.
Install
pip install poma-memory # BM25 keyword search (always works)
pip install poma-memory[semantic] # + model2vec local embeddings (30MB, no API key)
pip install poma-memory[openai] # + OpenAI text-embedding-3-large
pip install poma-memory[mcp] # + MCP server for Claude Code
pip install poma-memory[semantic,mcp] # recommended combo
Quick start
poma-memory index .claude/ # index your context files
poma-memory search "authentication middleware" --path .claude/ # search
MCP server (Claude Code)
Add poma-memory as an MCP server so Claude Code can search your project memory automatically:
claude mcp add --transport stdio --scope user poma-memory -- poma-memory-mcp
# Exposes poma_search, poma_index, poma_status tools
Once added, Claude Code can call poma_search during planning and exploration to surface relevant decisions, patterns, and context from prior sessions.
Python API
from poma_memory import index, search, status
index(path=".claude/")
results = search("session context", path=".claude/", top_k=5)
for r in results:
print(f"{r['file_path']} (score: {r['score']:.4f})")
print(r['context'])
How it works
- Hierarchical chunking. Markdown is parsed into depth-annotated chunks that preserve heading hierarchy, lists, code blocks, and tables.
- Chunkset assembly. Leaf chunks are paired with their ancestors into self-contained retrieval units (root-to-leaf paths), so every result carries full context.
- Hybrid search. BM25 keyword matching (always available) + optional semantic vectors, merged via Reciprocal Rank Fusion.
- Cheatsheet merging. Multiple hits from the same file are merged into one block with
[...]gap markers — reads like a summary, not a list of excerpts. - Incremental indexing. Append-only files (like agent context logs) only process new content on re-index.
Search backends
| Backend | Install | Requires | Best for |
|---|---|---|---|
| BM25 | included | nothing | exact term matching |
| model2vec | [semantic] |
30MB local model | general-purpose, no API key |
| OpenAI | [openai] |
OPENAI_API_KEY |
highest quality |
Multiple backends are automatically fused via Reciprocal Rank Fusion when available.
What this is (and isn't)
poma-memory extracts the heuristic chunking and retrieval logic from POMA's document processing platform. It works well on clean, predictable markdown — exactly what agents produce.
It does not include POMA's ML-powered indentation analysis, fine-tuned embedding models, or cloud processing pipeline. For complex document processing (scanned PDFs, inconsistent formatting, enterprise scale), see poma-ai.com.
Built for
- AI coding agents that persist context in markdown (
.claude/,.cursor/,.github/copilot/) - Megavibe multi-agent framework (ships with poma-memory integration)
- Claude Code hook pipelines (augment Grep results with semantic context)
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file poma_memory-0.3.4.tar.gz.
File metadata
- Download URL: poma_memory-0.3.4.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b21983f58da9c63a2aa4f6506fb25970f187f5f921bbc82c8374e0cd9fc1228
|
|
| MD5 |
69333c19d2be20faa4c7d264f892340f
|
|
| BLAKE2b-256 |
53c3d2ce96cdcb76c92d36c30fae8c3fe3606af798ac39624c333d061239b3e3
|
Provenance
The following attestation bundles were made for poma_memory-0.3.4.tar.gz:
Publisher:
pypi-publish.yml on poma-ai/poma-memory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
poma_memory-0.3.4.tar.gz -
Subject digest:
3b21983f58da9c63a2aa4f6506fb25970f187f5f921bbc82c8374e0cd9fc1228 - Sigstore transparency entry: 1375507811
- Sigstore integration time:
-
Permalink:
poma-ai/poma-memory@cbb03f30a9660cef70321bac52707405bb7bc284 -
Branch / Tag:
refs/tags/0.3.4 - Owner: https://github.com/poma-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@cbb03f30a9660cef70321bac52707405bb7bc284 -
Trigger Event:
push
-
Statement type:
File details
Details for the file poma_memory-0.3.4-py3-none-any.whl.
File metadata
- Download URL: poma_memory-0.3.4-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4784175156dfe02c2d597dc81ecb82047dd1452afc43500ea0ac1f1297492154
|
|
| MD5 |
da76bc222f9e7e5c6d527ac6ec673707
|
|
| BLAKE2b-256 |
ac7ae00feada381b49db53db6f61e6a92ebf1eb36003480b028fb8331cbec7b5
|
Provenance
The following attestation bundles were made for poma_memory-0.3.4-py3-none-any.whl:
Publisher:
pypi-publish.yml on poma-ai/poma-memory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
poma_memory-0.3.4-py3-none-any.whl -
Subject digest:
4784175156dfe02c2d597dc81ecb82047dd1452afc43500ea0ac1f1297492154 - Sigstore transparency entry: 1375507815
- Sigstore integration time:
-
Permalink:
poma-ai/poma-memory@cbb03f30a9660cef70321bac52707405bb7bc284 -
Branch / Tag:
refs/tags/0.3.4 - Owner: https://github.com/poma-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@cbb03f30a9660cef70321bac52707405bb7bc284 -
Trigger Event:
push
-
Statement type: