src/skills/builtin/history/SKILL.md
Search and retrieve exact messages from the conversation database using SQL queries — timestamps, keywords, sessions, counts
npx skillsauth add mcarcaso/phousevito keyword-history-searchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Direct SQL queries against the messages database (user/vito.db). Use this for precise, exact lookups — not fuzzy meaning-based recall.
Use this skill when:
Don't use this for: "What did we talk about regarding X?" — that's semantic-history-search.
| Column | Type | Description |
|--------|------|-------------|
| id | INTEGER | Auto-increment primary key |
| session_id | TEXT | e.g. dashboard:default, telegram:123456789 |
| channel | TEXT | dashboard, telegram, or discord |
| channel_target | TEXT | default, telegram chat ID, or discord channel ID |
| timestamp | INTEGER | Unix epoch in milliseconds |
| role | TEXT | user, assistant, system, or tool |
| content | JSON | Message content (JSON string — use json_extract or just cast) |
| compacted | INTEGER | 1 = compacted (knowledge extracted to memory docs) |
| archived | INTEGER | 1 = archived (old session, fully processed) |
| Column | Type | Description |
|--------|------|-------------|
| id | TEXT | Session ID (e.g. dashboard:default) |
| channel | TEXT | dashboard, telegram, or discord |
| channel_target | TEXT | Target identifier |
| created_at | INTEGER | Unix epoch ms |
| last_active_at | INTEGER | Unix epoch ms |
| config | JSON | Session-specific config |
SELECT datetime(timestamp/1000, 'unixepoch', 'localtime') as time,
role, substr(content, 1, 200) as preview
FROM messages
WHERE content LIKE '%keyword%'
AND role IN ('user', 'assistant')
ORDER BY timestamp DESC
LIMIT 20;
SELECT datetime(timestamp/1000, 'unixepoch', 'localtime') as time,
role, content
FROM messages
WHERE date(timestamp/1000, 'unixepoch', 'localtime') = '2026-02-13'
AND role IN ('user', 'assistant')
ORDER BY timestamp ASC;
SELECT datetime(timestamp/1000, 'unixepoch', 'localtime') as time,
role, content
FROM messages
WHERE timestamp BETWEEN strftime('%s', '2026-02-13 09:00:00', 'utc') * 1000
AND strftime('%s', '2026-02-13 12:00:00', 'utc') * 1000
AND role IN ('user', 'assistant')
ORDER BY timestamp ASC;
SELECT datetime(timestamp/1000, 'unixepoch', 'localtime') as time,
role, substr(content, 1, 200) as preview
FROM messages
WHERE channel = 'telegram'
AND role IN ('user', 'assistant')
ORDER BY timestamp DESC
LIMIT 30;
SELECT date(timestamp/1000, 'unixepoch', 'localtime') as day,
COUNT(*) as msg_count,
COUNT(DISTINCT session_id) as sessions
FROM messages
WHERE role IN ('user', 'assistant')
GROUP BY day
ORDER BY day DESC;
-- Step 1: Find matching messages
SELECT id, session_id, timestamp
FROM messages
WHERE content LIKE '%topic%' AND role IN ('user', 'assistant');
-- Step 2: Get context around a match (±10 messages in same session)
SELECT datetime(timestamp/1000, 'unixepoch', 'localtime') as time,
role, content
FROM messages
WHERE session_id = 'SESSION_ID_HERE'
AND id BETWEEN (MATCH_ID - 10) AND (MATCH_ID + 10)
AND role IN ('user', 'assistant')
ORDER BY timestamp ASC;
sqlite3 user/vito.db "YOUR QUERY HERE"
For multi-line or complex queries:
sqlite3 user/vito.db <<'EOF'
SELECT ...
FROM ...
WHERE ...;
EOF
datetime(timestamp/1000, 'unixepoch', 'localtime') for readable timesrole IN ('user', 'assistant') to skip tool calls/system messagessubstr(content, 1, 200) for previews to avoid dumping huge messagesdata-ai
Maintain and discover updates for user/profile.md — what belongs, how to edit, daily discovery sweeps, and refinement passes
tools
Browse the web, take screenshots, and extract content from web pages using Playwright MCP
tools
Generic MCP client bridge for skills — discover and call tools from MCP servers declared in SKILL.md frontmatter or passed as URLs
data-ai
How to update user/profile.md — what's profile-worthy, where to put it, when to clean up. Read this skill any time you're about to Edit profile.md.