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.
git clone --depth 1 https://github.com/defendend/Claude-ast-index-searchWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/defendend/claude-ast-index-search/initialize)<a href="https://agentmods.dev/commands/defendend/claude-ast-index-search/initialize"><img src="https://agentmods.dev/badge/commands/defendend/claude-ast-index-search/initialize.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00025 | $0.02145 |
| Opus 5 | $0.00013 | $0.01073 |
| Sonnet 5 | $0.00005 | $0.00429 |
| Haiku 4.5 | $0.00003 | $0.00215 |
Grade A, and why
initialize 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 7d 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.
How it starts
The opening of the file, as written. The whole thing — 274 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Auto-initialize ast-index
Use this command as the default initializer. Detect the current project's
stack(s), configure .claude/settings.json, create
.claude/rules/ast-index.md, build the index, and verify setup.
Keep initialize-android, initialize-ios, initialize-web,
initialize-rust, initialize-csharp, and initialize-ruby as manual
overrides only when the user explicitly wants one stack forced.
Workflow
1. Check prerequisites
Verify ast-index is installed:
ast-index version
If it is not installed, tell the user to run:
brew tap defendend/ast-index
brew install ast-index
Stop there until the binary exists.
2. Detect stack(s) from actual repo markers
Run the built-in detector and parse its JSON output. Do not scan markers by
hand — ast-index already implements the same checks and adds
Kotlin Multiplatform (KMP) recognition.
Treat detection as a set of stacks, not a single label.
ast-index --format json detect-stacks
The command prints:
{
"stacks": [
{ "kind": "android", "label": "Android (Kotlin/Java/JVM)", "markers": ["build.gradle.kts"] },
{ "kind": "ios", "label": "iOS (Swift/ObjC)", "markers": ["Package.swift"] },
{ "kind": "kmp", "label": "Kotlin Multiplatform", "markers": ["composeApp/commonMain", "build.gradle.kts"] }
],
"is_kmp": true,
"is_polyglot": false
}
Interpretation rules:
is_kmp: true→ treat the repo as KMP. Include both Android and iOS guidance plus the KMP note below.is_polyglot: true→ polyglot/monorepo. Include every detected stack's guidance.- Otherwise → single-stack. Use the matching per-platform command file as the source of truth.
stacksempty → tell the user "no known project markers in this directory" and ask whether to proceed against the current root anyway, or to point at another path.
If you need to double-check, the supported short kind ids are: android,
ios, kmp, web, rust, csharp, ruby, python, go, dart, php,
scala, zig, cpp, perl. Each marker is a real path relative to the
repo root, suitable for showing the user in the final summary.
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.
- 7d ago First seen · 274 lines · 25 tokens per session scan A d4de508a4b3c
initialize is a command published in the GitHub repository defendend/Claude-ast-index-search (557 stars, last pushed yesterday), licensed MIT. It adds 25 tokens to every session and 2,145 once invoked, about $0.0001 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.
Other commands, from other repositories
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.
converge
Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it.
implement
Execute the implementation plan by processing and executing all tasks defined in tasks.md.
analyze
Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.