docs/usage-analytics-rollout.md
This is the execution plan to add opt-in anonymous usage tracking to Flow with near-zero runtime overhead.
base trace API and store in a separate ClickHouse instance.Event kind: flow.command
Allowed fields:
install_id (random UUID, local)command_path (e.g. commit, skills.sync, setup.deploy)success (true/false)exit_code (integer or null)duration_ms (integer)flags_used (flag names only; e.g. ["sync","context"])flow_versionos, archinteractive (true/false)ci (true/false)project_fingerprint (optional HMAC; never raw path/remote)at timestampForbidden fields:
src/usage.rs
UsageConfigState (enabled/disabled/unknown, install_id, secret, last_prompt_at).~/.config/flow/usage-queue.jsonl.record_command_event(...).src/config.rs
[analytics] config:
enabled (true/false optional)endpoint (default http://127.0.0.1:7331/v1/trace)sample_rate (default 1.0)src/main.rs
usage::record_command_event.src/cli.rs and handler in new src/analytics.rs
f analytics statusf analytics enablef analytics disablef analytics exportf analytics purgesrc/lib.rs and command dispatch in src/main.rs.Validation:
cd ~/code/flow
cargo check
cargo run --bin f -- analytics status
src/main.rs, after first successful interactive command:
unknown and non-CI, prompt once:
~/.config/flow/analytics.toml.FLOW_ANALYTICS_FORCE=1 (self-test)FLOW_ANALYTICS_DISABLE=1 (hard off)Validation:
FLOW_ANALYTICS_FORCE=1 cargo run --bin f -- tasks
cargo run --bin f -- analytics status
src/usage.rs add flush_queue_async()
http://127.0.0.1:7331/v1/traceValidation:
f analytics status
# run a few commands
f tasks
f skills list
# then flush
f analytics export
Implement using base doc docs/flow-usage-tracking.md (added in parallel).
seqch in ~/code/org/linsa/base/crates/seqch-cli/src/main.rs
flowseqch flow commands --hours 24seqch flow flags --hours 24seqch flow failures --hours 24unknown -> enabled)FLOW_ANALYTICS_FORCE=1f analytics export).