← All Event Families
Gryph

foundation.protocols.ai.gryph.*

Independent system-level observation of AI coding agent actions via native hooks. Tool call interception, file change hashing, security block/guidance decisions, actual cost from transcripts, and subagent lifecycle tracking with inline attribution. The execution audit layer — parallel to ai.claude.* self-report. Based on gryph (Apache-2.0).

15
Events
15
Timeline
0
State

The Two Observation Layers

These events are parallel to foundation.protocols.ai.claude.* — not replacements. Both are emitted into the same Matrix room, linked by session_id and tool_use_id.

Propertyai.claude.*ai.gryph.*
SourceBridge daemon (API conversation)System hooks (tool call interception)
TrustSelf-reportIndependent observation
Can blockNoYes (PreToolUse hook)
Sees prompts/responsesYesNo
Sees actual file changesVia bridge reportVia system hook + SHA-256 hash
Token countsEstimated during sessionActual from transcript at session end
Divergence is data. Where claude.* and gryph.* disagree about the same session, that divergence reveals governance failures, capture gaps, or interesting behavioural phenomena.

Contents

1. Session Lifecycle

2 events — hook-observed session boundaries

Timeline Event

foundation.protocols.ai.gryph.session.start

Hook-observed session start. Includes agent version and gryph version — fields not available in claude.session.start.

FieldTypeDescription
session_idstringUUID linking to claude.session.start
agent_namestringAgent identifier (e.g., "claude-code")
agent_versionstringExact agent build (e.g., "2.1.104")
modelstringModel at session start
working_directorystringAbsolute path to project
sourcestringHow started: "cli", "web", "ide"
permission_modestringAgent permission mode
gryph_versionstringGryph version performing observation
timestampstringISO 8601 UTC
{
  "type": "foundation.protocols.ai.gryph.session.start",
  "content": {
    "session_id": "3f057459-de35-4b1a-84d7-484a38194b6a",
    "agent_name": "claude-code",
    "agent_version": "2.1.104",
    "model": "claude-opus-4-20250514",
    "working_directory": "/path/to/project",
    "source": "cli",
    "permission_mode": "default",
    "gryph_version": "v0.6.0",
    "timestamp": "2026-04-12T22:57:49Z"
  }
}
Timeline Event

foundation.protocols.ai.gryph.session.end

Hook-observed session end. Includes actual token counts from the agent's transcript file — ground truth for cost estimation.

FieldTypeDescription
session_idstringSession UUID
reasonstring"user_closed", "error", "completed"
duration_msintegerWall-clock session duration
total_actionsintegerTotal hook events in session
files_readintegerFile read count
files_writtenintegerFile write count
commands_executedintegerShell command count
blocked_actionsintegerActions blocked by Checks
sensitive_actionsintegerActions flagged as sensitive
costobjectActual tokens + cost (from transcript)
{
  "type": "foundation.protocols.ai.gryph.session.end",
  "content": {
    "session_id": "3f057459-...",
    "reason": "user_closed",
    "duration_ms": 3600000,
    "total_actions": 148,
    "files_read": 24,
    "files_written": 16,
    "commands_executed": 45,
    "blocked_actions": 2,
    "sensitive_actions": 1,
    "cost": {
      "input_tokens": 150000,
      "output_tokens": 25000,
      "cache_read_tokens": 80000,
      "total_cost_usd": "2.850",
      "source": "transcript"
    }
  }
}

2. Tool Observation

3 events — pre-execution (can block), post-success, post-failure

Timeline Event

foundation.protocols.ai.gryph.tool.pre

Observed before tool execution. This is the enforcement point — Checks run here and can block. No ai.claude.* equivalent fires before execution.

FieldTypeDescription
tool_use_idstringLinks Pre to Post for the same call
tool_namestring"Read", "Write", "Edit", "Bash", "Grep", "Glob", etc.
action_typestring"file_read", "file_write", "command_exec", "tool_use"
input_summarystringAbbreviated input (path or command, truncated)
is_sensitivebooleanTarget matches sensitive patterns
decisionstring"allow", "blocked", or "guidance"
checks_runarrayChecks that fired: [{check, decision, reason}]
{
  "type": "foundation.protocols.ai.gryph.tool.pre",
  "content": {
    "session_id": "3f057459-...",
    "sequence": 42,
    "tool_use_id": "tu_abc123",
    "tool_name": "Bash",
    "action_type": "command_exec",
    "input_summary": "docker build -t myimage .",
    "is_sensitive": false,
    "decision": "blocked",
    "checks_run": [
      {"check": "gate3-docker-compose", "decision": "block",
       "reason": "Use docker compose build, not standalone docker build -t"}
    ],
    "timestamp": "2026-04-12T23:05:00Z"
  }
}
Timeline Event

foundation.protocols.ai.gryph.tool.post

Observed after successful tool execution.

FieldTypeDescription
tool_use_idstringLinks to corresponding tool.pre
tool_namestringTool name
action_typestringNormalised action type
result_statusstring"success"
duration_msintegerExecution time
Timeline Event

foundation.protocols.ai.gryph.tool.failure

Observed after failed tool execution. Distinct from tool.post to enable filtering.

FieldTypeDescription
tool_use_idstringLinks to corresponding tool.pre
tool_namestringTool name
error_messagestringError description
duration_msintegerExecution time

3. File Operations

2 events — system-observed reads and writes with content hashing

Timeline Event

foundation.protocols.ai.gryph.file.read

System-observed file read. Covers Read, Grep, Glob, LS tools.

FieldTypeDescription
tool_use_idstringTriggering tool call
tool_namestring"Read", "Grep", "Glob", "LS"
pathstringAbsolute file path
is_sensitivebooleanMatches sensitive patterns
Timeline Event

foundation.protocols.ai.gryph.file.write

System-observed file write. Includes SHA-256 content hash for immutable audit.

FieldTypeDescription
tool_use_idstringTriggering tool call
tool_namestring"Write", "Edit", "NotebookEdit"
pathstringAbsolute file path
content_hashstringSHA-256 of file after write
lines_addedintegerLines added
lines_removedintegerLines removed
is_sensitivebooleanMatches sensitive patterns

4. Command Execution

1 event — shell commands with exit codes and timing

Timeline Event

foundation.protocols.ai.gryph.command.exec

System-observed shell command execution.

FieldTypeDescription
tool_use_idstringTriggering tool call
commandstringFull command string
descriptionstringAgent's description of command purpose
exit_codeintegerProcess exit code (0 = success)
duration_msintegerExecution time
is_sensitivebooleanCommand accesses sensitive paths

5. Notification

1 event — permission prompts, warnings, info messages

Timeline Event

foundation.protocols.ai.gryph.notification

System-observed notification. Captures permission prompts (maps to ai.claude.approval.request from a different perspective).

FieldTypeDescription
messagestringNotification text
notification_typestring"permission_prompt", "warning", "info", "error"

6. Security Decisions

2 events — no ai.claude.* equivalent. Only gryph can block tool calls.

Timeline Event

foundation.protocols.ai.gryph.security.blocked

A tool call was blocked by a governance Check before execution.

FieldTypeDescription
tool_use_idstringThe blocked tool call
tool_namestringTool that was blocked
action_typestringNormalised action type
check_namestringWhich Check blocked it
reasonstringHuman-readable reason
input_summarystringWhat was attempted
{
  "type": "foundation.protocols.ai.gryph.security.blocked",
  "content": {
    "session_id": "3f057459-...",
    "sequence": 42,
    "tool_use_id": "tu_blocked01",
    "tool_name": "Bash",
    "action_type": "command_exec",
    "check_name": "gate3-docker-compose",
    "reason": "Use docker compose build, not standalone docker build -t",
    "input_summary": "docker build -t myimage .",
    "timestamp": "2026-04-12T23:05:00Z"
  }
}
Timeline Event

foundation.protocols.ai.gryph.security.guidance

A tool call was allowed but with advisory guidance from a Check.

FieldTypeDescription
tool_use_idstringThe guided tool call
tool_namestringTool name
check_namestringWhich Check issued guidance
guidancestringAdvisory text

7. Cost Observation

1 event — actual token counts from transcript (ground truth)

Timeline Event

foundation.protocols.ai.gryph.cost.observed

Actual token counts from the agent's transcript file. Compare with ai.claude.usage.checkpoint estimates to calibrate cost models.

FieldTypeDescription
modelsarrayPer-model breakdown: model, input/output/cache tokens, cost
total_input_tokensintegerSum across all models
total_output_tokensintegerSum across all models
total_cost_usdstringEstimated cost (string, not float)
sourcestring"transcript"

8. Privacy

1 event — sensitive file access logging (content NOT included)

Timeline Event

foundation.protocols.ai.gryph.privacy.sensitive

A sensitive file was accessed. Records the fact of access for compliance, not the content.

FieldTypeDescription
tool_use_idstringThe accessing tool call
action_typestring"file_read", "file_write", "command_exec"
pathstringThe sensitive path
matched_patternstringWhich pattern matched (e.g., "**/.env")
content_redactedbooleanAlways true

7. Subagent Lifecycle

Track agent hierarchy: when subagents spawn and complete (added v1.1, validated 2026-04-14)

Inline attribution. Claude Code includes agent_id and agent_type in every subagent tool call. Main-agent calls omit these fields. No bracketing needed — check for field presence.
Timeline Event

foundation.protocols.ai.gryph.subagent.start

A subagent was spawned by the main agent.

FieldTypeDescription
agent_idstringSubagent identifier (from Claude Code hook JSON)
agent_typestringSubagent type
Values: Explore, Plan, general-purpose
Timeline Event

foundation.protocols.ai.gryph.subagent.stop

A subagent completed or was terminated.

FieldTypeDescription
agent_idstringSubagent identifier
agent_typestringSubagent type
agent_transcript_pathstringPath to per-subagent JSONL transcript
last_assistant_messagestringFinal output (truncated to 500 chars)

Cross-Reference: claude.* vs gryph.*

How the two observation layers map to each other

ai.claude.* eventai.gryph.* eventRelationship
session.startsession.startParallel — same session, different observer
session.endsession.endParallel — gryph adds actual token counts
tool.calltool.pregryph fires BEFORE execution, can block
tool.resulttool.postParallel — gryph adds duration
tool.errortool.failureParallel — different error detail
file.changefile.writeParallel — gryph adds content_hash
approval.requestnotificationDifferent framing of same moment
usage.checkpointcost.observedgryph has ACTUAL tokens vs estimates
security.blockedGryph-only: enforcement layer
security.guidanceGryph-only: advisory layer
privacy.sensitiveGryph-only: compliance layer
prompt, response, thinkingClaude-only: hooks don't see conversation
context.truncatedClaude-only: internal to runtime
agent.spawnsubagent.startParallel — gryph observes via SubagentStart hook + inline agent_id
agent.resultsubagent.stopParallel — gryph captures transcript path + last message