archmemory-architecture

archmemory-architecture is a cursor rule for Cursor from IWill29/archmemory. It costs 764 tokens per session, scanned A, original, MIT.

A set of coding rules for ArchMemory, with the architecture document as the source of truth. It describes how the Laravel project is divided into presentation, application, domain and infrastructure parts, and how files and tools should be structured.

In plain words
What is it for?
Guiding architecture decisions, code refactoring and implementation in the ArchMemory Laravel project.
Why use it?
It keeps new or changed code aligned with the project’s planned structure and required patterns instead of letting each change introduce a different approach.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Guiding architecture decisions, code refactoring and implementation in the ArchMemory Laravel project.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/iwill29/archmemory/archmemory-architecture
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/IWill29/archmemory

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 archmemory-architecture

README.md
[![agentmods](https://agentmods.dev/badge/rules/iwill29/archmemory/archmemory-architecture/github.svg)](https://agentmods.dev/rules/iwill29/archmemory/archmemory-architecture)
Your own site
<a href="https://agentmods.dev/rules/iwill29/archmemory/archmemory-architecture"><img src="https://agentmods.dev/badge/rules/iwill29/archmemory/archmemory-architecture/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 archmemory-architecture

Your own site · 80×15
<a href="https://agentmods.dev/rules/iwill29/archmemory/archmemory-architecture"><img src="https://agentmods.dev/badge/rules/iwill29/archmemory/archmemory-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 764 This file is loaded in full into every session.
When invoked 764 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.00764 $0.00764
Opus 5.5 $0.00306 $0.00306
Sonnet 5.5 $0.00153 $0.00153
Haiku 4.5 $0.00076 $0.00076

Measured 2mo ago against content hash 5610162f024c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

archmemory-architecture 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 2mo 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/archmemory-architecture.mdc · 91 lines

How it starts

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

ArchMemory Architecture

Source of truth: docs/design/architecture-design.md
Related: docs/PROJECT_CONTEXT.md, docs/design/mcp-tools-design.md

Before writing or refactoring code, align with the architecture design. If unclear, read those docs first.

Stack (MVP)

  • Laravel 12, PHP 8.3+, MCP stdio (php artisan mcp:serve)
  • Storage: .archmemory/ Markdown + JSON only — no database in MVP
  • Packages: laravel/mcp, nikic/php-parser, spatie/laravel-data, Pest

DDD Layer Structure

Presentation   → app/Domains/Mcp/Tools/, app/Console/Commands/
Application    → app/Domains/*/Actions/, app/Domains/*/DTOs/
Domain         → app/Domains/*/Services/
Infrastructure → Filesystem readers, PHP-Parser, Composer parsers
Domain Path Responsibility
Memory app/Domains/Memory/ Read/write .archmemory/ files
Mcp app/Domains/Mcp/Tools/ MCP tool handlers (thin)
Rules app/Domains/Rules/ Rules engine, validators
Analysis app/Domains/Analysis/ Project scan, doc generation

Mandatory Patterns

  • Every PHP file: declare(strict_types=1);, typed properties, explicit returns
  • MCP Tools and Artisan Commands are thin — delegate to Actions only
  • Business logic lives in Services or Actions, never in Tools/Commands
  • Tool responses use DTOs (Spatie Laravel Data or readonly DTOs)
  • Config in config/archmemory.php — never env() outside config
  • MCP read path only via MemoryReaderService; writes only via CLI + MemoryWriterService
  • Every MCP tool needs a Pest feature test

MCP Tools (MVP — implement in this order)

  1. get_project_context
  2. get_architecture_rules
  3. get_module_info
  4. get_decision_history
  5. validate_change

Register in ArchmemoryServiceProvider via Mcp::tool().

CLI Commands (MVP)

  • archmemory:init — scaffold .archmemory/
  • archmemory:analyze — generate architecture.md
  • archmemory:update — refresh context after changes
  • mcp:serve — stdio MCP server

Read the full file on GitHub · 91 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. 2mo ago First seen · 91 lines · 764 tokens per session scan A 5610162f024c

Subscribe to this mod's changes

archmemory-architecture is a cursor rule published in the GitHub repository IWill29/archmemory (0 stars, last pushed 3mo ago), licensed MIT. It adds 764 tokens to every session, about $0.0031 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-31.