Interactive Shell

Overview

sqry shell starts an interactive REPL that keeps the indexed graph loaded in memory for repeated structural queries. It is useful when you want to run several sqry query expressions against the same workspace without paying the setup cost each time.


Start the shell

cd /path/to/your/project
sqry shell

The shell requires an existing index. Run sqry index . first if the workspace does not already contain .sqry/graph/snapshot.sqry. On startup, the shell prints the loaded workspace path and then presents a prompt:

Loaded index from . in 18ms
sqry shell - type 'help' for commands, 'exit' to quit
sqry>

Running queries

Type a query expression at the prompt. The expression is passed to the same structural query engine used by sqry query:

sqry> kind:function AND async:true
  src/api/routes.rs:42     handle_request
  src/auth/middleware.rs:18 validate_token
  ... (38 more results)

sqry> callers:validate_token
  src/api/routes.rs:45     handle_request
  src/tests/auth_test.rs:12 test_auth_flow

sqry> name~=/^test_/ AND kind:function
  tests/auth_test.rs:12     test_auth_flow

Prompt lines should contain query expressions, not sqry query flags. Use non-interactive commands such as sqry query --limit 20 "kind:function" . or sqry batch --queries queries.txt . --output json when you need command-line output flags or scripted limits.


Shell commands

The shell also accepts a small set of meta commands:

sqry> help
sqry> stats
sqry> refresh
sqry> history
sqry> clear

Graph subcommands such as trace-path, direct-callers, cycles, and unused are not shell aliases. Run them from your normal shell as sqry graph ..., sqry cycles ..., or sqry unused ....


History

The shell keeps line-editing history for the current process. Use arrow keys to navigate queries typed during the active session:

sqry> # Press Up/Down to cycle through history

Exiting

Type exit, quit, or press Ctrl+D to exit the shell.


When to use the shell

The shell is best for exploratory sessions — when you’re tracing through unfamiliar code, debugging a call chain, or iteratively narrowing down a set of symbols. Each query runs against the already-loaded index.

For scripted or CI use cases, use sqry batch instead.