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.2.tar.gz (49.4 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.2-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intentmind-0.1.2.tar.gz
  • Upload date:
  • Size: 49.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for intentmind-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1e36c56869b8232e5f952a44f4cc652f89834b881bbb70753331fa3a02020909
MD5 d386b837a54b9b8f5726b5235c99f43a
BLAKE2b-256 e50e47bee3486718d01d5bb889e1c298538b9b5367bc0cfc1a731bc59db31e88

See more details on using hashes here.

Provenance

The following attestation bundles were made for intentmind-0.1.2.tar.gz:

Publisher: publish.yml on avnialkan/intentmind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: intentmind-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for intentmind-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 abd3ded1a6a332da3f0931860b1735b184930d6c4c9afdd7261584d186a6e08b
MD5 e5e37d84a70cdd6f1e0e998a68daaa7c
BLAKE2b-256 442539af3b632b5e4b87a8cf3adb91f158437a790701f5b5efc175ae75476959

See more details on using hashes here.

Provenance

The following attestation bundles were made for intentmind-0.1.2-py3-none-any.whl:

Publisher: publish.yml on avnialkan/intentmind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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