Skip to main content

Language-agnostic associative memory runtime for persistent AI systems

Project description

Intentmind

Intentmind is a lightweight associative memory runtime for AI assistants and agent systems. It stores memories as chunks, extracts intent nodes, connects co-occurring intents in a graph, and retrieves context through a mix of direct semantic match and graph traversal.

The goal is to surface relevant context that a plain top-k vector search can miss when the user mentions a related concept instead of the exact old fact.

What It Is

  • A Python memory layer for LLM apps, assistants, copilots, and experiments.
  • A graph-backed recall runtime with explainable paths such as car -> insurance.
  • A small library API: add, query, save, load, tick, graph_summary, and visualize.
  • Optional integrations for FAISS, SentenceTransformers, LangChain, and a demo FastAPI/React chat UI.

Intentmind is not a full agent framework, vector database, hosted service, or chatbot by itself.

Quick Start

pip install -e ".[dev]"
from intentmind import IntentmindMemory

mem = IntentmindMemory(is_test=True)

mem.add("I need car insurance but I have no money.")
mem.add("I bought a new car and will drive to London.")

result = mem.query("I have a car and I am going to London.")

for item in result["memories"]["items"]:
    print(item["layer"], item["intent"], item["path"], item["text"])

For production embeddings:

pip install -e ".[sentence-transformers]"
from intentmind import IntentmindMemory
from intentmind.embeddings import SentenceTransformerEmbedder

mem = IntentmindMemory(embedder=SentenceTransformerEmbedder())

Optional Features

pip install -e ".[faiss]"       # FAISS-backed intent index
pip install -e ".[langchain]"   # LangChain retriever adapter
pip install -e ".[vis]"         # graph visualization
pip install -e ".[llm]"         # OpenAI-backed intent extraction examples
pip install -e ".[api]"         # FastAPI demo backend dependencies

If you use OpenAI-backed examples or the demo API, create a local .env from .env.example and set OPENAI_API_KEY.

Core API

chunk_id = mem.add("The car insurance expires next week.", source="user")
result = mem.query("I am planning a road trip.")

print(result["prompt"])
print(result["memories"]["items"])
print(result["trace"])
print(result["cognitive_field"])

Each accepted memory item includes the chunk text, score, layer, triggering intent, path, reason, and edge metadata when the item was reached through the graph.

How Recall Works

  1. add() embeds the memory chunk and extracts candidate intents.
  2. Intents are reused or created, then co-occurrence edges are reinforced.
  3. query() extracts query intents, activates matching graph nodes, and runs a query-time cognitive field step.
  4. Recall selects direct memories, one-hop associated memories, and optional weak echo memories.
  5. PromptBuilder assembles an LLM-ready prompt with relevant memories and traceable context.

Persistence

mem.save("memory_snapshot.json")
restored = IntentmindMemory.load("memory_snapshot.json", is_test=True)

Generated memory snapshots are ignored by default so local experiments do not leak into the repository.

LangChain Adapter

from intentmind import IntentmindMemory
from intentmind.integrations.langchain import IntentmindRetriever

memory = IntentmindMemory(is_test=True)
retriever = IntentmindRetriever(memory=memory)
docs = retriever.invoke("How does the energy model work?")

Demo API And UI

Backend:

pip install -e ".[api]"
$env:PYTHONPATH="src"; python api.py

UI:

cd ui
npm install
npm run dev

The UI expects POST /api/chat to be reachable from the same origin or through a local proxy.

Benchmarks

Benchmark fixtures live under tests/fixtures. They are useful for regression testing and local comparison against a classic vector-search baseline, but they should not be treated as independent research claims.

$env:PYTHONPATH="src"; python examples/run_benchmark.py
$env:PYTHONPATH="src"; python examples/run_real_world_benchmark.py

Generated benchmark outputs are ignored by Git.

Development

$env:PYTHONPATH="src"; python -m pytest -q
cd ui
npm install
npm run lint
npm run build

Current local verification: 26 passed; UI lint and production build pass.

Repository Layout

src/intentmind/          Python package
tests/                   Unit and regression tests
tests/fixtures/          Deterministic benchmark fixtures
examples/                Usage demos and benchmark runners
ui/                      Optional React/Vite demo
api.py                   Optional FastAPI demo backend

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

intentmind-0.1.0.tar.gz (49.6 kB view details)

Uploaded Source

Built Distribution

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

intentmind-0.1.0-py3-none-any.whl (44.1 kB view details)

Uploaded Python 3

File details

Details for the file intentmind-0.1.0.tar.gz.

File metadata

  • Download URL: intentmind-0.1.0.tar.gz
  • Upload date:
  • Size: 49.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for intentmind-0.1.0.tar.gz
Algorithm Hash digest
SHA256 69b4837420c537eb9d4e2b6b1ae2c2c47eb8ffe1d43d4930fdd431e611b5787f
MD5 18bf9555570d1bd1a4a67c759efb5f03
BLAKE2b-256 2e2862370e44a6773fb7557d2b53d6b5449a9f5e3964465f03786e0367203683

See more details on using hashes here.

File details

Details for the file intentmind-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: intentmind-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for intentmind-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6bf661b7db3978bbdbeab68c1b996a27b5972c70258225bebb00d5815ceec86
MD5 b96f83e9321243be8c2bd66590e674a8
BLAKE2b-256 634fd42963702ecf66d2dabf9ca733bfe75c5ef6c10eb1ffc9963db394382779

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