scorpiox-emit-session

Session event telemetry emitter
Session
Linux x64 Linux ARM64 macOS ARM64 Windows x64

Description

scorpiox-emit-session captures and transmits telemetry events from AI-assisted coding sessions. Each invocation emits a single structured message representing a user prompt, assistant response, tool call, or tool result. Events are tagged with session ID, sequence number, provider, model, project, and branch metadata. This enables full session replay, usage analytics, cost tracking, and audit logging across all supported AI providers.

⚙️ Flags & Options (9)

Flag Short Description Takes Value
--session -s Session ID (required) Yes
--seq Message sequence number Yes
--type Message type: user, assistant, tool_call, tool_result Yes
--text Message text (inline) Yes
--file Read message text from file (for large content) Yes
--provider Provider name Yes
--model Model name Yes
--project Project name (default: basename of cwd) Yes
--branch Git branch (default: auto-detect) Yes

📖 Usage Examples

Basic — emit a user message
# Emit a user prompt as event #1 in session abc-123
scorpiox-emit-session --session abc-123 --seq 1 --type user \
  --text "Fix the null pointer dereference in parser.c"
Emit an assistant response with provider metadata
# Record the assistant reply with provider and model info
scorpiox-emit-session --session abc-123 --seq 2 --type assistant \
  --text "I found the issue on line 42..." \
  --provider claude_code --model opus
Emit a tool call event
# Record that the assistant invoked a tool
scorpiox-emit-session --session abc-123 --seq 3 --type tool_call \
  --text '{"tool":"Bash","command":"grep -n NULL parser.c"}'
Emit a tool result from file (large output)
# For large tool outputs, read from a file instead of inline
scorpiox-emit-session --session abc-123 --seq 4 --type tool_result \
  --file /tmp/grep_output.txt
Full session with project and branch context
# Emit with full metadata — project and branch auto-detected if omitted
scorpiox-emit-session --session ses_20260529_1005 --seq 1 \
  --type user --text "Refactor the auth middleware" \
  --provider claude_code --model opus \
  --project my-api --branch feature/auth-refactor
Scripted — emit from a shell pipeline
# Generate a session ID and emit sequenced events in a script
SID="ses_$(date +%s)"
scorpiox-emit-session -s "$SID" --seq 1 --type user --text "$PROMPT"
scorpiox-emit-session -s "$SID" --seq 2 --type assistant --file /tmp/response.md
scorpiox-emit-session -s "$SID" --seq 3 --type tool_call --text "$TOOL_JSON"
scorpiox-emit-session -s "$SID" --seq 4 --type tool_result --file /tmp/result.txt

🔧 Source & Build Info

Source File
scorpiox/scorpiox-emit-session.c
Lines of Code
590
Dependencies
libcurl · libsxhttp · libsxutil