Skip to content

feat: capture prompt_id + reasoning-effort level (v0.22.3) - #96

Merged
minarc merged 2 commits into
mainfrom
feat/capture-prompt-id
Jul 9, 2026
Merged

minarc merged 2 commits into
mainfrom
feat/capture-prompt-id

Conversation

@minarc

@minarc minarc commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Capture two per-turn hook-input signals on every telemetry event, via the central data assembly in runHook (no per-hook change needed thanks to the data-driven dispatcher).

Changes

  • prompt_id (Claude Code v2.1.196+): per-prompt correlation id grouping every event a single user prompt produced into one turn.
  • effort_level (hook input effort.level: low|medium|high|xhigh|max): the turn's reasoning-effort level.
  • Both are non-PII (UUID / enum), need no sanitization, and are omitted on runtimes that don't send them.
  • Bump 0.22.2 → 0.22.3.

Why

Events now group session_id (session) → prompt_id (turn) → tool_use_id (tool call), and turns can be segmented by reasoning effort. prompt_id correlates with OpenTelemetry per the docs.

Verification

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d6018c9d-7ab4-445b-9e2a-676da44c2dc3

📥 Commits

Reviewing files that changed from the base of the PR and between 6cefa61 and c5fcf99.

📒 Files selected for processing (2)
  • skillmeter/.claude-plugin/plugin.json
  • skillmeter/scripts/logger.js

Walkthrough

This PR bumps the plugin manifest version from 0.22.1 to 0.22.3 and adds a prompt_id field to the structured event JSON payload written by the logger's runHook function, sourced from input.prompt_id, omitted when undefined.

Changes

Version and logging update

Layer / File(s) Summary
Add prompt_id to logger payload
skillmeter/scripts/logger.js
runHook's event data object now includes a prompt_id field pulled from input.prompt_id, positioned alongside other correlation fields and omitted when undefined.
Bump plugin manifest version
skillmeter/.claude-plugin/plugin.json
The version field in the plugin manifest is updated from 0.22.1 to 0.22.3.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

Suggested reviewers: TheStarkor, jhunlee-dev

Poem

A tiny hop, a version rise,
0.22.3 gleams in the skies,
One new field for prompts to trace,
Tucked in logs with tidy grace,
Thump-thump — this rabbit approves this pace! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change by calling out prompt_id correlation and the release version bump.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/capture-prompt-id

Comment @coderabbitai help to get the list of available commands.

minarc and others added 2 commits July 9, 2026 19:50
Add the per-prompt correlation id (Claude Code v2.1.196+) to every event's
data via the central assembly in runHook, so all hook events a single user
prompt produced share one prompt_id — enabling per-turn analysis (tools/turn,
turn duration, retries). It's a random UUID (not PII, no sanitization) and is
omitted on older runtimes where the field is absent. Thanks to the data-driven
dispatcher, no per-hook change is needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979
Release the prompt_id per-turn correlation capture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979
@minarc
minarc force-pushed the feat/capture-prompt-id branch from 6cefa61 to c5fcf99 Compare July 9, 2026 10:51
@minarc
minarc merged commit 332f4c3 into main Jul 9, 2026
1 check passed
@minarc minarc changed the title feat: capture prompt_id for per-turn event correlation (v0.22.3) feat: capture prompt_id + reasoning-effort level (v0.22.3) Jul 9, 2026
minarc added a commit that referenced this pull request Jul 9, 2026
MessageDisplay fires per streaming delta (hundreds/turn = a node spawn each)
and its turn_id/message_id have no documented, stable join to the transcript, so
it's removed (registry + hooks.json + the runHook null-skip + central turn_id it
required).

Complete the common-input-fields coverage in the central event data:
- re-add effort_level (the effort capture was lost in #96's rebase and never
  reached main)
- add agent_id / agent_type centrally so subagent context is recorded on EVERY
  event fired inside a subagent (not just the Subagent* lifecycle events)

All 9 documented common fields are now captured: session_id, hook_event_name,
prompt_id, transcript_path, cwd, permission_mode, effort_level, agent_id,
agent_type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979
minarc added a commit that referenced this pull request Jul 9, 2026
* feat: add 5 hook events + fix stale field names for max coverage

New observation-only hook events (via the dispatcher — registry + hooks.json):
- Setup (setup_type), CwdChanged (path, hashed), MessageDisplay (message_length
  only — content lives in the transcript), Elicitation (server/tool_name/
  tool_input), ElicitationResult (server/tool_name; raw user_response omitted
  for privacy).

Field-name corrections to match the current hook input schema — these events
were previously capturing undefined:
- StopFailure: error_type/error_message (was error/error_details)
- TeammateIdle: agent_type
- TaskCreated: task_metadata; TaskCompleted: completion_status
- ConfigChange: config_source; WorktreeCreate: worktree_name/worktree_path
- Notification: dropped nonexistent title; InstructionsLoaded: dropped memory_type

Also: SessionStart now captures session_title. Coverage/field tests added.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979

* chore: bump version to 0.22.4

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979

* feat: capture turn_id globally; MessageDisplay = ids-only, final-chunk-only

MessageDisplay fires per streaming delta, so capture no content and log only
the final chunk:
- add turn_id to the central event fields (all events get turn-level correlation,
  free — like prompt_id)
- MessageDisplay mapper returns { message_id } on final, else null
- runHook now treats a null mapper return as 'skip logging this occurrence'
  (the hook still ran; nothing is written)

Result: one lightweight record per assistant message (turn_id + message_id, no
delta), instead of a content-bearing record per chunk.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979

* refactor: drop MessageDisplay; capture all common input fields

MessageDisplay fires per streaming delta (hundreds/turn = a node spawn each)
and its turn_id/message_id have no documented, stable join to the transcript, so
it's removed (registry + hooks.json + the runHook null-skip + central turn_id it
required).

Complete the common-input-fields coverage in the central event data:
- re-add effort_level (the effort capture was lost in #96's rebase and never
  reached main)
- add agent_id / agent_type centrally so subagent context is recorded on EVERY
  event fired inside a subagent (not just the Subagent* lifecycle events)

All 9 documented common fields are now captured: session_id, hook_event_name,
prompt_id, transcript_path, cwd, permission_mode, effort_level, agent_id,
agent_type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant