2 ファイル変更+7-1
この更新の概要
Python用Agent SDKにおいて、停止理由や権限拒否、エラーリストなどの新しい属性がレスポンス型に追加されました。memory設定のガイドラインが明確化され、コミット前などの特定のタイミングで実行すべき命令は、フックとして記述することが推奨されています。フックはシェルのコマンドとして実行され、AIの判断に関わらずライフサイクルイベントに合わせて適用されます。
@@ -1467,13 +1467,17 @@ class ResultMessage:
is_error: bool
num_turns: int
session_id: str
stop_reason: str | None = None
total_cost_usd: float | None = None
usage: dict[str, Any] | None = None
result: str | None = None
stop_reason: str | None = None
structured_output: Any = None
model_usage: dict[str, Any] | None = None
permission_denials: list[Any] | None = None
deferred_tool_use: DeferredToolUse | None = None
errors: list[str] | None = None
api_error_status: int | None = None
uuid: str | None = None
```
The `usage` dict contains the following keys when present:
@@ -365,6 +365,8 @@ To debug:
- Make instructions more specific. "Use 2-space indentation" works better than "format code nicely."
- Look for conflicting instructions across CLAUDE.md files. If two files give different guidance for the same behavior, Claude may pick one arbitrarily.
If the instruction is something that must run at a specific point, such as before every commit or after each file edit, write it as a [hook](/en/hooks-guide) instead. Hooks execute as shell commands at fixed lifecycle events and apply regardless of what Claude decides to do.
For instructions you want at the system prompt level, use [`--append-system-prompt`](/en/cli-reference#system-prompt-flags). This must be passed every invocation, so it's better suited to scripts and automation than interactive use.
Use the [`InstructionsLoaded` hook](/en/hooks#instructionsloaded) to log exactly which instruction files are loaded, when they load, and why. This is useful for debugging path-specific rules or lazy-loaded files in subdirectories.