Store knowledge, entries, errors, and context in the worklog database
/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.
Store information in the worklog database for cross-session persistence.
/worklog-init first)DATABASE_URL or PGHOST environment variables| Type | Table | When |
|---|---|---|
| Reusable learnings | knowledge_base | Patterns, gotchas, anti-patterns |
| Work completion | entries | After significant tasks |
| Error resolutions | error_patterns | When you solve a tricky error |
| Working context | memories | Session state, decisions in progress |
| Issues found | issues | Bugs, problems to track |
| Type | Why Not | Alternative |
|---|---|---|
| In-progress tasks | Transient | Use TodoWrite |
| Obvious code behavior | Documented in code | None needed |
| Already in files | Redundant | Reference the file |
| Trivial changes | No reuse value | None needed |
if [ -n "$DATABASE_URL" ] || [ -n "$PGHOST" ]; then
echo "Backend: PostgreSQL (use psql)"
else
echo "Backend: SQLite (use sqlite3)"
fi
Default database path: ~/.claude/worklog/worklog.db
DB="${WORKLOG_DB_PATH:-$HOME/.claude/worklog/worklog.db}"
sqlite3 "$DB" "INSERT INTO knowledge_base
(category, title, content, tags, source_agent, system) VALUES (
'development',
'Title of the knowledge',
'Content with problem, solution, examples',
'system:shared,agent:claude,topic:example',
'claude',
'$(hostname)'
);"
sqlite3 "$DB" "INSERT INTO entries
(agent, task_type, title, details, decision_rationale, outcome, tags) VALUES (
'claude',
'debugging',
'Fixed authentication bug',
'User sessions were expiring prematurely',
'Root cause was timezone mismatch',
'Sessions now persist correctly',
'system:$(hostname),agent:claude,topic:auth'
);"
sqlite3 "$DB" "INSERT INTO memories
(key, content, summary, memory_type, importance, source_agent, tags) VALUES (
'ctx_claude_20251222_project_context',
'Detailed content here',
'Brief summary',
'context',
7,
'claude',
'system:$(hostname),agent:claude'
);"
sqlite3 "$DB" "INSERT INTO error_patterns
(error_signature, error_message, platform, language, root_cause, resolution, tags) VALUES (
'ECONNREFUSED',
'connect ECONNREFUSED 127.0.0.1:5432',
'all',
'all',
'PostgreSQL not running',
'Start PostgreSQL: brew services start postgresql',
'topic:postgresql,topic:connection'
);"
sqlite3 "$DB" "INSERT INTO issues
(project, title, description, status, tags, source_agent) VALUES (
'my-project',
'API rate limiting needed',
'Users can make unlimited requests',
'open',
'topic:api,topic:security',
'claude'
);"
For multi-system setups with shared database.
psql -c "INSERT INTO knowledge_base
(category, title, content, tags, source_agent, system) VALUES (
'development',
'Title of the knowledge',
'Content with problem, solution, examples',
'system:shared,agent:claude,topic:example',
'claude',
'$(hostname)'
);"
psql -c "INSERT INTO entries
(agent, task_type, title, details, decision_rationale, outcome, tags) VALUES (
'claude',
'debugging',
'Fixed authentication bug',
'User sessions were expiring prematurely',
'Root cause was timezone mismatch',
'Sessions now persist correctly',
'system:$(hostname),agent:claude,topic:auth'
);"
psql -c "INSERT INTO memories
(key, content, summary, memory_type, importance, source_agent, tags) VALUES (
'ctx_claude_20251222_project_context',
'Detailed content here',
'Brief summary',
'context',
7,
'claude',
'system:$(hostname),agent:claude'
);"
psql -c "INSERT INTO error_patterns
(error_signature, error_message, platform, language, root_cause, resolution, tags) VALUES (
'ECONNREFUSED',
'connect ECONNREFUSED 127.0.0.1:5432',
'all',
'all',
'PostgreSQL not running',
'Start PostgreSQL: brew services start postgresql',
'topic:postgresql,topic:connection'
);"
psql -c "INSERT INTO issues
(project, title, description, status, tags, source_agent) VALUES (
'my-project',
'API rate limiting needed',
'Users can make unlimited requests',
'open',
'topic:api,topic:security',
'claude'
);"
The MCP server automatically uses the correct backend:
# Store a memory
store_memory(
key="ctx_claude_20251222_project",
content="Detailed content",
summary="Brief summary",
memory_type="context",
importance=7,
tags="system:shared,agent:claude"
)
# Log work entry
log_entry(
title="Fixed authentication bug",
task_type="debugging",
details="User sessions were expiring prematurely",
outcome="Sessions now persist correctly",
tags="system:shared,agent:claude,topic:auth"
)
# Store knowledge
store_knowledge(
category="development",
title="React useEffect cleanup",
content="Always return cleanup function...",
tags="topic:react,topic:hooks"
)
Knowledge Base Categories:
system-administration, development, infrastructure, decisions, projects, protocols
Task Types:
configuration, deployment, debugging, documentation, research, maintenance, handoff
Memory Types:
fact, entity, preference, context
Platforms:
linux, macos, docker, nas, all
Languages:
python, typescript, bash, go, rust, all
Always include structured tags:
system:{system_name},agent:{agent_name},topic:{topic1},topic:{topic2}
Examples:
system:my-laptop,agent:claude,topic:docker,topic:networkingsystem:shared,agent:claude,type:protocol,topic:sqlite**Problem:** What was the issue
**Solution:** How to solve it
**Commands:**
```bash
example commands
Notes: Gotchas, warnings
---
## SQL Syntax Reference
| Feature | SQLite | PostgreSQL |
|---------|--------|------------|
| Boolean | `1` / `0` | `true` / `false` |
| Auto-increment | `INTEGER PRIMARY KEY` | `SERIAL` |
| Current time | `CURRENT_TIMESTAMP` | `CURRENT_TIMESTAMP` |
---
## Complete Example
### SQLite
```bash
DB="${WORKLOG_DB_PATH:-$HOME/.claude/worklog/worklog.db}"
sqlite3 "$DB" "INSERT INTO knowledge_base
(category, title, content, tags, source_agent, system, is_protocol) VALUES (
'development',
'React useEffect cleanup pattern',
'**Problem:** Memory leaks from uncleared intervals
**Solution:** Return cleanup function from useEffect
**Code:**
\`\`\`typescript
useEffect(() => {
const id = setInterval(tick, 1000);
return () => clearInterval(id);
}, []);
\`\`\`
**Notes:** Also applies to event listeners, subscriptions',
'system:shared,agent:claude,topic:react,topic:hooks,type:pattern',
'claude',
'$(hostname)',
0
);"
psql -c "INSERT INTO knowledge_base
(category, title, content, tags, source_agent, system, is_protocol) VALUES (
'development',
'React useEffect cleanup pattern',
'**Problem:** Memory leaks from uncleared intervals
**Solution:** Return cleanup function from useEffect
**Code:**
\`\`\`typescript
useEffect(() => {
const id = setInterval(tick, 1000);
return () => clearInterval(id);
}, []);
\`\`\`
**Notes:** Also applies to event listeners, subscriptions',
'system:shared,agent:claude,topic:react,topic:hooks,type:pattern',
'claude',
'$(hostname)',
false
);"
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.