Documentation
¶
Overview ¶
Package usage records the SHAPE of MCP tool calls (which product/tool, which argument keys, and a redacted sample of ID/enum-like values) so that the shortcut layer can later mine high-frequency patterns and suggest distilling them into custom shortcuts (see docs/shortcut-p2-design.md).
Privacy first: free-text / content / credential values are NEVER recorded — only argument KEYS plus short, whitespace-free ID/enum-like values. Tracking is OFF by default (opt-in): enable it with DWS_USAGE_TRACKING=1 (or true/on/yes). When enabled it announces itself once on first use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append records one tool call. It never blocks or fails the caller: any error (disabled, unwritable dir, marshal issue) is swallowed. dryRun calls are skipped — they are not real usage.
func Enabled ¶
func Enabled() bool
Enabled reports whether usage tracking is active. Default OFF (opt-in): local telemetry — even shape-only — should not be on without the user's explicit consent. Enable by setting DWS_USAGE_TRACKING to 1/true/on/yes (case-insensitive).
func NewShortcutCommand ¶
NewShortcutCommand builds the `dws shortcut` management command tree:
dws shortcut list [--service x] # list built-in shortcuts dws shortcut stats [--top N] # high-frequency usage aggregation dws shortcut stats --purge # clear the usage log
Types ¶
type Group ¶
type Group struct {
Product string `json:"product"`
Tool string `json:"tool"`
ArgKeys []string `json:"arg_keys"`
Count int `json:"count"`
OKCount int `json:"ok_count"`
LastSeen string `json:"last_seen"`
// FixedArgs are argument keys whose sampled value was identical across every
// occurrence — strong candidates to bake into a custom shortcut as constants.
FixedArgs map[string]string `json:"fixed_args,omitempty"`
}
Group aggregates records that share the same (product, tool, arg_keys) shape — the unit a custom shortcut would capture.
type Record ¶
type Record struct {
TS string `json:"ts"`
Product string `json:"product"`
Tool string `json:"tool"`
ArgKeys []string `json:"arg_keys,omitempty"`
SampleArgs map[string]string `json:"sample_args,omitempty"`
OK bool `json:"ok"`
}
Record is one line in usage.jsonl. It captures the call shape, not its data.