Skip to main content

Module usage

Module usage 

Source
Expand description

CLI usage telemetry (src/asdecided/usage.py) — ADR-046, content-free, consent-gated, local-only.

Two halves, both consent-shaped:

  • the READ-BACK (decided usage): a unified summary over the CLI-usage log ($XDG_STATE_HOME/decisions/decided-usage.jsonl) and the Guide log (via telemetry::summarize), with no consent gate on reads;
  • the RECORDER: one content-free event appended after every dispatched command, if and only if consent is recorded (decided telemetry on). Write-only observability: silent on every failure path, never alters output or exit codes, and skipped entirely for parse-level exits (argparse errors, --version/-h) exactly like the oracle’s cli.main, which computes the command name only after parse_args returns.

The recorder’s bytes (wall-clock ts, per-process random session id, measured duration) are nondeterministic by design and never byte-refereed; the read-back over SEEDED logs is what parity pins.

Structs§

CommandUsage
UsageSummary

Constants§

OUTCOME_ERROR
OUTCOME_OK
SCHEMA_VERSION
SHARE_FIELD
SHARE_ISSUE_URL
SHARE_TEMPLATE

Functions§

cli_value
UsageSummary.to_dict() — pinned key order.
combined_value
_combined(summary, guide) — the usage --json/--share payload. Unlike mcp-stats’ share report, the guide dict keeps its path.
record_command
Append one content-free usage event, if consent is recorded (ADR-046). Silent on every failure path — no consent, no command name, or an unwritable log all mean “record nothing”.
share_url
The prefilled GitHub issue URL — the FULL combined report, including guide.path (usage does not strip the path; mcp-stats does).
summarize_usage
Per-command counts, session count, and a recent-activity trend.
usage_path
Location of the CLI-usage log (separate from the Guide log, ADR-046).