scryer-cli
Command-line interface and daemon binary for the Scryer Code Intelligence Server.
scryer provides high-performance workspace indexing, local-first AST token savings benchmarking, and MCP server daemon lifecycle management supporting both standard I/O (stdio) and HTTP Server-Sent Events (SSE) transports.
Installation
Or run directly with cargo run -p scryer-cli -- <COMMAND>.
Commands and Usage
1. scryer serve
Run the Model Context Protocol (MCP) server.
In stdio mode with a local database (the default), scryer serve is a thin client: it connects to the shared daemon's Unix socket (starting scryer daemon run in the background if none is listening), sends a one-line handshake with its working directory and --watch flag, then copies bytes between stdin/stdout and the socket. This is what lets any number of MCP clients share one database. See crates/scryer-mcp/README.md for the protocol.
# Run over stdio (default, ideal for Claude Desktop or Cursor local process)
# Run with reactive filesystem watcher enabled
# Run over HTTP on port 8080 (MCP endpoint: http://<host>:8080/mcp)
# Connect to a remote Turso database instance
Options:
--transport <stdio|sse>: MCP transport protocol (default:stdio).sseserves rmcp Streamable HTTP at/mcpon<host>:<port>, in-process, with a fresh session state per HTTP session.--host <ADDR>: Bind address for HTTP transport (default:127.0.0.1).--port <PORT>: Port for HTTP transport (default:8080).--watch: Register the current working directory as a project if no registered project contains it (launch from the workspace root). It is only registered if it has a project marker (.git,Cargo.toml,pyproject.toml,setup.py,package.json,tsconfig.json) and isn't/or the home directory. The daemon watches every registered project whether or not clients pass--watch. In-process mode (--no-daemon,--transport sse) watches all registered projects only with--watch.--no-daemon/SCRYER_NO_DAEMON: Open the database in this process instead of using the daemon. Fails with an explanation if a daemon already owns the database.--idle-timeout <SECS>: How long an auto-started daemon stays alive with no clients (default:600,0= forever).--db-url <URL>/SCRYER_DB_URL: Turso database URL or local path (default:~/.scryer/scryer.db).--auth-token <TOKEN>/SCRYER_AUTH_TOKEN: Authentication token for remote Turso databases.
The daemon is used only for stdio, local database files, and Unix. Remote (libsql:/turso:/https:) and :memory: databases, --no-daemon, and other platforms run in-process.
Note on stdio mode: When running with
--transport stdio, standard output (stdout) is strictly reserved for JSON-RPC MCP messages. All tracing and operational logs are written tostderr.
2. scryer daemon
Manage the shared daemon that scryer serve connects to. It is normally started automatically.
Options:
--db-url <PATH>/SCRYER_DB_URL: Database the daemon owns (default:~/.scryer/scryer.db). Each database gets its own daemon.--idle-timeout <SECS>(runonly): Exit after this long with no sessions (default:600,0= forever).
Runtime files live in ~/.scryer/run/, named by a hash of the database path: <hash>.sock (socket), <hash>.pid (lock held by the running daemon), <hash>.lock (serializes daemon startup), <hash>.log (daemon log). If that socket path would exceed the OS limit (~104 bytes), the socket moves to $XDG_RUNTIME_DIR or /tmp as scryer-<hash>.sock, and clients verify it is owned by the current user before connecting. Each binary has a build ID (its executable's size and mtime, read at startup), exchanged in the handshake. scryer serve and the CLI stop a daemon from a different build before connecting when it has no sessions, so a rebuilt or reinstalled binary takes effect on the next connection. A daemon that still has sessions is left running, the client prints a warning suggesting scryer daemon stop, and get_indexing_status reports server.stale: true.
3. scryer index
Perform a manual scan and incremental indexing of a workspace into Turso. If a daemon owns the database, the request is sent to it (via the index_workspace tool) instead of opening the database.
# Index current workspace
# Index specific directory with an explicit project slug
Options:
-p, --path <PATH>: Directory path of the workspace to index (default: current directory.).-s, --slug <SLUG>: Explicit project slug identifier (defaults to directory basename).-d, --db-url <URL>: Target database URL or file path.-a, --auth-token <TOKEN>: Database authentication token.
Outputs a structured summary table reporting scanned files, added/modified/deleted files, extracted symbols, lexical scopes, references, and call graph edges.
4. scryer status
Display registered workspaces, entity metrics, file counts, and database status, as well as the global Cargo dependencies cache (Project 0). If a daemon owns the database, the status is fetched through it and shows file and symbol counts.
# View all registered workspaces and global Cargo dependencies (Project 0)
# View status for a specific workspace project
# View status for global Cargo dependencies cache only
Options:
-p, --project <SLUG|ID>: Filter status by specific project slug, numeric ID, or "0"/"dependencies" for the Cargo cache.-d, --db-url <URL>: Database URL or file path.-a, --auth-token <TOKEN>: Database authentication token.
scryer delete
Unregister a project and delete its index data and ADR records from the database. Source files and ADR markdown on disk are not touched. Goes through the daemon when one is running, which also stops the project's file watcher.
# By slug, numeric ID, or root path
Options:
-d, --db-url <URL>: Database URL or file path.-a, --auth-token <TOKEN>: Database authentication token.
5. scryer benchmark
Benchmark AST retrieval efficiency and exact BPE token savings compared against naive whole-file ingestion. Supports benchmarking workspace directories or indexed external Cargo dependencies (Project 0).
# Benchmark current directory
# Benchmark a specific source file or directory
# Benchmark public surface token savings across top 5 indexed Cargo dependencies
# Benchmark up to 10 dependencies or a specific crate
Metrics Reported:
- Naive Tokens: Exact BPE token count for reading the entire raw file.
- AST Tokens: Exact BPE token count for extracted outline and declarations.
- Token Savings: Absolute context tokens eliminated from the model window.
- Savings %: Compression percentage (typically 75% to 92% context reduction).
- Elapsed Time: AST extraction latency.
- Estimated API Cost Savings: Net dollar savings per inspection pass based on standard LLM input token pricing ($3.00 / 1M tokens).
6. scryer init
Install or update standardized Scryer agent guidance in AGENTS.md and .agents/skills/scryer/SKILL.md.
The two files have different jobs. AGENTS.md is read in every session, so its block is about ten lines: use Scryer instead of grep, the one-line tool choice, when grep is still right, how to read an empty result, and a pointer to load the scryer skill when exploring or editing code. The skill holds the full playbook (decision tree, working rules, MCP / Antigravity / CLI invocation, workflows, payload options) and its description names the situations that should load it. The MCP server's instructions carry the same decision tree for clients that read neither file. Both generators live in installer.rs; tests keep them short, in step, and limited to real tool names.
# Install or update AGENTS.md in current directory
# Target a specific directory or file
# Verify whether AGENTS.md instructions are up to date (exit code 0 if up to date, 1 if missing/outdated)
# Print raw instruction template to stdout
Uses <!-- scryer:start --> and <!-- scryer:end --> comment sentinels to idempotently insert or replace the Scryer guidance block without disturbing existing human-written instructions in AGENTS.md.
7. Direct Code Intelligence Commands (CLI & Shell Tool Fallback)
Every Scryer MCP tool can be run directly from the command line using strongly typed Clap subcommands or dynamically via scryer call. This provides a complete fallback for coding agents operating without direct MCP tool integrations, and makes all capabilities self-discoverable via --help.
# Discover all tools and subcommands
# Discover specific tool flags and documentation
# File outlines without reading method bodies
# Type contracts and shapes
# Symbol navigation & references
# Call hierarchies & blast radius
# Dynamic generic tool invocation
3-Tier Invocation Model:
- Direct MCP (Codex, Cursor, Claude Code, Windsurf): Native tool calls (
get_file_outline,resolve_definition). - MCP Gateway (Google Antigravity / Gemini CLI): Gateway dispatch via
call_mcp_tool(ServerName: "Scryer", ToolName: "...", Arguments: {...}). - CLI Subcommand Fallback (Shell / Non-MCP): Terminal execution via
scryer <command>with full--helpdiscoverability.