Relationships
#1125 Telemetry silently dropped outside a swamp repo — lost events + undercounted scores
Opened by keeb · 7/13/2026· Shipped 7/14/2026
Summary
cli_invocation telemetry is only recorded when the resolved repo dir has a .swamp marker. Every command run outside a swamp repo emits nothing — no events reach the lake, and the activity never counts toward leaderboard score. Telemetry should be global (user-level), not repo-gated.
Root cause
src/cli/mod.ts:1060-1062—initTelemetryServicereturnsnullwhen the repo marker is absent ("Not in a swamp repo"), sotelemetryCtxstays null and noTelemetryServiceis wired (mod.ts:1186-1197).- The spool is also repo-local:
JsonTelemetryRepositorywrites to{repoDir}/.swamp/telemetry/telemetry-*.json(src/infrastructure/persistence/json_telemetry_repository.ts:35,43-44) — there is no global spool for repo-less runs. src/cli/commands/auth_login.ts(and other commands) have no telemetry emission of their own, so they inherit the gate.--repo-diris honored (mod.ts:1138-1139,getRepoDirFromArgs) but only helps when the target is a marked repo.
Steps to reproduce
- From any non-repo directory, run
swamp auth login(orswamp extension search foo,swamp version, etc.). - Observe: no
cli_invocationentry is written under any.swamp/telemetry/and nothing is flushed to the lake. - The user earns no score for that activity.
Blast radius
Any legitimately repo-less command drops its event: auth login, extension search/pull, model type describe, version, completions, repo init itself (no marker yet at run time), and any --repo-dir at a non-repo. Zero events → zero score. Users doing real work outside a repo are invisible and under-credited. Concretely: the new installer account prompt (install.sh runs swamp auth login pre-repo init) is completely untracked.
Already half-designed for this
The DTO reserves the repo-less state: src/domain/telemetry/invocation_context.ts:34-40 documents configuredAiTools: undefined as "recorded outside a swamp repo (forward-compat reserve; today initTelemetryService bails before recording in this case)." Identity is already global — UserIdentityRepository.getUserId() lazy-creates ~/.config/swamp/identity.json (mod.ts:1077-1078). Only the gate and the spool location block it.
Proposed fix (global telemetry)
- When no marker: still build a
TelemetryServicefrom the user-level identity,configuredAiTools: undefined, absent/sentinelrepoId. - Add a global spool (
~/.config/swamp/telemetry/, XDG) and drain it in the flush/sender alongside repo spools. - Add a user-level opt-out for the repo-less path (env or
~/.config/swampsetting);--no-telemetrystill applies. - Scoring needs no change — once events flow, repo-less activity counts automatically.
Environment
swamp @ 3ae8ded1 (latest dev).
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.