using-cortex-memory

Instructions for using Cortex, a shared memory service for AI agents. It explains how to save, find, update, and remove durable facts, preferences, and decisions.

In plain words
What is it for?
Recalling relevant past facts, storing lasting user preferences or project decisions, handling dates and relationships, and responding to requests to remember or forget something.
Why use it?
Important information can be lost between sessions or when different agents work with the same user. Shared memory keeps useful context available across those conversations.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/fernsdavid25/cortex-protocol/using-cortex-memory
Any agent
npx skills add fernsdavid25/cortex-protocol --skill using-cortex-memory
Clone the repo
git clone --depth 1 https://github.com/fernsdavid25/cortex-protocol

Made for: Claude Code, Codex.

Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,382 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00082 $0.01382
Opus 5 $0.00041 $0.00691
Sonnet 5 $0.00016 $0.00276
Haiku 4.5 $0.00008 $0.00138

Measured yesterday against content hash 9a11a8496124, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

using-cortex-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/using-cortex-memory/SKILL.md · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Using Cortex Memory — get maximum value from the user's memory

Cortex is the USER'S portable, cross-agent memory — you are one of several AIs reading and writing the same store, with their consent. Write for a reader that isn't you; recall before you assume; the user's memory outlives this session and this agent.

How Cortex works (why the rules below exist)

  • Recall is hybrid search with NO LLM: dense embeddings + keyword search fused by rank. Your query text is the entire retrieval signal — names, distinctive words, and paraphrases of meaning all help; no model on the server interprets vague queries. Recall is one embedding call: fast and cheap, so use it liberally.
  • Enrichment happens at WRITE time: when you memorize, Cortex extracts entities and relationships into a knowledge graph, resolves dates onto an event timeline, deduplicates near-identical facts, and supersedes contradicted ones (old versions are kept, marked outdated — never silently lost). The quality of all of that depends on how you phrase what you store.
  • The tools are specialized reads over one store — routing correctly is most of this skill.

Routing — pick the right tool for the question

Situation Tool
Specific question ("what stack does she prefer?") recall — phrase with names + meaning
"Tell me everything about X" (person/project/place) recall_about — exhaustive entity dossier (relations + attached memories); top-k recall structurally can't enumerate
"What happened last month / between dates / when did…" recall_timeline — queries true event time, not storage time
"What's recently stored?" / orientation list_memories
User states something durable / corrects a fact memorize (supersession is automatic)
User asks to delete / data is wrong or sensitive forget — immediately, no debate

Writing memories that retrieve well (the craft)

  1. One fact per memorize. Bundled paragraphs dedupe badly, embed vaguely, and can't be individually superseded or forgotten. Split compound facts.
  2. Self-contained phrasing: resolve every pronoun and implicit reference — "David prefers pnpm over npm for all projects", never "he prefers it". Another agent with zero context is the reader.
  3. Name the entities explicitly (people, projects, places, orgs): names power the graph extraction, the entity dossiers, AND the keyword half of retrieval. "Swizel (David's girlfriend) likes apples" builds graph edges; "she likes apples" builds nothing.
  4. Anchor time absolutely: "on 2026-07-05" or "in March 2026". Relative phrases ("yesterday") are resolved against the write date, so they work — but absolute dates are safer and survive re-telling.
  5. Store the durable, skip the transient: preferences, profile facts, decisions and their reasons, relationships, recurring context, important events. Do NOT store: this-session task state, secrets/credentials/API keys (never — memory is not a vault), huge pasted content (store the fact plus where the content lives), or trivia the user wouldn't expect remembered.
  6. Updates are new writes: when a fact changes ("I switched to pnpm"), memorize the new state — Cortex supersedes the old version automatically. Use forget only for deletion requests and wrong/sensitive data, not for routine updates.
  7. Classify with kind — one of preference, fact, project, instruction, event, relationship (unset defaults to fact). It improves organization and the user's dashboard view; add tags when a natural grouping exists.

Read the full file on GitHub · 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 94 lines · 82 tokens per session scan A 9a11a8496124

Subscribe to this mod's changes

using-cortex-memory is a skill published in the GitHub repository fernsdavid25/cortex-protocol (2 stars, last pushed 27d ago), licensed Apache-2.0. It adds 82 tokens to every session and 1,382 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.