A character's memories in one portable file, where what a user lived with it is a layer over the author's canon

COF

An open ZIP format for AI characters whose dated memories travel in the file, with a CLI, a scored selection and a browser player.

LicenceMIT for code, CC BY 4.0 for specifications and examples, CC0 for schemas and vocabularies; some example assets carry CC BY-NC 4.0
Size16,075 lines of Python in cli/cof_cli; 7,415 lines of JavaScript in the player and shared modules, inlined into single-page HTML apps; the memory is selection.py (1,049), selfdesc.py, memories.py (248), agents.py (280), player.js (3,755) and cofselect.js (1,142)
Activity1,181 commits from 9 October to 28 November 2026, 1,164 under one GitHub account and 17 under claude; nine tags, the latest v1.2.3.1
Tests538 pytest functions in 62 files under cli/tests and 87 Node scripts under tests/ that drive a browser; neither GitHub workflow runs them; none run for this reading

Carries 4 of 7 rubric mechanisms. Most systems here carry none or one (41%), and a dash means the mechanism was not found at this commit — not that the system needed it. Each mark is one LLM reviewer's reading of the code at this commit rather than a run of it — known limits.

  • Tombstone
  • Trust state
  • Bi-temporal
  • Scope enforced
  • Mutation audit
  • Human review
  • Negative evals

1. Executive Summary

COF is an open file format for AI characters: a .cof is a ZIP archive holding a character's personality, appearance, voice, body, rights and, since 1.1, its memories. A Python CLI, a set of single-page web apps and exports to agent hosts read and write it. Notable: what a user lives with the character is stored in the same file as a layer over the author's canon, and that layer is off on every read and export unless the caller says the current user is the person who lived it. Weak: the write path loses track of its own layer. A view revised in two sessions is kept as two live revisions, and the default save of a conversation stores a memory with no content in it.

The design keeps two producers apart. An authored node is canon and a tool must not modify it; a lived node is added by a host, usually personal. A lived revision of a psyche node derives_from the canon one and replaces it in selection only when personal nodes are on (cli/cof_cli/selection.py:986-1014). Without the flag the canon view is told as before. A character can therefore change for one person and stay itself for everyone else.

Recall is a scored pick, in Python and again in JavaScript with parity tests, from the nodes a preset lists. A preset is one age, look and language of the character, so a memory lived with the adult does not reach the twelve-year-old. There are no embeddings.

The gaps are in identity and de-duplication. personal names no user. Agent notes re-import as duplicates when the host's file changes day. An agent note quoting a canon sentence is dropped with everything else in it.

Licence. LICENSES.md puts every file under spec/examples/ at CC BY 4.0, and 38 example assets are declared CC BY-NC 4.0 in their own manifests: 19 motion clips and 10 voice samples in example 10, 6 and 2 in example 11, and the LoRA weights in example 07. The flagship character everyone starts from is therefore not free for commercial use as a whole. Code is MIT, specifications CC BY 4.0, schemas CC0.

Four marks: bitemporal on lived psyche nodes, scope_enforced on visibility and preset lists, human_review on the player's proposals, and negative_eval. Section 9 gives the reason for each of the three withheld.

2. Mental Model

A memory is a node the character could recall: a moment or a period with a short gist per language and optional axes for when, where, with whom, what it felt like then and now, how clearly it comes back and how much it matters (spec/schemas/memory.schema.json). Since 1.2 a psyche node is the same mechanism for a value, belief, fear, stance and so on, linked because to the memory it comes from.

Three axes decide who may read a node, and they are independent (rfcs/0002-memories.md, § 3.3):

  • origin is authored or lived. Canon is read-only for tools.
  • visibility is canon or personal. Personal is "a user's personal data".
  • disclosure is open, guarded or secret. A secret is context only, when a reader includes it at all.

A node becomes something the character recalls by being listed in a preset. The author lists canon. A lived node is listed only in the preset it was lived in, and never in an under-18 preset together with an adult one (cli/cof_cli/selfdesc.py:138-164).

A view changes by derivation, not by editing. The player writes a new lived node with derives_from the old one, inserted right after it in the same preset (tools/player/player.js:3318-3337). A core node never moves: the proposal becomes a comment linked about it (:3338-3345). The heir is personal, so whether the old or the new view is told depends on who is asking.

A node stops being recalled by being unlisted, by being deleted with its files, by an until that has passed, or by an heir. Nothing decays and nothing is refused on the way back in.

Diagram — a lived revision shadows its canon node only for the person it belongs to; a second session that opens the file with the flag off sees the canon node again and adds a sibling heir, and with the flag on both heirs are told
Diagram source
%% caption: a lived revision shadows its canon node only for the person it belongs to; a second session that opens the file with the flag off sees the canon node again and adds a sibling heir, and with the flag on both heirs are told
flowchart TD
  CAN["canon node val3<br/>authored, read-only<br/>for tools"]
  S1["session 1: the model<br/>proposes a revision,<br/>the person ticks it"]
  CAN --> S1
  S1 --> H1["val8: lived, personal,<br/>derives_from val3"]
  H1 --> OPEN["the file is opened again:<br/>personal flag reset to off"]
  OPEN --> SEL{"select: personal<br/>flag on?"}
  SEL -->|"off"| FB["val8 excluded: personal<br/>val3 is told"]
  SEL -->|"on"| SH["val3 excluded:<br/>derives-from val8"]
  FB --> S2["session 2: val3 is<br/>offered as revisable"]
  S2 --> H2["val9: lived, personal,<br/>derives_from val3"]
  H2 --> BOTH["flag on: val3 excluded,<br/>val8 and val9 both told:<br/>neither derives from<br/>the other"]

3. Architecture

Nothing runs between uses. The store is the .cof archive: mimetype first and uncompressed, manifest.json second, then one JSON file per node under elements/memories/<id>/ and elements/psyche/<id>/, with media beside them (cli/cof_cli/container.py:181-214). An unpacked folder is equally valid input.

  • cli/cof_cli is the reference implementation: validation, packing, cof select, the exports, cof memory add, cof import, cof merge.
  • tools/shared/cofselect.js is the JavaScript port of the selection, inlined by generator scripts into player/index.html and builder/index.html.
  • The player is one HTML page that calls the user's chosen model provider from the browser with the user's key. It writes a new .cof as a download.
  • The exporters turn a preset into an OpenClaw workspace or a Hermes profile, whose own memory files are read back later.

Deployment and ergonomics

pip install cof-cli brings one dependency, jsonschema; the web pages need no install. The selection, validation and every export run offline. Talking to a character needs a model endpoint, hosted or local, and storing a memory does not. The store is JSON in a ZIP, so a person can read and repair it by hand, and every packed file carries a COF.md that explains it to an agent.

4. Essential Implementation Paths

  • Host write. cof memory add copies the file to a temporary folder, calls memory_add, validates the result and writes back only when it validates (cli/cof_cli/cli.py:1063-1105, :1108-1138, cli/cof_cli/selfdesc.py:196-333). cof psyche add is the twin (:338-520).
  • Agent write-back. --from-agent parses memory/YYYY-MM-DD.md bullets and the § entries of memories/MEMORY.md, skips what it recognises and adds the rest as lived and personal (cli/cof_cli/agents.py:176-268).
  • Agent instruction. The exported AGENTS.md tells the host to append one line per fact in a fixed shape (:33-61).
  • Player write. openLived shows the dialog, proposeLived asks the model, normaliseProposals sanitises, writeLived builds the new nodes and rebuildZip copies every untouched member byte for byte (tools/player/player.js:2939-3004, :3062-3082, :3186-3418).
  • Platform import. cof import turns each exported conversation into one personal moment inside one period per platform (cli/cof_cli/platform_import.py:1414-1470).
  • Selection. select filters, scores, picks and orders; render writes the text (cli/cof_cli/selection.py:648-927, :1033-1049).
  • Injection. buildSystem puts session rules first and the character block in a fence whose every line is marked as data (tools/player/player.js:1519-1567).
  • Purges. drop_personal_memories and _drop_memory_variants remove a node, its folder, its listings, links to it and the assets only it used (cli/cof_cli/ops.py:773-823).
  • Tests. cli/tests/test_selection.py, cli/tests/test_lived_young.py, cli/tests/test_agents.py, tests/shared/cofselect_parity.js, tests/player/player_test.js, tests/player/conversation_test.js.

5. Memory Data Model

The manifest variant holds what a tool reads without opening the node: kind, label, the node path, media, identity, age, nudity, derives_from. The node file holds the content. Links are one-directional with five types on memories (after, part-of, about, because, same-event) and target a qualified reference such as memories/ev3.

Scope is a list on the preset plus a value on the node. slots.memories is the list, replaced whole by a child preset (cli/cof_cli/model.py:70-82). visibility is the value. Neither names a user. In a file with several characters every variant names its identity, and the validator refuses a preset that uses another character's element (cli/cof_cli/validate.py:650).

Times. A memory's when is the event time, as an age, a partial date or both, and the node has no record time. A psyche node's since and until are validity, and a lived one also has revisions[].date. The file has one provenance.modified.

revisions has no producer on memories. The schema and the RFC define it as the previous versions of a lived gist. The only code that writes the key writes it on psyche nodes (cli/cof_cli/selfdesc.py:459, tools/player/player.js:3333, :3341). A lived memory the player updates is overwritten (:3243-3277).

factual is a label. It is meant for real people. The Markdown exporter prints it and the validator warns when it is missing (cli/cof_cli/convert.py:576-577, cli/cof_cli/validate.py:1651-1653). The selection never reads it.

6. Retrieval Mechanics

Filters come first and are never weighted: consent for a real person, personal, secret, explicit content, the under-18 rules, risk, and time (cli/cof_cli/selection.py:694-759). Then a lived heir removes its ancestor, and a contradiction that lost a side is dropped (:761-771).

The score is a weighted mean of six features out of 100 (:31, :777-817):

Feature Weight What it is
base 0.40 salience or strength, 50 when absent
focus 0.25 tags, people, places and objects the host names
lexical 0.15 exact shared words of three characters or more
link 0.10 the best relevance one hop away
recency 0.05 halves every ten years before the character's present
fidelity 0.05 vivid 1.0, clear 0.7, faded 0.4, fragment 0.15

The focus and lexical features saturate, 1 - 0.5^hits. At temperature 0 the pick is greedy; above it, a seeded softmax sample without replacement (:868-898). The player uses temperature 3 and a budget of 12 by default (tools/player/player.js:1148), so the same message can bring back different memories.

Salience outweighs the question. The player passes the user's message as context and no focus keys. A lexical match is then worth at most 15 points, less than the 16 between salience 90 and the default 50 (cli/cof_cli/selection.py:31-35). An agent-imported memory has the default, so a question naming it exactly can still rank it under an unrelated memory its author marked as important.

Matching is exact. There is no stemming and no embedding, and the tokens are folded words. "Dreamed" does not match "dream". Chinese and Japanese are matched on character bigrams.

The candidate cap keeps the oldest. A preset's list is read in slot order to 5,000 per category and the rest are excluded as cap (:699-703). Lived nodes are appended at the end of that list (cli/cof_cli/selfdesc.py:318-319, tools/player/player.js:3124-3130), so on a file past the cap the newest lived memories are the ones never considered.

Core nodes and any stance toward the user are always in and counted in the budget (cli/cof_cli/selection.py:857-862). The flagship example has five, so a budget of 12 leaves seven.

7. Write Mechanics

The default save has no content. The player's dialog opens with "The conversation itself" ticked, the model-written one-sentence gist unticked and every proposed memory unticked (tools/player/template.html:424-427, tools/player/player.js:2992, :3082). The mechanical gist reads "A conversation with {who} in the COF player: {m} messages" (:2324, :3160-3167). The transcript is stored as media, which selection never reads. What a later session can match is the label, the first 48 characters of the user's first message (:3154-3158).

Revisions fork. openCof sets every flag to off, including personal, for every file it opens (:1263). revisableNodes offers the model the nodes the selection would admit under the current flags (:2932-2938). In a new session the earlier heir is excluded as personal and its canon ancestor is eligible, so the ancestor is offered and revised again. _supersede walks each heir to its ancestors, and _derivation_pairs ties a node only to its own chain (cli/cof_cli/selection.py:986-1028). Two heirs of one ancestor are not on one chain, so with personal on both are told. The committed cases hold one heir.

Agent notes are matched two ways, and both misfire.

  • A Hermes entry with no leading date takes the file's modification day (cli/cof_cli/agents.py:212-216). Re-import compares the pair of day and text (:258). After the host writes MEMORY.md on a later day, every undated entry is a new pair and is added again. The test that calls re-import idempotent uses OpenClaw day notes and exported entries that carry their day (cli/tests/test_agents.py:48-80).
  • A note is skipped when it contains any canon gist of 24 or more normalised characters (cli/cof_cli/agents.py:250-261). The rule stops a host from re-importing the export. It also drops a note that quotes a canon sentence and then adds what the user said about it. The player flags the same match and lets the person decide (tools/player/player.js:2984, :3014).

The direct command defaults to canon. cof memory add --gist writes origin: lived and visibility: canon unless --personal is given (cli/cof_cli/cli.py:1628, cli/cof_cli/selfdesc.py:265-266), and a canon node travels in every export. cof psyche add defaults to personal. The generated COF.md shows the command with --personal.

A forgotten memory returns. cof memory unlist deletes a node that no preset lists (cli/cof_cli/cli.py:1199-1230). The next --from-agent compares with the nodes present, so the same note comes back unless the agent's own file lost the line. AGENTS.md tells the agent to delete the line when asked to forget and says nothing about the .cof.

Operational cost

A write is a full unpack, validation and repack of the archive, media included, with no model. The player's proposal is one model call over the conversation, started by the person. Nothing is rewritten in the background. A turn injects at most twelve short gists by default, and the selected block changes with each message, so it sits in the system prompt after the rules and breaks a provider's prefix cache from there.

8. Agent Integration

An agent host gets a workspace, not a tool. cof export --format agent writes SOUL.md, IDENTITY.md, AGENTS.md, MEMORY.md and skills, with personal and secret nodes left out by default. The Hermes form fits entries into the host's character limit by salience (cli/cof_cli/agents.py:71-83). The host then manages its own memory, and the file learns what happened only when a person or the agent runs the import.

skills/cof-author/SKILL.md teaches an agent with a shell to author and edit a file and validate it. That agent can write any node, so the file's axes are conventions to it.

The player gives the model no memory tool. Recall happens before each call and writing happens only through the dialog. cof psyche propose on the CLI writes candidate nodes to a file and applies only ids named in --accept, which is an argument the same agent can pass.

9. Reliability, Safety, and Trust

The personal layer has no owner

personal means one user's data, and nothing says whose. The player asks the person to confirm that they are the one, per file and per opening (tools/player/player.js:47, :1263). cof select --personal takes it as a flag. Two people who use the same file in turn share one personal layer. The strong half of the boundary is the default: every read and every export leaves the layer out, and cof extract deletes it.

The age rule covers memories and not views

A lived memory is listed only where it was lived, and the readers refuse it to an under-18 preset even in an older file that lists it everywhere (cli/cof_cli/selection.py:276-298). psyche_add still lists a lived node in every preset of the character (cli/cof_cli/selfdesc.py:491, :129-135), and the selection applies no such rule to psyche nodes. A stance toward the user recorded with no --since-* is therefore listed in the character's child presets, and a stance toward the user is always in. A since after the child's age excludes it when the file implies a birth year. The player pins its lived psyche nodes to one preset (tools/player/player.js:3196-3199, :3353-3357).

One copy, rewritten in place

pack opens the destination archive for writing directly (cli/cof_cli/container.py:192). cof memory add clara.cof without -o uses the source as the destination, so an interruption during the repack leaves a truncated file where the only copy was. There is no lock, and two hosts holding the same file produce two histories. The player downloads a new file and leaves the opened one as it was.

What holds

The character block is fenced and each line marked as data, with rules that name the fence (tools/player/player.js:1526-1533). Agent notes cannot declare a person as shown, real or of an age. Dropping a personal node takes its folder, its media, links to it and any illustration borrowed from it (cli/cof_cli/ops.py:787-823). Consent and age rules run in the selection, the exports and the player alike.

Marks withheld

  • trust_state. disclosure decides exposure, fidelity ranks, risk is a safety filter, and false_but_held and aware are the character's own beliefs rendered as labels. factual is the one field about truth, and no read filters on it. A lived node is as believed as an authored one.
  • tombstone. Deletion leaves nothing behind, and the re-import compares with the nodes still present.
  • audit_log. revisions is a short list inside the node it describes, produced only on psyche nodes, and it leaves with the node. The player's update of a conversation's moment overwrites the node and the transcript.

10. Tests, Evals, and Benchmarks

The Python suite is broad on the rules: personal, secret, explicit, consent, age and the selection arithmetic, with a worked example whose scores are asserted to six decimals (cli/tests/test_selection.py:64-80). The negative cases run against a populated character. test_from_agent_lists_the_lived_memory_only_in_the_default_preset requires a marker absent from the child preset and present in the adult one for the same query.

tests/shared/cofselect_parity.js runs the Python and JavaScript selections on the same fixtures, which is what makes two implementations of one ranking credible. The player scripts drive a real page and check the saved archive with cof validate, including that an untouched member is byte-identical and that lived memories stay out after reopening (tests/player/player_test.js:262-314).

Neither workflow runs any of it: one publishes to PyPI and the other mirrors the explorer. The pull request template asks for a local pytest run.

Nothing measures recall. docs/reviews/2026-10-31-graph-scale.md times the explorer's drawing of up to 5,250 memories and measures no retrieval. No paper describes the system: the DOIs are Zenodo archives of releases, and the arXiv ids in the tree are in a survey of formats and in example assets' credits.

Missing before relying on it: two heirs of one canon node; a Hermes MEMORY.md whose modification day changes between imports; a note that quotes canon and adds something; a lived psyche node against a child preset; a deleted lived memory followed by a re-import.

11. For Your Own Build

Steal

  • Shadow canon instead of editing it. A user's revision is a new row that derives from the shared one, carries the user's visibility, and replaces it only on reads that include that visibility. Removing the layer restores the original with no undo.
  • Make the read default the safe one. Every export and selection leaves personal nodes out unless asked, so a forgotten flag withholds rather than leaks.
  • Name why each item was left out. The selection returns an exclusion reason per id, and the player shows it. A person can see that a memory exists and why it did not come up.
  • Set the proposal to unticked in code, not from the model's output, and let the person edit the text before it is written.
  • Keep two ports of a ranking honest with fixtures both must reproduce, down to the seeded draw.

Avoid

  • Choosing what may be revised through the filter that hides the revisions. A read with the layer off is the wrong input to a writer of that layer: look up the latest heir, whatever the read flags say.
  • Using a file's modification time as an event date and as part of a dedupe key. The key changes whenever the host writes anything.
  • Substring containment as duplicate detection. Containing a known sentence does not mean saying nothing new.
  • Fixing a scope leak for one record type. The memory path and the psyche path list nodes through two functions, and only one was narrowed.

Fit

COF suits someone who wants a character's past to be portable: an author, a companion-app developer who will honour the axes, or a person who wants to leave a platform with their conversations. It asks for a host that reads the spec, since the file cannot enforce anything on a reader that ignores it. It targets one character and one person, and a few hundred memories.

It does not suit a multi-user service, a store written by several processes, or an agent that must recall what was said last week: recency counts for a twentieth of the score over a ten-year half-life, and the words of a conversation are in an attachment nothing searches. As an interchange format for an existing memory system's episodic layer it is the more useful reading, with dated nodes, typed links, disclosure and consent already modelled.

12. Open Questions

  • Does the ComfyUI-COF node pack, in another repository, apply the same filters?
  • How often do people tick the proposed memories, given that the default save writes none of them?
  • Does Hermes rewrite MEMORY.md often enough for the duplicate import to show in practice?
  • Is a user identifier planned for personal in format 1.3?

Appendix: File Index

  • Format and schema: spec/SPEC.md, spec/schemas/memory.schema.json, spec/schemas/psyche-node.schema.json, rfcs/0002-memories.md, rfcs/0004-psyche-graph.md, docs/IMPLEMENTING.md
  • Node loading and time: cli/cof_cli/memories.py, cli/cof_cli/model.py
  • Selection: cli/cof_cli/selection.py, tools/shared/cofselect.js
  • Writes: cli/cof_cli/selfdesc.py, cli/cof_cli/agents.py, cli/cof_cli/cli.py, cli/cof_cli/platform_import.py
  • Exports and purges: cli/cof_cli/convert.py, cli/cof_cli/ops.py, cli/cof_cli/psyche.py
  • Container: cli/cof_cli/container.py, cli/cof_cli/validate.py
  • Player: tools/player/player.js, tools/player/template.html
  • Tests: cli/tests/test_selection.py, cli/tests/test_lived_young.py, cli/tests/test_agents.py, cli/tests/test_review_13nov_e2e.py, cli/tests/test_roundtrip.py, tests/shared/cofselect_parity.js, tests/player/player_test.js, tests/player/conversation_test.js

Recorded searches

Run from the repository root at the pinned commit with /usr/bin/git grep.

  • revisions is written on psyche nodes only. git grep -n -E '"revisions"|\.revisions' -- cli/cof_cli tools/player tools/shared ':!cli/cof_cli/schemas' returns the writers at selfdesc.py:459 and player.js:3333; :3341 writes it inside an object literal. The rest are reads, a validator warning and the player's proposal key.
  • No value-keyed refusal. git grep -n -i -E 'tombstone|blocklist|denylist|do_not_remember|never_again' -- cli/cof_cli tools spec/schemas returns comparison-page texts about another format and a provider error code at tools/shared/cofai.js:439.
  • No lock and no atomic replace in the CLI. git grep -n -E 'os\.replace|fcntl|flock|lockf|msvcrt|\.lock' -- cli/cof_cli returns nothing; git grep -n -E 'ZipFile\(dest' -- cli/cof_cli returns container.py:192.
  • No vector arm. git grep -n -i -E 'embedding|cosine|faiss|sentence.transformer' -- cli/cof_cli/selection.py tools/shared/cofselect.js tools/player/player.js returns nothing; git grep -n -i lexical -- cli/cof_cli/selection.py matches.
  • The under-18 rule is not applied to psyche nodes. git grep -n -E 'out_of_reach' -- cli/cof_cli/psyche.py cli/cof_cli/selection.py returns selection.py:276, :680 and :732, the last inside the memories branch.
  • factual is not read by a selection. git grep -n -w factual -- tools/player/player.js tools/shared cli/cof_cli/selection.py cli/cof_cli/convert.py returns convert.py:576 and :577.
  • No test moves a modification time. git grep -n -E 'utime|st_mtime' -- cli tests returns agents.py:212.
  • No workflow runs the tests. git grep -n -E 'pytest|node tests' -- .github returns the pull request template.
  • No memory benchmark. git grep -n -i -E 'longmemeval|locomo|recall@|precision@' -- cli tests docs rfcs tools README.md returns two lines of docs/state-of-the-art.md, a survey of other formats.
  • No paper about the system. git grep -c -i arxiv -- . returns docs/state-of-the-art.md and the README and manifests of examples 10 and 11.
  • No submodules. .gitmodules is absent.

History

2026-11-30 — 1e6142a2…. First reading, read at the user's request, from a clone at the head of main, read only. Screened with full history: no auto-run surface, nothing inside the seven-day cooldown, no build-time execution, and cli/pyproject.toml with no lockfile beside it. skills/cof-author/SKILL.md, llms.txt and the example agent skills were read as data. Nothing was installed, built or run, and none of the 538 pytest functions or 87 Node scripts was run; the defects in sections 7 and 9 are traced in the code. Four marks: bitemporal, scope_enforced, human_review, negative_eval.