my-memory
Integrates with Forgejo as remote Git hosting, providing OAuth 2.1 authentication for public clients, webhook handling for pushes, and support for pushes from Forgejo's web editor via rebase.
Uses Git as the source of truth for notes, committing every write with client attribution and trailers, maintaining history, and handling concurrent writes via optimistic concurrency and rebase.
Stores binary attachments in Git LFS, with companion notes containing extracted text (e.g., PDFs via pdftotext) so they remain searchable.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
cli-memoria
A self-hosted, git-backed memory for AI agents: a compact CLI (memoria) for shell-capable agents and a stateless MCP server (cli-memoria) backed by Markdown notes in git. Every write is a git commit attributed to the agent that made it.
Keep this file and README.es.md in sync: when you edit one, update the other.
A CLI for agents (
memoria). cli/ searches, reads and writes notes from a shell with compact output: reads straight from a checkout of the notes repo (rg+git), writes always through the server (MEMORIA_URL+MEMORIA_TOKEN). Packaged in Nix asmemoriafor Linux and macOS, with zero npm dependencies.Git is the source of truth. Server-side search runs on a SQLite index (catalog, FTS5 full text by section, wikilinks) that can be rebuilt from git at any time.
One commit per write, authored by the client:
Claude Code (laptop),Codex, etc. The commit message is the reason the agent gave, plusClient:/Tool:/Session:trailers.Safe for several agents at once. One writer queue, optimistic concurrency (
hashfromread) and atomic multi-commitpublish. The server is the only writer: there is no git remote to push to or fetch from.Your conventions, not ours. The notes repo declares its folders, required frontmatter, write rules and filename pattern in
memory.toml; itsAGENTS.mdis sent to every client as MCP instructions, with a short index.Per-agent static tokens. One Bearer token per agent (
readorwritescope), stored as SHA-256 hashes and reloaded onSIGHUP. Read-only tokens only see read tools.Notes only. The memory is Markdown and nothing else: no attached files, no OCR, no git-lfs. The documents themselves live in the archives of lisa, and a note points at them in its text. A repo that still carries a binary is read without breaking (it is catalogued so links to it keep resolving) and
lintreports it asbinaryuntil it moves out.Typed links.
works_at:: [[acme]]says what a link means, andlinkscan filter by it.
How it works inside (index, write flow, concurrency, auth): docs/design.md. Write-rules design and evaluation (Spanish): docs/normas-al-escribir.md.
The memoria CLI
memoria turns the memory into shell commands for agents: one line per result with the total and how to go on, --json for jq, and dry runs with --simular on every write. Commands are in Spanish (buscar, leer, lista, recientes…) with English aliases (search, read, list, recent…). No npm dependencies: Node 22 or later and a few .mjs files.
nix run github:PabloPC05/cli-memoria#memoria -- --help
memoria buscar kitchen --carpeta projects --limite 5Reads go straight to a checkout of the notes repo when
MEMORIA_DIRpoints at one (withrgandgit), or through the server otherwise.Writes always go through the server, so they are signed by the agent's credential and follow
memory.toml: one note at a time (crear,editar,escribir,mover,borrar --si), or, for changes to several notes at once, a git working copy (memoria copia) whose commitsmemoria publicarsends in one atomicpublishsubmission.Direct to the server (recommended): set
MEMORIA_URL(e.g.http://127.0.0.1:8782/mcp) andMEMORIA_TOKEN(mm_…) to talk directly over Streamable HTTP with no gateway required. For setups behind a gateway wrapping tools asmemoria_<tool>behindbuscador_usar,BADULAQUE_URLandBADULAQUE_CLAVEalso work.
Layout, configuration, packaging and tests: cli/README.md (in Spanish).
Related MCP server: Cortex
Give your agent one link
Once the memoria CLI or MCP server is available to an agent (see Connecting clients), send it this link and nothing else:
https://raw.githubusercontent.com/PabloPC05/cli-memoria/main/docs/agent-setup.mdThe agent reads the setup guide and installs your memory on its own host: it discovers the CLI or MCP tools, proposes importing what it already knows about you, installs standing instructions and, where the host allows it (Claude Code, your own agents), blocks it from saving anywhere else. It asks for one approval before changing anything. Inspired by Notion's agent setup page.
On Claude Code it can also install, if you want, a hook that brings relevant notes to the agent automatically: before each message, inject-memory.mjs searches your memory and adds the best few matches to the turn, framed as information to check, not instructions, within a small budget. It needs MEMORIA_URL and a read-only MEMORIA_TOKEN, and adds nothing on any error or timeout.
MCP Tools
Tool | What it does |
| Short index, or every note in a folder with description, aliases and last change |
| Full-text search by section (SQLite FTS5: accents ignored, prefixes match, a Spanish plural also finds its singular) with snippets, |
| A note or one section, with its |
| Outgoing |
| Commits that touched a note: who, when, why |
| Latest changes to the whole memory: per commit when, who (author and client), tool, reason and the notes it touched; filters |
| The pending lines of the notes, soonest first: from the «Pendiente» sections, one item per line ( |
| Maintenance worklist, worst first: bad frontmatter and superseded notes outside the archive, write-rule violations, broken links, look-alike duplicates, old inferences, missing pages, unlinked mentions, orphans, stale notes, files that are not notes ( |
| Who is connected: every token with last seen (time and tool), writes in the last 7 and 30 days, and the |
| New note; unique names across folders; refuses look-alike duplicates unless |
| Exact text replacements, all or nothing |
| Rewrite a whole note; needs the |
| Rename or move; rewrites every |
| Remove a note (it stays in history); refused while other notes link to it |
| Atomic multi-commit submission ( |
| Undo a commit from |
Clients with a read-only token only see the read tools: list, search, deadlines, read, links, history, recent, lint and clients.
lint is the cheap half of keeping the memory tidy (Karpathy's "LLM wiki": ingest, answer, lint). It is computed from the index and git dates in milliseconds, without a model, so the agent gets candidates instead of reading every note; judging them is the agent's half. See docs/design.md.
The server also offers the agent setup guide offline to every connected client (it ships with the package): as the MCP prompt setup ("Set up this memory on your host") and as the resource memory://agent-setup, both with the Markdown of docs/agent-setup.md.
Notes format
---
name: Universidad
description: Carrera, asignaturas de este curso y cómo las lleva
aliases: [uni, carrera]
---
# Universidad
Text, with links like [[otra-nota]], [[otra-nota#Sección|texto]] or an embed like ![[otra-nota]].File names (without .md) must be unique across the repo, so [[name]] always resolves; this is what Obsidian does with "shortest path" links.
A link can also say what it means, with Dataview-style inline fields: works_at:: [[acme]] on its own line, [lives_with:: [[sam]]] inside a sentence, or works_at: "[[acme]]" in the frontmatter. links returns the relation and can filter by it, so "who works at Acme" is one call.
memory.toml at the root of the notes repo (every key is optional):
[folders]
allowed = ["me", "people", "topics", "projects", "archive"]
archive = "archive" # excluded from list/search unless asked
index_full = ["me"] # listed note by note in the short index
root_files = ["AGENTS.md", "README.md"]
[notes]
required_fields = ["name", "description"]
filename_pattern = "^[a-z0-9]+(-[a-z0-9]+)*\\.md$"
superseded_field = "superseded_by"
max_description = 200
[instructions]
file = "AGENTS.md"
[relations]
allowed = ["works_at", "lives_with"] # warn on other keys; without it, keys in use are suggested
[lint]
exclude = [] # folders left out of every check (root files and the archive always are)
orphan_exclude = ["me"] # never reported as orphans; defaults to folders.index_full
stale_days = 180 # unchanged for longer → stale
inference_days = 90 # "(deducido, 2026-01-31)" older than this → old_inference
inferred_markers = ["deducido"] # provenance words that mark an inference
max_bytes = 16384 # bigger → oversized
missing_page_min = 2 # a missing target linked from this many notes → missing_page
mention_min_length = 4 # shortest name or alias looked for as an unlinked mention
mention_exclude_labels = [] # labels never looked for as an unlinked mention (besides folders.index_full)
[rules] # optional; every write is checked against these
# …see docs/normas-al-escribir.md for every rule…
[rules.status] # optional, off unless declared
types = ["project"] # the types that must say where they stand (empty: every typed note)
allowed = ["idea", "active", "waiting", "paused"]
action = "warn" # or "block"
[rules.pending] # optional, off unless declared
section = "Pendiente" # or sections = ["Pendiente", "Tareas"]
action = "warn" # checks that every line is «- [ ] what · who · 2026-03-14 [origin]»Running it
Requirements: Node.js 24 and git. Nothing else: the server never reads or extracts a file, it only writes Markdown notes.
npm ci && npm run build
cli-memoria token add laptop --name "Claude Code (laptop)" --scope write --file tokens.toml
cli-memoria serve --config config.toml
cli-memoria clients --config config.toml # who is connected: last seen, writes, setup version (--json for scripts)
cli-memoria lint --config config.toml # maintenance worklist (--json, --kind stale,orphan, --folder, --limit)Last-seen times are kept in activity.sqlite in the data dir (written at most once a minute per client; it is not in the notes repo) and the write counts come from the Client: trailers of the git history.
config.toml:
data_dir = "/var/lib/cli-memoria"
tokens_file = "tokens.toml"
[listen]
address = "127.0.0.1"
port = 8782
The JSON body of /mcp is capped at 32 MB, which is room for a publish of several long notes.
The server keeps the notes repo in data_dir/repo and is its only writer: no git remote, no fetch, no push, and no webhook to receive one. The keys of the removed git sync ([remote], fetch_interval_seconds, webhook_secret_file), of the removed extraction of attached files ([ocr], pdftotext), and the /hooks/git and /uploads/:filename endpoints are gone; an old config.toml still works, and the server names those keys in the log (config.ignored_keys) instead of refusing to start.
NixOS
{
inputs.cli-memoria.url = "github:PabloPC05/cli-memoria";
# in your configuration:
imports = [ inputs.cli-memoria.nixosModules.default ];
services.cli-memoria = {
enable = true;
listen = { address = "127.0.0.1"; port = 8782; };
tokensFile = "/var/lib/secrets/cli-memoria/tokens.toml"; # root:cli-memoria 0640
};
}After cli-memoria token add … --file <tokensFile>, run systemctl reload cli-memoria. The package brings git and nothing else: there is no extraction of attached files, so no poppler-utils and no tesseract. See nix/module.nix for all options (services.my-memory and listen.private remain supported for existing deployments). remote, webhookSecretFile, fetchIntervalSeconds and ocr have been removed from the NixOS module: remove them when updating if an existing NixOS configuration still sets them, and delete the binaries and their companion notes from the notes repo (see No attached files below).
Connecting clients
CLI (recommended for shell-capable agents):
export MEMORIA_URL="http://127.0.0.1:8782/mcp"
export MEMORIA_TOKEN="mm_..."
export MEMORIA_DIR="/path/to/notes-checkout" # optional: enables fast local reads
memoria listaMCP directly:
# Claude Code
claude mcp add --transport http memory http://host:8782/mcp --header "Authorization: Bearer $MEMORIA_TOKEN"# Codex (~/.codex/config.toml)
[mcp_servers.memory]
url = "http://host:8782/mcp"
bearer_token_env_var = "MEMORIA_TOKEN"Then give the agent the setup link (Give your agent one link).
One credential per agent
cli-memoria attributes every write (the git commit author and its Client: trailer), every log line and the clients view to the token the request used. So each agent must connect with its own token. If two agents share one, nobody can tell who wrote what, clients cannot tell them apart, and a leaked key cannot be revoked without cutting off the other agent too.
Static tokens: create one per agent and never share it:
cli-memoria token add <id> --name "<Agent name>" --scope write|read --file tokens.toml.Behind a gateway or proxy that joins several MCP servers into one endpoint, the gateway is the client the server sees. Give the gateway one key per agent and map each key to its own
cli-memoriatoken; otherwise every write shows the gateway's name.Check it: run
cli-memoria clients --config config.tomlor call theclientstool. Each agent must appear on its own row, with its last activity and its writes.
Notes format at a glance
typeandstatus.typesays what a note is (a person, a project, a reference…, see[rules.type]);statussays where it stands:idea,active,waitingorpaused. Both are optional and only enforced ifmemory.tomlasks for it;searchcan filter by them.type: record. A list or a log, meant to be long and to stay as it is:lintdoes not report it asstaleoroversized, and the size rule of[rules]leaves it alone.No attached files. The memory is Markdown; documents live in the archives of lisa and a note cites them in its text.
lint --kind binarylists whatever is still a file of another kind, and it never stops the server: such files are catalogued (so[[a-link]]to one still resolves) and never read. Removing them is a commit in git, since the tools only write notes (revertcan undo the commit that added one, but never bring its content back:NOT_RESTORABLE).Pending lines. A
## Pendientesection holds one item per line,- [ ] what · who · 2026-03-14 [origin](- [x]when done; the date may be2026-03orsin plazo). Thedeadlinestool reads them;[rules.pending]checks their shape on every write.
Development
npm ci
npm test # vitest: unit, integration (real git repos) and HTTP/MCP end to end
npm run typecheck
nix flake check # builds the package and runs the NixOS VM test
NODE=$(command -v node) CLI_MEMORIA=$(nix build --no-link --print-out-paths .#default)/bin/cli-memoria \
cli/probar.sh # the memoria CLI end to end, against a real cli-memoria with toy notesLicense
Apache-2.0.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Linked markdown notes as memory for AI apps: search, read, save and link notes over MCP.
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Markdown-based note-taking with a hosted MCP server. Your notes serve you and your AI.
Hosted MCP server for Obsidian Sync vaults: read, search, edit notes. Not affiliated with Obsidian.
Related MCP Servers
- FlicenseCqualityDmaintenanceGit-backed MCP server for creating and maintaining an Obsidian-style markdown knowledge base with full CRUD, search, and git sync.7-
- AlicenseNot gradedqualityBmaintenanceA dynamic, governed memory layer for Markdown notes that serves knowledge to AI clients and humans through a secure MCP server, with scoped access, git-audited changes, and optional LLM-powered semantic search.Apache 2.0
- AlicenseAqualityCmaintenanceMCP server for managing a local, domain-agnostic knowledge base using Markdown notes with frontmatter. Enables AI agents to capture, read, search, link, and maintain notes with atomic writes and privacy controls.13MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI agents read and write access to a folder of Markdown notes, supporting full-text search, reading, listing, and writing notes. It is deliberately small, with no dependencies beyond the MCP SDK, and includes proper path traversal protection.MIT