cxj 為編碼智能體提供無狀態 Java/Spring 程式碼分析
Your agent doesn't need a codebase memory
作者開發並公開開源、無狀態的 Java/Spring 程式碼智能 CLI cxj,讓編碼智能體按需讀取當前源碼、回答問題後即忘掉內容。以同一 AI 模型測試生產 Spring 服務的六項結構問題時,cxj 和 grep 加逐檔探索均答對;cxj 輸入 tokens 少 6.4 倍、Agent 成本低 5.6 倍、完成時間快 2.2 倍,但簡單單行查找由 grep 勝出。
Every coding agent needs to understand your codebase. But does it really need to remember it?
Most code intelligence tools maintain indexes, embeddings, or knowledge graphs, depends on other stuff like sqlite. These need to stay synchronized with your code, or risk giving agents outdated answers.
I built cxj to try a simpler approach: read the current source, answer the question, and forget everything.
What is cxj?
An open-source, stateless Java/Spring code intelligence CLI for coding agents.
Instead of spending tokens exploring dozens of files, your agent gets structured answers in milliseconds.
cxj brief # Understand the entire service
cxj endpoints # List HTTP routes
cxj trail PaymentService.pay # Follow calls and find tests
cxj callers PaymentService.pay # Find callers
cxj deps # Get resolved dependency versions
It understands Spring-specific concepts, resolves method calls using declared types, and explicitly reports uncertainty instead of silently guessing.
Does it actually help?
I compared cxj against traditional grep + file exploration using the same AI model on a production Spring service.
For six structural questions, both approaches answered correctly:
| Improvement with cxj | |
|---|---|
| Input tokens | 6.4× fewer |
| Agent cost | 5.6× cheaper |
| Completion time | 2.2× faster |
For simple one-line lookups, grep actually won. cxj is most useful when answers span multiple files.
Full benchmark and methodology.
No index. No daemon. No stale cache.
cxj uses tree-sitter to parse the current code on every invocation, builds its knowledge in memory, and exits.
- 561-file production Spring service: ~170 ms
- Spring Framework, 1.5 million lines: 2.4 seconds
No persistent state, no background process, and no network required for queries.
Try it
brew install umuterturk/tap/cxj
npx skills add umuterturk/cxj
[download] (https://github.com/umuterturk/cxj/releases/latest)
Works with Claude Code, Codex, OpenCode, and other skill-compatible agents. macOS and Linux. MIT licensed.
GitHub: https://github.com/umuterturk/cxj
Come contribute!
I'm curious whether other developers find persistent codebase indexes necessary, or whether parsing on demand is already fast enough for most projects.
來源:DEV Community · dev.to