跳到主内容
@wquguru
精选88r/LLMDevs(Reddit)技巧与观点

Chonks:基于AST与混合检索的多语言代码RAG工具

A year of reading AST-aware code RAG papers, and the thing I built

原文
发到 X
推荐理由

提供了一套经过文献验证的代码RAG工程实践方案,包含具体的分块策略、混合检索架构及避坑指南,对做Agent开发的同学极具参考价值。

Chonks indexes a large codebase into one SQLite file and serves it to a coding agent over MCP. Tree-sitter AST chunks, hybrid semantic plus BM25, a typed cross-reference graph. No LLM in the retrieval path. Apache-2.0, free, no telemetry. Built for multi-million line codebases.

Ten languages get full symbol and graph support, including C++, C#, HLSL and Python, so it works where a call path crosses languages.

Acc@5 64/100 on held-out Loc-Bench, in one call. The ids were picked before tuning and are published in the repo.

The reading list, and what I got from every single one:

  • [cAST](https://aclanthology.org/2025.findings-emnlp.430/), Findings of EMNLP 2025. Recursive AST-node splitting with sibling merging. The core chunking algorithm.
  • [LARGER](https://arxiv.org/abs/2605.16352), 2026. Lexical anchors, then confidence-filtered expansion. Became my graph seed gate.
  • [Reformulate, Retrieve, Localize](https://arxiv.org/abs/2512.07022), 2026. Pull identifiers and stack-trace terms out of bug report text before retrieval. I do it rule-based, with no LLM call.
  • [From Fragments to Paths](https://arxiv.org/abs/2606.22906), 2026. Budget-constrained traversal over multi-relational repository structure. The same shape as my graph expansion.
  • [AST-derived vs LLM-extracted graphs](https://arxiv.org/abs/2601.08773), 2026. The head-to-head behind my choice to keep the LLM out of index time.
  • [Practical Code RAG at Scale](https://arxiv.org/abs/2510.20609), 2025. The counterpoint. Line chunking matches syntax-aware splitting on completion benchmarks, and BM25 beats dense embeddings for code-to-code queries.
  • [LocAgent](https://arxiv.org/abs/2503.09089), 2025. Released Loc-Bench, which I use as the held-out set.
  • [GraphRAG](https://arxiv.org/abs/2404.16130), 2024.

Most of these I found while building. A lot of the time it turns out, what I was building was converging to the lit.

https://github.com/mgonzalez01/Chonks

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

关联讨论

同一事件的更多信源

相似阅读

关联信息,但可能不是同一事件