Opc Architecture

parcadei/continuous-claude-v3/.claude/skills/opc-architecture

作者 parcadeid07ff4b06b62无许可证3.9K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库8个月前更新

OPC Architecture Understanding

仅含说明AI & Agents
AI 生成的概览

说明 OPC(Orchestrated Parallel Claude)架构,即通过钩子、技能、脚本和数据库扩展 Claude Code。

功能
该技能提供参考文档,说明 OPC 如何扩展而非取代 Claude Code。它指出 Claude Code CLI 是执行引擎,OPC 通过钩子、技能、脚本和数据库增加编排能力。文档介绍了代理如何作为子进程 claude -p 运行、关键文件与目录结构,以及从钩子触发到输出存储的协调流程。
适用场景
当你需要了解 OPC 与 Claude Code 的关系、代理如何被创建和跟踪,或钩子、技能、脚本与数据库如何协调状态时使用。它适合在接触 OPC 的钩子或协调层之前用于熟悉其代码库。
运行要求
无需脚本或运行时依赖,仅为说明性参考文档。理解所述系统需对文中提到的 Claude Code、钩子、PostgreSQL、Redis 和 Docker 有所了解。

OPC Architecture Understanding

OPC (Orchestrated Parallel Claude) extends Claude Code - it does NOT replace it.

Core Concept

Claude Code CLI is the execution engine. OPC adds orchestration via:

  • Hooks - Intercept Claude Code events (PreToolUse, PostToolUse, SessionStart, etc.)
  • Skills - Load prompts into Claude Code
  • Scripts - Called by hooks/skills for coordination
  • Database - Store state between Claude Code instances

How Agents Work

When you spawn an agent:

  1. Main Claude Code instance (your terminal) runs hook on Task tool
  2. Hook calls subprocess.Popen(["claude", "-p", "prompt"])
  3. A NEW Claude Code instance spawns as child process
  4. Child runs independently, reads/writes to coordination DB
  5. Parent tracks child via PID in DB
$ claude                         ← Main Claude Code (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 Claude Code
  • OPC does NOT intercept Claude API calls directly
  • OPC does NOT modify Claude Code's internal behavior

What OPC IS

  • OPC IS hooks that Claude Code loads from .claude/hooks/
  • OPC IS skills that Claude Code loads from .claude/skills/
  • OPC IS scripts that hooks/skills call for coordination
  • OPC IS a database backend for state across Claude Code instances

Key Files

.claude/├── hooks/           ← TypeScript hooks that Claude Code runs├── skills/          ← SKILL.md prompts that Claude Code loads├── settings.json    ← Hook registration, Claude Code 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

  1. User runs claude in terminal
  2. Claude Code loads hooks from .claude/settings.json
  3. User says "spawn a research agent"
  4. Claude uses Task tool
  5. PreToolUse hook fires, checks resources
  6. Hook spawns claude -p "research..." as subprocess
  7. Hook stores PID in PostgreSQL
  8. Child agent runs, writes output to .claude/cache/agents/<id>/
  9. Child completes, broadcasts "done" to PostgreSQL
  10. 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
  • Claude Code is always the execution engine

来源与署名

来源:parcadei/continuous-claude-v3位于.claude/skills/opc-architecture提交d07ff4b

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架