codebase-index

A three-level index of a codebase that records files, symbols, imports, exports, line counts, and short summaries. It helps agents locate relevant code before reading full files.

In plain words
What is it for?
Use it during project setup or reindexing, and after edits when agents need to find functions, classes, files, or other code relevant to a task.
Why use it?
It reduces unnecessary code reading and helps agents navigate large projects using targeted file and line information.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/d3x293/code-crew/codebase-index
Any agent
npx skills add d3x293/code-crew --skill codebase-index
Clone the repo
git clone --depth 1 https://github.com/d3x293/code-crew

Made for: Claude Code, Codex.

Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,517 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00042 $0.01517
Opus 5 $0.00021 $0.00758
Sonnet 5 $0.00008 $0.00303
Haiku 4.5 $0.00004 $0.00152

Measured 2d ago against content hash 50f243c25b82, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codebase-index scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/codebase-index/SKILL.md · 153 lines

How it starts

The opening of the file, as written. The whole thing — 153 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codebase Index - 3-Layer Memory Optimizer

Build and maintain a progressive disclosure index that prevents agents from reading entire files when they only need a function signature or a specific line range.

When to Activate

  • During /crew init (full build)
  • During /crew reindex (full rebuild)
  • When an agent needs to find code but the index exists (consult mode)
  • After file edits (incremental update mode via index-updater skill)

Three-Layer Architecture

Layer 1 - Compact Index (.claude/crew-index.json, ~2-5KB)

The cheapest layer. Costs ~50 tokens to read. Contains just enough to route queries to the right file:

Per-file entry:

  • hash: SHA-256 of file content (for change detection)
  • size: file size in bytes
  • type: language (javascript, python, typescript, etc.)
  • exports: exported functions/classes/constants
  • imports: external dependencies
  • functions: all function/method names
  • classes: all class names
  • lines: total line count
  • category: core | test | config | docs | util
  • summary: 1-line description of what this file does

Global metadata:

  • version: schema version
  • generated: ISO timestamp
  • contentHash: hash of all file hashes combined
  • dependencies: package dependencies with versions
  • architecture.entryPoint: main entry file
  • architecture.pipeline: data flow description
  • architecture.patterns: detected patterns (MVC, pipeline, event-driven, etc.)
  • stats: totalFiles, totalLines, languages, lastIndexed

Layer 2 - Symbol Map (.claude/crew-symbols.json, ~5-15KB)

Mid-detail layer. Costs ~100-200 tokens for relevant section. Contains function signatures and relationships:

Per-symbol entry (keyed as filepath::symbolName):

  • type: function | class | method | constant | type
  • signature: full signature string
  • params: parameter list with types if available
  • returns: return type if available
  • calls: what this symbol calls
  • calledBy: what calls this symbol
  • lineRange: [startLine, endLine]
  • description: 1-line description

Read the full file on GitHub · 153 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 153 lines · 42 tokens per session scan A 50f243c25b82

Subscribe to this mod's changes

codebase-index is a skill published in the GitHub repository d3x293/code-crew (13 stars, last pushed 4mo ago), licensed MIT. It adds 42 tokens to every session and 1,517 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.