Skip to content
Back to skills

Terser Index

BSecurity

Symbol-first AST navigation, source retrieval, blast radius, and safe refactoring via Terser's 6-tool Counter MCP. Use before Grep/Read whenever you need to find where a function, class, or symbol is defined or used, who calls it, what an edit or delete would break, or the minimal source for a task in an indexed repo (the session brief says "Code index ... ready").

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentspythongoshellbashnextjsnodefastapiflaskrefactoringgit

Works with

  • cursor
  • cli
  • api
  • mcp

Security analysis

B75/100
  • criticalPipes output to a shell interpreter

Pro shows the line behind each finding and how to fix it

Scanned December 5, 2026

npx -y skills add HyperExtendedReality/terser --skill terser-index --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Terser Index?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Terser Index
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/hyperextendedreality-terser-index/badge)](https://www.skillsdirectory.com/skills/hyperextendedreality-terser-index)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: terser-index
description: Symbol-first AST navigation, source retrieval, blast radius, and safe refactoring via Terser's 6-tool Counter MCP. Use before Grep/Read whenever you need to find where a function, class, or symbol is defined or used, who calls it, what an edit or delete would break, or the minimal source for a task in an indexed repo (the session brief says "Code index ... ready").
---

# Terser Index — Symbol-First Navigation Workflow

`terser-index` exposes a **6-tool Counter front door** (`menu`, `route`, `order`, `index_folder`, `search_symbols`, `get_symbol_source`). Every other action below runs through `order(action="<name>", args={...})`. `repo` is optional when the cwd (or the only indexed repo) resolves it.

1. **Discover / route**: `route(task="...")` recommends an action; `menu(query="...")` prints exact arg shapes.
2. **Locate symbols**: `search_symbols` (identifier-aware BM25 ranking, typo fallback, exact names first; `_meta.ranking` carries confidence and gap, `coverage_state`/`absence_assertable` say whether an empty result proves absence; `importance_prior: true` adds a bounded PageRank prior) → then fetch ONLY the exact body with `get_symbol_source` (`symbol_id`, optional `start_line`/`end_line`). Batch several with `get_symbols` (`symbol_ids`).
3. **Task context**. Use `assemble_task_context` (`task`, `token_budget`) for source in one call. Use `search_context` (`query`, optional `path` and `limit`) to rank symbol and text hits together, or `get_context_manifest` (optional `task`, `path`, and `limit`) for exact ranges and their revisions. Read a range with `fetch_context` (`path`, `start_line`, `end_line`, optional `limit`), and pass the previous revision as `if_revision` when you already have the source. Use `recut_context` with a new range or a returned `next_cursor`. A cursor becomes stale when the source file changes.
4. **Structure**: `get_repo_outline`, `get_file_tree`, `get_file_outline` (`file_path`), `search_text` (`query`, `path`, `limit`, `case_sensitive`). Set `regex: true`, `glob`, or `live: true` for live ripgrep. Use `repo_atlas` (`path`, `force`) for the cached L0 module DAG and entrypoints, `module_surface` (`module`, `path`, `limit`) for L1 public API surface and cross-module edges, and `hot_neighbors` (`files`, `path`, `limit`) for co-changed/co-accessed neighbor files.
5. **Usage & graph**:
   - `find_references` (`symbol`): every line using the name, definition lines excluded.
   - `find_importers` (`module`: dotted name or repo-relative path): files importing it, tagged `[relative]`/`[name]` when the match is weaker than exact.
   - `get_call_hierarchy` (`symbol`, `depth` 1-4, default 2): callers and callees tree.
   - `get_blast_radius` (`symbol`): files referencing a symbol, with def/importer tags.
   - `get_dependency_cycles`: import cycles between indexed files.
6. **Preflight safety** (verdict + affected files):
   - `check_edit_safe` (`symbol`): SAFE / CAUTION / RISKY.
   - `check_delete_safe` (`symbol`): SAFE / UNSAFE.
   - `check_rename_safe` (`symbol`, `new_name`): SAFE / REVIEW / CONFLICT.
   - `preview_rename` (`symbol`, `new_name`, optional `stage_session`) emits exact global SCIP occurrences with per-file SHA-256 revisions. At import, supply `source_ref` for the compiler-input Git commit if the index omits text, or `position_encoding` if the index omits a known encoding. Edits are ordered from the end of each file upward, with one-based lines and zero-based Unicode columns. An optional unused overlay session holds the candidate text for inspection.
   - UNKNOWN means the name is not an indexed symbol.
7. **Review**: `get_changed_symbols` (`ref` default worktree vs index, `staged`, `include_untracked`) maps `git diff` hunks to symbols; `find_dead_code` (`limit`, `include_tests`, `reachability`) lists symbols whose name is never referenced and, under `reachability`, symbols unreachable from entry-point roots plus names that cannot be found by name (reported unknown). `check_delete_safe` returns UNKNOWN for roots and unfindable names. All are name-based candidates, not proof.
8. **Archived output** (from compressed tool results): `search_sandbox` (`archive_id` or `--last`, `query`) runs Porter + trigram search merged by reciprocal rank fusion, and retries once with a spelling correction when nothing matches; `expand_sandbox` reads a line range (omit lines for the full text); `search_archives` (`query`, optional `session`, `source`, `limit`, `cursor`) searches archives across sessions and commands in this workspace with provenance and archive IDs for `expand_sandbox`; `index_sandbox_file` (`path`) indexes a large doc or log; `purge_sandbox` deletes by `archive_id`, `session`, or `all: true`.
9. **Commands**: `execute_filtered` (`argv`, `intent`, `cwd`) runs a safe command and returns only the matching parts of large output. `execute_batch` (`commands` list, `queries`, `cwd`) runs up to 8 commands in one call the same way.
10. **Index maintenance**: Git repos are indexed in the background at startup and refreshed during active sessions (up to `index_auto_init_max_files`). Reuse the repo ID on follow-ups. For other folders, or to force a refresh: `order(action="index_folder", args={"path": "<abs-path>"})`. `list_repos` lists indexes; `invalidate_cache` (`repo`) deletes one. `index_python_dependency` (`site_packages` absolute dir, `distribution`, top-level `package`) opt-in indexes an installed Python package's local source without importing it; it reports installed version and source provenance. Use `index_status` to see queued changes, watch activity, and the last reconciliation. An editor can call `overlay_update` with a file, buffer version, text, and `overlay_session`. Pass the same session to `get_file_outline` or literal `search_text` to see that buffer, then call `overlay_clear` with a newer version when the buffer is saved or closed.
    Use `overlay_fork` (`overlay_session`, `new_session`) to copy session buffers and versions for an independent experiment. Use `overlay_drop` (`overlay_session`) to discard that branch. Both actions are process-local.
11. **Code Mode** (the work runs locally; only the result comes back):
    - `run_script` (`code`, `language` python|node|bash|powershell, `intent`, `apply`): write a short script instead of reading files. Python scripts get `t`: `t.files(glob)`, `t.grep(rx, glob)`, `t.count(rx, glob)`, `t.symbols(q)`, `t.source(id)`, `t.refs(name)`, `t.read(p, start, end)`, `t.json/toml/csv/ini/py_ast(p)`, and staged edits `t.replace(p, old, new)`, `t.sub(p, rx, repl)`, `t.write(p, text)`, `t.edit_symbol(id, src)`. Print only what you need. Edits come back as a diff unless `apply: true`; a script that fails writes nothing.
    - `code_search` (`all`, `any`, `none` regex lists, `glob`, `mode` files|count|hits): "files that use X but not Y" in one call.
    - `code_edit` (`edits`: `{path, old, new}`, `{path|glob, pattern, repl}`, `{symbol_id, source}`, `{path, content}`; `apply`): stages and validates edits before writing. Set `expected_revision` on a path or symbol edit to require a matching SHA-256 file hash.
    - `code_search_batch` takes up to eight mixed `code_search`, `search_symbols`, or `search_text` queries with per-query results.
    - `code_outline` combines declaration outlines (`paths`) and exact source ranges (`slices`) in one call.
    - `run_checks` runs independent named command profiles in parallel and returns exit statuses and diagnostics. Supply profiles as `verify` when applying `code_edit` to run checks after writing.
    - `code_query` (`path`, `select` dotted path like `dependencies.*` or `items[0].name`, or `outline: true`): values from JSON/JSONL/TOML/CSV/INI without reading the file. `slice_file` (`path`, `rows`, `cols`, `where`, `group_by`) slices, filters, or groups large JSONL, CSV, TSV, JSON, log, or Markdown files locally.
    - `fetch_and_index` (`url`, `query`): fetch a page once, archive it, get its outline plus matching sections; follow up with `search_sandbox`.
12. **Analysis** (all accept `path_prefix` to scope a monorepo member):
    - `get_hotspots` (`days`): files ranked by churn x size. `get_symbol_history` (`symbol`): commits touching one symbol.
    - `get_untested_symbols`: functions/classes no test file names. `find_similar_symbols` (`threshold`, `symbol`, `structural`): near-duplicates.
    - `get_class_hierarchy` / `find_implementations` (`symbol`): ancestors, descendants, implementers.
    - `get_symbol_diff` (`symbol`, `ref`): one symbol's change. `get_pr_risk_profile` (`base`): changed symbols scored by refs, tests, churn, size.
    - `get_layer_violations` (`layers` or `[[layers]]` in `.terser/config.toml`), `list_workspaces`, `import_scip` (`path`: a `.scip` file, after which `find_references` is compiler-precise).
    - `get_code_graph` traverses typed dependency edges with source locations and provenance. `get_test_impact` traces indexed tests to a symbol, file, or Git changes.
    - `get_symbol_coverage` maps LCOV or Cobertura line results to a symbol. `find_structural_matches` finds AST nodes by kind and name across Python and available tree-sitter grammars. Pass `language` to restrict the parser. `find_cross_repo_references` matches global SCIP identities across indexed repositories.
    - `get_framework_routes` lists declared FastAPI/Flask paths and conventional Next.js/SvelteKit route patterns with source evidence. Route prefixes supplied by mounts or router configuration can affect the runtime URL. `find_cross_repo_contracts` (`repo`, `repos`, `limit`, optional `protocols`, `base_prefixes`, `with_impact`) finds candidate HTTP consumers of declared routes and, under `protocol_contracts`, gRPC/protobuf, GraphQL, messaging-topic, OpenAPI and template-URL candidates with provenance, confidence and unresolved references. All are candidates, never verified runtime dependencies. `winnow_symbols` (`query`, `is_test`, `limit`) ranks symbols across text match, fan-in, churn, and fan-out.
13. **Session usage & memory**: `hud` (`session_id`, `cwd`) shows attributed savings and current context usage when available. `record_project_fact` (`key`, `value`, `kind`) persists a concise project invariant, command, or gotcha across sessions.
14. **Extended actions** (registered at runtime; `menu` lists exact args):
    - `get_index_coverage`: generation, indexed vs live revision, pending changes, missing sources, and whether absence may be asserted. `get_retrieval_telemetry` (`session_id`): advisory counts of symbols served, fetched, edited and redelivered. `issue_evidence_receipt` / `verify_evidence_receipt`: short-lived proof of exactly which bytes were returned.
    - `search_openapi_operations` (`query`, `method`, `tag`, `spec`) and `get_openapi_operation` (`spec`, `operation_id` or `method`+`path`): bounded OpenAPI operation index with on-demand hydration; endpoints are never executed. `get_file_reach` (`file`, `depth`, `benchmark`): importer reach with optional cache.
    - `jobs` (`op` start|status|cancel|result, `job_id`, `kind`): bounded background jobs for Terser-owned work such as indexing; scoped per workspace, cancellable, restart-safe, never runs arbitrary commands.
    - `find_antipatterns`, `get_coupling_metrics`, `preview_edit`, `trace_dataflow` and `plan_refactor`: heuristic review, architecture, in-memory edit preview, taint paths and read-only refactor plans (see `menu`).

Rules:
- On small files (< 250 lines) or when you already know exact line numbers, use targeted `read_file` / `Read` with line ranges directly.
- Prefer Code Mode when the answer needs many files read but only a few lines reported (counting, cross-file checks, config lookups, codemods).
- Edits trigger automatic background re-indexing via `PostToolUse`; Code Mode writes refresh the index and read cache themselves.
- Tool search: the six front-door schemas are ~1k tokens, so they rarely need deferring. If your client defers MCP schemas (Anthropic tool search), keep `order` and `route` loaded and let `menu` describe the rest on demand.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.