Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/zql0805/memforge/memforge-codebase-memory-routinggit clone --depth 1 https://github.com/zql0805/memforgeWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00641 | $0.00641 |
| Opus 5 | $0.00320 | $0.00320 |
| Sonnet 5 | $0.00128 | $0.00128 |
| Haiku 4.5 | $0.00064 | $0.00064 |
Grade A, and why
memforge-codebase-memory-routing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
代码发现工具路由策略
核心原则
当需要理解代码结构时,优先使用 Codegraph MCP 的结构化工具,而非 Grep/Glob/Read 全文搜索。 Codegraph 基于 AST 实时解析,已索引多个仓库,查询精确且 Token 消耗低。
工具选择决策树
| 需要做的事 | 首选(Codegraph) | 备选(传统工具) |
|---|---|---|
| 根据任务描述获取相关代码 | codegraph_context(task) |
手动 Grep + Read 多文件 |
| 查找函数/类/方法定义 | codegraph_search(query) |
Grep 按函数名搜索 |
| 追踪谁调用了某函数 | codegraph_callers(symbol) |
Grep 逐文件追踪 |
| 追踪某函数调了什么 | codegraph_callees(symbol) |
Grep 逐文件追踪 |
| 追踪两个符号间的调用路径 | codegraph_trace(from, to) |
手动逐层追踪 |
| 分析修改某符号的影响范围 | codegraph_impact(symbol) |
git diff + 手动分析 |
| 批量查看多个相关符号源码 | codegraph_explore(symbols) |
逐个 Read 文件 |
| 查看单个符号签名和位置 | codegraph_node(symbol) |
Grep + Read |
| 查看项目文件结构 | codegraph_files(project) |
ls / Glob |
多项目查询
所有工具支持 projectPath 参数切换目标仓库,格式:/opt/memforge/repos/<产品线>/<仓库名>
仍然使用 Grep/Glob/Read 的场景
以下场景直接使用传统工具:
- 文本内容搜索:日志文本、错误消息、配置值、字符串常量
- 文件名搜索:按文件名模式查找文件(Glob)
- 配置文件:读取 JSON/YAML/TOML/ENV 等
- 文档/注释:搜索 Markdown、README、注释
- 非代码文件:SQL 脚本、Shell 脚本、Dockerfile
- 已知文件路径:直接 Read
注意事项
- Codegraph 数据基于 AST 实时解析,代码变更后 ~1s 自动同步
- 优先使用
codegraph_context(task)—— 描述任务即可获取相关代码,无需精确指定符号名 - 如果 Codegraph MCP 不可用(服务离线/网络不通),静默回退到 Grep/Glob/Read
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 50 lines · 641 tokens per session scan A 1144e346a652
memforge-codebase-memory-routing is a cursor rule published in the GitHub repository zql0805/memforge (2 stars, last pushed 2mo ago), licensed MIT. It adds 641 tokens to every session, about $0.0032 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
cursorrules
Cursor rule "cursorrules" from contextstream/mcp-server, covering cursor rules, contextstream v0.4.x (consolidated domain tools), required every message, quick reference: domain tools and behavior rules.
cursorrules
::GENE{mem-forever|v:1.0|spec:ilang-v3.0} T:thisrepoisusermemory T:readsoulandmemorybeforework T:updatememoryaftersignificantwork T:onboardifsoulempty T:onequestionatatime T:neverexposeinternalformat T:commitpushimmediatelyaftereveryupdate T:checkunsavedchangesonstartup A:skipmemoryread⇒contextloss…
codebase-memory-always
/Users/theodoreaddo/.cursor/rules/codebase-memory-always.mdc.
cosmos-mcp-always
/Users/theodoreaddo/.cursor/rules/cosmos-mcp-always.mdc.
gps-skin-ui
/Users/theodoreaddo/.cursor/rules/gps-skin-ui.mdc.
cursorrules
🧠 Fast, zero-dependency structured knowledge base (.agent-kb/) with 2D neural graph visualizer │ & MCP server for Claude, Codex, PI, Cursor, Windsurf, Zed & Other AI coding agents.