doubled-graph 1.0.0__tar.gz

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.

Potentially problematic release.


This version of doubled-graph might be problematic. Click here for more details.

Files changed (128) hide show
  1. doubled_graph-1.0.0/.gitignore +2 -0
  2. doubled_graph-1.0.0/LICENSE +21 -0
  3. doubled_graph-1.0.0/PKG-INFO +222 -0
  4. doubled_graph-1.0.0/README.md +188 -0
  5. doubled_graph-1.0.0/docs/CHANGELOG.md +50 -0
  6. doubled_graph-1.0.0/docs/HOOKS.md +251 -0
  7. doubled_graph-1.0.0/docs/METHODOLOGY_README.md +96 -0
  8. doubled_graph-1.0.0/docs/SPEC.md +343 -0
  9. doubled_graph-1.0.0/docs/TOOLS.md +360 -0
  10. doubled_graph-1.0.0/for-ai-existing-project/README.md +56 -0
  11. doubled_graph-1.0.0/for-ai-maintenance/README.md +68 -0
  12. doubled_graph-1.0.0/for-ai-new-project/README.md +52 -0
  13. doubled_graph-1.0.0/methodology/README.md +60 -0
  14. doubled_graph-1.0.0/methodology/approval-checkpoints.md +164 -0
  15. doubled_graph-1.0.0/methodology/artifacts.md +303 -0
  16. doubled_graph-1.0.0/methodology/auto-scaling.md +70 -0
  17. doubled_graph-1.0.0/methodology/drift-and-priority.md +184 -0
  18. doubled_graph-1.0.0/methodology/language-adapters/_template.md +99 -0
  19. doubled_graph-1.0.0/methodology/language-adapters/csharp.md +262 -0
  20. doubled_graph-1.0.0/methodology/language-adapters/go.md +263 -0
  21. doubled_graph-1.0.0/methodology/language-adapters/java.md +238 -0
  22. doubled_graph-1.0.0/methodology/language-adapters/python.md +229 -0
  23. doubled_graph-1.0.0/methodology/language-adapters/rust.md +250 -0
  24. doubled_graph-1.0.0/methodology/language-adapters/swift.md +243 -0
  25. doubled_graph-1.0.0/methodology/language-adapters/typescript.md +236 -0
  26. doubled_graph-1.0.0/methodology/principles.md +168 -0
  27. doubled_graph-1.0.0/methodology/roles.md +112 -0
  28. doubled_graph-1.0.0/methodology/runtime-adapters/_template.md +65 -0
  29. doubled_graph-1.0.0/methodology/runtime-adapters/claude-code.md +142 -0
  30. doubled_graph-1.0.0/methodology/runtime-adapters/codex.md +62 -0
  31. doubled_graph-1.0.0/methodology/runtime-adapters/continue.md +72 -0
  32. doubled_graph-1.0.0/methodology/runtime-adapters/cursor.md +116 -0
  33. doubled_graph-1.0.0/methodology/runtime-adapters/local-llm.md +147 -0
  34. doubled_graph-1.0.0/methodology/runtime-adapters/windsurf.md +60 -0
  35. doubled_graph-1.0.0/methodology/tools.md +182 -0
  36. doubled_graph-1.0.0/methodology/workflow.md +131 -0
  37. doubled_graph-1.0.0/prompts/maintenance/on-after-edit.md +143 -0
  38. doubled_graph-1.0.0/prompts/maintenance/on-before-edit.md +105 -0
  39. doubled_graph-1.0.0/prompts/maintenance/on-drift-detected.md +168 -0
  40. doubled_graph-1.0.0/prompts/maintenance/on-user-manual-edit.md +104 -0
  41. doubled_graph-1.0.0/prompts/migrate-existing-project/00-entry-prompt.md +46 -0
  42. doubled_graph-1.0.0/prompts/migrate-existing-project/01-discover.md +160 -0
  43. doubled_graph-1.0.0/prompts/migrate-existing-project/02-reconstruct-intent.md +152 -0
  44. doubled_graph-1.0.0/prompts/migrate-existing-project/03-draft-plan.md +160 -0
  45. doubled_graph-1.0.0/prompts/migrate-existing-project/04-markup-codebase.md +160 -0
  46. doubled_graph-1.0.0/prompts/migrate-existing-project/05-verification-and-logs.md +135 -0
  47. doubled_graph-1.0.0/prompts/migrate-existing-project/06-validation-gates.md +126 -0
  48. doubled_graph-1.0.0/prompts/new-project/00-entry-prompt.md +47 -0
  49. doubled_graph-1.0.0/prompts/new-project/01-intent-interview.md +102 -0
  50. doubled_graph-1.0.0/prompts/new-project/02-requirements.md +98 -0
  51. doubled_graph-1.0.0/prompts/new-project/03-technology.md +54 -0
  52. doubled_graph-1.0.0/prompts/new-project/04-development-plan.md +179 -0
  53. doubled_graph-1.0.0/prompts/new-project/05-verification-plan.md +124 -0
  54. doubled_graph-1.0.0/prompts/new-project/06-generate.md +113 -0
  55. doubled_graph-1.0.0/prompts/new-project/07-post-init-sync.md +116 -0
  56. doubled_graph-1.0.0/pyproject.toml +85 -0
  57. doubled_graph-1.0.0/src/doubled_graph/__init__.py +10 -0
  58. doubled_graph-1.0.0/src/doubled_graph/__main__.py +6 -0
  59. doubled_graph-1.0.0/src/doubled_graph/cli.py +574 -0
  60. doubled_graph-1.0.0/src/doubled_graph/config.py +44 -0
  61. doubled_graph-1.0.0/src/doubled_graph/graphs/__init__.py +0 -0
  62. doubled_graph-1.0.0/src/doubled_graph/graphs/crossref.py +31 -0
  63. doubled_graph-1.0.0/src/doubled_graph/graphs/declared.py +117 -0
  64. doubled_graph-1.0.0/src/doubled_graph/hooks_installer.py +151 -0
  65. doubled_graph-1.0.0/src/doubled_graph/integrations/__init__.py +0 -0
  66. doubled_graph-1.0.0/src/doubled_graph/integrations/cgc.py +332 -0
  67. doubled_graph-1.0.0/src/doubled_graph/integrations/grace_cli.py +147 -0
  68. doubled_graph-1.0.0/src/doubled_graph/policy/__init__.py +0 -0
  69. doubled_graph-1.0.0/src/doubled_graph/policy/phase.py +125 -0
  70. doubled_graph-1.0.0/src/doubled_graph/server.py +323 -0
  71. doubled_graph-1.0.0/src/doubled_graph/setup.py +257 -0
  72. doubled_graph-1.0.0/src/doubled_graph/storage/__init__.py +0 -0
  73. doubled_graph-1.0.0/src/doubled_graph/storage/paths.py +39 -0
  74. doubled_graph-1.0.0/src/doubled_graph/tools/__init__.py +0 -0
  75. doubled_graph-1.0.0/src/doubled_graph/tools/_meta.py +29 -0
  76. doubled_graph-1.0.0/src/doubled_graph/tools/analyze.py +158 -0
  77. doubled_graph-1.0.0/src/doubled_graph/tools/context.py +249 -0
  78. doubled_graph-1.0.0/src/doubled_graph/tools/detect_changes.py +279 -0
  79. doubled_graph-1.0.0/src/doubled_graph/tools/impact.py +293 -0
  80. doubled_graph-1.0.0/tests/__init__.py +0 -0
  81. doubled_graph-1.0.0/tests/test_smoke.py +583 -0
  82. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/build-1.4.3.dist-info/licenses/LICENSE +20 -0
  83. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/certifi-2026.2.25.dist-info/licenses/LICENSE +20 -0
  84. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/charset_normalizer-3.4.7.dist-info/licenses/LICENSE +21 -0
  85. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/id-1.6.1.dist-info/licenses/LICENSE +202 -0
  86. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/jaraco.classes-3.4.0.dist-info/LICENSE +17 -0
  87. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/jaraco_context-6.1.2.dist-info/licenses/LICENSE +18 -0
  88. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/jaraco_functools-4.4.0.dist-info/licenses/LICENSE +18 -0
  89. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/keyring-25.7.0.dist-info/licenses/LICENSE +18 -0
  90. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/markdown_it_py-4.0.0.dist-info/licenses/LICENSE +21 -0
  91. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/mdurl-0.1.2.dist-info/LICENSE +46 -0
  92. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/more_itertools-11.0.2.dist-info/licenses/LICENSE +19 -0
  93. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/nh3-0.3.4.dist-info/licenses/LICENSE +21 -0
  94. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/packaging-26.1.dist-info/licenses/LICENSE +3 -0
  95. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/certifi/LICENSE +20 -0
  96. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/distro/LICENSE +202 -0
  97. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/packaging/LICENSE +3 -0
  98. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/LICENSE +17 -0
  99. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/platformdirs/LICENSE +21 -0
  100. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/pygments/LICENSE +25 -0
  101. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/LICENSE +21 -0
  102. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/requests/LICENSE +175 -0
  103. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/resolvelib/LICENSE +13 -0
  104. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/rich/LICENSE +19 -0
  105. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/tomli/LICENSE +21 -0
  106. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/tomli_w/LICENSE +21 -0
  107. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip/_vendor/truststore/LICENSE +21 -0
  108. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/certifi/LICENSE +20 -0
  109. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/distro/LICENSE +202 -0
  110. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/packaging/LICENSE +3 -0
  111. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/pkg_resources/LICENSE +17 -0
  112. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/platformdirs/LICENSE +21 -0
  113. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/pygments/LICENSE +25 -0
  114. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/pyproject_hooks/LICENSE +21 -0
  115. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/requests/LICENSE +175 -0
  116. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/resolvelib/LICENSE +13 -0
  117. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/rich/LICENSE +19 -0
  118. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/tomli/LICENSE +21 -0
  119. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/tomli_w/LICENSE +21 -0
  120. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pip-26.0.dist-info/licenses/src/pip/_vendor/truststore/LICENSE +21 -0
  121. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pygments-2.20.0.dist-info/licenses/LICENSE +25 -0
  122. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/pyproject_hooks-1.2.0.dist-info/LICENSE +21 -0
  123. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/readme_renderer-44.0.dist-info/LICENSE +174 -0
  124. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/requests-2.33.1.dist-info/licenses/LICENSE +175 -0
  125. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/requests_toolbelt-1.0.0.dist-info/LICENSE +13 -0
  126. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/rfc3986-2.0.0.dist-info/LICENSE +13 -0
  127. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/rich-15.0.0.dist-info/licenses/LICENSE +19 -0
  128. doubled_graph-1.0.0/venv/lib/python3.12/site-packages/twine-6.2.0.dist-info/licenses/LICENSE +174 -0
@@ -0,0 +1,2 @@
1
+ .gitnexus
2
+ extra/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 doubled-graph methodology authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: doubled-graph
3
+ Version: 1.0.0
4
+ Summary: MCP facade over CodeGraphContext + grace-marketplace: impact, context, drift-detect for LLM-driven codebases.
5
+ Project-URL: Homepage, https://github.com/osovv/doubled-graph
6
+ Project-URL: Repository, https://github.com/osovv/doubled-graph
7
+ Project-URL: Issues, https://github.com/osovv/doubled-graph/issues
8
+ Project-URL: Documentation, https://github.com/osovv/doubled-graph/blob/main/SPEC.md
9
+ Author: doubled-graph methodology authors
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: ast,claude,codebase,continue,cursor,graph,llm,mcp
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development
22
+ Classifier: Topic :: Software Development :: Code Generators
23
+ Classifier: Topic :: Software Development :: Documentation
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: anyio>=4.0
26
+ Requires-Dist: codegraphcontext>=0.1
27
+ Requires-Dist: mcp>=0.9.0
28
+ Requires-Dist: pydantic>=2.6
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
31
+ Requires-Dist: pytest>=8.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.5; extra == 'dev'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # doubled-graph
36
+
37
+ **MCP facade for LLM-driven codebases.** Four tools — `analyze`, `impact`, `context`, `detect_changes` — that combine a computed AST graph (via [CodeGraphContext](https://github.com/Shashankss1205/CodeGraphContext)) with a declared methodology graph (via [grace-marketplace](https://github.com/osovv/grace)) so your agent can reason about blast radius and drift before it edits code.
38
+
39
+ License: MIT.
40
+
41
+ ---
42
+
43
+ ## What it does
44
+
45
+ Large codebases break LLM agents two ways:
46
+ 1. They edit without knowing who calls the function → regression.
47
+ 2. They edit without knowing the declared contract → silent drift.
48
+
49
+ `doubled-graph` gives the agent one gateway over two graphs:
50
+
51
+ | Graph | Source | Answers |
52
+ |-------|--------|---------|
53
+ | **Computed** | CodeGraphContext (tree-sitter AST → graph DB) | who calls X, what X calls, where X is defined |
54
+ | **Declared** | grace-marketplace artifacts (`docs/*.xml`) | which module owns X, its contract, its verification entries |
55
+
56
+ Four MCP tools expose the cross-reference:
57
+
58
+ | Tool | Use | When |
59
+ |------|-----|------|
60
+ | `analyze` | build/update the computed graph | after commit, on CI, at onboarding |
61
+ | `impact` | blast radius + risk for a symbol | **before** editing |
62
+ | `context` | 360° view (symbol + contract + module + callers/callees) | before non-trivial edits |
63
+ | `detect_changes` | drift between code and artifacts | **before** commit |
64
+
65
+ Plus 11 gateway tools that thin-wrap grace-marketplace operations (`lint`, `module_show`, `file_show`, `refresh`, skills like `init`/`plan`/`execute`/`fix`/...) so your agent talks to a single namespace.
66
+
67
+ ---
68
+
69
+ ## Install
70
+
71
+ ```bash
72
+ pip install doubled-graph
73
+ ```
74
+
75
+ Requires Python 3.11+. On first use, CGC will pick an embedded graph backend (FalkorDB Lite on Linux, KuzuDB on Windows; or Neo4j if configured via `NEO4J_URI`).
76
+
77
+ ---
78
+
79
+ ## Onboard a repo
80
+
81
+ One command sets everything up:
82
+
83
+ ```bash
84
+ doubled-graph setup
85
+ ```
86
+
87
+ That will:
88
+ 1. install `@osovv/grace-cli` globally via `bun add -g` (skipped if Bun is not present),
89
+ 2. copy bundled `prompts/` and `methodology/` into the repo,
90
+ 3. register doubled-graph as an MCP server for the detected IDE (Claude Code / Cursor / Continue),
91
+ 4. install a `git post-commit` hook that keeps the computed graph fresh,
92
+ 5. run the first full `analyze` pass.
93
+
94
+ Preview what it will do without touching anything:
95
+
96
+ ```bash
97
+ doubled-graph setup --dry-run
98
+ ```
99
+
100
+ Pick the IDE explicitly if auto-detect misses:
101
+
102
+ ```bash
103
+ doubled-graph setup --ide claude-code
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Day-to-day CLI
109
+
110
+ ```bash
111
+ # Compute or refresh the graph (hooks call this automatically).
112
+ doubled-graph analyze --mode auto
113
+
114
+ # Blast radius for a symbol — run BEFORE editing.
115
+ doubled-graph impact validateUser
116
+ doubled-graph impact validateUser --direction both --depth 3
117
+
118
+ # 360° view — contract + module + callers + callees.
119
+ doubled-graph context validateUser
120
+
121
+ # Drift between code and declared artifacts — run BEFORE committing.
122
+ doubled-graph detect-changes --scope staged
123
+
124
+ # Current methodology phase (migration | post_migration).
125
+ doubled-graph phase get
126
+ doubled-graph phase set post_migration --reason "migration complete"
127
+
128
+ # Serve as an MCP server over stdio (IDE calls this).
129
+ doubled-graph serve
130
+ ```
131
+
132
+ ---
133
+
134
+ ## MCP usage (Claude Code example)
135
+
136
+ `.mcp.json` at the repo root:
137
+
138
+ ```json
139
+ {
140
+ "mcpServers": {
141
+ "doubled-graph": {
142
+ "command": "doubled-graph",
143
+ "args": ["serve"]
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ Then in your agent system prompt / `CLAUDE.md`:
150
+
151
+ > - **MUST run `impact` before editing any symbol.**
152
+ > - **MUST run `detect_changes` before committing.**
153
+
154
+ ---
155
+
156
+ ## The four core tools — input/output shape
157
+
158
+ Full schemas in [TOOLS.md](TOOLS.md). Summary:
159
+
160
+ ```jsonc
161
+ // impact
162
+ { "target": "validateUser", "direction": "upstream", "depth": 3 }
163
+ → {
164
+ "target_resolved": { "name": "...", "file": "...", "module_id": "M-AUTH-VALIDATE" },
165
+ "direct": [ { "name": "...", "file": "...", "depth": 1 } ],
166
+ "transitive": [ ... ],
167
+ "affected_modules": [ ... ],
168
+ "affected_verification": [ ... ],
169
+ "risk": { "level": "HIGH", "reasons": [ ... ] },
170
+ "meta": { "phase": "post_migration", ... }
171
+ }
172
+ ```
173
+
174
+ Risk levels: `NONE`, `LOW`, `MEDIUM`, `HIGH`, `CRITICAL`. Any `HIGH`/`CRITICAL` result means the methodology expects the agent to stop and surface the radius before editing.
175
+
176
+ ---
177
+
178
+ ## Layout
179
+
180
+ - [SPEC.md](SPEC.md) — architecture, storage layout (`.doubled-graph/`), wire format
181
+ - [TOOLS.md](TOOLS.md) — detailed tool spec (schemas, CGC mapping, use-cases)
182
+ - [HOOKS.md](HOOKS.md) — git + Claude Code hook contracts
183
+ - [CHANGELOG.md](CHANGELOG.md) — release notes
184
+
185
+ ---
186
+
187
+ ## Phase switch
188
+
189
+ The methodology has two modes — `migration` (code is ground-truth) and `post_migration` (artifacts are ground-truth). doubled-graph reads the phase from an HTML-comment block in `AGENTS.md`:
190
+
191
+ ```markdown
192
+ <!-- doubled-graph:phase:start -->
193
+ ## doubled-graph phase
194
+ phase: post_migration
195
+ <!-- doubled-graph:phase:end -->
196
+ ```
197
+
198
+ Switch atomically:
199
+
200
+ ```bash
201
+ doubled-graph phase set migration --reason "starting migration of legacy module"
202
+ ```
203
+
204
+ `impact` risk rules and `detect_changes` resolution hints branch on this phase.
205
+
206
+ ---
207
+
208
+ ## Project status
209
+
210
+ - Smoke-tested (29/29 passing).
211
+ - Real CGC integration wired; stubs removed.
212
+ - Ships with bundled `prompts/` and `methodology/` assets (loaded via `importlib.resources`).
213
+
214
+ Upstream versions pinned: `codegraphcontext >= 0.1`, `mcp >= 0.9`.
215
+
216
+ ---
217
+
218
+ ## License
219
+
220
+ MIT — see [LICENSE](LICENSE).
221
+
222
+ Upstream components retain their own licenses (CodeGraphContext: MIT; grace-marketplace: MIT). GitNexus is **not** a dependency (PolyForm NC incompatibility).
@@ -0,0 +1,188 @@
1
+ # doubled-graph
2
+
3
+ **MCP facade for LLM-driven codebases.** Four tools — `analyze`, `impact`, `context`, `detect_changes` — that combine a computed AST graph (via [CodeGraphContext](https://github.com/Shashankss1205/CodeGraphContext)) with a declared methodology graph (via [grace-marketplace](https://github.com/osovv/grace)) so your agent can reason about blast radius and drift before it edits code.
4
+
5
+ License: MIT.
6
+
7
+ ---
8
+
9
+ ## What it does
10
+
11
+ Large codebases break LLM agents two ways:
12
+ 1. They edit without knowing who calls the function → regression.
13
+ 2. They edit without knowing the declared contract → silent drift.
14
+
15
+ `doubled-graph` gives the agent one gateway over two graphs:
16
+
17
+ | Graph | Source | Answers |
18
+ |-------|--------|---------|
19
+ | **Computed** | CodeGraphContext (tree-sitter AST → graph DB) | who calls X, what X calls, where X is defined |
20
+ | **Declared** | grace-marketplace artifacts (`docs/*.xml`) | which module owns X, its contract, its verification entries |
21
+
22
+ Four MCP tools expose the cross-reference:
23
+
24
+ | Tool | Use | When |
25
+ |------|-----|------|
26
+ | `analyze` | build/update the computed graph | after commit, on CI, at onboarding |
27
+ | `impact` | blast radius + risk for a symbol | **before** editing |
28
+ | `context` | 360° view (symbol + contract + module + callers/callees) | before non-trivial edits |
29
+ | `detect_changes` | drift between code and artifacts | **before** commit |
30
+
31
+ Plus 11 gateway tools that thin-wrap grace-marketplace operations (`lint`, `module_show`, `file_show`, `refresh`, skills like `init`/`plan`/`execute`/`fix`/...) so your agent talks to a single namespace.
32
+
33
+ ---
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install doubled-graph
39
+ ```
40
+
41
+ Requires Python 3.11+. On first use, CGC will pick an embedded graph backend (FalkorDB Lite on Linux, KuzuDB on Windows; or Neo4j if configured via `NEO4J_URI`).
42
+
43
+ ---
44
+
45
+ ## Onboard a repo
46
+
47
+ One command sets everything up:
48
+
49
+ ```bash
50
+ doubled-graph setup
51
+ ```
52
+
53
+ That will:
54
+ 1. install `@osovv/grace-cli` globally via `bun add -g` (skipped if Bun is not present),
55
+ 2. copy bundled `prompts/` and `methodology/` into the repo,
56
+ 3. register doubled-graph as an MCP server for the detected IDE (Claude Code / Cursor / Continue),
57
+ 4. install a `git post-commit` hook that keeps the computed graph fresh,
58
+ 5. run the first full `analyze` pass.
59
+
60
+ Preview what it will do without touching anything:
61
+
62
+ ```bash
63
+ doubled-graph setup --dry-run
64
+ ```
65
+
66
+ Pick the IDE explicitly if auto-detect misses:
67
+
68
+ ```bash
69
+ doubled-graph setup --ide claude-code
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Day-to-day CLI
75
+
76
+ ```bash
77
+ # Compute or refresh the graph (hooks call this automatically).
78
+ doubled-graph analyze --mode auto
79
+
80
+ # Blast radius for a symbol — run BEFORE editing.
81
+ doubled-graph impact validateUser
82
+ doubled-graph impact validateUser --direction both --depth 3
83
+
84
+ # 360° view — contract + module + callers + callees.
85
+ doubled-graph context validateUser
86
+
87
+ # Drift between code and declared artifacts — run BEFORE committing.
88
+ doubled-graph detect-changes --scope staged
89
+
90
+ # Current methodology phase (migration | post_migration).
91
+ doubled-graph phase get
92
+ doubled-graph phase set post_migration --reason "migration complete"
93
+
94
+ # Serve as an MCP server over stdio (IDE calls this).
95
+ doubled-graph serve
96
+ ```
97
+
98
+ ---
99
+
100
+ ## MCP usage (Claude Code example)
101
+
102
+ `.mcp.json` at the repo root:
103
+
104
+ ```json
105
+ {
106
+ "mcpServers": {
107
+ "doubled-graph": {
108
+ "command": "doubled-graph",
109
+ "args": ["serve"]
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ Then in your agent system prompt / `CLAUDE.md`:
116
+
117
+ > - **MUST run `impact` before editing any symbol.**
118
+ > - **MUST run `detect_changes` before committing.**
119
+
120
+ ---
121
+
122
+ ## The four core tools — input/output shape
123
+
124
+ Full schemas in [TOOLS.md](TOOLS.md). Summary:
125
+
126
+ ```jsonc
127
+ // impact
128
+ { "target": "validateUser", "direction": "upstream", "depth": 3 }
129
+ → {
130
+ "target_resolved": { "name": "...", "file": "...", "module_id": "M-AUTH-VALIDATE" },
131
+ "direct": [ { "name": "...", "file": "...", "depth": 1 } ],
132
+ "transitive": [ ... ],
133
+ "affected_modules": [ ... ],
134
+ "affected_verification": [ ... ],
135
+ "risk": { "level": "HIGH", "reasons": [ ... ] },
136
+ "meta": { "phase": "post_migration", ... }
137
+ }
138
+ ```
139
+
140
+ Risk levels: `NONE`, `LOW`, `MEDIUM`, `HIGH`, `CRITICAL`. Any `HIGH`/`CRITICAL` result means the methodology expects the agent to stop and surface the radius before editing.
141
+
142
+ ---
143
+
144
+ ## Layout
145
+
146
+ - [SPEC.md](SPEC.md) — architecture, storage layout (`.doubled-graph/`), wire format
147
+ - [TOOLS.md](TOOLS.md) — detailed tool spec (schemas, CGC mapping, use-cases)
148
+ - [HOOKS.md](HOOKS.md) — git + Claude Code hook contracts
149
+ - [CHANGELOG.md](CHANGELOG.md) — release notes
150
+
151
+ ---
152
+
153
+ ## Phase switch
154
+
155
+ The methodology has two modes — `migration` (code is ground-truth) and `post_migration` (artifacts are ground-truth). doubled-graph reads the phase from an HTML-comment block in `AGENTS.md`:
156
+
157
+ ```markdown
158
+ <!-- doubled-graph:phase:start -->
159
+ ## doubled-graph phase
160
+ phase: post_migration
161
+ <!-- doubled-graph:phase:end -->
162
+ ```
163
+
164
+ Switch atomically:
165
+
166
+ ```bash
167
+ doubled-graph phase set migration --reason "starting migration of legacy module"
168
+ ```
169
+
170
+ `impact` risk rules and `detect_changes` resolution hints branch on this phase.
171
+
172
+ ---
173
+
174
+ ## Project status
175
+
176
+ - Smoke-tested (29/29 passing).
177
+ - Real CGC integration wired; stubs removed.
178
+ - Ships with bundled `prompts/` and `methodology/` assets (loaded via `importlib.resources`).
179
+
180
+ Upstream versions pinned: `codegraphcontext >= 0.1`, `mcp >= 0.9`.
181
+
182
+ ---
183
+
184
+ ## License
185
+
186
+ MIT — see [LICENSE](LICENSE).
187
+
188
+ Upstream components retain their own licenses (CodeGraphContext: MIT; grace-marketplace: MIT). GitNexus is **not** a dependency (PolyForm NC incompatibility).
@@ -0,0 +1,50 @@
1
+ # Changelog
2
+
3
+ All notable changes to doubled-graph. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning: [SemVer](https://semver.org/).
4
+
5
+ ## [0.1.0] — 2026-04-18
6
+
7
+ Initial public release.
8
+
9
+ ### Added
10
+ - `doubled-graph setup` — single-shot onboarding: installs `@osovv/grace-cli`,
11
+ copies bundled prompts + methodology into the repo, registers MCP for the
12
+ detected IDE (Claude Code / Cursor / Continue), installs the git post-commit
13
+ hook, runs the first full analyze. Supports `--dry-run` and `--ide` override.
14
+ - Real CGC integration in `integrations/cgc.py`:
15
+ - `analyze_full`, `analyze_incremental` wired to `GraphBuilder`
16
+ (`add_repository_to_graph` / `delete_file_from_graph` / `parse_file` /
17
+ `link_function_calls` / `link_inheritance`)
18
+ - `find_callers`, `find_callees` wired to
19
+ `CodeFinder.analyze_code_relationships(find_all_callers / find_all_callees)`
20
+ - `find_symbol` wired to `CodeFinder.find_by_function_name`
21
+ - `symbols_in_file` via Cypher fallback
22
+ - `impact` now returns populated `direct` / `transitive` / `affected_modules` /
23
+ `affected_verification`. Risk classification uses real caller counts +
24
+ phase + verification-touch.
25
+ - `context` fully implemented — joins CGC symbol, declared module, and
26
+ extracts `MODULE_CONTRACT` / `CONTRACT:fn` blocks from source.
27
+ - `detect_changes` fully implemented — `code_without_module`,
28
+ `module_without_code`, `stale_crosslinks`, `missing_verification`,
29
+ `markup_missing`. Resolution hint branches on `migration` vs
30
+ `post_migration`.
31
+ - `analyze` now persists `.doubled-graph/cache/code-fingerprint.json` on
32
+ every successful run (enables `mode=auto` incremental detection).
33
+ - CLI subcommands `impact`, `context`, `detect-changes` are no longer stubs —
34
+ they dispatch into the tools package.
35
+ - Bundled `prompts/` and `methodology/` shipped inside the wheel via
36
+ `hatch force-include`; loaded with `importlib.resources` by `setup.py`.
37
+ - 29 smoke tests covering CGC stubs, impact risk escalation, context joins,
38
+ drift detection, CLI wiring, setup dry-run + MCP registration.
39
+
40
+ ### Changed
41
+ - Bumped version 0.1.0.dev0 → 0.1.0.
42
+ - pyproject: added classifiers, keywords, URLs, `anyio` runtime dep, sdist
43
+ manifest.
44
+ - `README.md` replaces `SPEC.md` as the PyPI long description.
45
+
46
+ ### Removed
47
+ - `NotImplementedError` stubs in `integrations/cgc.py`.
48
+ - `NOT_IMPLEMENTED_MVP` stub classes for `context` and `detect_changes`.
49
+ - CLI `NOT_IMPLEMENTED_MVP` fallback for `impact` / `context` /
50
+ `detect-changes`.