autonomous-opus-loop
Opus 4.5を活用し、人が介入しなくても長時間の作業や複雑な開発を自律的に継続できるため、まるで優秀なアシスタントのように、ビジネスの様々な場面で効率的な自動化を実現するSkill。
📜 元の英語説明(参考)
Autonomous Claude Code operation using Opus 4.5 for intelligent continuation decisions. Use when running long tasks, multi-step implementations, overnight development, or any workflow requiring continuous autonomous operation without human intervention.
🇯🇵 日本人クリエイター向け解説
Opus 4.5を活用し、人が介入しなくても長時間の作業や複雑な開発を自律的に継続できるため、まるで優秀なアシスタントのように、ビジネスの様々な場面で効率的な自動化を実現するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o autonomous-opus-loop.zip https://jpskill.com/download/9369.zip && unzip -o autonomous-opus-loop.zip && rm autonomous-opus-loop.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9369.zip -OutFile "$d\autonomous-opus-loop.zip"; Expand-Archive "$d\autonomous-opus-loop.zip" -DestinationPath $d -Force; ri "$d\autonomous-opus-loop.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
autonomous-opus-loop.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
autonomous-opus-loopフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Autonomous Opus Loop
外部の Opus 4.5 インスタンスを使用して進捗状況を分析し、継続を決定することで、Claude Code をインタラクティブから完全に自律的に変換します。
概要
このスキルにより、Claude Code は別の Claude インスタンス (Opus 4.5) を使用して自律的に実行できます。
- 各応答後の作業の進捗状況を分析します
- 続行するか停止するかを決定します
- 具体的な次のステップの指示を提供します
- 目標が達成されるまで勢いを維持します
主なイノベーション: Stop hook の reason フィールドが Claude の次の指示となり、2 つの Claude インスタンスが連携する完全に自律的なループが作成されます。
アーキテクチャ
┌─────────────────────────────────────┐
│ Claude Code (Executor) │
│ - タスクを実行します │
│ - コードを記述し、テストを実行します │
│ - 完了時に Stop hook をトリガーします │
└─────────────────┬───────────────────┘
│
▼ (Stop hook が発動)
┌─────────────────────────────┐
│ autonomous-loop.sh │
│ - トランスクリプトを読み取ります │
│ - 安全制限を確認します │
│ - Opus analyzer を呼び出します │
└──────────┬──────────────────┘
│
▼
┌───────────────────────────────────┐
│ Claude Opus 4.5 (Analyzer) │
│ - 完了したすべての作業を確認します │
│ - 目標と照らし合わせて確認します │
│ - CONTINUE または COMPLETE を決定します │
│ - CONTINUE の場合: 具体的な次のタスク│
└──────────┬────────────────────────┘
│
▼
┌─────────────────────────────┐
│ Loop Controller │
│ - イテレーションを追跡します │
│ - コストを監視します │
│ - ドゥームループを防ぎます │
│ - CC に決定を返します │
└──────────┬──────────────────┘
│
▼
Claude Code は "reason" を次の指示として受け取ります
(COMPLETE になるまでループが繰り返されます)
クイックスタート
1. Hook のインストール
# インストールスクリプトを実行します
.claude/skills/autonomous-opus-loop/scripts/install.sh
または、.claude/settings.json に手動で追加します。
{
"hooks": {
"Stop": [{
"matcher": {},
"hooks": [{
"type": "command",
"command": ".claude/skills/autonomous-opus-loop/scripts/autonomous-loop.sh"
}],
"timeout": 120
}]
}
}
2. 目標の構成
.claude/autonomous-config.json を作成します。
{
"enabled": true,
"objective": "JWT トークンを使用したユーザー認証を実装する",
"success_criteria": [
"すべてのテストに合格する",
"コードカバレッジ > 80%",
"セキュリティ脆弱性がないこと"
],
"max_iterations": 30,
"max_cost_usd": 15.00,
"analyzer_model": "claude-sonnet-4-20250514",
"verbose": true
}
3. Claude Code の起動
# 初期タスクから開始します
claude -p ".claude/autonomous-config.json の目標に従って、ユーザー認証の実装を開始します"
Claude Code は、以下になるまで自律的に実行されます。
- すべての成功基準が満たされた
- 最大イテレーションに達した
- コスト制限を超えた
- 手動で中断した場合 (Ctrl+C)
構成リファレンス
必須設定
| 設定 | タイプ | 説明 |
|---|---|---|
enabled |
boolean | 自律モードの有効/無効 |
objective |
string | 達成すべき高レベルの目標 |
success_criteria |
string[] | 「完了」を定義する条件 |
安全制限
| 設定 | タイプ | デフォルト | 説明 |
|---|---|---|---|
max_iterations |
number | 50 | 最大ループイテレーション数 |
max_cost_usd |
number | 20.00 | 最大推定コスト |
max_consecutive_failures |
number | 3 | エスカレーション前の失敗回数 |
max_runtime_minutes |
number | 480 | 最大実行時間 8 時間 |
Analyzer の設定
| 設定 | タイプ | デフォルト | 説明 |
|---|---|---|---|
analyzer_model |
string | claude-sonnet-4-20250514 | 分析に使用するモデル |
analyzer_max_tokens |
number | 1024 | 分析の最大トークン数 |
include_full_transcript |
boolean | false | 全体または最近のコンテキストを送信 |
recent_messages_count |
number | 10 | 全体でない場合に含めるメッセージ数 |
動作設定
| 設定 | タイプ | デフォルト | 説明 |
|---|---|---|---|
verbose |
boolean | false | 詳細な進捗状況をログに記録 |
notify_on_complete |
boolean | true | 完了時のシステム通知 |
save_session_log |
boolean | true | イテレーション履歴を保存 |
escalation_mode |
string | "pause" | エスカレーション時のアクション: pause/notify/abort |
操作
1. 自律モードの有効化
# デフォルト構成で有効化
.claude/skills/autonomous-opus-loop/scripts/enable.sh
# 特定の目標で有効化
.claude/skills/autonomous-opus-loop/scripts/enable.sh \
--objective "支払いモジュールをリファクタリングする" \
--max-iterations 20
2. 自律モードの無効化
.claude/skills/autonomous-opus-loop/scripts/disable.sh
3. ステータスの確認
.claude/skills/autonomous-opus-loop/scripts/status.sh
出力:
Autonomous Loop Status
======================
Enabled: true
Objective: JWT トークンを使用したユーザー認証を実装する
Iterations: 12/30
Estimated Cost: $4.23/$15.00
Runtime: 45m/480m
Last Action: ログインエンドポイントを実装しました
Next Action: パスワードリセット機能を追加する
Status: RUNNING
4. セッションログの表示
.claude/skills/autonomous-opus-loop/scripts/view-log.sh
5. 緊急停止
.claude/skills/autonomous-opus-loop/scripts/emergency-stop.sh
安全機能
1. ドゥームループの防止
この hook は stop_hook_active フラグをチェックして、無限再帰を防ぎます。
if [ "$STOP_ACTIVE" == "true" ]; then
# すでに stop hook 内 - 終了を許可
exit 0
fi
2. イテレーション制限
イテレーションのハードキャップにより、暴走を防ぎます。
if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then
log "最大イテレーション数 ($MAX_ITERATIONS) に達しました"
exit 0 # 停止を許可
fi 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Autonomous Opus Loop
Transform Claude Code from interactive to fully autonomous using an external Opus 4.5 instance to analyze progress and decide continuation.
Overview
This skill enables Claude Code to run autonomously by using another Claude instance (Opus 4.5) to:
- Analyze work progress after each response
- Decide whether to continue or stop
- Provide specific next-step instructions
- Maintain momentum until objectives are achieved
Key Innovation: The Stop hook's reason field becomes Claude's next instruction, creating a fully autonomous loop where two Claude instances collaborate.
Architecture
┌─────────────────────────────────────┐
│ Claude Code (Executor) │
│ - Executes tasks │
│ - Writes code, runs tests │
│ - Triggers Stop hook when done │
└─────────────────┬───────────────────┘
│
▼ (Stop hook fires)
┌─────────────────────────────┐
│ autonomous-loop.sh │
│ - Reads transcript │
│ - Checks safety limits │
│ - Calls Opus analyzer │
└──────────┬──────────────────┘
│
▼
┌───────────────────────────────────┐
│ Claude Opus 4.5 (Analyzer) │
│ - Reviews all work done │
│ - Checks against objectives │
│ - Decides: CONTINUE or COMPLETE │
│ - If CONTINUE: specific next task│
└──────────┬────────────────────────┘
│
▼
┌─────────────────────────────┐
│ Loop Controller │
│ - Tracks iterations │
│ - Monitors cost │
│ - Prevents doom loops │
│ - Returns decision to CC │
└──────────┬──────────────────┘
│
▼
Claude Code receives "reason" as next instruction
(loop repeats until COMPLETE)
Quick Start
1. Install the Hook
# Run the installation script
.claude/skills/autonomous-opus-loop/scripts/install.sh
Or manually add to .claude/settings.json:
{
"hooks": {
"Stop": [{
"matcher": {},
"hooks": [{
"type": "command",
"command": ".claude/skills/autonomous-opus-loop/scripts/autonomous-loop.sh"
}],
"timeout": 120
}]
}
}
2. Configure Your Objective
Create .claude/autonomous-config.json:
{
"enabled": true,
"objective": "Implement user authentication with JWT tokens",
"success_criteria": [
"All tests pass",
"Code coverage > 80%",
"No security vulnerabilities"
],
"max_iterations": 30,
"max_cost_usd": 15.00,
"analyzer_model": "claude-sonnet-4-20250514",
"verbose": true
}
3. Start Claude Code
# Start with initial task
claude -p "Begin implementing user authentication per the objective in .claude/autonomous-config.json"
Claude Code will now run autonomously until:
- All success criteria are met
- Max iterations reached
- Cost limit exceeded
- You manually interrupt (Ctrl+C)
Configuration Reference
Required Settings
| Setting | Type | Description |
|---|---|---|
enabled |
boolean | Enable/disable autonomous mode |
objective |
string | High-level goal to achieve |
success_criteria |
string[] | Conditions that define "done" |
Safety Limits
| Setting | Type | Default | Description |
|---|---|---|---|
max_iterations |
number | 50 | Maximum loop iterations |
max_cost_usd |
number | 20.00 | Maximum estimated cost |
max_consecutive_failures |
number | 3 | Failures before escalation |
max_runtime_minutes |
number | 480 | 8-hour maximum runtime |
Analyzer Settings
| Setting | Type | Default | Description |
|---|---|---|---|
analyzer_model |
string | claude-sonnet-4-20250514 | Model for analysis |
analyzer_max_tokens |
number | 1024 | Max tokens for analysis |
include_full_transcript |
boolean | false | Send full vs. recent context |
recent_messages_count |
number | 10 | Messages to include if not full |
Behavior Settings
| Setting | Type | Default | Description |
|---|---|---|---|
verbose |
boolean | false | Log detailed progress |
notify_on_complete |
boolean | true | System notification on completion |
save_session_log |
boolean | true | Save iteration history |
escalation_mode |
string | "pause" | Action on escalation: pause/notify/abort |
Operations
1. Enable Autonomous Mode
# Enable with default config
.claude/skills/autonomous-opus-loop/scripts/enable.sh
# Enable with specific objective
.claude/skills/autonomous-opus-loop/scripts/enable.sh \
--objective "Refactor the payment module" \
--max-iterations 20
2. Disable Autonomous Mode
.claude/skills/autonomous-opus-loop/scripts/disable.sh
3. Check Status
.claude/skills/autonomous-opus-loop/scripts/status.sh
Output:
Autonomous Loop Status
======================
Enabled: true
Objective: Implement user authentication with JWT tokens
Iterations: 12/30
Estimated Cost: $4.23/$15.00
Runtime: 45m/480m
Last Action: Implemented login endpoint
Next Action: Add password reset functionality
Status: RUNNING
4. View Session Log
.claude/skills/autonomous-opus-loop/scripts/view-log.sh
5. Emergency Stop
.claude/skills/autonomous-opus-loop/scripts/emergency-stop.sh
Safety Features
1. Doom Loop Prevention
The hook checks stop_hook_active flag to prevent infinite recursion:
if [ "$STOP_ACTIVE" == "true" ]; then
# Already in a stop hook - allow termination
exit 0
fi
2. Iteration Limits
Hard cap on iterations prevents runaway execution:
if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then
log "Max iterations ($MAX_ITERATIONS) reached"
exit 0 # Allow stop
fi
3. Cost Tracking
Estimated cost monitoring based on token usage:
if (( $(echo "$TOTAL_COST > $MAX_COST" | bc -l) )); then
log "Cost limit ($MAX_COST USD) exceeded"
exit 0 # Allow stop
fi
4. Failure Detection
Consecutive failure tracking triggers escalation:
if [ "$CONSECUTIVE_FAILURES" -ge "$MAX_FAILURES" ]; then
escalate "Doom loop detected: $CONSECUTIVE_FAILURES consecutive failures"
fi
5. Circular Work Detection
Semantic analysis detects repeated work patterns:
# Analyzer prompt includes:
"Detect if the same work is being repeated. If circular pattern detected, respond with ESCALATE."
Analyzer Prompts
Default Analyzer System Prompt
You are an autonomous development coordinator analyzing Claude Code progress.
OBJECTIVE: {objective}
SUCCESS CRITERIA:
{success_criteria}
Your task:
1. Analyze the recent work done
2. Check progress against success criteria
3. Decide: CONTINUE, COMPLETE, or ESCALATE
Response format:
- If more work needed: "CONTINUE: [specific next task with clear instructions]"
- If all criteria met: "COMPLETE: [summary of what was achieved]"
- If stuck/looping: "ESCALATE: [description of the problem]"
Be specific in CONTINUE responses. Give actionable next steps.
Do not repeat tasks that have already been completed.
Track what's done vs. what remains.
Custom Analyzer Prompts
Create custom prompts in .claude/autonomous-prompts/:
.claude/autonomous-prompts/
├── refactoring.txt # For refactoring tasks
├── feature-build.txt # For new features
├── bug-fix.txt # For bug fixing
└── testing.txt # For test writing
Reference in config:
{
"analyzer_prompt_file": ".claude/autonomous-prompts/feature-build.txt"
}
Integration with Other Skills
With hooks-manager
The autonomous loop works alongside other hooks:
{
"hooks": {
"Stop": [{
"hooks": [{
"type": "command",
"command": ".claude/skills/autonomous-opus-loop/scripts/autonomous-loop.sh"
}]
}],
"PostToolUse": [{
"tools": ["Write", "Edit"],
"hooks": [{
"type": "command",
"command": "npx prettier --write \"$FILE\""
}]
}]
}
}
With agent-memory-system
Enable persistent learning across autonomous sessions:
{
"integrations": {
"agent_memory": true,
"save_episodes": true,
"learn_patterns": true
}
}
With momentum-keeper
Combine for enhanced progress tracking:
{
"integrations": {
"momentum_keeper": true,
"stall_detection": true,
"energy_management": false
}
}
With observability stack
Send metrics to your observability stack:
{
"observability": {
"enabled": true,
"endpoint": "http://localhost:4317",
"metrics": ["iterations", "cost", "duration", "success_rate"]
}
}
Example Configurations
Overnight Feature Development
{
"enabled": true,
"objective": "Build complete user dashboard with charts, filters, and export",
"success_criteria": [
"Dashboard component renders without errors",
"All 5 chart types implemented",
"Filter functionality works",
"Export to CSV and PDF works",
"Unit tests pass with >80% coverage",
"E2E tests pass"
],
"max_iterations": 100,
"max_cost_usd": 50.00,
"max_runtime_minutes": 480,
"analyzer_model": "claude-sonnet-4-20250514",
"notify_on_complete": true,
"escalation_mode": "notify"
}
Quick Refactoring Task
{
"enabled": true,
"objective": "Refactor utils/ to use TypeScript strict mode",
"success_criteria": [
"All files converted to .ts",
"No 'any' types remain",
"TypeScript compiles without errors",
"All existing tests pass"
],
"max_iterations": 20,
"max_cost_usd": 10.00,
"analyzer_model": "claude-sonnet-4-20250514"
}
Bug Hunting Session
{
"enabled": true,
"objective": "Find and fix the memory leak in the WebSocket handler",
"success_criteria": [
"Memory leak identified",
"Root cause documented",
"Fix implemented",
"Memory usage stable over 1000 connections",
"No regression in existing tests"
],
"max_iterations": 30,
"max_cost_usd": 15.00,
"analyzer_prompt_file": ".claude/autonomous-prompts/bug-fix.txt"
}
Troubleshooting
Hook Not Firing
-
Check hook is installed:
cat .claude/settings.json | jq '.hooks.Stop' -
Verify script is executable:
chmod +x .claude/skills/autonomous-opus-loop/scripts/*.sh -
Check for syntax errors:
bash -n .claude/skills/autonomous-opus-loop/scripts/autonomous-loop.sh
Immediate Stop (Not Continuing)
- Check
enabledis true in config - Verify API key is set:
echo $ANTHROPIC_API_KEY - Check iteration/cost limits aren't exceeded
- Review logs:
.claude/autonomous-log.jsonl
Infinite Loop / Runaway
- Emergency stop:
Ctrl+Cor runemergency-stop.sh - Check
stop_hook_activehandling in script - Verify max_iterations is reasonable
- Check for doom loop detection in logs
API Errors
- Verify API key:
echo $ANTHROPIC_API_KEY | head -c 10 - Check model availability
- Review error in
.claude/autonomous-log.jsonl - Try with
verbose: truefor detailed output
Session Logs
All autonomous sessions are logged to .claude/autonomous-log.jsonl:
{"timestamp": "2024-01-15T10:30:00Z", "iteration": 1, "action": "START", "objective": "..."}
{"timestamp": "2024-01-15T10:31:00Z", "iteration": 1, "action": "CONTINUE", "task": "..."}
{"timestamp": "2024-01-15T10:35:00Z", "iteration": 2, "action": "CONTINUE", "task": "..."}
{"timestamp": "2024-01-15T11:00:00Z", "iteration": 15, "action": "COMPLETE", "summary": "..."}
View formatted:
.claude/skills/autonomous-opus-loop/scripts/view-log.sh --format pretty
Best Practices
1. Clear Objectives
Bad: "Make the code better" Good: "Refactor auth module to use dependency injection, add unit tests for all public methods"
2. Measurable Success Criteria
Bad: "Code should be clean" Good: "ESLint passes with no warnings, all functions have JSDoc comments"
3. Reasonable Limits
- Start with lower iteration limits (20-30)
- Increase based on task complexity
- Set cost limits slightly above expected
4. Monitor First Runs
- Use
verbose: trueinitially - Watch the first few iterations
- Adjust prompts based on behavior
5. Use Appropriate Models
claude-sonnet-4-20250514: Good balance of speed/quality (recommended)claude-opus-4-5-20250929: Better analysis, higher costclaude-3-5-haiku-20241022: Fast/cheap for simple tasks
Cost Estimation
Approximate costs per iteration (analyzer call):
| Model | Input (10k tokens) | Output (1k tokens) | Total |
|---|---|---|---|
| Sonnet 4 | $0.03 | $0.015 | ~$0.045 |
| Opus 4.5 | $0.15 | $0.075 | ~$0.225 |
| Haiku 3.5 | $0.008 | $0.004 | ~$0.012 |
Example: 30 iterations with Sonnet = ~$1.35 for analyzer alone (Plus Claude Code usage costs)
References
references/hook-mechanics.md- Deep dive into Stop hook behaviorreferences/analyzer-prompts.md- Prompt engineering for analyzersreferences/safety-patterns.md- Comprehensive safety documentationreferences/integration-guide.md- Integrating with other skills
Scripts
scripts/autonomous-loop.sh- Main Stop hook handlerscripts/opus-analyzer.py- Python analyzer (alternative)scripts/install.sh- Install hooks to settingsscripts/enable.sh- Enable autonomous modescripts/disable.sh- Disable autonomous modescripts/status.sh- Check current statusscripts/view-log.sh- View session logsscripts/emergency-stop.sh- Emergency termination
Version History
- v1.0.0 (2024-01): Initial release with Stop hook support
- Supports bash and Python analyzers
- Integration with observability stack
- Comprehensive safety features