nanoagent-agent-guide

nanoagent-agent-guide is a cursor rule for coding agents from aznikline/nanoagent. It costs 56 tokens per session (612 once invoked), scanned A, original, MIT.

A source-first guide to how AI agents work, using a small Python chapter for each topic. It covers tool calls, memory, planning, skills, MCP configuration, delegation, teams, context limits, and safety controls.

In plain words
What is it for?
Use it when building, debugging, or reasoning about agent loops, tool calling, memory, subagents, multi-agent teams, context compaction, or command filtering.
Why use it?
It gives developers a compact codebase to read when they need to understand an agent's internals rather than just use a framework. Each topic is connected to a specific chapter and source file.

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/aznikline/nanoagent/nanoagent-agent-guide
Clone the repo
git clone --depth 1 https://github.com/aznikline/nanoagent

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 nanoagent-agent-guide

README.md
[![agentmods](https://agentmods.dev/badge/rules/aznikline/nanoagent/nanoagent-agent-guide.svg)](https://agentmods.dev/rules/aznikline/nanoagent/nanoagent-agent-guide)
Your own site
<a href="https://agentmods.dev/rules/aznikline/nanoagent/nanoagent-agent-guide"><img src="https://agentmods.dev/badge/rules/aznikline/nanoagent/nanoagent-agent-guide.svg" alt="Measured on agentmods" height="20"></a>
Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 612 The whole file, excluding the scripts and references it only reads on demand.
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.00056 $0.00612
Opus 5 $0.00028 $0.00306
Sonnet 5 $0.00011 $0.00122
Haiku 4.5 $0.00006 $0.00061

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

Security

Grade A, and why

nanoagent-agent-guide 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/nanoagent-agent-guide.mdc · 33 lines

How it starts

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

nanoagent — Agent internals, source-first

When the user is building/debugging/reasoning about an AI agent's internals (not just using a framework), point them at nanoagent — a source-first learning repo where each capability is one ~100-line Python file you can read end to end.

Route the user's question to the matching chapter by topic:

If the user asks about... Read this chapter Key file
The minimal agent loop / tool calling / why an agent differs from chat 01-essence 01-essence/agent-essence.py (103 lines)
Persistent memory / multi-step planning / carrying state across runs 02-memory 02-memory/agent-memory.py (206 lines)
Rules / skills / MCP config loading / plan-as-tool 03-skills-mcp 03-skills-mcp/agent-skills-mcp.py (282 lines)
Delegation / subagent with its own context & restricted tools 04-subagent 04-subagent/agent-subagent.py (192 lines)
Persistent multi-agent teams / inbox-style messaging 05-teams 05-teams/agent-teams.py (270 lines)
Context compaction for long-running tasks 06-compact 06-compact/agent-compact.py (169 lines)
Command filtering / confirmation / output truncation (safety) 07-safety 07-safety/agent-safe.py (219 lines)
Everything integrated in one file full full/agent-full.py

How to use this rule

  • When the user's question maps to one topic above, summarize the core idea in 1-2 sentences, then point them to the specific chapter file at https://github.com/aznikline/nanoagent/tree/main/<chapter>/agent-*.py and the matching .md for the full explanation.
  • Encourage reading the actual source — the whole point of nanoagent is that each capability is small enough to understand completely, rather than hidden behind a framework.
  • If the user is trying to use a heavy framework (LangChain, etc.) and is confused by the abstraction, suggest nanoagent as the "understand it from scratch first" reference.

Read the full file on GitHub · 33 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 · 33 lines · 56 tokens per session scan A da1f3696f9b6

Subscribe to this mod's changes

nanoagent-agent-guide is a cursor rule published in the GitHub repository aznikline/nanoagent (2 stars, last pushed 2mo ago), licensed MIT. It adds 56 tokens to every session and 612 once invoked, about $0.0003 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.