All Days
Day 41

12 Agent Primitives — The Leak Decoded

Walid Boulanouar · AY Automate

Agent Primitives
from the $2.5B Leak

Anthropic's Claude Code source was accidentally exposed. Here are the 12 architecture patterns every agent builder should steal.

207
Commands
184
Tools
18
Bash Security Modules
$2.5B
Annual Run Rate

If your agent doesn't have at least six of these, you have a demo. Not a product.

Tier 1Day One Non-Negotiables
Foundation
Tool Registry, Metadata-First

207 commands + 184 tools as data structures. List capabilities without invoking them. Registry is source of truth.

Security
3-Tier Permission System

Built-in / Plugin / Skill trust tiers. Bash tool alone has 18 security modules. Pre-approved patterns, destructive detection.

Reliability
Session Persistence

Full state as JSON: messages, tokens, permissions, config. Reconstruct any session after crash. Zero data loss.

Performance
Context Window Management

Compaction hooks + daily promotion logic. Prevent context rot over long conversations. Memory stays sharp.

Tier 2Architecture Layer
Identity
Memory Layer

soul.md for personality. user.md for profile. memory.md for decisions. Loaded at session start. Promoted daily.

Proactive
Heartbeat System

Cron-driven agent gathers context from APIs, reasons about your needs, acts before you ask. Posts alerts.

Safety
Tool Scoping

Every tool classified: Read / Mutate / Destructive. Pre-approved safe patterns. Flagging before dangerous ops.

Resilience
Error Recovery

Graceful fallback with backoff retry logic. Not crash-and-burn. Agent degrades instead of dying.

Tier 3Production Scale
Cost
Multi-Model Routing

Haiku for simple, Sonnet for medium, Opus for complex. Right model for right subtask. 50-80% savings.

Automation
Pre/Post Hooks

Session-start loads context. Pre-compact saves state. Post-build runs tests. Lifecycle automation at every edge.

Compliance
Permission Logging

Every grant/deny recorded with context. Full audit trail. Decisions replayable for debugging and compliance.

Zero Trust
Skill Isolation

User-defined skills start at lowest trust. Never escalate silently. Permission boundaries are deliberate.

Built by Anthropic. Leaked to everyone. Architecture lessons are permanent.

don't miss what's next.

Agent architecture breakdowns, automation playbooks, and tools that actually save you hours. straight to your inbox. no spam. unsubscribe anytime.