Tool Calls & Execution Trace¶
Tool calls are the foundational unit of observability in Chakshu. Every command, file operation, MCP invocation, and skill execution recorded in an agent's transcript is normalized into an agent-agnostic event.ToolCall record.
1. The ToolCall Schema (internal/event/event.go)¶
| Field | Type | Description |
|---|---|---|
ID |
string |
Unique call identifier (from the agent's own tool-use ID) |
Agent |
string |
Source agent (codex, claude-code, gemini, cursor) |
Model |
string |
LLM model that issued the call (e.g., claude-3-5-sonnet, gemini-2.5-pro) |
SessionID |
string |
Parent session identifier |
Tool |
string |
Tool name, or skill name when Kind == "skill" |
Kind |
string |
"tool" or "skill" |
UnderlyingTool |
string |
Extracted underlying tool when wrapped or when Kind == "skill" |
Input |
string |
Raw JSON or command payload |
Output |
string |
Captured stdout/stderr or tool result |
CWD |
string |
Working directory at invocation time |
Source |
string |
Path to the transcript file on disk |
Timestamp |
time.Time |
Invocation timestamp |
Status |
string |
"success", "failed", or empty while in flight |
ExitCode |
*int |
Process exit code (when applicable) |
Duration |
time.Duration |
Measured execution duration |
InputTokens |
int |
Prompt/input tokens reported by the agent API |
OutputTokens |
int |
Completion/output tokens reported by the agent API |
2. Normalization & Formatting (internal/formatter)¶
Before rendering tool calls in the terminal or web dashboard, Chakshu applies several normalization passes:
- Command Unwrapping (
UnwrapPayload,ExtractUnderlyingTool): Strips shell wrappers (bash -lc "...",zsh -c "...",sh -c "...") and normalizes quotes so you see the actual command (go test ./...,git status) rather than boilerplate shell invocations. - Secret Redaction (
RedactSecrets): Semantically masks detected API keys, tokens, and credentials before display. - Home Directory Collapsing (
CollapseHome): Replaces the user's home directory prefix with~for readability. - Short Session IDs (
ShortSessionID,ShortSessionIDs): Formats long session UUIDs into 8-character#ab12cd34identifiers, automatically extending length if a collision occurs across active sessions. - Call Pairing & Status Resolution (
PairEvents,ResolveCallStatus): Matches start and completion transcript records to computeDurationand resolves status to: ok— Completed successfullyfail— Completed with error or non-zero exit codepending— Currently in flightstale— In flight longer than the 5-minute threshold without a completion record
3. Inspecting Tool Calls¶
Terminal CLI¶
# Last 20 tool calls
chakshu logs
# Filter by status, agent, or session
chakshu logs 50 --status fail --agent codex
chakshu logs --session #ab12cd34 --details --full
# Stream live tool calls as they happen
chakshu logs -f
chakshu tail --session #ab12cd34
# Full-text search across commands, inputs, and outputs (SQLite FTS5)
chakshu search "npm test" --agent claude-code
# Aggregate counts by tool, session, agent, or kind (tool vs skill)
chakshu count --by tool
chakshu count --by kind
Web Dashboard¶
- Global Search (
Cmd+K/Ctrl+K): Instant cross-agent full-text search modal (GlobalSearchModal) backed byGET /api/search. - Global Tool Calls (
#/calls): Searchable, filterable table (CallsTable) across all sessions and agents. Click any row to openCallModalwith full input/output payloads, model attribution, token counts, and timing. - Session Execution Trace (
#/sessions/:id/trace): Chronological step-by-step accordion (TraceList) with duration badges, model tags, exit codes, unwrapped command previews, and one-click copy for inputs and outputs.