Query the worklog database for context, knowledge, errors, and history
/plugin marketplace add gaurangrshah/gsc-plugins/plugin install appgen@gsc-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Query the worklog database to retrieve context, knowledge, and history.
/worklog-init first)DATABASE_URL or PGHOST environment variables| Scenario | Query Type |
|---|---|
| Starting a task | Boot queries for relevant context |
| Debugging an error | Search error_patterns |
| Making a decision | Check knowledge_base for precedents |
| Continuing previous work | Query entries and memories |
| Learning about a topic | Search across all tables |
# Check which backend is configured
if [ -n "$DATABASE_URL" ] || [ -n "$PGHOST" ]; then
echo "Backend: PostgreSQL"
else
echo "Backend: SQLite"
fi
Default database path: ~/.claude/worklog/worklog.db
DB="${WORKLOG_DB_PATH:-$HOME/.claude/worklog/worklog.db}"
# Protocols
sqlite3 "$DB" "SELECT title FROM knowledge_base WHERE is_protocol=1 ORDER BY updated_at DESC LIMIT 5;"
# Recent work (24h)
sqlite3 "$DB" "SELECT agent, title FROM entries WHERE timestamp > datetime('now', '-1 day') ORDER BY timestamp DESC LIMIT 5;"
# Items flagged for me
sqlite3 "$DB" "SELECT title FROM entries WHERE tags LIKE '%for:claude%' AND timestamp > datetime('now', '-7 days');"
# By topic
sqlite3 "$DB" "SELECT id, title FROM knowledge_base WHERE title LIKE '%topic%' OR content LIKE '%topic%' ORDER BY updated_at DESC LIMIT 10;"
# By category
sqlite3 "$DB" "SELECT title, content FROM knowledge_base WHERE category = 'development' ORDER BY updated_at DESC LIMIT 10;"
# Protocols only
sqlite3 "$DB" "SELECT title, content FROM knowledge_base WHERE is_protocol = 1 ORDER BY updated_at DESC;"
# By agent
sqlite3 "$DB" "SELECT timestamp, title, outcome FROM entries WHERE agent = 'claude' ORDER BY timestamp DESC LIMIT 20;"
# By task type
sqlite3 "$DB" "SELECT timestamp, agent, title FROM entries WHERE task_type = 'debugging' ORDER BY timestamp DESC LIMIT 10;"
# Recent across all agents
sqlite3 "$DB" "SELECT timestamp, agent, title FROM entries ORDER BY timestamp DESC LIMIT 20;"
# By error text
sqlite3 "$DB" "SELECT error_signature, resolution FROM error_patterns WHERE error_message LIKE '%error text%' LIMIT 5;"
# By platform
sqlite3 "$DB" "SELECT error_signature, resolution FROM error_patterns WHERE platform = 'macos' ORDER BY id DESC LIMIT 10;"
# By key
sqlite3 "$DB" "SELECT content FROM memories WHERE key = 'ctx_agent_date_slug';"
# High importance
sqlite3 "$DB" "SELECT key, summary FROM memories WHERE importance >= 7 ORDER BY importance DESC LIMIT 10;"
# Active memories
sqlite3 "$DB" "SELECT key, summary FROM memories WHERE status != 'archived' ORDER BY importance DESC LIMIT 10;"
For multi-system setups with shared database.
# Protocols
psql -t -c "SELECT title FROM knowledge_base WHERE is_protocol=true ORDER BY updated_at DESC LIMIT 5;"
# Recent work (24h)
psql -t -c "SELECT agent, title FROM entries WHERE timestamp > NOW() - INTERVAL '1 day' ORDER BY timestamp DESC LIMIT 5;"
# Items flagged for me
psql -t -c "SELECT title FROM entries WHERE tags LIKE '%for:claude%' AND timestamp > NOW() - INTERVAL '7 days';"
# By topic (ILIKE for case-insensitive)
psql -t -c "SELECT id, title FROM knowledge_base WHERE title ILIKE '%topic%' OR content ILIKE '%topic%' ORDER BY updated_at DESC LIMIT 10;"
# By category
psql -t -c "SELECT title, content FROM knowledge_base WHERE category = 'development' ORDER BY updated_at DESC LIMIT 10;"
# Protocols only
psql -t -c "SELECT title, content FROM knowledge_base WHERE is_protocol = true ORDER BY updated_at DESC;"
# By agent
psql -t -c "SELECT timestamp, title, outcome FROM entries WHERE agent = 'claude' ORDER BY timestamp DESC LIMIT 20;"
# By task type
psql -t -c "SELECT timestamp, agent, title FROM entries WHERE task_type = 'debugging' ORDER BY timestamp DESC LIMIT 10;"
# Recent across all agents
psql -t -c "SELECT timestamp, agent, title FROM entries ORDER BY timestamp DESC LIMIT 20;"
# By error text
psql -t -c "SELECT error_signature, resolution FROM error_patterns WHERE error_message ILIKE '%error text%' LIMIT 5;"
# By platform
psql -t -c "SELECT error_signature, resolution FROM error_patterns WHERE platform = 'macos' ORDER BY id DESC LIMIT 10;"
# By key
psql -t -c "SELECT content FROM memories WHERE key = 'ctx_agent_date_slug';"
# High importance
psql -t -c "SELECT key, summary FROM memories WHERE importance >= 7 ORDER BY importance DESC LIMIT 10;"
# Active memories
psql -t -c "SELECT key, summary FROM memories WHERE status != 'archived' ORDER BY importance DESC LIMIT 10;"
The MCP server automatically uses the correct backend:
# Search across tables
search_knowledge(query="topic", tables="knowledge_base,entries")
# Get context for a task
recall_context(topic="docker deployment", min_importance=5)
# Query specific table
query_table(table="entries", where="agent='claude'", limit=10)
# Get recent entries
get_recent_entries(days=7, limit=20)
| Feature | SQLite | PostgreSQL |
|---|---|---|
| Case-insensitive | LIKE (default) | ILIKE |
| Days ago | datetime('now', '-7 days') | NOW() - INTERVAL '7 days' |
| Boolean | 1 / 0 | true / false |
| Last insert ID | last_insert_rowid() | RETURNING id |
sqlite3 "$DB" "
SELECT 'knowledge' as source, title, substr(content, 1, 100) as preview
FROM knowledge_base WHERE content LIKE '%term%'
UNION ALL
SELECT 'entry' as source, title, outcome as preview
FROM entries WHERE details LIKE '%term%'
LIMIT 20;"
psql -t -c "
SELECT 'knowledge' as source, title, substring(content, 1, 100) as preview
FROM knowledge_base WHERE content ILIKE '%term%'
UNION ALL
SELECT 'entry' as source, title, outcome as preview
FROM entries WHERE details ILIKE '%term%'
LIMIT 20;"
When presenting recalled information:
## Prior Knowledge Found
### From Knowledge Base
**{title}** (Category: {category})
{content_excerpt}
### From Work History
- {timestamp}: {title} → {outcome}
### Relevant Error Patterns
**{error_signature}**
Resolution: {resolution}
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.