context-mcp-server 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +29 -7
  2. package/codegraph/__pycache__/affected.cpython-313.pyc +0 -0
  3. package/codegraph/__pycache__/cache.cpython-313.pyc +0 -0
  4. package/codegraph/__pycache__/callflow_html.cpython-313.pyc +0 -0
  5. package/codegraph/__pycache__/export.cpython-313.pyc +0 -0
  6. package/codegraph/__pycache__/report.cpython-313.pyc +0 -0
  7. package/codegraph/__pycache__/server.cpython-313.pyc +0 -0
  8. package/codegraph/__pycache__/tree_html.cpython-313.pyc +0 -0
  9. package/codegraph/affected.py +233 -0
  10. package/codegraph/cache.py +51 -2
  11. package/codegraph/callflow_html.py +273 -0
  12. package/codegraph/export.py +544 -0
  13. package/codegraph/extractors/__pycache__/ast_extractor.cpython-313.pyc +0 -0
  14. package/codegraph/extractors/ast_extractor.py +143 -16
  15. package/codegraph/graph/__pycache__/builder.cpython-313.pyc +0 -0
  16. package/codegraph/graph/__pycache__/clustering.cpython-313.pyc +0 -0
  17. package/codegraph/graph/__pycache__/query.cpython-313.pyc +0 -0
  18. package/codegraph/graph/__pycache__/symbol_resolution.cpython-313.pyc +0 -0
  19. package/codegraph/graph/builder.py +10 -0
  20. package/codegraph/graph/clustering.py +247 -10
  21. package/codegraph/graph/query.py +56 -0
  22. package/codegraph/graph/symbol_resolution.py +112 -0
  23. package/codegraph/report.py +53 -0
  24. package/codegraph/server.py +99 -10
  25. package/codegraph/tree_html.py +241 -0
  26. package/package.json +2 -2
  27. package/pyproject.toml +4 -1
  28. package/src/cli.js +277 -86
  29. package/src/server.js +7 -1
  30. package/src/templates/antigravity/GEMINI.md +96 -0
  31. package/src/templates/antigravity/hooks/context-mcp-post-tool-use.js +62 -0
  32. package/src/templates/antigravity/workflows/context-resume.md +20 -0
  33. package/src/templates/antigravity/workflows/graph-build.md +23 -0
  34. package/src/templates/antigravity/workflows/save-context.md +29 -0
  35. package/src/templates/{CLAUDE.md → claude/CLAUDE.md} +3 -0
  36. package/src/templates/claude/commands/graph-build.md +9 -0
  37. package/src/templates/claude/commands/save-context.md +19 -0
  38. package/src/templates/claude/hooks/context-mcp-post-tool-use.js +59 -0
  39. package/src/templates/claude/hooks/context-mcp-pre-tool-use.js +26 -0
  40. package/src/templates/{skills → claude/skills}/SKILL.md +3 -0
  41. package/src/templates/codex/AGENTS.md +107 -0
  42. package/src/templates/codex/hooks/context-mcp-post-tool-use.js +46 -0
  43. package/src/templates/codex/hooks/context-mcp-pre-tool-use.js +23 -0
  44. package/src/templates/codex/prompts/context-resume.md +15 -0
  45. package/src/templates/codex/prompts/graph-build.md +14 -0
  46. package/src/templates/codex/prompts/save-context.md +24 -0
  47. package/src/templates/cursor/commands/context-resume.md +7 -0
  48. package/src/templates/cursor/commands/graph-build.md +7 -0
  49. package/src/templates/cursor/commands/save-context.md +12 -0
  50. package/src/templates/{cursor-rules.mdc → cursor/cursor-rules.mdc} +13 -3
  51. package/src/templates/cursor/hooks/context-mcp-post-tool-use.js +55 -0
  52. package/src/templates/{GEMINI.md → gemini/GEMINI.md} +3 -1
  53. package/src/templates/gemini/commands/context-resume.toml +15 -0
  54. package/src/templates/gemini/commands/graph-build.toml +14 -0
  55. package/src/templates/gemini/commands/save-context.toml +24 -0
  56. package/src/templates/gemini/hooks/context-mcp-after-tool.js +59 -0
  57. package/src/templates/gemini/hooks/context-mcp-before-tool.js +26 -0
  58. package/src/templates/vscode/commands/context-resume.prompt.md +15 -0
  59. package/src/templates/vscode/commands/graph-build.prompt.md +10 -0
  60. package/src/templates/vscode/commands/save-context.prompt.md +16 -0
  61. package/src/templates/vscode/hooks/context-mcp-post-tool-use.js +58 -0
  62. package/src/templates/windsurf/hooks/context-mcp-post-run-command.js +57 -0
  63. package/src/templates/{windsurf-rules.md → windsurf/windsurf-rules.md} +6 -4
  64. package/src/templates/windsurf/workflows/context-resume.md +11 -0
  65. package/src/templates/windsurf/workflows/graph-build.md +11 -0
  66. package/src/templates/windsurf/workflows/save-context.md +18 -0
  67. package/src/tools/codegraph.js +37 -0
  68. package/uv.lock +1100 -3
  69. package/src/templates/AGENTS.md +0 -90
  70. package/src/templates/commands/graph-build.md +0 -5
  71. package/src/templates/commands/save-context.md +0 -12
  72. /package/src/templates/{commands → claude/commands}/context-resume.md +0 -0
@@ -1,90 +0,0 @@
1
- # Context-MCP — Codex CLI Usage Guide
2
-
3
- Persistent memory + codebase knowledge graph.
4
- `context.resume` starts every session. `codegraph_arch` shows module structure. `codegraph_query` finds specific symbols. Files only for bugs/logic.
5
-
6
- ---
7
-
8
- ## 1. Start of Every Conversation (MANDATORY)
9
-
10
- Call `context` MCP tool: `action:"resume"`, `project:"<project>"` before anything else.
11
-
12
- Returns: `recentEntries`, `activePlans`, `codegraph`, `stats.totalEntries`.
13
-
14
- - `codegraph.built: true` → use graph tools before reading files
15
- - `codegraph.built: false` → call `codegraph_build(path)` first
16
- - `stats.totalEntries ≥ 20` → write compaction summary FIRST (see Rule 4)
17
- - `activePlans` non-empty → read them before starting new work
18
-
19
- ---
20
-
21
- ## 2. Save Triggers (MANDATORY)
22
-
23
- Call `context.save` with `type: "note"` after finishing anything worth keeping:
24
-
25
- | Trigger | Required fields |
26
- |---|---|
27
- | Task / fix / feature complete | title, why, outcome, files[] |
28
- | Decision made | title, why, outcome |
29
- | Discovery / constraint / gotcha | title, content |
30
- | Config / env / deploy info | title, content |
31
- | Graph build complete | title, content (nodes/edges count) |
32
- | User says "save this" | title, content |
33
- | "compact now" / "compress memory" | `type:"compaction"`, full session summary |
34
-
35
- **Do NOT save:** routine reads, search results, explanations of existing code.
36
-
37
- ---
38
-
39
- ## 3. Plans (MANDATORY for multi-file work)
40
-
41
- **Create a plan when:** editing 2+ files, multi-step implementation, refactor, multi-file bug fix.
42
-
43
- 1. Call `plan.save` with name, content, project before starting
44
- 2. Call `plan.update status:"done"` when complete — deletes the plan
45
-
46
- Check `activePlans` on resume — don't create duplicates.
47
-
48
- ---
49
-
50
- ## 4. Auto-Summary at ≥ 20 Entries (MANDATORY)
51
-
52
- When `totalEntries ≥ 20`, call `context.save` BEFORE the user's task:
53
-
54
- ```
55
- type: "compaction" title: "Session summary — <YYYY-MM-DD>"
56
- content: "<what was built, decided, broke, current state>"
57
- project: "<project>"
58
- ```
59
-
60
- ---
61
-
62
- ## 5. Search Before Asking
63
-
64
- Call `search` before asking user to re-explain past work.
65
-
66
- ---
67
-
68
- ## 6. ContextGraph Tools
69
-
70
- ```
71
- codegraph_build(path) → build AST graph (run once)
72
- codegraph_arch(path, limit?) → module map: files, exports, imports
73
- codegraph_query(path, question?, node?) → find symbol or answer structural question
74
- codegraph_nodes(path, type) → list all nodes of a type
75
- codegraph_report(path) → structural analysis
76
- ```
77
-
78
- Use `codegraph_arch` first. Never read files for structure questions.
79
-
80
- ---
81
-
82
- ## 7. Rules
83
-
84
- 1. `context.resume` first — before any tool or response
85
- 2. Always pass `project`
86
- 3. Save on task complete — `why` + `outcome` + `files`
87
- 4. Compaction at ≥ 20 entries — before starting task
88
- 5. Plan before multi-file work — `status:"done"` deletes it
89
- 6. Search before asking about past work
90
- 7. Graph tools before files
@@ -1,5 +0,0 @@
1
- Call `codegraph_build` with the path `$ARGUMENTS` (if no argument given, use the current working directory).
2
-
3
- This builds the ContextGraph for the project — parses all source files into an AST knowledge graph using tree-sitter. Takes a few seconds. Once built, use `codegraph_query` to answer any structural question about the codebase instead of reading files directly.
4
-
5
- After build completes, report: total nodes, edges, and communities found.
@@ -1,12 +0,0 @@
1
- Call the `context` MCP tool with `action: "save"` to store a note for the current project.
2
-
3
- Parse `$ARGUMENTS` to determine:
4
- - `project`: infer from current working directory name if not specified
5
- - `title`: first sentence or phrase (up to 120 chars — be specific)
6
- - `why`: reason it mattered — what problem it solved or constraint it revealed
7
- - `outcome`: result — what changed, what was verified, what shipped, which files were affected
8
- - `files`: list of files changed (required for task/bug types)
9
- - `content`: full argument text
10
- - `type`: auto-detect — bug/fix/error → `"bug"`, task/done/complete/shipped/implemented → `"task"`, decision/chose/decided/approach → `"decision"`, config/env/secret/deploy → `"config"`, otherwise `"note"`
11
-
12
- Confirm to the user: title, type, why, outcome, project.