This document describes the architecture of the Claude Agentic Config system.
┌─────────────────────────────────────┐
│ User Request │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ UserPromptSubmit Hook Chain │
│ ┌─────────────────────────────┐ │
│ │ skill-auto-activator.py │ │
│ └─────────────────────────────┘ │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ Workflow Orchestrator │
│ (Routes to appropriate agents) │
└─────────────────┬───────────────────┘
│
┌──────────────────────────┼──────────────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Agent 1 │ │ Agent 2 │ │ Agent N │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└──────────────────────────┼──────────────────────────┘
│
┌─────────────────▼───────────────────┐
│ PreToolUse Hook Chain │
│ ┌─────────────────────────────┐ │
│ │ riper-phase-validator.py │ │
│ │ token-budget-guardian.py │ │
│ │ git-safety-net.py │ │
│ └─────────────────────────────┘ │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ Tool Execution │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ SubagentStop Hook Chain │
│ ┌─────────────────────────────┐ │
│ │ output-quality-gate.py │ │
│ └─────────────────────────────┘ │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ Stop Hook Chain │
│ ┌─────────────────────────────┐ │
│ │ session-archiver.py │ │
│ └─────────────────────────────┘ │
└─────────────────────────────────────┘
The system enforces phase-separated development:
| Phase | Purpose | Constraints |
|---|---|---|
| Research | Understand the problem | Read-only operations |
| Innovate | Explore solutions | Read-only + brainstorming |
| Plan | Design approach | Write only to memory-bank/ |
| Execute | Implement solution | Full tool access |
| Review | Validate work | Read + test operations |
Agents are composed using these patterns:
Sequential Delegation
Agent1 → Agent2 → Agent3 → Output
Use for staged processing (brainstorm → plan → execute → review).
Parallel Investigation
Primary → [Agent1, Agent2, Agent3] → Aggregator
Use for independent problem analysis.
Feedback Loop
Agent → Review → Pass/Fail → Refinement/Completion
Use for iterative improvement (code review → fix → re-review).
Hooks execute at specific events:
- UserPromptSubmit - Before processing user input
- PreToolUse - Before each tool invocation
- PostToolUse - After tool completion
- SubagentStop - When subagent completes
- Stop - When main agent stops
Persistent context stored in ~/.claude/memory-bank/:
memory-bank/
├── main/
│ ├── plans/ # Implementation specifications
│ ├── reviews/ # Code review reports
│ ├── sessions/ # Archived session contexts
│ └── decisions/ # Architecture Decision Records
└── [branch]/ # Branch-specific context
| Agent | Role | Tools |
|---|---|---|
workflow-orchestrator |
Routes tasks to skills | All |
| Agent | Role | Tools |
|---|---|---|
code-review-sentinel |
Code quality review | Read, Grep, Glob |
output-quality-gate |
Output validation | Read |
| Agent | Role | Tools |
|---|---|---|
context-curator |
Context compression | Read, Write, Glob |
session-archiver |
Session persistence | Write |
| Agent | Role | Tools |
|---|---|---|
dependency-auditor |
Dependency analysis | Read, Bash, WebSearch |
plugin-capability-scout |
Plugin discovery | WebSearch, Read |
| Agent | Role | Tools |
|---|---|---|
agentic-system-architect |
System design | Read, Task |
| Hook | Event | Purpose |
|---|---|---|
skill-auto-activator |
UserPromptSubmit | Suggest skills |
| Hook | Event | Purpose |
|---|---|---|
riper-phase-validator |
PreToolUse | Enforce phases |
git-safety-net |
PreToolUse | Block dangerous git ops |
token-budget-guardian |
PreToolUse | Monitor tokens |
| Hook | Event | Purpose |
|---|---|---|
output-quality-gate |
SubagentStop | Validate output |
| Hook | Event | Purpose |
|---|---|---|
session-archiver |
Stop | Archive context |
Decision: Python for all hooks
Rationale:
- Cross-platform compatibility
- Rich standard library
- Easy JSON handling
- Familiar to most developers
Decision: Sonnet for most agents, Opus for orchestration
Rationale:
- Sonnet: Fast, cost-effective for focused tasks
- Opus: Superior reasoning for complex routing
Decision: Main agent coordinates all subagents
Rationale:
- Prevents cascade complexity
- Clearer debugging
- Predictable execution flow
- Create
agents/my-agent.mdwith YAML frontmatter - Define tools, model, and instructions
- Register in workflow-orchestrator if needed
- Create
hooks/my-hook.pyfollowing the template - Add to
settings.jsonwith appropriate event - Add tests in
hooks/tests/
- Define workflow in
docs/guides/ - Create supporting agents if needed
- Update orchestrator routing