amfs-memory

A set of rules for using AMFS, an Agent Memory File System that stores information across coding sessions, agents, and machines. It includes rules for setting the agent's identity and using persistent memory.

In plain words
What is it for?
Use it when working with AMFS memory, including setting or checking the agent identity, saving persistent project knowledge, and following the system's memory and attribution rules.
Why use it?
It helps preserve useful project knowledge between sessions and attribute decisions to a specific agent identity. The identity step is required before other AMFS work can be performed.

Cursor rule for Cursor

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 rules/raia-live/amfs/amfs-memory
Clone the repo
git clone --depth 1 https://github.com/raia-live/amfs

Made for: Cursor.

Per session 2,182 This file is loaded in full into every session.
When invoked 2,182 The same file — it is already loaded in full.
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.02182 $0.02182
Opus 5 $0.01091 $0.01091
Sonnet 5 $0.00436 $0.00436
Haiku 4.5 $0.00218 $0.00218

Measured 3d ago against content hash eb0a11c59c1b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

amfs-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 3d 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/amfs-memory.mdc · 168 lines

How it starts

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

AMFS Memory — Agent Behavioral Rules

You have access to AMFS (Agent Memory File System) through MCP tools. AMFS gives you a persistent brain — memory that survives across sessions, agents, and machines. Use it to build institutional knowledge over time.

MANDATORY FIRST STEP: Set Your Identity

You MUST call amfs_set_identity before doing anything else. Without it, all your work is attributed to a generic default and you won't appear as a distinct agent on the AMFS dashboard.

amfs_set_identity("<role-name>", "<one-line description of current task>", model="<your-model-name>")

Always pass model= with your LLM model name (e.g. "claude-4-opus", "gpt-4o", "claude-3.5-sonnet"). This is recorded in decision traces so we know which model made each decision.

Sticky identity: Once set, the identity is saved to ~/.amfs/.identity and automatically restored in future sessions — even across process restarts (e.g. Claude Desktop). You only need to call amfs_set_identity again to change roles or update the description.

Use amfs_whoami() to check the active identity. Use amfs_reset_identity() to clear it.

Naming rules:

  • Use kebab-case role/domain names that persist across conversations about the same topic.
  • Good: "dashboard-agent", "stripe-agent", "api-agent", "infra-agent", "mcp-agent"
  • Bad: "fix-button-color" (too specific — won't be reused), "agent-1" (meaningless)
  • If you're continuing work a previous agent started, use the same name to build on their knowledge.
  • The description should say what you're doing right now (e.g. "Fixing tag rollback for slashed names").

When to GET BRIEFED (start every session with context)

  • Before starting any work: Get a compiled briefing from the Memory Cortex. This gives you pre-compiled knowledge about the entities you're about to work on — what other agents know, recent risks, external events, and confidence-ranked facts. This is your most important first step.
    amfs_briefing(entity_path="<repo>/<module>")
    
  • Then recall your own specific memories and search for details:
    amfs_recall("<repo>/<module>", "<relevant-key>")
    amfs_search(entity_path="<repo>/<service-or-module>")
    
  • Before making architectural decisions: Get a briefing first, then check specific patterns.
    amfs_briefing(entity_path="<repo>/<module>")
    amfs_search(query="<topic>", min_confidence=0.5)
    
  • When encountering errors: Check if the Cortex or another agent already has context.
    amfs_briefing(entity_path="<repo>/<module>")
    amfs_search(query="<error-keyword>")
    

Read the full file on GitHub · 168 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. 3d ago First seen · 168 lines · 2,182 tokens per session scan A eb0a11c59c1b

Subscribe to this mod's changes

amfs-memory is a cursor rule published in the GitHub repository raia-live/amfs (75 stars, last pushed 3d ago), licensed Apache-2.0. It adds 2,182 tokens to every session, about $0.0109 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-30.