SkilVaultSign inStart free

Catalogue / cached-symbol-atlas

cached-symbol-atlas

Older skill: source not recordedSignedBuilds, updates, and audits a local AST-derived repository map of symbols and imports with ast-grep. Use for map creation, map status, code drift, or symbol inventory. Not for executing source code, installing parsers automatically, or proving runtime behavior from static structure.
---
name: cached-symbol-atlas
description: >-
  Builds, updates, and audits a local AST-derived repository map of symbols and imports with ast-grep. Use for map creation, map status, code drift, or symbol inventory. Not for executing source code, installing parsers automatically, or proving runtime behavior from static structure.
---

Cached symbol atlas

Choose one operation: status, initialize, or update. If the user gives no operation, inspect status. Treat force as a requested full rebuild, not permission to overwrite a cache. Confirm the project root and the platform state directory: a Claude Code project commonly uses .claude/repo-map.json, OpenCode .opencode/repo-map.json, and Codex .codex/repo-map.json. These are output locations in the user's workspace, not bundled resources.

Obtain explicit human confirmation before creating directories, writing or replacing a map, installing tools, invoking commands that modify state, or delegating validation. Check ast-grep availability and local help. If absent, stop execution and ask the owner about installation; do not silently download it.

Inspect freshness

Read an existing map and compare its Git commit and branch with the current repository. Check whether its recorded commit still exists and is an ancestor of HEAD, how many commits it lags, whether the branch changed, and whether an existing hook marks the cache stale. Also hash relevant working-tree files; uncommitted edits can invalidate a map even at the same commit. Report last update, lag, and stale or unknown reasons.

If no map exists during a drift or documentation review, explain what a map would add and propose initialization with the user's approval. No plugin command is required.

Construct a reproducible inventory

Enumerate supported source files while excluding generated output, dependencies, credentials, and ignored paths under the project's policy. Use the installed ast-grep interface to parse each language and extract exported declarations, functions, classes, and import source/kind. Derive language-specific AST rules from actual parsed nodes and verify them on local fixtures. Do not claim regex matches are AST results. Record unsupported languages and parse failures explicitly.

Maintain this minimal JSON contract, using real values rather than the fictional example:

{
  "version": "1.0.0",
  "generated": "2026-09-18T09:00:00Z",
  "updated": "2026-09-18T09:20:00Z",
  "git": {"commit": "actual-head-sha", "branch": "topic/search"},
  "project": {"languages": ["typescript"]},
  "stats": {"totalFiles": 1, "totalSymbols": 1},
  "files": {
    "app/search.ts": {
      "hash": "actual-content-digest",
      "language": "typescript",
      "symbols": {"exports": [], "functions": [{"name": "findRecord"}], "classes": []},
      "imports": [{"source": "./index", "kind": "named"}]
    }
  }
}

Define how symbols shared across export/function lists count, and use that definition consistently. Store repository-relative paths and cryptographic content hashes. Initial generation sets both timestamps; updates retain generated and advance updated.

Prefer an incremental update when history and format remain compatible: reuse unchanged hashes, reparse added or changed files, and remove entries for deleted files. Rebuild when the recorded commit disappeared, history was rewritten, format changed, or user-approved force requires it. A branch change demands a freshness assessment, not automatic reuse.

Validate before reporting success

Perform the validator role inline: parse JSON; verify required fields and timestamp syntax; check paths stay inside the root and exist; recalculate hashes; verify languages, import records, and symbol arrays; recompute counts; and compare representative symbols/imports with actual source. Report parse failures, unsupported languages, and ambiguous nodes. If delegating this audit, obtain approval and supply the same criteria rather than requiring an unavailable named agent.

After approval, persist through a temporary sibling file and atomic replacement. Report file count, symbol count, commit, and warnings for creation/update; report freshness, commit lag, and last update for status.

Never

  • Install parsers, overwrite caches, or delegate validation without explicit confirmation.
  • Claim a map is current using commit identity alone when files changed locally.
  • Include secret files, silently skip parse failures, or trust invalid counts.
  • Invoke an absent slash command or require an unshipped validator helper.