Chapter 3·25 min

Building Your First Agents

Create specialist AI agents that handle specific domains of your business.

Last updated: March 2026

What Are Agents?

My first week using Claude Code, I typed the same debugging instructions 23 times. The second week, I created a code-debugger agent and never typed them again. Agents are specialist AI personas defined as markdown files — each one carries its own expertise, tools, and constraints so you define the instructions once and reuse them forever.

Instead of one generalist AI doing everything, you build a roster of specialists — a researcher, a debugger, a content writer, a file manager. Each one is optimized for its domain and can be spawned on demand.

In the Genesis Framework, this is called The Hive Mind. The main AI (the Architect) routes tasks to specialist agents. The Architect never does the work — it delegates.
Agent Topology — Star ArchitectureOrchestrator(routes tasks)chief-of-staffweb-developergemini-researchercode-debuggergac-content-architectdevops-engineerstudent-crm-managerfile-executor36 specialist agents — 8 shown — all routed through single orchestrator
Fig 3 — Star topology agent architecture

Agent File Structure

Agent definitions live in your Claude Code settings or can be defined inline when spawning. Here is the structure of an agent definition.

Agent Definition Templatemarkdown
# Agent: [agent-name]

## Description
One-line description of what this agent does.

## Allowed Tools
- Read, Glob, Grep (read-only)
- Edit, Write (file operations)
- Bash (system commands)

## System Prompt
You are the [agent-name] for My Business's business.

Your job is to [specific responsibility].

### Rules
1. Always read existing files before creating new ones
2. [Domain-specific rule]
3. [Quality standard]

### Workflow
1. [Step 1]
2. [Step 2]
3. [Step 3]

Five Universal Agents Everyone Needs

Before building agents, make sure your CLAUDE.md foundation is solid (Chapter 1: CLAUDE.md Foundation) and your Life Repository is set up (Chapter 2: The Life Repository). Agents read from both — CLAUDE.md for identity, the Life Repository for context. Without these, agents operate blind.

Regardless of whether you run a business or any other business, these five agents form the foundation of any Genesis system. Start with these before adding domain specialists.

1. Chief of Staff

Your daily operations manager. Runs morning check-ins, evening summaries, and keeps priorities on track.

chief-of-staffmarkdown
You are the Chief of Staff for My Business.

Your job is to run daily operations:
- Morning: Read STATUS.md, show priorities, flag deadlines
- Evening: Summarize the day, update STATUS.md, write daily summary
- Anytime: Answer "what should I work on next?" with specific tasks

Rules:
1. Be specific — "Write the product description for X" not "work on content"
2. Reference STATUS.md for current priorities
3. Flag overdue items immediately
4. Keep summaries under 20 lines

2. Researcher

Handles all information gathering — market research, competitor analysis, technology evaluation. Uses web search and deep reading capabilities.

researchermarkdown
You are the Research Specialist for My Business.

Your job is to find, analyze, and summarize information:
- Market research for business industry
- Competitor analysis
- Technology and tool evaluation
- Data gathering for decision-making

Rules:
1. Use 3-5 targeted queries, not one broad search
2. Always cite sources
3. Present findings as actionable bullet points
4. Flag confidence level: High / Medium / Low
5. Acknowledge gaps — never present incomplete info as complete

3. File Executor

The only agent that writes to disk. All file operations go through this agent, creating a clean audit trail.

file-executormarkdown
You are the File Executor for My Business.

Your job is to create, edit, and manage files:
- Create new files from specifications
- Edit existing files with precision
- Organize directory structures
- Maintain file naming conventions

Rules:
1. Always read the target file before editing
2. Use absolute paths, never relative
3. Create a lockfile at start, remove when done
4. Never modify files outside the designated directories

4. Code Debugger

Investigates and fixes bugs. Follows a strict observe-before-edit methodology.

code-debuggermarkdown
You are the Code Debugger for My Business.

Your job is to find and fix bugs:
- Read error messages and stack traces
- Reproduce issues before attempting fixes
- Isolate the root cause
- Apply minimal, targeted fixes

Rules:
1. OBSERVE the actual error output before editing code
2. Make ONE change at a time — isolate variables
3. Verify the fix with a test or build
4. Document what caused the bug and why the fix works

5. Task Planner

Breaks down large goals into actionable implementation plans with clear phases and acceptance criteria.

task-plannermarkdown
You are the Task Planner for My Business.

Your job is to break down goals into plans:
- Convert vague goals into specific, ordered tasks
- Estimate complexity (not time)
- Identify dependencies between tasks
- Define clear acceptance criteria

Rules:
1. Read the codebase/context before planning
2. Use absolute file paths
3. Every task must have testable acceptance criteria
4. Include a rollback strategy for risky changes
5. Match plan depth to task complexity — simple task = simple plan

Business-Specific Agents for Your business

Beyond the five universals, here are agents tailored for a business. These handle the domain-specific work that makes your AI system truly useful.

Recommended agents for {business_type}text
Suggested specialist agents for your business:

chief-of-staff, researcher, file-manager, task-tracker, analytics-tracker, copywriter

Each of these agents follows the same template structure shown above.
Customize the system prompt with your specific workflows, tools (your current tools),
and quality standards.

Start with 2-3 agents. Add more only when you hit a task the existing
agents cannot handle. Over-engineering early is a common mistake.

Agent Constraints — The DON'Ts

Every agent needs 3-5 explicit constraints. Without constraints, agents drift — they over-engineer, skip steps, or operate outside their domain. Constraints are as important as capabilities.

Here is the pattern: for each agent, define what it must NEVER do. These are not suggestions — they are hard boundaries that enforcement hooks can check.

Example: Agent Constraintsmarkdown
## web-developer constraints
1. DON'T write code without reading existing patterns first
2. DON'T use 'any' types — explicit TypeScript always
3. DON'T skip build verification after changes
4. DON'T start dev servers during implementation — kills battery
5. DON'T create components longer than 150 lines — split automatically

## researcher constraints
1. DON'T rely on a single broad query — use 3-5 targeted queries
2. DON'T present incomplete info as complete — acknowledge gaps
3. DON'T leave orphaned lockfiles — always clean up

## {your_role} constraints
1. DON'T [most common mistake for this agent]
2. DON'T [second most common mistake]
3. DON'T [safety boundary]
The best constraints come from real failures. Every time an agent does something wrong, add a constraint. Your constraint list is your institutional memory of mistakes.

Agent constraints are formalized as rule files in Chapter 4: The Rules System. The enforcement hooks from Chapter 6: The Enforcement System can then verify these constraints mechanically, turning written DON'Ts into actual blocked actions.

Context Injection — Making Agents Smart

Agents are stateless — every spawn starts fresh. Without context injection, agents ask obvious questions: 'What is your tech stack?' 'What are your priorities?' Context injection solves this by feeding relevant information when spawning agents.

Before spawning ANY agent, inject runtime context from your Life Repository. This turns a blind agent into one that already knows your business.

Context Injection Templatetext
When spawning an agent, include:

SITUATIONAL AWARENESS:
- Date: [today's date]
- Top Priority: [from STATUS.md]
- Active Project: [which project this relates to]
- Recent Context: [yesterday's handoff summary if relevant]

TASK: [the actual task]

For iterative/autonomous tasks, also add:
- Success Metric: [single measurable criterion]
- Max Iterations: [number, default 10]
- Files agent CAN modify: [list]
- Files agent CANNOT touch: [list]
Agents with context don't ask questions — they ACT. Context injection is the difference between a 5-minute task and a 20-minute conversation.

Auto-Chain Sequences

Some agents should automatically trigger other agents when they finish. This is called auto-chaining. Instead of manually remembering to run documentation after implementation, the system does it for you.

Define chain sequences in your routing table. When Agent A completes, Agent B fires automatically.

Common Auto-Chain Patternstext
# System Change Chain (MANDATORY)
File modified in rules/ or protocols/
  -> enforcement-architect (build hooks to enforce it)
  -> cartographer (document what was built)

# Implementation Chain
Planner creates blueprint
  -> Developer implements code
  -> QA verifies the implementation
  -> Simplicity reviewer checks for over-engineering

# Discovery Chain
Debugger finds a non-obvious fix
  -> Fix logger documents the solution
  -> Knowledge extractor evaluates if it's reusable
  -> If yes -> Creates skill file for future reference

# Content Chain
Researcher gathers intelligence
  -> Content architect structures the video
  -> Copywriter writes hooks and CTAs
Auto-chains prevent the most common system failure: doing the work but forgetting to document it, enforce it, or verify it.

Backup Routing — When Agents Fail

No agent is perfect. Define backup agents for each primary agent so the system degrades gracefully instead of stopping.

Backup Routing Tabletext
| Primary Agent     | Backup Agent              | QA Agent   |
|-------------------|---------------------------|------------|
| web-developer     | code-debugger (for bugs)  | qa-gate    |
| code-debugger     | web-developer (if code change needed) | qa-gate |
| devops-engineer   | code-debugger (config bugs) | security |
| content-architect | copywriter (copy issues)  | —          |
| researcher        | deep-reader (large sources) | —        |

Rule: If primary AND backup both fail -> STOP ->
report to human with what was tried and why each failed.
Never let the system silently fail. If two agents cannot handle it, escalate to the human with a clear summary of what was attempted.

Frequently Asked Questions

Related Chapters