Skip to content

refactor(cli): the telemetry path depends on a telemetry declaration, not on a whole tool #696

Description

@blafourcade

Context

The plugin ships a generated reporter. It is one build of one source tree — a test asserts it answers byte-identical JSON to the CLI — but at 144 KB it is long enough to read as a second copy of the CLI, and it lands in the diff of every commit that touches the domain.

The marketplace sources plugins straight from this repository ("source": "./plugins/aidd-telemetry"), so the artefact must be committed: a user running /plugin marketplace add gets what is in the tree, with no build step. Not committing it is not an option; making it small is.

Measured, by module

 24,336  16%  domain/capabilities/marketplace-entry.ts
 12,123   8%  domain/tools/ai/copilot.ts
  8,567   5%  domain/tools/ai/codex.ts
  6,017   4%  domain/tools/ai/opencode.ts
  5,310   3%  domain/tools/ai/claude.ts
  5,294   3%  domain/tools/ai/cursor.ts
  4,022   2%  domain/capabilities/plugins-capability.ts
  3,978   2%  domain/capabilities/agents-capability.ts

Marketplace formats are sixteen percent of a script that reads a transcript. Over half the file is machinery for installing plugins.

Why it is there

Reading a session asks getAiToolConfig(tool), which answers with the tool's whole definition — rewriteContent, plugin capabilities, marketplace entry shapes, agent and command layouts. The telemetry path needs three declarations out of it: telemetryExport, telemetryLocalRead, telemetryJournalHost and telemetryTaskAttributable.

So the reporter is not a copy of the CLI by design. It is one by accident, and the accident is a dependency edge nobody meant to draw.

Expected

A measurement path that depends on what a tool declares about measurement, and on nothing about installing it. The bundle shrinks as a consequence rather than as the goal.

Acceptance

  • Nothing on the telemetry path reaches a tool's install-time definition — no marketplace entry, no plugin capability, no content rewriting.
  • Adding a tool is still one declaration, and the declarations stay in the tool's own file where they are read beside the rest of it.
  • The per-route conformance checks still run against captured files; this changes where a declaration is read, never what it claims.
  • The bundle's composition is asserted, not hoped for: a module that has no business in a reader fails the build rather than being noticed in a diff months later.
  • The reporter and the CLI still answer byte-identical JSON.

Why it matters beyond size

A diff that rewrites four thousand generated lines on every domain change is a review blind spot and a merge-conflict magnet. That cost is paid on every commit, forever, and it is the reason this is worth doing before the file grows again.

Relations

Field Value
parent #631
related #691, #687

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions