delegate-x-research
Skill3 starsChanged 5 months agoMITView on GitHub
x.com / X 上の投稿・アカウント・話題・反応を調査する作業を、X 調査 capability を持つ子プロセスへ委譲するスキル。 ユーザーが X、x.com、Twitter、ポスト、スレッド、アカウント、ハッシュタグ、炎上、世論、直近の反応、 コミュニティノート、投稿URLの確認などを調べたい場合に使う。main agent 側で X を直接確認できない、 または最新投稿・検索結果・引用元確認を隔離したい場合に使う。現在のバックエンドは Grok CLI で、 DELEGATE_X_RESEARCH_MODEL でモデルを切り替える。 x.com 調査を委譲する場合は、この skill を使う。generic な subagent で代替しない。
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- delegate-choreSkill
- delegate-exploreSkill
- delegate-htmldocSkill
- delegate-imagegenSkill
- delegate-implementSkill
- delegate-proseSkill
- delegate-reviewSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 40
run-x-research は内部で prepare → delegate-x-research-grok → read-response を順に実行し、stdout は成功・失敗とも単一 JSON(exit_code / status / content / …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
delegate-x-research
x.com / X の調査を、X 調査 capability を持つ子プロセスへ委譲する。task_type=xresearch、既定モデル grok-build。他 delegate と同じ request/response protocol v1 を使う。現在の実装バックエンドは Grok CLI で、grok -p -m へリクエストを渡す。
スクリプトパス
- Claude Code:
skill_dir=.claude/skills/delegate-x-research - Codex:
skill_dir=.agents/skills/delegate-x-research
以降のコマンド例は Claude Code の .claude/skills/delegate-x-research を使う。Codex で使う場合は、同じ相対構造の .agents/skills/delegate-x-research に読み替える。
モデル価格参照
コスト分析・単価比較が必要な場合のみ、<skill_dir>/model-token-prices.json を読む。このデータは参照用であり、delegate の起動可否判定には使わない。
委譲する前に
この skill は、X 上の投稿・アカウント・スレッド・検索結果・直近の反応・コミュニティノートなど、Grok の X 調査能力を使う必要がある場合に使う。通常の Web ページ、リポジトリ内ドキュメント、コード調査だけで足りる場合は、main が直接処理するか delegate-explore を使う。
リクエストには、調査対象、期間、言語、地域、確認したい主張、必要な粒度、引用してよいソース種別を明記する。特に「最新」「今日」「昨日」などの相対日付は、request 作成時点の具体的な日付も併記する。
実行フロー(one-shot)
- リクエスト作成: Objective / Scope / Context / Acceptance criteria / Verification / Constraints の Markdown を stdin で渡す。調査対象、期間、言語、地域、確認したい主張、必要な粒度、引用してよいソース種別を明記する。特に「最新」「今日」「昨日」などの相対日付は、request 作成時点の具体的な日付も併記する。
DELEGATE_X_RESEARCH_MODELは effort suffix に対応しない。@付きモデルは prepare が exit 6 で fail-closed する。
- 実行:
out="$(printf '%s' "$req_md" | bash .claude/skills/delegate-x-research/scripts/run-x-research.sh "$PARENT_TASK_TYPE_CHAIN" "$REQUESTER_SESSION_ID")"(top-level 起動なら$PARENT_TASK_TYPE_CHAINは空でよい)。- run-x-research は内部で prepare → delegate-x-research-grok → read-response を順に実行し、stdout は成功・失敗とも単一 JSON(
exit_code/status/content/content_truncated/response_file/observe_file/run_dir)を返す。 - selector 省略時の既定は
auto。 - exit code は内部スクリプトを透過する。exit 3=前提不足 / exit 4=委譲サイクルなら中止する。exit 6 の場合は、許容値列挙を含む stderr の 1 行をそのままユーザーへの説明に使う。
run-x-research.shは dispatch 前にobserve_file: <path>を stderr へ先出しする。run-x-research.shが Bash timeout で background へ退避しただけの場合は再実行しない(再実行は worker の二重起動になり、implement / chore では同一 worktree の同時書き換えになる)。復旧はbash .claude/skills/delegate-x-research/scripts/read-json.sh .state.phase "$observe_file"を見て分岐する。ended/stalled/interruptedなら終端なので、いずれでもbash .claude/skills/delegate-x-research/scripts/read-json.sh .run.response_file "$observe_file"で応答パスを取得してbash .claude/skills/delegate-x-research/scripts/read-response.shで読む(stalledでは failed response が書かれる。interruptedは dispatcher が終端を書けずに落ちた run を wrapper が代わりに記録したもので、.state.response_presentがtrueなら完走した response がある)。runningの間は.heartbeat.tsが進んでいれば待つ。runningのまま.heartbeat.tsがDELEGATE_OBSERVE_HEARTBEAT_INTERVAL(既定 10 秒)を大きく超えて進まない場合は dispatcher が終端を書けずに落ちている。wrapper も同時に落ちていれば phase は終端へ遷移しないので、待っても応答は来ない。新しい run を出す前に順に確認する。(1)read-json.sh .run.response_file "$observe_file"を読む。dispatcher だけが死んだ場合、wrapper が完全な response を書き終えていることがある。(2) response がChild CLI failed or did not write a response.の stub なら、read-json.sh .run.run_dir "$observe_file"の<run_dir>/worker-stdout.captureに子 CLI の生 stream が残っている。wrapper が finalize まで到達していれば observe の.streams.stdout.contentにもDELEGATE_OBSERVE_STREAM_MAX_BYTES(既定 65536 バイト)まで入る。構造化された response ではないが、長い run では再実行より安く回収できる。(3)read-json.sh .heartbeat.child_pid "$observe_file"の pid の生存を確認する。wrapper は dispatcher と別プロセスなので孤児化して動き続けることがあり、生きている間に implement / chore で新しい run を出すと同一 worktree の二重書き換えになる。確認後に新しい run を出す。background 退避した出力ファイルは stdout と stderr が合流するが、read-json.shは既知の harness 行(空行 /observe_file:行 /[exited with ...]行)に囲まれた JSON object を切り出して読める。- 非対話モードの親(
claude -p等)では run-x-research を必ずフォアグラウンドで実行し、委譲所要時間より長い Bash timeout(Claude Code ならBASH_DEFAULT_TIMEOUT_MS/BASH_MAX_TIMEOUT_MSまたは Bash tool の timeout 引数)を設定する。
- run-x-research は内部で prepare → delegate-x-research-grok → read-response を順に実行し、stdout は成功・失敗とも単一 JSON(
- レスポンス消費と検証:
status="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .status)"/content="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .content)"を読む。content_truncatedがtrueならresponse_file="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .response_file)"を取り出し、bash .claude/skills/delegate-x-research/scripts/read-response.sh "$response_file" <N>で Findings / Sources / Limitations / Blockers など必要 section だけ段階読みする。読了後、worker の本文を再要約しない。main のユーザー向け応答は、必要な結論と参照すべき section を短く示す。重要な主張について、Sources に投稿URL・アカウント・投稿日時・確認時刻が含まれるか確認する。根拠が弱い箇所や Grok 側のアクセス制限は Limitations / Blockers として扱い、断定しない。
高度なフロー(個別スクリプト)
dispatch 中の observe 監視、background 実行など、途中で親の判断を挟むフローでは従来の個別スクリプトを使う。
- 準備: Objective / Scope / Context / Acceptance criteria / Verification / Constraints の Markdown を stdin で渡す。exit 3=前提不足 / exit 4=委譲サイクルなら中止。
DELEGATE_X_RESEARCH_MODELは effort suffix に対応しない。@付きモデルは prepare が exit 6 で fail-closed する。out="$(printf '%s' "$req_md" | bash .claude/skills/delegate-x-research/scripts/prepare.sh xresearch DELEGATE_X_RESEARCH_MODEL grok-build "$PARENT_TASK_TYPE_CHAIN" "$REQUESTER_SESSION_ID")"(top-level 起動なら$PARENT_TASK_TYPE_CHAINは空でよい)model="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .model)"/request_file="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .request_file)"/response_file="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .response_file)"/run_dir="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .run_dir)"/observe_file="$(printf '%s' "$out" | bash .claude/skills/delegate-x-research/scripts/read-json.sh .observe_file)"
- 調査実行: 現在は
bash .claude/skills/delegate-x-research/scripts/delegate-x-research-grok.sh "$model" "$request_file" "$response_file" "$run_dir" "$observe_file"で Grok CLI を起動する。Grok CLI は X / network access とローカルセッション状態を使うため、sandboxed requester では権限付き実行(Codex ではsandbox_permissions=require_escalated)で起動する。非対話モードの親(claude -p等)では子プロセス起動を必ずフォアグラウンドで実行し、委譲所要時間より長い Bash timeout(Claude Code ならBASH_DEFAULT_TIMEOUT_MS/BASH_MAX_TIMEOUT_MSまたは Bash tool の timeout 引数)を設定する。実行中の通常監視はobserve_fileからstate.phase/state.started_at/heartbeat.ts/heartbeat.stdout_bytes/heartbeat.stderr_bytes/heartbeat.last_stream_change_atだけを read-json.sh で読む。state.phaseはprepared | running | superseded | stalled | interrupted | ended。prepared/supersededは dispatch されなかった observe(state.started_at == null、usageは未設定で read-json.sh では null 相当)なので、usage を集計する場合は分母から除外する。 - レスポンス読み取り:
bash .claude/skills/delegate-x-research/scripts/read-response.sh "$response_file" auto。autoが大きな response と判定した場合は status + index + Summary section を返すので、Findings / Sources / Limitations / Blockers など必要 section だけ... "$response_file" <N>で追加取得する。読了後、worker の本文を再要約しない。main のユーザー向け応答は、必要な結論と参照すべき section を短く示す。 - 検証フェーズ: 重要な主張について、Sources に投稿URL・アカウント・投稿日時・確認時刻が含まれるか確認する。根拠が弱い箇所や Grok 側のアクセス制限は Limitations / Blockers として扱い、断定しない。
待ち時間の隠蔽(対話親向け)
対話親では体感待ち時間を隠蔽できる。経路は起動スクリプトで異なる。delegate-x-research-grok.sh 経由は prepare.sh で response_file を事前取得済みなので、delegate-x-research-grok.sh を background で実行し、observe_file の state.phase / heartbeat を確認して ended / stalled / interrupted になった後に read-response.sh する。run-x-research.sh 経由は response_file を事前に取得できないので、run-x-research.sh を background で実行した場合は read-json.sh .run.response_file "$observe_file" で応答パスを取るか、合流した出力 JSON をそのまま read-json.sh で読む。総所要時間(wall time)は変わらない体感改善であり、非対話モードの親では従来どおりフォアグラウンド実行必須。
Worker report
worker の report Markdown は次の見出しを基本にする。
Summary: 結論の短い要約Findings: 主な発見。事実、推測、未確認情報を分けるSources: x.com URL、投稿者、投稿日時、確認時刻、関連検索語Method: 検索語、確認した範囲、除外した情報Limitations: 非公開投稿、削除済み投稿、検索結果の偏り、取得不能、時点依存Blockers: Grok CLI 不在、ログイン不備、X へのアクセス不可、入力不足
制約
DELEGATE_X_RESEARCH_MODEL→grok-buildの順でモデル解決する- Grok CLI が指定モデルを公開しておらず
grok-buildが利用可能な場合は、実行時にgrok-buildへフォールバックする GROK_DELEGATE_SANDBOXが設定された場合のみ Grok CLI に--sandboxを渡す- 現在の実行バックエンドは Grok CLI。将来別バックエンドに差し替える場合も、skill 名と env 名は X 調査という用途に合わせる
- x.com / X の調査に集中する。Web 一般やコード調査へ広がる場合は、request の Scope に必要な範囲だけを書く
- 直近情報は確認日時を明記し、削除・編集・非公開化で変わり得ることを Limitations に残す
- task_type_chain 内種別への再委譲はしない(別種別 delegate は可)
- main は worker の探索ログを echo / 再要約しない。必要な結論と参照 section だけを返す
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

