Initialize worklog database for cross-session persistence (primary system setup)
Sets up the worklog database for cross-session knowledge persistence. Choose SQLite for local storage or PostgreSQL for shared multi-system access.
/plugin marketplace add gaurangrshah/gsc-plugins/plugin install appgen@gsc-pluginsInitialize the worklog plugin for cross-session knowledge persistence.
This command sets up the worklog database on your system. Choose between:
Which database backend would you like to use?
[A] SQLite (Recommended for most users)
- Local database at ~/.claude/worklog/worklog.db
- No external dependencies
- Works offline
- Single system use
[B] PostgreSQL (For multi-system setups)
- Shared database across systems
- Requires PostgreSQL server
- Enables cross-agent collaboration
- Requires network connectivity
[1] MINIMAL - Lightweight persistence
[2] STANDARD - Balanced integration (Recommended)
[3] FULL - Maximum context awareness
# Create directory
mkdir -p ~/.claude/worklog
# Database will be auto-created by the MCP server on first use
# Or create manually with schema:
sqlite3 ~/.claude/worklog/worklog.db < {plugin_root}/schema/core.sql
# Optional: Set custom database path
export WORKLOG_DB_PATH=~/.claude/worklog/worklog.db
# Or use default (no config needed)
Same options as SQLite (MINIMAL, STANDARD, FULL)
How would you like to configure the PostgreSQL connection?
[A] DATABASE_URL (Recommended)
Single environment variable with full connection string
[B] Individual PG* variables
Separate PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD
Option A - DATABASE_URL:
# Add to ~/.zshrc or ~/.bashrc:
export DATABASE_URL="postgresql://user:password@host:port/database"
# Then run: source ~/.zshrc
Option B - Individual Variables:
# Add to ~/.zshrc or ~/.bashrc:
export PGHOST=your-host
export PGPORT=5432
export PGDATABASE=worklog
export PGUSER=worklog
export PGPASSWORD="your-password"
# Then run: source ~/.zshrc
psql -c "SELECT 1;"
Before making ANY changes, backup existing files:
BACKUP_TS=$(date +%Y%m%d%H%M%S)
BACKUP_DIR=~/.claude/.worklog-backup-$BACKUP_TS
mkdir -p $BACKUP_DIR
# Backup CLAUDE.md if exists
if [ -f ~/.claude/CLAUDE.md ]; then
cp ~/.claude/CLAUDE.md $BACKUP_DIR/CLAUDE.md
echo "Backed up: CLAUDE.md"
fi
# Backup existing config if exists
if [ -f ~/.claude/worklog.local.md ]; then
cp ~/.claude/worklog.local.md $BACKUP_DIR/worklog.local.md
echo "Backed up: worklog.local.md"
fi
echo $BACKUP_DIR > ~/.claude/.worklog-backup-path
Create .claude/worklog.local.md:
---
profile: {selected_profile}
hook_mode: {selected_hook_mode}
backend: {sqlite|postgresql}
db_path: ~/.claude/worklog/worklog.db # for SQLite
# database_url: postgresql://... # for PostgreSQL
system_name: {hostname}
initialized: {timestamp}
---
# Worklog Configuration
## Backend
- **Type:** {backend}
- **Path/URL:** {path_or_url}
## Settings
- **Profile:** {profile}
- **Hook Mode:** {hook_mode}
To reconfigure, run `/worklog-configure`.
Read appropriate template from {plugin_root}/templates/ based on profile:
minimal.md for MINIMAL profilestandard.md for STANDARD profilefull.md for FULL profileReplace {DB_PATH} or {DATABASE_URL} placeholders with actual values.
For SQLite, boot queries use sqlite3:
sqlite3 ~/.claude/worklog/worklog.db "SELECT ..."
For PostgreSQL, boot queries use psql:
psql -c "SELECT ..."
SQLite Verification:
DB=~/.claude/worklog/worklog.db
[ -f "$DB" ] && echo "Database: ✅" || echo "Database: ❌"
sqlite3 "$DB" "SELECT COUNT(*) FROM sqlite_master WHERE type='table';" && echo "Schema: ✅"
grep -q "WORKLOG_START" ~/.claude/CLAUDE.md && echo "CLAUDE.md: ✅" || echo "CLAUDE.md: ❌"
PostgreSQL Verification:
psql -c "SELECT 1;" && echo "Connection: ✅" || echo "Connection: ❌"
psql -c "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public';" && echo "Schema: ✅"
grep -q "WORKLOG_START" ~/.claude/CLAUDE.md && echo "CLAUDE.md: ✅" || echo "CLAUDE.md: ❌"
Installation complete!
Backend: {sqlite|postgresql}
Profile: {profile}
Hook: {hook_mode}
Changes made:
- Created: ~/.claude/worklog.local.md
- Updated: ~/.claude/CLAUDE.md
{If SQLite: - Created: ~/.claude/worklog/worklog.db}
Keep these changes? (y/n)
If YES: Finalize installation If NO: Rollback from backup
Worklog initialized successfully!
Backend: {backend}
Profile: {profile}
Next steps:
- Use `memory-store` skill to save learnings
- Use `memory-recall` skill to query context
- Run `/worklog-status` to check connectivity
MCP tools available:
- store_memory, recall_context, search_knowledge
- log_entry, store_knowledge, query_table
SQLite creation fails:
PostgreSQL connection fails:
CLAUDE.md not found:
BACKUP=$(ls -td ~/.claude/.worklog-backup-* 2>/dev/null | head -1)
if [ -n "$BACKUP" ]; then
cp $BACKUP/CLAUDE.md ~/.claude/CLAUDE.md 2>/dev/null
rm -f ~/.claude/worklog.local.md
echo "Restored from $BACKUP"
fi