Skip to content

Agent Tracer - API Integration Map

This is a reference organizing API endpoint usage per runtime. The automatic adapters currently implemented in the repository are the Claude Code plugin and the Codex hook adapter; other runtimes can be attached by calling the same API directly.

Implementation basis:

  • Claude Code hooks: https://code.claude.com/docs/en/hooks
  • Claude plugin implementation: packages/runtime/src/claude-code/hooks/*.ts
  • Codex hook adapter: packages/runtime/src/codex/hooks/*.ts

Related documentation:

Session Lifecycle

APIRoleAutomatic adaptersManual runtime
/ingest/v1/sessions/ensureRuntime session upsertSessionStart, UserPromptSubmit, PreToolUse, subagent hooksUse if stable runtime session ID is available
/ingest/v1/tasks/startExplicit task/session creationRarely usedUse when no session ID-based binding
/ingest/v1/sessions/endRuntime session closureStop, SessionEnd, SubagentStop, Codex StopUse to separate turn end from task end; pass completeTask: true only for a completed work item
/ingest/v1/tasks/completeExplicit task completionNot called directlyUse when directly completing a known task; accepts task fields only, not runtime-session closure fields
/ingest/v1/tasks/errorExplicit task failureNot called directlyUse when directly marking a known task as errored
/ingest/v1/conversation (assistant.response)Record assistant turn resultStop, StopFailureSend an assistant.response event if assistant has final text

/ingest/v1/tasks/complete and /ingest/v1/tasks/error finalize a task by taskId. Runtime-session policy fields such as completeTask, completionReason, and backgroundCompletions belong to /ingest/v1/sessions/end, where the server can decide whether ending a runtime observation window should also finalize the bound task.

Messages/Context

APIRoleClaude Code pluginManual runtime
/ingest/v1/conversationRecord user inputUserPromptSubmitRequired
/ingest/v1/events (user.prompt.expansion)Record slash-command / MCP-prompt expansionUserPromptExpansionOptional
/ingest/v1/workflowPlanning lane snapshotSessionStart, Setup, PreCompact, PostCompact, PostToolBatch, CwdChanged, Notification, ConfigChangeOptional
/ingest/v1/events (file.changed)Record changes to watched files (CLAUDE.md, .env, settings)FileChangedOptional
/ingest/v1/events (worktree.create / worktree.remove)Record worktree lifecycleWorktreeCreate, WorktreeRemoveOptional
/ingest/v1/workflowRecord loaded instruction filesInstructionsLoadedOptional
/ingest/v1/workflowRecord structured planning stepMCP/manual onlyOptional
/ingest/v1/workflowRecord agent action before executionMCP/manual only; SubagentStart, SubagentStop also route hereOptional
/ingest/v1/workflowRecord verification step resultMCP/manual onlyOptional
/ingest/v1/events or /ingest/v1/workflowRecord rule-related eventsPermissionDenied, PermissionRequest (Claude + Codex)Optional
/ingest/v1/conversationRecord question flowMCP/manual onlyOptional
/ingest/v1/workflowRecord summarized reasoningMCP/manual onlyOptional

Tool Usage

Claude's PostToolUse matcher is one-per-official-tool (see claude-setup.md § PostToolUse):

APIRoleClaude Code pluginManual runtime
/ingest/v1/tool-activityRecord implementation actionPostToolUse(Edit), PostToolUse(Write), PostToolUse(NotebookEdit), PostToolUse(Read), PostToolUse(Glob), PostToolUse(Grep), PostToolUse(LSP), PostToolUse(WebFetch), PostToolUse(WebSearch), PostToolUse(AskUserQuestion), PostToolUse(ExitPlanMode), PostToolUse(EnterPlanMode|EnterWorktree|ExitWorktree), PostToolUse(BashOutput), PostToolUse(KillShell), PostToolUse(ToolSearch), PostToolUseFailureRequired
/ingest/v1/tool-activityRecord file/web exploration(covered by the per-tool handlers above sharing _explore.ops.ts)Required
/ingest/v1/tool-activityRecord terminal command executionPostToolUse(Bash), PostToolUse(PowerShell), Codex PostToolUse(Bash)Use if bash-family tools exist
/ingest/v1/events (monitor.observed)Record long-running watch (Monitor tool)PostToolUse(Monitor)Optional
/ingest/v1/tool-activityRecord Codex apply_patch (alias Edit / Write)Codex PostToolUse(apply_patch) + rollout cross-checkUse for Codex
/ingest/v1/workflowRecord todo state changesPostToolUse(TaskCreate), PostToolUse(TaskUpdate), PostToolUse(TodoWrite), TaskCreated, TaskCompletedUse if todo tools exist
/ingest/v1/coordinationRecord cron schedule lifecyclePostToolUse(CronCreate|CronDelete|CronList)Optional

Agent/Background

APIRoleClaude Code pluginManual runtime
/ingest/v1/coordinationRecord delegation/skill/MCP callsPostToolUse(Agent), PostToolUse(Skill), PostToolUse(mcp__*); Codex PostToolUse(mcp__*) + rollout cross-checkUse if subagent or skill concept exists
/ingest/v1/coordinationBackground task stateSubagentStart, SubagentStopUse if background execution exists
/ingest/v1/tasks/linkLink parent-child tasksWhen child runtime session is acquiredUse if background lineage exists

Verification Rules

Verification rules are user-defined trigger/expect contracts. Rules are stored globally or for one task, matched against events while turns are open, and evaluated definitively when a (user.message -> assistant.response) turn closes.

APIRole
GET /api/v1/rulesList global/task rules; supports scope, taskId, and source query filters
POST /api/v1/rulesCreate a global or task-scoped rule
PATCH /api/v1/rules/:idUpdate a rule
DELETE /api/v1/rules/:idSoft-delete a rule
POST /api/v1/rules/:id/promotePromote a task-scoped rule to a global rule
POST /api/v1/rules/:id/re-evaluateBackfill rule enforcements/verdicts for existing turns
GET /api/v1/tasks/:taskId/rulesList global + task-scoped rules active for a task
GET /api/v1/tasks/:taskId/verdict-countsCount turn verdict statuses for a task

Rules can match trigger phrases against user/assistant text and expected tool/command/pattern activity against timeline events. Matches write rule_enforcements rows. The timeline repository then overrides matching events to the rule lane at read time while preserving the original lane in event metadata.

Minimum Implementation Order for New Runtime

text
1. /ingest/v1/sessions/ensure or /ingest/v1/tasks/start
2. /ingest/v1/conversation (user.message)
3. /ingest/v1/tool-activity (tool.used)
4. /ingest/v1/tool-activity (exploration or terminal events)
5. /ingest/v1/conversation (assistant.response)
6. /ingest/v1/sessions/end

Then optionally add /ingest/v1/workflow, /ingest/v1/coordination, /ingest/v1/lifecycle, /ingest/v1/telemetry, and /ingest/v1/tasks/link as needed.

Local-first documentation for Agent Tracer.