scryer-cli 0.2.1

CLI tool and shared daemon runner for Scryer code intelligence
scryer-cli-0.2.1 is not a library.

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

cargo install --path crates/scryer-cli

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)
scryer serve

# Run with reactive filesystem watcher enabled
scryer serve --watch

# Run over HTTP on port 8080 (MCP endpoint: http://<host>:8080/mcp)
scryer serve --transport sse --port 8080

# Connect to a remote Turso database instance
scryer serve --db-url "libsql://my-org.turso.io" --auth-token "my-token"

Options:

  • --transport <stdio|sse>: MCP transport protocol (default: stdio). sse serves rmcp Streamable HTTP at /mcp on <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 to stderr.


2. scryer daemon

Manage the shared daemon that scryer serve connects to. It is normally started automatically.

scryer daemon status          # PID, version, build, socket, log, sessions, watched projects and directory counts
scryer daemon stop            # stop it (connected clients disconnect)
scryer daemon run             # run in the foreground (what `scryer serve` spawns)

Options:

  • --db-url <PATH> / SCRYER_DB_URL: Database the daemon owns (default: ~/.scryer/scryer.db). Each database gets its own daemon.
  • --idle-timeout <SECS> (run only): 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
scryer index

# Index specific directory with an explicit project slug
scryer index --path /path/to/repo --slug my-service

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)
scryer status

# View status for a specific workspace project
scryer status --project my-service

# View status for global Cargo dependencies cache only
scryer status --project 0
scryer status --project dependencies

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
scryer delete my-service
scryer delete 3
scryer delete /home/me/projects/my-service

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
scryer benchmark

# Benchmark a specific source file or directory
scryer benchmark --target src/main.rs

# Benchmark public surface token savings across top 5 indexed Cargo dependencies
scryer benchmark --dependencies

# Benchmark up to 10 dependencies or a specific crate
scryer benchmark --dependencies --limit 10
scryer benchmark --dependencies --package tokio

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
scryer init

# Target a specific directory or file
scryer init /path/to/repo/AGENTS.md

# Verify whether AGENTS.md instructions are up to date (exit code 0 if up to date, 1 if missing/outdated)
scryer init --check

# Print raw instruction template to stdout
scryer init --print

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
scryer --help

# Discover specific tool flags and documentation
scryer get-file-outline --help
scryer resolve-definition --help
scryer get-type-contract --help

# File outlines without reading method bodies
scryer get-file-outline src/main.rs --compact
scryer get-file-outline src/main.rs --kinds function,struct --limit 20

# Type contracts and shapes
scryer get-type-contract MyStruct
scryer get-type-contract --type-name MyStruct --file-path src/models.rs

# Symbol navigation & references
scryer resolve-definition src/main.rs 42 10
scryer find-references MySymbol
scryer find-references MySymbol --role call --scope-level dependencies

# Call hierarchies & blast radius
scryer trace-call-hierarchy my_function --direction callers
scryer calculate-blast-radius MySymbol --files-only

# Dynamic generic tool invocation
scryer call list_projects
scryer call get_file_outline src/main.rs --compact

3-Tier Invocation Model:

  1. Direct MCP (Codex, Cursor, Claude Code, Windsurf): Native tool calls (get_file_outline, resolve_definition).
  2. MCP Gateway (Google Antigravity / Gemini CLI): Gateway dispatch via call_mcp_tool(ServerName: "Scryer", ToolName: "...", Arguments: {...}).
  3. CLI Subcommand Fallback (Shell / Non-MCP): Terminal execution via scryer <command> with full --help discoverability.