コンテンツにスキップ

Claude Codeで9エージェント・パイプラインを実行する

このガイドをオフラインで持ち帰る

AIガードレール・ラボのパイプライン — 実際のAIインシデントを取り込み、根本原因と脅威モデルを導き、ガードレールを設計し、最終レポートを作成する10の専門エージェント — を、ローカルターミナル上のClaude Code内で直接実行します。プラットフォームのインストールは不要で、各エージェントは自身の指示バンドルを読み、構造化された出力を workshop-outputs/ に書き込みます。

何が生成されるか

最終的に workshop-outputs/ ツリーには以下が含まれます。

  • data/ — 全ステージからのJSONLエビデンス:インシデント、根本原因、脅威モデル、ガードレール、開発プロセス・コントロール、ポリシー、フック、監査エビデンス、クリティック所見
  • policies/ + claude-hooks/ — コミット可能な機械可読アーティファクト
  • 01-incident-registry.md から 09-critic-review.md — エージェントごとに1つのmarkdownハンドオフ
  • final-report.md + readiness-checklist.md — オーケストレータの統合出力
  • dashboard/ — ローカルで提供できる静的ダッシュボード

合計時間:エージェント実行時間 30〜45分、加えてステージ間のオペレータ・レビューに数分。

前提条件

  • Claude Codeがインストール済みかつ認証済み — Claude Codeセットアップを参照
  • git がインストール済み — git --version で確認
  • github.com/metaweavehq/ai-guardrail-lab への読み取りアクセス
  • ディスク空き容量約500MB

1. パッケージをクローンする

クローン自体が作業ディレクトリを作成します。

Terminal window
git clone https://github.com/metaweavehq/ai-guardrail-lab.git ai-guardrail-workshop
cd ai-guardrail-workshop

2. ワークショップ・スキルをインストールする

Claude Codeはプロジェクトのスキルを .claude/skills/ から読み込みます。パッケージは skills/workshop-artifacts/ にスキルを同梱しているので、所定の位置にコピーします。

Terminal window
mkdir -p .claude/skills workshop-outputs/data
cp -R skills/workshop-artifacts .claude/skills/workshop-artifacts

作業ディレクトリは次のような構成になります。

ai-guardrail-workshop/
├─ agents/
│ ├─ incident-collector-agent/
│ │ ├─ AGENTS.md
│ │ ├─ HEARTBEAT.md
│ │ ├─ SOUL.md
│ │ └─ TOOLS.md
│ ├─ root-cause-agent/
│ ├─ threat-modeling-agent/
│ ├─ guardrail-designer-agent/
│ ├─ dev-process-integration-agent/
│ ├─ policy-as-code-agent/
│ ├─ claude-hook-agent/
│ ├─ evidence-audit-agent/
│ ├─ critic-agent/
│ └─ workshop-orchestrator-agent/
├─ .claude/skills/workshop-artifacts/
│ ├─ SKILL.md
│ ├─ references/
│ └─ templates/
└─ workshop-outputs/
└─ data/

3. Claude Codeを起動する

作業ディレクトリ内から。

Terminal window
claude

各エージェントは、以下の対応するプロンプトを貼り付けることで実行します。次のプロンプトを貼り付ける前に、各エージェントの完了を待ってください。

4. パイプラインの全体像

10のエージェントが順次実行されます。各エージェントは前のエージェントの出力を読み、自身の出力を書き込みます。

#エージェント出力
1Incident Collectordata/incidents.jsonl + 01-incident-registry.md
2Root Causedata/root-causes.jsonl + 02-root-cause-analysis.md
3Threat Modelingdata/threat-models.jsonl + 03-threat-models.md
4Guardrail Designerdata/guardrails.jsonl + 04-guardrail-design.md
5Dev Process Integrationdata/dev-process-controls.jsonl + 05-dev-process-integration.md
6Policy-as-Codedata/policy-as-code.jsonl + policies/ + 06-policy-as-code.md
7Claude Hookdata/claude-hooks.jsonl + claude-hooks/ + 07-claude-hooks.md
8Evidence and Auditdata/audit-evidence.jsonl + 08-evidence-audit.md
9Criticdata/critic-findings.jsonl + 09-critic-review.md
10Workshop Orchestratorfinal-report.md + readiness-checklist.md

5. プロンプト・テンプレート

すべてのエージェントは同じプロンプト形状を使用します。以下のエージェントごとのセクションから <AGENT-NAME><AGENT-FOLDER><TASK> を置き換えてください。

You are the <AGENT-NAME> for the AI Incident Analysis and Guardrail Design workshop.
First read and follow these instruction files:
- agents/<AGENT-FOLDER>/AGENTS.md
- agents/<AGENT-FOLDER>/HEARTBEAT.md
- agents/<AGENT-FOLDER>/SOUL.md
- agents/<AGENT-FOLDER>/TOOLS.md
Also use the workshop-artifacts skill from .claude/skills/workshop-artifacts.
Standalone terminal mode:
- Do not call LifeOSAI APIs.
- Do not check out, update, comment on, or close LifeOSAI tasks.
- Do not require LIFEOSAI_* environment variables.
- Treat HEARTBEAT.md as workflow and output guidance only; skip LifeOSAI runtime steps.
- Write files directly under workshop-outputs/.
Task:
<TASK>

以下の各エージェントには Agent nameFolderTask が示されています — これらをテンプレートに入れ、Claude Codeに貼り付け、完了を待ちます。

6. Agent 1 · Incident Collector

Folderincident-collector-agent Task — Create the initial incident evidence registry for the workshop. Collect 5 verified GenAI, LLM, coding-agent, or agentic-AI incidents from the last 6 months. Use discovery agents first, then independent verifier agents. Write the required JSONL, markdown, research, and dashboard artifacts under workshop-outputs/. Before writing final incidents, reject weak, duplicated, generic, or out-of-window candidates.

期待される出力。

  • workshop-outputs/data/incidents.jsonl
  • workshop-outputs/research/incident-candidates.jsonl
  • workshop-outputs/research/incident-verification.jsonl
  • workshop-outputs/01-incident-registry.md
  • workshop-outputs/dashboard/

7. Agent 2 · Root Cause

Folderroot-cause-agent Task — Analyze the collected incident corpus and produce the root-cause analysis handoff. Use workshop-outputs/data/incidents.jsonl and workshop-outputs/01-incident-registry.md as the input. Separate observed facts, technical causes, process causes, organizational causes, uncertainty, and evidence gaps.

期待される出力。

  • workshop-outputs/data/root-causes.jsonl
  • workshop-outputs/02-root-cause-analysis.md

8. Agent 3 · Threat Modeling

Folderthreat-modeling-agent Task — Review the incident and root-cause artifacts, cluster them into recurring threat groups, map those groups to MITRE ATLAS where supported, and produce the threat-modeling handoff. Prefer reusable threat groups over per-incident models unless the agent instructions require otherwise.

期待される出力。

  • workshop-outputs/data/threat-models.jsonl
  • workshop-outputs/03-threat-models.md

9. Agent 4 · Guardrail Designer

Folderguardrail-designer-agent Task — Review the incident, root-cause, and threat-model artifacts and design concrete guardrails. Cover preventive controls, detection controls, blocking controls, audit controls, approval gates, enforcement points, required evidence, residual risks, and implementation handoff notes.

期待される出力。

  • workshop-outputs/data/guardrails.jsonl
  • workshop-outputs/04-guardrail-design.md

10. Agent 5 · Dev Process Integration

Folderdev-process-integration-agent Task — Review the guardrail design artifacts and map them into PDLC, SDLC, Claude Code, and Claude Agent SDK process controls. Include product risk checkpoints, design reviews, implementation gates, code review / test / CI / release controls, SDK options, permission modes, allowed and disallowed tools, hooks, approval routing, audit checkpoints, session handling, and subagent controls.

期待される出力。

  • workshop-outputs/data/dev-process-controls.jsonl
  • workshop-outputs/05-dev-process-integration.md

11. Agent 6 · Policy-as-Code

Folderpolicy-as-code-agent Task — Review the PDLC, SDLC, and Claude Agent SDK process controls and convert them into machine-readable policy-as-code artifacts. Produce policy files for agent guardrail profiles, tool permissions, protected paths, approval routing, audit events, and any other policy families required by the instruction files.

期待される出力。

  • workshop-outputs/data/policy-as-code.jsonl
  • workshop-outputs/06-policy-as-code.md
  • workshop-outputs/policies/

12. Agent 7 · Claude Hook

Folderclaude-hook-agent Task — Review the policy-as-code artifacts and produce Claude Agent SDK hook prototypes for the workshop. Cover user-prompt classification, pre-tool-use blocking and approvals, post-tool-use audit validation, permission-request routing, subagent lifecycle controls, session-end audit closure, and hook configuration examples.

期待される出力。

  • workshop-outputs/data/claude-hooks.jsonl
  • workshop-outputs/07-claude-hooks.md
  • workshop-outputs/claude-hooks/

13. Agent 8 · Evidence and Audit

Folderevidence-audit-agent Task — Review the Claude hook prototypes and all prior workshop artifacts. Build the evidence and audit handoff, including traceability, decision rationale, references, check results, approval history, retention notes, redaction notes, and audit gaps.

期待される出力。

  • workshop-outputs/data/audit-evidence.jsonl
  • workshop-outputs/08-evidence-audit.md

14. Agent 9 · Critic

Foldercritic-agent Task — Review the complete workshop prototype. Find evidence gaps, weak assumptions, missing threat coverage, incomplete guardrails, unenforceable policies, hook implementation gaps, audit traceability gaps, dashboard issues, and final report risks. Produce the final critique, gap register, remediation plan, and readiness checklist.

期待される出力。

  • workshop-outputs/data/critic-findings.jsonl
  • workshop-outputs/09-critic-review.md

15. Agent 10 · Workshop Orchestrator

Folderworkshop-orchestrator-agent Task — Coordinate the full workshop pipeline. Inspect all specialist outputs, verify artifact handoffs, check dashboard readiness, route any rework to the right stage, and prepare the final workshop report and demo readiness material.

期待される出力。

  • workshop-outputs/final-report.md
  • workshop-outputs/readiness-checklist.md

16. 実行結果を確認する

生成されたすべてのファイルを一覧表示。

Terminal window
find workshop-outputs -maxdepth 3 -type f | sort

JSONLの行数を確認(インシデント、脅威グループ、ガードレールなど1行ずつ)。

Terminal window
wc -l workshop-outputs/data/*.jsonl

ダッシュボードをローカルで提供。

8080/workshop-outputs/dashboard/
python3 -m http.server 8080

17. トラブルシューティング

workshop-artifacts スキルが見つからない。 .claude/skills/workshop-artifacts/SKILL.md に存在することを確認し、SKILL.md と並んで references/templates/ フォルダが含まれていることを確認してください。

エージェントが指示ファイルを見つけられない。 agents/ フォルダが作業ディレクトリの直下にあること、各エージェントフォルダに AGENTS.mdHEARTBEAT.mdSOUL.mdTOOLS.md の4ファイルがすべて含まれていることを確認してください。

下流のエージェントが実行できない。 先に前のエージェントを実行してください。期待されるJSONL入力が workshop-outputs/data/ 配下に存在することを確認してください。

ダッシュボードがすでに存在する。 それを利用してください — 置き換えないでください。後続のエージェントは workshop-artifacts の契約が要求する場合のみ、共有ダッシュボードを更新します。

次に読む

次: Day 2 · オーケストレーション + 9エージェント →