hook-augment is spawned per tool call even with an empty index; expose a cheap "is cwd indexed" gate
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- c, sqlite
调研方向
Start with src/store/store.c, which the issue names for the cache layout and project database invariant, then trace the hook-augment entry point and generated OpenCode plugin hook. Decide which proposed gate fits the existing interfaces and make its behavior machine-readable or skip work when no project is indexed. Done means the client can avoid repeated useless launches; include windowsHide: true for generated plugin spawns as described.
由索引模型根据 Issue 内容生成。
描述
Summary
A generated client hook spawns codebase-memory-mcp hook-augment on every tool result, even when the current directory is not covered by any indexed project. In that state the call cannot produce anything useful: it walks up ancestors, falls back to scanning the whole cache and opening every project DB, and then returns the same generic hint every time:
[codebase-memory] Session context: no indexed graph project matched this working directory.
Run index_repository before structural exploration. ...
A no-op should cost nothing. Today it costs a process spawn, a cache scan, an on-access AV scan, and — on Windows — a console window.
Environment
- codebase-memory-mcp 0.12.1, Windows 11
- OpenCode 2 (V2
setup(ctx)surface,execute.aftertool hook); the plugin calls the standalone CLI with stdin JSON:SessionStart,PreToolUse(Grep/Glob),PostToolUse(Read) - Cache state during measurement:
list_projects→projects: 0, i.e. nothing indexed on the machine
Observed
- One
hook-augmentprocess per tool result (measured 10–20 spawns per minute in an active session). - On Windows the client runs as a detached service process without a console, so each spawn allocates a fresh console window (
conhost/OpenConsole -Embedding) that appears and closes; the user sees a terminal flicker per tool call. - Every launch of the executable is also picked up by on-access AV scanning.
- The answer does not depend on the tool or the payload: for a directory with no index the outcome is always the same hint, and nothing in the payload can change that until the project is indexed.
Proposal (any one is enough for a client-side gate)
- Exit before the ancestor walk and the cache scan when the cache contains no project DBs at all — in that state neither step can succeed.
- A machine-readable gate: e.g.
hook-augment --if-indexed(or a documented exit code) that answers "iscwdcovered by an indexed project?" without emitting augmentation text, so a client can skip the call entirely. - A documented, stable offline check. The cache layout is already effectively a contract —
<cache>/<project>.db, tableprojects, single row withroot_path(src/store/store.c, incl. the "no ghost .db for unknown/unindexed projects" invariant) — but it is not documented as public API. If it were, a client could verify with the host runtime's built-in SQLite and spawn nothing. - Generated plugins: register the hook only when the project is indexed, and/or cache the answer. Workaround used today: read
root_pathfrom the project DBs in the cache via the runtime's built-in SQLite (bun:sqlite/node:sqlite), fail open when verification is impossible, re-check every 5 minutes.
Independently of the gating, generated plugins should spawn with windowsHide: true: a console window per tool call is user-visible noise (same class of problem as #1427).
Related
- #2058 —
hook-augmentrestarts the daemon on every invocation (~3 s per call) - #1427 — detached daemon spawns focus-stealing console windows (closed)
- 主要语言
- C
- 星标
- 45.8k
- 派生
- 3.8k
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 108
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DeusData/codebase-memory-mcp 的其他 Issue
-
bug ux/behavior
难度 2/5 1-3 小时 新手友好度 70/100
DeusData/codebase-memory-mcp#3191 ·
维护者通常 1 天内回复
-
documentation enhancement parsing/quality ux/behavior
难度 1/5 1-3 小时 新手友好度 82/100
DeusData/codebase-memory-mcp#3131 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug editor/integration parsing/quality ux/behavior
难度 2/5 1-3 小时 新手友好度 75/100
DeusData/codebase-memory-mcp#3062 · 2 条评论 ·
维护者通常 1 天内回复
-
bug documentation editor/integration parsing/quality
难度 2/5 1-3 小时 新手友好度 75/100
DeusData/codebase-memory-mcp#3050 · 1 条评论 ·
维护者通常 1 天内回复
-
editor/integration parsing/quality
难度 2/5 1-3 小时 新手友好度 68/100
DeusData/codebase-memory-mcp#2286 ·
维护者通常 1 天内回复
查看 DeusData/codebase-memory-mcp 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
维护者通常 1 天内回复
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the game未关闭game: 010065A014024000 ios
难度 2/5 1-3 小时 新手友好度 76/100
seedds/nxnative#3714 · 1 条评论 ·
维护者通常 2 天内回复