promptify-cmax 0.1.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.
@@ -0,0 +1,34 @@
1
+ # Build / packaging
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.pyc
9
+ *.pyo
10
+ .pytest_cache/
11
+ .benchmarks/
12
+ .coverage
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+
16
+ # Virtual envs
17
+ .venv/
18
+ venv/
19
+ env/
20
+
21
+ # Index artifact (project-local)
22
+ .promptify/
23
+ .dca/
24
+
25
+ # Internal — outreach playbook, design-partner tracking, never push public
26
+ OUTREACH.md
27
+ PARTNERS.md
28
+ .private/
29
+
30
+ # OS / editor
31
+ .DS_Store
32
+ .idea/
33
+ .vscode/
34
+ *.swp
@@ -0,0 +1,56 @@
1
+ # Contributing to promptify-cmax
2
+
3
+ Thanks for your interest. This project is Apache-2.0 licensed and developed by [Promptify LLC](https://promptify.com).
4
+
5
+ ## Quick start
6
+
7
+ ```bash
8
+ git clone https://github.com/promptify-com/promptify-cmax
9
+ cd promptify-cmax
10
+ uv sync
11
+ uv run pytest
12
+ ```
13
+
14
+ All 33 tests should pass.
15
+
16
+ ## Development workflow
17
+
18
+ - **Tests-first.** Every behavior change ships with a failing test that turns green. Bug fixes ship with a regression test that captures the bug.
19
+ - **Small PRs.** One concern per PR; rebase rather than merge-commit.
20
+ - **Style.** No formatter is enforced yet; match what's already there. Type hints on public functions.
21
+ - **Conventional Commits** for the subject line: `feat:`, `fix:`, `refactor:`, `test:`, `docs:`, `chore:`.
22
+
23
+ ## DCO sign-off (after the first external PR)
24
+
25
+ Once external contributions start landing, every commit will need a `Signed-off-by:` line per the [Developer Certificate of Origin](https://developercertificate.org/). Add it with:
26
+
27
+ ```bash
28
+ git commit -s -m "your message"
29
+ ```
30
+
31
+ Until then, this isn't required — sign-off enforcement will go on with the first external PR, not before.
32
+
33
+ ## Reporting issues
34
+
35
+ Please include:
36
+ - The query or task that produced the unexpected result
37
+ - The relevant slice of `promptify-cmax query --top-k 10` output
38
+ - Python version and OS
39
+ - Project size (rough function count from `promptify-cmax index`)
40
+
41
+ ## What's in scope
42
+
43
+ - Bug fixes in the call-graph builder, FQN resolution, query identifier extraction
44
+ - New language support (Go, Rust, Java, C# are open ground; mention before starting)
45
+ - Performance work on large repos (>10k files)
46
+ - MCP protocol compliance fixes
47
+
48
+ ## What's not in scope (yet)
49
+
50
+ - Hosted-tier features (multi-repo index, analytics, editor extensions) — those live in the Promptify SaaS layer, not this package
51
+ - Vendoring tree-sitter grammars (we depend on the official PyPI bindings)
52
+ - Telemetry of any kind
53
+
54
+ ## License
55
+
56
+ By contributing, you agree your contributions are licensed under Apache-2.0, the same license as the project.
@@ -0,0 +1,68 @@
1
+ # Design-partner feedback
2
+
3
+ Thanks for trying `promptify-cmax` early. We're sending it to ~5 people before any public launch; you're one of them. Honest answers — including "this didn't help me" — are the most valuable thing you can give us.
4
+
5
+ The bar for v0.1 is one binary question, asked at the end of two weeks of casual use:
6
+
7
+ > **After two weeks, would you install promptify-cmax on every new repo by default?**
8
+
9
+ That's the wedge-survives-or-doesn't question. Everything below helps us understand *why* your answer is yes or no.
10
+
11
+ ## How to send feedback
12
+
13
+ Reply by email to **support@promptify.com** with the questionnaire below filled in. No call required. If you'd rather hop on a 30-minute Zoom to walk through it, mention that and we'll book one. Either path is fine; we want the answers either way.
14
+
15
+ ## When to send
16
+
17
+ End of week 2 of trying it (or sooner if you bounce off it earlier — we want the bounce-off data too). Don't worry about polish; bullet points beat prose.
18
+
19
+ ---
20
+
21
+ ## Questionnaire (7 questions, 10 minutes)
22
+
23
+ ### 1. Setup friction
24
+
25
+ How long did install + first successful query take? What broke, what was confusing, what did you have to look up that the QUICKSTART didn't cover?
26
+
27
+ ### 2. The binary question
28
+
29
+ After ~two weeks of using it casually, would you install promptify-cmax on every new repo by default?
30
+
31
+ - [ ] Yes — explain in one sentence what won you over
32
+ - [ ] No — explain in one sentence what's missing or wrong
33
+ - [ ] Maybe — explain in one sentence what would make it a clear yes
34
+
35
+ ### 3. Wins (concrete)
36
+
37
+ Describe one specific case where the structural-context tool found the right file(s) and saved your AI agent a long detour. Include the task you asked, the files it returned, what you would have gotten with `grep` instead. Anything resembling a token count, latency feel, or "the agent got it on the first try" is gold.
38
+
39
+ ### 4. Losses (concrete)
40
+
41
+ Describe one specific case where the tool failed — wrong files, missed the obvious file, was slow, hallucinated, didn't get installed in the agent at all. Same format: what you asked, what you got, what should have happened.
42
+
43
+ ### 5. The agent's behavior change
44
+
45
+ Did your AI agent (Claude Code / Cursor / Continue) actually *use* the `structural_context` tool when it had access? How did you tell? If it didn't use it, why do you think — was the tool description wrong, did the agent prefer grep, were the result counts overwhelming?
46
+
47
+ ### 6. What would make this Pro-tier worth $X to you
48
+
49
+ If this were a paid product with a hosted-indexing tier (no laptop indexing of monorepos, multi-repo BFS, editor extensions, analytics), what would the trigger be for you to upgrade? Team size? Repo size? A specific feature? A specific price point?
50
+
51
+ ### 7. Anything else
52
+
53
+ Bugs, surprises, "I wish it did Y," people you think we should also send it to, vibes — whatever didn't fit above.
54
+
55
+ ---
56
+
57
+ ## What we won't do with your feedback
58
+
59
+ - Quote you publicly without explicit permission
60
+ - Add you to a marketing list
61
+ - Auto-charge you when we eventually launch (this trial is free; no payment method required)
62
+
63
+ ## What we will do
64
+
65
+ - Read every word
66
+ - Reply within 48 hours with what we're going to fix and what we're not
67
+ - Tell you which of your asks made it into v0.2 and which didn't
68
+ - Send you a free Pro tier when we launch, as thanks
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Promptify LLC
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ promptify-cmax
2
+ Copyright 2026 Promptify LLC
3
+
4
+ This product includes software developed at Promptify LLC (https://promptify.com).
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: promptify-cmax
3
+ Version: 0.1.0
4
+ Summary: Call-graph-aware code context retrieval for AI coding agents (MCP server + CLI)
5
+ Project-URL: Homepage, https://promptify.com
6
+ Project-URL: Repository, https://github.com/promptify-com/promptify-cmax
7
+ Project-URL: Issues, https://github.com/promptify-com/promptify-cmax/issues
8
+ Author-email: Promptify LLC <support@promptify.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai-agents,claude-code,code-context,mcp,structural-retrieval
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: mcp>=1.0
19
+ Requires-Dist: tree-sitter-python>=0.23
20
+ Requires-Dist: tree-sitter-typescript>=0.23
21
+ Requires-Dist: tree-sitter>=0.23
22
+ Requires-Dist: watchdog>=4.0
23
+ Description-Content-Type: text/markdown
24
+
25
+ # promptify-cmax
26
+
27
+ **Call-graph-aware code context retrieval for AI coding agents.**
28
+
29
+ When you ask Claude Code, Cursor, or any agent to fix a function, the agent typically searches the codebase with `grep` and pulls back every file that *mentions* the symbol — including specs, plans, ADRs, and unrelated definitions that happen to share a name. The model pays attention tax on all of it.
30
+
31
+ `promptify-cmax` returns the files most likely to need editing, ranked by **distance in the call graph** rather than surface name match. It exposes both an [MCP](https://modelcontextprotocol.io/) server (drop-in for Claude Code, Cursor, etc.) and a CLI.
32
+
33
+ ## Why
34
+
35
+ On a SWE-bench-derived smoke test (n=20), grep-based retrieval returned a median **142× more tokens** than the agent actually needed; structural retrieval returned the same target files at **49× lower token cost**. A reproducible benchmark at full scale (n≥200, SWE-bench-Verified) is in `bench/` — published numbers will live there.
36
+
37
+ ## Status
38
+
39
+ **Beta** — Python and TypeScript indexing, FQN-aware call resolution, MCP server. License: Apache-2.0.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ pip install promptify-cmax
45
+ ```
46
+
47
+ Then index your project and wire it into Claude Code / Cursor / Continue. Five-minute walkthrough with copy-pasteable MCP config snippets and troubleshooting: **[QUICKSTART.md](./QUICKSTART.md)**.
48
+
49
+ ## What it exposes
50
+
51
+ CLI:
52
+ - `promptify-cmax index --project-root <dir>` — build / incrementally update the structural index (one-time per repo, then automatic-on-change)
53
+ - `promptify-cmax query --project-root <dir> "<task>"` — return ranked files for a task description
54
+ - `promptify-cmax serve --project-root <dir>` — run as an MCP server over stdio
55
+
56
+ MCP tools (when run as `serve`):
57
+ - `structural_context(task, top_k=5)` — rank files by call-graph distance from the task's identifiers
58
+ - `reindex()` — rebuild after large code changes
59
+
60
+ ## How it works
61
+
62
+ 1. **Index** (one-time per repo, then incremental on file change): tree-sitter walks every Python and TypeScript source file, extracts function definitions, intra-function call sites, and module-level imports; persists everything to a single SQLite file at `.promptify/code-index.db`.
63
+ 2. **Resolve** (query time): given a natural-language task, extract candidate identifiers (backtick / CamelCase / snake_case / dotted paths) and intersect with the symbols actually in the index.
64
+ 3. **BFS** (query time): walk the call graph two hops in both directions; resolve each call edge to a *specific* `(file, function)` tuple via the caller's import bindings and same-file scope, so two functions named `helper` in different files never collapse into one node.
65
+ 4. **Rank**: group reached nodes by file, sort by `(distance ASC, affected-function-count DESC)`, return the top-k.
66
+
67
+ The discipline that makes this useful: **fully-qualified-name resolution**, not bare-name matching. A naive call graph treats every `def main(): ...` in the repo as the same node — typically 100+ collisions in any non-trivial Python project. We resolve through imports, so cross-file false positives don't enter the BFS frontier.
68
+
69
+ ## Roadmap
70
+
71
+ - [x] Python + TypeScript indexing (v0.1)
72
+ - [x] FQN-aware call resolution
73
+ - [x] MCP server, CLI
74
+ - [ ] Go, Rust, Java, C# (Pro)
75
+ - [ ] Hosted multi-repo index (Pro)
76
+ - [ ] PR-bot / CI integration (Team)
77
+ - [ ] VSCode + JetBrains extensions
78
+
79
+ ## Pro / Team
80
+
81
+ This package is the open-source core. [Promptify](https://promptify.com) sells a hosted layer for teams: multi-repo indexing that survives laptop churn, additional language support, token-savings analytics, editor extensions, SSO/SAML, and CI integration. Pricing and signup at [promptify.com/context](https://promptify.com/context).
82
+
83
+ ## Contributing
84
+
85
+ See [CONTRIBUTING.md](./CONTRIBUTING.md). Issues and PRs welcome.
86
+
87
+ ## License
88
+
89
+ Apache-2.0. Copyright © 2026 Promptify LLC. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
@@ -0,0 +1,137 @@
1
+ # Quickstart — promptify-cmax
2
+
3
+ Five-minute install. The goal: in your next Claude Code / Cursor session, watch your AI agent stop wasting tokens on irrelevant files.
4
+
5
+ ## Prerequisites
6
+
7
+ - Python 3.12 or newer (`python3 --version` to check)
8
+ - An MCP-aware AI coding tool: [Claude Code](https://claude.com/claude-code), [Cursor](https://cursor.com), or [Continue](https://continue.dev)
9
+
10
+ ## 1. Install
11
+
12
+ ```bash
13
+ pip install promptify-cmax
14
+ ```
15
+
16
+ If you don't have `pip` for Python 3.12 specifically:
17
+
18
+ ```bash
19
+ python3.12 -m pip install --user promptify-cmax
20
+ ```
21
+
22
+ Verify:
23
+
24
+ ```bash
25
+ promptify-cmax --help
26
+ ```
27
+
28
+ You should see three subcommands: `index`, `query`, `serve`.
29
+
30
+ ## 2. Build the index for your project
31
+
32
+ ```bash
33
+ cd /path/to/your/project
34
+ promptify-cmax index --project-root .
35
+ ```
36
+
37
+ Expected: a few seconds for a small project, ~10s per 1k files for larger ones. Index lands at `.promptify/code-index.db` (add to `.gitignore` — it's a build artefact).
38
+
39
+ Try a query to confirm it works:
40
+
41
+ ```bash
42
+ promptify-cmax query --project-root . "fix the <some_function_name> function" --top-k 5 --json-only
43
+ ```
44
+
45
+ You should see five files ranked by call-graph distance, not by surface keyword match.
46
+
47
+ ## 3. Wire it into your AI tool
48
+
49
+ ### Claude Code
50
+
51
+ Add to `.mcp.json` at the root of your project:
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "promptify-cmax": {
57
+ "command": "promptify-cmax",
58
+ "args": ["serve", "--project-root", "."]
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ Restart Claude Code (or run `/mcp` and reconnect). The agent now has access to two tools:
65
+ - `structural_context(task, top_k)` — rank files by call-graph distance
66
+ - `reindex()` — rebuild after large code changes
67
+
68
+ ### Cursor
69
+
70
+ Cursor's MCP support is in beta. Add to `~/.cursor/mcp.json`:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "promptify-cmax": {
76
+ "command": "promptify-cmax",
77
+ "args": ["serve", "--project-root", "/absolute/path/to/your/project"]
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ Cursor needs an absolute path — `.` won't work the way it does in Claude Code.
84
+
85
+ ### Continue
86
+
87
+ Add to `~/.continue/config.json` under `experimental.modelContextProtocolServers`:
88
+
89
+ ```json
90
+ {
91
+ "experimental": {
92
+ "modelContextProtocolServers": [
93
+ {
94
+ "transport": {
95
+ "type": "stdio",
96
+ "command": "promptify-cmax",
97
+ "args": ["serve", "--project-root", "."]
98
+ }
99
+ }
100
+ ]
101
+ }
102
+ }
103
+ ```
104
+
105
+ ## 4. Watch it work
106
+
107
+ Open a coding session and ask the agent something like:
108
+
109
+ > "Fix the `<some_function_name>` function — it's returning the wrong result on edge cases."
110
+
111
+ Watch the agent's tool calls. With `promptify-cmax` available, it should call `structural_context` instead of (or before) `Grep`. The result is a short list of files the agent actually needs to read, instead of every file that mentions the symbol.
112
+
113
+ ## Re-indexing
114
+
115
+ The MCP server includes a `reindex` tool the agent can call when it suspects the index is stale. You can also run it manually:
116
+
117
+ ```bash
118
+ promptify-cmax index --project-root .
119
+ ```
120
+
121
+ The index is incremental — files whose hash hasn't changed are skipped, so re-running is cheap.
122
+
123
+ ## Troubleshooting
124
+
125
+ **"command not found: promptify-cmax"** — your `pip install` location isn't on `$PATH`. Try `python3.12 -m promptify_cmax.cli` directly, or check `pip show promptify-cmax` to see where the script went.
126
+
127
+ **MCP server starts but tool calls return errors** — the index probably hasn't been built. Run `promptify-cmax index --project-root .` from the same directory the MCP server was started in.
128
+
129
+ **Indexing takes too long** — the indexer skips `.venv/`, `node_modules/`, dotfile dirs, and `__pycache__/`. If you have a build directory or generated code dir we don't recognize, add it to a `.promptify-ignore` (planned for v0.2; in the meantime, run from a smaller project root).
130
+
131
+ **Wrong files in results** — file an issue with: (1) the task you asked, (2) the result you got, (3) the result you expected. We tune the ranker on real cases, not synthetic ones.
132
+
133
+ ## What to expect
134
+
135
+ This is v0.1.0 — Beta. Python and TypeScript are well-supported; Go / Rust / Java / C# are on the roadmap. Bugs will exist. We're treating early users as design partners, not customers; see [FEEDBACK.md](./FEEDBACK.md) if you'd like to share what you find.
136
+
137
+ If you hit a wall, open a GitHub issue or email support@promptify.com.
@@ -0,0 +1,65 @@
1
+ # promptify-cmax
2
+
3
+ **Call-graph-aware code context retrieval for AI coding agents.**
4
+
5
+ When you ask Claude Code, Cursor, or any agent to fix a function, the agent typically searches the codebase with `grep` and pulls back every file that *mentions* the symbol — including specs, plans, ADRs, and unrelated definitions that happen to share a name. The model pays attention tax on all of it.
6
+
7
+ `promptify-cmax` returns the files most likely to need editing, ranked by **distance in the call graph** rather than surface name match. It exposes both an [MCP](https://modelcontextprotocol.io/) server (drop-in for Claude Code, Cursor, etc.) and a CLI.
8
+
9
+ ## Why
10
+
11
+ On a SWE-bench-derived smoke test (n=20), grep-based retrieval returned a median **142× more tokens** than the agent actually needed; structural retrieval returned the same target files at **49× lower token cost**. A reproducible benchmark at full scale (n≥200, SWE-bench-Verified) is in `bench/` — published numbers will live there.
12
+
13
+ ## Status
14
+
15
+ **Beta** — Python and TypeScript indexing, FQN-aware call resolution, MCP server. License: Apache-2.0.
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pip install promptify-cmax
21
+ ```
22
+
23
+ Then index your project and wire it into Claude Code / Cursor / Continue. Five-minute walkthrough with copy-pasteable MCP config snippets and troubleshooting: **[QUICKSTART.md](./QUICKSTART.md)**.
24
+
25
+ ## What it exposes
26
+
27
+ CLI:
28
+ - `promptify-cmax index --project-root <dir>` — build / incrementally update the structural index (one-time per repo, then automatic-on-change)
29
+ - `promptify-cmax query --project-root <dir> "<task>"` — return ranked files for a task description
30
+ - `promptify-cmax serve --project-root <dir>` — run as an MCP server over stdio
31
+
32
+ MCP tools (when run as `serve`):
33
+ - `structural_context(task, top_k=5)` — rank files by call-graph distance from the task's identifiers
34
+ - `reindex()` — rebuild after large code changes
35
+
36
+ ## How it works
37
+
38
+ 1. **Index** (one-time per repo, then incremental on file change): tree-sitter walks every Python and TypeScript source file, extracts function definitions, intra-function call sites, and module-level imports; persists everything to a single SQLite file at `.promptify/code-index.db`.
39
+ 2. **Resolve** (query time): given a natural-language task, extract candidate identifiers (backtick / CamelCase / snake_case / dotted paths) and intersect with the symbols actually in the index.
40
+ 3. **BFS** (query time): walk the call graph two hops in both directions; resolve each call edge to a *specific* `(file, function)` tuple via the caller's import bindings and same-file scope, so two functions named `helper` in different files never collapse into one node.
41
+ 4. **Rank**: group reached nodes by file, sort by `(distance ASC, affected-function-count DESC)`, return the top-k.
42
+
43
+ The discipline that makes this useful: **fully-qualified-name resolution**, not bare-name matching. A naive call graph treats every `def main(): ...` in the repo as the same node — typically 100+ collisions in any non-trivial Python project. We resolve through imports, so cross-file false positives don't enter the BFS frontier.
44
+
45
+ ## Roadmap
46
+
47
+ - [x] Python + TypeScript indexing (v0.1)
48
+ - [x] FQN-aware call resolution
49
+ - [x] MCP server, CLI
50
+ - [ ] Go, Rust, Java, C# (Pro)
51
+ - [ ] Hosted multi-repo index (Pro)
52
+ - [ ] PR-bot / CI integration (Team)
53
+ - [ ] VSCode + JetBrains extensions
54
+
55
+ ## Pro / Team
56
+
57
+ This package is the open-source core. [Promptify](https://promptify.com) sells a hosted layer for teams: multi-repo indexing that survives laptop churn, additional language support, token-savings analytics, editor extensions, SSO/SAML, and CI integration. Pricing and signup at [promptify.com/context](https://promptify.com/context).
58
+
59
+ ## Contributing
60
+
61
+ See [CONTRIBUTING.md](./CONTRIBUTING.md). Issues and PRs welcome.
62
+
63
+ ## License
64
+
65
+ Apache-2.0. Copyright © 2026 Promptify LLC. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).