feat: add Goose (aaif-goose/goose) session scanner
Merged
FR
6mo ago+371+371+012345678901234567890123456789-5-5-0123456789
Summary
- Adds support for Goose (aaif-goose/goose), an open-source AI coding agent with 43k+ stars, now part of the Agentic AI Foundation (AAIF) at the Linux Foundation.
- Parses token usage from Goose's SQLite
sessions.db, extracting model name frommodel_config_json, provider fromprovider_name, and accumulated token counts per session.
Data Location
The scanner checks multiple paths in order:
$GOOSE_PATH_ROOT/data/sessions/sessions.db(env var override)~/.local/share/goose/sessions/sessions.db(aaif-goose fork, primary)~/Library/Application Support/goose/sessions/sessions.db(macOS)~/Library/Application Support/Block/goose/sessions/sessions.db(legacy Block/goose macOS)~/.local/share/Block/goose/sessions/sessions.db(legacy Block/goose Linux)
Files Changed
crates/tokscale-core/src/clients.rs—Goose = 18entry indefine_clients!macrocrates/tokscale-core/src/sessions/goose.rs— New SQLite parsercrates/tokscale-core/src/sessions/mod.rs—pub mod goosecrates/tokscale-core/src/scanner.rs— DB discovery with multi-path fallbackcrates/tokscale-core/src/lib.rs— Parser wiring in both parse pathscrates/tokscale-cli/src/main.rs—--gooseCLI flagcrates/tokscale-cli/src/tui/client_ui.rs— TUI entry with hotkeyocrates/tokscale-cli/src/tui/ui/widgets.rs— Goose colorcrates/tokscale-cli/src/tui/data/mod.rs— Client count updatecrates/tokscale-cli/src/commands/wrapped.rs— Display name mapping
Closes #456
Summary by cubic
Adds a Goose session scanner to track token usage from Goose’s SQLite sessions.db, with multi-path discovery and pricing. Adds CLI and TUI support for filtering and viewing Goose sessions; closes #456.
-
New Features
- Parses model from
model_config_json, provider fromprovider_name, and accumulated input/output/total tokens per session; infers reasoning tokens when present. - DB discovery order:
$GOOSE_PATH_ROOT/data/sessions/sessions.db,~/.local/share/goose/sessions/sessions.db,~/Library/Application Support/goose/sessions/sessions.db, plus legacy Block paths. - Integrates Goose into
tokscale-coreparsing and pricing; updates client registry and counts. - Adds
--goosefilter intokscale-cli, TUI entry with hotkeyo, display name mapping, color, and logo URL.
- Parses model from
-
Bug Fixes
- Uses i64 for token counts to prevent overflow.
- More robust timestamp parsing (RFC3339, SQLite formats) with correct ms conversion.
- Validates discovered paths with
is_fileto avoid false positives.