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

#292 Add agent harness detection and AiTool to telemetry

Opened by keeb · 5/7/2026· Shipped 5/8/2026

Telemetry currently captures command, options (key-only), versions, platform, userId, and repoId, but it has no signal for the execution context: which AI agent (if any) launched swamp, whether the configured aiTool from .swamp.yaml matches the runtime tool, and whether the process is interactive. Without these fields we can't answer basic adoption questions like "what's the breakdown of agent-driven vs. manual usage," "are people running multiple agents in one repo," or "how much usage is headless/CI."

This feature would extend the telemetry payload with a small executionContext block populated at invocation time:

  • configuredAiTool — the aiTool value from the repo marker (.swamp.yaml), if a marker is present.
  • detectedAiTool — the agent harness inferred from environment variables at runtime (Claude Code, Cursor, Aider, Codex, Kiro, etc.), null if none detected.
  • isInteractiveDeno.stdin.isTerminal() result, so headless/CI usage is distinguishable.

Affected components:

  • src/domain/telemetry/command_invocation.ts and src/domain/telemetry/telemetry_entry.ts — extend the schema and entry construction.
  • src/domain/telemetry/telemetry_integration.ts — read the repo marker's aiTool, run harness detection, and stamp isInteractive on every TelemetryEntry.
  • A new detector module (e.g. src/domain/telemetry/agent_harness_detection.ts) that maps known env vars (CLAUDECODE, CURSOR_TRACE_ID / TERM_PROGRAM=cursor, etc.) to the canonical AiTool values used by the repo marker.
  • src/infrastructure/persistence/json_telemetry_repository.ts and the remote flush path — pass the new fields through verbatim.
  • Tests alongside each module, plus an integration test that exercises both "configured but not detected" and "detected differs from configured" cases.

Approach: the detection routine is a pure function over a Record<string, string> env snapshot, so it's trivial to unit test against fixtures for each supported harness. The repo-marker read already happens during CLI bootstrap — we hand the existing aiTool value through to telemetry rather than re-reading the file. isInteractive is captured once at process start. The receiver in swamp-club accepts opaque telemetry rows already (no schema gate), so this is additive on the transport side and does not require coordinated changes there.

Out of scope for this issue: dashboards or queries on top of the new fields. Those follow once data is flowing.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 3 MOREPR_MERGEDSHIPPED

Shipped

5/8/2026, 12:14:17 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
keeb assigned keeb5/7/2026, 11:11:18 PM

Sign in to post a ripple.