Skip to main content

Module usage

Module usage 

Source
Expand description

usage_events writer + tool_scores aggregator. Phase 4.

insert_event is idempotent on uuid — re-running toolhub score on the same JSONL files MUST NOT double-count. recompute_scores rebuilds tool_scores from scratch (DELETE + INSERT inside a transaction): the table is a derived projection, so a clean rebuild is simpler than incremental updates and stays correct as usage_events evolves.

Structs§

EventRow

Functions§

count_events
dead_weight
Tools that have NOT been used in the last older_than_days days.
insert_event
INSERT OR IGNORE — returns true if the row was new, false if uuid collided with an existing event. Events without uuid are always inserted (no dedupe key), so callers should prefer to set uuid whenever possible.
last_used
Most-recent occurred_at for a tool, used by stats --tool.
list_events
recompute_scores
Rebuild tool_scores from usage_events. Returns the number of tool rows written. Intended to be called after a batch of insert_event calls.