initialize

initialize is a command for Claude Code from defendend/Claude-ast-index-search. It costs 25 tokens per session (2,145 once invoked), scanned A, original, MIT.

A project setup command that detects the technologies used in a repository and configures ast-index for them.

In plain words
What is it for?
Use it to verify ast-index, detect one or more project stacks, configure the project, create ast-index rules, build the code index, and verify the setup. Manual initializers remain available when one stack must be forced.
Why use it?
It avoids choosing a language or platform manually when a project contains several stacks, including Kotlin Multiplatform, a setup that shares Kotlin code across platforms. It also creates the required configuration and search rules before building and checking the index.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths.

Part of the ast-index plugin — 1 skill, 7 commands, 3 hooks shipped together

Good fit Use it to verify ast-index, detect one or more project stacks, configure the project, create ast-index rules, build the code index, and verify the setup. Manual initializers remain available when one stack must be forced.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/defendend/claude-ast-index-search/initialize
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.

Clone the repo
git clone --depth 1 https://github.com/defendend/Claude-ast-index-search

Made for: Claude Code.

Or install ast-index, the plugin that ships this one along with the rest of its 1 skill, 7 commands, 3 hooks.

Wrote 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.

agentmods badge for initialize

README.md
[![agentmods](https://agentmods.dev/badge/commands/defendend/claude-ast-index-search/initialize.svg)](https://agentmods.dev/commands/defendend/claude-ast-index-search/initialize)
Your own site
<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>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,145 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00025 $0.02145
Opus 5 $0.00013 $0.01073
Sonnet 5 $0.00005 $0.00429
Haiku 4.5 $0.00003 $0.00215

Measured 7d ago against content hash d4de508a4b3c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

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.

plugin/commands/initialize.md · 274 lines

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: truepolyglot/monorepo. Include every detected stack's guidance.
  • Otherwise → single-stack. Use the matching per-platform command file as the source of truth.
  • stacks empty → 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.

Read the full file on GitHub · 274 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. 7d ago First seen · 274 lines · 25 tokens per session scan A d4de508a4b3c

Subscribe to this mod's changes

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.