Skip to content

Telemetry/243 emitting events#261

Open
gme-muriuki wants to merge 6 commits into
symposium-dev:mainfrom
gme-muriuki:telemetry/243-emitting-events
Open

Telemetry/243 emitting events#261
gme-muriuki wants to merge 6 commits into
symposium-dev:mainfrom
gme-muriuki:telemetry/243-emitting-events

Conversation

@gme-muriuki

Copy link
Copy Markdown
Contributor

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):

  • the wire funnel (session start, prompt, tool use, stop), the sync pass (which plugins and skills activated, and the crates that triggered them), and hook dispatch.
  • Producers return plain data, a pure mapping turns it into events, and Symposium::record_telemetry is the single place [telemetry] enabled is checked. Off by default, local JSONL, nothing uploaded.
Disclosure questions

AI disclosure.

  • I used an AI tool for research, autocomplete, or in other minimal ways
  • The AI tool authored large parts of the code

Questions for reviewers.

@gme-muriuki
gme-muriuki force-pushed the telemetry/243-emitting-events branch from 9c4030a to d8bafee Compare July 13, 2026 16:20
gme-muriuki and others added 5 commits July 17, 2026 22:01
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
gme-muriuki force-pushed the telemetry/243-emitting-events branch from bfbba35 to b86cd9c Compare July 17, 2026 22:00
@gme-muriuki
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
gme-muriuki force-pushed the telemetry/243-emitting-events branch from b86cd9c to 91885e6 Compare July 17, 2026 22:09
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.

Telemetry: Emitting events

1 participant