Telemetry/243 emitting events#261
Open
gme-muriuki wants to merge 6 commits into
Open
Conversation
gme-muriuki
force-pushed
the
telemetry/243-emitting-events
branch
from
July 13, 2026 16:20
9c4030a to
d8bafee
Compare
Eight supply-side EventKinds: session_start, user_prompt, tool_use, plugin_activation, skill_activation, hook_invocation, sync_run, stop. Recording entry points exist but nothing calls them yet. session_id lives on the TelemetryEvent envelope (common to every kind; wire format unchanged, still a top-level key). user_prompt / stop are unit variants. crates lists carry predicate-witness crates, omitted for wildcard/env/shell gates read_events skips and debug-logs an unparseable line instead of dropping it silently (best-effort read). Tests: per-kind round-trip + kind_name/serde-tag drift guard; skip of unparseable lines. Docs: telemetry.md + module-structure realigned.
sync() now returns Result<SyncSummary> so the hook pipeline can emit
telemetry from a real sync pass; cli/hook callers discard it.
resolve_applicable (was skills_applicable_to) returns ApplicableSkills {
skills, plugins }, capturing predicate witnesses in the single gating
pass via PredicateSet::witness. A plugin is recorded even when it vends
no applicable skill.
SkillWithGroupContext gains plugin + crates (witness union over the
plugin/group/skill levels, empty for wildcard/non-crate gates). Lean
PluginActivation/SkillActivation records live in skills.rs;
SkillWithGroupContext::activation() projects to the latter.
SyncSummary { plugins, skills, installed, reaped, crate_count };
installed derives from the installed-dirs set, no parallel counter.
GroupContext bundles the inherited plugin/witness context.
Tests: resolve_applicable attributes witness crates to a matched plugin
and a wildcard skill that rides in on it.
Docs: module-structure sync and skills blurbs.
…-dev#243) The only place config.telemetry.enabled is checked: record the event via telemetry::record_kind when enabled, does nothing otherwise, and returns nothing. Callers emit unconditionally; Tests: write nothing when disabled ( the privacy guarantee); writes one event with the envelope session_id when enabled. Docs: config.rs blurb.
With telemetry opted in, execute_hook now records events for each hook
pass through the record_telemetry gate:
- the wire funnel (session_start, user_prompt, tool_use, stop),
- sync_run when a sync ran,
- plugin/skill activation on SessionStart, and
- timed hook_invocation per hook.
PreToolUse stays silent so as a tool is counted once, on
PostToolUse.
To supply that, run_auto_sync now returns its SyncSummary (or None)
and dispatch_plugin_hooks returns the hook timings; telemetry_events
maps them to the event list. Nothing is written when telemetry is off,
and a blocking hook returns before emission.
I also split the oversized dispatch_plugin_hooks into:
- select_dispatch_hooks, run_plugin_hook, and intercept_hook_output.
Behavior is unchanged, checked branch-by-branch against the old
code and by the existing dispatch tests; the split also let me
unit-test the exit-2 block path.
Review nits folded in: renamed the shadowing sync param,
doc/typo fixes, a PreToolUse-still-records-invocations test, and
documented the blocked-pass gap.
Co-authored-by: Claude <claude@anthropic.com>
tests/telemetry_emit.rs drives the real hook pipeline and asserts events land on disk: wire funnel, SessionStart sync snapshot, opt-in gate, retention, and a golden sample of every kind Fixes: - roll_of was never called, so 30-day retention never ran. Now runs on SessionStart, ungated so data still ages out after opting out. - record_all opens the day file once per pass instead of per event. - hook_invocation now carries the exit code dispatch already computed. - sync_run.installed counts distinct skills created or updated. - Unknown event kinds now deserialize to a catch-all variant instead of being dropped. - A blocked hook (exit 2) recorded nothing; dispatch now returns the invocations it collected so the pass is still emitted, blocking hook included. - Added some good comments while there. Co-authored-by: Claude <claude@anthropic.com>
gme-muriuki
force-pushed
the
telemetry/243-emitting-events
branch
from
July 17, 2026 22:00
bfbba35 to
b86cd9c
Compare
gme-muriuki
marked this pull request as ready for review
July 17, 2026 22:04
Upstream renamed the `crates` predicate field to `depends-on`. Update the telemetry test fixtures and teh witness test's SKILL.md front matter to match. Ignore symposium-synced skills under .agents/skills Codex syncs plugin skills into .agents/skills/; ignore them and keep the hand-authored authoring-rfds skill tracked.
gme-muriuki
force-pushed
the
telemetry/243-emitting-events
branch
from
July 17, 2026 22:09
b86cd9c to
91885e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
closes #243
Makes the opt-in telemetry log (added in #251) record real activity. The hook pipeline now emits 8 anonymous event kinds (counts and coarse metadata only, no prompt text or file paths):
Symposium::record_telemetryis the single place[telemetry] enabledis checked. Off by default, local JSONL, nothing uploaded.Disclosure questions
AI disclosure.
Questions for reviewers.