Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mantis-structural-index

БесплатноБез исполняемых скриптовНе проверен

Builds a content-addressed semantic-unit index from source code for structural context. Use when a pinned or live codebase is available and structural…

googleот google★ 2 881 звезда на GitHub

Об этом скилле

Structural Code Index Builder

This is an optional first-class stage in the Pass Lifecycle Contract. It runs immediately after the snapshot is pinned (Block D), before the first code-reading analysis stage (summarize/architecture). It only needs CODE_ROOT + SNAPSHOT_ID and must not depend on architecture/KB.

System Goal

Structural Code Index Builder. Builds a content-addressed semantic-unit index from source code using capability-based per-partition backend selection, degrading gracefully to grep. Provides find_callers(symbol), get_function_boundary(file, line), and call-site awareness to improve LLM reasoning quality during discovery — supplementing (never replacing) grep-based call-site discovery with structural data. The index is composed from independent semantic compilation units, persisted as a manifest + SQLite catalog, and exposed through a bounded query helper.

Command Definition

  • Command: /mantis-structural-index
  • Description: Build a content-addressed semantic-unit index from source code under CODE_ROOT.
  • Arguments (optional; supplied by the orchestrator, consumed by Block A): --snapshot_root/--snapshot_id/--state_root. All absent → MODE-OFF/legacy mode (reads source from the current directory, writes index to ./workspace/kb/structural_index/).

Input/Output Contract

  • Reads:
    • workspace/.mantis_state.json (to read active_snapshot for provenance checking and snapshot-aware rebuild logic).
    • workspace/kb/structural_index/manifest.json (to check snapshot_id for reuse-on-match idempotency — primary check).
    • workspace/kb/structural_index.jsonl (backward-compat provenance check if manifest absent).
    • workspace/kb/structural_index/units/ (content-addressed cache for incremental unit reuse).
    • workspace/kb/structural_index/native/ and sidecar provenance.json files (prebuilt index attachments and metadata manifests).
    • CODE_ROOT source files (via generated helper script — the script parses all source files under CODE_ROOT).
  • Writes:
    • workspace/kb/structural_index/manifest.json (STATE-RELATIVE — atomic commit point, written LAST).
    • workspace/kb/structural_index/catalog.sqlite (STATE-RELATIVE — query-optimized serving store).
    • workspace/kb/structural_index/units/ (STATE-RELATIVE — content-addressed immutable unit outputs).
    • workspace/kb/structural_index/shards/ (STATE-RELATIVE — partitioned serving data for large corpora).
    • workspace/kb/structural_index/native/ (STATE-RELATIVE — prebuilt index attachments: SCIP, Kythe, LSIF).
    • workspace/kb/structural_index/tmp/ (STATE-RELATIVE — temporary objects during build).
    • workspace/kb/structural_index.jsonl (STATE-RELATIVE — compatibility pointer; full export below threshold).
    • workspace/helpers/build_structural_index.py (STATE-RELATIVE — the builder helper script).
    • workspace/helpers/query_structural_index.py (STATE-RELATIVE — the query helper script).
  • Preconditions:
    • Source files must exist under CODE_ROOT. If CODE_ROOT is not resolved (MODE-OFF and no readable active_snapshot), build against the current directory with snapshot_id set to "unknown". Do NOT skip — this is the standalone-efficiency case.
  • Inert until wired: This skill returns an empty index until a caller invokes it (the harness, mantis-plan, or mantis-researcher). It never fails — it simply returns an empty index if tools are unavailable or source cannot be parsed.
  • Idempotency Guarantee:
    • Read-only on CODE_ROOT. Writes only to STATE-RELATIVE paths. Re-running with the same CODE_ROOT and SNAPSHOT_ID reuses the existing index (manifest snapshot_id match) rather than rebuilding — except in MODE-OFF, where it always rebuilds. Individual semantic units are reused across snapshots when their content-addressed cache keys match (incremental rebuild).

Instructions

Step 0: Locator Resolution (run first)

LOCATOR RESOLUTION (before reading ANY target code or artifact):
0. ROLE: If this skill NEVER reads target source (report, calibrate, reflect),
   you are a FINDINGS-ONLY stage: skip steps 2-6; still read active_snapshot from
   state for provenance/annotation; NEVER stop merely because a code root is unset.
1. Determine CODE_ROOT, in this priority order:
   a. If --target_root is passed on THIS invocation, CODE_ROOT = --target_root.
      It is AUTHORITATIVE and OVERRIDES SNAPSHOT_ROOT and the state fallback
      (used when a caller hands you a prepared tree, e.g. a patched shadow).
   b. Else if --snapshot_root (or SNAPSHOT_ROOT) is passed, use it.
   c. Else read state_root/workspace/.mantis_state.json (state_root from
      --state_root if passed, else ./workspace/... relative to the current dir)
      -> active_snapshot.root / .snapshot_id / .snapshot_pinned.
   d. Else (no arg AND no readable active_sna
Полный SKILL.md на GitHub

Установить mantis-structural-index в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл mantis-structural-index?

Builds a content-addressed semantic-unit index from source code for structural context. Use when a pinned or live codebase is available and structural cross-reference data would improve research quality. Don't use for findings analysis, patching, or reporting.

Как установить скилл mantis-structural-index?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mantis-structural-index запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mantis-structural-index с