atobouh/symapse

GitHub: atobouh/symapse

Symapse 通过对代码库构建确定性调用图并提供 MCP/CLI/REST 接口,帮助 AI 编程助手大幅减少文件读取次数和 token 消耗。

Stars: 1 | Forks: 0

# Symapse

npm version license node

## 安装 ``` npm install -g symapse ``` 要求 **Node.js 22+**。无依赖。零配置。 ## 快速开始 ``` # 索引你的项目 symapse index /path/to/repo # 启动 MCP server(用于 OpenCode/Cursor/Claude 集成) symapse mcp /path/to/repo # 从终端查询 symapse_ask "add notification system" symapse_find login symapse_map "direct login after payment" symapse_audit 10 symapse_health # 实时编码感知 — 开始监视冲突、中断和死代码 symapse_health --watch ``` ## OpenCode 集成 首先安装 Symapse: ``` npm install -g symapse ``` 添加到你的项目的 `opencode.json` 中: ``` { "mcp": { "symapse": { "type": "local", "command": ["npx", "symapse", "mcp", "."], "enabled": true } } } ``` 在你的项目根目录下创建 `AGENTS.md`,内容如下: ``` ## 规则 1:始终首先检查 Symapse | Instead of... | Use... | |---|---| | Reading files for architecture | `symapse_map` | | Grepping for symbols | `symapse_find` | | Guessing where code goes | `symapse_ask` | | Finding dead code or duplicates | `symapse_audit` | | Re-indexing or checking status | `symapse_health` | First action every session: `symapse_ask ""`. If it returns questions, ASK them. If Symapse doesn't answer your question, read files. ``` ## 工具 | 工具 | 它能回答的问题 | |---|---| | `symapse_ask` | 在处理 X 之前我应该了解什么? | | `symapse_find` | X 在哪里,它影响了什么? | | `symapse_map` | 展示这个 repo / feature 的结构 | | `symapse_audit` | 哪些地方有错误、未使用或重复? | | `symapse_diff` | 修改后:我影响了什么?watch 检测到了什么? | | `symapse_health` | index 的状态是什么?Watch 模式 | **时序工作流:** - 编码前:`symapse_ask` → `symapse_map` → `symapse_find` - 编码时:`symapse_health --watch` - 每次编辑后:`symapse_diff` - 维护:`symapse_audit` | `symapse_health` ## 支持的语言 JavaScript、TypeScript、Python、Go、Rust、C#、PHP、Ruby、Lua 和 C。 ## 工作原理 1. **Index** — 遍历 repo,使用 regex 解析器提取函数/类/方法,构建调用和导入关系边 2. **Store** — 规范化的 SQLite schema,基于 mtime + engine 版本进行增量更新 3. **Expose** — CLI、REST API 以及基于 stdio 的 MCP。所有这些都共享同一个 engine。 ## 自我改进 Symapse 会在跨会话中学习 agent 的行为,无需任何用户干预: - **Session coherence** — 将上下文偏向 agent 已经在探索的子系统 - **Usage signals** — 记录 agent 实际深入查看的 symbols - **Workflow memory** — 自动检测跨会话中重复的 symbol 序列 - **Intent classification** — 将配置/文档问题路由,使其远离源代码探索 ## 架构 ``` packages/ engine/ — regex-based parser, call graph, all analysis tools db/ — SQLite persistence with incremental indexing mcp/ — MCP protocol server (JSON-RPC over stdio) apps/ cli/ — command-line entry point api/ — HTTP API server + web dashboard web/ — terminal-style web UI ``` ## 许可证 AGPL-3.0
标签:AI编程助手, GNU通用公共许可证, MCP, MITM代理, Node.js, SOC Prime, SQL查询, 代码分析, 代码索引, 凭证管理, 开发工具, 自定义脚本, 调用图