timeline-cleanup
GitHub按关键词模式清理时间线中的低价值消息,默认保护含附件的消息。支持自定义或内置模式组,提供节流、重试及数据库真空选项,返回清理统计结果。
Trigger Scenarios
Install
npx skills add rcarmo/piclaw --skill timeline-cleanup -g -y
SKILL.md
Frontmatter
{
"name": "timeline-cleanup",
"description": "Delete low-value messages from the web timeline by keyword patterns. Protects messages with user-uploaded images. Optionally vacuums the DB afterward.",
"distribution": "private"
}
Timeline Cleanup
Delete low-value timeline messages by pattern, with attachment protection by default.
Default chat scope:
- if
chatJidis omitted, the cleanup targetsweb:default - for
web:*chats, the helper resolves the full web session scope (root chat plus branches)
Usage
Cleanup is available both as an import and as a CLI.
Import
import { cleanupTimeline } from "/workspace/.pi/skills/timeline-cleanup/cleanup.ts";
const result = await cleanupTimeline({
patterns: ["reload", "compaction"],
// dryRun: true,
// includeMedia: false,
// vacuum: false,
// beforeRowid: 99999,
// chatJid: "web:default",
// maxLength: 300,
// senderFilter: "web-agent",
// throttleMs: 1100,
// retryOn429: true,
// maxRetries: 2,
});
CLI
bun run /workspace/.pi/skills/timeline-cleanup/cleanup.ts \
--patterns "reload,compaction,compacting" \
--before 5000 \
--dry-run
Result shape
cleanupTimeline() returns a CleanupResult shaped like:
{
matched: number,
skipped: number,
deleted: number,
failed: number,
dbSizeBefore: string,
dbSizeAfter: string
}
cleanupAll() returns a record of those per built-in pattern group.
Built-in pattern groups
Use cleanupAll() for a full housekeeping pass:
import { cleanupAll } from "/workspace/.pi/skills/timeline-cleanup/cleanup.ts";
const results = await cleanupAll({ beforeRowid: 5000, dryRun: true });
| Group | Patterns | Sender | Max length |
|---|---|---|---|
| Reloads | reload, supervisorctl restart, restart-piclaw, local-install, bun pm pack |
any | 500 |
| Compaction | compaction, compacting, auto-compact |
any | 500 |
| Greetings (user) | exact: hey, hello, hi, Hello?, hey there, etc. |
user | 30 |
| Agent intros | Hey! ..., Hello! ..., good to see you, ready to help |
agent | 300 |
| Slash commands | lines starting with / |
any | 50 |
| Slash responses | Unknown command:, Current model:, Switched...model, Switching...model, Model switched, Cycle model, Cycle thinking, Thinking level, Thinking set, Supports thinking |
agent | 300 |
| One-word acks | exact: yes, ok, go, done, well?, so?, etc. |
any | 30 |
| Transition filler | let me check, let me look, now let me, etc. |
agent | 200 |
| Version bumps | bumped version, tagged v0., bump patch |
any | 300 |
| Build/lint/test | make lint, make test, bun run build, pass...0 fail |
any | 300 |
| Git operations | git add, git commit -m, git push, git status |
any | 200 |
| Package installs | bun install, bun add, bun update, packages installed |
any | 300 |
Behaviour
- delete operations are throttled by default (
1100ms) with optional retry on HTTP 429 responses - media-bearing messages are skipped unless
--include-mediais set - vacuuming is optional and only makes sense after actual deletions
Vacuum
Vacuuming requires exclusive DB access. The helper can copy the DB to /tmp, vacuum the copy, swap it in, and restart piclaw briefly.
Environment
PICLAW_STORE— message DB parent directory (default/workspace/.piclaw/store)PICLAW_WEB_PORT— web server port (default8080)PICLAW_INTERNAL_SECRET/PICLAW_WEB_INTERNAL_SECRET— internal API auth
Related
close-of-dayuses the same cleanup strategy as part of end-of-day maintenance.
Version History
- 5fa0ce5 Current 2026-07-25 10:26


