What problem does it solve?
ClawHub's Convex database accumulates ephemeral data such as auth sessions, refresh tokens, and metric events, and without enforced retention policies these tables grow unbounded. This Skill ensures every table is classified in a central retention policy file and that ephemeral tables get indexed, bounded cleanup paths.
Core Features & Use Cases
- Policy Enforcement: Requires every new schema table to be registered in
RETENTION_POLICIES in convex/lib/retentionPolicy.ts, with the Record<TableNames, RetentionPolicy> type acting as a compile-time gate.
- Bounded Cleanup Jobs: Guides creation of TTL fields, indexes, and cron-scheduled cleanup entrypoints that prune with
.withIndex() and .take(...) using RETENTION_STANDARD_BATCH_SIZE.
- Auth and Metrics Retention: Covers pruning of expired
authSessions and authRefreshTokens via convex/retention.ts, plus documented special cases like skillStatEvents.
- Use Case: When adding a new Convex table for rate-limit events, use this Skill to classify the table, add an
expirationTime field with an index, wire a bounded cron cleanup, and verify with focused Vitest tests and bunx convex codegen.
Quick Start
Ask the agent to add a retention policy and bounded cleanup cron for a new ephemeral Convex table following the ClawHub retention checklist.