How do I create a memory?

Table of Contents

For background on what project memory is and what does and does not belong in it, see the project memory inventory. For the LLM-side procedure (when to write a memory vs when to push back), see the doc-add-memory skill.

Question

How do I write a new project memory — pick the subtype, scaffold the file, fill in the body, and link it from the inventory?

Answer

Memories are short, atomic, durable. One memory per file under doc/llm/memory/. Use the codegen to scaffold; never hand-write the frontmatter.

  1. Pick the subtype. Memories use the same four subtypes as Claude Code's auto-memory:
    • feedback — what the user has corrected or confirmed.
    • user — facts about the user.
    • project — facts about the work in flight or its motivation.
    • reference — pointers to external systems.
  2. Pick a slug. Snake-case, short, descriptive of the rule rather than the topic — e.g. do_not_re_export_env_vars, not bash.
  3. Scaffold the file using compass add memory:

    projects/ores.compass/compass.sh add memory \
      --slug do_not_re_export_env_vars \
      --title "Do not re-export ORES_* env vars in Bash tool calls" \
      --description "The user has already exported ORES_* env vars in their shell session — don't prepend them." \
      --memory-subtype feedback
    

    --parent-dir defaults to doc/llm/memory; only pass it to land the file somewhere else. The memory tag and the chosen subtype are auto-added to #+filetags so the whole catalogue is greppable in one shot.

  4. Fill in the body. The scaffold gives you a one-paragraph placeholder plus *Why:* and *How to apply:* bold lines. Replace each with the actual content:
    • Lead with the rule, one to two sentences.
    • *Why:* the reason (the user's words, or the incident).
    • *How to apply:* when this kicks in (which files, which workflows, what circumstances).
  5. Link from the inventory. Open Project memory and add an id-link under the appropriate subtype heading.
  6. Verify:

    ./projects/ores.compass/compass.sh show <uuid-prefix>
    

    The Outgoing/Incoming link sections should resolve cleanly.

Conventions

  • One memory per file. If you find yourself writing "and also…", the second point is its own memory.
  • Lead with the rule, not the topic. do_not_re_export_env_vars, not bash_environment.
  • Always include *Why:*. Without the why, future sessions can't judge edge cases.
  • Don't duplicate code-derivable facts. Architecture, conventions, file paths belong in Knowledge, not memory.
  • Don't duplicate CLAUDE.md. If a guideline is enforced on every session, it goes there.

Script

projects/ores.compass/compass.sh add memory — the compass wrapper delegates to ores.codegen. The memory-specific machinery (template, --memory-subtype flag, tag injection) lives in projects/ores.codegen/src/doc_generate.py and the template at projects/ores.codegen/library/templates/doc_memory.org.mustache.

Tested by

Manual. Scaffolding via the codegen guarantees the frontmatter; a visual check of the generated memory file confirms it.

See also

Emacs 29.1 (Org mode 9.6.6)