← View index

Dev Intel: instruction-loading observability

Agent observability should show which instructions were actually loaded, not only tokens.

Generated: 2026-05-25T10:08:00+09:00

Lane: 開発ネタ発掘

Goal: 健人くん向けに、agentic coding / OpenClaw運用へすぐ転用できる開発ネタを1つ、ソース付きで残す。

Assumption: 今回は「新サービス紹介」より、heartbeatやCodex/Claude Code運用の品質に効く実装パターンを優先する。

Smallest edit/action: Claude Code hooks + OpenTelemetry の実例と公式docsを読み、OpenClawに移せる1枚の判断メモに圧縮する。

ざっくり

AI coding agentの観測は、トークン量やコストだけ見ても足りない。いま面白いのは「そのセッションでどの指示ファイル・ルール・フックが本当に読み込まれたか」をイベントとして残す方向。

Mae Capozziの記事では、Claude Code hooksでSessionStart / InstructionsLoaded / tool use / prompt submitなどを拾い、HoneycombへOpenTelemetry spanとして送る運用が紹介されていた。Anthropic公式docs側でも、hooksはSessionStart、UserPromptSubmit、PreToolUse、PostToolUse、InstructionsLoadedなどのライフサイクルイベントを扱えると説明されている。Monitoring docsでは、Claude Code自体もOpenTelemetryでusage/cost/tool activityをexportできる。

健人くんに関係ある理由

OpenClaw/ひめのの最近の失敗は、単に「モデルが賢いか」ではなく、「どのAGENTS.md、tone playbook、phrasebank、heartbeat契約がそのターンで効いていたか」を後から追えないことが多い。

だから、heartbeat品質を上げるなら次はログ本文の反省を増やすより、各runごとに以下を小さく残す方が効く。

これがあると「また硬い通知になった」時に、性格論じゃなくて「phrasebank未読」「tone gate未実行」「dev-intel通知の型崩れ」みたいに原因を切れる。

次に試すなら

OpenClaw側でいきなり外部OTelへ送らず、まずはworkspace内に memory/heartbeat-run-trace.jsonl を作るのが安全。1 run 1行で run_id / required_files_read / lane / notify_decision / owner_gate_result だけ残す。うまく効いたら後でView化、必要ならOTel exportへ広げる。

Why this is useful

ひめのheartbeatは「起きた証明」ではなく「価値が出た理由・出なかった理由」を追える方が強い。特に口調・外部通知・source-backed dev scoutは、指示の読み込み漏れと判断漏れが混ざると再発防止しにくい。

What I made/changed

Sources/Evidence

Prediction

If OpenClaw heartbeat adds a local run trace for required context reads and owner-facing gate outcomes, repeated “tone/style/notification contract drift” investigations should need fewer manual log reads.

Verify by

Observed

Next safe action

Add a tiny local-only heartbeat_run_trace helper that records required file reads and final notify decision, then test it with one synthetic heartbeat pass.

Notify

yes — this is a source-backed dev/agent ops pattern with a concrete OpenClaw implementation idea.

質問したい箇所を選択
この箇所について質問
✓ 質問を送信しました