Operations
Daily operations
Section titled “Daily operations”# Sync repos and rebuild FTS indexrk sync --owners my-org --local /path/to/repos
# Rebuild full-text search if results seem stalerk reindex
# Check database healthrk statsDatabase backup
Section titled “Database backup”The database is a single SQLite file running in WAL mode.
# Flush the WAL to the main database filesqlite3 data/knowledge.db "PRAGMA wal_checkpoint(FULL);"
# Copy the database filecp data/knowledge.db data/knowledge-backup-$(date +%Y%m%d).dbOnly the .db file is needed — the -wal and -shm files are transient and will be recreated.
Recovery
Section titled “Recovery”If the database becomes corrupt or you need a fresh start:
# Delete the corrupt databaserm data/knowledge.db data/knowledge.db-wal data/knowledge.db-shm
# Re-initialize and seed controlsrk init
# Re-sync from GitHub and local reposrk sync --owners my-org --local /path/to/reposAll data is reconstructable from GitHub metadata and local repo scans. Manually-added notes and relationships will need to be re-entered unless you have a backup.
Migrations
Section titled “Migrations”Schema migrations run automatically when any CLI command or MCP server starts. The current version is tracked in the meta table.
If a migration fails:
- Check the schema version:
sqlite3 data/knowledge.db "SELECT * FROM meta WHERE key = 'schema_version';" - Review migration SQL files in
src/db/ - If unrecoverable, delete the database and re-sync
Troubleshooting
Section titled “Troubleshooting”gh not authenticated
Section titled “gh not authenticated”Error: gh auth status failedRun gh auth login and follow the prompts. The gh CLI must be authenticated for GitHub sync.
better-sqlite3 build fails
Section titled “better-sqlite3 build fails”Error: Could not locate the bindings fileInstall C/C++ build tools:
- Ubuntu:
sudo apt install build-essential - macOS:
xcode-select --install - Windows: Install Visual Studio Build Tools
Prebuilt binaries are used automatically on many platforms.
Database locked
Section titled “Database locked”Error: SQLITE_BUSY: database is lockedAnother process has the database open. Close other rk CLI sessions or MCP server instances. If the lock persists, delete the -wal and -shm files and retry.
FTS index out of date
Section titled “FTS index out of date”If search results don’t match expected content:
rk reindex