Bridge-native observation of AI coding agent actions. Tool use interception, file operations with content hashing, command execution, security block/guidance decisions, cost snapshots, privacy sensitivity flags, and subagent lifecycle tracking. The bridge observation layer (AGPL-3.0) — parallel to ai.gryph.* (Go, Apache-2.0) and ai.claude.* self-report.
These events are the bridge's own audit trail — emitted by the Kotlin bridge daemon as it proxies Claude API traffic. They run in parallel with ai.claude.* (self-report) and ai.gryph.* (external Go hooks).
| Property | ai.claude.* | ai.observation.* | ai.gryph.* |
|---|---|---|---|
| Source | Bridge (API conversation) | Bridge (Kotlin daemon) | System hooks (Go binary) |
| Trust | Self-report | Bridge observation | Independent observation |
| Can block | No | No | Yes (PreToolUse hook) |
| Tracks subagents | Via agent.spawn | Via subagent_id on every event | Via SubagentStart hook |
| License | AGPL-3.0 (bridge) | AGPL-3.0 (bridge) | Apache-2.0 (gryph) |
2 events — bridge-observed session boundaries
Bridge-observed session start. Includes bridge version for provenance.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID (links to claude.session.start) |
| agent_name | string | Agent identifier (default: "claude-code") |
| bridge_version | string? | Bridge daemon version |
| timestamp | integer | Unix epoch milliseconds |
{
"type": "foundation.protocols.ai.observation.session.start",
"content": {
"session_id": "3f057459-de35-4b1a-84d7-484a38194b6a",
"agent_name": "claude-code",
"bridge_version": "1.0.0",
"timestamp": 1776199855184
}
}
Bridge-observed session end with aggregate statistics.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| duration_ms | integer | Wall-clock session duration |
| total_events | integer | Total observation events emitted |
| blocked_count | integer | Actions blocked by security checks |
| guidance_count | integer | Actions with guidance issued |
| actual_input_tokens | integer? | Actual input tokens (from transcript) |
| actual_output_tokens | integer? | Actual output tokens (from transcript) |
| timestamp | integer | Unix epoch milliseconds |
3 events — pre-use, post-use, and failure
Tool about to be used. Emitted before execution starts.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| tool_name | string | Tool identifier (Bash, Read, Write, etc.) |
| action_type | string | Action category (CommandExec, FileWrite, etc.) |
| description | string? | Human-readable description of intended action |
| working_directory | string? | Working directory at time of call |
| subagent_id | string? | Subagent ID if from a spawned agent |
| timestamp | integer | Unix epoch milliseconds |
Tool execution completed. Includes exit code and duration.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| tool_name | string | Tool identifier |
| action_type | string | Action category |
| exit_code | integer? | Process exit code (0 = success) |
| duration_ms | integer? | Execution duration in milliseconds |
| subagent_id | string? | Subagent ID if from a spawned agent |
| timestamp | integer | Unix epoch milliseconds |
Tool execution failed with error.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| tool_name | string | Tool identifier |
| action_type | string | Action category |
| error | string | Error message |
| exit_code | integer? | Process exit code |
| subagent_id | string? | Subagent ID if from a spawned agent |
| timestamp | integer | Unix epoch milliseconds |
2 events — read and write with content hashing
File read observed. Includes content hash for integrity verification.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| path | string | Absolute file path |
| size_bytes | integer? | File size in bytes |
| content_hash | string? | SHA-256 of file content |
| subagent_id | string? | Subagent ID if from a spawned agent |
| timestamp | integer | Unix epoch milliseconds |
File write observed. Includes diff metrics and content hash.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| path | string | Absolute file path |
| size_bytes | integer? | File size after write |
| content_hash | string? | SHA-256 of content after write |
| lines_added | integer? | Lines added |
| lines_removed | integer? | Lines removed |
| subagent_id | string? | Subagent ID if from a spawned agent |
| timestamp | integer | Unix epoch milliseconds |
1 event — shell command with output preview
Shell command execution observed. Includes truncated stdout/stderr previews.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| command | string | Shell command executed |
| description | string? | Human-readable description |
| exit_code | integer? | Process exit code |
| duration_ms | integer? | Execution duration |
| stdout_preview | string? | Truncated stdout (500 chars) |
| stderr_preview | string? | Truncated stderr (500 chars) |
| subagent_id | string? | Subagent ID if from a spawned agent |
| timestamp | integer | Unix epoch milliseconds |
1 event — generic bridge notification
Generic notification from the bridge observation layer.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| notification_type | string | Notification category |
| message | string | Notification message |
| timestamp | integer | Unix epoch milliseconds |
2 events — blocked actions and guidance advisories
An action was blocked by a security check.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| tool_name | string | Tool that was blocked |
| action_type | string | Action category |
| check_name | string | Name of the Check that blocked |
| reason | string | Human-readable block reason |
| timestamp | integer | Unix epoch milliseconds |
A security check issued guidance (advisory, not blocking).
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| tool_name | string | Tool receiving guidance |
| action_type | string | Action category |
| check_name | string | Name of the Check |
| guidance | string | Advisory message |
| timestamp | integer | Unix epoch milliseconds |
1 event — token usage and cost snapshot
Token usage and cost snapshot from the bridge observation layer.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| input_tokens | integer | Input tokens consumed |
| output_tokens | integer | Output tokens generated |
| cache_read_tokens | integer | Cache read tokens |
| cache_write_tokens | integer | Cache write tokens |
| model | string? | Model identifier |
| estimated_cost_usd | string? | Estimated cost in USD |
| timestamp | integer | Unix epoch milliseconds |
1 event — sensitive content detection
Sensitive content detected (credentials, keys, PII). Reports whether content was redacted.
| Field | Type | Description |
|---|---|---|
| session_id | string | Session UUID |
| tool_name | string | Tool handling sensitive content |
| path | string? | File path if applicable |
| sensitivity_type | string | Category: credentials, pii, api_key, etc. |
| redacted | boolean | Whether content was redacted before recording |
| timestamp | integer | Unix epoch milliseconds |
2 events — subagent spawn and completion
A subagent was spawned. All subsequent tool events from this agent carry the agent_id in their subagent_id field.
| Field | Type | Description |
|---|---|---|
| session_id | string | Parent session UUID |
| agent_id | string | Subagent identifier |
| agent_type | string | Subagent type (Explore, Plan, general-purpose) |
| timestamp | integer | Unix epoch milliseconds |
A subagent completed or was terminated.
| Field | Type | Description |
|---|---|---|
| session_id | string | Parent session UUID |
| agent_id | string | Subagent identifier |
| agent_type | string | Subagent type |
| agent_transcript_path | string? | Path to per-subagent JSONL transcript |
| last_assistant_message | string? | Final output (truncated) |
| timestamp | integer | Unix epoch milliseconds |
How the three observation layers relate
| ai.claude.* | ai.observation.* | ai.gryph.* | Relationship |
|---|---|---|---|
| session.start | session.start | session.start | Triple-parallel: same session, three observers |
| session.end | session.end | session.end | Triple-parallel: gryph has actual tokens |
| tool.call | tool.pre | tool.pre | Observation + gryph fire before execution |
| tool.result | tool.post | tool.post | Triple-parallel: all report exit code |
| tool.error | tool.failure | tool.failure | Triple-parallel: different error detail |
| file.change | file.write | file.write | Observation + gryph add content_hash |
| — | file.read | file.read | Claude doesn't emit explicit file reads |
| — | command.exec | command.exec | Detailed command execution (stdout/stderr preview) |
| usage.checkpoint | cost.observed | cost.observed | Observation = bridge estimate, gryph = actual |
| — | security.blocked | security.blocked | Both layers report blocks |
| — | security.guidance | security.guidance | Both layers report guidance |
| — | privacy.sensitive | privacy.sensitive | Both layers detect sensitive content |
| agent.spawn | subagent.start | subagent.start | Triple-parallel: subagent tracking |
| agent.result | subagent.stop | subagent.stop | Triple-parallel: subagent completion |
subagent_id on every tool/file/command event, enabling per-subagent attribution without the cross-reference hop that gryph requires.