Skip to content

I3296 — Each compaction is measured: the context before and after, from the provider's report

Record pre- and post-compaction token counts from the provider's own events (PreCompact/PostCompact and the compaction telemetry) against the episode, and derive the ratio and the time to the next compaction.

BLOCKED wave 2 · p3 · implementation profile · parallel safe

Part of every-sessions-usage-is-observed — What every AI session consumed is observed from the provider, attributed to the work it served, and never estimated into a fact.

Blocked. This issue cannot start until I3288 is done. The status is derived from that, not declared.

Objective

Record pre- and post-compaction token counts from the provider's own events (PreCompact/PostCompact and the compaction telemetry) against the episode, and derive the ratio and the time to the next compaction.

Why

Compression strategies are argued about and never measured; the episode boundary already sees every compaction (ADR 0015). The PreCompact hook carries no token counts and the compaction event is an unverified vendor claim; transcript parsing is rejected by ADR 0213. It extends milestone execution-telemetry. Proposed in ADR 0213 (Usage is observed through each provider's official telemetry into one provider-neutral record, and reported, estimated and billed amounts are never merged) (proposed; it carries no authority until the owner accepts it). Sources: chatgpt-majordomus:c236#4.

Current state

PreCompact is captured as an episode event; no token counts are kept.

Desired state

Compaction ratio per episode is a derived metric with its sample size.

Scope

  • apps/majordomus-cli/src/economics
  • lib/capture.sh

Dependencies

Acceptance criteria

  • A fixture compaction yields a ratio and both counts
  • A compaction without reported counts is recorded absent
  • Work starts only once a captured compaction event with pre- and post-token counts, from a dated client version, is a fixture; without it compaction counts are recorded absent and no transcript is parsed

Validation

  • bash test/run.sh 54_session_lifecycle_hooks
  • cargo test --manifest-path apps/majordomus-cli/Cargo.toml --test economics

Evidence required

  • case_compaction_is_measured

Evidence

None recorded. Every token above needs a command or an artifact behind it before this issue can be completed; narrative is refused.

Timeline

started
—
verified
—
completed
—

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I3296.yaml. Read it back with majordomus plan show I3296.

Searches the titles and descriptions of every page this site publishes.