Core System Overview¶
Samuel (Artificial Intelligence Coding Framework) is built on a simple but powerful architecture designed for progressive adoption and cross-tool compatibility.
Architecture¶
┌─────────────────────────────────────────────────────────────┐
│ Your Project │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌──────────────────────────────────┐ │
│ │ CLAUDE.md │ │ .claude/ │ │
│ │ │ │ │ │
│ │ • Commands │ │ ├── skills/ (language, framework, │ │
│ │ • Guards │ │ │ workflow skills) │ │
│ │ • Methods │ │ └── auto/ (autonomous loop state) │ │
│ │ │ │ │ │
│ └─────────────┘ └──────────────────────────────────┘ │
│ ↑ ↑ │
│ └───────────────────────────┘ │
│ References │
└─────────────────────────────────────────────────────────────┘
Core Components¶
CLAUDE.md - The Brain¶
The main instruction file loaded by AI assistants. Contains:
| Section | Purpose |
|---|---|
| Operations | Commands for setup, testing, building |
| Boundaries | Files/actions AI should not modify |
| Quick Reference | Task classification, emergency links |
| Guardrails | 35+ testable rules |
| 4D Methodology | ATOMIC/FEATURE/COMPLEX modes |
| SDLC | Software Development Lifecycle stages |
| Context System | How .claude/ directory works |
| Anti-Patterns | What to avoid |
Size: ~500 lines (optimized for token efficiency)
.claude/ Directory - The Memory¶
Project-specific context that grows over time:
.claude/
├── skills/ # Agent Skills (language, framework, workflow)
│ ├── go-guide/ # 21 language guide skills
│ ├── react/ # 33 framework skills
│ ├── create-prd/ # 23 workflow skills
│ ├── auto/ # Autonomous loop skill
│ └── ...
├── auto/ # Autonomous loop state (generated by samuel auto init)
│ ├── prd.json # Machine-readable task state
│ ├── progress.md # Learnings journal
│ ├── prompt.md # Iteration prompt
│ └── discovery-prompt.md # Discovery prompt (pilot mode)
└── settings.local.json # Claude Code local settings (gitignored)
Loading Protocol:
- Session Start: AI loads CLAUDE.md → checks per-folder CLAUDE.md
- During Work: Language guide loads based on file extensions
- Complex Features: Workflows and framework skills loaded on-demand
- Autonomous Mode: Reads prd.json, progress.md for task selection
The 3 Modes¶
AI auto-detects which mode based on task complexity:
ATOMIC Mode¶
For: Bug fixes, small features (<5 files)
graph LR
A[Task] --> B[Deconstruct]
B --> C[Diagnose]
C --> D[Develop]
D --> E[Deliver]
E --> F[Done ✓] - Direct implementation
- Quick validation
- One commit
FEATURE Mode¶
For: New components, API endpoints (5-10 files)
graph TD
A[Task] --> B[Break into 3-5 subtasks]
B --> C1[Subtask 1]
B --> C2[Subtask 2]
B --> C3[Subtask 3]
C1 --> D[Integration Test]
C2 --> D
C3 --> D
D --> E[Documentation]
E --> F[Done ✓] - Break into subtasks
- Sequential implementation
- Multiple commits
COMPLEX Mode¶
For: New subsystems, architecture (>10 files)
graph TD
A[Task] --> B[Create PRD]
B --> C[Generate Tasks]
C --> D[Task 1]
D --> E[Task 2]
E --> F[Task N]
F --> G[Integration]
G --> H[Documentation]
H --> I[Done ✓] - PRD workflow (optional but recommended)
- Full task breakdown
- Staged delivery
The 4D Methodology¶
Every task follows four phases:
| Phase | Purpose | Key Question |
|---|---|---|
| Deconstruct | Break down the task | What's the minimal change? |
| Diagnose | Identify risks | Will this break anything? |
| Develop | Implement with tests | Does it meet guardrails? |
| Deliver | Validate and commit | Is it ready for production? |
Guardrails System¶
35+ testable rules across categories:
-
Code Quality
- Functions ≤50 lines
- Files ≤300 lines
- Complexity ≤10
- All exports typed
-
Security
- Input validation
- Parameterized queries
- No hardcoded secrets
- Dependency auditing
-
Testing
-
80% business logic
-
60% overall
- Regression tests
- No flaky tests
-
-
Git
- Conventional commits
- Atomic changes
- No direct to main
- All tests pass
Language Guides¶
Auto-loaded based on file extensions:
| Language | Extensions | Guide |
|---|---|---|
| TypeScript | .ts, .tsx, .js, .jsx | typescript.md |
| Python | .py | python.md |
| Go | .go | go.md |
| Rust | .rs | rust.md |
| Kotlin | .kt, .kts | kotlin.md |
No manual selection needed - AI detects and loads automatically.
Workflows¶
On-demand workflows for complex tasks:
| Workflow | When to Use |
|---|---|
| Initialize Project | New or existing project setup |
| Create PRD | Plan complex features |
| Generate Tasks | Break PRD into tasks |
| Troubleshooting | Debug systematically |
| Generate AGENTS.md | Cross-tool compatibility |
| Create Skill | Create portable Agent Skills |
| Auto | Autonomous AI coding loop |
| Algorithmic Art | Generative art with p5.js |
| Doc Co-Authoring | Collaborative document writing |
| Frontend Design | Design-driven frontend interfaces |
| MCP Builder | MCP server development guide |
| Theme Factory | Theme styling for artifacts |
| Web Artifacts Builder | React/TypeScript/shadcn toolchain |
| Web App Testing | Playwright-based web testing |
Progressive Growth¶
The system grows with your project:
Day 1: CLAUDE.md + .claude/ templates only
↓
Week 1: .claude/project.md created (tech stack)
↓
Month 1: .claude/patterns.md populated (conventions)
↓
Ongoing: .claude/memory/ captures decisions
Don't Over-Document
Let documentation emerge naturally. Don't create files preemptively.
Cross-Tool Compatibility¶
Works with any AI coding assistant:
| Tool | Primary File | Fallback |
|---|---|---|
| Claude Code | CLAUDE.md | AGENTS.md |
| Cursor | AGENTS.md | CLAUDE.md |
| OpenAI Codex | AGENTS.md | - |
| GitHub Copilot | AGENTS.md | - |
| Google Jules | AGENTS.md | - |
Setup: ln -s CLAUDE.md AGENTS.md
Next Steps¶
-
CLAUDE.md Deep Dive
Understand the main instruction file.
-
All Guardrails
Review the 35+ testable rules.