Agent skill

Smart Explore Code Search

by thedotmack in thedotmack/claude-mem

Explores code structure with tree-sitter AST search tools, getting a ranked symbol map and file outlines before reading full source, to save tokens.

Apache-2.0Auto-check passedDevelopment

Install Smart Explore Code Search

skills CLI
$ npx skills add thedotmack/claude-mem --skill smart-explore -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install thedotmack/claude-mem smart-explore --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/thedotmack/claude-mem.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugin/skills/smart-explore .claude/skills/smart-explore && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
smart-explore
GitHub stars
97k
Token cost
~2.3k tokens
SKILL.md length
908 words
Files
1
Skills in repo
26
Repo updated
First seen
Licence
Apache-2.0

At a glance

Explores code structure with tree-sitter AST search tools, getting a ranked symbol map and file outlines before reading full source, to save tokens.

  • Works in 3 steps: Search -- Discover Files and Symbols → Outline -- Get File Structure → Unfold -- See Implementation
  • Finding where a function or concept lives without reading whole files
  • SKILL.md covers Your Next Tool Call, 3-Layer Workflow, When to Use Standard Tools… and Workflow Examples, plus 2 more sections
  • Calls npm

What it does

While active, this skill overrides default exploration: the agent uses the smart_search, smart_outline and smart_unfold MCP tools as its primary route instead of Read, Grep and Glob. The core idea is to index first and fetch on demand, getting a structural map before loading any implementation details.

It is a three-layer workflow. smart_search walks a directory, parses the code files and returns ranked matching symbols with signatures, line numbers and match reasons plus folded file views, replacing the glob, grep and read discovery cycle. smart_outline returns the skeleton of one file, with functions, classes, methods, properties and imports. smart_unfold returns the full source of one named symbol.

smart_search takes a query, an optional path, a max_results value that defaults to 20 and caps at 50, and an optional file pattern, and the skill gives rough token costs for each layer, such as a few thousand for a search and one to two thousand per outline. The skill only loads instructions, so the MCP tools must be available for the agent to call.

When your agent uses it

  • Finding where a function or concept lives without reading whole files
  • Getting a structural outline of a large file before opening it
  • Reading one symbol's full source on demand

Example prompts

  • “Find everything related to graceful shutdown in ./src and outline the main file.”
  • “Show me the structure of services/worker-service.ts without reading the whole file.”
  • “Unfold the performGracefulShutdown function so I can read its source.”

Requirements

  • The smart_search, smart_outline and smart_unfold MCP tools

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Search -- Discover Files and Symbols
  2. Outline -- Get File Structure
  3. Unfold -- See Implementation

What it can do on your machine

Read from SKILL.md and the folder at commit 71ddd11. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Smart Explore Code Search loads about 2.3k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 908 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from thedotmack/claude-mem at commit 71ddd11, republished under its Apache-2.0 licence (© thedotmack). 908 words, ~2,305 tokens.

Download SKILL.mdSave it as .claude/skills/smart-explore/SKILL.md (or your agent's skills folder).
name
smart-explore
description
Token-optimized structural code search using tree-sitter AST parsing. Use instead of reading full files when you need to understand code structure, find functions, or explore a codebase efficiently.

Smart Explore

Structural code exploration using AST parsing. This skill overrides your default exploration behavior. While this skill is active, use smart_search/smart_outline/smart_unfold as your primary tools instead of Read, Grep, and Glob.

Core principle: Index first, fetch on demand. Give yourself a map of the code before loading implementation details. The question before every file read should be: "do I need to see all of this, or can I get a structural overview first?" The answer is almost always: get the map.

Your Next Tool Call

This skill only loads instructions. You must call the MCP tools yourself. Your next action should be one of:

smart_search(query="<topic>", path="./src")    -- discover files + symbols across a directory
smart_outline(file_path="<file>")              -- structural skeleton of one file
smart_unfold(file_path="<file>", symbol_name="<name>")  -- full source of one symbol

Do NOT run Grep, Glob, Read, or find to discover files first. smart_search walks directories, parses all code files, and returns ranked symbols in one call. It replaces the Glob → Grep → Read discovery cycle.

3-Layer Workflow

Step 1: Search -- Discover Files and Symbols
smart_search(query="shutdown", path="./src", max_results=15)

Returns: Ranked symbols with signatures, line numbers, match reasons, plus folded file views (~2-6k tokens)

-- Matching Symbols --
  function performGracefulShutdown (services/infrastructure/GracefulShutdown.ts:56)
  function httpShutdown (services/infrastructure/HealthMonitor.ts:92)
  method WorkerService.shutdown (services/worker-service.ts:846)

-- Folded File Views --
  services/infrastructure/GracefulShutdown.ts (7 symbols)
  services/worker-service.ts (12 symbols)

This is your discovery tool. It finds relevant files AND shows their structure. No Glob/find pre-scan needed.

Parameters:

  • query (string, required) -- What to search for (function name, concept, class name)
  • path (string) -- Root directory to search (defaults to cwd)
  • max_results (number) -- Max matching symbols, default 20, max 50
  • file_pattern (string, optional) -- Filter to specific files/paths
Step 2: Outline -- Get File Structure
smart_outline(file_path="services/worker-service.ts")

Returns: Complete structural skeleton -- all functions, classes, methods, properties, imports (~1-2k tokens per file)

Skip this step when Step 1's folded file views already provide enough structure. Most useful for files not covered by the search results.

Parameters:

  • file_path (string, required) -- Path to the file
Step 3: Unfold -- See Implementation

Review symbols from Steps 1-2. Pick the ones you need. Unfold only those:

smart_unfold(file_path="services/worker-service.ts", symbol_name="shutdown")

Returns: Full source code of the specified symbol including JSDoc, decorators, and complete implementation (~400-2,100 tokens depending on symbol size). AST node boundaries guarantee completeness regardless of symbol size — unlike Read + agent summarization, which may truncate long methods.

Parameters:

  • file_path (string, required) -- Path to the file (as returned by search/outline)
  • symbol_name (string, required) -- Name of the function/class/method to expand

When to Use Standard Tools Instead

Use these only when smart_* tools are the wrong fit:

  • Grep: Exact string/regex search ("find all TODO comments", "where is ensureWorkerStarted defined?")
  • Read: Small files under ~100 lines, non-code files (JSON, markdown, config)
  • Glob: File path patterns ("find all test files")
  • Explore agent: When you need synthesized understanding across 6+ files, architecture narratives, or answers to open-ended questions like "how does this entire system work end-to-end?" Smart-explore is a scalpel — it answers "where is this?" and "show me that." It doesn't synthesize cross-file data flows, design decisions, or edge cases across an entire feature.

For code files over ~100 lines, prefer smart_outline + smart_unfold over Read.

Workflow Examples

Discover how a feature works (cross-cutting):

1. smart_search(query="shutdown", path="./src")
   -> 14 symbols across 7 files, full picture in one call
2. smart_unfold(file_path="services/infrastructure/GracefulShutdown.ts", symbol_name="performGracefulShutdown")
   -> See the core implementation

Navigate a large file:

1. smart_outline(file_path="services/worker-service.ts")
   -> 1,466 tokens: 12 functions, WorkerService class with 24 members
2. smart_unfold(file_path="services/worker-service.ts", symbol_name="startSessionProcessor")
   -> 1,610 tokens: the specific method you need
Total: ~3,076 tokens vs ~12,000 to Read the full file

Write documentation about code (hybrid workflow):

1. smart_search(query="feature name", path="./src")    -- discover all relevant files and symbols
2. smart_outline on key files                           -- understand structure
3. smart_unfold on important functions                  -- get implementation details
4. Read on small config/markdown/plan files             -- get non-code context

Use smart_* tools for code exploration, Read for non-code files. Mix freely.

Exploration then precision:

1. smart_search(query="session", path="./src", max_results=10)
   -> 10 ranked symbols: SessionMetadata, SessionQueueProcessor, SessionSummary...
2. Pick the relevant one, unfold it

Token Economics

ApproachTokensUse Case
smart_outline~1,000-2,000"What's in this file?"
smart_unfold~400-2,100"Show me this function"
smart_search~2,000-6,000"Find all X across the codebase"
search + unfold~3,000-8,000End-to-end: find and read (the primary workflow)
Read (full file)~12,000+When you truly need everything
Explore agent~39,000-59,000Cross-file synthesis with narrative

4-8x savings on file understanding (outline + unfold vs Read). 11-18x savings on codebase exploration vs Explore agent. The narrower the query, the wider the gap — a 27-line function costs 55x less to read via unfold than via an Explore agent, because the agent still reads the entire file.

Show full SKILL.md (318 more words)Show less

Language Support

Smart-explore uses tree-sitter AST parsing for structural analysis. Unsupported file types fall back to text-based search.

Bundled Languages
LanguageExtensions
JavaScript.js, .mjs, .cjs
TypeScript.ts
TSX / JSX.tsx, .jsx
Python.py, .pyw
Go.go
Rust.rs
Ruby.rb
Java.java
C.c, .h
C++.cpp, .cc, .cxx, .hpp, .hh

Files with unrecognized extensions are parsed as plain text — smart_search still works (grep-style), but smart_outline and smart_unfold will not extract structured symbols.

Custom Grammars (.claude-mem.json)

You can register additional tree-sitter grammars for file types not in the bundled list. Create or update .claude-mem.json in your project root:

json
{
  "grammars": {
    "solidity": {
      "package": "tree-sitter-solidity",
      "extensions": [".sol"],
      "query": "solidity-query.scm"
    }
  }
}

Each key is a language name. package is the npm package of the tree-sitter grammar and extensions lists the file extensions it covers; the package must be installed in the project's node_modules (npm install tree-sitter-solidity). query (optional) is a path, relative to the config file, to a tree-sitter query whose captures (@func, @cls, @method, @iface, @enm, @struct_def, @imp) extract symbols. Without query, a minimal generic pattern is used — it only matches grammars that define function_declaration/class_declaration node types, and query compilation fails silently (0 symbols) for grammars that lack them, so a custom query is effectively required for most languages. Once registered, smart_outline and smart_unfold parse those extensions structurally instead of falling back to plain text.

Markdown Special Support

Markdown files (.md, .mdx) receive special handling beyond the generic plain-text fallback:

  • smart_outline — extracts headings (#, ##, ###) as the symbol tree. Use it to navigate long documents without reading the full file.
  • smart_search — searches within code fences as well as prose, so queries for function names inside ```ts ``` blocks work as expected.
  • smart_unfold — expands heading sections rather than function bodies; each section up to the next same-level heading is returned as a chunk.
  • Frontmatter — YAML frontmatter (lines between leading --- delimiters) is included in smart_outline output under a synthetic frontmatter symbol so metadata like title: and description: is visible without reading the whole file.

© thedotmack, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugin/skills/smart-explore of thedotmack/claude-mem.

Open the folder on GitHubat commit 71ddd11

Compare with similar skills

Smart Explore Code Search next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Smart Explore Code Search compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Smart Explore Code Search this skillthedotmack/claude-mem97k—~2.3kAutomated safety check: PassApache-2.0
tilth Code Reading CLIjahala/tilth352—~1.1kAutomated safety check: PassMIT
trace-mcp Code Navigationnikolai-vysotskyi/trace-mcp185—~1.6kAutomated safety check: NotesMIT
Basemind Code ContextGoldziher/basemind106—~2.6kAutomated safety check: PassMIT
Codebase SearchHelweg/open-codebase-index216—~1.3kAutomated safety check: PassMIT
Codegraph Detection Partneritechmeat/open-second-brain430—~1.6kAutomated safety check: PassMIT

Similar skills

  • Replaces grep, cat, find and ls with the tilth CLI, which returns AST-aware outlines, definitions, usages and callers across many languages in one call.

    352 GitHub stars~1.1k tokensUpdated 10 days ago
    DevelopmentAuto-check passed
  • trace-mcp Code Navigation

    nikolai-vysotskyi/trace-mcp

    Routes code exploration through trace-mcp's indexed dependency graph, using symbol search, outlines, call graphs and change-impact tools instead of Read, Grep and Glob.

    185 GitHub stars~1.6k tokensUpdated yesterday
    DevelopmentAuto-check: notes
  • Basemind Code Context

    Goldziher/basemind

    Answers structural questions about a repository, such as where a symbol is defined, what calls it and what changed recently, through the basemind MCP server.

    106 GitHub stars~2.6k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Codebase Search

    Helweg/open-codebase-index

    Chooses the right retrieval tool for code questions: compact context for unfamiliar repos, direct lookup for known symbols, call graphs for relationships and grep for exhaustive matches.

    216 GitHub stars~1.3k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Codegraph Detection Partner

    itechmeat/open-second-brain

    Teaches the agent to detect whether the codegraph symbol graph is available and use it for callers, callees and impact questions, without installing or writing anything for it.

    430 GitHub stars~1.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Codebase Search Workflow

    Helweg/open-codebase-index

    Directs an agent to use a local codebase index for repository orientation, definition lookups, call graphs and semantic search before turning to web lookups.

    216 GitHub stars~822 tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from thedotmack/claude-mem

All 26 skills in this repo
  • Walks you through creating, installing and verifying a custom claude-mem mode, including note types, tags and optional Telegram alerts for chosen memories.

    97k GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Project Timeline Report

    thedotmack/claude-mem

    Writes a narrative Journey Into report on a project's whole development history, built from the timeline that claude-mem has recorded.

    97k GitHub starsUsed in 1 repo~3.1k tokens
    Auto-check passed
  • Pull Request Babysitter

    thedotmack/claude-mem

    Keeps watching a pull request, fixing real review and CI problems and resolving stale threads, until it is clean and ready to merge.

    97k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Claude-Mem Install for Grok Bot

    thedotmack/claude-mem

    Use this when setting up claude-mem on Grok Bot: local worker plus CMEM Pro observer (default), optional host-login observer, or remote cmem.ai. No Cursor…

    97k GitHub stars~440 tokensUpdated today
    Auto-check passed
  • Claude-Mem Cloud Sync

    thedotmack/claude-mem

    Checks claude-mem cloud sync status and guides you through connecting a cmem.ai Pro account without the sync token ever passing through the chat.

    97k GitHub stars~1k tokensUpdated today
    Auto-check: notes
  • Audits a design against Dieter Rams' ten principles of good design, scores each with evidence, and hands off a make-plan prompt for a new, refined or redesigned outcome.

    97k GitHub stars~4.6k tokensUpdated today
    Auto-check passed

Questions about Smart Explore Code Search

What does Smart Explore Code Search do?

Explores code structure with tree-sitter AST search tools, getting a ranked symbol map and file outlines before reading full source, to save tokens. While active, this skill overrides default exploration: the agent uses the smart_search, smart_outline and smart_unfold MCP tools as its primary route instead of Read, Grep and Glob. The core idea is to index first and fetch on demand, getting a structural map before loading any implementation details.

When should I use Smart Explore Code Search?

Smart Explore Code Search fits situations like: finding where a function or concept lives without reading whole files; getting a structural outline of a large file before opening it; reading one symbol's full source on demand.

How do I install Smart Explore Code Search in Claude Code?

Run `npx skills add thedotmack/claude-mem --skill smart-explore -a claude-code`. Or copy the skill folder (plugin/skills/smart-explore in thedotmack/claude-mem) into .claude/skills/smart-explore in your project. Claude Code loads it when a task matches its description.

How do I install Smart Explore Code Search in Codex?

Run `npx skills add thedotmack/claude-mem --skill smart-explore -a codex`. Or copy the skill folder (plugin/skills/smart-explore in thedotmack/claude-mem) into .agents/skills/smart-explore in your project. Codex loads it when a task matches its description.

Can I use Smart Explore Code Search in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add thedotmack/claude-mem --skill smart-explore -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/smart-explore, .gemini/skills/smart-explore, .github/skills/smart-explore and .opencode/skills/smart-explore in your project.

What does Smart Explore Code Search need to run?

Going by SKILL.md and its folder, Smart Explore Code Search needs the command-line tools its instructions call (npm). Our summary lists: The smart_search, smart_outline and smart_unfold MCP tools.

Does Smart Explore Code Search access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Smart Explore Code Search safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Smart Explore Code Search use?

Smart Explore Code Search is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Smart Explore Code Search use?

About 2.3k tokens (SKILL.md is roughly 9.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Smart Explore Code Search?

Skills that share tags, products or a category with Smart Explore Code Search: tilth Code Reading CLI (jahala/tilth, 352 stars), trace-mcp Code Navigation (nikolai-vysotskyi/trace-mcp, 185 stars), Basemind Code Context (Goldziher/basemind, 106 stars) and Codebase Search (Helweg/open-codebase-index, 216 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Smart Explore Code Search?

thedotmack (a GitHub user) maintains it in thedotmack/claude-mem, which has 97,250 GitHub stars. The repository holds 26 skills in this directory. The repository was last updated on October 7, 2026.

Source: thedotmack/claude-mem on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.