Skip to main content
Trisynapse Memory logo

Trisynapse Memory

Ingest sources. Index memory.

Evidence-first memory for AI agents: ingest many kinds of data, retrieve the useful parts, and answer with citations.

Tests PyPI version npm version Supported Python versions Apache 2.0 license Project status: alpha

Quickstart · Interfaces · Architecture · API · Operations · Releases


Trisynapse Memory is a local-first memory engine for assistants, agents, and applications. It preserves source evidence in an ordered memory log, builds searchable indexes, and drills back to the evidence before returning an answer.

Use it when your application needs to remember conversations, documents, code, web pages, tables, images, or structured records—and you need to see where an answer came from.

Why Trisynapse?

Capability What it means
Source-aware Keeps pages, sections, rows, cells, files, symbols, line ranges, speakers, and timestamps.
Grounded Answers from the memory log evidence and returns citations—or abstains when confidence is too low.
Inspectable Saves retrieval stages, candidates, decisions, timings, and model provenance as query runs.
Local-first Runs with local embeddings and no completion API key by default. Add a provider only when you need generation or image understanding.
One engine Python, CLI, REST, Studio, and TypeScript share the same store and namespace model.

Quickstart

1. Install

macOS or Linux:

curl -LsSf https://github.com/shanmukh05/trisynapse-memory/releases/latest/download/install.sh | sh

Windows PowerShell:

irm https://github.com/shanmukh05/trisynapse-memory/releases/latest/download/install.ps1 | iex

Or install from PyPI:

pip install 'trisynapse-memory[all]'

Python 3.11 or newer is required. The first semantic search may download the default local embedding model. Re-run the installer to upgrade; uninstall with uv tool uninstall trisynapse-memory.

2. Store and recall something

trisynapse-memory init
trisynapse-memory add raw-source "Maya prefers three-bullet weekly updates."
trisynapse-memory query "How should I update Maya?"

No completion API key is required for this path. Without one, Trisynapse returns an extractive answer grounded in the retrieved evidence.

3. Open the interactive terminal

trisynapse-memory

Ask a question as plain text or enter / to browse commands. Suggestions narrow as you type; press Tab or Right Arrow to accept one. Useful commands include /ingest, /sources, /history, /model, /remove, and /check.

Ingest several source types together:

trisynapse-memory --project-id demo ingest \
  ./handbook.pdf ./src https://example.com/guide

trisynapse-memory --project-id demo query \
  "What does the handbook say about releases?"

Each source succeeds or fails independently. The run remains available for inspection and failed-item retries.

Choose how you use it

Surface Start here Best for
Interactive terminal trisynapse-memory Exploring memory, ingesting sources, and grounded questions
Scriptable CLI trisynapse-memory --help Automation, jobs, backups, validation, and benchmarks
Python MemoryEngine.from_env(...) In-process agents and applications
REST + Studio trisynapse-memory serve --studio A shared service and visual inspection
TypeScript npm install @trisynapse/trisynapse-memory Node.js or web backends calling the REST service

Python

from trisynapse_memory import MemoryEngine, MemoryNamespace, SourceInput

namespace = MemoryNamespace(user_id="maya", project_id="assistant")
memory = MemoryEngine.from_env(namespace=namespace)

try:
    memory.add("Maya prefers short weekly updates.", group_id="chat:1")

    memory.ingest_many([
        SourceInput(kind="file", path="./handbook.pdf"),
        SourceInput(kind="directory", path="./src"),
        SourceInput(kind="url", url="https://example.com/guide"),
    ])

    answer = memory.query("How should I write Maya's update?")
    print(answer.answer)
    for citation in answer.citations:
        print(citation.record_id, citation.locator)
finally:
    memory.close()

Use add() and add_many() for text that is already normalized. Use ingest() and ingest_many() for files, directories, URLs, repositories, archives, images, and mixed batches.

REST and Memory Studio

trisynapse-memory init
trisynapse-memory serve --studio

Open http://127.0.0.1:8765/studio/. The API token is stored at ~/.trisynapse-memory/store/.api-key; keep it private.

Studio gives you five focused views:

  • Memory Viewer — inspect the memory log and every index helper, then run live retrieval from the current item.
  • Sources — browse, preview, ingest, retry, download, and remove sources.
  • Queries — watch retrieval run step by step and reopen past workflows.
  • Configuration — choose completion, embedding, and retrieval settings.
  • Connection — select the server, token, and active namespace.

Health and OpenAPI are available at:

GET http://127.0.0.1:8765/api/v1/health
    http://127.0.0.1:8765/openapi.json

See API and interfaces for request contracts, asynchronous ingestion, SSE query runs, source previews, and graph endpoints.

JavaScript and TypeScript

The TypeScript package is a dependency-free Fetch client for the REST service.

npm install @trisynapse/trisynapse-memory
import { TrisynapseMemory } from "@trisynapse/trisynapse-memory";

const memory = new TrisynapseMemory({
  baseUrl: "http://127.0.0.1:8765",
  apiKey: process.env.TRISYNAPSE_MEMORY_API_KEY,
  namespace: { project_id: "demo", user_id: "maya" },
});

await memory.add("Maya prefers short weekly updates.");
const answer = await memory.query("How should I update Maya?");

console.log(answer.answer);
console.log(answer.citations);

The client also covers mixed ingestion, source previews, query runs, memory graphs, lifecycle operations, model selection, retrieval configuration, and connection checks.

How memory works

flowchart LR
    S["Sources"] --> F["Ingest<br/>load and structure"]
    F --> T["Memory log<br/>ordered evidence"]
    T --> R["Indexes<br/>searchable views"]
    Q["Question"] --> P["Retrieval<br/>plan and route"]
    R --> P
    P --> G["Ground in the memory log"]
    G --> A["Answer or abstain<br/>with citations"]
  1. Ingest loads a source and keeps its useful structure.
  2. Memory log stores the resulting evidence in order with provenance and lifecycle state.
  3. Indexes build replaceable search structures, graph connections, group summaries, and claims.
  4. Retrieval searches several routes, fuses candidates, and drills back to the memory log.
  5. Grounding creates an answer with citations or abstains.

The memory log is an application data store, not a cryptographic ledger. validate checks SQLite consistency, sequence continuity, evidence references, and retained source blobs. index data can be rebuilt; cited evidence always comes from the memory log.

Read the architecture guide →

Sources and retrieval

Supported source types
Category Sources
Documents Text, Markdown, HTML, PDF, DOCX, and PPTX
Structured data JSON, JSONL, YAML, CSV, and XLSX
Code Files, directories, repositories, notebooks, ZIP, and TAR archives
Media PNG, JPEG, and WebP with a vision-capable completion model
Network One public web page or public HTTPS Git repository per source

Code keeps repository paths, languages, symbols, imports, line ranges, file identity, and Git provenance. Repositories honor .gitignore and .trisynapseignore. Tables keep sheets, rows, and cells; documents keep pages and sections; conversations keep speakers and timestamps.

Accepted originals are retained in content-addressed storage and included in backups. The store is permission-restricted but not encrypted at rest.

Retrieval routes and query history

Trisynapse can route a question through lexical, semantic, temporal, graph, code, table, image, document, and conversation retrieval. It fuses and reranks candidates under per-source and total context budgets before grounding.

Every query run can retain executed steps, route candidates, scores, decisions, durations, citations, retrieval configuration, prompt provenance, and provider/model provenance. It never stores API keys, authorization headers, embeddings, hidden model reasoning, or full system prompts.

Models are optional

The default setup uses local SentenceTransformers embeddings and no completion provider. Add completion when you want generated answers, richer extraction and indexes, or image understanding.

export ANTHROPIC_API_KEY="your-key"
trisynapse-memory models set completion anthropic claude-sonnet-4-5
trisynapse-memory models test --role completion

Or run the interactive terminal and enter /model to search provider catalogs and select models.

Supported providers and credential variables
Provider Completion Embedding Credential
OpenAI ✓ ✓ OPENAI_API_KEY
OpenRouter ✓ ✓ OPENROUTER_API_KEY
Gemini ✓ ✓ GEMINI_API_KEY
Anthropic ✓ — ANTHROPIC_API_KEY
DeepInfra ✓ ✓ DEEPINFRA_API_TOKEN
DeepSeek ✓ — DEEPSEEK_API_KEY
Kimi ✓ — MOONSHOT_API_KEY
OpenAI-compatible ✓ ✓ OPENAI_COMPATIBLE_API_KEY when required
SentenceTransformers — ✓ None

Qwen models appear through OpenRouter or DeepInfra when their live catalogs provide them. Model choices are stored per memory store; credentials remain environment-only.

Changing completion affects future work only. Changing embeddings on a non-empty store requires confirmation and builds a complete replacement index before switching. A failed rebuild leaves the old index active.

Provider setup and model behavior →

Memory lifecycle

Operation Meaning
correct() Add a replacement while preserving what changed.
forget() Logically retract memory while retaining authorized history.
remove() Physically redact selected memory content.
remove_source() Remove an original source and all memory derived from it.

Namespaces isolate memory by project and optionally by user, agent, and session. The same namespace rules apply to Python, CLI, REST, Studio, and TypeScript.

Documentation

Read this When you need to…
Architecture Understand Ingest, memory log, indexes, retrieval, graphs, and storage
Algorithms Study mathematical formulas, RRF, confidence margin, and grounding
API and interfaces Use Python, REST, SSE, TypeScript, or CLI contracts
Operations Configure providers, deploy Studio, back up, restore, or troubleshoot
Release notes See what changed in each version
Contributing Set up development and submit changes
Security Understand the deployment boundary or report a vulnerability

Release notes

Published installers and packages are on GitHub Releases. Written notes for each version live in docs/releases/.

Version Notes
v0.2.0 Memory Log and Indexes architecture refactoring, formal algorithmic specifications, group summaries, evidence-grounded facts, and multi-item ingestion APIs.
v0.1.3 Memory Viewer catalog, trusted Python extension packs, non-persistent search, and a starter notebook.
v0.1.2 Retrieval profiles, token-aware grounding, store validation, and the @trisynapse/trisynapse-memory npm package. Includes breaking CLI, REST, and SDK renames.
v0.1.1 Installers pin 0.1.1; tagged releases always rebuild and publish.
v0.1.0 First public alpha of the memory log and index engine.

Development and benchmarks

pip install -e '.[dev,all]'
pytest -q
ruff check src tests scripts

pnpm install --frozen-lockfile
pnpm --filter @trisynapse/trisynapse-memory check
pnpm --filter @trisynapse/studio test

Benchmark adapters support LoCoMo, LongMemEval, HaluMem, and MemoryDoc. Retrieval mode measures the evidence pipeline without answer-generation calls; end-to-end mode adds provider-backed formation, answering, and judging.

trisynapse-memory bench run locomo \
  --mode retrieval --data-root data/locomo --max-questions 100

trisynapse-memory bench gate --mode retrieval --data-root data

See the benchmark operations guide before treating a result as a release gate.

License

Apache 2.0

Metadata

Release files for trisynapse-memory 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trisynapse-memory 0.2.0
File Size Uploaded
trisynapse_memory-0.2.0.tar.gz 899.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trisynapse-memory 0.2.0
File Interpreter ABI Platform
trisynapse_memory-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / trisynapse_memory-0.2.0.tar.gz

Download URL trisynapse_memory-0.2.0.tar.gz
Size 899.5 kB
Tags Source
SHA-256 checksum
How to use checksums
767c921910dbbf7f28349ce63f2d70b709d3b13baa132334533d1c48e4cf97fd
BLAKE2b-256 checksum
How to use checksums
040fe765cfbf7cf5484fd3c2f49d8579edc647b954c5cd4fe6d00b2bb98bc7bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / trisynapse_memory-0.2.0-py3-none-any.whl

Download URL trisynapse_memory-0.2.0-py3-none-any.whl
Size 887.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e8819363742df36c67d03faf06b1e94f5db73d3db4cbcaaf799bf372f1eb98d
BLAKE2b-256 checksum
How to use checksums
11b59b60e2c313ac907af3fd277bc887725d0fb62b8846536b34710f1086c1e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page