| name | ai-context-generation |
| description | Generate compact AI-readable context maps from codebases — tools like codesight, repomix, agentic-context that pre-compute project structure to save tokens in AI coding sessions. |
| version | 1.0.0 |
| author | Hermes Agent |
| license | MIT |
| platforms | ["linux","macos","windows"] |
| metadata | {"hermes":{"tags":["context-engineering","token-savings","codebase-analysis","AI-coding","codesight"]}} |
AI Context Generation
Tools that scan a codebase and produce compact, AI-readable context maps (markdown, wiki, or MCP tool sets) so AI coding assistants understand the project without burning tokens on file exploration.
When to Use
- User wants to generate a context map for an AI coding assistant (Claude Code, Cursor, Copilot, Codex, Aider, etc.)
- User wants blast-radius analysis before refactoring
- User wants to generate project config files (CLAUDE.md, .cursorrules, AGENTS.md) automatically
- User wants to reduce per-conversation token cost for AI-assisted development
Tools
codesight (npm)
npx codesight — Universal AI context generator. Zero dependencies, MIT, TypeScript. 1.1K+ stars.
Strengths:
- Import graph with per-file import counts (language-agnostic — works on Java, Python, JS/TS, etc.)
- Blast radius:
--blast <file> shows affected files at 3 hops depth
- CI/CD workflow detection (GitHub Actions, secrets)
- Hot file identification (most-coupled files)
- MCP server mode with 13 tools (
--mcp)
- One-shot config generation:
--init produces CLAUDE.md, .cursorrules, codex.md, AGENTS.md
- Knowledge mode:
--mode knowledge <path> maps markdown notes (Obsidian vaults, ADRs) into KNOWLEDGE.md
- Wiki generation:
--wiki creates a .codesight/wiki/ knowledge base
Limitations (web/TS-centric):
- Route detection, schema/model extraction, component props, library exports, env var mapping are tuned for web frameworks (Express, Next.js, React, ORM models). Non-web projects (Android/Java, etc.) get 0 results for these categories.
- "Middleware" detection misclassifies non-web resources (e.g., Android drawable XML icons classified as middleware)
- Token savings claims are inflated for non-web projects (benchmark assumes extraction that didn't happen)
- No folder exclusion — scans everything including build dirs
Commands:
npx codesight
npx codesight --blast <file>
npx codesight --benchmark
npx codesight --init
npx codesight --mcp
npx codesight --wiki
npx codesight --mode knowledge <path>
npx codesight --profile <tool>
npx codesight --open
Output files (.codesight/):
CODESIGHT.md — combined context map (one file, full project understanding)
routes.md — API routes with method, path, params (web only)
schema.md — DB models with fields, types, keys, relations (web only)
components.md — UI components with props (web only)
libs.md — library exports with function signatures (web only)
config.md — env vars, config files, key deps (web only)
middleware.md — auth, CORS, rate limiting, etc. (web only)
graph.md — import relationships and hot files (language-agnostic)
report.html — interactive visual dashboard (with --html or --open)
Pitfalls
- Check project type before expecting full results — run
npx codesight --benchmark first to see what detectors fired. If routes/models/components are all 0, the project type isn't supported for structural extraction.
- The import graph and blast radius are always useful — even when structural extraction fails, the language-agnostic import graph tells you which files are safe to refactor and which touch everything.
- Clean up
.codesight/ if not integrating into workflow — the directory is not gitignored by default. Decide whether to commit it or remove it.
- 27K files scanned in ~15s — fast for most projects, but no folder exclusion means build/dependency dirs are included.
See Also
codebase-inspection skill (pygount) — LOC counting and language breakdown, complementary but different purpose