codecortex-context-engine 0.1.0a1__py3-none-any.whl

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 (90) hide show
  1. codecortex/__init__.py +3 -0
  2. codecortex/architecture/__init__.py +23 -0
  3. codecortex/architecture/drift.py +182 -0
  4. codecortex/architecture/inference.py +160 -0
  5. codecortex/backends/__init__.py +35 -0
  6. codecortex/backends/base.py +38 -0
  7. codecortex/backends/context.py +118 -0
  8. codecortex/backends/contracts.py +65 -0
  9. codecortex/backends/factory.py +60 -0
  10. codecortex/backends/graph.py +107 -0
  11. codecortex/backends/manager.py +303 -0
  12. codecortex/backends/mcp_client.py +196 -0
  13. codecortex/backends/pool.py +128 -0
  14. codecortex/backends/spec.py +83 -0
  15. codecortex/backends/symbols.py +189 -0
  16. codecortex/benchmark.py +211 -0
  17. codecortex/cli.py +409 -0
  18. codecortex/config.py +27 -0
  19. codecortex/context/__init__.py +13 -0
  20. codecortex/context/budget.py +62 -0
  21. codecortex/context/integrated.py +60 -0
  22. codecortex/context/pipeline.py +223 -0
  23. codecortex/core/__init__.py +1 -0
  24. codecortex/core/contracts.py +45 -0
  25. codecortex/core/errors.py +17 -0
  26. codecortex/core/models.py +69 -0
  27. codecortex/dashboard.py +259 -0
  28. codecortex/editing.py +41 -0
  29. codecortex/engines/__init__.py +5 -0
  30. codecortex/engines/builtin/__init__.py +5 -0
  31. codecortex/engines/builtin/factory.py +26 -0
  32. codecortex/engines/builtin/memory.py +35 -0
  33. codecortex/engines/builtin/repository.py +73 -0
  34. codecortex/engines/builtin/symbols.py +89 -0
  35. codecortex/engines/builtin/validation.py +54 -0
  36. codecortex/engines/registry.py +26 -0
  37. codecortex/entrypoint.py +266 -0
  38. codecortex/evaluation/__init__.py +55 -0
  39. codecortex/evaluation/external.py +265 -0
  40. codecortex/evaluation/production.py +670 -0
  41. codecortex/evaluation/regression.py +188 -0
  42. codecortex/gateway.py +38 -0
  43. codecortex/git_intelligence.py +252 -0
  44. codecortex/indexing/__init__.py +6 -0
  45. codecortex/indexing/graph.py +78 -0
  46. codecortex/indexing/impact.py +127 -0
  47. codecortex/indexing/incremental.py +163 -0
  48. codecortex/indexing/incremental_graph.py +189 -0
  49. codecortex/indexing/indexer.py +172 -0
  50. codecortex/indexing/relationships.py +179 -0
  51. codecortex/indexing/resolution.py +88 -0
  52. codecortex/integrations/__init__.py +5 -0
  53. codecortex/integrations/agents.py +235 -0
  54. codecortex/interfaces/__init__.py +1 -0
  55. codecortex/interfaces/mcp_bridge.py +66 -0
  56. codecortex/languages/__init__.py +5 -0
  57. codecortex/languages/native.py +166 -0
  58. codecortex/languages/registry.py +232 -0
  59. codecortex/mcp/__init__.py +5 -0
  60. codecortex/mcp/extended.py +114 -0
  61. codecortex/mcp/server.py +473 -0
  62. codecortex/memory/__init__.py +11 -0
  63. codecortex/memory/json_store.py +52 -0
  64. codecortex/memory/knowledge.py +193 -0
  65. codecortex/memory/team_store.py +193 -0
  66. codecortex/orchestrator.py +153 -0
  67. codecortex/pr_intelligence.py +214 -0
  68. codecortex/retrieval/__init__.py +16 -0
  69. codecortex/retrieval/hybrid.py +67 -0
  70. codecortex/retrieval/index.py +135 -0
  71. codecortex/retrieval/providers.py +67 -0
  72. codecortex/retrieval/repository.py +94 -0
  73. codecortex/router/__init__.py +5 -0
  74. codecortex/router/router.py +79 -0
  75. codecortex/runtime.py +69 -0
  76. codecortex/setup.py +100 -0
  77. codecortex/symbols/__init__.py +5 -0
  78. codecortex/symbols/providers.py +192 -0
  79. codecortex/telemetry/__init__.py +5 -0
  80. codecortex/telemetry/collector.py +43 -0
  81. codecortex/tracing/__init__.py +9 -0
  82. codecortex/tracing/task_trace.py +235 -0
  83. codecortex/workspace/__init__.py +9 -0
  84. codecortex/workspace/federation.py +173 -0
  85. codecortex_context_engine-0.1.0a1.dist-info/METADATA +381 -0
  86. codecortex_context_engine-0.1.0a1.dist-info/RECORD +90 -0
  87. codecortex_context_engine-0.1.0a1.dist-info/WHEEL +4 -0
  88. codecortex_context_engine-0.1.0a1.dist-info/entry_points.txt +3 -0
  89. codecortex_context_engine-0.1.0a1.dist-info/licenses/LICENSE +201 -0
  90. codecortex_context_engine-0.1.0a1.dist-info/licenses/NOTICE +2 -0
@@ -0,0 +1,173 @@
1
+ """Federated multi-repository context and graph search."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from dataclasses import asdict, dataclass
7
+ from pathlib import Path
8
+
9
+ from codecortex.indexing.graph import GraphEdge, GraphNode, ProjectGraph
10
+ from codecortex.indexing.incremental_graph import IncrementalGraphIndex
11
+
12
+
13
+ @dataclass(frozen=True, slots=True)
14
+ class RepositoryDescriptor:
15
+ name: str
16
+ root: Path
17
+ weight: float = 1.0
18
+
19
+
20
+ @dataclass(frozen=True, slots=True)
21
+ class FederatedHit:
22
+ repository: str
23
+ node: GraphNode
24
+ score: float
25
+
26
+
27
+ class MultiRepositoryWorkspace:
28
+ VERSION = 1
29
+
30
+ def __init__(self, state_path: Path | None = None) -> None:
31
+ self.state_path = state_path
32
+ self._repositories: dict[str, RepositoryDescriptor] = {}
33
+ self._graphs: dict[str, ProjectGraph] = {}
34
+ if state_path and state_path.exists():
35
+ self.load()
36
+
37
+ @property
38
+ def repositories(self) -> tuple[RepositoryDescriptor, ...]:
39
+ return tuple(self._repositories[name] for name in sorted(self._repositories))
40
+
41
+ def add_repository(self, name: str, root: Path, weight: float = 1.0) -> None:
42
+ if not name or ":" in name:
43
+ raise ValueError("repository name must be non-empty and cannot contain ':'")
44
+ resolved = root.expanduser().resolve()
45
+ if not resolved.is_dir():
46
+ raise ValueError(f"repository root does not exist: {resolved}")
47
+ self._repositories[name] = RepositoryDescriptor(name, resolved, max(0.01, weight))
48
+ if self.state_path:
49
+ self.save()
50
+
51
+ def remove_repository(self, name: str) -> None:
52
+ self._repositories.pop(name, None)
53
+ self._graphs.pop(name, None)
54
+ if self.state_path:
55
+ self.save()
56
+
57
+ def refresh(self) -> dict[str, ProjectGraph]:
58
+ graphs: dict[str, ProjectGraph] = {}
59
+ for descriptor in self.repositories:
60
+ graph, _ = IncrementalGraphIndex(descriptor.root).refresh()
61
+ graphs[descriptor.name] = graph
62
+ self._graphs = graphs
63
+ return dict(graphs)
64
+
65
+ def search(self, query: str, limit: int = 40, per_repository: int = 20) -> list[FederatedHit]:
66
+ if not self._graphs:
67
+ self.refresh()
68
+ query_terms = {
69
+ term.lower().strip(".,:;()[]{}")
70
+ for term in query.split()
71
+ if len(term.strip()) > 2
72
+ }
73
+ hits: list[FederatedHit] = []
74
+ for descriptor in self.repositories:
75
+ graph = self._graphs.get(descriptor.name, ProjectGraph())
76
+ for node in graph.search(query, per_repository):
77
+ name = node.name.lower()
78
+ path = (node.path or "").lower()
79
+ lexical = sum(
80
+ 5 if term == name else 3 if term in name else 1 if term in path else 0
81
+ for term in query_terms
82
+ )
83
+ structural = 1.10 if node.kind not in {"file", "module", "reference"} else 1.0
84
+ score = lexical * descriptor.weight * structural
85
+ hits.append(FederatedHit(descriptor.name, node, score))
86
+ hits.sort(key=lambda item: (-item.score, item.repository, item.node.id))
87
+ return hits[:limit]
88
+
89
+ def federated_graph(self) -> ProjectGraph:
90
+ if not self._graphs:
91
+ self.refresh()
92
+ nodes: list[GraphNode] = []
93
+ edges: list[GraphEdge] = []
94
+ symbol_groups: dict[tuple[str, str], list[tuple[str, str]]] = {}
95
+ for repository, graph in self._graphs.items():
96
+ for node in graph.nodes:
97
+ namespaced = self._node_id(repository, node.id)
98
+ metadata = dict(node.metadata)
99
+ metadata["repository"] = repository
100
+ nodes.append(node.model_copy(update={"id": namespaced, "metadata": metadata}))
101
+ if node.kind not in {"file", "module", "reference"}:
102
+ symbol_groups.setdefault((node.kind, node.name.lower()), []).append(
103
+ (repository, namespaced)
104
+ )
105
+ for edge in graph.edges:
106
+ metadata = dict(edge.metadata)
107
+ metadata["repository"] = repository
108
+ edges.append(
109
+ edge.model_copy(
110
+ update={
111
+ "source": self._node_id(repository, edge.source),
112
+ "target": self._node_id(repository, edge.target),
113
+ "metadata": metadata,
114
+ }
115
+ )
116
+ )
117
+ for (_, _), members in symbol_groups.items():
118
+ if len({repository for repository, _ in members}) < 2:
119
+ continue
120
+ for index, (left_repo, left_id) in enumerate(members):
121
+ for right_repo, right_id in members[index + 1 :]:
122
+ if left_repo == right_repo:
123
+ continue
124
+ edges.append(
125
+ GraphEdge(
126
+ source=left_id,
127
+ target=right_id,
128
+ kind="cross_repo_symbol",
129
+ metadata={
130
+ "confidence": 0.85,
131
+ "left_repository": left_repo,
132
+ "right_repository": right_repo,
133
+ },
134
+ )
135
+ )
136
+ return ProjectGraph(nodes=nodes, edges=edges)
137
+
138
+ def save(self) -> None:
139
+ if self.state_path is None:
140
+ return
141
+ self.state_path.parent.mkdir(parents=True, exist_ok=True)
142
+ payload = {
143
+ "version": self.VERSION,
144
+ "repositories": [
145
+ {**asdict(item), "root": str(item.root)} for item in self.repositories
146
+ ],
147
+ }
148
+ temp = self.state_path.with_suffix(self.state_path.suffix + ".tmp")
149
+ temp.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
150
+ temp.replace(self.state_path)
151
+
152
+ def load(self) -> None:
153
+ if self.state_path is None:
154
+ return
155
+ try:
156
+ payload = json.loads(self.state_path.read_text(encoding="utf-8"))
157
+ except (OSError, json.JSONDecodeError):
158
+ return
159
+ if payload.get("version") != self.VERSION:
160
+ return
161
+ for item in payload.get("repositories", []):
162
+ try:
163
+ self.add_repository(
164
+ str(item["name"]),
165
+ Path(str(item["root"])),
166
+ float(item.get("weight", 1.0)),
167
+ )
168
+ except (KeyError, TypeError, ValueError):
169
+ continue
170
+
171
+ @staticmethod
172
+ def _node_id(repository: str, node_id: str) -> str:
173
+ return f"repo:{repository}:{node_id}"
@@ -0,0 +1,381 @@
1
+ Metadata-Version: 2.5
2
+ Name: codecortex-context-engine
3
+ Version: 0.1.0a1
4
+ Summary: Context intelligence layer for AI coding agents
5
+ Project-URL: Homepage, https://github.com/BehnamJalaliCo/CodeCortex
6
+ Project-URL: Repository, https://github.com/BehnamJalaliCo/CodeCortex
7
+ Project-URL: Issues, https://github.com/BehnamJalaliCo/CodeCortex/issues
8
+ Project-URL: Security, https://github.com/BehnamJalaliCo/CodeCortex/security
9
+ Author: Behnam Jalali
10
+ License: Apache License
11
+ Version 2.0, January 2004
12
+ http://www.apache.org/licenses/
13
+
14
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
15
+
16
+ 1. Definitions.
17
+
18
+ "License" shall mean the terms and conditions for use, reproduction,
19
+ and distribution as defined by Sections 1 through 9 of this document.
20
+
21
+ "Licensor" shall mean the copyright owner or entity authorized by
22
+ the copyright owner that is granting the License.
23
+
24
+ "Legal Entity" shall mean the union of the acting entity and all
25
+ other entities that control, are controlled by, or are under common
26
+ control with that entity. For the purposes of this definition,
27
+ "control" means (i) the power, direct or indirect, to cause the
28
+ direction or management of such entity, whether by contract or
29
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
30
+ outstanding shares, or (iii) beneficial ownership of such entity.
31
+
32
+ "You" (or "Your") shall mean an individual or Legal Entity
33
+ exercising permissions granted by this License.
34
+
35
+ "Source" form shall mean the preferred form for making modifications,
36
+ including but not limited to software source code, documentation
37
+ source, and configuration files.
38
+
39
+ "Object" form shall mean any form resulting from mechanical
40
+ transformation or translation of a Source form, including but
41
+ not limited to compiled object code, generated documentation,
42
+ and conversions to other media types.
43
+
44
+ "Work" shall mean the work of authorship, whether in Source or
45
+ Object form, made available under the License, as indicated by a
46
+ copyright notice that is included in or attached to the work
47
+ (an example is provided in the Appendix below).
48
+
49
+ "Derivative Works" shall mean any work, whether in Source or Object
50
+ form, that is based on (or derived from) the Work and for which the
51
+ editorial revisions, annotations, elaborations, or other modifications
52
+ represent, as a whole, an original work of authorship. For the purposes
53
+ of this License, Derivative Works shall not include works that remain
54
+ separable from, or merely link (or bind by name) to the interfaces of,
55
+ the Work and Derivative Works thereof.
56
+
57
+ "Contribution" shall mean any work of authorship, including
58
+ the original version of the Work and any modifications or additions
59
+ to that Work or Derivative Works thereof, that is intentionally
60
+ submitted to Licensor for inclusion in the Work by the copyright owner
61
+ or by an individual or Legal Entity authorized to submit on behalf of
62
+ the copyright owner. For the purposes of this definition, "submitted"
63
+ means any form of electronic, verbal, or written communication sent
64
+ to the Licensor or its representatives, including but not limited to
65
+ communication on electronic mailing lists, source code control systems,
66
+ and issue tracking systems that are managed by, or on behalf of, the
67
+ Licensor for the purpose of discussing and improving the Work, but
68
+ excluding communication that is conspicuously marked or otherwise
69
+ designated in writing by the copyright owner as "Not a Contribution."
70
+
71
+ "Contributor" shall mean Licensor and any individual or Legal Entity
72
+ on behalf of whom a Contribution has been received by Licensor and
73
+ subsequently incorporated within the Work.
74
+
75
+ 2. Grant of Copyright License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ copyright license to reproduce, prepare Derivative Works of,
79
+ publicly display, publicly perform, sublicense, and distribute the
80
+ Work and such Derivative Works in Source or Object form.
81
+
82
+ 3. Grant of Patent License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ (except as stated in this section) patent license to make, have made,
86
+ use, offer to sell, sell, import, and otherwise transfer the Work,
87
+ where such license applies only to those patent claims licensable
88
+ by such Contributor that are necessarily infringed by their
89
+ Contribution(s) alone or by combination of their Contribution(s)
90
+ with the Work to which such Contribution(s) was submitted. If You
91
+ institute patent litigation against any entity (including a
92
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
93
+ or a Contribution incorporated within the Work constitutes direct
94
+ or contributory patent infringement, then any patent licenses
95
+ granted to You under this License for that Work shall terminate
96
+ as of the date such litigation is filed.
97
+
98
+ 4. Redistribution. You may reproduce and distribute copies of the
99
+ Work or Derivative Works thereof in any medium, with or without
100
+ modifications, and in Source or Object form, provided that You
101
+ meet the following conditions:
102
+
103
+ (a) You must give any other recipients of the Work or
104
+ Derivative Works a copy of this License; and
105
+
106
+ (b) You must cause any modified files to carry prominent notices
107
+ stating that You changed the files; and
108
+
109
+ (c) You must retain, in the Source form of any Derivative Works
110
+ that You distribute, all copyright, patent, trademark, and
111
+ attribution notices from the Source form of the Work,
112
+ excluding those notices that do not pertain to any part of
113
+ the Derivative Works; and
114
+
115
+ (d) If the Work includes a "NOTICE" text file as part of its
116
+ distribution, then any Derivative Works that You distribute must
117
+ include a readable copy of the attribution notices contained
118
+ within such NOTICE file, excluding those notices that do not
119
+ pertain to any part of the Derivative Works, in at least one
120
+ of the following places: within a NOTICE text file distributed
121
+ as part of the Derivative Works; within the Source form or
122
+ documentation, if provided along with the Derivative Works; or,
123
+ within a display generated by the Derivative Works, if and
124
+ wherever such third-party notices normally appear. The contents
125
+ of the NOTICE file are for informational purposes only and
126
+ do not modify the License. You may add Your own attribution
127
+ notices within Derivative Works that You distribute, alongside
128
+ or as an addendum to the NOTICE text from the Work, provided
129
+ that such additional attribution notices cannot be construed
130
+ as modifying the License.
131
+
132
+ You may add Your own copyright statement to Your modifications and
133
+ may provide additional or different license terms and conditions
134
+ for use, reproduction, or distribution of Your modifications, or
135
+ for any such Derivative Works as a whole, provided Your use,
136
+ reproduction, and distribution of the Work otherwise complies with
137
+ the conditions stated in this License.
138
+
139
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
140
+ any Contribution intentionally submitted for inclusion in the Work
141
+ by You to the Licensor shall be under the terms and conditions of
142
+ this License, without any additional terms or conditions.
143
+ Notwithstanding the above, nothing herein shall supersede or modify
144
+ the terms of any separate license agreement you may have executed
145
+ with Licensor regarding such Contributions.
146
+
147
+ 6. Trademarks. This License does not grant permission to use the trade
148
+ names, trademarks, service marks, or product names of the Licensor,
149
+ except as required for reasonable and customary use in describing the
150
+ origin of the Work and reproducing the content of the NOTICE file.
151
+
152
+ 7. Disclaimer of Warranty. Unless required by applicable law or
153
+ agreed to in writing, Licensor provides the Work (and each
154
+ Contributor provides its Contributions) on an "AS IS" BASIS,
155
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
156
+ implied, including, without limitation, any warranties or conditions
157
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
158
+ PARTICULAR PURPOSE. You are solely responsible for determining the
159
+ appropriateness of using or redistributing the Work and assume any
160
+ risks associated with Your exercise of permissions under this License.
161
+
162
+ 8. Limitation of Liability. In no event and under no legal theory,
163
+ whether in tort (including negligence), contract, or otherwise,
164
+ unless required by applicable law (such as deliberate and grossly
165
+ negligent acts) or agreed to in writing, shall any Contributor be
166
+ liable to You for damages, including any direct, indirect, special,
167
+ incidental, or consequential damages of any character arising as a
168
+ result of this License or out of the use or inability to use the
169
+ Work (including but not limited to damages for loss of goodwill,
170
+ work stoppage, computer failure or malfunction, or any and all
171
+ other commercial damages or losses), even if such Contributor
172
+ has been advised of the possibility of such damages.
173
+
174
+ 9. Accepting Warranty or Additional Liability. While redistributing
175
+ the Work or Derivative Works thereof, You may choose to offer,
176
+ and charge a fee for, acceptance of support, warranty, indemnity,
177
+ or other liability obligations and/or rights consistent with this
178
+ License. However, in accepting such obligations, You may act only
179
+ on Your own behalf and on Your sole responsibility, not on behalf
180
+ of any other Contributor, and only if You agree to indemnify,
181
+ defend, and hold each Contributor harmless for any liability
182
+ incurred by, or claims asserted against, such Contributor by reason
183
+ of your accepting any such warranty or additional liability.
184
+
185
+ END OF TERMS AND CONDITIONS
186
+
187
+ APPENDIX: How to apply the Apache License to your work.
188
+
189
+ To apply the Apache License to your work, attach the following
190
+ boilerplate notice, with the fields enclosed by brackets "[]"
191
+ replaced with your own identifying information. (Don't include
192
+ the brackets!) The text should be enclosed in the appropriate
193
+ comment syntax for the file format. We also recommend that a
194
+ file or class name and description of purpose be included on the
195
+ same "printed page" as the copyright notice for easier
196
+ identification within third-party archives.
197
+
198
+ Copyright 2026 Behnam Jalali
199
+
200
+ Licensed under the Apache License, Version 2.0 (the "License");
201
+ you may not use this file except in compliance with the License.
202
+ You may obtain a copy of the License at
203
+
204
+ http://www.apache.org/licenses/LICENSE-2.0
205
+
206
+ Unless required by applicable law or agreed to in writing, software
207
+ distributed under the License is distributed on an "AS IS" BASIS,
208
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
+ See the License for the specific language governing permissions and
210
+ limitations under the License.
211
+ License-File: LICENSE
212
+ License-File: NOTICE
213
+ Keywords: ai,code-intelligence,coding-agents,context-engine,mcp
214
+ Classifier: Development Status :: 3 - Alpha
215
+ Classifier: License :: OSI Approved :: Apache Software License
216
+ Classifier: Programming Language :: Python :: 3.11
217
+ Classifier: Programming Language :: Python :: 3.12
218
+ Classifier: Programming Language :: Python :: 3.13
219
+ Requires-Python: >=3.11
220
+ Requires-Dist: pydantic<3,>=2.8
221
+ Requires-Dist: rich<15,>=13.7
222
+ Requires-Dist: typer<1,>=0.27.1
223
+ Provides-Extra: dev
224
+ Requires-Dist: build>=1.2; extra == 'dev'
225
+ Requires-Dist: mypy>=1.11; extra == 'dev'
226
+ Requires-Dist: pytest-asyncio>=1.4.0; extra == 'dev'
227
+ Requires-Dist: pytest-cov<8,>=6; extra == 'dev'
228
+ Requires-Dist: pytest>=8.2; extra == 'dev'
229
+ Requires-Dist: ruff>=0.16.5; extra == 'dev'
230
+ Requires-Dist: twine>=7.0.0; extra == 'dev'
231
+ Provides-Extra: parsers
232
+ Requires-Dist: tree-sitter-language-pack<2,>=1.15.8; extra == 'parsers'
233
+ Provides-Extra: security
234
+ Requires-Dist: bandit>=1.7; extra == 'security'
235
+ Requires-Dist: cyclonedx-bom>=4; extra == 'security'
236
+ Requires-Dist: pip-audit>=2.7; extra == 'security'
237
+ Provides-Extra: semantic
238
+ Requires-Dist: sentence-transformers<6,>=3; extra == 'semantic'
239
+ Description-Content-Type: text/markdown
240
+
241
+ # CodeCortex Context Engine 🧠
242
+
243
+ [![CI](https://github.com/BehnamJalaliCo/CodeCortex/actions/workflows/ci.yml/badge.svg)](https://github.com/BehnamJalaliCo/CodeCortex/actions/workflows/ci.yml)
244
+ [![CodeQL](https://github.com/BehnamJalaliCo/CodeCortex/actions/workflows/codeql.yml/badge.svg)](https://github.com/BehnamJalaliCo/CodeCortex/actions/workflows/codeql.yml)
245
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/BehnamJalaliCo/CodeCortex/badge)](https://securityscorecards.dev/viewer/?uri=github.com/BehnamJalaliCo/CodeCortex)
246
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
247
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue.svg)](pyproject.toml)
248
+
249
+ ### Context intelligence infrastructure for AI coding agents.
250
+
251
+ CodeCortex builds a task-specific view of a codebase from repository structure, semantic symbols, dependencies, Git history, impact, memory, and compressed context — then exposes it through one MCP surface.
252
+
253
+ **Map. Understand. Edit. Compress. Remember.**
254
+
255
+ > **Alpha.** The architecture and local workflows are usable today. Performance claims are published only from reproducible benchmark artifacts produced by repository workflows.
256
+
257
+ ## Why CodeCortex
258
+
259
+ Large repositories force coding agents to repeatedly rediscover architecture, read irrelevant files, and spend context on information that should already be structured. CodeCortex sits between an agent and its codebase and routes each request to the smallest useful intelligence surface.
260
+
261
+ ```text
262
+ Coding Agent
263
+
264
+
265
+ CodeCortex MCP / Gateway
266
+
267
+ ├── Adaptive Router
268
+ ├── Repository + Dependency Intelligence
269
+ ├── Semantic Symbol + Refactor Intelligence
270
+ ├── Hybrid Retrieval + Context Compression
271
+ ├── Project + Team Memory
272
+ ├── Git + PR + Impact Intelligence
273
+ ├── Architecture Drift
274
+ └── Validation + Task Tracing
275
+ ```
276
+
277
+ The orchestration, routing, repository intelligence, symbol intelligence, context processing, memory, multi-repository workspace, change intelligence, observability, evaluation, and product integration layers live in this repository. Optional external adapters are configuration-driven and disabled by default.
278
+
279
+ ## Install
280
+
281
+ Python 3.11–3.13 is supported.
282
+
283
+ ```bash
284
+ git clone https://github.com/BehnamJalaliCo/CodeCortex.git
285
+ cd CodeCortex
286
+ pip install -e ".[dev]"
287
+ cortex init .
288
+ ```
289
+
290
+ The release pipeline is prepared to publish the Python distribution as `codecortex-context-engine`.
291
+
292
+ ## One MCP surface
293
+
294
+ ```bash
295
+ cortex mcp --path /path/to/repository
296
+ ```
297
+
298
+ The MCP surface includes repository mapping, semantic search, symbols, references, dependency analysis, impact analysis, architecture inference, context construction, project/team memory, PR intelligence, traces, validation, and guarded semantic editing.
299
+
300
+ ### Semantic edits
301
+
302
+ ```bash
303
+ cortex edit rename src/auth.py AuthService SessionService
304
+ cortex edit replace src/auth.py AuthService/refresh --body-file ./replacement.txt
305
+ cortex edit insert-before src/auth.py AuthService --body-file ./imports.txt
306
+ cortex edit insert-after src/auth.py AuthService --body-file ./helper.txt
307
+ ```
308
+
309
+ Paths are constrained to the project root and symbol-body mutations perform a semantic preflight read.
310
+
311
+ ## Native language intelligence
312
+
313
+ Python uses the standard AST. The optional native parser extra provides Tree-sitter grammars across TypeScript, JavaScript, Go, Rust, Java, C, C++, C#, PHP, and Ruby.
314
+
315
+ ```bash
316
+ pip install "codecortex-context-engine[parsers]"
317
+ ```
318
+
319
+ ## Core commands
320
+
321
+ ```bash
322
+ cortex index
323
+ cortex semantic "authentication refresh"
324
+ cortex impact AuthService
325
+ cortex architecture
326
+ cortex architecture-drift
327
+ cortex symbol-history src/auth.py 10 80
328
+ cortex pr main --head HEAD
329
+ cortex workspace-add backend ../backend
330
+ cortex workspace-search "payment service"
331
+ cortex benchmark
332
+ cortex dashboard
333
+ cortex doctor
334
+ ```
335
+
336
+ ## Quality and security
337
+
338
+ CodeCortex uses layered validation: CI across Python 3.11–3.13, CodeQL, dependency auditing, Bandit, security-boundary tests, OpenSSF Scorecard, CycloneDX SBOMs, checksums, Sigstore signing, and GitHub build-provenance attestations.
339
+
340
+ Repository-wide branch coverage has a measured baseline and a 90% long-term target. See `docs/QUALITY.md` for the current evidence and policy.
341
+
342
+ ## Reproducible performance evidence
343
+
344
+ ```bash
345
+ python scripts/run_production_benchmark.py
346
+ ```
347
+
348
+ Missing token, file-read, or cost metrics remain `null`; CodeCortex does not fabricate them. Public performance claims should be backed by reproducible benchmark artifacts.
349
+
350
+ ## Observatory
351
+
352
+ ```bash
353
+ cortex dashboard -p /path/to/repository
354
+ ```
355
+
356
+ The local read-only dashboard shows backend health, routing distribution, context tokens saved, engine latency, graph hotspots, recent task traces, architecture drift, benchmark history, and a PR-risk API. It binds to `127.0.0.1` by default.
357
+
358
+ ## Docker
359
+
360
+ ```bash
361
+ docker build --target core -t codecortex:core .
362
+ docker build --target full -t codecortex:full .
363
+ docker compose up dashboard
364
+ ```
365
+
366
+ ## Project standards
367
+
368
+ - `CONTRIBUTING.md` — contribution workflow.
369
+ - `CODE_OF_CONDUCT.md` — community expectations.
370
+ - `GOVERNANCE.md` — decision-making and maintainership.
371
+ - `SUPPORT.md` — support channels.
372
+ - `SECURITY.md` — private vulnerability reporting and security defaults.
373
+ - `CITATION.cff` — citation metadata.
374
+ - `COMMERCIAL.md` — commercial support and licensing model.
375
+ - `docs/QUALITY.md` — measurable quality targets.
376
+ - `docs/OPENSSF.md` — OpenSSF badge readiness and external enrollment.
377
+ - `ROADMAP.md` — shipped and future work.
378
+
379
+ ## Licensing
380
+
381
+ CodeCortex is licensed under **Apache-2.0**. Separate paid support, managed offerings, enterprise terms, and commercial agreements for material the licensor has the right to license may be offered independently; see `COMMERCIAL.md`.
@@ -0,0 +1,90 @@
1
+ codecortex/__init__.py,sha256=PoHqaX-IP4xVThe26Nr6JxDy44yqAXdrbul7a8XmEw0,51
2
+ codecortex/benchmark.py,sha256=wFL86SJdFS20eCPUdBcNr2epsDtOnN6PaMnZzYZZB3s,7775
3
+ codecortex/cli.py,sha256=xjNn4192jpFT5-OWn6MnI2Jbuptqm0boUeW2SIqPZEw,14517
4
+ codecortex/config.py,sha256=pd_0D6ZOMMoGS9Wuo6dDp8CQ1pzRyqLlF_pwzPp2mww,786
5
+ codecortex/dashboard.py,sha256=fpI44FnuW7ffYV5fLu1eR8Mof_ShbGBVJ1jb4hCKW4Q,14021
6
+ codecortex/editing.py,sha256=uQjFAT-YCQMcGkPMFPC8Vn4Y1ih66L_xLDb_Wl8CRqo,1489
7
+ codecortex/entrypoint.py,sha256=SvaZ6dRwArIXkPZNvCp4gxi_PKGQbxFW_-2BrJO97PU,9155
8
+ codecortex/gateway.py,sha256=NGOdLz4-tSoB30Q956nye_tjRZQlDjWWL0KrTcu-_2k,1388
9
+ codecortex/git_intelligence.py,sha256=7V4HlqGUVv8X1Wgt9RAdcHlgL7EWpYtCbod-KA7G32k,7940
10
+ codecortex/orchestrator.py,sha256=OMB-jdUwmFr0xeVpXc866JRymHEwZL1RHB36HEYgA70,5907
11
+ codecortex/pr_intelligence.py,sha256=MJOWFyoUeJciHm33fBcrp9KACFwbjysVDE-zr5nb7IU,7758
12
+ codecortex/runtime.py,sha256=oYKOIdBl86WSPqsHzQLHhgrh6ED3icFYbV9mvoMDT8M,2259
13
+ codecortex/setup.py,sha256=FtQ5LyBYYDnNsp3FnUD7PchRtJiBsr6gT9v1dfV2bhw,3284
14
+ codecortex/architecture/__init__.py,sha256=yGof4IXV06k7Fj6Gk74PDwsk67BLDuRI4h-C5BnyyLw,559
15
+ codecortex/architecture/drift.py,sha256=PrYYZIvpYfcYTBuJwMBChZvb10T62thlb_Kwo5MuHgc,7061
16
+ codecortex/architecture/inference.py,sha256=rhm8MOxMtHNi5_M2Q6065B-a3pNLjWXdnoB0OICaca0,6119
17
+ codecortex/backends/__init__.py,sha256=WKPlV6gtVVxwGT6b4gZwZlUc1KzNJpjhhBgZlwt3v_M,1024
18
+ codecortex/backends/base.py,sha256=JHIAP06Xto5dUoRGk7gO_P1r0xUSWlKz1EhCqIX_Hyw,1306
19
+ codecortex/backends/context.py,sha256=akvoTpgVCBaOrsi79AzCHQKmykG79XQN7catGBfuXOQ,4270
20
+ codecortex/backends/contracts.py,sha256=e9um8KPjSXbgOBGQXQ2lDg6Zz5qJ7T2A9KeXBShIb28,1594
21
+ codecortex/backends/factory.py,sha256=yvE3lzvsxCl7jauD84eyG3xf5e9sIaA9-Tf5V2mnSMc,2297
22
+ codecortex/backends/graph.py,sha256=oQ-IJiJ3iT5M9sNs8MFO2Y206XknYGK6aQV7t1sw4s8,3920
23
+ codecortex/backends/manager.py,sha256=M-e7j7_71ihOcDCfIJGfg-f-SJKq6YHPJcDV7rKZfdo,11505
24
+ codecortex/backends/mcp_client.py,sha256=c5Sj8MKhK1UxAGr0i593Pc3ZxVI4m25_b55si1fAXDA,6980
25
+ codecortex/backends/pool.py,sha256=y25satgz5NjziR_hGz5avMXeqjADd37TyTIzuhlyXR0,3989
26
+ codecortex/backends/spec.py,sha256=TQCfZHY3Q3ePoUIH8xXiifqjwlnyQIvvrPRVKYCcxiM,2524
27
+ codecortex/backends/symbols.py,sha256=WzXZ2GacKKM56X2bi0aWjQDYghj3OAL1uroTjQlJbJ0,7584
28
+ codecortex/context/__init__.py,sha256=4F3zlbYL_FT_fYGpj2c0mpy_lncA6kpyASZQPcvQIks,409
29
+ codecortex/context/budget.py,sha256=lrqpZrzMOoQBB-g3vQCHlZRYIo2ToDXDsgc4aCxcZ70,2023
30
+ codecortex/context/integrated.py,sha256=KJE6tTDSbCanJ0TnmOEsyvmUIcvuITAIkorehClOAMU,2453
31
+ codecortex/context/pipeline.py,sha256=zUV660jNgCbuTxXQxID0LeU60KIAE9wvMAGSpe3FbO8,7880
32
+ codecortex/core/__init__.py,sha256=O6UU0uQ6gpUUIgryXi03nqaae4QIij7iCGidDxVBD2s,47
33
+ codecortex/core/contracts.py,sha256=FKztDTiavZpf-_kpgXpIXCQiolX3m4OWujef3iJNDYU,1359
34
+ codecortex/core/errors.py,sha256=79HyH3xQmgiUzih3jxUnp2W-Gizp2VvKSzRrKh4vjxs,443
35
+ codecortex/core/models.py,sha256=nI2qSgii_OkcGWlnNCFwYhaCgxySkG7FYVz0HEadoMo,1637
36
+ codecortex/engines/__init__.py,sha256=3ReEZITnz9aWrNswNdB-k6-qA7tOgePxb1I5k_RX27k,145
37
+ codecortex/engines/registry.py,sha256=RFp8-PZFktMSH5eiHqcxmbgWe8XQ6QSyhrC7ZrpaTJE,799
38
+ codecortex/engines/builtin/__init__.py,sha256=vKvU4Q13Yw5F1f27agY__5QzOVRnWsg6waASrD8uXhI,139
39
+ codecortex/engines/builtin/factory.py,sha256=4veFBSNpPQINVviL8cqjFz9myYAwi9Uq4icCuR67mPI,1014
40
+ codecortex/engines/builtin/memory.py,sha256=yxK2vBxDb7gZ8BZNZhaNYS3agLOQQBx7aNeB9Rok1Hw,1208
41
+ codecortex/engines/builtin/repository.py,sha256=rJaqDwZ2_jsnZqvcLPtyJ779Upw-ja5AfcLiMjkhIT0,2606
42
+ codecortex/engines/builtin/symbols.py,sha256=iWfbjLqEQSXWf_6XteFc6xq53A6GSgMS18-HBlB5RmE,3344
43
+ codecortex/engines/builtin/validation.py,sha256=19rVGk4PNjT3PLe4HpgDcyBSqx-l9GHE6tr2DuGSe8U,1939
44
+ codecortex/evaluation/__init__.py,sha256=sZO-X-4XKrlP84DaG_fY-ZVp83VCw3c50eWQYZ0sxaA,1311
45
+ codecortex/evaluation/external.py,sha256=gr6GGI9y5ftXVzLHabZyalvXgYnbjPjLcdwfGlENDVE,9788
46
+ codecortex/evaluation/production.py,sha256=A8ENJ4G6ESx_X5fVtUe3QwegY7EKaApLhqDSyN26E_A,23883
47
+ codecortex/evaluation/regression.py,sha256=WLQAUp5I1-0KWq6d-4KvI7bxA7dh8XjAIisCqJ8V5MI,6915
48
+ codecortex/indexing/__init__.py,sha256=oRKAIpJgUYCfyortfAGzOk6_GNQ1-n1isIvf442epYw,259
49
+ codecortex/indexing/graph.py,sha256=udLC-q5EPo72yTnAf50u6a0Voy5-eZTKPnkWHrj6UXY,2365
50
+ codecortex/indexing/impact.py,sha256=oHZmXhgpeKvdcrJ4uo4FEQ3nVSI_avuTHrY33nS6Sh8,4536
51
+ codecortex/indexing/incremental.py,sha256=qHQT58LVhNm4todEtCWQ9n-R6tL90th8giJ5zS3-F7U,4906
52
+ codecortex/indexing/incremental_graph.py,sha256=sAUyIxGZx2AGFd41UUbSRFEK-LOudlEVoxnJeM7-n6k,7810
53
+ codecortex/indexing/indexer.py,sha256=RrIufUC_qmz5QTWAKNY6OSa8-5tYbUi0ZYT8pmI0DFw,6238
54
+ codecortex/indexing/relationships.py,sha256=kDIUHyGUMQb4mx71e3eRuI2XdyTwWl7TpOU64KifEWs,6517
55
+ codecortex/indexing/resolution.py,sha256=gqXZAsPGGDmN9ORZFMom4TLRzkWhd5sILTlSfRMKn3E,2893
56
+ codecortex/integrations/__init__.py,sha256=euNa-XtBda-RiXwJXKXoE1lO-laWM5BeUVwXIp1HJGg,195
57
+ codecortex/integrations/agents.py,sha256=b4L-Wzfxjf0O-MOXyQ1RzpobE3J9dw_-AnQJvZzifE4,8820
58
+ codecortex/interfaces/__init__.py,sha256=BaxvPDu7nWMQsl2sXKKHEMbpJEARmibzBFkvgL1AQYE,35
59
+ codecortex/interfaces/mcp_bridge.py,sha256=QuqQdxaIP-MjxsMwyXYX239u_9zZIg44ebswppHd08w,2477
60
+ codecortex/languages/__init__.py,sha256=KvuFJNifdOHFuvJ5618q14QGa61I1xh8NrQYEsRDGiA,188
61
+ codecortex/languages/native.py,sha256=R7hk346aR2Uw6ZgkKoSVv-tzb2ZeNvN-OWDlG9AeMQY,5951
62
+ codecortex/languages/registry.py,sha256=xkaoZQmhlDmLpJ75E556Ooye_Sfc0Z1aJJwRp-_s-CE,9123
63
+ codecortex/mcp/__init__.py,sha256=yJzWtPOgejTE7u8vEL3P9oXq_UUgnCQvcFXmENBKNTk,129
64
+ codecortex/mcp/extended.py,sha256=QnpRt_Oz8esErXAdCipZoEn3NBCvT6CC_JWyOCL38b0,4102
65
+ codecortex/mcp/server.py,sha256=hdCwI-Kb8j3O5gimRkkNBosEuk3AUtNyeZMJYakrWlg,19681
66
+ codecortex/memory/__init__.py,sha256=1AQsi3-e2qDIFhcRb6-EBcxqsUl0y9eU9Ri_bpT2-2Q,307
67
+ codecortex/memory/json_store.py,sha256=0-f2_jVqCobvxKzVBwic12CpVB-bvB3-aaMIRDo4Olg,1859
68
+ codecortex/memory/knowledge.py,sha256=Lgz3a6BQY6rtBsAMhWshzlrUZuGHd9ncfEG42mZ194k,6137
69
+ codecortex/memory/team_store.py,sha256=WPIwJJR-bW1eQKiopxk9TIeJEE_NnxA6T-H7x5WvEk4,7584
70
+ codecortex/retrieval/__init__.py,sha256=GAfG9WvGMb3J28paZXfWagSLi2IGViSYOaJHubqpTK8,533
71
+ codecortex/retrieval/hybrid.py,sha256=xhISX9do9sxHGz2cehl9u8PKlH0ikQ-KHZ0u9dGPAdc,2518
72
+ codecortex/retrieval/index.py,sha256=Ttz8yGytJXt6ntfUU19z0KyMs45Kjhy72eWa1HRqoDs,4625
73
+ codecortex/retrieval/providers.py,sha256=iVWK7huk1XEtrjMuHqqVerCPcjEWUXrOA2rNUz3fTkg,2427
74
+ codecortex/retrieval/repository.py,sha256=E3kxdCt3N2It5y3jtzMDxYTqfQsYqm3gRv5N8DTtz2Y,3628
75
+ codecortex/router/__init__.py,sha256=gsJv2qJcPruWroEV-uqwTth078C29Ntubg043vy5lvY,115
76
+ codecortex/router/router.py,sha256=MRpkCVcIARM-6PsjwAd5pbgInJbiPE8NCTW9gQPWw-E,3393
77
+ codecortex/symbols/__init__.py,sha256=yHACh-bZlLSNUzJ_hNDqpLWkKD3wgzXrE5-GiHL2MV4,173
78
+ codecortex/symbols/providers.py,sha256=63QdUQKDNwUYKqYZcDoi5aq_bFPLIxDlkcVEdx-hs4s,7448
79
+ codecortex/telemetry/__init__.py,sha256=_Bn5rBGtRKkwcnZMV6IY6sfT8iriSxuSd6CPgjEHBd4,134
80
+ codecortex/telemetry/collector.py,sha256=VcAdrkJxwpzKfIKd6RMS7hkNjk6UQ9RDRsGGGmw-nm4,1422
81
+ codecortex/tracing/__init__.py,sha256=FT0qMstGApUM4cUd-W5OrmlNb9PWiIaUHo3wjHmcq68,211
82
+ codecortex/tracing/task_trace.py,sha256=qPh3nW_Q3-RIds3QhQlcqCcQEpP4Xu0UXCar8Dw1oT4,7896
83
+ codecortex/workspace/__init__.py,sha256=Z8rsIogx55CbPwFcw9CkTAu0AE95lI0yFaewiQyybrU,238
84
+ codecortex/workspace/federation.py,sha256=tCpgtY9bRE1i9GWrBOFIBZ4I-EpMcZd6ThfAe8eyFu4,6793
85
+ codecortex_context_engine-0.1.0a1.dist-info/METADATA,sha256=ehgCTadPdKuf8DfHCLc962gCkOPlhD8nQ3Pl5abxv1c,20480
86
+ codecortex_context_engine-0.1.0a1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
87
+ codecortex_context_engine-0.1.0a1.dist-info/entry_points.txt,sha256=tLCSh97ZcExJyNxp4mHKn3hBXxzG6GN4V4xQaA67Bdk,92
88
+ codecortex_context_engine-0.1.0a1.dist-info/licenses/LICENSE,sha256=iw-tv5BWvGYoHK-5azC7LfNHa3W4BeSTYSH0SbIfbnA,11343
89
+ codecortex_context_engine-0.1.0a1.dist-info/licenses/NOTICE,sha256=7xnl7UE66-4hudQ9QZER6shyuubBh8_1cv_llSKv5r0,40
90
+ codecortex_context_engine-0.1.0a1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ codecortex = codecortex.entrypoint:app
3
+ cortex = codecortex.entrypoint:app