Skip to main content

Append-only JSONL memory store with type-aware indexing and BM25 search

Project description

siftmem

Append-only JSONL memory store for AI agents and workflows. Siftmem provides type-aware indexing, BM25 keyword search, and optional LLM-assisted importance scoring, consolidation, and session capture.

Core features work fully offline — no API key required for append, index, search, or dedup.

Install

pip install siftmem

From source:

git clone https://github.com/josefrancisco81788/siftmem.git
cd siftmem
pip install -e .

Optional extras:

pip install siftmem[llm-openai]   # OpenAI provider for capture/consolidate/score-assist
pip install siftmem[dev]          # pytest, build, twine

5-minute quickstart

pip install siftmem
siftmem-init
siftmem-search "getting-started" --json
siftmem-append --type fact --topic my-topic --content "Your first memory."
siftmem-build-index
siftmem-doctor

--importance is optional; siftmem defaults to the type floor plus a small margin.

Works offline vs needs LLM

Feature API key required?
siftmem-append (default importance) No
siftmem-build-index No
siftmem-search No
Dedup / supersession No
siftmem-init, siftmem-doctor No
--score-assist Yes (when SIFTMEM_LLM_PROVIDER is set)
siftmem-consolidate Yes
siftmem-capture Yes

Environment variables

Variable Required Default Purpose
SIFTMEM_MEMORY_DIR No ~/.siftmem/memory Canonical JSONL store
SIFTMEM_LLM_PROVIDER No none LLM backend: none, gemini, openai
SIFTMEM_LLM_MODEL No provider default Model override
GEMINI_API_KEY For gemini provider Gemini API access
OPENAI_API_KEY For openai provider OpenAI API access
SIFTMEM_HOME No ~/.siftmem Base dir for session capture (agents/main/sessions)

Usage

export SIFTMEM_MEMORY_DIR=~/.siftmem/memory

# Append a memory (importance optional)
siftmem-append --type decision --topic my-topic \
  --content "Always validate inputs before indexing."

# Optional LLM-refined importance
export SIFTMEM_LLM_PROVIDER=gemini
export GEMINI_API_KEY=your-key
siftmem-append --type decision --topic my-topic \
  --content "..." --score-assist

# Build markdown + BM25 index
siftmem-build-index

# Keyword search with filters
siftmem-search "workflow-email-triage" --type decision --json
siftmem-search "paths /tmp/foo" --explain --json

Python API

from pathlib import Path
from siftmem import MemoryStore

store = MemoryStore(Path("~/.siftmem/memory"))
store.append(
    type="decision",
    topic="onboarding",
    content="Always rebuild the index after batch writes.",
    importance=0.9,
    rebuild_index=True,
)
hits = store.search("onboarding", max_results=5)
print(store.stats())

Package layout

Module Role
siftmem.store MemoryStore Python API
siftmem.lib Shared library (load, dedup, BM25)
siftmem.llm Pluggable LLM JSON generation
siftmem.append Append entries to canonical JSONL files
siftmem.build_index Build markdown retrieval index + BM25 sidecar
siftmem.search BM25 keyword search over JSONL corpus
siftmem.init_cmd Bootstrap a new memory store
siftmem.doctor Health checks
siftmem.consolidate Weekly topic synthesis (LLM)
siftmem.session_capture Extract memories from agent session transcripts

Generated artifacts (under SIFTMEM_MEMORY_DIR)

Path Role
facts.jsonl, decisions.jsonl, etc. Append-only canonical store
siftmem_index/ Markdown index (topic__*.md, SIFTMEM_INDEX.md)
siftmem_bm25_index.json BM25 search corpus

Memory types and importance floors

Type Index floor Default append
decision 0.85 0.90
preference 0.80 0.85
lesson 0.70 0.75
fact 0.60 0.65

Entries below the floor for their type may be excluded from the markdown index unless they are the only entry for a topic (fallback indexing).

Development

pip install -e ".[dev]"
pytest -q

License

MIT — see LICENSE.

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

siftmem-0.2.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

siftmem-0.2.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file siftmem-0.2.0.tar.gz.

File metadata

  • Download URL: siftmem-0.2.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for siftmem-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a8ccc0679e35382188436d7fe41ff4dc577e75ebb853224f5ad59eba450968bb
MD5 db51ed0ac50321745852640e7989f6b5
BLAKE2b-256 76aeeb2314434e528daefdd3f4084cfd5d6abf4fc34d4d65ad12929db0e9b181

See more details on using hashes here.

File details

Details for the file siftmem-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: siftmem-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for siftmem-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35c65abfbe9ec37072c1355ce7a4e9674aa276c09ed5e849e015795f629a36ed
MD5 63f66a681beadafb628183568e5a723c
BLAKE2b-256 42224d65a7399356cf28f1d7c2e1b964aaddbf705aea8914b7fd748ec08737c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page