You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5d14dca
Browse filesBrowse the repository at this point in the historyBrowse files
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
Copy file name to clipboardExpand all lines: .codex-plugin/plugin.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "codegraph",
3
-
"version": "0.1.7+codex.20261009",
3
+
"version": "0.2.0+codex.20261009",
4
4
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
Copy file name to clipboardExpand all lines: .zcode-plugin/plugin.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
"en": "CodeGraph",
6
6
"zh-CN": "CodeGraph 代码智能"
7
7
},
8
-
"version": "0.1.7",
8
+
"version": "0.2.0",
9
9
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
10
10
"description_i18n": {
11
11
"en": "At SessionStart, when a `.codegraph/` directory exists, this plugin writes the official CodeGraph prompt block to `<cwd>/.claude/CLAUDE.md` or `<cwd>/AGENTS.md`, and injects the same block as SessionStart additionalContext. Exposes 21 of codegraph's 23 CLI commands as slash commands.",
-**SessionStart 钩子保持静默**:上游注入块原文写着 "If there is no `.codegraph/` directory, skip CodeGraph entirely — indexing is the user's decision."(见 `prompt.CODEGRAPH_INSTRUCTIONS_BLOCK`)。钩子若在未索引时发「你该去索引」的提示,等于自我否定刚 verbatim 注入的块,违反上方 L6。未索引场景由技能的「检查 + 提示」通路兜底。
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,13 @@ Three things, and **only** these three:
21
21
- The current session, via `SessionStart.additionalContext` JSON output.
22
22
-`<cwd>/.claude/CLAUDE.md` if it exists; else `<cwd>/AGENTS.md`. Uses atomic, marker-fenced section replacement — byte-equal content is a no-op, so this is safe to run alongside `codegraph install`.
23
23
2.**Exposes 21 of codegraph's 23 CLI commands** as slash commands in two formats: JSON (`commands/*.json`, declared in `kimi.plugin.json`) and Markdown (`kimi-commands/*.md`), including the four hidden-but-useful maintenance commands (`daemon`, `unlock`, `version`, `telemetry`).
24
-
3.**Registers a discovery skill** (`codegraph-helper`) that conditions the agent to use the right CodeGraph MCP tool for the task at hand.
24
+
3.**Registers a discovery skill** (`codegraph-helper`) that makes the agent **check whether the repo is indexed and, if not, proactively offer to index it**. The skill activates on code-structure questions *whether or not*`.codegraph/` exists: it checks first, then either answers via CodeGraph or tells the user 「this repo isn't indexed yet — want me to index it?」 and runs `codegraph init` once the user agrees.
25
25
26
26
## What this plugin does **not** do
27
27
28
28
- It does **not** modify or replace the `codegraph` CLI. The upstream `colbymchenry/codegraph` (MIT) is the source of truth.
29
29
- It does **not** install the `codegraph` CLI. Users run `npm i -g @colbymchenry/codegraph` (or the install script) themselves; the plugin just exposes `/codegraph-install` as a guided wrapper around `codegraph install` for MCP wiring.
30
-
- It does **not**auto-run `codegraph init`. Indexing is the user's decision. The plugin only activates when `.codegraph/` already exists.
30
+
- It does **not** run `codegraph init`**without asking**. Indexing writes a `.codegraph/` directory, so the agent must get consent first — but it *does* detect the missing index and prompt for it automatically, because that discovery is the whole point of this plugin. (The SessionStart hook itself stays silent in un-indexed repos, matching the upstream prompt's own "skip CodeGraph entirely" wording.)
31
31
- It does **not** hook `PreToolUse`, `PostToolUse`, `UserPromptSubmit`, or `Stop` — only `SessionStart`. This avoids collisions with codeguard-plugin and other plugins that own those events.
Copy file name to clipboardExpand all lines: RELEASE-NOTES.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@
13
13
14
14
| Version | Date | Changes |
15
15
|---|---|---|
16
+
| 0.2.0 | 2026-10-09 |**Behaviour change** — the `codegraph-helper` skill no longer treats an existing index as its activation gate; it now activates on code-structure questions in any repo, checks for `.codegraph/` itself, and proactively offers to index when absent (running `codegraph init` only after user consent). Documented the `init` vs `install` boundary. Regression guard added |
16
17
| 0.1.7 | 2026-10-09 | Fix MCP tool claims to match upstream `DEFAULT_MCP_TOOLS` (only `codegraph_explore` is listed to agents by default); drop the fabricated `codegraph affected` MCP alternative; add `/codegraph-context` (codegraph 1.6.0 command) for 21/23 coverage; re-sync prompt text against codegraph v1.6.0; fix `./codegraph/` path typo; align AGENTS.md wording with actual marketplace schema; add regression guard for non-default MCP tool claims |
Copy file name to clipboardExpand all lines: docs/codegraph-plugin-design.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,28 @@ A plugin that activates on SessionStart ensures **all three** audiences get the
16
16
-`additionalContext` injection reaches the main agent's runtime context.
17
17
- Both audiences get the same byte-equal text.
18
18
19
+
## 1b. Why does the skill check for an index instead of assuming one?
20
+
21
+
**Question.** Should `codegraph-helper` just assume the repo is indexed and use CodeGraph?
22
+
23
+
**Answer.** No — and in v0.1.x it actually made that assumption structurally. The skill's frontmatter read *"仓库根有 `.codegraph/` 目录时使用"*, which made index presence the **activation gate**. The same description then ended with *「`.codegraph/` 不存在时引导用户运行 `/codegraph-init`」* — a branch that could never execute, because the skill only activated when it was already indexed. The SessionStart hook was silent for the same reason (`if not is_indexed(cwd): return 0`).
24
+
25
+
Net effect: in an un-indexed repo, **neither** path fired. The agent got no signal that CodeGraph existed, so "discoverability" reduced to discoverability-among-those-who-already-indexed — the one audience that needed it least.
26
+
27
+
**0.2.0 contract.** The skill activates on code-structure questions **regardless of index state**, then branches:
28
+
29
+
|`.codegraph/`| Agent behavior |
30
+
|---|---|
31
+
| present | Answer via `codegraph_explore` (or the CLI table). Never fall back to Read + grep. |
32
+
| absent | Tell the user the repo isn't indexed, offer to index, run `codegraph init`**only after they agree**. |
33
+
34
+
**Why the hook still stays silent when un-indexed.** The injected block must be verbatim from upstream, and upstream's own text says *"If there is no `.codegraph/` directory, skip CodeGraph entirely — indexing is the user's decision."* Emitting an "you should index this" hint from the hook would contradict the block it just injected verbatim, violating the plugin's own prompt-sync discipline. The skill's check-and-prompt path covers that case instead.
35
+
36
+
**`init` vs `install`.** Both are "the user's decision", but the plugin treats them differently — and the discriminator is *scope and reversibility*, not *who decides*:
37
+
38
+
-`codegraph init` → writes `.codegraph/` inside the project, rebuildable → **proactive check + proactive prompt**, may run it with consent.
39
+
-`codegraph install` → rewrites the user's global MCP config, cross-project, affects the host itself → **never runs it for the user**, only guides via `/codegraph-install`.
40
+
19
41
## 2. Why inject at SessionStart, not on every prompt?
20
42
21
43
**Question.** UserPromptSubmit fires every turn — wouldn't that be more reliable?
Copy file name to clipboardExpand all lines: kimi.plugin.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "codegraph",
3
-
"version": "0.1.7",
3
+
"version": "0.2.0",
4
4
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
0 commit comments