Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneeskeeb

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-1062initTelemetryService returns null when the repo marker is absent ("Not in a swamp repo"), so telemetryCtx stays null and no TelemetryService is wired (mod.ts:1186-1197).
  • The spool is also repo-local: JsonTelemetryRepository writes 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-dir is honored (mod.ts:1138-1139, getRepoDirFromArgs) but only helps when the target is a marked repo.

Steps to reproduce

  1. From any non-repo directory, run swamp auth login (or swamp extension search foo, swamp version, etc.).
  2. Observe: no cli_invocation entry is written under any .swamp/telemetry/ and nothing is flushed to the lake.
  3. 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)

  1. When no marker: still build a TelemetryService from the user-level identity, configuredAiTools: undefined, absent/sentinel repoId.
  2. Add a global spool (~/.config/swamp/telemetry/, XDG) and drain it in the flush/sender alongside repo spools.
  3. Add a user-level opt-out for the repo-less path (env or ~/.config/swamp setting); --no-telemetry still applies.
  4. Scoring needs no change — once events flow, repo-less activity counts automatically.

Environment

swamp @ 3ae8ded1 (latest dev).

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 9 MOREFINDINGS+ 5 MOREPR_MERGED+ 1 MORENOTIFICATION_SKIPPED

Shipped

7/14/2026, 1:13:01 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
keeb assigned keeb7/13/2026, 11:03:52 PM

Sign in to post a ripple.