Skip to main content

curu-memory

What is this

curu-memory is a shared knowledge base for ComfyUI and generative media. It reads OKF concept files about workflows, models, parameters, prompt techniques and findings. Then it indexes them and serves them to agents through MCP and to persons through a command. An agent can search the knowledge, read a concept and follow its links to related concepts. An agent can also propose a new concept, and a person with maintain reviews and merges it. The global knowledge stays in plain Markdown files that you keep in git. The files of a private space are encrypted in git.

What you can do

Task Command Section
Understand the parts, the flows and where each file is Read the diagrams How curu-memory works
Set up one computer from start to end Follow the tutorial Tutorial: set up curu-memory on one computer
Run the curu-vision service at each login on macOS launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/local.curu-vision.plist Run the embedder as a service
Keep the settings of each shell in one file . ~/.config/curu-memory/env Keep the settings in a file
Check each function of a setup by hand Follow the test plan Check each function by hand
Write a concept for the index Add <name>.md with front matter Write a concept file
Start a concept file from a template with each provenance key curu-memory concept new a-short-claim Start a concept from a template
Give each concept a proof that a reader can reproduce Add an evidence list to the front matter Give a proof for each concept
Check concept files before you index them curu-memory validate knowledge Check concept files
Add a concept by a commit, a proposal or an edit of an encrypted space Follow the how-to Add a concept to a space
Refuse the host of your own repositories in the sources export CURU_MEMORY_SOURCES_NO_HOST=github.com/me/ Refuse the host of your own repositories in the sources
Add images, audio and video to a concept Add a media: list to the front matter Add media to a concept
Build the index from your concept files curu-memory index --concepts ./knowledge Index your knowledge
Keep team notes and personal notes apart from the global knowledge curu-memory index --space personal/me Keep team and personal knowledge apart
Keep the team and the personal spaces encrypted on disk curu-memory key new ~/.config/curu-memory/kek Keep private knowledge encrypted
Let only your SSH key open the key file curu-memory key new ~/.config/curu-memory/kek --protect --ssh-key ~/.ssh/id_ed25519.pub --issuer URL Protect the key file with your SSH key
Open the key file after the loss of your SSH key curu-memory key recover --ssh-key ~/.ssh/new_id_ed25519.pub --issuer URL Recover the key file
Replace a plain key file with a protected key file curu-memory key protect --old OLD --new NEW --ssh-key PUB --issuer URL Protect an existing key file
Encrypt the concept files of a private space for git curu-memory space encrypt --space team/look ./look-plain ./look Encrypt the concept files of a private space
Edit an encrypted space with any editor, and commit the change curu-memory space checkout --space team/look ./look Edit an encrypted space
Log in to a server for an edit through the server curu-memory login --server https://memory.example.com Edit a space through the server
Edit an encrypted space with no key file, through the server curu-memory space checkout --space team/look --server https://memory.example.com ./look Edit a space through the server
Sign the commits of an encrypted space Set CURU_MEMORY_ALLOWED_SIGNERS Sign the commits of an encrypted space
Read the plaintext changes of an encrypted space in git diff and git log -p curu-memory git install Read the diff of an encrypted space
Resolve a merge conflict of an encrypted space curu-memory space checkout --space team/look --merge ./look Resolve a merge conflict of an encrypted space
Merge two branches of an encrypted space git merge -S other Merge the branches of an encrypted space
Stop a push that puts plaintext into an encrypted space curu-memory space hook install Check the commits before a push
Remove the plaintext of a space from the git history git filter-repo --invert-paths --path look-plain Rewrite the plaintext history
Change the key of the private spaces while the server answers curu-memory key rotate --old OLD --new NEW Rotate the key
Encrypt a space again under a new space key, after a leak curu-memory space rekey --space team/look ./look Rekey an encrypted space
Give each person their own spaces, and see who reads which space curu-memory access person add me Give each person their own spaces
Connect agents with tokens of Authentik or of the shipped rauthy Set CURU_MEMORY_OIDC_ISSUER Connect agents with OIDC tokens
Give a second person the role to review proposals curu-memory access role set ada --space global --role maintain Give a person a role for review
Stop knowledge that skipped review from reaching search curu-memory access protect global Protect the global space
Give an agent a role in one space for some days curu-memory access grant scout --space team/look --role read Give an agent its own access
Search the knowledge from a terminal curu-memory search "VAE for WAN2.2 5B" Search the knowledge
Give the knowledge to a local agent curu-memory serve Connect a local agent
Give the knowledge to a remote agent curu-memory serve --transport http Connect a remote agent
Run curu-memory, rauthy, an embedder and a TLS proxy on a server with Docker Compose deploy/stack/init.sh Deploy the stack with TLS
Search with an image, a clip or a video, for example an output of a workflow curu-memory search --media output.png Search with media
Search by meaning with the curu-vision model service Set CURU_MEMORY_EMBEDDER_URL and CURU_MEMORY_EMBEDDER_TOKEN Use the curu-vision model service
Search by meaning with an OpenAI-compatible server Set CURU_MEMORY_EMBEDDER_PROTOCOL=openai Search by meaning
Browse the knowledge in a web browser curu-memory browse Browse the knowledge
Read a concept and its links The get_concept and concept_neighbours tools Read a concept and follow its links
Let an agent propose a new concept for review The propose_concept tool Propose a concept
Let an agent propose a change of a concept for review The read_concept_file and propose_change tools Propose a change of a concept
Let an agent keep notes of its work in your personal space, out of the knowledge The write_scratch_note tool Keep scratch notes of an agent
Close a proposal that nobody will merge curu-memory proposal close <id> Close a proposal
Move a concept to a team space or to global, for review curu-memory proposal move <id> --from personal/me --to global Move a concept to a wider tier
Review a proposal and merge it into the knowledge curu-memory proposal merge <id> Review and merge a proposal
Add the missing author, confidence, tier and date to old concepts curu-memory proposal complete --space global --author <handle> --confidence <map> Complete the provenance of old concepts
Find why a call failed The code of the error Handle errors
Build and read the knowledge from a Python program curu_memory.open_knowledge() Use curu-memory from Python
Propose a concept, a change or a move from a Python program knowledge.propose_concept("global", "tiled-vae", text) Write through the library
Test a program that writes, with no server git init -b main /tmp/kb Test a program that writes

Install

You need Python 3.12 or later and uv.

uv tool install "curu-memory[server] @ git+https://github.com/darth-veitcher/curu-memory"

This installs the curu-memory command with the server extra. serve and browse need the extra. Without it, index, search and access work, and serve and browse stop with exit code 78.

To install a release from PyPI, give a version range:

uv tool install "curu-memory[server]>=0.10,<0.11"

A program that uses curu-memory as a library pins a range in its pyproject.toml, with no extra. A new minor version can change the Python API or the MCP tools, so the range stops before the next minor version.

Quickstart

This example makes one concept, indexes it, searches it, and gives it to Claude Code. Make a directory for your concept files:

mkdir -p knowledge

Save this text as knowledge/wan22-5b-vae.md:

---
type: Model Component
title: WAN2.2 5B VAE
description: "The VAE that the WAN2.2 5B model loads."
tags: [vae, wan]
status: verified
sources:
  - id: the-card
    resource: https://huggingface.co/Wan-AI
    author: person:owner
    last_modified: "2026-10-01"
---
The [WAN2.2 5B family](./wan22-5b.md "USES_COMPONENT") loads this VAE.

## Settings

Use the `wan2.2_vae.safetensors` file.

Then index the directory and search it:

curu-memory index --concepts ./knowledge
curu-memory search "VAE for WAN2.2 5B" --limit 5

The first command prints a report. skipped: 0 means that each concept file is in the index. broken links: 1 means that wan22-5b.md is not in the directory yet. The second command prints the concept, with its sources.

Then give the knowledge to Claude Code:

claude mcp add curu-memory -- curu-memory serve

The server reads the index in the same data directory as the index command. Claude Code can now use the search_knowledge, search_knowledge_by_media, get_concept and concept_neighbours tools.

Write a concept file

A concept file is a Markdown file with YAML front matter between two --- lines. The file in the Quickstart is an example. The front matter must have description. type, title, tags, sources, status, media, tier, confidence, date, evidence, author and agent are optional for the index. A proposal and an edit of an encrypted space need some of them: see Call the tool and Give a proof for each concept.

  • The identifier of a concept is its file name without .md. In the example, it is wan22-5b-vae.
  • A missing title becomes the identifier. A missing type becomes Untyped, and the index report gives a warning.
  • A link to another concept is a Markdown link to its .md file. Its title in quotes is the link kind.
  • The link kinds are USES_COMPONENT, HAS_TURBO_VARIANT, SAME_LINEAGE_AS, SHARES_CLIP_TYPE_LABEL_WITH, EVIDENCED_BY, SHARES_GUARD_CONVENTION_WITH, DISTINCT_FAILURE_CLASS_FROM and RETRACTS_CLAIM_IN.
  • A link resolves by file name in all the subdirectories, so two concept files must not have the same name.
  • Write each ## heading for one topic. Search by meaning compares each section separately.
  • A section of more than 30,000 characters becomes parts. The index cuts it at the end of a paragraph, else of a sentence, else at 30,000 characters. Each later part starts with the heading line of its section, and gets the slug <slug>-part-<n>. The match of meaning for a concept is the best score of its units, so a concept with more parts does not rank higher.
  • When the curu-vision service refuses a part as too long, the index cuts that part in two and sends the two parts again. A part of fewer than 1,000 characters that the service refuses stops the index run with the error embedder_failed, and the old index stays.

Start a concept from a template

Write the template of a new concept. Then fill it in with any editor:

curu-memory concept new a-short-claim --type "Engineering Finding" --dir knowledge
  • The command writes knowledge/a-short-claim.md. The identifier is also the file name. Use 1 to 128 lowercase letters, digits, ., _ and -. Start with a letter or a digit, and do not end with .md.
  • The command fills tier, author, date, type and title. tier is the value of --space, and the default is global. author is the value of --author, else CURU_MEMORY_PRINCIPAL. date is the date of today. title comes from the identifier, unless you give --title.
  • The command leaves description, confidence, sources and evidence empty. The empty description gives a fault of the kind okf, so the index skips the file. After you fill description, validate gives a fault for each of the other three. The comments of the template show a source with no host and an example of each kind of proof.
  • The default type is Engineering Finding.
  • The command does not overwrite a file, and it does not commit. A file that exists gives exit code 1. A bad identifier gives exit code 2. A directory that does not exist also gives exit code 2.

Give a proof for each concept

Each concept gives 1 or more proofs that a reader can reproduce, in the key evidence. A proof is a run, a test or a source:

evidence:
  - id: comfyui-validates-ancestors
    kind: source
    url: https://github.com/comfyanonymous/ComfyUI
    commit: 3b2671fb3e3f9723ef224c36ba9618d7d73af00a
    path: execution.py
    lines: 512-540
  - kind: test
    repo: curu
    commit: 3b2671fb3e3f9723ef224c36ba9618d7d73af00a
    path: tests/unit/test_loader.py
    name: test_the_loader_reads_the_file
  - kind: run
    recipe: {repo: curu, commit: 3b2671fb3e3f9723ef224c36ba9618d7d73af00a, path: ops/workflows/sweep.json}
    inputs:
      - model: krea2_turbo_lora_rank_64_bf16.safetensors
        sha256: 9f2c0d4e8b7a6f5e4d3c2b1a0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a2f1e
      - seed: 42
    result: {value: 0, metric: face defects in 8 images}
Kind What it gives
source Upstream code: repo or url, commit, path and lines. lines is a number or N-M, where M is not less than N.
test An automated test: repo or url, commit, path and name.
run A recipe, its inputs and its result. The recipe is a file (repo or url, commit, path) or a command. Each input is a mapping, and an input with model needs its sha256. The result is a file, a url, or a value with its metric.
  • Each commit is a full commit identifier of 40 or 64 lowercase hexadecimal characters. A branch or a tag can move, and a short identifier can become ambiguous. Each gives a fault.
  • Documentation alone, an analysis of a reference image, untested advice and a measurement with no recorded recipe are not proofs.
  • The rule of no host applies to each url of a proof too.
  • id is optional. A fault names the proof by its id, else as proof N.
  • curu-memory checks only the form of a proof. It does not run a recipe or a test, and it does not open a repository. A reviewer checks the proof before a merge.
  • A scratch note needs no proof.
  • propose_concept, propose_change and a move refuse a concept with no valid proof. space commit refuses a new or changed concept with no valid proof.
  • Seven paths do not check a proof:
    • a direct signed commit, then the index;
    • space encrypt;
    • space rekey;
    • a moved file in space commit;
    • a git merge of an encrypted space;
    • the merge of a proposal from before version 0.16.5;
    • proposal complete.
  • Each of these paths moves existing content, or comes from a person who can write to the repository. validate still names each concept that they bring in.
  • An old concept with no proof still indexes, and validate names it.

Check concept files

Check a file or a directory before you index it. The check uses the rules of the index command, and it writes nothing.

curu-memory validate knowledge
  • The command lists each fault as path:line: kind: message, or path: kind: message when the fault has no line. Then it prints faults: N. The exit code is 1 when there is a fault, else 0.
  • --space is the space of the files, for the check of tier. The default is global. For a personal space, give --space personal/me.
  • --json prints {"faults": [...]}. Each fault has path, line, message and kind.
  • A path that does not exist, and an encrypted space, give exit code 2.

From Python:

import curu_memory

for fault in curu_memory.validate("knowledge"):
    print(fault.kind, fault.path, fault.line, fault.message)
  • validate gives a list of faults. Give space="personal/me" for the files of a personal space. With no fault of the kind okf, the index command indexes each file of the directory, unless an identifier is also in another space. validate refuses an encrypted space with InvalidArgument, because it checks plaintext files only.
  • kind is okf or provenance. A fault of the kind okf makes the index command skip the file. A fault of the kind provenance names a missing or wrong provenance key: tier, sources, author, confidence, date or evidence. The index command still reads that file, but the tool propose_concept refuses it. The server adds a missing author, so a missing author does not stop the tool.
  • path is relative to the directory that you give. For one file, it is the file name. line counts from the first --- line, and it is None when the fault has no line. For a fault of the kind okf, message is the reason that the index command reports. For a fault of the kind provenance, it starts with the key, for example confidence: give a number from 0 to 1, and line is None.
  • A warning of the index command is not a fault, for example a missing type or a link to a missing concept.
  • A Markdown link in a code block still needs a link kind. A wiki-link [[...]] in code is text.
  • curu_memory.LINK_KINDS holds the link kinds. curu_memory.OKF_VERSION is 0.2, the version of the format.
  • The package ships the format: schema.json, a JSON Schema of the front matter, and conformance fixtures. curu_memory.conformance_fixtures() gives the directory of the fixtures. Its parent directory holds schema.json.
  • To test a parser in another language, give it each file of valid/ and of invalid/. Compare its faults with expected.toml.

Refuse the host of your own repositories in the sources

A source that names the host of a repository breaks when the repository moves. Give such a source as repo, commit and path in the front matter:

sources:
  - id: the-loader
    repo: curu
    commit: 293ed35db73e72cfac91dc2cc6c5d3bc85abc567
    path: src/curu/loader.py
    lines: 120-140

To refuse the host, set the prefixes of your repositories:

export CURU_MEMORY_SOURCES_NO_HOST=github.com/me/,git.example.com/me/
  • Each value is an address prefix with no https://, separated by commas.
  • A source whose url or resource starts with one of the prefixes gives a fault of the kind provenance. The fault names the id of the source. propose_concept and propose_change refuse the concept, and validate lists the fault.
  • A source of another host stays valid, for example a page of a project of another person.
  • Without the setting, no address gives this fault.

Add media to a concept

Add example outputs, reference images, audio clips or videos to a concept with a media list. Each path is relative to the concept file:

---
type: Finding
description: A CFG above 7 burns the colours of WAN2.2 5B.
media:
  - images/cfg-9-burnt.png
  - images/cfg-5-good.png
  - audio/cfg-notes.flac
  - video/cfg-9-motion.mp4
---
  • The index command embeds each image, clip and video in the same space as the text, so a question in words can find it. This needs an embedder that accepts these media, for example EmbeddingGemma 2 on SGLang.
  • An image must be a PNG, JPEG or WebP file. A clip must be a WAV, FLAC, MP3 or Ogg file. A video must be an MP4, MOV, WebM or MKV file. Each file must be 10 MB or less. The command reads the format from the first bytes of the file, not from its name.
  • Keep one topic in each clip. A long clip with many topics matches each topic less well.
  • The model sees 1 frame of a video each second, at most 32 frames. A longer video gets 32 frames, spread evenly, so a short event in it can be lost.
  • Each path must stay in the concept directory, also through a symbolic link. Keep the media files in git with the concept files.
  • A media file with a problem gives a warning. The concept stays in the index with its text.
  • curu ignores the media key, so the same concept files still index in curu.

Index your knowledge

Run the index command after each change to the concept files:

curu-memory index --concepts ./knowledge

You can also set CURU_MEMORY_CONCEPTS_DIR and run curu-memory index with no option. Add --json to get the report as a JSON object.

The report gives these values:

Value Meaning
files read The .md files in the directory and its subdirectories. A README.md file and the files in a hidden directory, for example .git, are not concepts.
concepts indexed The concepts in the new index. It is files read minus skipped.
skipped The files that are not in the index. The report gives the file, the line and the reason for each file.
warnings Problems that did not stop a file, for example a missing type.
broken links Links to a concept that is in no space. A link to a concept of another space is not broken. The concept stays in the index.
embedder The embedding model of the index, or none for an index of words only.
media embedded The images, clips and videos that a search by meaning can find.
media skipped The images, clips and videos that a search by meaning cannot find. Each one is also a warning, with the path and the reason.
index The path of the index file in the data directory.

The command exits with 0 when it skipped no file, and with 1 when it skipped one or more files. The command skips a file for one of these causes:

  • The file is not UTF-8 text, or it has no front matter.
  • The front matter has no closing --- line, is not valid YAML, or is not a YAML mapping.
  • The front matter has no description.
  • The body has a [[wiki-link]], or a link with no kind or an unknown kind.
  • Two files have the same name. The command skips both files.
  • The identifier of the concept is in another space. The reason names that space.

A media file with a problem gives a warning. The command does not skip the concept. It does not put the file in the index for one of these causes:

  • The file does not exist, or the path is not a file.
  • The path goes outside the concept directory, or it is an absolute path.
  • The file is larger than 10 MB, or it is not an image, a clip or a video of a known format.
  • The media value is not a list of paths. The command ignores the full list, and media skipped does not count it.

When no embedder is set, or the embedder did not embed a file, the file has no embedding. It stays in the index, and the browser shows it or plays it. A search by meaning cannot find it, and the report gives a warning. An embedder that accepts only text gives this warning for each file.

The command sends each image, clip and video to the embedder one time, with no task prompt. It keeps each vector in an embedding cache. The next run sends only the changed text and media. The same files always give the same index. The command writes a new index file and then replaces the old one. A server that runs at that time uses the old index until the new index is complete. If the embedder fails on a text, the old index stays.

Keep team and personal knowledge apart

Give each part of the knowledge its own space. Index each directory into its space:

curu-memory index --concepts ./knowledge
curu-memory index --concepts ./look --space team/look
curu-memory index --concepts ./me --space personal/me

The directory of a team space or a personal space is an encrypted space. Make it with curu-memory space encrypt, as Encrypt the concept files of a private space says.

  • A space is global, team/<slug> or personal/<handle>. The default is global.
  • The team slug is the short name of the team, and the handle is the short name of the person. Each has 1 to 40 characters from a to z, 0 to 9 and -. The first character is a letter.
  • Each space has its own index file. An index run changes only the index file of its space. The index of a team space or a personal space is encrypted. See Keep private knowledge encrypted.
  • The global space uses the embedding cache. A team space or a personal space does not use it, so each index run of that space embeds its text again.
  • A concept identifier must be unique in all spaces. The command skips a concept whose identifier is in another space, and the report names that space.
  • All spaces must use one embedder: one model with one protocol. When the embedder is not the embedder of another space, the command stops with exit code 1 and changes no index. The command accepts a space with no embeddings. A search of that space uses words only.
  • To change the embedder, index each space again with --new-embedder. The report then gives a warning for each space that still has the old embedder. A search of that space uses words only until you index it again.
  • Only one index run can run at a time. A second run stops with exit code 1 and the message "Another index run holds the lock".
  • A bad space name stops the command with exit code 2.

A caller reads only its readable spaces: the spaces where its principal has a role. A caller with no principal reads global only. See Give each person their own spaces. A search finds concepts in each readable space, and each result names its space. concept_neighbours and the browser resolve a link to a concept in another readable space.

Keep private knowledge encrypted

The index of each private space (a team space or a personal space) is encrypted on disk. A copy of the data directory then does not show the private knowledge. Make a key file one time, outside the data directory:

curu-memory key new ~/.config/curu-memory/kek

Then name it in the environment of each index, serve, browse and search process. A Python program that calls build_space or open_knowledge also needs it:

export CURU_MEMORY_KEK_FILE=~/.config/curu-memory/kek
  • The command writes one line with mode 0600: 32 random bytes in base64url. Only you can read the file. It does not replace a file that exists, because the old key opens the old indexes.
  • Keep the key file out of the data directory, out of each repository and out of each backup of the data. A copy of the data and the key together is a copy of the private knowledge.
  • Keep a copy of the key file in a safe place, for example a password manager. Without the key file, nobody can read the private indexes. If you lose it, delete each *.sqlite.enc file in the data directory. Then make a new key file, and index each private space again.
  • index of a private space stops with exit code 78 when the key file is not set or does not exist. It also stops when the file holds no key. It stops when the key file is a symbolic link or is in the data directory. It also stops when the file has another hard link, belongs to another user, or other users can read it. It also stops when it cannot read the file. The message names the cause.
  • A private space with a wrong or missing key file does not open. When no other readable space with an index opens, the read gives the error index_unreadable. The message names the space and the cause. For a missing or unsafe key file, the message names no path, and the log of the process names the full cause.
  • A read of more than one space answers from each space that opens. A private space that does not open gives nothing to the answer. The notice of a search names that space and the cause. A list of concepts, a read of a concept and the links of a concept leave it out. Only when no readable space with an index opens does the read give index_unreadable.
  • For a program, closed_spaces of a search result lists each readable space that does not open, with its space and its cause. Knowledge.closed_spaces() gives the same list with no search. The error index_unreadable also has space and cause. Use these fields, not the text of the notice, because the text can change.
  • The global space is not encrypted. A read of it needs no key file. An index run reads each other space for its checks. Thus each index run needs the key file when the data directory has a private space. An index run of a private space checks the key file first, so a bad key file gives exit code 78. In an index run of the global space, a wrong, missing or unsafe key file gives exit code 1 and the error index_unreadable.
  • The index of a private space is team--look.sqlite.enc or personal--me.sqlite.enc. An older version of curu-memory wrote team--look.sqlite as plaintext. A read refuses that file. The next index run of the space deletes it. Index each private space again after the upgrade.
  • Version 0.5.0 wrote an encrypted index of an older format. A read refuses it with index_unreadable. An index run also stops on it, because it reads each other space. Delete each *.sqlite.enc file of 0.5.0. Then index each private space again.
  • An index run of a private space sends its text only to an embedder on loopback or with https://. It stops with exit code 78 for an http:// embedder on another computer.

Warning: The encryption protects a stolen copy of the data directory and of git. It does not protect against a person who has the key file and a copy of the data directory or of git.

Protect the key file with your SSH key

A protected key file opens only with your SSH key in ssh-agent, or after an OIDC login to a key service. A copy of the file alone opens no space. Use it when an agent runs as your user and must not decrypt without your SSH key.

You need these:

  • An ssh-ed25519 key with no hardware part. The command refuses an ECDSA key and an sk- key, because their signatures change each time.
  • A key service with a transit key and an OIDC login. Run the key service in the stack tells how to start OpenBao.
  • OpenSSH 10 or later.
  1. Add your SSH key to ssh-agent:

    ssh-add ~/.ssh/id_ed25519
    
  2. Set the address of the key service:

    export CURU_MEMORY_KEK_SERVICE_URL=https://keys.example.com
    
  3. Unseal the key service.

  4. Make the protected key file:

    curu-memory key new ~/.config/curu-memory/kek --protect --ssh-key ~/.ssh/id_ed25519.pub --issuer https://auth.example.com/auth/v1/
    
  5. Name the key file:

    export CURU_MEMORY_KEK_FILE=~/.config/curu-memory/kek
    
  6. Then refuse each plain key file:

    export CURU_MEMORY_KEK_PROTECTED=1
    
  • The command asks you to log in at the issuer, with the client curu-memory-keys. Open the address that it prints. Enter the code.
  • The token of the login goes to the key service one time. curu-memory does not save it, and the key service revokes it after the request. The client curu-memory-keys gives no refresh token.
  • The command writes no plain key file. The protected key file holds the agent slot and the recovery slot.
  • Each command then opens the key-encryption key through ssh-agent, with no prompt. With no SSH key in ssh-agent, each command that opens a private space stops with exit code 78.
  • A server keeps the key-encryption key of its indexes in memory after the first read of a private space. Thus a search still reads the private indexes after ssh-add -D. Some requests sign through ssh-agent each time: an edit of an encrypted space through the server, a proposal in it and a move from it. After ssh-add -D, these requests fail.
  • With CURU_MEMORY_KEK_PROTECTED=1, each command refuses a plain key file, also in CURU_MEMORY_KEK_FILE_PREVIOUS. Only --old of key rotate and of key protect accepts a plain key file.
  • A protected key file of another key-encryption key than your spaces stops each command with exit code 78. Thus a person who changes the file cannot give a key of their choice.
  • ssh-add -c asks you to confirm each signature. It needs an askpass program: a program that shows the prompt of ssh-agent, which SSH_ASKPASS names. With no askpass program, ssh-agent refuses each signature. Each git process of an encrypted space asks again.
  • --role names the role in the key service, and --transit-key names the transit key. The defaults are curu-memory-owner and curu-memory-kek, as the stack makes them. The proxy of the stack passes only the transit key curu-memory-kek.
  • CURU_MEMORY_SSH_KEYGEN gives the absolute path of ssh-keygen. Without it, curu-memory uses /usr/bin/ssh-keygen, /opt/homebrew/bin/ssh-keygen or /usr/local/bin/ssh-keygen. It never searches the PATH.
  • Each command of the CLI turns off core files, because it can hold the key-encryption key in memory.

Warning: Each process of your user that can reach ssh-agent while your SSH key is loaded can open the key file. An AI agent that runs as your user can do it too. A remote host with agent forwarding (ssh -A) can do it too. Use a separate SSH key for curu-memory. Do not forward the agent that holds it.

Recover the key file

Use the recovery slot when you lose the SSH key, or when you change to a new SSH key. The key-encryption key does not change, so no index and no space record changes.

  1. Unseal the key service.

  2. Add the new SSH key to ssh-agent:

    ssh-add ~/.ssh/new_id_ed25519
    
  3. Open the key-encryption key through the key service, and add a slot for the new SSH key:

    curu-memory key recover --ssh-key ~/.ssh/new_id_ed25519.pub --issuer https://auth.example.com/auth/v1/
    
  • The command asks you to log in at the issuer, as key new --protect does. Only the person of the role of the key service can decrypt.
  • The command prints wrote a new agent slot for SHA256:... in .... The old SSH key then opens nothing.
  • A refused login, or a refused decrypt, stops the command with exit code 78. The file does not change.
  • When a later OpenSSH gives another signature for your SSH key, each command stops with "the signature of the key changed". Then recover with the same SSH key.

Protect an existing key file

key protect replaces a plain key file with a protected key file. It makes a new key-encryption key, so the old plain key file opens nothing after it.

curu-memory key protect --old ~/.config/curu-memory/kek --new ~/.config/curu-memory/kek-protected --ssh-key ~/.ssh/id_ed25519.pub --issuer https://auth.example.com/auth/v1/
  • The command rotates each private index and each space record to the new key-encryption key, as key rotate does. Give --space-dir for each encrypted space in git.
  • It deletes the plain key file only after it rotates each space. Then it prints remove each backup of .... Remove each copy of the old file, because each copy opens the old key-encryption key.
  • When a space fails, the plain key file stays, and the exit code is 1. Fix the space. Then run the command again. It continues with the same new key-encryption key, and prints its fingerprint.
  • When the command stops after it wrote the new file, run it again. It deletes the plain key file.
  • Then set CURU_MEMORY_KEK_FILE to the new file.

Encrypt the concept files of a private space

Encrypt the concept files of a private space, so that git and each remote hold only ciphertext. Run the command one time for each space, on the server, with the key file of the server:

curu-memory space encrypt --space team/look ./look-plain ./look
curu-memory index --concepts ./look --space team/look
  • ./look must be new or empty. ./look-plain does not change. Put ./look in git in its place.
  • ./look holds space.json, .gitattributes and the directory objects/. Each concept file and each media file becomes one object with a random name of 26 characters. The object holds the path, so the file names show no concept.
  • The command ignores hidden files and README.md. It names each other file that it does not encrypt, and gives exit code 1. Such a file is, for example, a .txt file, a symbolic link or a file larger than 10 MB. It still writes the encrypted space, with the other files, and its space record. To add a named file, delete ./look and spaces/team--look.json, and run the command again.
  • Each space gets its own space key. The data directory holds it in the space record spaces/team--look.json, under the key of the key file. space.json is a copy of the record. The index refuses a space.json of another space, another generation or another current space key than the record.
  • The index decrypts the objects in memory, and writes no plaintext to disk. It refuses a changed object, an object under another name or of another space, and two objects of the same path. It also refuses each file beside space.json and objects/ that is not hidden, for example a plaintext notes.md. It names the first such file or object and gives exit code 1. Remove it, and run the index again.
  • The index of a private space refuses a directory of plaintext concept files, and names space encrypt. The index of global refuses an encrypted space. Each gives exit code 78.
  • The command refuses global, which stays plaintext, and a target that is not empty, with exit code 2. A second run for the same space into a new directory gives exit code 78. The command also gives exit code 1 when an index run holds the lock.
  • The old plaintext files stay in the git history until you rewrite it, for example with git filter-repo. A copy on a git host can stay after a rewrite, for example in old pull requests and forks. Treat that plaintext as known to others, or move the space to a new repository.

To upgrade a space that version 0.8.0 encrypted, encrypt it again. The new version reads only objects of the new format. Do these steps on the server, with the key file of the server:

  1. Run version 0.8.0 to make a checkout: uvx --from 'curu-memory==0.8.0' curu-memory space checkout --space team/look --to ~/look-plain ./look. The checkout must be outside each git work tree.
  2. Delete the record spaces/team--look.json of the data directory, and the directory ./look of the encrypted space.
  3. With the new version, run curu-memory space encrypt --space team/look ~/look-plain ./look.
  4. Commit the space with a signature: git add --all look, then git commit -S.
  5. Lock the checkout: curu-memory space lock ~/look-plain.

The space then has a new space key. The old objects stay in the git history under the old key. After the upgrade, git log -p shows a locked line for each object of 0.8.0 in older commits. This is correct. Do not run space encrypt for this space again.

These facts still show in git:

  • The number of objects, and the size of each object in a small range. A file of up to 64 KiB shows its size to within 1 KiB. A larger file shows its size to within about 3 %.
  • How often each object changes, and the time and the author of each commit. Write commit messages that name no concept.
  • The space name and the key identifiers in space.json.

The output of index and of space encrypt names the paths of private files. Keep that output and its log private.

Edit an encrypted space

Edit the files of an encrypted space with any editor. Decrypt the space into a checkout: a private directory. Change the files there. Then commit the change. For a space in git, first do the steps in Sign the commits of an encrypted space:

curu-memory space checkout --space team/look ./look
curu-memory space status --space team/look
curu-memory space commit --space team/look
curu-memory space lock --space team/look
  • space checkout prints the checkout. Edit the files there. The checkout has mode 700, and each file has mode 600.
  • The default checkout is $XDG_RUNTIME_DIR/curu-memory/checkouts/team--look when XDG_RUNTIME_DIR is set. Else, on macOS, it is in ~/Library/Caches/curu-memory/checkouts/. Else it is in ~/.cache/curu-memory/checkouts/. --to DIR gives another new or empty directory. space checkout refuses a directory in a git work tree or in the space, because a git add could then commit the plaintext. For the default checkout on Linux with no XDG_RUNTIME_DIR, space checkout gives a warning, because a backup of the home directory can copy ~/.cache.
  • On macOS, the command asks Spotlight and Time Machine to skip each checkout. When Time Machine cannot skip it, the command gives a warning.
  • space status prints one line for each changed, new and deleted path, for example changed: 'notes/quokka.md'. No line means no change. It also says when the space changed since space checkout, for example after a commit of another person.
  • space commit encrypts only the new and the changed files. A moved file keeps its object, and a deleted file loses its object. In git, the command makes one signed commit with the message curu-memory: update an encrypted space, which names no path. It prints the number of changed, new, deleted and moved files, and the new commit. Outside git, it makes no commit and gives a warning. With no change, it makes no commit.
  • When git cannot sign, space commit stops with exit code 78 after it writes the objects. Set up the signature, then commit the space with git commit -S.
  • space commit stops with exit code 1, and changes no object, when another person changed an object since space checkout. Lock this checkout with space lock. Then make a new checkout. Change the file again. It also stops for a rebase in progress, and for a merge in progress when the checkout is not of space checkout --merge, and for conflict markers. It stops for a symbolic link, a special file, a file larger than 10 MB, a hidden file and a bad path. It also stops for a new path that another object holds, or that differs from a path only in case. Another commit of the same space at the same time also stops it.
  • space commit stops with exit code 1, and changes no object, when a new or changed concept has no valid proof. The message names each file and its fault. An unchanged or a moved concept with no proof does not stop the commit.
  • space lock deletes the checkout. It refuses a directory that is not a checkout. The delete is a normal delete, not a secure erase.

Warning: The plaintext of a checkout is on disk until space lock. An editor can keep copies in other places. Examples are the local history of VS Code or JetBrains, and the swap and backup files of vim or Emacs. Use disk encryption, for example FileVault. Turn off these copies for the checkout.

Edit a space through the server

Edit an encrypted space with no key file. The curu-memory server decrypts and encrypts each object after it checks your role on the space. The space key stays on the server. Log in one time. Then check out with --server, and commit with the same --server:

curu-memory login --server https://memory.example.com
export CURU_MEMORY_ALLOWED_SIGNERS=~/.config/curu-memory/allowed_signers
curu-memory space checkout --space team/look --server https://memory.example.com ./look
curu-memory space commit --space team/look --server https://memory.example.com

login prints the issuer, an address and a code. Open the address in a web browser on any device. Log in there. Enter the code. The command then prints logged in to https://memory.example.com.

  • login finds the issuer in the metadata of the server. The metadata must name the address of the server with /mcp, so a server cannot start a login for another server. --issuer URL gives the issuer when the metadata of the server names none. In the basic mode, the server accepts only the static token, so use CURU_MEMORY_SERVER_TOKEN.
  • login asks for read and write access. --read-only asks for read access only, and a commit then stops with exit code 78.
  • login stops with exit code 1 when you deny the code, or when the code expires before you enter it. Run login again.
  • The token cache keeps the tokens, one entry for each server. Its default is $XDG_CONFIG_HOME/curu-memory/login/tokens.json when XDG_CONFIG_HOME is set. Else it is ~/.config/curu-memory/login/tokens.json. CURU_MEMORY_TOKEN_CACHE gives another file. The file has mode 600, and its directory has mode 700.
  • The commands refuse a token cache that other users can read or write, or that another user owns. They also refuse a link, and a cache that is not valid. They also refuse such a directory of the cache. For a file, delete it, then log in again. For a directory, set its mode to 700.
  • The commands renew an access token that expires in less than 60 seconds. When the issuer refuses the renewal, the command deletes the entry and stops with exit code 78. Log in again. When the issuer does not answer, the command keeps the entry and stops with exit code 78.
  • The commands send a token of the cache only to the server of its entry, and to the issuer of the entry. The audience of the token must name the address of the server with /mcp. They print no token.
  • curu-memory logout --server https://memory.example.com deletes the entry of that server, and prints logged out of https://memory.example.com.
  • CURU_MEMORY_SERVER_TOKEN has priority over the cache. Use it for a token that you got in another way, for example the static token. Each command prints the server that gets it.
  • The issuer, its device endpoint, its token endpoint and the address that you open must use https://, except on 127.0.0.1, ::1 or localhost. They must be on the host of the issuer. Else login stops with exit code 78.

Warning: Enter only a code that you started yourself with curu-memory login. A person who sends you a code and an address can get a token of your account when you enter that code.

  • --server is the address of the server, with no /mcp. It must start with https://. Plain http:// is only for a server on 127.0.0.1, ::1 or localhost. For another address, the command stops with exit code 78 and sends no token.
  • In OIDC mode, the token is an access token of the provider for you or for your agent. A commit with a token of a person needs the scope knowledge:write. A token with knowledge:read or with no known scope reads only. In the basic mode (the static token), the token is the CURU_MEMORY_HTTP_TOKEN of the server.
  • A checkout needs a read role on the space, and a commit needs a write role. A member of a team has a write role on the team space. An agent has the weaker of two roles: the role of its grant and the role of its person.
  • A commit of the checkout needs the --server of the checkout. A commit with no --server or with another --server stops with exit code 2 and sends nothing. Thus a change of the state file cannot send your token and your files to another server. space status and space lock need no server and no token.
  • Your computer still does each check of Edit an encrypted space and of Sign the commits of an encrypted space. A space.json with another generation or another space key than the record of the server stops the command with exit code 78.
  • The command stops with exit code 78 for a refused token, no role or a read role on a commit. Exit code 78 is also for no record on the server, a record that the server cannot open, or no answer. The server gives the same answer for no role and for a space that does not exist. An object that the server refuses stops the command with exit code 1.
  • The command uses no proxy of the environment or of the system, so the token and the files go only to the server.
  • The command uses TLS 1.3 or later and the certificates that the system trusts. For another certificate authority, set SSL_CERT_FILE to a file of its root certificates. That file then replaces the certificates of the system.
  • Each request with a valid token writes one line to the audit log of the server. A request with a wrong Host header or a wrong content type writes no line.

The server accepts the static token only when the operator turns on the setting. Set it in the environment of serve:

export CURU_MEMORY_SERVER_UNLOCK_STATIC_TOKEN=1
  • Each holder of the static token then has the roles of CURU_MEMORY_PRINCIPAL on each space. Keep the static token as safe as the key file.
  • The setting accepts 1, true or yes, and 0, false or no. Another value stops serve with exit code 78.
  • Without the setting, the server refuses each request of the static token with HTTP 403. In OIDC mode, the setting has no effect, because each token has its own person.

Sign the commits of an encrypted space

A space in git opens only at a signed commit. index, space checkout and space commit verify the signature of the last commit, and refuse an uncommitted change of the space, with exit code 78. Thus a person with write access to the git host cannot add, change or delete an object without a valid signature.

  1. In the git repository of the space, sign each commit with an SSH key:

    git config gpg.format ssh
    git config user.signingkey ~/.ssh/id_ed25519
    git config commit.gpgsign true
    
  2. Write the file of allowed signers. Each line is an email, namespaces="git" and a public key:

    echo "me@example.com namespaces=\"git\" $(cat ~/.ssh/id_ed25519.pub)" > ~/.config/curu-memory/allowed_signers
    
  3. Name the file in the environment of index, space checkout and space commit: export CURU_MEMORY_ALLOWED_SIGNERS=~/.config/curu-memory/allowed_signers.

  • Only an SSH signature of a key in the file of allowed signers passes. git checks a GPG signature against a keyring, not against this file, so a GPG signature does not pass.
  • Keep the file of allowed signers outside the repository. The commands refuse a file inside the work tree, because a person who can push could then add a key of their own. A relative path in CURU_MEMORY_ALLOWED_SIGNERS starts at the current directory.
  • A commit must hold the space.json of the space. An ignored file in the space is an uncommitted file. Thus a space that git ignores does not open.
  • A space is in git when its directory or a parent directory holds .git. With no CURU_MEMORY_ALLOWED_SIGNERS, index, space checkout and space commit stop with exit code 78. With no git on the PATH, index, space checkout, space commit and space status stop with exit code 78.
  • A space outside git has no history to check. The report of index then has the warning not in git: no signature of the space was checked.
  • The check does not find a roll back of the whole branch to an older signed commit. Read the git log to find it.

Read the diff of an encrypted space

See the plaintext changes of an encrypted space in git diff, git log -p and git show. Set up each clone one time:

curu-memory git install
git log -p -- look/
  • git install writes the textconv of the diff driver curu to the .git/config of this clone only, with the absolute path of curu-memory. Run it again after you move curu-memory.
  • After git install --server https://memory.example.com, the diff decrypts through the server, with the token of curu-memory login or of CURU_MEMORY_SERVER_TOKEN. After git install with no --server, the diff uses the key file.
  • The text of each object starts with the lines space: <space> and path: <path>. git shows them for a new, a deleted or a moved file, and for a change near the start of a file. A media file shows media: <media type>, <size> bytes, not its bytes.
  • When the diff cannot open an object, it shows curu-memory: locked object <object> (<hash>): <reason>, and continues. The reason is, for example, no role on the space or no key file. It is also a space key that no space of the repository holds, or that more than one space holds. <hash> is the first 16 characters of the SHA-256 of the object file. Thus two different locked objects give two different lines, and a change always shows. When the settings are not valid, the line has no hash.
  • A file that is not an object of a space shows as it is, also when a .gitattributes names the driver curu for it.
  • The diff shows each control character of a text, but not the tab or the line end, as an escape, for example \x1b. Thus a text cannot change the terminal.
  • git install turns off the cache of the textconv, because git keeps that cache in refs that a push can send. space status stops with exit code 78 when the cache is on. Run git install again.
  • The diff decrypts each object in memory, and writes no file.
  • git starts curu-memory once for each side of each changed object. One start takes about 0.1 to 0.3 seconds, so a git log -p of many commits is slow. A git log -p of 20 commits takes about 15 seconds with the key file, and more through the server. Give it a path or a range, for example git log -p -5 -- look/.

Merge the branches of an encrypted space

Merge two branches of an encrypted space with git. curu-memory git install also sets up the merge driver curu. Merge with a signature:

git merge -S other
  • When both branches changed a file, the driver decrypts the three versions in memory and merges them. It writes no plaintext file. Changes of different lines merge with no conflict when one or more unchanged lines separate them. Changes of adjacent lines, and two different inserts at the same place, are a conflict, as in git.
  • When a file changed on one branch only, git takes that version, and the driver does not run.
  • The driver merges the path apart from the text. A move on one branch and a change on the other merge. Two different moves of one file are a conflict, and the file keeps the path of your branch. On a terminal, the message names both paths. When the output is not a terminal, for example a log file, the message names only the object, because a path can show a concept.
  • A change of the same line on both branches is a conflict. git reports CONFLICT (content), and the object then holds the text with the conflict markers <<<<<<< ours, ======= and >>>>>>> theirs.
  • A media file that both branches changed is a conflict. The file keeps the version of your branch.
  • When the driver cannot open a version, for example with no key file, it reports a conflict and keeps your version. It does the same for a result larger than 10 MB. It also does so when the lines of the base, multiplied by the lines of the larger side, are more than 2,000,000. Two versions of about 1,400 lines each are at that limit.
  • A version under an old space key is a conflict too. Such a key is neither the key of the base nor the current key. The version can be an old one that a person put back.
  • The merge commit needs a signature, as each commit of an encrypted space. Use git merge -S, or git config commit.gpgsign true. The index refuses a merge commit with no signature.
  • Two branches can give two objects the same path, for example with two new files, or with a move and a new file. git then merges with no conflict, but the index refuses the space, because two objects hold one path. Run git reset --hard ORIG_HEAD. Then rename the file on one branch, and merge again.
  • The signature of the merge commit is your signature. The index checks only the signature of the last commit, so your signature is the only check of the commits of the other branch. Read them with git log -p before you merge.

Resolve a merge conflict of an encrypted space

Resolve a conflict of a merge of an encrypted space. Check out the space of the merge. Remove the conflict markers, then commit:

curu-memory space checkout --space team/look --merge ./look
curu-memory space commit --space team/look
  • space checkout --merge runs only during a merge of two branches. The last commit of your branch (HEAD) and the last commit of the branch that you merge must each have a valid signature.
  • Each file of the space must be of one of the two branches, or an object that the merge driver wrote. Only an object can have a conflict here: a conflict of space.json or .gitattributes stops the command.
  • The command stops with exit code 78 with no merge in progress, a rebase or a bad signature. It does the same for a symbolic link or a file of neither branch, and names it. It also stops for an object of the merge driver that is not under the current space key, and names the object.
  • Edit the files of the checkout. Remove each conflict marker, and keep the text that you want.
  • space commit ends the merge with one signed merge commit, also when you change no file. The message of the commit names no branch and no path.
  • space commit stops with exit code 1 for a file with conflict markers. It also stops for a conflict outside the space, and for a staged change outside the space that is not of the merge. Then no object changes. Resolve a conflict outside the space with git first.
  • space commit also stops when an object of the space changed since the checkout. It stops when the merge is not the merge of the checkout, for example after git merge --abort.
  • To stop the merge, run git merge --abort, then lock the checkout with space lock.
  • space checkout --merge refuses a rebase, and stops with exit code 78. Use git merge.

Check the commits before a push

Stop a push that puts plaintext into an encrypted space. Install the pre-push hook one time in each clone:

curu-memory space hook install
  • Before each push, the hook checks each commit that the push sends. It reads the full tree of each commit. In a directory with space.json, each file must be space.json, the .gitattributes of the space or an object. Each other file stops the push. A symbolic link, a submodule, a file that is not a regular or an executable file, and a space inside a space also stop it.
  • The message names the commit and the file, for example 3f2a9c1d0b7e: 'look/notes.md': it is not an object of the encrypted space, so it can be plaintext. The line starts with the first 12 characters of the commit identifier. Remove the file from that commit, for example with git rebase -i. Then push again.
  • The hook calls curu-memory by its absolute path. Run space hook install again after you move curu-memory. It replaces its own hook.
  • The command refuses to replace a hook that it did not write. If it refuses, add the line curu-memory space check --pre-push "$@" to your hook. It also refuses a hook that is a symbolic link.
  • A person can push with --no-verify, so run the same check in the CI of the repository of the space: curu-memory space check origin/main..HEAD. CI needs the full history, for example fetch-depth: 0 of actions/checkout. Without it, git cannot find origin/main, and the check stops with exit code 1 and the message git rev-list failed.
  • curu-memory space check --all checks each commit of each ref. The check reads the commits, not the work tree. It cannot find plaintext outside the directory of a space.
  • Exit code 1 means a file that breaks a rule, or a git error. Exit code 2 means a revision that starts with -, or no git work tree.

Rewrite the plaintext history

Remove the old plaintext files of a space from the whole git history after space encrypt. Install git filter-repo first. The old plaintext was in a git remote, so treat it as known to others, also after the rewrite. Do these steps in this order:

  1. Make a new mirror clone: git clone --mirror <url> look.git. Go into it: cd look.git.
  2. Write the file ../words.txt, outside the mirror. Write one line for each word that the commit messages must lose, for example Zebroquokka==>(removed).
  3. Remove the plaintext directory and the words: git filter-repo --invert-paths --path look-plain --replace-message ../words.txt. Then delete ../words.txt.
  4. Find each branch and each tag whose name shows content: git for-each-ref --format='%(refname)'. Rename each one, for example git branch -m notes-on-zebroquokka notes-1, or delete it.
  5. Check each commit. Make a normal clone of look.git. In the clone, run curu-memory space check --all.
  6. Push the rewritten history: git push --force --mirror <url>.
  7. In a new clone, add a signed commit: git commit --allow-empty -S -m "curu-memory: sign the rewritten history". Then push it. The rewrite removes each signature of a rewritten commit. Then each person deletes their clone and makes a new one.
  8. Ask the git host to remove its copies of the old commits, for example the refs of old pull requests and its caches. If it cannot, move the space to a new repository.
  • A clone from before the rewrite can push the old history back. The hook and the check of CI do not stop it, because the old plaintext is outside the directory of a space. Delete each old clone.

Rotate the key

Rotate the key to change the key file of the private indexes. The rotation encrypts each private index again under a new data key. With the previous key file, the server answers during the rotation. Do these steps in this order:

  1. Make a new key file: curu-memory key new ~/.config/curu-memory/kek-2.

  2. Restart the server with the new key file and the old key file. The old key file is the previous key file:

    export CURU_MEMORY_KEK_FILE=~/.config/curu-memory/kek-2
    export CURU_MEMORY_KEK_FILE_PREVIOUS=~/.config/curu-memory/kek
    
  3. Rotate each private index. Give the clone of each encrypted space with --space-dir: curu-memory key rotate --old ~/.config/curu-memory/kek --new ~/.config/curu-memory/kek-2 --space-dir ./look.

  4. When key rotate prints its total line with failed 0, push the commit of each space in git, for example git -C ./look push.

  5. Remove CURU_MEMORY_KEK_FILE_PREVIOUS. Then restart the server.

During the rotation, each read with the two key files opens each index with the key that the index names. An index run also reads each other space in this way. Each index run writes under CURU_MEMORY_KEK_FILE only.

The command also wraps the space key of each encrypted space again under the new key. It changes no object. Without --space-dir, git sees no change. It prints one line for each private index, one line for each encrypted space, for example space team/look: rotated, and a total, for example rotated 2, skipped 0, failed 0:

  • rotated: the index is now under the new key, with a new data key.
  • skipped: the new key already opens the index. Thus you can run the command again after a stop.
  • failed: the old key does not open the index, or the index has an older format. Or a person or a fault changed the file, or the index is plaintext. The command does not change the file. Index that space again.

For a space line, rotated means that the new key wraps the same space key. skipped means that the new key opens the record already. failed means that the old key does not open the record, and the record does not change.

With --space-dir DIR, the command also writes the new record into DIR/space.json, and makes one signed commit with the message curu-memory: wrap the space keys again. No object changes. Give --space-dir one time for each space. Then push each commit. Thus the old key file opens no space key in the new commits of git. The command prints one line for each directory, for example space.json /srv/look: rotated:

  • rotated: the command wrote space.json and made the signed commit. For a space outside git, the command writes space.json and makes no commit.
  • skipped: space.json is equal to the record already. The command makes no commit.
  • failed: a check failed, and space.json does not change. In git, the space must be at a signed commit, with no uncommitted change and no merge. Its generation and its space keys must equal those of the record. The line gives the reason.

--space-dir decrypts no object, so it works also when CURU_MEMORY_KEK_FILE still names the old key file.

The command holds the index lock, so it stops with exit code 1 when an index run is active. It gives exit code 1 when a space failed. It stops with exit code 78 for a missing or unsafe key file. It also stops with 78 when the old key and the new key are the same key. It does not read the concept files and does not call the embedder. It warns when CURU_MEMORY_KEK_FILE does not hold the new key, because each index run writes under that key file.

If a person steals the key file, rotate the key at once, with the five steps and --space-dir. Then destroy the old key file, each copy of it, and each backup of the data directory from before the rotation. The rotation changes each data key of an index too, so you need no index run.

The rotation does not change a space key. The old space.json in the git history still opens the space keys with the old key file. Thus a person with the old key file and a copy of git can read each encrypted space. Treat its contents as known. Then rekey each space with --remove-old.

If you lose the key file, a rotation cannot help. Delete each *.sqlite.enc file, make a new key file, and index each private space again.

Warning: A rotation does not change a backup. Each backup from before the rotation opens with the old key. Keep the old key file while you keep those backups, or destroy both together.

Rekey an encrypted space

Rekey a space to encrypt each object again under a new space key. Rekey after a leak of a space key, or after a leak of the key file. Do these steps on the server, with the key file of the server, in a clone of the space:

  1. Merge each branch of the space first. A merge after the rekey can keep objects of the branch under the old space key. After --remove-old, the merge driver cannot open those objects, and it reports a conflict. Merge or close each open proposal of the space too.

  2. Rekey the space:

    curu-memory space rekey --space team/look ./look
    
  3. Push the commit: git -C ./look push.

  • The command adds a new generation with a new random space key to the record. It encrypts each object again under the new key. Each object keeps its name. It writes space.json, makes one signed commit with the message curu-memory: rekey an encrypted space, and then saves the record.
  • It prints the new generation, the number of objects and the commit, for example generation: 2, objects: 3 and commit: 3f2a9c1d….
  • The record keeps the earlier space keys, so git log -p still shows the earlier commits.
  • After a leak, add --remove-old. The record then keeps only the new space key. The command prints removed: N, the number of earlier space keys that it removed. git log -p then shows a locked line for each object of an earlier commit. A person with the leaked key and a copy of git can still read the earlier commits, so treat their contents as known. To remove them from git too, rewrite the history or move the space to a new repository.
  • A rekey does not take back plaintext that a person already has, for example in a checkout. A person who edits through the server never holds a space key. Thus the removal of their role is enough, and the space needs no rekey.
  • A checkout from before the rekey cannot commit a changed file, because its object changed. Lock it, and make a new checkout.
  • The space must be in git, at a signed commit, with no uncommitted change and no merge or rebase in progress. The command stops with exit code 78 else, or when git cannot make the signed commit. Then the space and the record do not change.
  • The command holds the index lock, the lock of space commit and the lock of the work tree. It stops with exit code 1 when an index run or a commit holds a lock. It waits for 10 seconds when a proposal or a merge holds the work tree. Then it stops with exit code 1.
  • An open proposal of the space, or a branch proposal/<id> of the space with no record, stops the command with exit code 1. The command names each one. A rekey writes each object again, so each open proposal goes stale.
  • Add --close-proposals to close each open proposal of the space first. The command then prints closed: N before the other lines. N is the number of closed proposals, plus the number of deleted branches with no record. Each proposal gets the reason rekey, and the command deletes its branch. One audit line records the close. If the rekey stops after the close, the proposals stay closed. The authors propose again after the rekey.
  • If the command cannot save the record after the commit, it names the commit and stops with exit code 78. The space does not open then. Reset the branch to the parent of that commit, for example with git reset --hard HEAD~1, and rekey again.
  • The space name is in the encryption of each object. A rekey keeps the name, so it cannot rename a space.

Give each person their own spaces

Register each person and each team. The first person is an instance owner:

curu-memory access person add me
curu-memory access person add guest
curu-memory access team add look
curu-memory access member add look guest

Then set CURU_MEMORY_PRINCIPAL to the handle of the person of each serve, browse or search process. For example, set CURU_MEMORY_PRINCIPAL=me in the environment of the MCP client. A registered principal reads only the spaces where it has a role. With no principal, a process reads global only:

Space Role of each person
global admin for an instance owner, else read.
team/<slug> admin for an instance owner, write for a member of the team, else no role.
personal/<handle> admin for that person only. An instance owner has no role in the personal space of another person.
  • Without CURU_MEMORY_PRINCIPAL, a process reads global only.
  • A CURU_MEMORY_PRINCIPAL that names no registered person stops serve, browse and search with exit code 78.
  • A value that is not a valid handle stops each command with exit code 78.
  • A running server reads the access store at each request. When you remove a person, that person reads nothing from the next request. A tool then gives the error access_refused, and the browser shows the page "No access" with HTTP 403. A media request gets HTTP 404. Each such request writes a refused line to the audit log.
  • curu-memory access person add HANDLE --owner registers another instance owner. The command refuses to remove the last instance owner.
  • curu-memory access person remove, access team remove and access member remove remove a person, a team or a member. When you remove a person or a team, the command also removes its team memberships.
  • A removed person or team keeps the index of its space. The command says so. Delete its index file in the data directory, for example personal--me.sqlite.enc or team--look.sqlite.enc. Else a new person or team with the same handle or slug reads it.
  • A bad handle or slug gives exit code 2. A change that the rules refuse, for example a new member of a team that does not exist, gives exit code 1.

Show the persons, the teams and the role of each person in each space:

curu-memory access show
curu-memory access show --json

The access store is access.sqlite in the data directory. It holds handles and slugs, and no token and no secret. The roles are, from the weakest to the strongest:

Role It allows
read Search and read the concepts of the space, and decrypt them through the server.
triage read, and close each proposal of the space.
write triage, propose a new concept or a change, and encrypt through the server.
maintain write, and list, show, merge and complete the proposals of the space.
admin maintain, and the merge of an own proposal in a protected space with proposal merge --bypass.

Give a person a role for review

The table of the spaces in Give each person their own spaces gives read in global to each person who is not an owner. To let a second person review the proposals of your agents, give that person maintain:

curu-memory access role set ada --space global --role maintain
curu-memory access role remove ada --space global
  • An assigned role is triage or maintain. It only raises a role that the person already has. A personal space has no assigned roles.
  • A grant can then give an agent of that person triage or maintain.
  • Each change writes an audit line with the action role.set or role.remove.

Protect the global space

When a second person can review, protect global:

curu-memory access protect global
curu-memory access unprotect global
  • access protect records the commit of main as the protection base. You can protect only global now.
  • In a protected space, the author of a proposal cannot merge it. The author of a proposal of an agent is the person of the agent. Another person with maintain merges it.
  • An admin can merge their own proposal with curu-memory proposal merge <id> --bypass. The merge commit then has the line Curu-Bypass: <handle>, and the audit line has the reason bypass.
  • Before each index of a protected space, the index checks each first-parent commit of main after the base. Each one must be a merge that the server key signed, with the lines Curu-Proposal and Reviewed-by. The reviewer must not be the author, unless the commit has the line Curu-Bypass.
  • If a commit fails the check, the index refuses the space, names the commit and exits with code 1. Search keeps the last good index. Revert the commit through a proposal.
  • The index also refuses a work tree that is not on main, or that has an uncommitted change or a merge in progress. It also refuses a history that no longer holds the base.
  • A protected space needs CURU_MEMORY_SIGNING_KEY and CURU_MEMORY_ALLOWED_SIGNERS, also for curu-memory index.
  • After a rotation of the server key, the old merges fail the check. Protect the space again to set a new base.
  • Each protect and unprotect writes an audit line with the old and the new base.

Read the audit log

audit.jsonl in the data directory gets one JSON line for each change of access and each refused read. It also gets a line for each proposal, each merge, each close and each refused show of a proposal. Each scratch write and each refused scratch write also gets a line. A refused read is a request for a concept, its links, its page or its media in a space without a role. A request of a principal with no role in any space is also a refused read. The caller gets the same answer as for a concept that does not exist.

Key Value
time The UTC time, for example 2026-10-31T21:00:00Z.
principal person:<handle>, agent:<name>, anonymous for a process with no principal or for a refused token, or operator for the command access.
acts_for The person that an agent acts for, or null.
action For example person.add, person.link, member.remove, agent.add, grant.add, grant.revoke, get_concept, concept_neighbours, read_concept_file, page, media or token. For an edit through the server: space_info, space_decrypt or space_encrypt. For a proposal: proposed, merged, closed or proposal_show, the refused show of a proposal. For a protection: protect, unprotect, role.set, role.remove or index. For a scratch note: scratch.
space The space of the change, of the grant or of the refused read. null for a change of a person or an agent, for a principal with no role in any space, and for a refused token. Also null for an edit through the server that the server refuses before it reads the space. Also null for a refused scratch write of a principal with no person.
outcome changed or refused. For an edit through the server, allowed or refused.
reason For a change, the message that the command prints, for example added the person me. For an edit through the server, ok, no role, no record, read only, static token off, bad request, too large, object refused or record refused. For a refused read, no role in the space or no role in any space. For a refused token, the reason of the token check, for example expired, wrong audience or unknown subject. For a proposal, new concept, change, completion, merged into main, bypass, stale, closed by a person or the details.reason of the error, for example no write role, no maintain role, own proposal or id in use. For a protection, base <old> -> <new>, with none for no base. For a refused index, unreviewed commit. For a scratch note: new note or replaced note, or the reason of the refusal.
subject The handle, the slug or the agent name of a change, or <slug>:<handle> for a member change. The proposal id for proposed, merged, closed and proposal_show lines. null for a refused proposed line. null for a refused read or a refused token. The commit of a scratch write, or null for a refused scratch write.
count Only for an edit through the server: the number of objects or files in the request. 0 for space_info, and for a request that the server refuses before it counts the items.
token Only for an edit through the server: oidc or static, the kind of the token.

A line never holds a token, a question, a concept identifier, a title, media, a path or an object name. curu-memory makes the file with mode 0600. If curu-memory cannot write a line, it writes an error to stderr, and the request gets its normal answer. Rotate it with logrotate and its copytruncate option.

Search the knowledge

curu-memory search "VAE for WAN2.2 5B" --limit 5
curu-memory search "turbo" --type "Model Component" --tag wan
  • --limit sets the number of results, from 1 to 50. The default is 10.
  • --type keeps only concepts of that OKF type. Repeat it for more types.
  • --tag keeps only concepts that have the tag. Repeat it, and each concept must have all the tags.
  • --scratch also returns the scratch notes in your personal space. A search leaves them out by default. A search with --media never returns a note.
  • --json prints the same JSON object as the search_knowledge tool.

Each result gives the identifier, the space, the title, the type, the description, the tags and the sources. The status is the status of the front matter. The score comes from reciprocal rank fusion, from about 0.006 to 0.018. A higher score is a better match. The best match of words alone has a score of about 0.016. A concept that is first in words and in meaning has a score of about 0.018.

matched_unit is the unit that matched the meaning best. summary is the title and the description. overview is the text before the first heading. image.1 is an image at the first place of the media list. audio.2 is a clip at the second place, and video.3 is a video at the third place. Other values are the slug of a ## heading. A repeated slug gets a number, for example notes-2. A ## Summary heading is summary-2. A later part of a long section gets <slug>-part-<n>, for example notes-part-2. matched_kind is text for the summary, the overview or a section, image for an image, audio for a clip and video for a video. Both are null when only the words matched the concept, for example in words_only mode.

The mode line says how the search worked. hybrid means words and meaning. words_only means words only, and the notice line says why. With two or more spaces, a space whose vectors this embedder cannot use is searched by words only. An example is a space with no vectors. When another space can use its vectors, the mode stays hybrid, and the notice names the spaces of words. The notice line also shows when nothing matched. A name such as sdxl_base_1.0 or wan2.2_vae.safetensors matches as one word.

The printed result gives the matched line of each concept that matched by meaning, for example matched: image.1 (image).

With --json and in the tool result, scratch is true for a scratch note and false for a concept. The printed result shows a note with the type (Scratch). The search_knowledge and get_concept tools take the input scratch, with the default false. With false, get_concept gives concept_not_found for a scratch note.

Search with media

Give an image, an audio clip or a video in place of a question, for example an output of a workflow that has a fault:

curu-memory search --media output.png --limit 5
curu-memory search --media voice.flac
curu-memory search --media motion.mp4
  • The file must be a PNG, JPEG, WebP, WAV, FLAC, MP3, Ogg, MP4, MOV, WebM or MKV file of 10 MB or less. The command reads the kind from the first bytes.
  • An image finds the concepts whose images or texts are nearest in meaning. A clip finds the concepts whose clips or texts are nearest, and a video finds videos and texts. Each kind of question finds only its own kind of media. matched_kind says which kind matched.
  • Media has no words, so only the meaning counts. The mode is media. The score is from about 0.009 to 0.016. The first result has about 0.016.
  • Give a question or --media, not both. Both, or neither, stop the command with exit code 2.
  • A bad file stops the command with exit code 2. A bad file is a missing file, a file larger than 10 MB, or a file of an unknown format. The tool gives the error invalid_argument, and details.field is media. See Handle errors.
  • The search needs an embedder that accepts the kind of the file. Without one, the result is empty, and the notice says why.
  • --limit, --type, --tag and --json work as for a question in words.

An agent uses the tool search_knowledge_by_media. It gives the file as base64 text or as a base64 data URI, for example data:image/png;base64,.... The base64 text can have line breaks. It never gives a path. Over HTTP, a request can hold a file of 10 MB as base64.

Search by meaning

Without an embedder, curu-memory searches by words only. To search by meaning too, run an embedder. The default embedder is the curu-vision model service, so curu and curu-memory use the same vectors. See Use the curu-vision model service.

An OpenAI-compatible server also works, with CURU_MEMORY_EMBEDDER_PROTOCOL=openai. It serves POST /v1/embeddings. SGLang, vLLM, Ollama and llama-server serve this API. Its vectors are not the vectors of curu.

The default model is EmbeddingGemma 2 from Google. It changes text, code, images, video and audio into embeddings that you can compare with each other. It is free to use under Apache 2.0.

For example, serve EmbeddingGemma 2 with SGLang on port 30000:

sglang serve --model-path google/embeddinggemma-2 --host 127.0.0.1

Then set the URL before you index, before you search and before you start the server:

export CURU_MEMORY_EMBEDDER_URL=http://127.0.0.1:30000
export CURU_MEMORY_EMBEDDER_PROTOCOL=openai
curu-memory index --concepts ./knowledge

Ollama gives the same model a different name, so set the name too:

ollama pull embeddinggemma-2
export CURU_MEMORY_EMBEDDER_URL=http://127.0.0.1:11434
export CURU_MEMORY_EMBEDDER_PROTOCOL=openai
export CURU_MEMORY_EMBEDDER_MODEL=embeddinggemma-2
  • CURU_MEMORY_EMBEDDER_URL is the base URL of the embedder. A URL that ends with /v1 also works.
  • CURU_MEMORY_EMBEDDER_MODEL is the model name that the embedder serves. The default is google/embeddinggemma-2 for openai and embeddinggemma-2 for curu-vision. Without a URL, this setting stops each command with exit code 78.
  • CURU_MEMORY_EMBEDDER_PROTOCOL is the API of the embedder: curu-vision or openai. The default is curu-vision. Set openai for the POST /v1/embeddings API of the servers above. See Use the curu-vision model service. Another value stops each command with exit code 78. Without a URL, this setting stops each command with exit code 78.
  • CURU_MEMORY_EMBEDDER_TOKEN is a bearer token for the embedder. It is optional for openai and necessary for curu-vision. With a URL, no protocol and no token, each command stops with exit code 78, and the message tells you to set CURU_MEMORY_EMBEDDER_PROTOCOL=openai.
  • CURU_MEMORY_EMBEDDER_TIMEOUT is the time in seconds before a search uses words only. The default is 5. The index command uses the same limit for each request of 32 texts or 4 media files. Increase it for a slow embedder.
  • CURU_MEMORY_EMBEDDER_MIN_SIMILARITY is the lowest cosine similarity that counts as a match of meaning, from -1 to 1. The default is 0.68 for EmbeddingGemma and 0.35 for other models. A higher value gives fewer matches by meaning. A lower value gives more matches, and an unrelated question can get results. A value that is not a number from -1 to 1 stops each command with exit code 78.
  • CURU_MEMORY_EMBEDDER_MIN_IMAGE_SIMILARITY is the same limit for a match between a question in words and an image. The default is 0.68 for EmbeddingGemma and 0.35 for other models. A higher value gives fewer matches with images. A lower value gives more matches, and an unrelated question can match an image. A value that is not a number from -1 to 1 stops each command with exit code 78.
  • CURU_MEMORY_EMBEDDER_MIN_AUDIO_SIMILARITY is the same limit for a match between a question in words and a clip. The default is 0.68 for EmbeddingGemma and 0.35 for other models. A higher value gives fewer matches with clips. A lower value gives more matches, and an unrelated question can match a clip. A value that is not a number from -1 to 1 stops each command with exit code 78.
  • CURU_MEMORY_EMBEDDER_MIN_VIDEO_SIMILARITY is the same limit for a match between a question in words and a video. The default is 0.71 for EmbeddingGemma and 0.35 for other models. A higher value gives fewer matches with videos. A lower value gives more matches, and a question can match a video with a near motion. Descriptions of the test videos scored from about 0.73 with their own videos, and wrong videos reached about 0.70. A value that is not a number from -1 to 1 stops each command with exit code 78.
  • CURU_MEMORY_EMBEDDER_MIN_IMAGE_TO_IMAGE_SIMILARITY is the limit when you search with an image and the unit is an image. The default is 0.89 for EmbeddingGemma and 0.35 for other models. Images of the same content score above about 0.93. Different images can score up to about 0.85.
  • CURU_MEMORY_EMBEDDER_MIN_IMAGE_TO_TEXT_SIMILARITY is the limit when you search with an image and the unit is a text. The default is 0.70 for EmbeddingGemma and 0.35 for other models. Correct descriptions of the test images scored from about 0.75. Wrong descriptions and unrelated concepts reached about 0.69.
  • CURU_MEMORY_EMBEDDER_MIN_AUDIO_TO_AUDIO_SIMILARITY is the limit when you search with a clip and the unit is a clip. The default is 0.87 for EmbeddingGemma and 0.35 for other models. Clips of the same speech scored above about 0.94. Different speech scored up to about 0.80.
  • CURU_MEMORY_EMBEDDER_MIN_AUDIO_TO_TEXT_SIMILARITY is the limit when you search with a clip and the unit is a text. The default is 0.70 for EmbeddingGemma and 0.35 for other models. Correct descriptions of the test clips scored from about 0.73. Wrong descriptions reached about 0.69, and unrelated concepts about 0.68.
  • CURU_MEMORY_EMBEDDER_MIN_VIDEO_TO_VIDEO_SIMILARITY is the limit when you search with a video and the unit is a video. The default is 0.92 for EmbeddingGemma and 0.35 for other models. Videos of the same content scored above about 0.96. Different videos scored up to about 0.89.
  • CURU_MEMORY_EMBEDDER_MIN_VIDEO_TO_TEXT_SIMILARITY is the limit when you search with a video and the unit is a text. The default is 0.725 for the curu-vision service, 0.73 for EmbeddingGemma with openai and 0.35 for other models. With the curu-vision service, correct descriptions of the test videos scored from 0.721, and the best wrong concept scored 0.723. So the description of one test video gets no match.
  • Each of these six settings must be a number from -1 to 1. A higher value gives fewer matches, and a lower value gives more. A value that is not a number from -1 to 1 stops each command with exit code 78.

Set the task prompts

EmbeddingGemma needs a task prompt around each text. curu-memory adds the prompts that Google gives for the model when the model name has embeddinggemma in it:

Text Prompt
A question task: search result | query: {text}
A section of a concept title: {title} | text: {text}

{text} is the text. {title} is the title of the concept, and only the prompt of a section can use it. A different model gets the text with no prompt. Set CURU_MEMORY_EMBEDDER_QUERY_PROMPT for the prompt of a question, and CURU_MEMORY_EMBEDDER_DOCUMENT_PROMPT for the prompt of a section. Each prompt must contain {text}, or the command stops with exit code 78.

A search uses words only and says why in these cases:

  • No embedder is set.
  • The index has no embeddings, or it comes from a different model or other prompts.
  • The index comes from another protocol, or from another served identity of the curu-vision service.
  • The embedder fails or does not answer in time.

An index from version 0.1.0 has no record of its prompts, so it counts as an index with no prompts. To use a different model or other prompts, run the index command again. The index command keeps an embedding cache in the data directory, so a second run sends only the changed text and media to the embedder.

Use the curu-vision model service

The curu-vision model service serves EmbeddingGemma 2 with its own API. It runs one fixed build of the model on the CPU. curu uses the same build, so curu and curu-memory get the same vectors. curu-memory sends each text with its role, a question or a section, and the service adds the task prompt.

Run the service of curu-vision 0.29.1 or a later 0.29 version, with the model embeddinggemma-2. The first command downloads the model one time:

uv run --with "curu-vision>=0.29.1,<0.30" python -m curu_vision fetch embeddinggemma-2
export CURU_VISION_TOKEN=$(head -c 32 /dev/urandom | base64)
uv run --with "curu-vision>=0.29.1,<0.30" python -m curu_vision serve --config service.toml

The file service.toml names the model and the address. For one computer, use this file:

models = ["embeddinggemma-2"]
request_timeout_s = 600

[bind]
address = "127.0.0.1"
port = 8765

Then set two variables:

export CURU_MEMORY_EMBEDDER_URL=http://127.0.0.1:8765
export CURU_MEMORY_EMBEDDER_TOKEN="$CURU_VISION_TOKEN"

For a service on another computer, give its https:// address, because private text goes to it.

  • The token is the token of the service. By default, the service reads it from CURU_VISION_TOKEN. The service refuses each request with no token. Without CURU_MEMORY_EMBEDDER_TOKEN, each command stops with exit code 78.
  • A process that reads a .env file cannot run $(cat ...). Name the file of the token in CURU_MEMORY_EMBEDDER_TOKEN_FILE in place of CURU_MEMORY_EMBEDDER_TOKEN. curu-memory reads the file when a command starts the embedder. It removes one newline at the end of the token.
  • The token file has the checks of the key file. Give it mode 0600, with your user as its owner, and keep it out of the data directory. curu-memory refuses a symbolic link or a second hard link. A bad file stops each command that uses the embedder with exit code 78, and no message holds the token.
  • CURU_MEMORY_EMBEDDER_TOKEN and CURU_MEMORY_EMBEDDER_TOKEN_FILE together stop each command with exit code 78.
  • The default model is embeddinggemma-2, the name that the service uses. CURU_MEMORY_EMBEDDER_MODEL changes it.
  • On a CPU the service is slow. A section of 6,000 characters takes about 20 seconds. Set CURU_MEMORY_EMBEDDER_TIMEOUT to some minutes for the index command, for example 600. Set request_timeout_s in service.toml to the same value or more, as in the example above.
  • curu-memory adds no prompt, so that the text never gets a prompt two times. CURU_MEMORY_EMBEDDER_QUERY_PROMPT and CURU_MEMORY_EMBEDDER_DOCUMENT_PROMPT stop each command with exit code 78.
  • The index records the served identity of the model. When the service gets another model build, other prompts, another preprocessing or another decode of files, a search uses words only. The model build is the weights, the engine, the precision, the quantization and the dimension. A new release of the service that keeps these values also keeps the index valid. The notice line gives the old and the new prompt version, that is, the version of the task prompts of the service. Then index each space again.
  • The service embeds images, audio clips and videos. It decodes each file itself. A clip longer than 30 seconds fails, and the index report gives a warning for it.
  • Do not use the protocol openai with this service. The index command and the search refuse the answer of the service, because the text would get two prompts.

Index again after a change of the protocol

The vectors of the old index come from another protocol, so index each space again one time. Until then, a search uses words only, and the notice line says why.

  1. Set the variables of Use the curu-vision model service.

  2. Index the global space with --new-embedder:

    curu-memory index --concepts ./knowledge --new-embedder
    
  3. Read the warnings of the report. Each warning names a space that still has the old embedder.

  4. Index each of these spaces in the same way, with its own directory and --space:

    curu-memory index --concepts ./team-look --space team/look --new-embedder
    
  5. Stop the server and the browser, and start them again with the variables of step 1.

  6. Search one time. The mode line must say hybrid:

    curu-memory search "VAE for WAN"
    

Do the same steps when you go back to openai. The embedding cache keys each vector by the identity of the embedder. The first index run with a new embedder embeds each text again. An index run of the global space with an earlier embedder uses its old cache entries.

Connect a local agent

A local agent starts curu-memory itself and talks to it on stdio:

curu-memory serve

Do not run this command by hand. Give it to the MCP client, as in the Quickstart. The server reads the index of the data directory. Messages for a person go to stderr. Set CURU_MEMORY_PRINCIPAL in the environment of the MCP client, so that the agent reads your personal and team spaces. To give the agent less than your access, see Limit a local agent to one grant.

Limit a local agent to one grant

A local agent on stdio reads as CURU_MEMORY_PRINCIPAL. To give it less, start it as the agent of one grant:

curu-memory serve --grant 3

The process then reads, reads a concept file and writes only in the space of that grant. A write in another space gets access_refused, and the audit log records it. The process cannot move a concept or give consent to a move, because a move needs two spaces. It can write a scratch note only with a grant on your personal space. A grant that is not live stops the command with exit code 78. This limit is not a security boundary: a process can start with no --grant. With --transport http, serve refuses --grant with exit code 2, because the token of each request decides.

Connect a remote agent

A remote agent connects over streamable HTTP. The server refuses each request without the token:

export CURU_MEMORY_HTTP_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
export CURU_MEMORY_OIDC_RESOURCE=https://memory.example.com/mcp
curu-memory serve --transport http --host 0.0.0.0 --port 6474
  • The token must have 32 characters or more. Without it, the server does not start and exits with 78.
  • --host sets the address. The default is 127.0.0.1, which only this computer can reach.
  • curu-memory serves plain HTTP only. On an address other than 127.0.0.1, ::1 or localhost, put a TLS proxy in front of it. Set CURU_MEMORY_OIDC_RESOURCE to the https:// address of the proxy, with /mcp. Without an https:// value, the server does not start and exits with 78.
  • On such an address, the server accepts only the Host header of CURU_MEMORY_OIDC_RESOURCE. The Host header is the server name in the request. A request with a valid token and another Host header gets HTTP 421. A request with another Origin header gets HTTP 403.
  • --port sets the port, from 1 to 65535. The default is 6474.
  • A request without the token, or with a different token, gets HTTP 401 and no knowledge.

Then connect the agent with the same token:

claude mcp add --transport http curu-memory https://memory.example.com/mcp --header "Authorization: Bearer $CURU_MEMORY_HTTP_TOKEN"

To run the server with rauthy and a TLS proxy in one step, see Deploy the stack with TLS.

Connect agents with OIDC tokens

Use OIDC tokens on HTTP, so that each person has their own identity. curu-memory checks each access token with the keys of one OIDC provider. It never issues a token, and it keeps no password.

  1. Register each person, and link the person to the issuer and the subject (sub) of their tokens. For a new person, use add:

    curu-memory access person add me --issuer https://auth.example.com/application/o/curu-memory/ --subject 4f0c2a
    

    For a person that exists, use link. A new link replaces the old link of the person:

    curu-memory access person link me --issuer https://auth.example.com/application/o/curu-memory/ --subject 4f0c2a
    

    Give --issuer the same text as CURU_MEMORY_OIDC_ISSUER and as the iss of the tokens, with the same last /.

  2. Set the settings in the table below. Set CURU_MEMORY_OIDC_RESOURCE to the address that the MCP clients use, for example https://memory.example.com/mcp. Then start the server:

    curu-memory serve --transport http --host 0.0.0.0 --port 6474
    
  3. Connect the MCP client with no token. The MCP client finds the provider from the metadata of the server, and asks the person to log in:

    claude mcp add --transport http curu-memory https://memory.example.com/mcp
    
Setting Meaning Default
CURU_MEMORY_OIDC_ISSUER The issuer URL of the provider, as in the iss of a token. It turns on the OIDC mode. Plain http is only for an issuer on 127.0.0.1, ::1 or localhost. none
CURU_MEMORY_OIDC_RESOURCE The canonical URI of the server: the address that the MCP clients use, with /mcp. On a network address it must start with https://. http://<host>:<port>/mcp of serve
CURU_MEMORY_OIDC_AUDIENCE The value that the audience (aud) of a token must hold. the resource
CURU_MEMORY_OIDC_TOKEN_TYPES The accepted typ values of the token header, separated by commas. at+jwt
CURU_MEMORY_OIDC_BASIC_CLIENT_ID The client identifier for the exchange of an app password. Empty turns the exchange off. See Let an agent send its app password. none

A bad value stops each command with exit code 78.

  • The server publishes its metadata at /.well-known/oauth-protected-resource/mcp. It names the provider.
  • A request with no token, or with a refused token, gets HTTP 401. The WWW-Authenticate header names the metadata URL.
  • curu-memory refuses a token with a bad signature, the algorithm none or an HMAC algorithm.
  • It also refuses a token of another issuer or audience. It refuses a token whose header has a typ that is not in the list. A token with no typ passes this check.
  • It also refuses an expired token, and a token that is valid for more than 1 hour. It refuses a token that names no registered person and no registered agent.
  • Each refused token writes a line to the audit log, with the reason and no part of the token.
  • curu-memory reads the keys of the provider again for an unknown key, at most one time each 60 seconds. After a failed read, it waits 10 seconds.
  • With CURU_MEMORY_OIDC_ISSUER, serve ignores CURU_MEMORY_HTTP_TOKEN, and writes a notice to stderr. The static token is the basic mode only when you use no OIDC provider. The browser has no OIDC login, so browse still uses the static token.
  • A token of an agent, for example a token of the client credentials grant, reads only the spaces of its grants. See Give an agent its own access. A token of no person and no agent gets HTTP 401.

Use Authentik

Authentik puts the client identifier of its OAuth client in aud, and writes the token type JWT. Make one provider only for curu-memory, so that no token of another application has that aud:

  1. In Authentik, make an OAuth2/OpenID provider and an application for curu-memory. An Authentik blueprint can also make them.
  2. Select a signing key for the provider, for example authentik Self-signed Certificate. Without a signing key, Authentik signs with HS256, and curu-memory refuses each token.
  3. Add the redirect URI of your MCP client to the provider.
  4. Find the client identifier and the issuer of the provider. The issuer is https://<authentik host>/application/o/<application slug>/.
  5. Set CURU_MEMORY_OIDC_ISSUER to the issuer, CURU_MEMORY_OIDC_AUDIENCE to the client identifier, and CURU_MEMORY_OIDC_TOKEN_TYPES to at+jwt,JWT.
  6. Find your sub. The subject mode of the provider sets it. The default is a hash of your user identifier, which you can read in one of your tokens. With the subject mode "Based on the User's username", your sub is your user name.
  7. Link your person to your sub with curu-memory access person link.

With the type JWT, or with no type, curu-memory also requires the claims azp and scope. An ID token of Authentik has no scope, so curu-memory refuses an ID token that an MCP client sends as an access token.

Give an agent its own access

An agent acts for one person, and reads only the spaces of its grants. First, register the agent. Then give it a grant:

curu-memory access agent add scout --person me --issuer https://auth.example.com/application/o/curu-memory/ --subject 9b1e7d
curu-memory access grant scout --space team/look --role read --days 30
  • Use --subject for an Authentik service account: its sub is in each of its tokens. Use --client for a rauthy client, whose tokens have no sub. A token with a sub is the agent of a client only when the sub is the client identifier. Thus a person that logs in through that client is not the agent.
  • In a space, an agent gets the weaker of two roles: its strongest live grant, and the current role of its person. When the person loses a role, the agent loses it too.
  • A grant lasts 90 days by default, and at most 366 days. The command refuses a grant that is stronger than the role of the person.
  • access grant prints the identifier of the grant. End a grant with curu-memory access revoke <id>. From its next request, the agent reads that space only through its other live grants for that space, if it has some.
  • curu-memory access agent remove <name> removes an agent and its grants. When you remove a person, its agents go too.
  • curu-memory access show lists each agent and its live grants.
  • An agent with no live grant gets the error access_refused. Each audit line of an agent names its person in the key acts_for.
  • A token that matches more than one person or agent gets HTTP 401, with the audit reason more than one principal.

Let an agent send its app password

Many agent tools can send only a fixed header, and an Authentik token expires after some minutes. Set CURU_MEMORY_OIDC_BASIC_CLIENT_ID to the client identifier of the provider, for example curu-memory. Then an agent can send the user name and the app password of its Authentik service account, in the header Authorization: Basic <base64 of user name:app password>.

  • curu-memory sends them to the token endpoint of the issuer, with the client credentials grant. Then it checks the token as each other token.
  • curu-memory keeps the token until 30 seconds before its exp or its expires_in, whichever comes first, and at most 1 hour. It finds the kept token by the SHA-256 of the header, so it keeps no password.
  • A refused exchange gets HTTP 401, and the audit log gets a line with the reason basic exchange refused. No line holds the user name or the password.
  • curu-memory keeps a refused header for 10 seconds, so a repeat of it sends no request to the issuer.
  • At most 4 exchanges run at the same time. More Basic requests wait, and bearer tokens do not wait for them.
  • The token endpoint must use https off loopback.
  • The app password goes to curu-memory with each request, so put TLS in front of curu-memory. Leave the setting empty where no agent needs it.

Use the shipped rauthy

If you have no OIDC provider, use the rauthy of deploy/rauthy/. rauthy is an OIDC provider in one container, with no database server. Run these commands from the root of the repository:

deploy/rauthy/init.sh
docker compose -f deploy/rauthy/compose.yaml up -d
deploy/rauthy/setup.sh
  • init.sh writes deploy/rauthy/local/ with new random secrets, one time. Git ignores that directory.
  • rauthy listens on 127.0.0.1:6480, and its issuer is http://localhost:6480/auth/v1/.
  • setup.sh also puts the canonical URI in each token of the client curu-memory-cli, which curu-memory login uses. A code of that client is valid for 5 minutes.
  • setup.sh lets the OAuth client curu-memory ask for tokens for http://127.0.0.1:6474/mcp. Set CURU_MEMORY_OIDC_RESOURCE before init.sh and setup.sh for another address.
  • The OAuth client curu-memory uses the authorization code grant with PKCE (S256). Its redirect URIs are http://localhost:6476/callback and http://127.0.0.1:6476/callback. An MCP client that uses another redirect URI registers its own OAuth client.
  • The first start writes the password of admin@localhost to the log of the container. Read it with docker compose -f deploy/rauthy/compose.yaml logs rauthy.
  • Make your user in the admin pages of rauthy. A user needs a given name. Your sub is the user identifier that rauthy shows.
  • An access token of the OAuth client curu-memory is valid for 10 minutes.

See deploy/rauthy/README.md for a server on a network, behind a TLS proxy.

Deploy the stack with TLS

Deploy curu-memory, rauthy, an embedder and the TLS proxy Caddy together on a server with Docker. The stack serves three host names over HTTPS: the MCP server, the browser and rauthy. Caddy gets their certificates from Let's Encrypt. You need a server with ports 80 and 443 free, and a DNS name for each of the three host names. The stack needs Docker Compose 2.20 or later. Run these commands from the root of a clone:

MEMORY_HOST=memory.example.com BROWSE_HOST=browse.example.com AUTH_HOST=auth.example.com ACME_EMAIL=me@example.com CONCEPTS_DIR=/srv/knowledge deploy/stack/init.sh
docker compose -f deploy/stack/compose.yaml --env-file deploy/stack/local/.env up -d --build
deploy/stack/setup.sh
  • init.sh writes deploy/stack/local/ one time, with new random secrets. It refuses to run again while local/ exists.
  • The first start builds the global space from CONCEPTS_DIR. Each start builds it again.
  • Each host name accepts TLS 1.3 only, and sends HSTS. Plain HTTP gets a redirect to HTTPS.
  • Only Caddy publishes ports. Inside the stack, curu-memory reaches rauthy at its https:// address through Caddy.
  • setup.sh lets the OAuth client curu-memory ask for tokens for https://<MEMORY_HOST>/mcp.
  • The stack has its own embedder, so a search uses words and meaning. The first start downloads one fixed version of the model from Hugging Face, about 1.5 GB, into a Docker volume. The index waits until the model loads. A new build of the image keeps the model.
  • The embedder needs about 4 GB of memory, and its limit is 6 GB. EMBEDDER_MEMORY changes the limit. It also uses at most 2 CPUs. EMBEDDER_CPUS changes that limit.
  • curu-memory sends private text to Caddy over TLS 1.3, on a port that the stack does not publish. Caddy sends it to the embedder as plain HTTP on a private network. Only Caddy and the embedder share this network, and it has no route out of the server.
  • The stack waits up to 300 seconds for each request to the embedder, because an embedder on a CPU is slow. If the embedder does not answer, a search can wait this time before it uses words only. CURU_MEMORY_EMBEDDER_TIMEOUT changes the time.
  • If Hugging Face asks for a login to download the model, set HF_TOKEN before init.sh. Use a token of an account that accepted the licence of the model. Without the token, the log of the service embedder-fetch names HF_TOKEN, and the services index, serve and browse do not start.
  • To use an embedder that you already run, set CURU_MEMORY_EMBEDDER_URL to its https:// address before init.sh. The stack then starts no embedder and downloads nothing. init.sh refuses an http:// address, because private text goes to the embedder. The embedder must serve POST /v1/embeddings, because the stack sets the protocol openai. The stack cannot use the curu-vision service.
  • To search by words only, set EMBEDDER=none before init.sh. The stack then starts no embedder.
  • The web browser asks for a user name and a password. Type any user name, and the value of CURU_MEMORY_HTTP_TOKEN in deploy/stack/local/curu-memory.env as the password. The browser has no OIDC login.
  • The stack without an embedder uses less than 1 GB of memory.

To test the stack on one computer, use local mode. Caddy then uses its own certificate authority (CA) for memory.localhost, browse.localhost and auth.localhost. Give the directory of your concept files:

STACK_MODE=local CONCEPTS_DIR=$PWD/knowledge deploy/stack/init.sh

Then start the stack with the docker compose command above. Then run deploy/stack/setup.sh. It copies the root certificate of the CA to deploy/stack/local/caddy-root.crt. Give that file to each client, for example curl --cacert deploy/stack/local/caddy-root.crt https://memory.localhost/mcp. deploy/stack/README.md gives the other settings, the trust of the CA and the staging certificates of Let's Encrypt.

Run the key service in the stack

The stack can run OpenBao as the key service of the recovery slot. Start it only when you use a protected key file.

  1. Set KEY_SERVICE=1 before init.sh. In local mode, the key service is at keys.localhost. On a host, set KEYS_HOST to a name with DNS, or the stack uses keys. and the domain of MEMORY_HOST.

  2. Start the stack and run setup.sh, as above.

  3. Find your user id in the admin page of rauthy. Then set up the key service one time:

    OWNER_SUBJECT=<your rauthy user id> deploy/stack/keys-setup.sh
    
  4. Keep the unseal key that the command prints in a safe place, for example a password manager. The command saves it nowhere.

  5. Restart the key service. A restart seals it:

    docker compose -f deploy/stack/compose.yaml --env-file deploy/stack/local/.env restart openbao
    
  • keys-setup.sh makes the transit key curu-memory-kek and the role curu-memory-owner. Only your rauthy user can decrypt with it, through the client curu-memory-keys.

  • Set AUDIENCE for keys-setup.sh to the aud of the token of your login. The default is curu-memory-keys.

  • The command revokes the root token at its end, also after a failed step.

  • The key service writes each request to its audit log, /openbao/logs/audit.log in the volume openbao-logs.

  • Caddy passes only the requests of the recovery slot to the key service. Each other path answers 404.

  • A sealed key service decrypts nothing, also for a person with a copy of its volume. Unseal it only for key new --protect, key protect and key recover:

    docker compose -f deploy/stack/compose.yaml --env-file deploy/stack/local/.env exec openbao bao operator unseal
    
  • Only Caddy shares the network of the key service, and that network has no route out of the host.

  • An administrator of the key service with the unseal key can decrypt the recovery slot. Trust the operator of the key service.

These five tools are read-only. The tools propose_concept and propose_change of Propose a concept and Propose a change of a concept write proposals.

Tool Input Result
search_knowledge question, and optional limit, types and tags The matching concepts, the mode and the notice, as in Search the knowledge.
search_knowledge_by_media media as base64 text or a base64 data: URI, and optional limit, types and tags The same object as search_knowledge, with the mode media. See Search with media.
get_concept id The fields of one concept, its space, its path, its full Markdown body and its media list. Each media item gives the path relative to the concept directory, the sha256 and the mime type of an image, a clip or a video.
concept_neighbours id The links from the concept (outgoing) and to the concept (incoming).
read_concept_file id The full file of the concept on main: its id, text, its version (the sha256 of text), its space and its path. The tool reads only a concept in a space that takes proposals.

Each neighbour gives the identifier, the link kind and the title of the other concept. resolved is false for a link to a concept that is not in a space that the caller can read. Such a link has no title. Use these tools in sequence: search, read the best concept, then follow its links for more context.

Propose a concept

An agent can propose a new concept with the tool propose_concept, in global, in a team space or in a personal space. The concept goes on its own git branch. Search does not find it until a person with the maintain role merges it. In a personal space, the person of the space has admin, which includes maintain.

Prepare the server for proposals

  1. Keep the concept files of each space that takes proposals in a git work tree that has a branch main. The directory of a team space or a personal space is an encrypted space, as Encrypt the concept files of a private space says. Use this work tree for the server only.

  2. Make the server key, an SSH key with no passphrase:

    ssh-keygen -t ed25519 -N "" -C server@curu-memory.invalid -f ~/.config/curu-memory/server-key
    
  3. Add its public key to the file of allowed signers of Sign the commits of an encrypted space:

    echo "server@curu-memory.invalid namespaces=\"git\" $(cat ~/.config/curu-memory/server-key.pub)" >> ~/.config/curu-memory/allowed_signers
    
  4. Set the settings in the environment of serve:

    export CURU_MEMORY_SPACE_DIRS=global=/srv/knowledge
    export CURU_MEMORY_SIGNING_KEY=~/.config/curu-memory/server-key
    export CURU_MEMORY_ALLOWED_SIGNERS=~/.config/curu-memory/allowed_signers
    
  5. Register the agent, as in Give an agent its own access. Then give it the write role in global: curu-memory access grant scout --space global --role write.

Setting Meaning Default
CURU_MEMORY_SPACE_DIRS The concept directory of each space that takes proposals, as space=path entries separated by commas. Each path is absolute. A private space also needs CURU_MEMORY_KEK_FILE. none: the server refuses each proposal
CURU_MEMORY_SIGNING_KEY The server key: the SSH private key that signs each commit of the server. Its public key must be in the file of allowed signers. none: the server refuses each proposal
CURU_MEMORY_ALLOWED_SIGNERS The file of allowed signers. The server checks each of its own commits with it. none: the server refuses each proposal
  • The server is the only writer of this work tree. Do your own edits in another clone, and push them to the same remote.
  • The server does not push. Push main from the work tree after each merge.
  • An SSH agent can hold the key in place of a key with no passphrase.

Call the tool

Input Meaning
space The space of the new concept: global, team/<slug> or personal/<handle>. The agent needs the write role there.
id The new concept identifier: 1 to 128 characters from a to z, 0 to 9, ., _ and -. The first character is a letter or a digit, and the identifier has no ... It is also the file name, with .md.
text The full concept file, as in Write a concept file, with the provenance keys below. At most 256 KiB.

A proposed concept must have these keys in its front matter:

Key Meaning
tier The space of the proposal, for example global or team/look.
sources A list of 1 or more mappings, for example - url: https://example.com/guide.
confidence How certain the claim is, from 0 to 1. 1 means certain, 0.5 means as likely as not, and 0.2 means a guess.
date The date of the sources and the proofs, as YYYY-MM-DD.
evidence 1 or more proofs that a reader can reproduce, as in Give a proof for each concept.

The server writes author, the handle of the person behind the agent, and agent, the name of the agent. The server refuses a concept that names another author or another agent. It also refuses a concept with media, because a proposal holds text only.

The result gives the id of the proposal, its space, the concept identifier concept_id, the state open, the branch proposal/<id> and the commit. It also gives author, agent (null for a person) and the UTC time created. reviewer, merged and merge_commit are null until the merge. kind is new. closed_by, closed and reason are null until a close. The branch has one commit, and the server key signs it. Its git author is the person, as <handle> <<handle>@users.curu-memory.invalid>. Its committer is curu-memory <server@curu-memory.invalid>. The commit message holds the line Curu-Proposal: <id>, and for an agent the line Curu-Agent: <name>. It holds no concept text.

A refused proposal makes no branch and no record. The error codes are access_refused, invalid_concept, invalid_argument and proposal_refused, in Handle errors. With OIDC tokens, a person token needs the scope knowledge:write to propose.

Propose in a private space

A proposal in a team space or a personal space keeps the name of its concept secret. The git host and the data directory of the server show no concept identifier, title or path:

  • The branch writes one encrypted object, objects/<object id>, under the current space key. A new concept gets a new object. A change writes the object of the concept again, with the same object id.
  • The commit message holds the same lines as in global. No line names the concept.
  • In the result and in the record, concept_id is null. The record holds a keyed hash of the concept identifier in its place. The hash stops two open proposals of one concept.
  • One concept identifier has one open proposal in all of the spaces. The tool refuses a second proposal of the same identifier with the reason id in use, also in another space.
  • The tool refuses a private space whose directory is not an encrypted space, with the reason not encrypted.
  • In a private space, the work tree must be on main, with no uncommitted change and no merge in progress. Else propose_concept, propose_change and read_concept_file refuse with the reason checkout not ready.
  • proposal complete refuses a private space, with the reason encrypted space.

Propose a change of a concept

An agent with the write role changes one existing concept with two tool calls. The concept can be in global, in a team space or in a personal space. With OIDC tokens, a person token needs the scope knowledge:write to propose a change.

  1. Call read_concept_file with the id. Keep text and version.
  2. Change text.
  3. Call propose_change with space, id, version and the new text.
  • Send the full file, with each key that you did not change. The server refuses a file that changes author, agent or contributors, because it sets them.
  • author stays the first author of the concept. The tool refuses a change of a concept with no author: a person with maintain completes it first. The server adds the person of the change to contributors, unless the person is the author or is in the list.
  • The concept needs the provenance keys of Call the tool. Complete old concepts first, as in Complete the provenance of old concepts.
  • The change goes on its own branch. Search shows the old text until a person with maintain merges it.
  • If the concept changed after you read it, the tool refuses the change with the reason stale. Read it again, and propose again.
  • If the concept changes on main after the proposal, the merge closes the proposal as stale. Then read the concept again, and propose again.
  • The tool refuses a concept that has an open proposal, for example an open completion. It also refuses a text that is equal to the file on main.

The result is the proposal, as for propose_concept, with the kind change. The commit message holds Curu-Kind: change and Curu-Base: <commit>, the commit of main that the change starts from.

Review and merge a proposal

A person with the maintain role in the space reviews each proposal and merges it. Run the commands on the server, with the settings of Prepare the server for proposals and CURU_MEMORY_PRINCIPAL:

export CURU_MEMORY_PRINCIPAL=me
curu-memory proposal list
curu-memory proposal show <id>
curu-memory proposal merge <id>
git -C /srv/knowledge push origin main
  • proposal list shows the open proposals of each space where you have maintain, oldest first. Each row gives the id, the space, the concept identifier, the author, the agent and the UTC time. A completion shows (completion) in place of the concept identifier. Add --space global for one space, and --json for a JSON list.
  • proposal show prints the record of the proposal, then its concept file. The record gives the id, the space, the concept identifier, the author, the agent, the time, the state, the branch and the commit. A merged proposal also shows the reviewer, the merge time and the merge commit. Read the sources and the confidence before you merge.
  • For a proposal of a private space, the server decrypts the object. Only a person with maintain in the space sees the concept identifier and the file. After space rekey --remove-old, a proposal from before the rekey does not open, and proposal show stops with exit code 1.
  • proposal merge makes a merge commit on main that the server key signs. The commit message holds the lines Curu-Proposal: <id> and Reviewed-by: <handle>. The command then deletes the branch and builds the index of the space, so search finds the concept at once.

The merge refuses a proposal and leaves main as it was in these cases:

Case Exit code
No proposal has the id, the proposal is not open, or you have no maintain role. 1
The space is protected, and you are the author of the proposal (own proposal). 1
main already holds a concept file with the same identifier. 1
A concept of a completion or of a change changed on main after the proposal. The merge also closes the proposal and deletes its branch. 1
The proposal is a move with no consent (no consent), or its concept changed in the source after the start (stale). 1
Another write held the work tree for 10 seconds. 1
The work tree is not on main, or it has an uncommitted change or a merge in progress. 78
A git command failed, for example the merge. main stays as it was. 78
The branch is not at the commit of the proposal, or a commit has no valid signature. 78
CURU_MEMORY_SIGNING_KEY, CURU_MEMORY_ALLOWED_SIGNERS or CURU_MEMORY_SPACE_DIRS is not correct. 78

If the index build fails after the merge, the merge stays on main. The command prints the index command to run, and exits with code 1.

A crash of the server between the commit and the record can leave a branch with no record. proposal list then makes the record from the signed commit, and prints repaired: <id>.

Close a proposal

Close a proposal that nobody will merge. Its concept is then free for a new proposal:

curu-memory proposal close <id>
  • Run the command on the server, with the settings of Prepare the server for proposals and CURU_MEMORY_PRINCIPAL.
  • The id is in the result of propose_concept, propose_change or propose_move. A person with maintain also finds it with proposal list.
  • A person with triage or a stronger role in the space closes each proposal. An admin of the source of a move also closes the move, for example to refuse a move that waits for consent.
  • The command deletes the branch, if the proposal has one, and sets the record to closed, with the person and the time. It prints closed: <id>.
  • The command refuses an unknown proposal, a proposal that is not open, and a person who may not close it, with exit code 1.
  • Each close and each refused close writes one audit line with the action closed.

Move a concept to a wider tier

Move a concept that is ready for more readers. A move goes from your personal space to a team space or to global, or from a team space to global. A person with maintain in the target reviews the move and merges it. After the merge, the concept is only in the target.

  1. Start the move on the server, with the settings of Prepare the server for proposals:

    export CURU_MEMORY_PRINCIPAL=me
    curu-memory proposal move tiled-vae --from personal/me --to global
    

    The command prints proposed: <id>, the target space and consent: yes.

  2. A person with maintain in the target reviews and merges the move, as in Review and merge a proposal:

    curu-memory proposal show <id>
    curu-memory proposal merge <id>
    
  3. Search the target for the concept. The search of your personal space no longer finds it.

These rules apply to each move:

  • You need the write role in the source and in the target. In global, only an instance owner or a person with maintain has write.
  • With OIDC tokens, a person token needs the scope knowledge:write to start a move or to give consent.
  • The move needs the consent of an admin of the source. You are the admin of your personal space, so your own move has consent at once.
  • An agent calls the tool propose_move with source_space, id and target_space. An agent with admin in the source gives consent when it starts the move. To let an agent move a concept with no manual step, give it admin in your personal space.
  • A move of a person or an agent with write, and not admin, in the source waits for consent. The tool result has consent: false, and the command prints consent: no: it waits for proposal consent. The target holds nothing of the concept until the consent.
  • Give consent with curu-memory proposal consent <id>, or with the tool consent_move. It needs admin in the source. The id is in the result of propose_move or proposal move. The command prints consented: <id>.
  • To refuse a move, close it with curu-memory proposal close <id>. The concept stays in the source, and it does not change.
  • The moved file gets the target space as its tier. Its author and agent do not change. The person of the move goes into contributors when that person is not the author.
  • The merge makes the signed merge commit in the target. Then it makes one signed commit in the source that deletes the concept. The git history of the source keeps the old encrypted object.
  • If the concept changes in the source after the start, the consent or the merge closes the move with the reason stale. Start the move again.
  • If the server stops between the two commits, the next proposal list deletes the concept from the source and prints repaired: <id>. Until then, no proposal can change the concept in the source. If a person edits the source concept by hand in that time, the repair keeps it. It then writes a removed line with the outcome refused. Each later proposal list writes this line again. No proposal can change the concept until you delete the source copy, for example in a checkout of the source space.
  • proposal show of a move prints the moved file, with the target as its tier. A move that waits for consent has no file yet.
  • In a private space, no commit message and no proposal record names the concept.
  • The start writes the audit action proposed. A later consent writes consented. The merge writes removed in the source and merged in the target. A close writes closed, and a refused step writes one line with the outcome refused.

The command prints the message and exits with code 1 in these cases. The tool gives the reason in details.reason.

Case Reason
The target is not a wider tier, for example global to a team, or one team to another. not wider
You have no write role in the source or in the target. no write role
The source has no concept with the id. unknown concept
The concept is a scratch note, or it has media. scratch note or media
The concept has an open proposal, or another space holds the id. id in use
The concept has no author, or it breaks a rule of OKF. missing provenance or schema fault

Complete the provenance of old concepts

Old concepts, for example those of curu, often have no tier, author, confidence or date. validate names each of them with a fault of the kind provenance. The index still reads them, but they do not obey the provenance rule that propose_concept uses for a new concept. Complete them with one reviewed proposal:

export CURU_MEMORY_PRINCIPAL=me
curu-memory proposal complete --space global --author me --confidence stable=0.9,unverified=0.5,draft=0.3,superseded=0.1,none=0.5
curu-memory proposal show <id>
curu-memory proposal merge <id>
  • Run the commands on the server, as a person with maintain, with the settings of Prepare the server for proposals.
  • --author names the registered person who answers for the old concepts. The author of each source stays as it is.
  • --confidence gives the confidence of each status, from 0 to 1. 1 means certain, 0.5 means as likely as not, and 0.2 means a guess. none is the value for a concept with no status. These values are examples: choose your own. The command refuses a status that the map does not cover.
  • The command adds only the keys that a concept does not have. It does not add sources or evidence, and it does not correct a key that is there. After the merge, validate still names those faults. A completed concept still needs a proof.
  • tier is the space. date is the newest of verified.at, generated.at, superseded_at and the last_modified of each source. With none of these, it is the date of the last commit of the file.
  • The proposal is one signed commit that changes each incomplete concept of the space, on a branch proposal/<id>. main does not change until the merge. proposal show prints the change of each file.
  • The command refuses while a completion of the space is open, or while a concept of the space has an open proposal. With nothing to complete, it prints Nothing to complete..
  • The command prints proposed: <id>, branch: proposal/<id> and concepts: N. N is the number of concept files that the proposal changes. --json prints id, branch, concepts and skipped.
  • The command leaves out a file whose front matter it cannot read, and names it on stderr as skipped: <path>: the front matter cannot be read. With --json, the list skipped holds the same text for each file.
  • If a concept of the completion changes on main before the merge, the merge closes the proposal as stale. It prints closed: <id> (stale), deletes the branch and exits with code 1. Run proposal complete again.

Keep scratch notes of an agent

An agent can keep a note of its work, for example a plan or a partial result. A person can also write a note. The note stays in the personal space of the person, or of the person that the agent acts for. A note is not knowledge: it needs no source and no review, and a search leaves it out.

The agent or the person calls the write_scratch_note tool:

Input Meaning
id The note identifier: 1 to 128 characters, with the rule of the id of Propose a concept. It is also the file name, with .md.
title The title of the note: 1 to 200 characters, on one line.
body The Markdown text of the note. The whole file is at most 256 KiB.

The tool has no space input. The space is personal/<handle> of the caller, or of the person that the agent acts for. The server writes the front matter of the note:

type: Scratch
title: Plan for the tiles
description: Plan for the tiles
scratch: true
tier: personal/me
author: me
agent: scout
date: 2026-11-04
  • The personal space must be an encrypted space in a git work tree, with the settings of Prepare the server for proposals. Else the tool refuses with the reason not encrypted, no concept directory or not signed.
  • The agent needs write in the personal space. Give it with curu-memory access grant scout --space personal/me --role write. With OIDC tokens, a person token needs the scope knowledge:write.
  • The note goes on main with no review, as one encrypted object in one signed commit. The commit message is curu-memory: write a scratch note and, for an agent, Curu-Agent: <name>. Git holds no note identifier, title or text.
  • Then the server indexes the personal space again. The result gives id, space, commit, replaced and index_error. commit is the hash of the signed commit on main. The audit line names the same commit. index_error is null, or it says why the index run failed. The note stays on main when the index run fails.
  • A second write with the same identifier replaces the note. Then replaced is true.
  • The tool refuses an identifier that a concept or an open proposal has, with the reason id in use. It refuses a checkout that is not on a clean main, with the reason checkout not ready.
  • propose_concept and propose_change refuse a text with the key scratch, with the reason scratch note. propose_change also refuses a scratch note. A note does not go to a team space or to global.
  • The index skips a file with scratch: true in a team space or in global, and names it as a fault. It also skips a file whose scratch key has a value other than true.

To read the notes back, search with scratch set to true, or run curu-memory search --scratch. Only the person of the personal space and the agents of that person can read the notes. concept_neighbours and the browser never show a note. A link to a note looks like a link to a missing concept.

To delete a note, do these steps:

  1. Push main from the work tree of the server.
  2. In another clone, pull main.
  3. Delete <id>.md in a checkout of the space.
  4. Run curu-memory space commit --space personal/me.
  5. Push the commit.
  6. In the work tree of the server, run git pull --ff-only.
  7. Index the personal space again with curu-memory index --space personal/me --concepts <dir>. Until then, a search with scratch still finds the note.

Browse the knowledge

A person can search the knowledge and follow the links of a concept in a web browser:

curu-memory browse
  • --host sets the address. The default is 127.0.0.1, which only this computer can reach.
  • --port sets the port, from 1 to 65535. The default is 6475.

Open http://127.0.0.1:6475/. Type a question, and the page lists the same concepts, in the same order, as the search_knowledge tool. Each result shows its title, type, description, tags and score. The score, the mode and the notice mean the same as in Search the knowledge. Select a result to open its page.

  • The page of a concept shows its fields, its sources, its body and its links in both directions.
  • The page of a concept also shows each image and plays each clip and video of its media list that is in the index. The caption is the path relative to the concept directory. The index holds a copy of each file, so the browser does not need the concept directory. Run the index command again to show a changed file.
  • A link to another concept in the index opens the page of that concept.
  • A link to a missing concept is crossed out and has no address.

Without an index, each page says "No index" and gets HTTP 503. Run curu-memory index, then load the page again.

The browser only reads. It accepts GET and HEAD only, and each other method gets HTTP 405. Each media file has the address /media/<sha256>, from the SHA-256 of its bytes. The browser answers a Range request, so a web browser can seek in a clip. Each other address under /media/ gets HTTP 404. The browser never reads a file path from a request. HTML and scripts in a concept show as text and never run.

To open the browser to other computers, put a TLS proxy in front of it. Then set the token and the address of the proxy:

export CURU_MEMORY_HTTP_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
export CURU_MEMORY_BROWSE_URL=https://browse.example.com/
curu-memory browse --host 0.0.0.0

The web browser then asks for a user name and a password. Type any user name, and the token as the password. Without a token of 32 characters or more, the command does not start and exits with 78. Without an https:// value in CURU_MEMORY_BROWSE_URL, it also exits with 78.

Handle errors

A tool failure is an error result. Its text is one JSON object with code, message and details:

{"code": "concept_not_found", "message": "No concept has the identifier 'x'. Use an identifier from search_knowledge.", "details": {"id": "x"}}
Code Cause What to do
index_missing The data directory has no index. Run curu-memory index.
concept_not_found No concept has the identifier. Use an identifier from search_knowledge.
index_unreadable A team space or a personal space cannot be read. The cause is a missing or wrong key file, a bad previous key file, a changed file, or an index of an older version. For a protected key file, the cause can be no SSH key in ssh-agent. The message names the space. Set CURU_MEMORY_KEK_FILE to the key file of the space. For a protected key file, add your SSH key with ssh-add. During a rotation, also set CURU_MEMORY_KEK_FILE_PREVIOUS. After a rotation, remove it. Or index the space again.
access_refused The principal can read no space, for example a person that the operator removed, or an agent with no live grant. For propose_concept, propose_change, propose_move and write_scratch_note, the caller has no write role in the space, and details.reason is no write role. For consent_move, the caller has no admin role in the source, and details.reason is no admin role. Ask the operator to register the person, or to give the agent a grant with the role.
invalid_argument A value does not obey a rule, for example a question of only spaces. details.field names the field. Correct the value.
invalid_concept A proposed concept breaks a rule. details.reason is schema fault, missing provenance, media, too large or scratch note. details.faults names each fault. Correct the concept file, and propose it again.
proposal_refused The server cannot take the proposal. details.reason is id in use, encrypted space, not encrypted, checkout not ready, no concept directory, not signed, work tree busy or git failed. For a change, it is also unknown concept, stale, no change or scratch note. For a move, it is also not wider, unknown concept, no consent, has consent, not a move, not open or stale. For id in use, choose another identifier. For a change with id in use, wait for the merge or the close of the open proposal. For unknown concept, use an identifier from search_knowledge. For no change, change the text. For stale, read the concept again and propose again. For work tree busy, try again later. For encrypted space, propose in global. For scratch note, give no scratch key, or keep the note with write_scratch_note. For not wider, move the concept to a wider tier. For no consent, ask an admin of the source to call consent_move. For has consent, not a move or not open, read the proposal with proposal show. For a stale move, start the move again. For the other reasons, ask the operator to correct the settings of Prepare the server for proposals.

The tool schema refuses some values first, for example limit: 51 or an empty question. For these values, the MCP SDK gives its own validation error, not one of these codes.

The curu-memory command uses these exit codes:

Exit code Meaning
0 Success.
1 index skipped a file, the embedder failed, another index run held the lock, or the embedder model was not the model of another space. search found no index, or no readable space. access refused a change. key rotate could not rotate a space, or an index run held the lock. space commit refused a change, a file, a merge or the lock. login got a denied code, or the code expired. git merge found a conflict, or an object or a setting that is not valid. space checkout or space commit got an object that the server refused. space check found a file that breaks a rule, or git failed. space hook install refused a hook that it did not write, or a hook that is a symbolic link. space rekey found that an index run or a commit holds a lock. proposal got an unknown or merged proposal, no maintain role, or its own proposal in a protected space. It also got an identifier on main or a busy work tree. proposal complete got an unknown author, a status that the map does not cover, or an open proposal. proposal merge closed a stale completion or change. proposal close got a proposal that is not open, or a person who may not close it. proposal move got a target that is not wider, no write role, an unknown concept, a scratch note, media or an identifier in use. proposal consent got no admin role. proposal merge or proposal consent closed a stale move. proposal merge could not build the index after the merge. index refused a protected space with an unreviewed commit. access protect refused a space.
2 A usage error, for example --limit 51. space check got a revision that starts with -, or space check or space hook ran outside a git work tree. git install, git textconv or git merge ran outside a git work tree. space rekey got global or a bad space name. proposal complete got a bad --confidence map. proposal move got a bad --from or --to space.
78 A configuration error, for example HTTP with no token, serve with no server extra, or a private space with no safe key file. key new refused a path. key rotate got a missing or unsafe key file, or the same key twice. serve or browse on a network address has no https:// address of a TLS proxy. A space in git has no valid signature, an uncommitted change, no CURU_MEMORY_ALLOWED_SIGNERS, or no git on the PATH. An edit through the server has no CURU_MEMORY_SERVER_TOKEN and no login, a token for another audience, or an http:// address that is not loopback. It also got a refused token, no role, no record, a read role on a commit, or no answer. login or logout got a bad address, no metadata, a refused client, no answer, or a token cache that is not safe. git install got a bad --server address. space status found the cache of the textconv on. space checkout --merge found no merge in progress, a rebase or a bad signature. It also found a file of neither branch, or an object of the merge driver under an old key. The space commit of its checkout found a bad signature, a file of neither branch, or such an object. space rekey found a space outside git, a merge, a record under the previous key file, or a failed commit. It also stops when it cannot save the record after the commit. proposal found a bad setting of proposals, or a work tree that is not ready. It also found a changed branch, a bad signature or a failed git command.

Use curu-memory from Python

Use the library to build a space, to read it and to write to it from a Python program, with no server. Import each name from curu_memory only. The names of curu_memory.__all__ are the public API. Each other name can change in any release. The public API starts with version 0.3.0. validate starts with 0.4.0. IndexUnreadable starts with 0.5.0. The index format 2 starts with 0.6.0. The writes start with 0.13.0. A program pins the current minor version, for example curu-memory>=0.13,<0.14.

from pathlib import Path

import curu_memory

report = curu_memory.build_space(Path("knowledge"))
print(report.concepts_indexed, len(report.skipped))

knowledge = curu_memory.open_knowledge()
for hit in knowledge.search("VAE for WAN2.2 5B", limit=3).results:
    print(hit.id, hit.space)

concept = knowledge.get_concept("wan22-5b-vae")
links = knowledge.neighbours(concept.id)
  • build_space builds one space, as the index command does. space= names the space, and the default is global. A skipped file is not an error. The fields of the report are the values of Index your knowledge, except index, for example concepts_indexed. skipped holds a (path, reason) pair for each skipped file.
  • open_knowledge reads as one principal. Give person="<handle>" to read the spaces of that person. Give grant=<id> to read only the space of that grant. With neither, the library reads global only.
  • An unknown, ended or revoked grant does not stop open_knowledge. Each read then raises NoReadableSpace. serve --grant stops at the start for such a grant.
  • Each read gets the readable spaces again. A removed role or a revoked grant stops the next read.
  • search, get_concept and neighbours give the same results as the tools search_knowledge, get_concept and concept_neighbours. Each hit gives its space. scratch=True of search and get_concept also gives the scratch notes, as the option of the tools.
  • list_concepts(types=[...], tags=[...]) gives each concept of the readable spaces, in the order of the ids, with no limit. types keeps any of the types, and tags keeps all of the tags. Each ConceptSummary has the id, space, type, title, description, tags and scratch of one concept, with no body. scratch=True also gives the scratch notes.
  • Each refused read writes the line in the audit log that the server writes, with the name of the matching tool as the action. A refused list has the action list_concepts or list_proposals, because no tool lists.
  • data_dir= replaces the data directory. env= gives the CURU_MEMORY_* variables as a dictionary, for example the embedder settings of Search by meaning. With no env, the library reads the environment of the process.
  • The library does not use CURU_MEMORY_PRINCIPAL to select the principal. A value that is not a valid handle raises ConfigError.
  • The principal is not a security boundary in one process. The boundary is who can read the data directory.

Each error is in curu_memory:

Call Cause Error
build_space The concept directory does not exist, or the space name is not valid. details.field names the argument. InvalidArgument
build_space Another index run holds the lock. IndexLocked
build_space The embedder model is not the model of another space. IndexRefused
build_space The embedder failed. The old index stays. EmbedderFailed
build_space Another private space in the data directory cannot be read. The message names the space. IndexUnreadable
build_space, open_knowledge A CURU_MEMORY_* variable is not valid. ConfigError
build_space A private space has no safe key file, or its embedder is not on loopback and does not use TLS. ConfigError
validate The path does not exist. details.field is path. InvalidArgument
open_knowledge No person has the handle, or person and grant are both given. InvalidArgument
each read The principal can read no space. NoReadableSpace
get_concept, neighbours No readable space holds the concept. ConceptNotFound
search The question is empty or too long, or the limit is not from 1 to 50. InvalidArgument
each read No readable space has an index. IndexMissing
each read No readable space with an index can be decrypted. The message names the first space that cannot be decrypted. IndexUnreadable
each write The principal has no role for the write, a grant writes outside its space, or the object has no principal. WriteRefused
propose_concept, propose_change, write_scratch_note The concept breaks a rule of OKF or of the provenance. InvalidConcept
each write The server cannot take the proposal. details.reason gives the reason. ProposalRefused, ProposalStale or ProposalConceptUnknown
read_concept_file No readable space holds the concept. ConceptNotFound

Each error except IndexLocked and ConfigError is a CuruMemoryError. Its code is the code that a tool gives, for example concept_not_found.

Write through the library

Open the knowledge as a person, then propose a concept, a change or a move. The settings of Prepare the server for proposals must be in env= or in the environment. propose_move and write_scratch_note also need a personal space in CURU_MEMORY_SPACE_DIRS, encrypted as in Keep private knowledge encrypted. A person with maintain merges each proposal with curu-memory proposal merge, as in Review and merge a proposal. No method of the library merges.

from pathlib import Path

import curu_memory

knowledge = curu_memory.open_knowledge(person="me")

text = Path("tiled-vae.md").read_text()
made = knowledge.propose_concept("global", "tiled-vae", text)
print(knowledge.get_proposal(made.id).state)

# A person with maintain merges the proposal: curu-memory proposal merge <id>
found = knowledge.read_concept_file("tiled-vae")
new_text = found.text.replace("tiles of 512", "tiles of 256")
try:
    knowledge.propose_change(found.space, "tiled-vae", new_text, version=found.version)
except curu_memory.ProposalStale:
    found = knowledge.read_concept_file("tiled-vae")

knowledge.propose_move("personal/me", "my-finding", "global")
knowledge.write_scratch_note("plan", "Plan for the tiles", "First try a tiled decode.\n")

The Knowledge object has these write methods. Six of them call the function of their MCP tool. get_proposal and close_proposal call the functions of the proposal command. Each one has the rules, the refusals and the audit lines of its tool or command.

Method Tool or command Result
read_concept_file(concept_id) read_concept_file ConceptFile: the space, the path, the text and the version
propose_concept(space, concept_id, text) propose_concept ProposalView
propose_change(space, concept_id, text, version=...) propose_change ProposalView
propose_move(source_space, concept_id, target_space) propose_move ProposalView with consent
consent_move(proposal_id) consent_move ProposalView
write_scratch_note(note_id, title, body) write_scratch_note ScratchNoteView
get_proposal(proposal_id) proposal show, with no file, and also for the author ProposalView
close_proposal(proposal_id) proposal close ProposalView
  • The fields of ProposalView are the result fields of Call the tool and Move a concept to a wider tier. consent is true when an admin of the source gave consent, and false while the move waits. The fields of ScratchNoteView are the result of Keep scratch notes of an agent.
  • A Knowledge object of a person writes with the roles of that person.
  • A Knowledge object of a grant reads, writes, shows and closes only in the space of that grant, also when its agent has other grants. It cannot start a move or give consent, because a move needs two spaces.
  • A Knowledge object with no principal raises WriteRefused for each write method except read_concept_file, and writes one refused audit line. read_concept_file then reads global only.
  • list_proposals(space=..., state="open", author=...) gives each proposal that get_proposal gives, oldest first. The default state is open. A Knowledge object of a grant gets only the proposals of its grant space.
  • get_proposal gives the record to its author, to a person with maintain in its space, and to an admin of the source of a move. An agent is the author only of the proposals that it made, not of those of the other agents of its person. The state is open, merged or closed. A closed proposal has a reason, for example stale, closed by a person or rekey.
  • ProposalStale means that the concept changed after your read, or after the start of the proposal. Read the concept again, and propose again. For a move, start the move again. ProposalConceptUnknown means that no readable main holds the concept. Both are subclasses of ProposalRefused, with the code proposal_refused.

Test a program that writes

A test needs no server and no database. Make a temporary data directory and a temporary git repository with a signing key:

git init -b main /tmp/kb && git -C /tmp/kb commit --allow-empty -m start
ssh-keygen -q -t ed25519 -N "" -C server@curu-memory.invalid -f /tmp/server-key
echo "server@curu-memory.invalid namespaces=\"git\" $(cat /tmp/server-key.pub)" > /tmp/allowed
export CURU_MEMORY_DATA_DIR=/tmp/data CURU_MEMORY_SPACE_DIRS=global=/tmp/kb
export CURU_MEMORY_SIGNING_KEY=/tmp/server-key CURU_MEMORY_ALLOWED_SIGNERS=/tmp/allowed
curu-memory access person add me
  • The store is a set of SQLite files in the data directory, so a temporary directory gives each test its own store.
  • For a private space, also make a key file, as in Keep private knowledge encrypted, and encrypt the space.
  • To import the OKF v0.2 files of a private space, encrypt them with curu-memory space encrypt, and commit them in the work tree of the space. Then call build_space(work_tree, space="personal/me"). The index is complete when report.skipped is empty.

Limits

  • On stdio, in the browser and with the static token, one process reads as one person (CURU_MEMORY_PRINCIPAL). In Python, each Knowledge reads as the principal of its open_knowledge. On stdio, serve --grant makes the process read as the agent of one grant. Only the OIDC mode of HTTP gives each request its own person or agent.
  • The token cache is a file, not the keyring of the operating system. A person with your user account can read it.
  • An Authentik provider for login needs the device login, the scopes knowledge:read and knowledge:write, and the canonical URI in the audience of its tokens. The repository ships no Authentik blueprint for it.
  • A rotation reads and writes each whole private index, one space at a time. It does not change a backup, a concept file or a space key. It changes a space.json only with --space-dir.
  • curu-memory cannot rename an encrypted space.
  • The key file is the only source of the key. A protected key file opens with your SSH key or a key service. An OS keyring is not supported.
  • A protected key file needs a software ssh-ed25519 key. An ECDSA key and a hardware sk- key cannot open its agent slot.
  • A server keeps the key-encryption key of its indexes in memory after the first read of a private space. After ssh-add -D, a search still reads the private indexes.
  • Each process of your user that can reach ssh-agent while your key is loaded can open the protected key file.
  • curu-memory refuses a protected key file of another key-encryption key than the spaces. It does not check a plain key file in this way. Set CURU_MEMORY_KEK_PROTECTED=1, so that no plain key file opens a space.
  • A search of a private space sends its question to the embedder. The check of loopback or TLS is for an index run only, so use a loopback or TLS embedder for the server too.
  • A reader decrypts the whole index of a private space into memory. A private space with many media files uses memory for each file.
  • The browser has no OIDC login.
  • A private proposal, a private change, a read of a private concept and the merge of a new private concept each decrypt the whole space. proposal list decrypts one object for each private proposal.
  • A scratch note uses an identifier from the same set as the concepts. A note blocks its identifier for a new concept until the person deletes the note.
  • The browser cannot show a scratch note. An agent cannot delete a scratch note, and a note does not expire.
  • The index of each space has a version. A read refuses an index of an older version with index_unreadable. Index each space again after an upgrade.
  • A move takes one concept, and it goes only to a wider tier. A move that waits for consent is only in access.sqlite. Delete that file, and the move is lost.
  • A proposal holds no media. proposal complete completes the concepts of global only. access protect protects global only. An agent cannot rename a concept. It can delete a concept only from the source of a merged move. To rename or delete a concept, a person edits it in another clone. Then the person pushes it to the same remote, as in Prepare the server for proposals.
  • In a protected space, the index refuses a direct commit, also a rename or a delete. Unprotect the space, index it, and protect it again.
  • An embedder of the protocol openai gives no identity. When its weights change and its URL and model name stay the same, curu-memory cannot see the change. Delete embedding-cache.sqlite in the data directory, then index each space again.
  • With the curu-vision service, a clip longer than 30 seconds has no vector, and the index gives a warning for it. A search with a clip longer than 30 seconds gives no results, and its notice gives the reason. Cut a long clip into short clips of one topic.
  • The curu-vision service embeds a clip or a video from version 0.28.0. With an older service, the index gives a warning for each clip and each video, and a search with one gives a notice.
  • curu-memory does not control the git host. A push to main is still possible, but the index of a protected space refuses it.
  • Do not sign your own commits with the server key. The check cannot tell them from a reviewed merge.
  • The merge closes a stale change, and does not merge it: the server does no rebase and no three-way merge of the text. An agent with write can make any number of proposals.
  • The browser accepts one static token. Without CURU_MEMORY_OIDC_ISSUER, the HTTP transport also accepts only one static token. Neither serves TLS itself, so a TLS proxy must stand in front of each on a network.
  • The embedder of the stack runs on the CPU, so an index run of many concepts takes some minutes. The embedder image is about 2.1 GB, and the model adds about 1.5 GB.
  • The browser has no log-out button. Close the web browser to forget the token.
  • The browser shows the links of a concept as lists, not as a picture of the graph.
  • Search compares each embedding with the question one by one. This is fast for some thousands of concepts. It becomes slow at about 100,000 concepts.
  • A match of meaning needs a cosine similarity of 0.68 or more with EmbeddingGemma 2. The measured margin is small: unrelated questions reached 0.67, and known answers started at 0.70. A real question with few shared words can miss its answer by meaning. With another model, the limit is 0.35. Some models give lower values for good matches, so measure the limit and set CURU_MEMORY_EMBEDDER_MIN_SIMILARITY.
  • A match between a question in words and an image also needs 0.68 or more with EmbeddingGemma 2. Simple test images scored from 0.74 with their descriptions, and wrong images reached 0.66. Real outputs of ComfyUI can score lower. If an image that you describe well does not match, measure and set CURU_MEMORY_EMBEDDER_MIN_IMAGE_SIMILARITY.
  • A search with an image uses 0.89 for image to image and 0.70 for image to text with EmbeddingGemma 2. The margin for image to text is small: a wrong description of a test image reached 0.695, and an unrelated curu concept reached 0.684.
  • A search with a clip uses 0.87 for clip to clip and 0.70 for clip to text. The margin for clip to text is also small: a wrong description reached 0.692. A correct description scored as low as 0.712 in an earlier measurement. These limits come from changed copies of speech clips. Music, sound effects and other recordings can score lower.
  • A search with a video uses 0.92 for video to video. For video to text, it uses 0.725 with the curu-vision service and 0.73 with openai. With the curu-vision service, no limit separates the results. A correct description scored 0.721 and a wrong concept 0.723, so one test video misses its description. With openai, a wrong description reached 0.728 in an earlier measurement, and a correct description scored as low as 0.737. These limits come from changed copies of short animations. Real outputs of ComfyUI can score lower.
  • A question cannot hold words and media together. The browser cannot search with media. The list of search results does not show media. Each kind of media question finds only its own kind of media and texts.
  • A match between a question in words and a video needs 0.71 or more with EmbeddingGemma 2. The test videos are short animations of shapes. A question about motion can match a video with a near motion.
  • A match between a question in words and a clip needs 0.68 or more with EmbeddingGemma 2. The limit comes from speech clips. Speech test clips scored from 0.73 with their own questions. Wrong clips and unrelated questions reached 0.64. Music and sound effects can score lower.
  • The index holds a copy of each media file. One hundred files of 2 MB make the index about 200 MB larger.
  • There is no file watcher. Run the index command after each change.
  • validate does not read the index, so it does not find an identifier that is also in another space. For one file, it does not find a duplicate identifier.
  • The Python API cannot search with media, and it cannot merge a proposal. Use curu-memory search --media or the tool search_knowledge_by_media for media. Use curu-memory proposal merge to merge.

Technical notes

  • The first start of the stack downloads the model of its embedder, because docker compose up is a command that a person types. An operator can also give an embedder that runs already, and the stack then downloads nothing. See ADR-023.
  • The index is one SQLite file for each space in the data directory, for example ~/.local/share/curu-memory/global.sqlite. The file of team/look is team--look.sqlite.enc. CURU_MEMORY_DATA_DIR changes the directory. XDG_DATA_HOME also changes the default. See ADR-001. The space names and the readable spaces come from ADR-016.
  • The index lock uses fcntl.flock, so curu-memory runs on Linux and macOS, not on Windows.
  • The merge driver compares lines with difflib of Python, not with the diff of git. Thus a conflict can hold other lines between its markers than git merge-file gives. See ADR-025 and specs/029-git-merge-driver/contracts/cli.md. The contract of the flow to resolve a conflict is specs/030-resolve-merge/contracts/cli.md.
  • The parts of a long section follow ADR-036. The budget of 30,000 characters is over the longest section of the evaluation corpus, so the frozen vectors do not change.
  • The protected key file follows ADR-035. ssh-keygen -Y sign signs a fixed challenge in the namespace curu-memory-kek. curu-memory verifies the signature, and HKDF-SHA256 makes the wrapping key from it. AES-256-GCM encrypts the key. The contract is specs/042-ssh-protected-key-file/contracts/cli.md.
  • The login uses the device login of RFC 8628, and follows ADR-024. The contract is specs/027-device-login/contracts/cli.md.
  • The OIDC mode follows ADR-015 and ADR-017. The contract is specs/012-oidc-tokens-with-the-shipped-rauthy/contracts/oidc.md.
  • Agents, grants and the Basic exchange follow ADR-018. The contract is specs/013-agent-grants/contracts/agents.md. The exchange sends grant_type=client_credentials, client_id, username, password and scope=openid profile. The cache keeps at most 1,000 tokens, and it removes the oldest first.
  • curu-memory accepts keys of the algorithms RS256, RS384, RS512, PS256, ES256 and EdDSA. curu-memory refuses each token that a key of another algorithm signs, for example ES384.
  • curu-memory reads the keys from <issuer>/.well-known/openid-configuration and its jwks_uri. The document must name the same issuer, and jwks_uri must use https off loopback. The clock skew of the token check is 60 seconds.
  • The browser makes its pages on the server, with no JavaScript. A content security policy blocks each script. See ADR-004.
  • The limit of the match of meaning comes from a measurement of EmbeddingGemma 2. See ADR-005. The limit for images has its own measurement. See ADR-008. The limits for audio and for video also have their own measurements. See ADR-011 and ADR-013. A search with media has its own limits and its own measurement, and one tool takes all media. See ADR-010, ADR-012 and ADR-014.
  • The default protocol curu-vision and its limit of 0.725 for a video question and a text unit follow ADR-034.
  • curu-memory sends each image to the embedder in an item {"image": "data:..."}, each clip in an item {"audio": "data:..."} and each video in an item {"video": "data:..."}. The value is a data: URI: a text that holds the file bytes in base64, with their MIME type. See ADR-007. The index keeps the bytes of each media file one time for each SHA-256. See ADR-009.
  • The protocol curu-vision sends POST /v1/embedding with an input {"kind": "query", "text": ...} for a question and {"kind": "document", "title": ..., "text": ...} for a section. The service adds the prompts. The index records the protocol, the identity_digest and the prompt_version of the service. The embedding cache keys a vector by the identity_digest, or by the URL, the model and the prompts for openai. See ADR-030, which changes who adds the prompts of ADR-003.
  • With the protocol curu-vision, an image, an audio clip and a video are {"kind": "image", "data": ...}, {"kind": "audio", "data": ...} and {"kind": "video", "data": ...}, with the bytes of the file in base64. The service decodes each file, and each file result names its file_decode. A file result with a file_decode that the served identity does not name is an error. See ADR-033.
  • The keys and the encryption of private knowledge follow ADR-002. Each index run of a private space makes a new data key. The key in the key file wraps it with AES key wrap, and AES-256-GCM encrypts the index. The format is in specs/019-encrypted-private-indexes/contracts/encrypted-index.md. The audit line of a refused read names a hidden private space too, so that check decrypts it. See ADR-021.
  • The word match uses SQLite FTS5 (the full-text search of SQLite) with the unicode61 tokenizer (the rule that splits a text into words). The tokenizer keeps ., _ and - in a word. A word of three or more characters also matches as a prefix.
  • Search fuses the two rankings with reciprocal rank fusion, with k = 60. The lower of the two values counts one tenth. So ten rivals that are a little worse in both rankings do not push out the best answer of one ranking. See ADR-006. The identifier breaks a tie, so the order is stable.
  • The concept rules are the same as the rules of the curu index, so each curu concept file indexes here. The index command and validate use one implementation of them. The schema and the fixtures are in src/curu_memory/okf_v0_2/. See specs/017-the-okf-v0-2-schema/contracts/okf.md. The copy of the curu concepts in tests/fixtures/eval_corpus/ is a frozen evaluation corpus, not a reference of the format. See ADR-020.
  • The tool contracts are in specs/001-okf-index-mcp-search/contracts/.
  • Proposals follow ADR-026. The contracts are specs/032-propose-and-merge/contracts/mcp-tool.md and specs/032-propose-and-merge/contracts/cli.md.
  • The writes of the library follow ADR-032. The contract is specs/039-library-writes/contracts/library.md.
  • Moves follow ADR-031. The contract is specs/037-review-a-move-to-a-wider-tier/contracts/tools.md.
  • The access store has version 4. Each command refuses a store of an older version. Delete access.sqlite, then register the persons, the agents, the grants and the roles again. The project keeps no migration before 1.0.
  • Roles and protection follow ADR-028. The contract is specs/035-protected-branches-and-required-review/contracts/cli.md.
  • Proposals in private spaces follow ADR-029. The record holds the HMAC-SHA256 of the concept identifier. Its key comes from the space key with HKDF-SHA256. The contract is specs/036-proposals-in-encrypted-spaces/contracts/cli.md.
  • Scratch notes follow ADR-016: the notes of an agent go into the personal space of its person. The index table concepts has the column scratch. The contract is specs/038-agent-scratch-notes-in-the-personal-tier/contracts/tools.md.
  • curu-memory uses the official MCP Python SDK. It never loads model weights.
  • curu uses curu-memory as a library, and the version range of a release follows a version policy. See ADR-019. tests/contract/public_api.txt holds the names of curu_memory.__all__. The contract is specs/015-the-public-library-api/contracts/public-api.md.
  • The core install has pydantic, httpx2, markdown-it-py, pyyaml and cryptography. The server extra adds mcp, starlette and uvicorn.
  • curu_memory.TOOL_SCHEMA_VERSION is the version of the MCP tool schemas and the error codes. The value is 1 for the tools of 0.3.0, and 2 since the error code index_unreadable. It is 3 since the tool propose_concept, and 4 since its result has the fields kind, closed_by, closed and reason. It is 5 since the tools read_concept_file and propose_change, and 6 since the tool write_scratch_note and the input scratch. It is 7 since the tools propose_move and consent_move and the result fields consent, consented_by and consented. It is 8 since the result field closed_spaces and the attributes space and cause of index_unreadable. It goes up by 1 in each pull request that changes a tool, a field or an error code. A change of a description or a title does not change it. It is not the package version.
  • A Python program that imports curu_memory can compare TOOL_SCHEMA_VERSION with the version that it expects. A different value means that a tool, a field or an error code is different. The MCP server does not send the value. tests/contract/tool_schemas.json holds the schemas of the current version.

Develop

git clone https://github.com/darth-veitcher/curu-memory
cd curu-memory
uv sync
uv run pytest

uv sync installs the server extra, because the development group names it. The default tests need no network, no GPU and no model. They use a fake embedder and the frozen evaluation corpus in tests/fixtures/eval_corpus/, a copy of 183 curu concept files. The corpus is for the search measurements only. The shipped fixtures are the reference of the format. The tests with a real embedder have the integration marker. Start the curu-vision service on your computer first, as Use the curu-vision model service tells. Set request_timeout_s = 3600 in service.toml, because a request of many long sections takes a long time. Then run:

CURU_MEMORY_EMBEDDER_URL=http://127.0.0.1:8765 CURU_MEMORY_EMBEDDER_TOKEN="$CURU_VISION_TOKEN" CURU_MEMORY_EMBEDDER_TIMEOUT=3600 uv run pytest -m integration

On a CPU, the first index of the corpus takes more than 30 minutes, the time of tools/parity.py vectors. AGENTS.md tells how to start from the frozen vectors of the parity report. To measure an OpenAI-compatible server, also set CURU_MEMORY_EMBEDDER_PROTOCOL=openai. Its limits are the limits of openai.

The rauthy test of the integration tier also needs Docker and a free port 6480.

The source distribution on PyPI holds the tests too. Some tests read files of the repository that it leaves out, for example the workflows and the ADRs. These tests have the repository marker. In the source distribution, each of them skips and names the missing files. To leave them out, run uv run pytest -m "not integration and not repository", because this option replaces the default -m.

To measure the search on the evaluation corpus, run the parity report. It compares the search of curu-memory with the search of curu. It needs no network and no model, because it reads the frozen vectors of the curu-vision service in tests/fixtures/eval_vectors/:

uv run tools/parity.py report

The report gives recall@1, recall@5 and recall@10 of curu-memory. Recall@k is the part of the judged answers in the first k results, from 0 to 1. The report gives the mean of the 25 judged questions. A higher value is better: 1 means that each judged answer is in the first k results.

curu sends its results for the same questions in a file. Put it at tests/fixtures/eval_vectors/curu_rankings.json. The file contains the first 10 concepts that curu finds for each question. Without this file, the report gives only the line of curu-memory. When the file exists, the report also gives these items:

  • The recall of curu.
  • Each question where curu-memory has a lower recall@5 than curu.
  • Each judged answer with a different 2-hop reach: the concepts within 2 links of it, in both directions.

The report exits with 1 when a lower question is not in tests/fixtures/eval_vectors/accepted.toml. Each question in that file names the decision record that accepts it. The report also exits with 1, and gives the cause, in these conditions:

  • A frozen vector is missing.
  • curu_rankings.json is for a different corpus.
  • curu_rankings.json has a question that is not judged.

Without curu_rankings.json, it exits with 0.

When the corpus, the served identity of the service or the units of a concept change, make the frozen vectors again. Start the curu-vision service on your computer, with request_timeout_s = 3600 in service.toml. Then run:

CURU_MEMORY_EMBEDDER_URL=http://127.0.0.1:8765 CURU_MEMORY_EMBEDDER_TOKEN="$CURU_VISION_TOKEN" uv run tools/parity.py vectors

The run takes about 30 minutes on a CPU. --batch-size 4 sends 4 sections in each request in place of 32. The run is then slower, but the service uses less memory.

Before a pull request, run the gates:

uv run ruff check --fix && uv run ruff format
uv run ty check
beacon doctor --strict

The CI runs the same gates on each pull request and on each push to main. A release starts when the owner pushes a tag vX.Y.Z on main. The release workflow checks the tag, then publishes the package to PyPI.

AGENTS.md gives the rules for contributors and agents.

Glossary

  • Agent: a program that uses a language model and calls tools, for example Claude Code. A registered agent acts for one person, and reads only the spaces of its grants.
  • Concept: one OKF file about one topic, for example a model, a node or a finding.
  • Clip: an audio file: an item of the media list of a concept, or the file that you search with.
  • Base64: a text form of bytes that uses only letters, digits, +, / and =.
  • Browser: the read-only web pages that curu-memory browse serves.
  • Video: a video file: an item of the media list of a concept, or the file that you search with. The formats are MP4, MOV, WebM and MKV.
  • CI: a workflow that runs checks on each pull request and each push. Examples are the GitHub workflow of this repository, and the workflow of the repository of a space.
  • Content security policy: an HTTP header that tells the web browser which scripts, styles, images, audio and video it can load.
  • Cosine similarity: a value from -1 to 1 that tells how near two embeddings are. A higher value is a nearer meaning.
  • Data URI: a text that holds the bytes of a file in base64, with their MIME type, for example data:image/png;base64,....
  • Data directory: the directory of the index, the embedding cache, the access store access.sqlite and the audit log audit.jsonl. The default is ~/.local/share/curu-memory, or $XDG_DATA_HOME/curu-memory. CURU_MEMORY_DATA_DIR changes it.
  • Data key: the random key that encrypts one private index. Each index run of a private space makes a new one.
  • Development embedder: the server in tools/embedder_server/ that serves EmbeddingGemma 2 with torch, for the protocol openai. Its vectors are not the vectors of curu.
  • Conformance fixtures: the valid and invalid concept files that the package ships, with the expected faults in expected.toml.
  • Frozen vectors: the stored embeddings of the evaluation corpus and the judged questions in tests/fixtures/eval_vectors/.
  • Judged question: a question of search_eval.toml or meaning_eval.toml with its correct concepts.
  • Lower question: a judged question where curu-memory has a lower recall@5 than curu.
  • Recall@k: the part of the judged answers of a question in the first k results, from 0 to 1.
  • 2-hop reach: the concepts within 2 links of a concept, in both directions.
  • Evaluation corpus: the frozen copy of 183 curu concept files in tests/fixtures/eval_corpus/, for the search measurements.
  • Extra: a named set of optional packages of a Python package, for example server in curu-memory[server].
  • Embedder: a server that changes a text, an image, a clip or a video into an embedding.
  • Embedding: a list of numbers that holds the meaning of a text, an image, a clip or a video. Items with a near meaning have near embeddings.
  • Fault: one problem of a concept file. A fault of the kind okf makes the index command skip the file. validate gives each fault with its kind, path, line and message.
  • GraphRAG: retrieval that uses a search and the links between concepts to give an agent its context.
  • Index: the searchable copy of the concept files that the index command makes.
  • JSON Schema: a standard JSON document that gives the fields and the types of a JSON or YAML value.
  • Key rotation: a run of curu-memory key rotate. It encrypts each private index again under a new key file and a new data key.
  • Previous key file: the old key file during a key rotation. CURU_MEMORY_KEK_FILE_PREVIOUS names it. Each read also opens an index under its key, and no index run writes with it.
  • Keyed hash: a hash that only a holder of a key can make. The same identifier and key always give the same value.
  • Key file: the file that holds the key-encryption key. This key encrypts the data key of each private index. curu-memory key new makes the file, and CURU_MEMORY_KEK_FILE names it.
  • Key service: a service that encrypts and decrypts with a key that it keeps, for example the transit engine of OpenBao. It opens the recovery slot after an OIDC login.
  • Protected key file: a key file that holds the key-encryption key in two slots, and never as plain text. Your SSH key or the key service opens it.
  • Agent slot: the slot of a protected key file that opens with a signature of your SSH key through ssh-agent.
  • Recovery slot: the slot of a protected key file that the key service opens after an OIDC login of the owner.
  • Transit key: a key that the key service keeps and never gives out. It encrypts and decrypts the data that a client sends.
  • Sealed: the state of a key service that cannot read its own keys until a person gives the unseal key. A restart seals it. To unseal is to give that key.
  • Link kind: the type of a link between two concepts, for example USES_COMPONENT.
  • MCP: the Model Context Protocol, which lets an agent find and call tools.
  • Minor version: the second number of X.Y.Z. Below 1.0, a new minor version can remove or change a name or a tool field.
  • OKF: Open Knowledge Format, the format of the concept files: YAML front matter and a Markdown body.
  • MIME type: the name of a file format, for example image/png.
  • PyPI: the Python Package Index, the public server of Python packages.
  • Reciprocal rank fusion: a method that joins two rankings. Each ranking gives 1 / (60 + rank) to each concept. The best of the two values counts in full, and the other counts one tenth.
  • Task prompt: a fixed text around a question or a section before the embedder makes its embedding. curu-memory adds it, or the curu-vision service adds it.
  • File decode: the method that the curu-vision service uses to read an audio or video file into samples and frames. Its name, for example file-decode-1, is in the served identity.
  • Served identity: the record of the model that the curu-vision service serves. Its digest changes with each change of the model name, the weights, the engine, the prompts, the file decode or the version of the service.
  • Stdio: the standard input and output of a process. A local MCP client talks to the server through them.
  • Streamable HTTP: the MCP transport over HTTP, for remote agents.
  • HSTS: HTTP Strict Transport Security, a response header. The web browser then uses only HTTPS for that host name, for one year in the stack.
  • TLS proxy: a server, for example Caddy, that accepts HTTPS from clients and sends plain HTTP to curu-memory on a private network.
  • Wiki-link: a link of the form [[name]]. OKF does not accept it outside code.
  • Web browser: the program that shows web pages, for example Firefox.
  • SHA-256: a hash of 64 hexadecimal characters that the bytes of a file give. Different bytes give a different SHA-256.
  • Unit: one piece of a concept that has its own embedding. It is the summary, the overview, a ## section, a part of a long section, an image, a clip or a video.
  • Part: a unit made from a section of more than 30,000 characters. Each later part starts with the heading line of its section.
  • Version range: the lowest version and the first version to exclude, for example >=0.10,<0.11.
  • Space: a part of the knowledge with its own index: global, team/<slug> or personal/<handle>. Each request reads only the spaces that its caller can read.
  • Team slug: the short name of a team in a space name, for example look in team/look.
  • Instance owner: a person with admin on global and on each team space. The first registered person is an instance owner.
  • Principal: the person or the agent of a request, or anonymous with no principal. It comes from CURU_MEMORY_PRINCIPAL, serve --grant, the OIDC token on HTTP or open_knowledge.
  • Private space: a team space or a personal space. Its index is encrypted on disk, and its concept files are an encrypted space.
  • Encrypted space: a directory with space.json, .gitattributes and objects/. Each object holds one concept file or media file, under the space key.
  • Space key: the AES-256 key of one encrypted space.
  • Generation: the number of the current space key of a space. It starts at 1, and each rekey adds 1.
  • Rekey: a run of curu-memory space rekey. It adds a generation with a new space key, and encrypts each object again under it.
  • Space record: the file of one encrypted space in spaces/ of the data directory, for example spaces/team--look.json. It holds the space keys that it keeps, each wrapped by the key of the key file.
  • Wrap: to encrypt a key with another key.
  • Token cache: the file of the tokens of curu-memory login, one entry for each server, with mode 600.
  • Device login: a login of OAuth for a program with no web browser. The program shows a code, and the person enters it in a web browser on any device.
  • Textconv: a program that git runs to change a file to text before a diff.
  • Merge driver: a program that git runs to merge the versions of a file, which merge=curu in .gitattributes selects.
  • Diff driver: a name in .gitattributes, for example diff=curu, that selects the textconv of a file.
  • Edit through the server: the curu-memory server decrypts and encrypts the objects of a space after a role check. The space key never leaves the server.
  • Checkout: the private directory of the plaintext files of one encrypted space, with .curu-checkout.json.
  • Allowed signers: the file, in the format of git, of the public keys that can sign a commit. The commit is of a private space or of the server.
  • Server key: the SSH private key that CURU_MEMORY_SIGNING_KEY names. It signs each commit of the server.
  • Proposal: a new concept, a change, a completion of old concepts or a move, on its own signed git branch proposal/<id>. It waits for a person with maintain to merge it. A move with no consent has no branch yet.
  • Move: a proposal that puts a concept from a personal or a team space into a wider space. The merge deletes it from the source.
  • Consent: the agreement of an admin of the source space to a move.
  • Wider tier: a space with more readers. personal/<handle> is narrower than team/<slug>, and team/<slug> is narrower than global.
  • Scratch note: a note of an agent or of a person, in the personal space of that person, with scratch: true in its front matter. It is not knowledge, so a search leaves it out unless the caller asks for it.
  • Stale: a change or a proposal whose concept changed on main after the read or after its base. propose_change refuses a stale change. The consent or the merge closes a stale proposal.
  • Contributors: the handles of the persons who changed a concept after its author.
  • Version: the SHA-256 of the full text of a concept file.
  • Completion: a proposal of curu-memory proposal complete. One signed commit adds the missing provenance keys to the old concepts of a space.
  • Proof: an entry of the key evidence: a run, a test or a source. A test, a source and each file of a run give a full commit identifier. A reader can reproduce the claim from it.
  • Provenance: the front-matter keys that say where a concept comes from: tier, sources, confidence, date, evidence, author and agent.
  • Work tree: the directory of a git repository with its files.
  • Merge commit: a git commit that joins a branch into another branch.
  • Signed commit: a git commit with a signature that git verifies.
  • Pre-push hook: a script in .git/hooks/ that git runs before each push. A result other than 0 stops the push.
  • Ref: a name of a commit, for example a branch or a tag.
  • Mirror clone: a clone of each ref, with no work tree.
  • git filter-repo: a tool that rewrites the git history.
  • Conflict markers: the lines that git writes in a file after a merge conflict, for example <<<<<<< ours. Each starts with 7 or more <, = or > characters. The attribute conflict-marker-size in .gitattributes makes them longer.
  • Operator: the person who runs curu-memory access and curu-memory index on the computer of the server.
  • Access store: access.sqlite, with the persons, the teams, the members, the agents, the grants, the assigned roles and the protections.
  • Audit log: audit.jsonl, with one line for each change of access, each refused read and each refused token. It also has a line for each proposal, each merge, each close and each refused show of a proposal. It also has a line for each consent and each deletion of a moved concept. It also has a line for each role change, each protect and unprotect, and each refused index.
  • OIDC provider: a service that logs persons in and issues tokens, for example Authentik or rauthy. OIDC is OpenID Connect.
  • Issuer: the URL of an OIDC provider, as in the iss claim of its tokens.
  • Subject: the identifier of a person or a service account at an issuer, as in the sub claim of a token.
  • Audience: the aud claim of a token: the service or the OAuth client that the token is for.
  • Access token: a signed JWT (JSON Web Token) that a client sends in the Authorization header. A claim is one field of a token.
  • ID token: a token that tells a client who logged in. It is not for a service such as curu-memory.
  • OAuth client: a program that the provider knows by its client identifier. An MCP client uses an OAuth client.
  • Signing key: the key that signs the tokens of a provider. curu-memory checks each signature with the public part.
  • HMAC: signatures with a shared secret, for example HS256. A service cannot check them without the secret, so curu-memory refuses them.
  • Canonical URI: the one address of the server that tokens name, for example https://memory.example.com/mcp.
  • OAuth grant: the method that a client uses to get a token, for example the client credentials grant.
  • Grant: one role of one agent in one space, for 1 to 366 days. A grant is live from its start until it expires or the operator revokes it.
  • Service account: an Authentik user for a program, not for a person.
  • App password: a password that Authentik makes for one user, for a program.
  • Device endpoint: the URL of the issuer that gives the codes of the device login. The discovery document of the issuer names it.
  • Token endpoint: the URL of the issuer that gives tokens. The discovery document of the issuer names it.
  • Basic header: Authorization: Basic followed by the base64 of user name:password.
  • Authorization code grant: the person logs in through the web browser, and the client gets a token for that person.
  • PKCE: a check that only the client that started a login can get its token.
  • Client credentials grant: a program gets a token with its own secret, with no person.
  • Blueprint: a YAML file that Authentik reads to make its objects, for example a provider and an application.
  • Redirect URI: the address where the provider sends the person back after the login.
  • Role: read, triage, write, maintain or admin of one person or one agent in one space, from the weakest to the strongest.
  • Protected space: a space where only a reviewed merge of the server key reaches the index.
  • Protection base: the commit of main that access protect records. The check starts after it.
  • Assigned role: triage or maintain, which the operator gives with access role set.
  • Handle: the short name of a person in a space name, for example me in personal/me.

Metadata

Release files for curu-memory 0.16.5

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

Source distribution (sdist)

Source distribution for curu-memory 0.16.5
File Size Uploaded Provenance Actions
curu_memory-0.16.5.tar.gz 7.3 MB With provenance Details for curu_memory-0.16.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for curu-memory 0.16.5
File Interpreter ABI Platform Actions
curu_memory-0.16.5-py3-none-any.whl Python 3 none any Details for curu_memory-0.16.5-py3-none-any.whl

Total release size: 7.6 MB

Release files / curu_memory-0.16.5.tar.gz

Download URL curu_memory-0.16.5.tar.gz
Size 7.3 MB
Tags Source
SHA-256 checksum
How to use checksums
c7cb75a46635f6689d1c42dcb0d8a7d12e8f51877efa9680c58b79bc38c83a06
BLAKE2b-256 checksum
How to use checksums
51bd965f29e9736f0d3f69de2fa4a4f7e97fb1903130ffee8c5c0d46fc14f09d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / curu_memory-0.16.5-py3-none-any.whl

Download URL curu_memory-0.16.5-py3-none-any.whl
Size 290.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28ccf0e7788648ab0a92f9292d827cf95dc825cd688f5c1167374ebbbefeaf5f
BLAKE2b-256 checksum
How to use checksums
bd5668f3cac599dda132668114cda9f7656f101186157613dfbfba4cb63e9185
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for curu-memory 0.16.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for curu_memory-0.16.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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