Show HN: 我搭建了一个本地运行的 RAG 和知识图谱 Agent
4 分•作者: gabriel_oauth•大约 2 个月前
Claw-Coder 是一款 AI 代理,在您的笔记本电脑上本地运行,并可以使用强大的工具,无需配置 Claude 或 Codex 来使用本地模型,只需使用 Claw-Coder 即可。
创建 Claw-Coder 的原因是什么? 答案:为了解决隐私和安全问题。 当您使用配置了云模型(如 Codex、Cursor、Claude 等)的代理时,您不仅仅获得了代理,还交出了代码库来训练 LLM,这有点令人担忧,并降低了对 AI 技术的信任。 但现在又出现了一个问题:性能。 当您切换到并非为此工作流程设计的本地模型时,您会失去性能和速度,这确实是一种权衡。 这就是 Claw-Coder 的用武之地,它不仅在您的机器上运行,而且所有代码、RAG、知识图谱等信息都保存在本地,从而解决了隐私问题。 但现在性能又如何呢?
性能:本地 LLM 并非为执行云模型所做的那些很酷的事情而构建,因为模型大小甚至无法构建真正的应用程序,例如 8b 模型、13b 甚至 1b。 因此,我提出的解决方案是让这些小型模型访问工具和功能,使它们在编码性能方面真正发挥作用。
那么 Claw-Coder 可以访问什么呢? 知识图谱:知识图谱是现实世界实体(例如人、地点、概念或事件)及其相互关系的互连网络。 它将信息组织成可读的意义网络,而不是静态列表,从而使人类和 AI 都能理解上下文。 那么这如何帮助 AI 呢? 它使 AI 能够讲述代码库中代码之间的关系、克隆的未知存储库等等,这大大提高了本地 LLM 在编码任务和推理能力方面的性能。 RAG:我们都曾接触过 RAG,但有一个问题,本地 LLM 的上下文窗口无法容纳大型代码库和存储库,因此 RAG 并非可选。 通过将向量存储在向量存储中,您可以使 AI 真正了解代码的含义以及每个部分对其他部分的作用,从而允许您将数百万行代码加载到向量存储中,而不会使上下文窗口崩溃。
工具:我们已经讨论了改进本地 LLM 性能的微小但强大的方法,但要成为一个代理,它需要采取行动,这就是向本地 LLM 暴露工具的地方。 那么,哪些工具已集成到 Claw-Coder 中呢? 1. search_tool 这使 AI 代理能够实际搜索最新信息,这样它就不会对它不知道的信息产生幻觉,这在本地 LLM 中很常见。 2. Docker 执行 此代理有一个名为 workspace 的特殊文件夹,它可以在其中工作,而不会破坏您的桌面,但这不足以保护您的桌面免受廉价代码的破坏,这就是 Docker 的用武之地。 我已经实现了各种语言的 Docker 容器,代理可以在其中验证自己的代码,这非常强大,因为所有 LLM(不仅仅是本地 LLM)都会生成代码,它们甚至无法确认代码是否有效,因为它们只是强大的预测器,因此使它们能够运行其代码可以令人惊讶地提高生成代码的实用性,因为它现在知道它是否有效,即使对于 html 和 css,AI 代理也被赋予了一个有用的视觉 LLM,以实际解释浏览器中呈现的内容。 这就是为 LLM 提供 Docker 执行工具的惊人力量。
我们已经研究了 Claw-Coder 的许多不同之处,使本地 LLM 能够真正完成实际工作。 但是,您如何亲自尝试呢? Claw-Coder 是闭源的,因为它正在进行大量测试,但这并没有扼杀透明度,并且由于我们正在测试它,这并不能阻止人们在真实的代码库上尝试它并提供反馈,要开始使用:
brew tap gabriel-c70/claw 然后 brew install claw-coder
查看原文
Claw-Coder is an AI agent that runs locally on your laptop and has access to powerful tools instead of configuring claude or codex to use a local model just use claw-coder.
Why was claw-coder created? Answer: To solve the problem of privacy and security. When you use an agent that is configured with a cloud model like codex, cursor, Claude etc. You are not just getting the agent but you are giving up your codebase to train an llm which is a bit concerning and this reduces trust in the technology called AI but now another problem comes in performance when you switch to a local model that is not made for that workflow you lose performance, speed, and it becomes really a tradeoff so that's where claw-coder comes in it not only runs on your machine but all the code, rag, knowledge graph etc info is kept local making the privacy problem solved but now what about performance.<p>Performance: Local llms are not built to do the cool things cloud models do because the model sizes are not even capable of building real apps like the 8b models, 13b, even 1b so the solution I came up with was to give these small models access to tools and features that make it actually work well in coding performance.<p>So what does claw-coder have access to: A knowledge graph: A knowledge graph is an interconnected network of real-world entities—such as people, places, concepts, or events—and the relationships between them. It organizes information into a readable web of meaning rather than static lists, allowing both humans and AI to understand context. So how does this help an AI, it gives the AI the ability to tell relationships between code in your codebase, a cloned unknown repo and so forth this increases performance of local llms by far in coding tasks and reasoning abilities. Rag: We have ever had of RAG at some point but there is a catch the context window of local llms can't bear large codebases and repos so RAG isn't optional by storing vectors in a vector store you enable the AI to actually know what the code means and what each piece does to the other letting you load millions of lines into the vector store without blowing up the context window.<p>Tools: So we have discussed the tiny but powerful ways to improve local llm performance but an agent to be an agent it needs to take action this is where exposing tools to the local llm helps so what tools have been implemented into claw-coder. 1. search_tool This enables the ai agent to actually search up to date info so that it doesnt hallucinate on info it doesn't know which is common in local llms. 2. Docker execution This agent has a special folder called workspace where it does its work without destroying your desktop but this is not enough to protect your desktop from being destroyed by cheap code so this is where docker comes in I have implemented docker containers of various languages where the agent can validate its own code this is powerful because all llms not only local ones generate code they can't even confirm works because they are just powerful predictors so enabling it to run its code can surprisingly increase the usefulness of the generated code because it now knows it works or not even for html and css the ai agent has been given a helpful vision llm to actually explain what rendered in the browser. This is the surprising power of giving an llm a docker execution tool.<p>We have looked at a lot of how claw-coder is different enabling local llms to actually do real work. But how do you actually try it out yourself: Claw-coder is closed source because it is going through heavy testing but that doesnt kill transparency and since we are testing it doesn't stop people from trying it on real codebase and giving feedback to get started use:<p>brew tap gabriel-c70/claw then brew install claw-coder