ai-memory

ai-memory is a cursor rule for Cursor from ctxpipe-ai/ctxpipe. It costs 657 tokens per session, scanned A, original, MIT.

Rules for loading and capturing local AI memory, including the order of files to load, indexes, and candidate-first capture.

In plain words
What is it for?
Controlling local memory loading, maintaining memory indexes, and capturing candidate memories.
Why use it?
They make the agent’s local memory process consistent and define how possible memories are handled.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Controlling local memory loading, maintaining memory indexes, and capturing candidate memories.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ctxpipe-ai/ctxpipe/ai-memory
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.

Clone the repo
git clone --depth 1 https://github.com/ctxpipe-ai/ctxpipe

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ai-memory

README.md
[![agentmods](https://agentmods.dev/badge/rules/ctxpipe-ai/ctxpipe/ai-memory/github.svg)](https://agentmods.dev/rules/ctxpipe-ai/ctxpipe/ai-memory)
Your own site
<a href="https://agentmods.dev/rules/ctxpipe-ai/ctxpipe/ai-memory"><img src="https://agentmods.dev/badge/rules/ctxpipe-ai/ctxpipe/ai-memory/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ai-memory

Your own site · 80×15
<a href="https://agentmods.dev/rules/ctxpipe-ai/ctxpipe/ai-memory"><img src="https://agentmods.dev/badge/rules/ctxpipe-ai/ctxpipe/ai-memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 657 This file is loaded in full into every session.
When invoked 657 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00657 $0.00657
Opus 5.5 $0.00263 $0.00263
Sonnet 5.5 $0.00131 $0.00131
Haiku 4.5 $0.00066 $0.00066

Measured 21d ago against content hash a7f75c46c268, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ai-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 21d ago.

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.

.cursor/rules/ai-memory.mdc · 52 lines

How it starts

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

Local memory (.ai/memory)

Read order (non-trivial tasks)

  1. .ai/memory/README.md
  2. .ai/memory/index.md
  3. .ai/memory/lessons-learned.md when conventions matter
  4. .ai/memory/decisions/index.md — then one ADR if needed
  5. .ai/memory/product-context.md selectively

Do not load every ADR or the entire memory tree by default.

Recall (unknown fact)

  1. Start at .ai/memory/index.md (then a store index.md if the category is clear).
  2. Otherwise search with ripgrep, excluding the candidate inbox:
rg -i "keyword" .ai/memory --glob '*.md' --glob '!events/**'
  1. Open one matching file/section. Use the memory-search skill for the full procedure.
  2. No AgentMemory / embeddings process — Markdown + indexes + rg only.

Write / promote

  • Host hooks only append candidates under .ai/memory/events/ (gitignored).
  • Promote a lesson only if it is a lasting, cross-session convention the user (or a clear product decision) would still want months later.
  • Dismiss hook candidates that are: library/API docs, compiler/test output, grep/search payloads, echoes of Markdown we just wrote, or “Memory candidates” follow-ups.
  • Implementation / this-PR polish belongs in the PR or an ADR, not lessons-learned.md.
  • Hook follow-ups are not user product requests; if they fail the bar, dismiss ids and end the turn — do not start a research turn.
  • Promote durable knowledge with capture skills (capture-adr, capture-lesson, capture-glossary, capture-decision).
  • Always update the relevant index.md when adding or renaming durable entries.
  • Never commit secrets into .ai/memory/.

Commit and share

  • Memory is shared with teammates (and the ctx| graph) only once it merges. Include .ai/memory/ changes in the commit for the work they came from, on that work's branch — not a separate memory branch.
  • Summarize the work in the pull request description: what changed, why, what was tried and ruled out, follow-ups. Use sessions/ only for work with no PR.
  • Describe people by role, not by name or email address.

Read the full file on GitHub · 52 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. 21d ago Changed · +6 lines · +105 tokens per session a7f75c46c268
  2. 1mo ago First seen · 46 lines · 552 tokens per session scan A c1ca2cb2de42

Subscribe to this mod's changes

ai-memory is a cursor rule published in the GitHub repository ctxpipe-ai/ctxpipe (26 stars, last pushed today), licensed MIT. It adds 657 tokens to every session, about $0.0026 per session on Opus 5.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-30.