Gortex exposes a knowledge-graph query surface over the Model Context Protocol: 100+ tools, 18 resources, 3 prompts. Agents call the same surface from stdio, the daemon Unix socket, or the MCP 2026 Streamable HTTP endpoint.
- Daemon availability and embedded fallback
- Compact MCP surface
- Tool discovery (lazy mode)
- Restricting the tool surface (presets)
- Core navigation
- Graph traversal
- Search & traversal extensions
- Dataflow (CPG-lite)
- Structural search
- Diagnostics & code actions
- Proactive notifications
- Coding workflow
- Agent-optimized (token efficiency)
- Response re-cutting
- Analysis
- Proactive safety
- Code quality
- Code generation
- PR review
- Multi-repo management
- Worktree views and checkouts
- Live editor buffers (overlay sessions)
- Speculative execution
- MCP resources (18)
- MCP prompts (3)
gortex mcp connects to and may auto-start the shared daemon. If no compatible daemon can be reached, it exits by default instead of starting a private in-process server. This prevents multiple MCP clients from silently indexing the same repository in parallel.
To retain the legacy standalone behavior, opt in from the user-level config (~/.gortex/config.yaml, or $XDG_CONFIG_HOME/gortex/config.yaml):
mcp:
allow_embedded: trueRepository-local .gortex.yaml files cannot enable this machine-level permission.
With the opt-in, daemon-unavailable launches—including gortex mcp --index ...—use a private temporary SQLite store that is removed on exit and rebuild the tree on every launch.
The compact surface consolidates the legacy catalogue into 21 domain tools with compact, stable schemas. Every MCP client connection selects it automatically in hide mode unless a higher-precedence forwarded, operator, or instruction-profile policy overrides it — whether or not its initialize carried a clientInfo.name. Only internal session-less callers (the HTTP dashboard and /v1 REST routes) retain the server default. Select it explicitly with the neutral compact preset alias:
GORTEX_TOOLS=compact gortex mcpWith that surface, the client receives all 21 names in its first tools/list: explore, search, read, relations, trace, analyze, ask, change, review, pr, recall, workspace, response, capabilities, edit, refactor, remember, workspace_admin, overlay, session, and publish_review. They are static for the session—there is no tools_search promotion or tools/list_changed dependency. capabilities discovers operation schemas, not additional tool names. Session-lifetime controls use session, for example {"operation":"subscribe","channel":"diagnostics"}; durable workspace changes remain under workspace_admin.
The compact surface delegates to the existing handlers. Existing agent, core, full, and specialist presets retain their legacy schemas; the CLI, HTTP routes, and legacy MCP names remain compatible. Names shared by both surfaces (such as explore, analyze, and review) advertise the compact schema only in a compact session. See the compact MCP surface specification for effects, schemas, migration, and acceptance gates.
Authorization follows observable effects. analyze is strictly read-only: blame, coverage enrichment, SQL rebuild, and Temporal verification are exposed through workspace_admin; model-assisted concepts/search and lazy graph enrichment are fixed off on local read operations. Stateful nav is exposed as session(operation="cursor"). change.contract cannot acknowledge risk; durable acknowledgement is explicit through remember(operation="risk_ack").
The fallback server default is a curated core preset in defer mode (see presets): ~34 dev-cycle workhorse tools are published eagerly in the initial tools/list, and the rest of the ~180-tool catalogue is deferred—fetched on demand through tools_search. Named MCP clients instead default to the static compact surface described above. Opt into the full eager surface with preset full (GORTEX_TOOLS=full).
tools_search returns each deferred tool's schema inline (in a <functions>{…}</functions> block) and promotes it into tools/list, firing notifications/tools/list_changed. Clients that honour that notification (or read the inline schema) reach deferred tools transparently. GORTEX_LAZY_TOOLS=1 is the older, all-or-nothing switch that defers everything except a hard-coded hot set regardless of preset; the core/defer default supersedes it for the common case.
// With GORTEX_LAZY_TOOLS=1 set:
// Browse — list deferred tool names without schemas.
{"name":"tools_search","arguments":{}}
// Fetch schemas for specific tools by name (auto-promotes them into tools/list).
{"name":"tools_search","arguments":{"query":"select:flow_between,taint_paths,find_clones"}}
// Keyword search with required-token filter, ranked, capped at max_results.
{"name":"tools_search","arguments":{"query":"+overlay drop","max_results":5}}
// Fuzzy keyword match across name + description.
{"name":"tools_search","arguments":{"query":"memories invariants"}}Returned tools are auto-promoted (promote:false opts out) and the server fires notifications/tools/list_changed. The tool_profile tool reports the active surface — which tools are live vs. deferred, their scopes and categories, the active preset (below), and (with a tool argument) a single tool's enabled status.
Two front doors over one set of handlers. The same tool handlers back both the MCP transport and the gortex CLI. The daemon routes a tool call by name over its socket, independent of which tools a given client eagerly published in tools/list — so the CLI reaches the full surface, including tools that are deferred under the core preset, with no tools_search round-trip. gortex call <tool> invokes any tool by name, and the dedicated CLI verb groups (gortex edit …, gortex memory …, gortex analyze, gortex flow / taint / clones / feedback) are ergonomic front-ends over the most-used tools. Driving Gortex through those verbs mounts no tool schemas into the model's context — see cli.md and the consumption-path trade-off in cli.md.
The full ~180-tool surface is more than many agents need. A tool preset picks what the server publishes — the basis both for the lean shipped default and for a minimal, headless editing harness (an agent on a trusted box driving a remote daemon through a small, fixed tool set).
Eight built-in presets:
| Preset | Surface |
|---|---|
facade-v1 (default for named MCP clients) |
Stable config identifier for the 21 static, effect-homogeneous domain tools; operation schemas are discovered through capabilities, with no tool promotion. Aliases: compact, facade, agent-v2 |
agent |
Legacy lean coding-agent working set (~20 tools): explore (the one-shot localization verb) + search/navigate + read (incl. batch_symbols) + orient + edit/verify. Parameter descriptions are compacted (the full prose is one tools_search / full hop away). Aliases: coding-agent |
core (fallback server default) |
the curated dev-cycle set (~35 tools): orient (incl. explore) + search/navigate + read + edit + verify/test + analyze + review + the memory workflow. Aliases: default, classic |
full |
every tool (the pre-core behaviour — opt back in here) |
readonly |
everything except the mutating tools (edit_file, write_file, index_repository, …) |
edit |
the minimal headless editing set — orient + navigate + mutate + verify (smart_context, search_symbols, find_files, edit_file, verify_change, get_test_targets, …) |
nav |
read-only navigation / exploration; no editors |
localization |
the diet "where is the code that does X" set (~10 tools, read-only, compacted descriptions): smart_context + search + trace + read. The eager list is sourced from the instruction-profile table, so this surface and the localization profile's instructions body cannot drift. Aliases: locate, find |
For legacy presets, tool_profile and tools_search are always kept. The compact surface uses capabilities instead and is closed: it always contains exactly its 21 public tools, so allow / deny deltas are ignored for facade-v1. Select a legacy or custom surface when per-tool deltas are required.
Client-aware default. With no higher-precedence selection, every MCP client connection gets the compact 21-tool surface in hide mode. clientInfo.name is informational and does not select the surface: an empty name gets the same tools as a named client. Only internal session-less callers (the HTTP dashboard and /v1 REST routes) retain the server default. Client identity and wire format are separate: an unknown named client still gets the compact tools but remains on JSON unless it is independently GCX-capable. GORTEX_TOOLS always overrides. The gortex mcp proxy forwards its GORTEX_TOOLS / --tools to the daemon in the handshake, so a client's preset applies over the shared daemon (it can both narrow and widen the surface, not just subtract).
Instruction profiles. The machine's active instruction profile (gortex instructions switch <core|localization|full> — see cli.md) can carry a tool preset; sessions pick it up between the forwarded spec and the client-aware default. Full precedence: forwarded spec (GORTEX_TOOLS / --tools) > operator-pinned mcp.tools config > active instruction profile > client-aware default > server default. The shipped core profile carries no preset, so nothing changes until a machine explicitly switches; profile changes apply to new sessions only.
Tool names in installed instructions are examples, subject to the tools actually advertised for the session. An explicit legacy preset such as GORTEX_TOOLS=core,+distill_session,+query_notes,+query_memories keeps its legacy editors; the absence of the compact change alias does not disable those callable editors. Follow the server's session guidance, including read-only policies and explicit denials.
After upgrading, gortex instructions switch full (or your selected profile) refreshes an already installed managed global inline block and the active profile. instructions regen and daemon startup refresh profile files, not every existing inline instruction file. Rerun your usual gortex init command in repositories with managed project instruction blocks to refresh those blocks. Start a new agent/MCP session afterward; existing sessions retain their loaded guidance and tool surface.
Two modes (mode):
defer(the default mode forcore) — non-allowed tools are kept out of the coldtools/listbut stay reachable throughtools_search, which returns their schema inline and promotes them (firingnotifications/tools/list_changed). The lean-but-complete surface: nothing is lost, the rare tool is one discovery call away.hide(the default forfacade-v1and the explicitedit/nav/readonlyharness presets) — non-allowed tools are removed fromtools/listand calls to them are hard-blocked. The locked-down surface; works identically on every client.
Select a preset three ways (precedence: env > flag > config > default):
# .gortex.yaml — config file
mcp:
tools:
preset: full # compact | agent | core (default) | full | readonly | edit | nav
mode: defer # defer | hide
allow: [find_files] # add tools on top of the preset
deny: [write_file] # remove tools from the preset# env (overrides config) — spec is "preset,+add,-remove"
export GORTEX_TOOLS="edit,+analyze,-write_file"
export GORTEX_TOOLS_MODE=hide
# CLI flags (override config; env still wins)
gortex mcp --tools edit --tools-mode hide
gortex daemon start --tools readonly # propagates to the detached childPer-connection (client-driven) scoping. The selectors above applied to gortex daemon start narrow the whole daemon for every client. To let one client pick its own surface while the daemon keeps serving the full set to everyone else, set --tools / GORTEX_TOOLS on that client's gortex mcp invocation — the stdio proxy filters just that connection's tools/list and blocks calls to tools outside the set. Because the filter applies from the first tools/list, it works on every MCP client (no tools/list_changed dependency).
// An MCP client config giving this client a minimal editing surface,
// against a daemon that still serves the full catalogue to others:
{
"command": "gortex",
"args": ["mcp", "--tools", "search_symbols,find_files,edit_file,verify_change"],
// or: "args": ["mcp", "--tools", "edit"] (a named preset)
// or: "env": { "GORTEX_TOOLS": "readonly" }
}A spec whose first token isn't a known preset (search_symbols,find_files,…) is an explicit allow list — exactly those tools — for experts who want to hand-pick the surface. A known preset followed by names (edit,find_files) keeps preset semantics plus the extra tools.
tool_profile reports the active preset / preset_mode, the narrowed live set, and a categories{} map grouping every tool into a functional family (nav / read / edit / analysis / review / pr / memory / overlay / subscription / enrich / workspace / admin) for prefix-style filtering.
Prompt-injection screening. Every tool call is screened by middleware that scans arguments and result text for injection patterns. On a hit it attaches a non-blocking _meta.gortex_security advisory — the call still succeeds and the result body is never mutated. Disable with GORTEX_MCP_SANITIZE=0.
Unknown-option guard. Tools published with a closed schema (additionalProperties: false) enforce it at dispatch. By default an unknown option still executes the call and the result carries an _ignored_options rider naming the unknown keys and the valid ones — the self-correct signal for a mistyped or hallucinated option (#597). GORTEX_TOOL_ARG_GUARD=reject upgrades that to a refusal before the handler runs; GORTEX_TOOL_ARG_GUARD=0 / false / off / no disables enforcement. Response-shaping keys generic layers honor on any tool (format, fields, max_bytes, max_tokens, cursor) are always accepted, and facade tools are exempt — their compatibility wrappers deliberately take legacy call shapes.
| Tool | Description |
|---|---|
graph_stats |
Node/edge counts by kind, language, per-repo stats, session token savings, and an edge_identity_revisions counter (edges re-keyed when their provenance changed) |
search_symbols |
Find symbols by name (replaces Grep). Inline kind:/flavor:/lang:/path: field clauses (also a top-level flavor param) + query_class / max_per_file tuning; accepts repo, project, ref, scope params. flavor: filters type nodes by their structural shape — class/struct/enum/interface/trait/protocol/object/record/type_alias/newtype/message/service/table/view/module/… — with flavor:component spanning every UI component (React / Vue / Svelte / SwiftUI / Compose / Flutter / Angular / …); a kind:class-style value that is only a flavor routes to this filter automatically. corpus: code|docs|all selects the corpus (docs has its own retrieval channel + prose-tuned ranking); vocab_anchored: true constrains LLM expansion to the repo's own vocabulary; a zero-result identifier query is auto-decomposed into leaf terms (decomposed: true) |
search_text |
Trigram-accelerated literal (or regexp: true) code search across the repo — the alt grep backbone. Returns file/line/text rows, each carrying the enclosing symbol (symbol_id / symbol_name) |
find_files |
Find source files by name — the file-name counterpart of search_symbols. query (basename/path substring, ranked exact > prefix > substring) and/or glob (e.g. internal/**/*_test.go), with optional fuzzy subsequence matching and path / repo scoping. File nodes are excluded from the symbol index, so search_symbols kind:file cannot return them — use this |
winnow_symbols |
Structured constraint-chain retrieval — kind, language, community, path_prefix, min_fan_in, min_fan_out, min_churn, text_match with per-axis score contributions |
get_symbol |
Symbol location and signature (replaces Read). Accepts repo, project, ref params |
get_file_summary |
All symbols and imports in a file. Accepts repo, project, ref, max_bytes / max_tokens budget caps |
get_editing_context |
Primary pre-edit tool — symbols, signatures, callers, callees. Accepts max_bytes / max_tokens budget caps; compress_bodies stubs bodies, and fidelity_globs (e.g. internal/**:full,*_test.go:omit,vendor/**:compress) sets a per-glob full/compress/omit tier |
get_repo_outline |
Narrative single-call repo overview — top languages, communities, hotspots, most-imported files, entry points |
plan_turn |
Opening-move router — returns ranked next calls with pre-filled args for a task description (~200 tokens) |
| Tool | Description |
|---|---|
get_dependencies |
What a symbol depends on |
get_dependents |
What depends on a symbol (blast radius) |
get_call_chain |
Forward call graph. Accepts max_bytes / max_tokens budget caps |
get_callers |
Reverse call graph. Carries a caveat whenever the answer must not be taken at face value, so a pre-edit safety check isn't silently disarmed: likely_unused (indexed, nothing uses it), possible_extraction_gap (no edges at all — the extractor probably missed it), or coverage_incomplete (the only evidence is import-level, unresolved same-name candidates, or callers matched by name alone — including a populated caller list where every row is a name-only match) |
find_usages |
Every reference to a symbol. Each usage carries its reference context (parameter_type / return_type / field / value / type / attribute / call); pass context: to filter (e.g. "where is this type used as a parameter?"). flavor: filters by where a usage originates — a type flavor resolves the usage's enclosing owner type ("usages from inside a struct"), and flavor:component keeps usages originating inside a UI component; each usage surfaces the resolved from_type_flavor / from_ui_component. Accepts max_bytes / max_tokens budget caps. Carries the same caveat as get_callers — likely_unused / possible_extraction_gap / coverage_incomplete, the last also on a populated result whose every usage is a name-only match |
find_implementations |
Types implementing an interface |
find_overrides |
Methods that override (children) or are overridden by (parents) a method — backed by EdgeOverrides |
get_class_hierarchy |
Multi-hop inheritance subgraph around a type, interface, or method. Walks EdgeExtends + EdgeImplements + EdgeComposes (type nodes) and EdgeOverrides (method nodes); direction ∈ up / down / both, include_methods pulls members + their override chain |
get_cluster |
Bidirectional neighborhood |
| Tool | Description |
|---|---|
find_declaration |
Use-site → declaration resolver. Accepts a literal substring or (with regex: true) a regex matching a use site like fooBar(; returns the declaration node plus the matching use locations. Trigram-prefiltered. Optional path_prefix / kind filters |
walk_graph |
Token-budgeted free-form graph traversal — walks arbitrary edge_kinds (CSV) outward / inward / both from a starting symbol; auto-stops at token_budget. Surfaces budget_hit / stopped_at_depth on the response. community (ID or label) confines the walk to a detected community |
context_closure |
Dependency-closure context selection — given a set of seed files / symbols, walks the transitive import / dependency closure and packs it under one token_budget (reusing the graded-manifest tiers), ranked by graph distance from the nearest seed or, with rank: "proximity", by seeded random-walk proximity |
graph_query |
Ad-hoc graph-query escape hatch — small read-only DSL with nodes / traverse / filter stages joined by |, e.g. nodes kind=interface name~Handler | traverse implements in | filter path=internal/mcp/. Bounded by limit and a five-stage cap |
nav |
Per-session symbol cursor — verb-dispatched via action: goto / into (a callee) / up (a caller) / sibling / back / where / read. Adjacency preview rides on every response; the cursor lives in session state and resets on disconnect |
| Tool | Description |
|---|---|
flow_between |
Ranked dataflow paths between two symbols — walks value_flow / arg_of / returns_to edges |
taint_paths |
Pattern-driven source→sink dataflow sweep for security and architecture audits |
| Tool | Description |
|---|---|
search_ast |
Cross-language structural search by AST shape — raw tree-sitter S-expression pattern or a bundled detector (e.g. sql-string-concat, weak-crypto, hardcoded-secret) |
Wired across every running language server (gopls, tsserver, pyright, rust-analyzer, …). Server-driven capability registration via client/registerCapability / client/unregisterCapability is honoured live, so servers (jdtls, tsserver, rust-analyzer) that announce features after initialize no longer return empty results.
| Tool | Description |
|---|---|
subscribe_diagnostics |
Opt the session into push notifications/diagnostics; initial state replays immediately, deltas thereafter. Filter by min_severity / path_prefix |
unsubscribe_diagnostics |
Opt back out — idempotent, fires automatically on session disconnect |
get_diagnostics |
Latest stored diagnostics for a file; wait: true blocks on the first publish |
get_code_actions |
LSP code actions (quickfix / organizeImports / refactor / source) at a file location |
apply_code_action |
Apply a single code action to disk — atomic temp+rename |
fix_all_in_file |
Loop codeAction → apply → re-collect until convergence over the whole file |
Four additional push channels modeled on subscribe_diagnostics — per-session opt-in, delta-filtered, initial replay, auto-cleanup on disconnect.
| Tool | Description |
|---|---|
subscribe_workspace_readiness |
notifications/workspace_readiness — daemon warmup phase transitions (snapshot_loaded → parallel_parse → deferred_passes_all → global_resolve → end_batch → watcher_started → ready), plus one {event:"repo_state", repo, repo_path, state:"ready"} event each time a configured repository registers. Last-known phase replayed to late subscribers. A graph tool called during warmup does not need this subscription to cope: for a session whose repository is already registered it returns an in-band warming block plus best-effort partial results; for a session whose repository warmup has not registered yet it returns repo_loading (see Startup states) |
unsubscribe_workspace_readiness |
Opt back out — idempotent |
subscribe_daemon_health |
notifications/daemon_health — periodic ticker (default 15 s, interval_ms clamped to 1 s..5 min) snapshots uptime, alloc/sys/heap, num_goroutine, num_gc, tracked_repos, sessions, lsp_alive, graph nodes/edges, live checkout coordinators, the process-wide SQLite page cache (sqlite_page_cache_bytes, sqlite_page_cache_peak_bytes) and the OS view of the process: resident set (rss_bytes, rss_peak_bytes), Linux proportional set (pss_bytes, pss_file_bytes), macOS physical footprint (footprint_bytes, footprint_peak_bytes); an OS figure is omitted where the platform has no reader. Ticker only runs while ≥1 subscriber is attached |
unsubscribe_daemon_health |
Opt back out — idempotent |
subscribe_stale_refs |
notifications/stale_refs — per-session intersect of watcher symbol-change events against the session's viewed/modified working set. Fires only when a change actually touches what this session has consumed |
unsubscribe_stale_refs |
Opt back out — idempotent |
subscribe_graph_invalidated |
notifications/graph_invalidated — coarse "the graph was rebuilt, drop cached results" signal. {node_count, edge_count, reason, ts}; unfiltered |
unsubscribe_graph_invalidated |
Opt back out — idempotent |
After a daemon start, a repository is served once warmup registers it, which on a large store is minutes after the socket accepts connections. Until then a session whose working directory is inside a configured repository (or above one, or in a linked worktree of one) is neither tracked nor untracked, and gets its own answers:
| State | When | tools/call |
initialize instructions |
|---|---|---|---|
| loading | configured, warmup job queued or running | repo_loading, retryable:true, with phase, percent, repo, repo_path |
a LOADING preamble ahead of the ordinary instructions |
| prefix collision | the configured root's prefix belongs to another root | prefix_collision, retryable:false, with prefix, owner_path, owner_state |
owner-specific naming guidance |
| failed | the warmup job ended without registering it | repo_unavailable, retryable:false, with reason |
how to repair it |
| missing | the configured path does not exist | repo_unavailable, retryable:false |
how to repair it |
| ready | registered | served normally | ordinary |
While loading, index_health (also workspace(operation:"index")), capabilities, tools_search and the subscribe_* / unsubscribe_* tools answer; index_health lists only the caller's repository. track_repository, index_repository and workspace_admin(operation:"track") for the repository answer {status:"already_configured", state:"loading"}; once its load has failed they run normally, because tracking it again is the repair. Every other tool call, resources/read and prompts/get returns repo_loading, and mutations stay refused.
Tools start working in place when the repository registers: no reconnect is needed. The session's cached scope is dropped at registration, and a session whose initialize reported the repository as loading receives one notifications/message saying it is ready. A directory outside every configured repository still gets repo_not_tracked. The control-socket probe that hooks and the CLI pre-flight read reports the same per-repository state (loading, ready, failed, missing, prefix_collision), the hook lets native Read/Grep/Edit through for a loading repository instead of denying them, and the CLI maps repo_loading to "the daemon is still loading ": on a terminal it waits up to --loading-wait (default 30 s), otherwise it exits with code 75 (EX_TEMPFAIL).
A known prefix collision takes precedence over loading guidance: re-tracking
that configured root returns prefix_collision, never already_configured.
Use name for a new root, or edit the configured root's name and reload.
owner_state is present, missing or unknown; only missing suggests
inspecting an untrack of the owner.
track_repository may answer accepted while its detached initial index
continues. Its final outcome is retained for ten minutes under the canonical
root and the request's name, as_worktree and force options. A retry reads
that outcome without starting another index. Collision outcomes are errors with
structured error_code: prefix_collision, prefix, owner_path and
owner_state fields. Changing the options, configured ownership or live owner
invalidates reuse, so choosing a different name can repair the request. Native
file reads and edits remain available while a collision prevents graph access.
Every tool call and resource read is bounded, on every transport. A request that overruns its budget is abandoned: the client gets a terminal, structured error so the session keeps serving later requests. The handler itself can keep running — it may be inside a store call that cannot be interrupted — so treat any side effect of an abandoned call as unknown and re-read before assuming it did or did not land.
| Layer | Bound | Knob |
|---|---|---|
| Tool call / resource read / prompt fetch (all transports) | 60 s | GORTEX_MCP_TOOL_TIMEOUT (Go duration; off disables) |
| Daemon socket, per JSON-RPC request | 60 s, terminal -32001 |
— |
Daemon socket and HTTP /mcp, shared concurrent dispatches |
8 | GORTEX_MCP_MAX_CONCURRENT_DISPATCHES (max 64) |
Daemon socket and HTTP /mcp, tool dispatch queue wait |
Up to 5 s, clamped to the request deadline minus 100 ms; terminal -32002 includes queue_wait_ms and retry_after_ms |
GORTEX_MCP_DISPATCH_QUEUE_WAIT (Go duration, max 30 s; 0/off restores the instant refusal) |
Control RPC (daemon status / search_symbols / proxy) |
30 s, terminal timeout |
— |
Control RPC (shutdown) |
unbounded on the daemon — the store flush precedes the ack. gortex daemon stop bounds its own wait at 30 s, then watches the process for up to 2 min and force-kills |
— |
Control RPC (track / untrack / reload / enrich_*) |
unbounded by design | — |
MCP tool calls to the daemon, over its socket or /mcp, share three admission
lanes. REST /v1/tools/<name> calls run their handlers directly and are not
admitted through these lanes. Mutating calls have two reserved slots and can
also use free shared slots. Slow calls (outline, dead_code
and analysis) hold at most two slots; other calls use the fast lane. Free slots
serve queued mutating calls first, then fast, then slow. Sessions take turns
within each lane; a session holding four slots yields to another waiting
session. For small cap overrides, the reservation is min(2, cap-1) and the
slow limit is min(2, cap-reservation), so cap 1 remains usable.
Each lane permits at most 16× the total dispatch cap to wait. Queue time counts
against the request timeout, leaving 100 ms for a refusal to reach the client.
Busy replies are retryable and include retry_after_ms, estimated from the
lane's observed drain rate and clamped to 100–5,000 ms (1 s before observations).
An edit that waits for graph publication returns mutation capacity before
entering the slow lane, and stops queueing for it once publication lands: a
finished publication never waits for a slot. If slow admission fails after the
disk commit, the edit returns its pending receipt instead of a retryable busy
refusal.
Cancellation returns logical lane capacity within 100 ms while the process
has room in its four-handler draining allowance. Abandoned handlers, including
inner tool handlers whose middleware has already returned, stay counted until
they actually return. When all four drains are occupied, further cancelled
handlers remain capacity-charged; physical dispatcher work stays bounded by
the configured cap plus four. Initialization (initialize or server/discover)
and notifications share total capacity but are exempt from tool reservations;
notifications wait without a queue budget. notifications/cancelled takes no
slot on either transport, so a full pool cannot hold back the cancellation that
frees it. subscriptions/listen stays unbounded and consumes no dispatch slot.
Daemon status exposes mcp_dispatch: lane in-flight, queued, draining and
cancelled-but-held counts, refusals, reserved-slot use and queue-wait histograms
for admitted, refused and cancelled calls. Histogram buckets are disjoint
upper bounds in milliseconds and include zero-wait admissions. The metrics
surface reports the corresponding views_mcp_dispatch_* series without
session or request identifiers.
The handler bound fires just inside any deadline the transport already imposed, so the client receives the tool-shaped diagnosis rather than an opaque transport timeout. Track / reload / enrichment are deliberately left unbounded: they are long by design, and a user who starts one is waiting on purpose. Shutdown is unbounded for a different reason — abandoning a half-done store flush is worse than a slow stop — so the command carries the bound instead.
GORTEX_MCP_TOOL_TIMEOUT is read in the server's own process, so set it in the
daemon's environment (or, when embedded fallback is enabled, the gortex mcp process),
not in the MCP client's config. It can always tighten the bound. It can only
raise it past 60 s on the embedded stdio server and Streamable HTTP — on the
daemon socket the per-request lifetime is a hard 60 s that clamps it. Raise it
when a tool legitimately runs longer than a minute: a first index_repository
over a very large tree, or ask against a slow local model.
| Tool | Description |
|---|---|
get_symbol_source |
Source code of a single symbol (80% fewer tokens than Read). Returns tokens_saved per call. compress_bodies stubs bodies (with an optional keep subset); max_lines salience-truncates to a control-flow skeleton |
batch_symbols |
Multiple symbols with source and a capped 1-hop callers/callees sample (callers_truncated / callees_truncated mark a cut; full neighbourhood is get_callers / get_call_chain) |
find_import_path |
Correct import path for a symbol |
explain_change_impact |
Risk-tiered blast radius with affected processes. A zero-edge target carries the same per-symbol likely_unused / possible_extraction_gap / coverage_incomplete caveat as get_callers |
get_recent_changes |
Files/symbols changed since timestamp. Rows are clamped to the session workspace and narrowed further by repo/project/scope; each multi-repo row names its repo |
edit_symbol |
Edit a symbol's source directly by ID — no Read needed. Line-ending tolerant: an LF-authored old_source matches a CRLF file (and vice versa) and the replacement adopts the file's endings (eol_normalized: true rides on the response). Optional base_sha content-hash guard refuses the write when the on-disk SHA has drifted; every success carries new_sha so the next edit can pipeline without re-reading |
edit_file |
Edit any file (markdown, config, spec, template, source) by exact string replacement — accepts absolute paths or repo-rooted paths. Line-ending tolerant: an LF-authored old_string matches a CRLF file (and vice versa) and the replacement is written with the file's own endings (eol_normalized: true rides on the response). Same base_sha / new_sha drift guard. Kills Read-before-Edit for files not in the graph |
write_file |
Create or overwrite any file — atomic temp+rename, re-indexes on write. Same base_sha / new_sha drift guard |
mutation_status |
What a file mutation actually did, after the fact. Reports disk_status (committed / not_applied / failed / in_flight) separately from graph_status (fresh / pending / stale / failed), selected by receipt, mutation_id, or path. Use it instead of retrying when an edit call was abandoned at its deadline |
rename_symbol |
Coordinated multi-file rename with all references — definition, graph usages, receiver lines, and test names that embed the old identifier. Replacement is whole-identifier, so renaming Get leaves GetUser intact. Every target line is re-verified against disk and every affected file is parse-gated before anything is written, so the rename lands completely or is refused; dry_run: true returns the identical edit list without writing. Successful responses carry status (applied / would_apply / no_edits) plus per-file bytes_written / new_sha / reindexed. An existing unindexed target returns a structured symbol_not_indexed error only when the configured extractor anchors the requested declaration. Its safe_fallback.request is a guarded exact edit of that declaration line (scope: declaration_only); same-file and cross-file references remain explicitly unproven, and the refusal itself writes no bytes |
move_symbol |
Relocate a function / method / type / variable / const to another file. Cross-package moves rewrite every qualified reference, drop the source import, add the target import, synthesise the target file if missing. Go for now |
inline_symbol |
Replace every callsite of a trivial single-statement / single-expression callee with the body — refuses cleanly on defer, spawn, close-over-scope, multi-return, or side-effecting arg. delete_after: true removes the declaration. Go for now |
safe_delete_symbol |
Atomic dead-code removal with a graph-aware safety gate. A cascade parameter (off / preview / apply) drives a fixed-point orphan-propagation pass; cross-workspace and out-of-closure callers (and, by default, test-only callers) disqualify a candidate |
set_planning_mode |
Switch the session between a guaranteed no-writes planning phase and editing mode |
workflow |
Drive a phase-enforcement state machine (explore → implement → verify) — editing tools are gated until the implement phase |
move_symbol and safe_delete_symbol (the facade's refactor move / refactor delete) relocate or remove one symbol, selected by symbol ID. move_symbol is Go-only — a non-Go symbol is refused with an explicit unsupported-language error — and a cross-package move rewrites every qualified reference and fixes the imports on both sides, while a same-package move leaves callers untouched. safe_delete_symbol works for any indexed language: it computes the referencing edges first and refuses the delete while any remain unless force is set, and propagate turns that refusal into a per-caller delete-and-patch plan.
batch_edit's move_file and delete_file operate on a whole file of any language and rewrite nothing: no callers, no imports, no symbol analysis. They take a path selector, and source and destination must both resolve inside an indexed repository. A destination is never overwritten — an existing destination fails the transaction — and a symlink source or a destination path with any symlink component below the repository root is refused, so a lifecycle write cannot escape the repository. Optional expected_sha256 pins the complete source bytes and fails the transaction on drift. The receipt records before/after digests per touched path, and a commit failure rolls every touched file back. Two batch paths that name one file are refused rather than given independent futures — a hard link, a case alias on a case-insensitive filesystem (which is what a case-only rename is), or a symlink and the file it points at. Two destinations that do not exist yet and whose names differ only by case or by Unicode normalisation (NFC versus NFD) — or that are the same name spelled through two paths to one directory — are refused on the same grounds, on every filesystem and even under a directory the batch would create: nothing on disk distinguishes them, so the batch cannot say which file was meant.
dry_run: true writes nothing and returns the resolved plan. A lifecycle entry carries resolved_path and source_state; a move_file entry adds resolved_destination and destination_state. A path state is {exists, kind, git, ignored} plus sha256 on a source that is a regular file — a destination never carries a digest. git is tracked / untracked / ignored / absent / unknown (git unavailable, not a repository, timed out, or a path git refuses to answer for, such as one that crosses a symlinked directory). A content edit is reported only when its path aliases another path in the batch, and then carries resolved_path and its status and nothing else. A lifecycle precondition, the destination guard, or the aliasing rule reports status: "conflict: …" spelled exactly like the abort it predicts; an argument failure reports status: "failed: …" — including an edit_symbol item whose file cannot be located because the request has no resolvable root or reads a committed tree, which the real run would refuse the same way; and the top-level conflicts counts both. Content edits are not checked against disk until the locked commit, so an absent path, a directory, or an old_string that is not there still reports planned.
Several tools return a hash and none of them are interchangeable. Pick by what you need to prove, not by which field is nearest.
| Field | Algorithm | Covers | Observed when |
|---|---|---|---|
base_sha (request) |
git blob SHA-1 | the full file the caller read earlier | — (a value you supply) |
new_sha (response) |
git blob SHA-1 | the bytes the tool was about to write | before the write |
content_sha256 (read_file) |
SHA-256 | the full file on disk | during the read |
before_sha256 / after_sha256 (mutations) |
SHA-256 | the full file on disk, before and after | before / after the write |
etag |
SHA-256 of the response payload | the returned representation, not the file | as the response is built |
Two consequences worth internalising:
new_shais a pipelining token, not physical evidence. It is a git blob SHA-1 (sha1("blob <len>\0" + data), the same valuegit hash-objectprints) computed from the in-memory buffer beforeAtomicWriteFileruns. It is what you feed to the next call'sbase_sha. It is not a SHA-256, it is not read back from disk, anddry_runreturns one for bytes that were never written.etagis not a file hash. It covers the JSON response — window, elision, redaction and all — so two reads of an unchanged file with different options carry different ETags.
To prove what is actually on disk, ask for it explicitly with
physical_evidence: true (see below). Anything else is a prediction or a
cache key.
read_file, edit_file, write_file and edit_symbol accept
physical_evidence: true (with an optional digest, sha256 only, which is
also the default). The read side returns content_sha256 plus hash_scope,
content_source, same_buffer_as_content and resolved_path; the mutation
side returns before_sha256 / after_sha256 re-read from disk after the
atomic write, plus resolved_path, byte_count and verified_at. Both are
hash_algorithm: sha256, hash_scope: full_file, content_source: disk.
Contract details that matter for an evidence workflow:
- The mutation digest is an observation, not a prediction. The file is read
back through the same hardened path
read_fileuses — non-regular files refused, symlink resolution recorded, repo-root confinement re-checked against the target that supplied the bytes. - A creating
write_filereportsbefore_absent: trueinstead of abefore_sha256, so "no prior bytes" is distinguishable from "not requested". dry_run+physical_evidenceis refused. A dry run writes nothing, so there are no disk bytes to attest.- Evidence failure never fails the call. If the read-back cannot be
completed or confinement is violated, the write is still reported as applied
and the response carries
evidence_errorwith no digests — failing the call would invite a retry that applies the edit twice. - Secret-shaped config leaves are withheld.
before_sha256digests bytes the caller did not supply, so a.env-shaped file refuses the receipt (the edit itself still works). Read its digest withread_file{allow_secrets: true}if you genuinely need it. - Multi-file mutations (
rename_symbol,batch_edit) do not yet take the flag;batch_edit's transaction journal carries its ownbefore_sha256/after_sha256, computed from in-memory buffers for crash recovery — not a disk observation.
Whether the graph caught up with the write is a separate question, answered by
graph_status (and the reindexed / reindex_pending / reindex_generation
fields behind it) on every mutation response. Whether the write happened at
all is a third question — see the next section.
A tool call is bounded (GORTEX_MCP_TOOL_TIMEOUT, default 60s). When a handler
outruns that budget the transport is released and the handler keeps running, so
a write can land after the client was answered. The mutating tools make that
observable instead of leaving it unknown:
- Before the disk commit, a cancelled request is refused and nothing is
written. The response says
disk_status=not_appliedand retrying is safe. - After the disk commit, the abandoned-call error names what landed —
path,
new_sha, and a receipt id — and carries a machine-readablemutation_commit={...}tail. Re-applying the edit would duplicate it. - Either way, the receipt is queryable for 30 minutes with
mutation_status(facade:changewithoperation: "receipt"), which reports the disk state and the graph-freshness state independently. edit_file/write_file/edit_symbolaccept an optionalmutation_ididempotency key. Retrying with the same key and the identical edit replays the original result without writing again; reusing it for a different edit is refused.batch_edithas the equivalenttransaction_id.
Successful edit responses carry disk_status, graph_status, and
mutation_receipt alongside the existing new_sha / reindexed fields.
physical_evidence and disk_status answer different questions and compose:
the first attests what bytes are on disk, the second whether the write
happened at all. A call abandoned before its response returns no evidence block
— only the receipt — which is exactly when disk_status is the field you need.
Set the daemon's startup configuration to choose when source edits acknowledge:
edit:
ack: fullfull is the default. It waits for the complete admitted patch, for up to the
existing three-second publication budget. local returns after the disk commit,
exact file projection when available, and watcher admission. Both policies
release source path locks before waiting; a graph failure never reverses a disk
commit. Invalid modes are rejected. This is daemon configuration, not a tool
argument, and the response's ack_mode records the policy used for the operation.
Existing require_fresh, freshness_scope, and wait_deadline metadata can
request a specific tier under either policy.
Each committed source-file response adds commit_seq, the actual raw-byte
content_sha256 when known, readback_exact, and graph_status_hint.
file_view is an object: state, delta_state, counts, symbols,
truncated, and syntax_health. Available counts include before, after,
added, removed, changed, and total_changes; they remain complete when
symbols displays only the first 20 deterministic changes. Each displayed row
has change, id, kind, start_line, end_line, and signature.
An unauthenticated prior symbol set yields an unavailable delta and null counts.
Syntax health is checked only when the acknowledgement's parse supplies an exact
verdict; unknown health has checked:false and null errors.
readback_exact:true requires that this write's projection is still live.
tier_state.file describes that physical file view independently of the
watcher-owned file_graph, relations, and derived stages. A newer write or
invalidation can make a replay's file view unavailable or historical. Replays
and mutation_status refresh live receipt evidence without parsing or writing
again. Transactional batches retain journal authority and report per-file
file_views; restarting does not reconstruct an original process-local
projection sequence from the journal. Report full/default and explicit-local
measurements separately; changing the mode does not establish a latency target.
readback_exact:true means the written bytes can be used immediately; continue
without polling. Graph relations and derived analyses can publish later. Check
graph_freshness before acting on callers, usages, impact, or rename plans.
Before a rename, deletion, or signature change, send require_fresh:true,
freshness_scope:"relations", and an absolute RFC3339 wait_deadline.
freshness_scope accepts file, relations, and derived as request metadata;
it is intentionally absent from tool schemas. Text and declaration capability
scopes do not select a publication tier.
Pending or failed answers carry a visible tier line in text/TOON/compact output;
GCX preserves its GCX1 header and places the line immediately after it. JSON
carries the same fields in its freshness block. An idle fresh answer gains no
fields. Never classify a symbol as dead while its file is pending.
mutation_status reads live ack_at, file_graph_at, relations_at, and
derived_at stamps when a watcher ticket observed them. Missing stamps mean
unobserved work. Unknown receipt or mutation IDs return state:"lost" immediately;
a lost receipt cannot certify freshness. After restart, relation queries remain
pending until the shared startup resolver has published. File reads still check
current disk state. CLI verbs print the freshness line on stderr;
--require-fresh exits with code 4 when the requested tier remains pending or
failed.
| Tool | Description |
|---|---|
explore |
One-shot localization: free task/bug text in, the ranked neighborhood out — likely symbols with source + call paths (1-hop callers/callees), a file map, and a completeness cue, packed under a token_budget (default 9000; bodies demote to signatures past it, truncation reported honestly). The opening move for any task-shaped request — folds the whole search/read/callers exploration phase into one call |
smart_context |
Task-aware minimal context — replaces 5-10 exploration calls. The working set is ranked through the full rerank pipeline. Always emits a blast_radius block (callers grouped by file + covering tests + a no covering tests found warning) and a file-clustered working_set; seed count and token_budget scale with graph size when unset. fidelity: "graded" returns a graph-distance-tiered context_manifest (large interchangeable symbol families are skeletonized to one representative) under one token_budget; estimate: true projects token cost without fetching; if_none_match dedups an unchanged pack to not_modified |
get_edit_plan |
Dependency-ordered edit sequence for multi-file refactors |
get_test_targets |
Maps changed symbols to test files and run commands |
get_untested_symbols |
Inverse of get_test_targets — functions/methods not reached from any test file, ranked by fan-in |
suggest_pattern |
Extracts code pattern from an example — source, registration, tests |
export_context |
Portable markdown/JSON context briefing for sharing outside MCP |
feedback |
action: "record": report useful/missing symbols. action: "query": aggregated stats — most useful, most missed, accuracy metrics |
ask |
Optional in-process LLM research agent (-tags llama + llm.model) — navigates the graph and returns a synthesized answer; chain: true for cross-repo call-chain tracing |
Gortex captures every large tool response into a bounded per-session ring; these tools re-cut a captured response without re-issuing the original query.
| Tool | Description |
|---|---|
ctx_stats |
List the session's buffered responses — handles, tools, line / byte / token counts |
ctx_grep / grep_results |
Regex (or literal) search over a buffered response — structured matches[] plus a grep-style block with -A/-B/-C context |
ctx_slice |
An explicit line range of a buffered response |
ctx_peek |
Head + tail preview of a buffered response |
head_results |
The first N lines of a buffered response |
| Tool | Description |
|---|---|
get_communities |
Functional clusters (Louvain). Without id: list all. With id: members and cohesion for one community. Members and files are clamped to the session workspace; the partition is global, so a repo/project/scope narrowing is widened to the workspace and the response discloses it |
get_processes |
Discovered execution flows. Without id: list all. With id: step-by-step trace. Clamped to the session workspace and narrowed further by repo/project/scope — out-of-scope steps are excised by subtree so the surviving chain keeps its real call shape |
detect_changes |
Git diff mapped to affected symbols, plus a file-level view (changed_files / file_changes with added/modified/deleted/renamed) that stays populated for changes carrying no indexed symbol. Untracked and ignored files are not observed — every scope reads git diff. |
index_repository |
Index or re-index a repository path |
reindex_repository |
Incrementally re-index a tracked repository — whole-root, or scoped to an optional paths subset. Multi-repo aware |
contracts |
API contracts. action: "list" (default): detected HTTP/gRPC/GraphQL/topics/WebSocket/env/OpenAPI. action: "check": orphan providers/consumers |
find_co_changing_symbols |
Ranked git co-change neighbours for a symbol — over the mined cosine-weighted co_change edge layer |
search_artifacts |
Full-text search over the context-artifacts manifest — DB schemas, API specs, infra configs, ADRs registered via .gortex.yaml::artifacts |
get_artifact |
Fetch one context artifact by id, with its content and the symbols it references |
detect_changes and explain_change_impact wait up to 250 ms for edits in the answer's relation scope: the symbols' files, their callers, files naming the symbols, and the diff's changed files. Edits outside that scope do not delay the answer. Pending or failed edits return the usual analysis with complete:false, graph_freshness:pending|failed, freshness_scope:relations, pending_files (at most 16), and pending_file_count; failures include a recovery hint. Every answer reports barrier_wait_ms. An earlier wait_deadline shortens the wait; require_fresh:true instead waits until its request deadline and returns an error if the scope is still lagging. Text answers begin with relations: pending|failed (N files); GCX preserves GCX1 on line 1 and puts the relations comment on line 2. Stop and post-edit briefings bound detection to 300 ms and report pending relations instead of silently omitting the briefing.
| Tool | Description |
|---|---|
verify_change |
Check proposed signature changes against all callers and interface implementors |
check_guards |
Evaluate project guard rules (.gortex.yaml) against changed symbols |
audit_agent_config |
Scan CLAUDE.md / AGENTS.md / .cursor/rules / .github/copilot-instructions.md / .windsurf/rules / .antigravity/rules for stale symbol references, dead file paths, and bloat — validated against the live graph |
| Tool | Description |
|---|---|
analyze |
Unified graph analysis dispatcher. kind ∈ dead_code, hotspots, cycles, would_create_cycle, connectivity_health, todos, blame, coverage, coverage_gaps, coverage_summary, stale_code, stale_flags, ownership, releases, cgo_users, wasm_users, orphan_tables, unreferenced_tables, channel_ops, goroutine_spawns, field_writers, race_writes, unclosed_channels, unsafe_patterns, health_score, impact, annotation_users, config_readers, env_var_users, sql_call_sites, fixes_history, edge_audit, domain, named, tests_as_edges, clusters, event_emitters, pubsub, string_emitters, error_surface, log_events, sql_rebuild, external_calls, routes, models, components, k8s_resources, images, kustomize, cross_repo, dbt_models, synthesizers, resolution_outcomes. clusters takes an algorithm arg (leiden / louvain / spectral). impact takes an optional target ({symbol} or {file}): with one it ranks that target's blast radius — the target row first, then its transitive dependents with their depth — and reports the closure width plus whether it is exact; without one it ranks the whole repo. An unresolvable target is a structured error, never a silent fall-back to the repo-wide ranking. synthesizers rolls up every framework-dispatch-synthesized edge by the pass that produced it; resolution_outcomes classifies unresolved call/reference edges by why the resolver gave up (ambiguous_multi_match / candidate_out_of_scope / cross_language_only / stub_only / no_definition) |
find_clones |
Near-duplicate function/method clusters from the MinHash + LSH similar_to layer; dead_only: true finds dead duplicates of live code |
index_health |
Health score, parse failures, stale files, language coverage, tracked-repo path liveness (tracked_repo_paths_ok + missing_repo_paths — a repo whose directory was deleted still holds its registration and silently drops out of workspace-wide answers), per-(repo, provider) semantic-enrichment lifecycle (semantic_enrichment: running / completed / partial / abandoned / failed with edge counts, plus a semantic_enrichment_ok rollup) — a green file count with a partial enrichment state means LSP-tier edges are incomplete. path_liveness asks the same question one level down, per file: it stats the paths the graph itself claims and reports how many indexed files no longer exist on disk (orphan_files / orphan_rate / orphans_by_repo, sampled with truncated: true past 20k files). stale_files only covers files the daemon still tracks, so a deletion it never witnessed shows up here and nowhere else; a non-zero orphan_files caps health_score. On a SQLite-backed daemon a planner_stats object reports the query planner's own view of the store: nodes / edges carry believed (the leading token of the index's sqlite_stat1 row) against actual_from_counters (the repo_index_state counter sum across ALL view generations, flagged by counters_known; no counter row describes the external-call bucket or nodes carrying no repo prefix, and a leftover empty-prefix row on a store that later became multi-repo is summed on top of the per-repo rows, so the pair is an approximation of index cardinality and a difference between the two is not a measured discrepancy), receivers carries a bounded: true LIMIT-capped probe of the Go receiver index plus complete (false means the probe stopped at its cap, so actual is a lower bound and must not be compared with believed) and is omitted entirely when the receiver index is not in the schema — a bulk load has dropped it, or this store never had it, and a believed: 0 there would read as the poisoned near-zero row rather than as an absent index. stale says whether the graph has outgrown what the planner believes — which can invert join order on receiver/edge queries — while reason names every verdict, staleness or not: bulk_window_active is why a cold load in progress reports zeros, and dense_indexes_missing means a cold load closed without rebuilding some of its dense indexes (typically because the volume filled up during the final index rebuild): dense_indexes_missing in the same object names them, lookups that use them scan until they are back, and the store rebuilds them in the background once its volume has free space at least the size of the store (a daemon restart also rebuilds them). last_refresh_at / last_refresh_reason appear once this process has rebuilt them. The field is read-only: statistics refresh at the next repository index, commit/HEAD move, whole-graph resolve or generation build, never from reading this payload — and that refresh is cooperative, so a busy writer, a spent per-pass budget or a per-index timeout defers the rest of the work to the following boundary (which resumes where the last one stopped) rather than stalling the pipeline that noticed |
get_symbol_history |
Symbols modified this session with counts; flags churning (3+ edits) |
The analyze dispatcher also accepts a set of facade-aliased kinds that route to the captured legacy handler instead of the dispatcher switch: processes → get_processes, communities → get_communities, contracts → contracts, architecture → get_architecture, clones → find_clones, health → audit_health, inspections → run_inspections, recent_changes → get_recent_changes, and the other entries of the facade analyze migration table (see mcp-facade-v1.md). These aliases are surface-independent: they work for client (facade-v1), explicitly legacy-preset, and session-less HTTP callers alike, with no tools_search promotion — the HTTP dashboard endpoints depend on this under the core/defer default. |
The in-graph coverage tools above (analyze kind=coverage*, index_health language coverage) have an offline, whole-corpus counterpart for regression testing: the gortex eval parity CLI benchmarks per-language resolved cross-file-dependent coverage against a frozen baseline and is CI-fenced three ways — a per-language coverage floor, a frozen at-or-beyond-parity language count, and per-feature extraction goldens. See features.md.
| Tool | Description |
|---|---|
scaffold |
Generate code, registration wiring, and test stubs from an example symbol |
batch_edit |
Atomically apply edit_symbol, edit_file, move_file, and delete_file operations with durable rollback receipts |
diff_context |
Git diff enriched with callers, callees, community, processes, per-file risk |
prefetch_context |
Predict needed symbols from task description and recent activity. Accepts max_bytes / max_tokens budget caps |
batch_edit selects each item by op: edit_symbol {id, old_source, new_source}, edit_file {path, old_string, new_string, replace_all?}, move_file {source, destination, expected_sha256?}, and delete_file {path, expected_sha256?}. The last two are the whole-file lifecycle operations — path-selected, language-agnostic, and rewriting no callers, unlike the symbol-selected move_symbol / safe_delete_symbol (see Symbol refactors versus whole-file lifecycle). Compact-surface clients reach the same set through edit(operation:"batch") with the items under changes; capabilities(domain:"edit", operation:"batch", detail:"schema") returns one example per op.
A graph-grounded pull-request review surface. The forge-data tools self-serve PR data via the daemon's own forge client (needs GH_TOKEN / GITHUB_TOKEN in the daemon environment), or accept caller-supplied data to skip the network; all are read-only. The review gate is AST-grounded — the deterministic correctness rulepack runs over the changeset and a graph-grounding pass drops false positives, with an opt-in LLM fold-in. The CLI exposes the same surface as gortex prs / gortex review (cli.md).
| Tool | Description |
|---|---|
list_prs |
List a repo's PRs with a one-shot review-state classification — a state label (DRAFT / BASE_MISMATCH / CHANGES_REQUESTED / APPROVED / STALE / READY), a normalized CI rollup (NONE / FAILURE / PENDING / SUCCESS), and merge blockers. Pass prs to classify an already-fetched set with no network call |
get_pr_impact |
Graph-joined blast radius + risk score for one PR — maps the PR's changed files to symbols, scores five risk axes (blast-radius flow, caller fan-in, coverage gap, security keywords, community span), groups the affected surface by community and caller/test file. receipt: true emits a privacy-safe review receipt |
triage_prs |
Rank a repo's open PRs by graph-derived review priority — get_pr_impact per PR ordered by composite risk (deterministic; use_llm re-ranks with one compact LLM pass + per-PR rationale). Decides which PR to review first |
pr_risk |
PR-level composite risk score for a set of changed symbols — five 0-100 axes into one score + a LOW/MEDIUM/HIGH/CRITICAL level and an ordered review_priorities list. Pass ids (mapped symbol IDs) or base (a git ref — changed set from the diff) |
conflicts_prs |
Surface merge-order conflict risk — maps each open PR to the graph communities it touches and reports the communities touched by more than one PR, with colliding PR numbers, a suggested safe merge order, and a conflict-risk score. Plan a merge train that minimises rebases |
suggest_reviewers |
Rank the people / teams best placed to review a changeset — blends CODEOWNERS matches, recent authorship of the changed symbols, and co-change experts into one ranked list with per-reviewer reasons. Pass ids, base, or number |
suggested_review_questions |
Prioritised, symbol-anchored review questions mapping the changeset to graph anomalies — bridge / hub_risk / surprising / thin_community / untested_hotspot — each tied to a symbol id + file + line with a HIGH/MEDIUM/LOW severity |
pr_review_context |
Deterministic, LLM-free PR-review rollup in one call — composes diff_context, verify_change, simulate_chain (gated on an explicit overlay session), and audit_agent_config into a composite PASS / WARN / BLOCK verdict. The cheap counterpart to review_pack |
sibling_diff_context |
Raw unified diff of the OTHER changed files in a changeset — the sibling changes a per-symbol / per-file review view filters out, ranked by relatedness to the focus (shared community/process → co-change → directory proximity) |
review |
Review a changeset → line-anchored inline comments + a BLOCK/REVIEW/APPROVE verdict. Runs the deterministic correctness rulepack (graph-grounded to drop false positives) over the changeset (base / scope, or a pasted diff); use_llm folds in LLM findings relocated to exact lines |
review_pack |
The single AST-grounded PR-review entrypoint — folds the graph-grounded review, per-symbol semantic classification, per-file risk, contract-impact + guard/architecture checks, and impacted test targets into one envelope, with a derived verification_command and a privacy-safe receipt |
critique_review |
Second, adversarial self-critique pass over a prior review's findings — asks the LLM (grounded in the diff) which findings are genuine vs false positives, returns the kept set, the dropped set each with a reason, and a revised verdict. Conservative: a disabled LLM keeps everything |
post_review |
Post review findings as inline comments on a GitHub PR / GitLab MR — each anchored to its file + line, batched into one review. Every body is secret-redacted before any payload is built; public / fork PRs require confirm_public: true; dry_run: true returns the would-post payloads with no network call |
suppress_finding |
Durably silence a review finding as a false positive (or list / remove) for the current repo — keyed over rule / category / symbol / file / source text so it survives the finding shifting lines. A permanent per-repo never-flag-again list (sidecar-backed) |
analyze also takes kind: "review" — the idiomatic/correctness rulepack (NPE / thread-safety check-then-act / N+1 / logic-error, Go + Python) with the same graph-grounded false-positive-reduction post-pass that backs the review tool.
| Tool | Description |
|---|---|
track_repository |
Add a repo at runtime — indexes immediately, persists to global config |
untrack_repository |
Remove a repo — evicts nodes/edges, persists to global config |
set_active_project |
Switch active project scope for all subsequent queries |
get_active_project |
Return current project name and its member repositories |
list_repos |
List every project/repo in the active workspace |
workspace_info |
Workspace identity — bind mode, root directory, marker contents, discovered member set |
query_project |
Search symbols in another project or repo without a set_active_project switch — read-only cross-project lookup |
save_scope |
Save a named, reusable set of repository prefixes — accepted by search_symbols / smart_context via scope |
list_scopes |
List every saved repository scope |
delete_scope |
Delete a saved repository scope by name |
A view is what one request reads through. The session CWD automatically selects its checkout: an ordinary linked worktree is discovered and represented as an overlay over the family's designated primary, without an explicit track_repository call. Explicit tracking is reserved for a user-requested dedicated logical graph. Any request may name a different view explicitly. See multi-repo.md for the storage and lifecycle model.
view is request context, not a tool parameter: the server reads it off the arguments and strips it before parameter reconciliation and before any handler runs, so every tool honours it and no tool schema declares it.
// Search the index as it stands on another branch.
{"name":"search_symbols","arguments":{"query":"Login","view":{"kind":"git_ref","value":"refs/heads/release-2","graph_id":"graph-1f0c…"}}}
// Read a file through one registered worktree.
{"name":"read_file","arguments":{"path":"internal/auth/login.go","view":{"kind":"worktree","checkout_id":"018f…"}}}Graph and checkout ids are opaque; list_checkouts (CLI: gortex repos families) lists them per family alongside the repo prefix each graph serves.
kind |
Required field | Selects |
|---|---|---|
auto (default when view is omitted) |
— | the session's own view: its cwd's checkout when that checkout is served automatically, else the base corpus |
base |
graph_id |
one persisted base graph by id |
worktree |
checkout_id or absolute root path |
one registered checkout's automatic route, including its working-tree edits |
git_ref |
value |
the commit a full ref points at — under refs/heads/, refs/tags/, or refs/remotes/ |
commit |
value |
one commit by object id — a full lowercase hex oid, 40 (SHA-1) or 64 (SHA-256) characters |
git_ref and commit also take an optional graph_id. kind, graph_id, checkout_id, path and value are the only accepted fields, and each must be a string. A worktree selector accepts exactly one of checkout_id and path.
Rules worth knowing before a client builds selectors:
- Full names only. Short refs (
main),HEAD, revision expressions (main~1,a..b,x@{1}) and abbreviated object ids are rejected — they resolve against ambient state, and a pinned view may not. Values are never trimmed: surrounding whitespace is a malformed value, not a typo. - Multi-repo disambiguation. A
git_ref/commitselector with nograph_idresolves only when the session reaches exactly one repository; reaching several fails withinvalid_view_selectornaming them, so name one withgraph_id. - Scope still applies. A
baseorworktreeselector naming a graph or checkout outside the session's workspace is refused withselector_out_of_scope, and the scope check runs before the readiness check so a session cannot probe a sibling workspace's build state. - Substitution is always labelled.
exact: falsemeans the requested view was not served. Every fallback is read-only. Setrequire_exact: truewhen substitution is unacceptable. - Exact worktree edits are supported through the coordinator-backed write path. Fallback, inactive ref, and commit views remain read-only and return
view_read_onlyfor mutation. - A view of a committed tree has no working copy, so its files are served out of the object store and a file location is reported as a
gortex-view://<view-fingerprint>/<repo-prefix>/<path>identity instead of an on-disk path.
The view is resolved before the session's overlay is prepared, so pushed editor buffers layer on top of whatever answers.
Every view-aware response says which view answered, in the same freshness block file-drift provenance already uses. It always rides on the response envelope's _meta, and is additionally merged into the payload where the wire format has a home for it — into a JSON object's own freshness, or into a GCX header's meta channel — so a client that reads only the payload still sees it. Shapes with no structural home (TOON, the one-line text form, a diagram) carry it on the envelope alone. An empty field is omitted.
| Field | Meaning |
|---|---|
requested_view |
the selector the caller sent, rendered as kind plus its payload — auto, base:<graph-id>, worktree:<checkout-id>, git_ref:<ref> or git_ref:<graph-id>:<ref> |
actual_view |
what served the request — a selector string, or the view fingerprint when the server pinned one |
exact |
whether actual_view is the view that was requested |
fallback_reason |
why it is not; set exactly when exact is false |
view_fingerprint |
identity of the content that answered — the authority half of every gortex-view:// URI in the same response |
requested_ref / resolved_ref / resolved_commit / resolved_tree |
the ref or object id the selector named, and what it resolved to when the request was served (resolved_ref is empty for a commit selector) |
build_token |
an in-progress build the caller can poll |
retry_after |
poll hint, in whole seconds |
degraded_capabilities |
capabilities this view does not serve completely that the request did not require — each with the state it was found in |
base_scoped |
capabilities a base-scoped engine answered while a routed view served the request |
A view is rarely complete all at once: source bytes are readable long before the syntax graph is resolved, and vector search may never be enabled at all. Three request-level arguments — read and stripped on the same seam as view — let a caller state what it needs instead of accepting a silently thin answer.
| Argument | Type | Effect |
|---|---|---|
require_complete |
bool (a "true" / "false" string is accepted) |
promotes the calling operation's own default capabilities to required |
required_capabilities |
array of names, or one comma-separated string | adds to whatever require_complete produced; the request fails if the view cannot serve them |
optional_capabilities |
same shapes | annotates only — never fails a request |
The schemas also publish three consistency controls on every view-aware tool: require_exact rejects substitution, require_fresh waits until the selected worktree reflects current filesystem state, and wait_deadline is the absolute RFC3339 deadline bounding that wait. A deadline without a wait requirement is rejected rather than ignored.
Selector and freshness behavior depends on whether the request needs source bytes or graph relationships:
| Selection / read | Freshness controls | Result |
|---|---|---|
Dedicated checkout CWD (auto), or base with its graph_id; indexed graph read |
No require_fresh, with or without require_exact |
Reads the indexed corpus. Exact selection alone does not require a current working-copy graph. |
| Same dedicated/base graph read | require_fresh:true, without require_exact |
Answers with fresh:false and fresh_reason:committed_base_advance_unimplemented. |
| Same dedicated/base graph read | Both require_fresh:true and require_exact:true |
Refuses with capability_unavailable, preserving committed_base_advance_unimplemented; no fallback is served. A later wait_deadline cannot advance this committed base. |
Dedicated checkout selected as worktree, by checkout ID or absolute root path, without a ready automatic route; graph read |
With or without strict freshness | Refuses with capability_unavailable. Use view:{kind:"base",graph_id:"<dedicated-graph-id>"} to read its indexed graph without require_fresh, or select an automatic checkout for a fresh working-copy graph. No build token or retry hint is advertised. |
Automatic checkout selected as worktree; graph read |
Strict selection while the route is pending | Activates its coordinator and returns view_building. A missing route or coordinator_live:false alone does not establish an unsupported capability. |
| Automatic checkout; graph read | require_fresh:true |
Waits for publication up to wait_deadline; a successful exact answer reads the published route. Without require_exact, an unfresh answer remains labelled; with it, transient failures retain their specific refusal codes and reasons. |
Supported source-only file read, including read operation file through an explicit dedicated worktree selector |
With or without strict freshness | Proves the bytes it serves independently of graph publication. freshness_scope:file and fresh:true certify only those bytes; inspect graph_freshness before relying on relationships. |
File read with a nonempty context.keep, or explicit graph capability requirements |
With strict freshness | Uses graph selection and freshness rules above; a dedicated checkout's unsupported graph request remains capability_unavailable. |
For dedicated/base graph reads, remove require_fresh (and its wait_deadline) to read the indexed graph. Selecting base alone does not make that graph working-copy fresh. The same consistency controls are accepted inside a facade request's options object. Scope, checkout accessibility, catalog failures, and primary readiness are checked before disclosing an unsupported worktree capability.
Defaults that were not required are still evaluated and reported under degraded_capabilities. A request the base corpus serves is exempt: the base is a plain whole index with no producer rows to read.
The capability vocabulary is closed — an unknown name is refused with invalid_view_selector rather than silently requiring nothing:
| Group | Ids |
|---|---|
| source | source.snapshot, source.config |
| graph | graph.syntax, graph.resolution.local, graph.resolution.cross_repo, graph.incoming_edges, graph.similarity |
| search | search.symbols, search.content, search.vector, search.text |
| lsp | lsp.references, lsp.diagnostics, lsp.hover, lsp.rename, lsp.code_actions |
Each is in one of five states for a given view: complete, incomplete, building, unavailable, disabled_by_config. A required capability in a terminal state (unavailable, disabled_by_config, or undeclared by the view) refuses the request with capability_unavailable — waiting cannot clear it. One that is merely building or incomplete refuses with required_capability_incomplete, which a retry can clear.
Every refusal on the view path carries a stable code as the first token of the message. The codes are a wire contract — a client may switch on them, and none is ever reworded.
| Code | Meaning |
|---|---|
invalid_view_selector |
malformed selector — unknown kind or field, a non-string value, a missing required field, a ref name git itself would reject, an abbreviated object id, or an unresolvable repository for a bare ref |
selector_conflict |
the selector carries a field its kind does not use |
selector_out_of_scope |
the selector names a repository or checkout outside the caller's workspace |
ref_not_commit |
the selector resolved to an object that is not a commit |
ref_not_available_locally |
the ref or object is well-formed but the local object store does not have it |
view_building |
the view exists but is still being built; the response carries build_token and retry_after (2 s for a ref view) |
view_read_only |
the request would mutate a view that only serves reads |
capability_unavailable |
a required capability cannot be served by this view at all |
required_capability_incomplete |
a required capability exists but is still building or only partly populated |
checkout_inaccessible |
the checkout backing the view cannot be read — not registered, not ready, unmounted, or permission denied |
no_primary |
the family has no primary base graph to compose a view over |
source_object_missing |
the source bytes a result points at are gone from the object store |
A ref view that is rebuilding while already serving an older generation answers with that generation rather than refusing, marked exact: false with the view_building reason and the build token to poll — so the answer is never mistaken for the requested tree.
Checkout administration is one surface with two front doors; the CLI verbs under gortex repos call exactly these tools (cli.md). Every destructive tool previews by default: a call without confirm reads the catalog, returns what would happen, and writes nothing.
Three of these verbs — untrack_repository, forget_checkout and explain_view — name their target explicitly, answer from catalog rows and read no graph, so they run without binding the calling session's working directory to a checkout view. Every other tool binds it first and refuses with view_building or checkout_inaccessible when that binding cannot be made.
These three must not carry that gate, because a broken binding is the state they exist for. gortex untrack <path> relays through an MCP session whose cwd IS the checkout being removed, so requiring discovery of that checkout to succeed first makes the verb unavailable exactly when the working copy is one git is slow to answer for — or no longer answers for at all — and retrying the removal does not make it any easier to discover. explain_view is the tool you reach for to find out why, so refusing it for the reason it was called to report leaves nothing to diagnose with.
A read that answers off the graph never joins them, however convenient it would be: serving it through an unbound cwd would answer from the wrong corpus.
| Tool | Description |
|---|---|
list_checkouts |
List the checkout families this daemon tracks — per family the primary corpus and epoch, its dedicated graphs, every registered working copy (mode, state, both reconciler clocks with their deadlines, path evidence, route, whether a build coordinator is live) and the views rooted in its graphs. family narrows by family id / graph id / repo prefix / a path inside a tracked repo. Reads the catalog only |
set_primary_checkout |
Make one corpus (graph: a graph id, repo prefix, or path) the base every automatic checkout of its family composes over. Previews the incumbent, the epoch, whether the move is accepted, and every checkout that must rebuild its layers; confirm: true runs it |
forget_checkout |
Remove one checkout (path: a path or repo prefix), its corpus and everything rooted in it. Unlike untrack_repository it never demotes the checkout into the family's automatic lane. Previews the closure; confirm: true runs it |
reconcile_checkouts |
Reconcile families against git and the filesystem now instead of waiting for the janitor — identities confirmed or allocated, the availability and removal clocks moved, build coordinators brought in line. family scopes it; omit for every family |
explain_view |
Explain which graph answers for one filesystem path: the checkout it binds to, how that checkout is served, its route and the generations behind it — or the step in the chain that could not be taken and left the base corpus to answer |
All five take format (json default, gcx, toon) and max_bytes.
Editor extensions push in-flight (unsaved) buffers as overlays. Gortex composes a per-request shadow view on top of the immutable base graph and threads it through the tool dispatch context — every subsequent tools/call from the same MCP session reads through the shadow. Graph-walking tools (find_usages, get_call_chain, analyze, …) and source-reading tools (get_symbol_source, get_editing_context, …) all see the editor-buffer state without per-tool changes.
Base is never mutated by overlay flow. Concurrent sessions each see their own view; the file watcher's reindex passes don't race with overlay queries; cross-file edges from non-overlaid files into overlaid symbols are preserved.
| Tool | Description |
|---|---|
overlay_register |
Bind an overlay session to the current MCP session ID (idempotent) |
overlay_push |
Push (or update) a single file overlay; base_sha enables drift detection, deleted: true previews a delete |
overlay_list |
List every overlay attached to the session — path / size / deleted / base_sha |
overlay_delete |
Remove one overlay from the session |
overlay_drop |
Tear down the session and discard every overlay |
overlay_keepalive |
Refresh the session's idle timer without re-pushing buffer content; cheap option for debugger / wizard pauses |
compare_with_overlay |
Run find_usages / get_callers / get_call_chain / get_dependencies / get_dependents against base AND overlay; returns added / removed / common ID sets |
Branching — N parallel speculative sessions off one baseline. Each overlay session carries an active-branch pointer plus a branches map; every legacy overlay tool operates on the active branch, so callers that never touch branches see exactly one implicit main branch and behave unchanged. With branches, an agent can hold strategy A and strategy B simultaneously off the same baseline, evaluate each, and merge the winner.
| Tool | Description |
|---|---|
overlay_fork |
Clone the active (or named) branch into a new branch; optional activate: true flips the session pointer |
overlay_branches |
List every branch with active flag, file count, base_sha anchor count, parent, and created_at |
overlay_switch |
Flip the session's active branch |
overlay_merge |
Fold one branch into another (default target: main) or write the branch to disk through the same atomic-write + base_sha drift guard as edit_file. Same-path divergent content is refused without force: true; force resolves last-writer-wins |
overlay_drop_branch |
Delete a named branch — refuses to drop the active branch or the implicit main |
compare_branches |
Run find_usages / get_callers / get_call_chain / get_dependencies / get_dependents against two branches and report each side plus the delta |
HTTP transport mirrors the surface at /v1/overlay/sessions/*. The /v1/tools/<name> entry point resolves the caller's real session identity from Mcp-Session-Id (preferred) or ?session_id= — this identity drives every per-session subsystem: tool-policy gating, token-stats accounting, notes/memory scoping, and so on. X-Gortex-Overlay-Session, when present, is a narrower, independent override that scopes only overlay state to a different cohort id than the caller's own session (e.g. a CI harness orchestrating several overlay scopes from one connection) — it never substitutes for the real session identity anywhere else. Overlays are bound to their cohort id; the synchronous drop-on-disconnect only fires for a cohort that matches its own MCP transport session (ReleaseSession drops by session id) — a cohort explicitly named via X-Gortex-Overlay-Session lives until the idle TTL regardless of the owning connection's lifetime. Idle TTL is a fail-safe (default 30 m, configurable via GORTEX_OVERLAY_IDLE_TTL); every tool call against a live overlay refreshes it.
Built on the same shadow-graph substrate, preview_edit and simulate_chain answer "what would change if I applied this WorkspaceEdit?" without ever touching disk or mutating the base graph. The input is a standard LSP WorkspaceEdit (changes / documentChanges), so any agent that already produces WorkspaceEdits for code actions can speculate on them directly. Per-step impact: touched files, added / removed / renamed symbols (non-trivial-signature rename heuristic), broken callers, broken interface implementors, blast-radius rollup, suggested test targets, and (when an LSP is configured) round-trip diagnostics restored to the on-disk state at simulation end.
| Tool | Description |
|---|---|
preview_edit |
Single-shot WorkspaceEdit → impact report. Optional diagnostics: false skips the LSP round-trip. inherit_overlay: true layers on top of the caller's current overlay |
simulate_chain |
Ordered sequence of WorkspaceEdits applied in order with per-step impact + cumulative rollup + per-step diagnostics delta. stop_on_error: true (default) aborts on the first new ERROR-severity diagnostic. keep: true promotes the final simulated state into a real overlay session bound to the caller |
Read-only, URI-addressable, no args. Clients that speak resources can resources/subscribe once and receive notifications/resources/updated after each graph re-warm — no polling.
| Resource | Description |
|---|---|
gortex://session |
Current session state and activity |
gortex://stats |
Graph statistics (node/edge counts) |
gortex://schema |
Graph schema reference |
gortex://guide |
On-demand reference: LLM-provider matrix, capabilities, token-economy, analyze/search_ast catalogs, workflow |
gortex://guide/{topic} |
One guide section by topic (providers, capabilities, tokens, analyze, search_ast, resources, workflow) |
gortex://index-health |
Health score, parse failures, stale files |
gortex://workspace |
Workspace identity and discovered member set |
gortex://repos |
Tracked repo / project list |
gortex://active-project |
Active project name and member repos |
gortex://communities |
Community list with cohesion scores |
gortex://community/{id} |
Single community detail |
gortex://processes |
Execution flow list |
gortex://process/{id} |
Single process trace |
gortex://report |
High-level orientation — graph size, top languages/kinds, hotspot / dead-code / todo counts |
gortex://god-nodes |
Top 20 hotspots |
gortex://surprises |
Cycles + dead code + cross-community call hubs |
gortex://audit |
audit_agent_config with discovery defaults |
gortex://questions |
TODO / FIXME / XXX / HACK / QUESTION rollup grouped by tag and assignee |
| Prompt | Description |
|---|---|
pre_commit |
Review uncommitted changes — shows changed symbols, blast radius, risk level, affected tests |
orientation |
Orient in an unfamiliar codebase — graph stats, communities, execution flows, key symbols |
safe_to_change |
Analyze whether it's safe to change specific symbols — blast radius, edit plan, affected tests |
index_health includes last_first_index_drain after a full shadow index has
persisted, keyed by repository prefix. Daemon status exposes the same snapshot
under storage, together with dense_indexes_missing when a failed seal owes
index repair. A drain records its actual window kind, node/edge counts, drain
and seal-call durations, completion time and any seal error. A coordinated
window seals at its outer boundary, so its per-repository seal call can be a
no-op. wal_peak_scope=shared_store_drain_chunk_samples identifies physical WAL
observations at the start, bounded graph/FTS chunks and seal boundaries. This
is a sampled peak on the shared store; concurrent repository work can contribute
and a peak between samples can be missed. Missing observations
are omitted, and these process-local snapshots reset when the store reopens.