minion-orchestrator
できること
このスキルは、セッションが再起動しても動き続けるバックグラウンドジョブを管理します。単純なシェルのタスクと、AIサブエージェントが行うタスクの両方を扱い、進捗の確認や一時停止もできます。
使う場面
- ✓再起動の後も、長いタスクをバックグラウンドで動かし続けたいとき。
- ✓大きな作業を多数の並列タスクに分けて追跡したいとき。
- ✓すでに実行中のジョブを、一時停止、再開、または操作したいとき。
スキルのリンク
https://github.com/garrytan/gbrain/blob/master/plugin/skills/minion-orchestrator/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このデータの整理を、再起動しても生き残るバックグラウンドジョブとして実行してください。進捗は後で確認したいです。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは各ジョブを、Postgresに保存された永続的なキューに送ります。進捗とトークンの使用量を記録し、実行中の作業に操作メッセージを送れるようにし、結果が届いたときに報告します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Minion Orchestrator
Contract
Minions is a Postgres-native job queue for durable, observable background work. This single skill handles two lanes:
- Deterministic shell jobs (
gbrain jobs submit shell ...) - LLM subagent jobs (
gbrain agent run ...)
When to route to Minions: durable, observable work that must survive restarts,
fan out across many parallel tasks, or persist across sessions. Routing policy
is defined in skills/conventions/subagent-routing.md — the project default is
pain_triggered (native subagents first, Minions after specific pain signals
fire); Mode A (all-through-Minions) is opt-in.
Guarantees:
- Jobs survive gateway restart (Postgres-backed)
- Every job has structured progress, token accounting, and session transcripts
- Running agents can be steered mid-flight via inbox messages
- Jobs can be paused, resumed, or cancelled at any time
- Parent-child DAGs with configurable failure policies
Durable-execution doctrine (routing convention the agent follows — nothing mechanically enforces it; see "Durable execution" below):
- Operations expected to exceed ~2 minutes route through the capability ladder, never a bare background shell that dies with the session.
- A deadman check verifies the result was REPORTED to the user, not merely that the process exited — a swallowed completion event looks identical to a dead job from the user's side.
- The deadman is second-line insurance, not a delivery guarantee: it can
itself die before firing (scheduler restart, deleted entry). Backstop:
on the next turn, sweep
gbrain jobs list --status activeand recent completions for overdue work whose result never reached the user. - Deadman checks are idempotent. A double-fire, or a fire that races the normal completion report, produces silence — it checks reported-state first and tags any recovery report with the job ID so duplicates are detectable.
- A checkpoint or progress file is trusted only with a freshness check.
A stale checkpoint reads as "still running" forever; compare its
timestamp against the expected progress interval and against
gbrain jobs get <id>.
Route the Request: Shell Job vs Subagent
| Condition | Action |
|---|---|
| User asks for deterministic command/script run | Shell job (CLI: gbrain jobs submit shell ...) |
| User asks to "run in minions" + explicit command/argv | Shell job (CLI, --params with cmd or argv) |
| User asks for research/reasoning/iterative agent | Subagent job (CLI: gbrain agent run) |
| User asks to steer/pause/resume an agent | Subagent job lifecycle tools (MCP-callable) |
| Single simple operation under ~30s | Consider inline execution first |
| Needs restart durability/observability | Submit as Minion job |
| Operation expected to exceed ~2 minutes | Route through the Durable execution ladder (below) |
| Parallel work (2+ streams) | gbrain agent run --fanout-manifest or parent + child subagents |
If intent is ambiguous, ask one clarification: "Do you want a deterministic shell command job, or an LLM agent job?"
Shell Jobs (Deterministic Scripts)
Use for reproducible command execution, ETL steps, cron work, and scriptable tasks where no LLM reasoning loop is needed.
Preconditions (read before submitting your first shell job)
- The worker must be started with
gbrain jobs work --allow-shell-jobs(equivalentlyGBRAIN_ALLOW_SHELL_JOBS=1exported on the worker; a.envin the worker's directory cannot set it). The shell handler is always registered but guarded: an unflagged worker that claims a shell job dead-letters it immediately (UnrecoverableError, straight todead, no retries) with the flag named inerror_text. A job that sits inwaitingmeans NO worker is running at all — checkgbrain jobs supervisor status. Gate lives insrc/core/minions/handlers/shell.ts. - Security: flipping
GBRAIN_ALLOW_SHELL_JOBS=1authorizes arbitrary command execution on the worker. On a shared queue, this is a remote code execution surface. Treat as privileged infrastructure authorization. - Execution mode — pick one:
- Postgres + daemon:
gbrain jobs workruns a persistent worker that claims and executes jobs from the queue. - PGLite + --follow:
gbrain jobs submit ... --followruns inline. The daemon mode is not available on PGLite (exclusive file lock). Seedocs/guides/minions-shell-jobs.md.
- Postgres + daemon:
- MCP boundary: shell-job submission is CLI-only. `submit_job n
よくある質問
ジョブは再起動後も生き残りますか?
はい。キューはPostgresに保存されるため、ゲートウェイが再起動してもジョブは続きます。
実行中のジョブを変更できますか?
はい。操作メッセージを送ったり、一時停止、再開、キャンセルしたりできます。
通常のサブエージェントはいつ使いますか?
ルーティングのルールでは、まず組み込みのサブエージェントを優先し、特定の問題が起きたときにキューを使います。
詳細
作者による元の説明
Unified Minions skill for both deterministic shell jobs and LLM subagent orchestration. Replaces the older `gbrain-jobs` routing intent. Use when: submitting gbrain jobs, shell/background tasks, spawning subagents, checking progress, steering running work, pausing/resuming, parallel fan-out. One durable, observable, steerable queue interface. Also carries the durable-execution doctrine for any operation expected to exceed ~2 minutes: capability ladder, deadman checks that verify the result was reported, and content-addressed stage checkpoints for expensive pipelines.
repo: garrytan/gbrain
人気
- GitHubのスター
- 31k
- ランキング
- #9306
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
gbrain
31kエージェントが、共有の社内ナレッジブレインで人、プロジェクト、決定事項についての事実を検索し、永続的なメモを保存できるようにします。
brain-ingest-gate
31k重複を避け、名前付きのエンティティを先に解決するため、新しい内容をナレッジブレインに追加する前に、既存のブレインと照合するようエージェントを支援します。
brain-link-discipline
31kエージェントが報告する各ブレインのページについて、同じメッセージの中で動くリンクを必ず含め、すぐに開けるようにします。
brain-ops
31kナレッジブレインの基本的な手順をエージェントに与えます。まず既存の文脈を確認し、出典つきで明示的なメモを保存し、関連するページをリンクします。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。