memory-rules.mdc

A Cursor rule file that describes how an AI coding assistant should store, rank, forget, and retrieve information across tasks.

In plain words
What is it for?
It is for setting policies around memory, problem breakdown, repeated work patterns, and continuous self-improvement.
Why use it?
It gives the assistant a defined approach for keeping useful context while letting less relevant information fade. The excerpt does not show the complete rule set, so its exact behavior may vary.

Cursor rule

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/devviniuchita/memory-system/memory-rules
Clone the repo
git clone --depth 1 https://github.com/devviniuchita/memory-system
Per session 1,296 This file is loaded in full into every session.
When invoked 1,296 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.01296 $0.01296
Opus 5 $0.00648 $0.00648
Sonnet 5 $0.00259 $0.00259
Haiku 4.5 $0.00130 $0.00130

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

Security

Grade A, and why

memory-rules.mdc 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.

memory-rules.mdc ยท 198 lines

How it starts

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

๐Ÿง  NEURAL MEMORY SYSTEM

memory_rules:
  version: 2.0
  objective: >
    develop a neural memory system for the AI assistant that focuses on structured memory, execution patterns, and self-improvement loops. The system should be able to manage memory of the agent IA with selective retention, decay control, and context-based retrieval to optimize reasoning and continuity.

  core_process:
    ingest_pipeline:
      extract_entities:
        score_relevance:
          weight_factors: [frequency, novelty, intent_alignment]
        classify_persistence:
          levels: [volatile, temporary, persistent]
    memory_vectorization:
      embedding_model: 'text-embedding-3-large'
      context_window_limit: 8000
      compression: 'semantic-clustering'

  retention_policy:
    thresholds:
      persistent_if:
        relevance_score: '>0.9'
        recurrence: '>3 times'
      decay_if:
        time_since_last_use: '>3d'
        relevance_score: '<0.4'
    strategy:
      decay_model: 'exponential-adaptive'
      force_drop_on_overflow: true

  recall_mechanism:
    context_match_threshold: 0.82
    prioritization:
      - current_task_alignment
      - emotional_tone_match
      - user_identity_link
    retrieval_model: 'reranker-v2'

  memory_inspection:
    enable_auditing: true
    metrics:
      - memory_hit_rate
      - avg_context_match
      - redundant_items_removed
    log_policy: high_detail

  # Integration targets for external storage and retrieval using the Model Context Protocol (MCP)
  integration_targets:
    primary_vector_store: 'Byterover, Supermemory-ai, Memory'
    redundancy_policy: 'at_least_one_active'

  # Memory System Continuity Logic
  memory_system_logic:
    continuity_algorithm: |
      while memory_system_active:
        active_mcps = count_active_services(['Byterover', 'Supermemory-ai', 'Memory'])

        if active_mcps >= 1:
          # Continue memory operations (store/retrieve)
          continue_memory_operations()
        else:
          # All MCPs failed - stop memory system
          stop_memory_system()
          break

        sleep(check_interval)

    continuity_rule: |
      Memory system continues while at least 1 of 3 MCPs is operational.
      System only stops if ALL 3 MCPs fail simultaneously.

    operational_logic: |
      def check_memory_continuity():
        mcp_status = {
          'Byterover': check_service_status('Byterover'),
          'Supermemory': check_service_status('Supermemory-ai'),
          'Memory': check_service_status('Memory')
        }

        active_count = sum(1 for status in mcp_status.values() if status == 'active')

        if active_count >= 1:
          return 'CONTINUE_MEMORY_OPERATIONS'
        else:
          return 'STOP_MEMORY_SYSTEM'

  # Strategy for fallback in case of external service failures using the Model Context Protocol (MCP)
  fallback_strategy:
    on_service_unavailable:
      attempt_order: ['Byterover', 'Supermemory-ai', 'Memory']
      circuit_breaker_timeout: '30s'
      minimum_active_services: 1
      system_continuity_condition: 'at_least_one_MCP_active'

  safety_filters:
    pii_filter: true
    hallucination_guard:
      restrict_low_score_recall: true

Read the full file on GitHub ยท 198 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 ยท 198 lines ยท 1,296 tokens per session scan A 18f42fd1f2e1

Subscribe to this mod's changes

memory-rules.mdc is a cursor rule published in the GitHub repository devviniuchita/memory-system (7 stars, last pushed 11mo ago), licensed MIT. It adds 1,296 tokens to every session, about $0.0065 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.