agent-architecture

agent-architecture is a cursor rule for Cursor from mergisi/openclaw-rules. It costs 623 tokens per session, scanned A, original, MIT.

A set of rules for organizing and configuring OpenClaw agents, including their identity, memory, tools, secrets, scheduled tasks, and bot entry point.

In plain words
What is it for?
Use it when creating or changing an OpenClaw agent, especially one with persistent memory, tool scripts, scheduled tasks, or a Telegram bot.
Why use it?
It gives agents a consistent layout and naming scheme, so developers know where each part belongs and how to configure it.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: built for openclaw.

Good fit Use it when creating or changing an OpenClaw agent, especially one with persistent memory, tool scripts, scheduled tasks, or a Telegram bot.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/mergisi/openclaw-rules/agent-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/mergisi/openclaw-rules

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

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/mergisi/openclaw-rules/agent-architecture"><img src="https://agentmods.dev/badge/rules/mergisi/openclaw-rules/agent-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 623 This file is loaded in full into every session.
When invoked 623 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.00623 $0.00623
Opus 5.5 $0.00249 $0.00249
Sonnet 5.5 $0.00125 $0.00125
Haiku 4.5 $0.00062 $0.00062

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

Security

Grade A, and why

agent-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 3mo 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.

project-rules/agent-architecture.mdc · 72 lines

How it starts

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

OpenClaw Agent Architecture

When building or modifying an OpenClaw agent, follow this directory structure and these conventions.

Directory Structure

my-agent/
├── SOUL.md              # Agent identity, personality, rules
├── config.json          # Agent metadata and heartbeat config
├── MEMORY.md            # Persistent memory (agent reads/writes this)
├── tools/               # Tool scripts (Node.js, zero npm deps)
│   ├── ga4-report.cjs
│   ├── stripe-report.cjs
│   └── reddit-scan.cjs
├── secrets/             # API keys and credentials (never commit)
│   ├── ga4-credentials.json
│   └── .env
├── TOOLS.md             # Available commands and usage
├── HEARTBEAT.md         # Scheduled task definitions
├── USER.md              # User preferences and context
└── bot-telegram.cjs     # Telegram bot entry point

config.json

{
  "name": "AgentName",
  "role": "Role Description",
  "sessionKey": "agent:name:main",
  "heartbeat": { "interval": 0, "offset": 0 },
  "capabilities": ["list", "of", "capabilities"],
  "personality": {
    "tone": "analytical_concise",
    "verbosity": "moderate",
    "emoji_usage": "none"
  },
  "systemFiles": ["agents/name/SOUL.md"]
}
  • heartbeat.interval: 0 means Telegram-only (no scheduled tasks via legacy heartbeat)
  • Use ~/.openclaw/cron/jobs.json for scheduled tasks instead
  • sessionKey format: agent:{name}:{scope}

Key Conventions

  • Zero npm dependencies for tool scripts. Use Node.js built-in https, fs, path, crypto.
  • CommonJS format (.cjs) for all scripts. OpenClaw runs scripts directly with node.
  • Secrets in environment variables or secrets/ directory. Never hardcode API keys.
  • MEMORY.md is the agent's long-term memory. The agent reads it at session start and writes to it when it learns something important. Keep it under 200 lines.
  • TOOLS.md lists available commands. The agent reads this to know what scripts it can run.
  • Each agent gets its own directory under agents/. Never share config files between agents.

Read the full file on GitHub · 72 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. 3mo ago First seen · 72 lines · 623 tokens per session scan A 308f96b64a42

Subscribe to this mod's changes

agent-architecture is a cursor rule published in the GitHub repository mergisi/openclaw-rules (2 stars, last pushed 9mo ago), licensed MIT. It adds 623 tokens to every session, about $0.0025 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.

Related

agent-architecture compared with cursor rules from other repositories

agent-architecture next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
agent-architecturemergisi/openclaw-rulesCursor rule29mo agoMITA623Cursor
swiftnedcodes-ok/cursorrules-collectionCursor rule389mo agoMITA310Cursor
002-verify-before-actbookedsolidtech/helixirCursor rule55mo agoMITA306Cursor
pre-flight-checkmirekondro/The-Pre-Flight-CheckCursor rule25mo agoMITB982Cursor
ponytailDietrichGebert/ponytailCursor rule201k8d agoMITA604Cursor
angular-20angular/angularCursor rule102k4d agoMITA0Cursor
dev-standardapache/supersetCursor rule76ktodayApache-2.0A1,147Cursor