# BR-AGT-05

When a Claude Code event has no session identifier, then it is refused with The hook event carries no session_id, the thread its values belong to.

Defined in [Plug the protection into an agent and its tools](https://docs.piighost.dev/en/domain/integrations/agents-and-tools/#br-agt-05).

## Where the rule lives

- [`handle_hook()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/integrations/claude_code/hooks.py#L136)

## Direct tests

- [`tests/integrations/test_claude_code_hooks.py::test_an_event_without_a_session_id_is_refused`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L92)
- [`tests/integrations/test_claude_code_hooks.py::test_missing_field_is_a_no_op`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L100)
- [`tests/integrations/test_claude_code_hooks.py::test_post_tool_use_anonymizes_grep_matching_lines`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L173)
- [`tests/integrations/test_claude_code_hooks.py::test_post_tool_use_anonymizes_read_content_leaves_path`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L107)
- [`tests/integrations/test_claude_code_hooks.py::test_post_tool_use_anonymizes_string_output`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L42)
- [`tests/integrations/test_claude_code_hooks.py::test_post_tool_use_edit_anonymizes_text_leaves_metadata`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L127)
- [`tests/integrations/test_claude_code_hooks.py::test_post_tool_use_leaves_grep_file_names_untouched`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L191)
- [`tests/integrations/test_claude_code_hooks.py::test_post_tool_use_unknown_tool_is_passthrough`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L229)
- [`tests/integrations/test_claude_code_hooks.py::test_pre_tool_use_deanonymizes_tool_input`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L59)
- [`tests/integrations/test_claude_code_hooks.py::test_unknown_event_is_a_no_op`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L85)
- [`tests/integrations/test_claude_code_hooks.py::test_user_prompt_submit_records_the_prompt_without_a_mutation`](https://github.com/Athroniaeth/piighost/blob/master/tests/integrations/test_claude_code_hooks.py#L25)

## Indirect tests

No indirect test found.

## Used by

- [`run()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/integrations/claude_code/runner.py#L110)
- [`_handle()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/integrations/claude_code/runner.py#L121)

Read from the code graph graphify builds, at the places the domain documentation gives.
