ContextMax如何帮助开发者为LLM精准创建代码上下文集?(附实测体验)
AI Summary (BLUF)
ContextMax is a browser-based tool that enables developers to create precise context sets for LLMs by specifying relevant files, functions, and workflows, ensuring privacy and efficiency without uploa
ContextMax:为你的 LLM 精准导航代码库
告诉你的 LLM,对于每个任务,代码库中哪些部分才是真正重要的。
项目主页 | 立即试用
ContextMax 是一款基于浏览器的工具,用于为大型语言模型创建“上下文集”。你可以定义对于特定任务而言,哪些文件、函数和工作流程是相关的。借助内置的 LLM 辅助搜索功能,你的代码永远不会离开你的浏览器。
ContextMax is a browser-based tool that lets you create context sets for LLMs. Define which files, functions, and workflows are relevant for specific tasks. Get assistance from the embedded LLM to assist in your search. Your code never leaves your browser.
【YouTube 视频】精心策划的上下文集如何帮助 LLM(点击观看)
[Youtube Video] How curated context set helps LLM (click to view)
SppedUpDemo-WithText.mp4
🚀 快速开始
🚀 Quick Start
[最快捷] 选项一:使用托管版本
[QUICKEST] Option 1: Use the hosted version
访问在线管理工具。
Go to the curation tool.
隐私说明:即使在托管版本上,你的代码也只会保留在浏览器中。没有任何文件会上传到我们的服务器。
Privacy Note: Even on the hosted version, your code stays in your browser. No files are uploaded to our servers.
选项二:使用 npm 包在本地运行(推荐)
Option 2: Run it locally using the npm package (Recommended)
npx contextmax
# 默认运行在 3000 端口,你也可以像这样指定端口:
PORT=3005 npx contextmax
This will automatically run the tool locally and open it on your browser.
选项三:开发环境搭建
Option 3: Development setup
# 克隆并安装
git clone https://github.com/galliani/contextmax.git
cd contextmax
npm install
# 启动开发服务器
npm run dev
Open http://localhost:3000/ in Chrome/Edge and start creating context sets!
什么是 ContextMax
What is ContextMax
ContextMax 帮助你创建“上下文集”——这是一种 JSON 文件,用于告诉你的 LLM 应该关注代码库中的哪些部分。与其将整个项目一股脑地塞给 LLM,你可以精确指定:
ContextMax helps you create context sets - JSON files that tell your LLM which parts of your codebase to focus on. Instead of dumping your entire project into an LLM, you specify:
哪些文件是相关的 (Which files are relevant)
哪些具体的函数是重要的 (Which specific functions matter)
不同部分之间如何连接(工作流程) (How different parts connect (workflows))
Think of it as creating a map for your LLM to navigate your codebase.
核心特性
Key Features
可视化构建器 (Visual Builder): 通过 UI 界面创建上下文集,无需手动编辑 JSON
100% 隐私 (100% Private): 所有操作均在浏览器中运行。无需服务器,无需上传
函数级上下文 (Function-Level Context): 可以指向特定函数,而不仅仅是文件
工作流映射 (Workflow Mapping): 展示文件和函数在数据流中如何连接
版本控制就绪 (Version Control Ready): 输出是简单的 JSON 文件,可以直接提交到版本库
团队共享 (Team Sharing): 团队成员可以使用相同的上下文定义
本地 AI (Local AI): 内置嵌入模型,提供智能文件建议
快速 (Fast): 使用 IndexedDB 缓存,并在可用时利用 WebGPU 加速
Visual Builder: Create context sets through a UI instead of editing JSON
100% Private: Everything runs in your browser. No servers, no uploads
Function-Level Context: Point to specific functions, not just files
Workflow Mapping: Show how files and functions connect in your data flow
Version Control Ready: Output is a simple JSON file you can commit
Team Sharing: Everyone uses the same context definitions
Local AI: Built-in embeddings model for smart file suggestions
Fast: Uses IndexedDB caching and WebGPU when available
亲自尝试:见证差异
Try It Yourself: See the Difference
想证明上下文集是否有效吗?ContextMax 自身的代码库就使用了上下文集!
Want proof that context sets work? The contextMax codebase itself uses context sets!
首先,克隆 contextmax 仓库:
First, clone the
contextmaxrepo:
git clone https://github.com/galliani/contextmax.git
然后,为了了解管理工具的工作原理
Then, to get the sense of how the curation tool works
将
contextmax仓库上传到工具中 (Upload thecontextmaxrepo into the tool)
或者,为了了解其工作原理
Or to get the sense of how it works
用你的 LLM 进行测试 (Test with your LLM):
提问:"
@context:embeddingsGeneration是如何工作的?" (Ask: "How does@context:embeddingsGenerationwork?")提问:"解释
@context:contextCreation流程" (Ask: "Explain the@context:contextCreationflow")与以下提问进行比较:"在这个代码库中,嵌入生成是如何工作的?" (Compare with asking: "How does embedding generation work in this codebase?")
You'll see firsthand how context sets give your LLM laser focus on the right code, reducing token usage by ~80% while getting more accurate answers.
为什么选择 ContextMax
Why ContextMax
LLM 在处理真实代码库时常常失败,因为它们:
LLMs often fail on real codebases because they:
生成的代码忽略了现有的代码模式 (Generate code that ignores your existing patterns)
遗漏了关键的依赖关系和关联 (Miss critical dependencies and relationships)
提出的解决方案不符合你的架构 (Suggest solutions that don't fit your architecture)
迫使你反复解释相同的上下文 (Force you to repeatedly explain the same context)
Even when LLMs succeed, they waste time and tokens searching through your entire codebase, reading irrelevant files to piece together context. With ContextMax, your LLM starts with the exact files and functions it needs, understands the workflow from entry point to completion, and produces accurate results faster with fewer tokens.
ContextMax 通过让你一次性定义并复用上下文来解决这个问题。你的团队将获得一致、准确的 AI 辅助,它真正理解你的代码结构。
ContextMax solves this by letting you define context once and reuse it. Your team gets consistent, accurate AI assistance that actually understands your code structure.
没有上下文集的情况
Without Context Sets
graph TD
A[提示:修复登录Bug] --> B[LLM 搜索代码库]
B --> C[在所有文件中进行 Grep]
C --> D[读取许多文件]
D --> E[推断关系]
E --> F[假设架构]
F --> G[生成代码]
G --> H{代码有效吗?}
H -->|否| I[用户提供更多上下文]
I --> B
H -->|是| J[完成 - 使用了 10k+ tokens]
graph TD A[Prompt: Fix login bug] --> B[LLM searches codebase] B --> C[Grep through all files] C --> D[Read many files] D --> E[Infer relationships] E --> F[Assume architecture] F --> G[Generate code] G --> H{Code works?} H -->|No| I[User provides more context] I --> B H -->|Yes| J[Done - 10k+ tokens used]
使用手动文件列表的情况
With Manual File Lists
graph TD
A[用户列出:login.vue, auth.controller.ts, user.model.ts] --> B[LLM 读取文件]
B --> C[读取完整文件 - 3k tokens]
C --> D[没有函数定位]
D --> E[识别相关函数]
E --> F[遗漏:中间件、验证器、工具函数]
F --> G[没有工作流信息]
G --> H[生成代码]
H --> I[用户添加遗漏的文件]
I --> J[包含更多上下文]
J --> B
graph TD A[User lists: login.vue, auth.controller.ts, user.model.ts] --> B[LLM reads files] B --> C[Reads complete files - 3k tokens] C --> D[No function targeting] D --> E[Identifies relevant functions] E --> F[Missing: middleware, validators, utils] F --> G[No workflow information] G --> H[Generate code] H --> I[User adds missing files] I --> J[Include more context] J --> B
使用上下文集的情况
With Context Sets
graph TD
A[提示:修复登录Bug] --> B[LLM 加载上下文:UserAuth_Flow]
B --> C[读取指定的 5 个文件]
C --> D
## 常见问题(FAQ)
### ContextMax 如何确保我的代码隐私安全?
ContextMax 完全在浏览器本地运行,所有代码处理都在你的设备上进行,无需上传到外部服务器,从根本上保障了代码隐私和数据安全。
### 使用 ContextMax 有哪些快速开始的方式?
有三种方式:1) 直接使用托管版本;2) 通过 npm 包在本地运行(推荐);3) 搭建开发环境。所有方式都基于浏览器,无需复杂配置。
### ContextMax 能为 LLM 提供什么样的上下文?
你可以为特定任务精准定义相关的文件、函数和工作流程,创建精确的上下文集,并利用内置的 LLM 辅助搜索功能,让 LLM 只关注代码库中真正重要的部分。
版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。
文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。
若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。 也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。


