Persistent project memory and knowledge graph for AI coding agents
Project description
Mnemon
Persistent project memory and a scoped knowledge graph for AI coding agents.
Mnemon helps an AI coding agent remember what matters between sessions: what the project is, what branch is being worked on, what decisions were made, what tasks are still open, and which components or concepts are important in the codebase.
It is intentionally small and local-first. There is no hosted service to configure and no vector database to operate. Mnemon runs as an MCP server, stores memory in SQLite, and gives compatible agents a clean context block at the start of every session.
Why Mnemon
AI coding sessions often lose the thread. A new session may need the same explanations again: the branch goal, the plan, the constraints, the decision history, the half-finished task, the component that should not be touched casually.
Mnemon is built around continuity rather than chat history search.
- Session memory keeps the current project state, per-branch focus, decisions, tasks, and recent session history.
- Knowledge graph memory stores entities, observations, and typed relations for components, concepts, files, people, and systems.
- Git-aware setup derives the project id from the repository remote, so each repo gets a stable memory namespace.
- Branch-aware state lets the same repository have different active plans on different branches.
- Local storage keeps memory in
~/.agent-memory/mnemon.db. - MCP tools let agents read and update memory as part of their normal workflow.
The result is a compact memory layer that helps an agent start a session already oriented instead of asking you to rebuild the map by hand.
How It Works
Mnemon keeps two complementary layers.
Session Memory
Session memory answers: "Where are we right now?"
It stores:
- project-wide context, such as stack, conventions, and architecture notes
- branch-specific focus and next steps
- decisions, either global or branch-scoped
- tasks with
todo,in-progress,blocked, ordonestatus - recent session summaries
- git commit entries from optional hooks
Agents read this through memory_read at the start of a session and update it through memory_summarize at the end.
Knowledge Graph
The graph answers: "What do we know about the important things in this project?"
It stores:
- entities such as components, concepts, files, people, systems, or custom types
- observations as factual notes attached to entities
- relations such as
calls,implements,depends_on,owns,uses, or custom labels - importance scores from
0.0to1.0
Important graph entities are automatically included in the session-start context, so architectural knowledge becomes part of the agent's working memory without a separate search step.
Installation
Mac / Linux
curl -fsSL https://raw.githubusercontent.com/paulushcgcj/mnemon/main/install.sh | bash
Windows (PowerShell)
irm https://raw.githubusercontent.com/paulushcgcj/mnemon/main/install.ps1 | iex
Via pip / uv (all platforms)
pip install mnemonn
# or
uv tool install mnemonn
macOS note: If you see a security warning on first run, clear the quarantine flag once:
xattr -d com.apple.quarantine /usr/local/bin/mnemon
One-off Usage
# Run a command without permanent installation
uvx mnemonn read --help
From Source (Development)
# Clone the repository
git clone https://github.com/paulushcgcj/mnemon.git
cd mnemon
# Install in development mode
uv sync
uv tool install -e .
During development, you can also run it directly with:
uv run mnemon --help
Quick Start
Install Mnemon, then set up a repository:
uv tool install /path/to/mnemon
cd /path/to/your/repo
mnemon init
mnemon install
bash /path/to/mnemon/install-hooks.sh
mnemon init creates:
.github/copilot-instructions.md
The file tells the agent to call Mnemon at session start and session end.
mnemon install creates:
.github/skills/mnemon/SKILL.md
The skill tells the agent how to handle requests such as "remember this", "save this decision", or "add this to the knowledge graph".
The hook installer links:
.git/hooks/post-commit
.git/hooks/post-merge
Those hooks log commits into Mnemon's session history.
MCP Configuration
Configure your MCP client to run Mnemon over stdio:
{
"command": "mnemon",
"args": ["serve"]
}
After that, compatible agents can call Mnemon's tools directly.
CLI
mnemon serve
Start the MCP server over stdio.
mnemon init
mnemon init --force
Generate .github/copilot-instructions.md for the current repository. Mnemon detects the project id from git remote get-url origin, using the owner/repo slug.
mnemon install
mnemon install --force
Install the Mnemon skill into .github/skills/mnemon/SKILL.md.
mnemon read
mnemon read --project owner/repo --branch main
Print the full context block that an agent receives at session start.
mnemon graph
mnemon graph --min 0.6
mnemon graph --type component
Inspect the project knowledge graph.
mnemon prune
mnemon prune --below 0.3 --days 60
mnemon prune --dry-run
Remove stale, low-importance entities from the graph.
mnemon projects
List projects known to the local memory store.
mnemon log-commit
Log the latest commit. This is normally called by the installed git hooks.
MCP Tools
Mnemon exposes two groups of tools.
Session Tools
memory_read(project_id, branch)returns the full session-start context block.memory_summarize(...)stores the end-of-session summary, current focus, next steps, decisions, completed tasks, and new tasks.memory_task_update(task_id, status, notes)updates a task during a session.memory_project_set_context(project_id, context)sets the global project context.memory_log_commit(...)logs a commit into session history.memory_project_list(parent_id)lists known projects.
Graph Tools
graph_entity_upsert(...)creates or updates an entity and optionally adds observations.graph_observe(project_id, entity_name, observation)adds a fact to an existing entity.graph_relate(project_id, from_entity, relation, to_entity)connects two entities.graph_search(project_id, query, entity_type, limit)searches by entity name or observation content.graph_read(project_id, branch, importance_min)reads the graph.graph_forget(project_id, entity_name, observation_id)deletes an entity or a single observation.
Data Model
Mnemon stores data in:
~/.agent-memory/mnemon.db
The SQLite schema has nine tables:
projectsproject_statebranch_statedecisionstaskssession_logentitiesobservationsrelations
The project id is normally inferred from the git remote URL. For example:
git@github.com:owner/repo.git
https://github.com/owner/repo.git
Both resolve to:
owner/repo
Example Flow
At the beginning of a session, the agent calls:
memory_read(project_id="owner/repo", branch="feature/imports")
Mnemon returns a context block containing project context, decisions, graph entities, branch focus, tasks, and recent history.
During the session, the agent can update task status:
memory_task_update(task_id="a1b2c3d4", status="in-progress")
When the user says "remember that the ImportService owns CSV validation", the agent can store graph knowledge:
graph_entity_upsert(
project_id="owner/repo",
name="ImportService",
entity_type="component",
observations=["owns CSV validation"],
importance=0.7
)
At the end of the session, the agent calls:
memory_summarize(
project_id="owner/repo",
branch="feature/imports",
summary="Implemented CSV validation path and added error handling.",
current_focus="Finishing import validation edge cases.",
next_steps="Add tests for malformed rows and empty files."
)
The next session starts with that context already available.
Design Principles
- Continuity over retrieval tricks. Mnemon focuses on the information an agent needs to resume work, not on building a general-purpose RAG stack.
- Project and branch scope by default. Memory follows the way software work actually happens.
- Append important history, overwrite current state. Session logs and observations accumulate; branch focus stays current.
- Local and inspectable. Memory is SQLite, and the CLI can read the context and graph directly.
- Small surface area. The system is meant to be easy to install, understand, and remove.
Development
Run the CLI from the repository:
uv run mnemon --help
Start the MCP server:
uv run mnemon serve
Inspect the current repository memory:
uv run mnemon read
The package entry point is defined in pyproject.toml:
[project.scripts]
mnemon = "mnemon.cli:cli"
Recent Improvements
The following improvements have been completed as part of the ongoing development:
| Date | Change | Workstream | Impact |
|---|---|---|---|
| 2026-06-23 | Fixed SQL injection vulnerability in search_entities | 01-security-fixes | HIGH - Security |
| 2026-06-23 | Added input validation for entity types, task statuses, importance | 02-input-validation | HIGH - Data Quality |
| 2026-06-23 | Extracted magic strings into constants module | 03-constants-refactor | MEDIUM - Maintainability |
| 2026-06-23 | Made database path configurable via env var and CLI | 04-configurable-db-path | MEDIUM - Testability |
| 2026-06-23 | Improved git hooks with better error handling | 05-git-hook-improvements | MEDIUM - Reliability |
| 2026-06-24 | Added CLI quality improvements (contracts, format flags, error handling) | 09-cli-quality-improvements | HIGH - CLI Infrastructure |
Architecture Updates
- New Module:
mnemon/core/constants.py- Centralized constants and validation helpers - Enhanced:
mnemon/db/connection.py- Now supportsMNEMON_DB_PATHenvironment variable and explicit path override - Improved:
mnemon/core/git.py-get_commit_context()now handles first commit gracefully - Hardened: All CLI commands now include
--db-pathoption for testing - New Directories:
mnemon/contracts/- Pydantic models for JSON output contracts,mnemon/commands/- Shared CLI utilities
Status
Mnemon is early software. The core loop is intentionally usable now: install it, initialize a repository, connect an MCP client, and let the agent keep project memory as work progresses.
The most valuable next improvements are likely around export/import, richer graph inspection, comprehensive test coverage, and more client-specific setup guides.
Project details
Release history Release notifications | RSS feed
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 mnemonn-1.0.0.tar.gz.
File metadata
- Download URL: mnemonn-1.0.0.tar.gz
- Upload date:
- Size: 140.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3931dc239ee93686803106d3380585668a577db737f4e3552856d74ebf9ed9ff
|
|
| MD5 |
f09f6a8a5ed785a832b1792186b49996
|
|
| BLAKE2b-256 |
07c1fe47d7861a51af924b0582e1fac535eb7ef5532893b8ed30bccc71f7088c
|
File details
Details for the file mnemonn-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mnemonn-1.0.0-py3-none-any.whl
- Upload date:
- Size: 53.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b219f925e5c970f1e2962e02e273d0b35c42f5457f87c8958c68753a143c8db0
|
|
| MD5 |
e542ae07cbb9a897f3792f9d631b486e
|
|
| BLAKE2b-256 |
a77b45d81e71c0b1a44e0f0be239f8acf2189228f416353b079d53de6bf35975
|