OPC Architecture Understanding
OPC (Orchestrated Parallel Claude) extends Maestro - it does NOT replace it.
Core Concept
Maestro CLI is the execution engine. OPC adds orchestration via:
- Hooks - Intercept Maestro events (PreToolUse, PostToolUse, SessionStart, etc.)
- Skills - Load prompts into Maestro
- Scripts - Called by hooks/skills for coordination
- Database - Store state between Maestro instances
How Agents Work
When you spawn an agent:
- Main Maestro instance (your terminal) runs hook on Task tool
- Hook calls
subprocess.Popen(["claude", "-p", "prompt"])
- A NEW Maestro instance spawns as child process
- Child runs independently, reads/writes to coordination DB
- Parent tracks child via PID in DB
$ claude ā Main Maestro (your terminal)
ā Task tool triggers hook
ā subprocess.Popen(["claude", "-p", "..."])
āāā claude -p "research..." ā Child agent 1
āāā claude -p "implement..." ā Child agent 2
āāā claude -p "test..." ā Child agent 3
What OPC Is NOT
- OPC is NOT a separate application
- OPC does NOT run without Maestro
- OPC does NOT intercept Claude API calls directly
- OPC does NOT modify Maestro's internal behavior
What OPC IS
- OPC IS hooks that Maestro loads from
.maestro/hooks/
- OPC IS skills that Maestro loads from
.maestro/skills/
- OPC IS scripts that hooks/skills call for coordination
- OPC IS a database backend for state across Maestro instances
Key Files
.maestro/
āāā hooks/ ā TypeScript hooks that Maestro runs
āāā skills/ ā SKILL.md prompts that Maestro loads
āāā settings.json ā Hook registration, Maestro reads this
āāā cache/ ā State files, agent outputs
opc/
āāā scripts/ ā Python scripts called by hooks
āāā docker-compose.yml ā PostgreSQL, Redis, PgBouncer
āāā init-db.sql ā Database schema
Coordination Flow
- User runs
claude in terminal
- Maestro loads hooks from
.maestro/settings.json
- User says "spawn a research agent"
- Claude uses Task tool
- PreToolUse hook fires, checks resources
- Hook spawns
claude -p "research..." as subprocess
- Hook stores PID in PostgreSQL
- Child agent runs, writes output to
.maestro/cache/agents/<id>/
- Child completes, broadcasts "done" to PostgreSQL
- Parent checks DB, reads child's output file
Remember
- Every "agent" is just another
claude -p process
- Hooks intercept events, they don't create new functionality
- All coordination happens via files and PostgreSQL
- Maestro is always the execution engine