Skip to content

CLI Reference

Start the GHOST daemon (Discord bot + job scheduler).

Terminal window
ghost daemon

Initialize workspace and config files.

Terminal window
ghost init

Creates ~/.config/ghost/config.toml and the workspace directory with default files.

Read, write, and reload configuration values.

Terminal window
ghost config get <key> # Get a config value (with defaults)
ghost config set <key> <value> # Set a config value
ghost config reload # Validate config and signal the daemon to reload

Examples:

Config examples
ghost config get discord.allowed_user_id
ghost config set timing.heartbeat_idle_minutes 10
ghost config set web.search_max_results 10
ghost config reload

Validates config.toml and .env, then sends SIGHUP to a running daemon to apply changes without restarting.

Terminal window
ghost config reload

Hot-reloadable — the daemon picks up these changes immediately:

  • model — default chat model
  • timing — heartbeat, idle, and compaction intervals
  • compaction — token thresholds and limits
  • web — search provider, result counts
  • docling — document import settings
  • coding — coding session settings
  • debug — log level and debug flags
  • discord.allowed_user_ids — who can interact with GHOST
  • embeddings.url and embeddings.model — embedding endpoint and model name

Requires restart — these settings are read once at startup:

  • workspace — workspace directory path
  • embeddings.dimension — vector size (changing this invalidates stored embeddings)
  • discord.enabled — enables or disables the Discord interface

Manage authentication for providers.

Terminal window
ghost auth codex # OpenAI OAuth flow (opens browser)
ghost auth status # Check authentication status
ghost auth revoke # Revoke OpenAI tokens

Manage cron jobs.

Terminal window
ghost job list # List jobs with next-run times
ghost job validate <path> # Validate job file syntax
ghost job run <name> # Execute job immediately
ghost job logs [name] # View job execution logs

Manage coding sessions. See GHOST HACK for details.

Terminal window
ghost hack start <dir> [--prompt "task"] # Start a coding session
ghost hack resume <id> [--prompt "task"] # Resume a previous session
ghost hack list # List recent sessions

Discover, validate, and inspect agents.

Terminal window
ghost agent list # List all discovered agents
ghost agent validate [name] # Validate agent Lua configs (all or one)
ghost agent status # Running agents + recent runs
ghost agent show <run_id> # Details of a specific run

Table of running agents and recent completed/failed runs.

Terminal window
ghost agent status # Last 20 runs
ghost agent status --agent my-agent # Filter by agent name
ghost agent status --limit 50 # Show more runs

Running agents appear first, sorted by start time.

View the result of a specific agent run. Accepts a full run ID or a unique prefix (minimum 4 characters).

Terminal window
ghost agent show 01JQ8A2B # Transcript only
ghost agent show 01JQ8A2B --full # Include full message history
ghost agent show 01JQ8A2B --json # JSON output
ghost agent show 01JQ8A2B --full --json

Failed runs automatically include the error message. Use --json for machine-readable output (e.g. piping to another agent).

Inspect chat sessions.

Terminal window
ghost session list # Recent sessions (up to 50)
ghost session logs <session_id> # View messages
ghost session logs <session_id> --count 100 # More messages
ghost session logs <session_id> --around <id> # Center on a message

Query and manage the knowledge base.

Terminal window
ghost knowledge search <query>
ghost knowledge search <query> --kind note # Filter by type
ghost knowledge search <query> --limit 20 # More results
Terminal window
ghost knowledge get --title "Note Title" # Get by title
ghost knowledge get <path> # Get by path
Terminal window
ghost knowledge graph <target> # Show connections
ghost knowledge graph <target> --direction out # Outgoing only
ghost knowledge graph --orphans # Unconnected notes
ghost knowledge graph --stats # Edge/stub counts
Terminal window
ghost knowledge tags # Tags with counts
ghost knowledge recent # Recent activity
ghost knowledge recent --limit 50
ghost knowledge stats # Type counts
ghost knowledge references # All reference topics
ghost knowledge references --topic rust # By topic
Terminal window
ghost knowledge reindex # Sync files → database
ghost knowledge reindex --skip-embeddings # Skip embedding gen

Import, update, and delete external reference material. See Reference Import for details.

Terminal window
# From a git repository (preferred for doc sets)
ghost reference import git --url <url> --topic <name> \
[--paths dir1,dir2] [--extensions .md,.rs] [--ref <tag-or-branch>]
# By crawling a website (fallback)
ghost reference import crawl --url <url> --topic <name> \
[--max-depth 3] [--max-pages 50]
Terminal window
ghost reference update --topic <name> # Re-fetch from source
ghost reference update --topic <name> --ref v2.0 # Switch branch/tag

Re-fetches from the original source and applies changes. New files are added, changed files are updated, and files deleted upstream are removed — unless cited by notes, in which case they are moved to _orphaned/.

Terminal window
ghost reference delete --topic <name>

Removes the topic, all its references, embeddings, import metadata, and workspace files.

Repair the SQLite database by rebuilding file-backed state from the workspace and copying operational tables into a fresh candidate DB.

Terminal window
ghost db repair
ghost db repair --dry-run

ghost db repair --dry-run is the safest default. It builds a candidate database beside ghost.db, verifies that DB-only tables were preserved, writes a JSON repair report, and leaves the live DB untouched.

Run it when GHOST or ghost knowledge search starts failing with SQLite corruption errors such as database disk image is malformed.

Repair artifacts are written next to the live database:

  • ghost.db.repair-<timestamp>.candidate
  • ghost.db.repair-<timestamp>.report.json
  • ghost.db.backup-<timestamp> on a successful non-dry-run swap

Import documents (PDF, DOCX, etc.) via docling-serve. See Reference Import for details.

Terminal window
ghost document import file --path <path> --topic <name>

For URLs, download the file first (curl -L -o uploads/doc.pdf <url>), then import with the command above.

Optional flags (use only when explicitly needed):

FlagDefaultPurpose
--no-ocrOCR onSkip OCR for digital PDFs
--page-range "1-10"full docImport specific pages only
--timeout 900600sExtend timeout for large docs

Web search and fetch.

Terminal window
ghost web search <query> # Search with Brave
ghost web search <query> -n 10 # More results
ghost web fetch <url> # Extract content
ghost web fetch <url> --readability # Article mode
ghost web fetch <url> --raw # Raw HTML

Start all registered services (top-to-bottom), then start the GHOST daemon via the OS service manager.

Terminal window
ghost start

Stops on first service failure — the daemon is not started if any service fails to come up. Shows ghost status output at the end.

Stop the GHOST daemon, then stop all registered services (bottom-to-top, best-effort).

Terminal window
ghost stop

Always attempts all service stops even if some fail. Shows ghost status output at the end.

Manage the service registry (services.toml). Generated during ghost init, editable via these commands.

Terminal window
ghost services list # Show registered services
ghost services add --name <n> [--start ".."] [--stop ".."] [--update ".."] [--status ".."]
ghost services remove <name> # Unregister a service
ghost services update # Run update commands (stops on first failure)
ghost services status # Check process-level status

Show config validity, daemon status, and service health at a glance.

Terminal window
ghost status

Checks:

  • Config — loads and validates config.toml, reports parse errors
  • Daemon — checks whether ghost-daemon is active via systemd/launchd
  • Services — probes each configured service URL (embeddings, search, Crawl4AI, Docling, browsers)

Complementary to ghost services status — this checks HTTP health, while ghost services status checks process-level status.

Print the GHOST version.

Terminal window
ghost version