ai-codex: Pre-index your codebase to save Claude tokens

✍️ OpenClawRadar📅 Published: April 14, 2026🔗 Source
ai-codex: Pre-index your codebase to save Claude tokens
Ad

What ai-codex does

ai-codex is a single script that scans your project and generates five compact markdown files to pre-index your codebase for Claude Code conversations. This eliminates the initial exploration phase where Claude typically spends 10-20 tool calls reading files, scanning directories, and checking functions.

How it works

You run npx ai-codex once to generate these files:

  • routes.md — every API route with methods and auth tags
  • pages.md — full page tree with client/server flags
  • lib.md — all library exports with function signatures
  • schema.md — database schema compressed to key fields only
  • components.md — component index with props

Then add one line to your CLAUDE.md telling Claude to read these files first. Every future conversation skips the exploration phase entirely.

Ad

Performance impact

On large projects, the exploration phase typically burns 30-50K tokens before any real work begins. The creator's example project had 950+ API routes and 255 DB models:

  • Without codex: ~15 Serena/Read calls to understand the finance module
  • With codex: 5 grep calls on the pre-built index, instant full picture — routes, pages, schema, lib exports, components
  • All in parallel, all under 2 seconds

Technical details

The tool works with Next.js (App Router & Pages Router) and generic TypeScript projects. It auto-detects Prisma schemas. The entire tool was designed and built by Claude Code itself in a single conversation session. It's MIT licensed and available on GitHub.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also

Claude Octopus v8.48: Multi-AI Orchestration Plugin for Development Workflows
Tools

Claude Octopus v8.48: Multi-AI Orchestration Plugin for Development Workflows

Claude Octopus v8.48 is an open-source plugin that orchestrates Claude, Codex, and Gemini AI models in parallel with distinct roles across development phases. It includes a 75% consensus gate between phases, fresh context windows for complex tasks, and specific commands like /octo:embrace for full lifecycle development.

OpenClawRadar
Zoku: A Tool That Automatically Detects Repeated Workflows in Claude Code
Tools

Zoku: A Tool That Automatically Detects Repeated Workflows in Claude Code

Zoku is a local tool that hooks into Claude Code's event system to record tool actions across sessions, identifies repeated workflow patterns, and then informs Claude about these patterns so it can proactively suggest or execute them. It requires no configuration, has no dependencies, and stores everything locally in ~/.zoku/.

OpenClawRadar
Log Reducer MCP Server Cuts Token Usage When Claude Code Reads Logs
Tools

Log Reducer MCP Server Cuts Token Usage When Claude Code Reads Logs

Log Reducer is an MCP server that processes log files server-side before sending reduced output to Claude Code, avoiding raw logs in the context window. It applies 19 deterministic transforms that compress logs by 50-90%, with a 2000-line log representing 20,000+ tokens removed from sessions.

OpenClawRadar
LAP: 1,500+ API Specs Compiled for LLM Consumption to Reduce Claude Hallucinations
Tools

LAP: 1,500+ API Specs Compiled for LLM Consumption to Reduce Claude Hallucinations

LAP is a tool that compiles 1,500+ real API specifications into a lean format optimized for LLMs, providing verified endpoints and parameters to prevent AI coding agents like Claude from hallucinating incorrect API calls.

OpenClawRadar