cortex-kg 0.3.4__tar.gz → 0.5.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.
- cortex_kg-0.5.0/CHANGELOG.md +204 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/MANIFEST.in +3 -2
- cortex_kg-0.5.0/PKG-INFO +325 -0
- cortex_kg-0.5.0/README.md +260 -0
- cortex_kg-0.5.0/SECURITY.md +120 -0
- cortex_kg-0.5.0/docs/README.md +27 -0
- cortex_kg-0.5.0/docs/agents.md +167 -0
- cortex_kg-0.5.0/docs/cortex-brain.md +191 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/cursor.md +15 -11
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/installation.md +8 -9
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/other-platforms.md +9 -7
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/project-workflow.md +1 -1
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/publishing.md +1 -1
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/pyproject.toml +6 -3
- cortex_kg-0.5.0/scripts/benchmark.py +84 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/scripts/build_brain_ui.sh +10 -1
- cortex_kg-0.5.0/scripts/security_scan.py +519 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/__init__.py +1 -1
- cortex_kg-0.5.0/src/cortex/__main__.py +29 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/agents/writeback.py +1 -2
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/analysis/hubs.py +23 -10
- cortex_kg-0.5.0/src/cortex/analysis/orientation.py +183 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/api/rest.py +145 -13
- cortex_kg-0.5.0/src/cortex/api/ui.py +708 -0
- cortex_kg-0.5.0/src/cortex/api/universe.py +508 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/cli.py +568 -118
- cortex_kg-0.5.0/src/cortex/context/generator.py +493 -0
- cortex_kg-0.5.0/src/cortex/context/present.py +217 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/daemon.py +30 -1
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/code_extractor.py +485 -180
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/markdown_extractor.py +97 -18
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/module_resolver.py +24 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/ingestion/ignore.py +68 -14
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/ingestion/pipeline.py +302 -119
- cortex_kg-0.5.0/src/cortex/ingestion/resolver.py +610 -0
- cortex_kg-0.5.0/src/cortex/mcp_server/server.py +161 -0
- cortex_kg-0.5.0/src/cortex/mcp_server/tools.py +741 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/ontology/registry.py +17 -2
- cortex_kg-0.5.0/src/cortex/retrieval/fusion.py +144 -0
- cortex_kg-0.5.0/src/cortex/retrieval/lookup.py +200 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/retrieval/planner.py +11 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/retrieval/query_engine.py +165 -62
- cortex_kg-0.5.0/src/cortex/retrieval/text.py +135 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/retrieval/traversal.py +57 -44
- cortex_kg-0.5.0/src/cortex/setup/agents.py +467 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/setup/generators.py +76 -84
- cortex_kg-0.5.0/src/cortex/static/brain/assets/index-B1EUZByq.js +122 -0
- cortex_kg-0.5.0/src/cortex/static/brain/assets/index-BrGxCaRw.css +1 -0
- cortex_kg-0.5.0/src/cortex/static/brain/index.html +14 -0
- cortex_kg-0.5.0/src/cortex/storage/graph_store.py +847 -0
- cortex_kg-0.5.0/src/cortex/storage/keyword_store.py +228 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/storage/provenance.py +147 -16
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/storage/vector_store.py +48 -13
- cortex_kg-0.5.0/src/cortex/sync/freshness.py +166 -0
- cortex_kg-0.5.0/src/cortex_kg.egg-info/PKG-INFO +325 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex_kg.egg-info/SOURCES.txt +15 -2
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex_kg.egg-info/requires.txt +1 -1
- cortex_kg-0.3.4/PKG-INFO +0 -249
- cortex_kg-0.3.4/README.md +0 -184
- cortex_kg-0.3.4/docs/README.md +0 -30
- cortex_kg-0.3.4/docs/cortex-brain.md +0 -203
- cortex_kg-0.3.4/src/cortex/__main__.py +0 -6
- cortex_kg-0.3.4/src/cortex/analysis/orientation.py +0 -82
- cortex_kg-0.3.4/src/cortex/context/generator.py +0 -253
- cortex_kg-0.3.4/src/cortex/ingestion/resolver.py +0 -308
- cortex_kg-0.3.4/src/cortex/mcp_server/server.py +0 -770
- cortex_kg-0.3.4/src/cortex/retrieval/fusion.py +0 -47
- cortex_kg-0.3.4/src/cortex/static/brain/assets/index-B1Qme9VI.css +0 -1
- cortex_kg-0.3.4/src/cortex/static/brain/assets/index-BHGAsAmN.js +0 -488
- cortex_kg-0.3.4/src/cortex/static/brain/index.html +0 -14
- cortex_kg-0.3.4/src/cortex/storage/graph_store.py +0 -613
- cortex_kg-0.3.4/src/cortex/storage/keyword_store.py +0 -102
- cortex_kg-0.3.4/src/cortex_kg.egg-info/PKG-INFO +0 -249
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/LICENSE +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/automation.md +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/benchmarks/graphify-vs-cortex-2026-07-25-post.json +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/benchmarks/graphify-vs-cortex-2026-07-25-rerun.json +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/benchmarks/graphify-vs-cortex-2026-07-25.json +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/benchmarks/graphify-vs-cortex-2026-07-25.md +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/cortex-vs-graphify-replacement-rating.md +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/templates/cortex-agent-rule.mdc +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/docs/templates/cortex-mcp.json +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/README.md +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/api/openapi.yaml +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/docs/adr-001-session-tokens.md +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/docs/architecture.md +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/notes/meeting-2026-07-10-billing-sync.md +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/schema/schema.sql +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/src/auth_service.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/examples/sample_repo/src/billing_service.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/sdk/python/cortex_sdk/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/sdk/python/pyproject.toml +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/sdk/typescript/package.json +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/sdk/typescript/src/index.ts +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/sdk/typescript/tsconfig.json +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/setup.cfg +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/agents/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/agents/hooks.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/analysis/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/analysis/flows.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/api/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/api/graph_viz.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/api/workspace_viz.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/api_client.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/bench/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/bench/graphify_parity.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/config.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/context/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/doctor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/evidence.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/export/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/export/studio.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/api_spec_extractor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/base.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/db_schema_extractor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/git_extractor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/image_extractor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/llm_relation_extractor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/notes_extractor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/extractors/pdf_extractor.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/ingestion/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/ingestion/content_hash.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/maintenance.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/mcp_server/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/mcp_server/workspace_ctx.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/models.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/offline/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/offline/local_llm.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/ontology/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/plugins/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/plugins/examples/jira_like_plugin/plugin.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/plugins/interface.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/plugins/loader.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/project_binding.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/replication/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/replication/crdt.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/retrieval/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/retrieval/embeddings.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/review/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/review/pack.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/security/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/security/acl.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/security/audit.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/security/encryption.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/security/secrets_scanner.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/server_profile/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/server_profile/neo4j_store.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/setup/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/storage/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/sync/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/sync/change_feed.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/sync/job_queue.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/sync/watch_manager.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/sync/watcher.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/versioning/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/versioning/bitemporal.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/workspace/__init__.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/workspace/federation.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex/workspace/registry.py +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex_kg.egg-info/dependency_links.txt +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex_kg.egg-info/entry_points.txt +0 -0
- {cortex_kg-0.3.4 → cortex_kg-0.5.0}/src/cortex_kg.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
Focus: a web UI that tells the truth and stays usable on large projects,
|
|
6
|
+
with a 3D view of everything indexed.
|
|
7
|
+
|
|
8
|
+
### Upgrading
|
|
9
|
+
|
|
10
|
+
- `pip install -U cortex-kg` (or `pipx upgrade cortex-kg`), then
|
|
11
|
+
`cortex down && cortex up` if a daemon is running.
|
|
12
|
+
- The index format changed since 0.4.0: the first `cortex ingest` after
|
|
13
|
+
upgrading re-reads every file once.
|
|
14
|
+
- Agent configs written by earlier versions keep working. Re-run
|
|
15
|
+
`cortex setup agents` to pick up the safer launch arguments.
|
|
16
|
+
|
|
17
|
+
### New: Universe — everything indexed, in 3D
|
|
18
|
+
|
|
19
|
+
A fifth page shows every file, class, function, method, document and
|
|
20
|
+
external package at once, and how they use each other.
|
|
21
|
+
|
|
22
|
+
- **Laid out from the project's structure, not by a physics simulation**, so
|
|
23
|
+
it is the same picture every time and cannot collapse into a ball. A
|
|
24
|
+
folder is a sphere and what it contains sits on its surface; a file is a
|
|
25
|
+
star with its functions and classes on rings around it; methods circle
|
|
26
|
+
their class. External packages form a group of their own.
|
|
27
|
+
- **Position shows where something lives; lines show only use** — imports,
|
|
28
|
+
calls, inheritance and references — as arcs that are brighter at the end
|
|
29
|
+
being used. Calls matched by method name alone are guesses and are not
|
|
30
|
+
drawn.
|
|
31
|
+
- Select anything to see what it uses (blue) and what uses it (orange),
|
|
32
|
+
with pulses travelling in the direction of use, and a list beside it.
|
|
33
|
+
Selecting flies the camera to face that file's disc.
|
|
34
|
+
- Three link levels (file to file, every link, none), colour by kind or by
|
|
35
|
+
top-level folder, tests on or off, and a slow drift that stops for
|
|
36
|
+
reduced-motion settings.
|
|
37
|
+
- Drawn with WebGL 2 and no added dependencies. A 32,000-body,
|
|
38
|
+
51,000-link workspace is laid out in about a second. Without WebGL the
|
|
39
|
+
page says so and points to the 2D map.
|
|
40
|
+
|
|
41
|
+
### Fixed after benchmarking with real agent sessions
|
|
42
|
+
|
|
43
|
+
- **The MCP server could not start in some repositories.** Agent configs
|
|
44
|
+
run `python -m cortex`, which puts the working directory first on the
|
|
45
|
+
import path, so a top-level folder named like a dependency (`mcp/`,
|
|
46
|
+
`yaml/`, `click/`, `lancedb/` ...) was imported in its place and the
|
|
47
|
+
server died at startup. The agent then silently worked without Cortex.
|
|
48
|
+
The entry point now drops the working directory from the import path
|
|
49
|
+
(fixing configs already written), and new configs also pass `-P` on
|
|
50
|
+
Python 3.11+. `cortex up` was affected in the same way.
|
|
51
|
+
|
|
52
|
+
### Web UI rebuilt
|
|
53
|
+
|
|
54
|
+
The browser UI was replaced. The old one opened on an empty workspace, drew
|
|
55
|
+
up to 1,500 nodes as an unreadable force-directed graph, spread its features
|
|
56
|
+
over eleven views, and stated things the data did not support.
|
|
57
|
+
|
|
58
|
+
- **Four pages:** Overview (what is indexed), Explore (module map, and one
|
|
59
|
+
symbol's connections / source / impact), Ask (the exact `get_context`
|
|
60
|
+
output an agent receives) and Sources (folders, freshness, re-index).
|
|
61
|
+
- **Scales by aggregating, not by drawing more.** The module map shows one
|
|
62
|
+
level of folders and files (at most 48 boxes), computed on the server, with
|
|
63
|
+
a deterministic layered layout. A 32,000-node workspace answers every UI
|
|
64
|
+
request in well under half a second.
|
|
65
|
+
- **Removed claims the data did not support:** the "AI-generated
|
|
66
|
+
explanation" (it was a template), "confidence" percentages, orphan / cycle
|
|
67
|
+
/ duplicate analysis computed on whichever nodes happened to be loaded, a
|
|
68
|
+
"timeline" that was the ingest time, and type lists padded with zero counts.
|
|
69
|
+
- **Guesses are labelled.** Calls linked only by method name are marked
|
|
70
|
+
*by name*, kept out of the map and rankings, and counted separately in
|
|
71
|
+
impact.
|
|
72
|
+
- **Fewer wrong links in the graph itself:** name-matched method calls no
|
|
73
|
+
longer cross languages, no longer link production code to test doubles,
|
|
74
|
+
and need the receiver's name to agree with the class when the two files do
|
|
75
|
+
not import each other.
|
|
76
|
+
- A folder is described only by its own package file, and a project only by
|
|
77
|
+
its front-page document — previously a licence file deep in the tree could
|
|
78
|
+
be quoted as the project summary.
|
|
79
|
+
- `POST /ingest` rejects a path that does not exist instead of indexing
|
|
80
|
+
nothing and tracking the dead folder.
|
|
81
|
+
- Opens on a workspace with content, follows the system light/dark setting,
|
|
82
|
+
every view has its own URL, and the bundle is 76 kB gzipped including
|
|
83
|
+
the 3D scene (was 131 kB)
|
|
84
|
+
with `react` and `react-dom` as the only runtime dependencies.
|
|
85
|
+
- New bounded endpoints under `/api/ui/` (see `docs/cortex-brain.md`). The
|
|
86
|
+
previous `/api/graph/*` and `/api/workspaces/*` endpoints remain.
|
|
87
|
+
|
|
88
|
+
## 0.4.0
|
|
89
|
+
|
|
90
|
+
Focus: make Cortex dependable as the context layer for AI coding agents.
|
|
91
|
+
|
|
92
|
+
### Upgrading
|
|
93
|
+
|
|
94
|
+
- Run `cortex ingest` (or let the daemon's background scan do it) once after
|
|
95
|
+
upgrading. Files are re-extracted because the index format changed; nodes
|
|
96
|
+
in the old format are removed automatically.
|
|
97
|
+
- If a daemon is running: `cortex down && cortex up`.
|
|
98
|
+
- Method symbols are now named `path#Class.method` (previously `path#method`).
|
|
99
|
+
- `cortex search` prints readable rows; pass `--json` for the previous kind of
|
|
100
|
+
machine output. MCP tool results are compact rows rather than raw storage
|
|
101
|
+
records.
|
|
102
|
+
- `serve-api` now binds to `127.0.0.1`. Use `--host` and
|
|
103
|
+
`CORTEX_ALLOWED_HOSTS` if you relied on reaching it from another machine.
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
|
|
107
|
+
- **Fresh installs crashed.** `mcp` 2.x removed `mcp.server.fastmcp`; the
|
|
108
|
+
dependency is now pinned to `mcp>=1.10,<2`.
|
|
109
|
+
- **Deleted code never left the graph.** Removing a function or a file left
|
|
110
|
+
its nodes, edges and search entries behind indefinitely. Re-extracting a
|
|
111
|
+
source now replaces what it contributed, and files that disappear from a
|
|
112
|
+
root are purged.
|
|
113
|
+
- **Import stubs overwrote real definitions**, flagging them as `stub` and
|
|
114
|
+
clobbering their properties depending on file order.
|
|
115
|
+
- **Private functions were invisible** (anything starting with `_` was
|
|
116
|
+
skipped), and same-named methods of different classes in one file collapsed
|
|
117
|
+
into a single node.
|
|
118
|
+
- **Search matched on the absolute path.** The keyword index stored a
|
|
119
|
+
`str(dict)` dump of every node's properties, so every node under
|
|
120
|
+
`/home/you/project` matched "home", "you" and "project".
|
|
121
|
+
- **Impact analysis reported most of the repository** for any change, by
|
|
122
|
+
following file-level imports transitively.
|
|
123
|
+
- **A code-only (`--fast`) ingest hid docs from later full ingests**, and a
|
|
124
|
+
crash mid-ingest could mark files as synced that were never committed.
|
|
125
|
+
- Edge provenance was recorded against ids that did not exist in the graph;
|
|
126
|
+
provenance rows grew on every re-ingest.
|
|
127
|
+
- `.get("key")` calls in Python were detected as HTTP routes; stdlib imports
|
|
128
|
+
became `Technology` nodes; `#` comments inside Markdown code fences became
|
|
129
|
+
headings; Markdown links created stub documents named after filenames.
|
|
130
|
+
- The project summary could be taken from a nested example README instead of
|
|
131
|
+
the repository's own.
|
|
132
|
+
- **`cortex orient`, `get_orientation` and `hub_nodes` crashed** with a
|
|
133
|
+
`NameError` on every call. The orientation report is now a map of the
|
|
134
|
+
repository: layout, most depended-on modules, central symbols, entry
|
|
135
|
+
points and docs.
|
|
136
|
+
- `cortex setup vscode --write` wrote Cursor's file and schema.
|
|
137
|
+
- The stdio MCP proxy was a hand-copied second implementation that had
|
|
138
|
+
drifted from the real tools.
|
|
139
|
+
- Watcher syncs did not attach new symbols to the project, so project-scoped
|
|
140
|
+
search missed them.
|
|
141
|
+
|
|
142
|
+
### Security
|
|
143
|
+
|
|
144
|
+
- **Supply-chain guard.** On 27 Nov 2026 `main` briefly carried an amended
|
|
145
|
+
commit with hidden, obfuscated JavaScript wired into the npm build scripts
|
|
146
|
+
and `vite.config.ts` (details and indicators in [SECURITY.md](SECURITY.md)).
|
|
147
|
+
No release was built from it. `scripts/security_scan.py` now scans the tree
|
|
148
|
+
and every commit on every ref in CI, before the publish build, in the UI
|
|
149
|
+
build script, in `pre-commit` / `pre-push` hooks and in the test suite.
|
|
150
|
+
The UI build uses `npm ci --ignore-scripts`; only the publish job can mint
|
|
151
|
+
the PyPI token; line endings are enforced; the sdist no longer takes
|
|
152
|
+
arbitrary files from `sdk/`.
|
|
153
|
+
- `serve-api` listened on `0.0.0.0` with `Access-Control-Allow-Origin: *` and
|
|
154
|
+
no authentication, exposing endpoints that read source and index arbitrary
|
|
155
|
+
folders. It now binds to loopback, validates the `Host` header and only
|
|
156
|
+
allows localhost origins.
|
|
157
|
+
- Ingest skips `.env*`, key and certificate files.
|
|
158
|
+
|
|
159
|
+
### Faster
|
|
160
|
+
|
|
161
|
+
- Indexing this repository: 64 s → about 3 s; an unchanged re-run: about
|
|
162
|
+
0.5 s. A 1,100-file / 400k-line Python corpus (19k nodes, 76k edges)
|
|
163
|
+
indexes in under 30 s, and re-syncing one edited file there takes about
|
|
164
|
+
half a second.
|
|
165
|
+
- Graph writes go through Kuzu's bulk Arrow path, the per-candidate
|
|
166
|
+
full-table scan is replaced by an in-memory key index, keyword rows are
|
|
167
|
+
replaced by rowid instead of a table scan, and traversal queries one hop
|
|
168
|
+
for the whole frontier at a time.
|
|
169
|
+
- Search: about 20 ms warm on this repository, about 130 ms for a full
|
|
170
|
+
context brief on the 400k-line corpus.
|
|
171
|
+
|
|
172
|
+
### New
|
|
173
|
+
|
|
174
|
+
- **Agent-ready context.** `get_context` returns, per result, a
|
|
175
|
+
`path:start-end` location, signature, docstring, grouped relationships
|
|
176
|
+
(calls / called by / defines / documented in …) and current source for the
|
|
177
|
+
top hits, trimmed to the token budget.
|
|
178
|
+
- **Read-time freshness.** Results are checked against the working tree and
|
|
179
|
+
the files behind them re-synced before answering; long-lived servers also
|
|
180
|
+
rescan tracked folders in the background.
|
|
181
|
+
- **Code navigation tools:** `find_symbol`, `read_symbol`, `file_outline`,
|
|
182
|
+
`find_references`, `workspace_status`. Every target accepts a symbol name,
|
|
183
|
+
path, `path:line` or `path#Symbol`.
|
|
184
|
+
- **Richer code graph:** signatures, docstrings / doc comments, line ranges,
|
|
185
|
+
class-qualified methods, nested functions, TypeScript interfaces / enums /
|
|
186
|
+
type aliases, Go types and receiver methods, test detection, and
|
|
187
|
+
cross-file method-call resolution using the receiver's name.
|
|
188
|
+
- **Better ranking:** weighted name / alias / body keyword index with
|
|
189
|
+
identifier splitting and stop-word removal; exact-name and name-coverage
|
|
190
|
+
boosts; tests, stubs and constructors demoted; how-to questions answered
|
|
191
|
+
from documentation.
|
|
192
|
+
- **`cortex init`** — index a repository and connect its coding agents in one
|
|
193
|
+
step; **`cortex setup agents`** for Claude Code, Cursor, VS Code, Codex,
|
|
194
|
+
Gemini CLI, OpenCode, Roo, Windsurf, Cline and Zed.
|
|
195
|
+
- **Shell access to every tool:** `cortex symbol | read | outline | refs |
|
|
196
|
+
impact`, `cortex tool <name> key=value`, and `POST /tools/{name}`.
|
|
197
|
+
- **Lean MCP profile:** `serve-mcp --tools core` (11 tools).
|
|
198
|
+
- Ingest respects `.gitignore` (including nested ones) and skips minified or
|
|
199
|
+
generated bundles; single files can be ingested.
|
|
200
|
+
- Markdown sections keep their text, so documented commands are retrievable.
|
|
201
|
+
|
|
202
|
+
## 0.3.4 and earlier
|
|
203
|
+
|
|
204
|
+
See the [commit history](https://github.com/RoshanGamage01/Cortex/commits/main).
|
|
@@ -3,9 +3,10 @@ include README.md
|
|
|
3
3
|
include pyproject.toml
|
|
4
4
|
recursive-include docs *.md *.mdc *.json
|
|
5
5
|
recursive-include examples *
|
|
6
|
-
recursive-include sdk
|
|
6
|
+
recursive-include sdk *.py *.toml *.ts *.json *.md
|
|
7
7
|
recursive-include src/cortex/static *
|
|
8
|
-
recursive-include scripts *.sh
|
|
8
|
+
recursive-include scripts *.sh *.py
|
|
9
|
+
include SECURITY.md CHANGELOG.md
|
|
9
10
|
global-exclude __pycache__ *.py[cod] .DS_Store *.map
|
|
10
11
|
prune .venv
|
|
11
12
|
prune tests
|
cortex_kg-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cortex-kg
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Cortex: a local code knowledge graph that gives AI coding agents context over MCP.
|
|
5
|
+
Author-email: Roshan Gamage <roshangamage01@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/RoshanGamage01/Cortex
|
|
8
|
+
Project-URL: Repository, https://github.com/RoshanGamage01/Cortex
|
|
9
|
+
Project-URL: Documentation, https://github.com/RoshanGamage01/Cortex/tree/main/docs
|
|
10
|
+
Project-URL: Issues, https://github.com/RoshanGamage01/Cortex/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/RoshanGamage01/Cortex/releases
|
|
12
|
+
Keywords: knowledge-graph,mcp,engineering,ai,local-first,rag,cursor,claude-code,coding-agents,code-search
|
|
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.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: kuzu>=0.11
|
|
29
|
+
Requires-Dist: lancedb>=0.15
|
|
30
|
+
Requires-Dist: pyarrow>=15
|
|
31
|
+
Requires-Dist: fastapi>=0.110
|
|
32
|
+
Requires-Dist: uvicorn[standard]>=0.29
|
|
33
|
+
Requires-Dist: watchdog>=4.0
|
|
34
|
+
Requires-Dist: tree-sitter>=0.21
|
|
35
|
+
Requires-Dist: tree-sitter-python>=0.23
|
|
36
|
+
Requires-Dist: tree-sitter-javascript>=0.23
|
|
37
|
+
Requires-Dist: tree-sitter-typescript>=0.23
|
|
38
|
+
Requires-Dist: tree-sitter-go>=0.23
|
|
39
|
+
Requires-Dist: tree-sitter-java>=0.23
|
|
40
|
+
Requires-Dist: pypdf>=4.0
|
|
41
|
+
Requires-Dist: pillow>=10.0
|
|
42
|
+
Requires-Dist: cryptography>=42.0
|
|
43
|
+
Requires-Dist: networkx>=3.2
|
|
44
|
+
Requires-Dist: pydantic>=2.6
|
|
45
|
+
Requires-Dist: mcp<2,>=1.10
|
|
46
|
+
Requires-Dist: httpx>=0.27
|
|
47
|
+
Requires-Dist: gitpython>=3.1
|
|
48
|
+
Requires-Dist: pyyaml>=6.0
|
|
49
|
+
Requires-Dist: neo4j>=5.19
|
|
50
|
+
Requires-Dist: jsonschema>=4.21
|
|
51
|
+
Requires-Dist: python-ulid>=2.2
|
|
52
|
+
Requires-Dist: sse-starlette>=2.0
|
|
53
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
54
|
+
Provides-Extra: dev
|
|
55
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
57
|
+
Requires-Dist: httpx2>=2.0; extra == "dev"
|
|
58
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
59
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
60
|
+
Provides-Extra: ocr
|
|
61
|
+
Requires-Dist: pytesseract>=0.3; extra == "ocr"
|
|
62
|
+
Provides-Extra: server
|
|
63
|
+
Requires-Dist: neo4j>=5.19; extra == "server"
|
|
64
|
+
Dynamic: license-file
|
|
65
|
+
|
|
66
|
+
# Cortex — a code knowledge graph for AI coding agents
|
|
67
|
+
|
|
68
|
+
Cortex indexes a repository into a local knowledge graph — every function,
|
|
69
|
+
class and file with its signature, location, callers and callees, plus the
|
|
70
|
+
docs, decisions and notes around them — and serves it to coding agents
|
|
71
|
+
(Claude Code, Cursor, Copilot, Codex, Gemini CLI, …) over MCP, HTTP and the
|
|
72
|
+
shell.
|
|
73
|
+
|
|
74
|
+
Instead of grepping and reading whole files, an agent asks one question and
|
|
75
|
+
gets back what it needs to act:
|
|
76
|
+
|
|
77
|
+
````text
|
|
78
|
+
$ cortex context "how is the natural key index kept in sync"
|
|
79
|
+
|
|
80
|
+
# Cortex context: how is the natural key index kept in sync
|
|
81
|
+
|
|
82
|
+
### `KuzuGraphStore._natural_keys` · method · src/cortex/storage/graph_store.py:211-229
|
|
83
|
+
`def _natural_keys(self) -> dict[tuple[str, str, str], str]`
|
|
84
|
+
Caller must hold ``self._lock``.
|
|
85
|
+
- calls: _symbol_leaf (src/cortex/storage/graph_store.py:169-173)
|
|
86
|
+
- called by: KuzuGraphStore.find_by_natural_key (src/cortex/storage/graph_store.py:382-385), KuzuGraphStore.find_by_natural_keys (src/cortex/storage/graph_store.py:387-403), KuzuGraphStore.symbols_named (src/cortex/storage/graph_store.py:269-279)
|
|
87
|
+
- member of: KuzuGraphStore (src/cortex/storage/graph_store.py:181-730)
|
|
88
|
+
…
|
|
89
|
+
````
|
|
90
|
+
|
|
91
|
+
Everything runs locally (Kuzu + LanceDB + SQLite, all embedded). No account,
|
|
92
|
+
no network, no model download.
|
|
93
|
+
|
|
94
|
+
## Quick start
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pipx install cortex-kg # or: python -m pip install cortex-kg
|
|
98
|
+
|
|
99
|
+
cd your-repo
|
|
100
|
+
cortex init # index it + connect the coding agents it uses
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`cortex init` binds the repo to its own workspace, indexes it (about 3 seconds for a ~200-file repo, under 30 for 400k lines of
|
|
104
|
+
Python; re-runs only touch changed files) and writes the
|
|
105
|
+
MCP config and a short instruction block for the agents it finds in the
|
|
106
|
+
project. Choose explicitly with `--agents claude-code,cursor,codex` or
|
|
107
|
+
`--agents all`.
|
|
108
|
+
|
|
109
|
+
Then ask your agent something about the code — or try it yourself:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cortex context "what is this project?"
|
|
113
|
+
cortex symbol AuthService # where is it defined?
|
|
114
|
+
cortex read AuthService.login # its current source
|
|
115
|
+
cortex refs AuthService.login # who calls it
|
|
116
|
+
cortex impact src/auth_service.py # what breaks if this changes + tests to run
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Windows:** if `cortex` is “not recognized”, run `pipx ensurepath` and open a
|
|
120
|
+
new terminal, or use `python -m cortex …` (same CLI). Details:
|
|
121
|
+
[docs/installation.md](docs/installation.md#windows).
|
|
122
|
+
|
|
123
|
+
## What agents get
|
|
124
|
+
|
|
125
|
+
| Tool | Use it for |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `get_context(query)` | **Start here.** A token-budgeted brief: for each result its `path:line` range, signature, docstring, what it calls / what calls it, and current source for the top hits. “What depends on X” adds an impact list; “how do I run the tests” answers from the docs. |
|
|
128
|
+
| `find_symbol(name)` | Where a function / class / method is defined. |
|
|
129
|
+
| `read_symbol(target)` | Current source of a symbol or file — no line numbers needed. |
|
|
130
|
+
| `file_outline(path)` | Every symbol in a file with line ranges and signatures. |
|
|
131
|
+
| `find_references(target)` | Direct callers, importers, subclasses (or callees with `direction="out"`). |
|
|
132
|
+
| `explain_impact(target)` | Transitive blast radius, affected files, tests to run. |
|
|
133
|
+
| `search_knowledge(query)` | Ranked candidates rather than a written brief. |
|
|
134
|
+
| `get_orientation()` | One-page tour of an unfamiliar repo. |
|
|
135
|
+
| `add_note(...)` | Record a decision or gotcha so it outlives the session. |
|
|
136
|
+
| `workspace_status()` / `index_path(path)` | What is indexed; index more. |
|
|
137
|
+
|
|
138
|
+
Plus review tools (`review_delta`, `review_analysis`), raw graph access
|
|
139
|
+
(`get_node`, `traverse`), and multi-project / multi-workspace search — 24 in
|
|
140
|
+
all. `cortex serve-mcp --tools core` exposes just the 11 above for agents
|
|
141
|
+
where every tool definition costs context.
|
|
142
|
+
|
|
143
|
+
Three properties make these safe to rely on:
|
|
144
|
+
|
|
145
|
+
- **Targets are what the agent already has.** A symbol name, a path,
|
|
146
|
+
`path:line` from a stack trace, or `path#Symbol` from an earlier result.
|
|
147
|
+
Node ids are never required.
|
|
148
|
+
- **Answers follow the working tree.** Before a result is returned, the files
|
|
149
|
+
behind it are checked against the index and re-synced if they changed — so
|
|
150
|
+
line ranges and call graphs reflect the agent's own uncommitted edits.
|
|
151
|
+
Deleted functions and files leave the graph. Source is always read live
|
|
152
|
+
from disk, never from a stored copy.
|
|
153
|
+
- **Output is built for a context window.** Repo-relative locations, compact
|
|
154
|
+
rows, bounded lists that say when they are truncated, and a hint for what
|
|
155
|
+
to do when the answer is empty.
|
|
156
|
+
|
|
157
|
+
## Supported agents
|
|
158
|
+
|
|
159
|
+
`cortex init` / `cortex setup agents --write` handle these; config files are
|
|
160
|
+
merged (never overwritten) and instructions go in a marked block you can
|
|
161
|
+
re-generate safely.
|
|
162
|
+
|
|
163
|
+
| Agent | MCP config | Instructions |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| Claude Code | `.mcp.json` | `CLAUDE.md` |
|
|
166
|
+
| Cursor | `.cursor/mcp.json` | `.cursor/rules/cortex.mdc` |
|
|
167
|
+
| VS Code (Copilot) | `.vscode/mcp.json` + `.mcp.json` | `.github/copilot-instructions.md` |
|
|
168
|
+
| OpenAI Codex CLI | `.codex/config.toml` (`--global` for `~/.codex`) | `AGENTS.md` |
|
|
169
|
+
| Gemini CLI | `.gemini/settings.json` | `GEMINI.md` |
|
|
170
|
+
| OpenCode | `opencode.json` | `AGENTS.md` |
|
|
171
|
+
| Roo Code | `.roo/mcp.json` | `.roo/rules/cortex.md` |
|
|
172
|
+
| Windsurf, Cline, Zed | printed for you to paste (`cortex setup <tool>`) | rules file / `AGENTS.md` |
|
|
173
|
+
| Claude Desktop | `cortex setup claude --write` | — |
|
|
174
|
+
| anything else | `cortex setup mcp` prints the generic entry | `AGENTS.md` |
|
|
175
|
+
|
|
176
|
+
Agents with only a shell can use the same tools as commands (`cortex context`,
|
|
177
|
+
`cortex symbol`, … or `cortex tool <name> key=value`). Anything that speaks
|
|
178
|
+
HTTP can `POST /tools/{name}` on the daemon.
|
|
179
|
+
|
|
180
|
+
More: **[docs/agents.md](docs/agents.md)**.
|
|
181
|
+
|
|
182
|
+
## The shared daemon and the Brain UI (optional)
|
|
183
|
+
|
|
184
|
+
The embedded graph database allows one writer process. For a single agent
|
|
185
|
+
that is fine — the MCP server it spawns owns the graph. To use several
|
|
186
|
+
clients at once (two editors, the CLI, the web UI), start the daemon and
|
|
187
|
+
everything talks to it instead:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
cortex up # http://127.0.0.1:8420 — REST API, /mcp, and the web UI
|
|
191
|
+
cortex down
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The daemon binds to loopback, only accepts loopback `Host` headers and only
|
|
195
|
+
lets localhost pages read its responses: it is unauthenticated and can read
|
|
196
|
+
your source, so it is not exposed to the network unless you ask
|
|
197
|
+
(`serve-api --host`, `CORTEX_ALLOWED_HOSTS`, `CORTEX_CORS_ORIGINS`).
|
|
198
|
+
|
|
199
|
+
Open that address in a browser for the web UI: an overview of what is
|
|
200
|
+
indexed, a module map that stays readable on large repositories, a 3D
|
|
201
|
+
"universe" of every file and symbol and how they use each other, a view of
|
|
202
|
+
any symbol's callers / source / impact, and a preview of exactly what an
|
|
203
|
+
agent receives for a question. See [docs/cortex-brain.md](docs/cortex-brain.md).
|
|
204
|
+
|
|
205
|
+
## What gets indexed
|
|
206
|
+
|
|
207
|
+
- **Code** (Python, JavaScript/TypeScript, Go, Java via tree-sitter): files,
|
|
208
|
+
classes, interfaces, functions and methods — private ones included — with
|
|
209
|
+
signature, docstring / doc comment, line range, and `contains` / `imports` /
|
|
210
|
+
`calls` / `extends` / `implements` edges. Method calls through attributes
|
|
211
|
+
(`self.store.search()`) are resolved across files using the receiver's name
|
|
212
|
+
as a hint and marked lower-confidence.
|
|
213
|
+
- **Docs**: Markdown documents and their sections (with the section text,
|
|
214
|
+
commands included), ADRs, notes, PDFs, OpenAPI specs, SQL schemas. Links
|
|
215
|
+
between docs, and from docs to code files, become edges.
|
|
216
|
+
- **History**: authors and co-change from git.
|
|
217
|
+
- **What agents write back** with `add_note` / `link`.
|
|
218
|
+
|
|
219
|
+
Not indexed: anything your `.gitignore` ignores, dependency and build
|
|
220
|
+
directories, lockfiles, minified or generated bundles, `.env` and key files,
|
|
221
|
+
and editor/agent config. Add a `.cortexignore` (gitignore syntax) to exclude
|
|
222
|
+
more or to re-include something with `!path`.
|
|
223
|
+
|
|
224
|
+
## Useful commands
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
cortex ingest . --project MyApp # (re)index; incremental
|
|
228
|
+
cortex watch . --project MyApp # re-sync on every save
|
|
229
|
+
cortex search "rate limit" --json
|
|
230
|
+
cortex review delta --staged # blast radius of what you are about to commit
|
|
231
|
+
cortex orient # orientation report
|
|
232
|
+
cortex doctor # diagnose binding / config problems
|
|
233
|
+
cortex workspaces list
|
|
234
|
+
cortex tool list # every agent tool, callable from the shell
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Data lives in `~/.cortex/<workspace>/` (override with `CORTEX_HOME`).
|
|
238
|
+
|
|
239
|
+
| Setting | Effect |
|
|
240
|
+
|---|---|
|
|
241
|
+
| `CORTEX_HOME` | Where workspaces are stored |
|
|
242
|
+
| `CORTEX_MCP_TOOLS=core` | Lean MCP tool profile |
|
|
243
|
+
| `CORTEX_AUTO_REFRESH=0` | Disable read-time / background re-sync |
|
|
244
|
+
| `CORTEX_RESPECT_GITIGNORE=0` | Index git-ignored files too |
|
|
245
|
+
| `CORTEX_MAX_FILE_BYTES` | Size above which a source file is treated as generated |
|
|
246
|
+
| `CORTEX_ALLOWED_HOSTS`, `CORTEX_CORS_ORIGINS` | Widen who may call the daemon |
|
|
247
|
+
| `CORTEX_DEBUG=1` | Full tracebacks from the CLI |
|
|
248
|
+
|
|
249
|
+
## Guides
|
|
250
|
+
|
|
251
|
+
| Guide | |
|
|
252
|
+
|---|---|
|
|
253
|
+
| [docs/agents.md](docs/agents.md) | **Connecting coding agents; tool reference** |
|
|
254
|
+
| [docs/installation.md](docs/installation.md) | Install, first run |
|
|
255
|
+
| [docs/project-workflow.md](docs/project-workflow.md) | Workspaces, projects, keeping the index current |
|
|
256
|
+
| [docs/cursor.md](docs/cursor.md) | Cursor specifics and troubleshooting |
|
|
257
|
+
| [docs/other-platforms.md](docs/other-platforms.md) | REST API, SDKs, CI |
|
|
258
|
+
| [docs/cortex-brain.md](docs/cortex-brain.md) | The web UI |
|
|
259
|
+
| [docs/automation.md](docs/automation.md) | Watch mode, hooks, cron |
|
|
260
|
+
| [SECURITY.md](SECURITY.md) | Supply-chain guards, incident record, reporting |
|
|
261
|
+
| [CHANGELOG.md](CHANGELOG.md) | Release notes |
|
|
262
|
+
|
|
263
|
+
## How it works
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Sources (code, git, docs, PDFs, schemas, API specs, notes, plugins)
|
|
267
|
+
-> Extractors deterministic parsers emit candidate nodes/edges
|
|
268
|
+
-> Entity resolver merges candidates, replaces what a re-extracted source
|
|
269
|
+
said before, prunes what it no longer says
|
|
270
|
+
-> Storage Kuzu (graph) · SQLite FTS5 (keyword) · LanceDB (vectors)
|
|
271
|
+
· SQLite (provenance, sync manifest, jobs, ACLs, ontology)
|
|
272
|
+
-> Retrieval keyword + vector seeds -> rank fusion -> relevance re-rank
|
|
273
|
+
-> one-hop graph expansion
|
|
274
|
+
-> Context token-budgeted briefs with live source
|
|
275
|
+
-> Access MCP (stdio / HTTP) · REST · CLI · Python/TS SDKs
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Node and edge types are data, not code: the ontology is a registry
|
|
279
|
+
(`cortex.ontology.registry`) that extractors, plugins and clients extend at
|
|
280
|
+
runtime.
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
src/cortex/
|
|
284
|
+
cli.py the `cortex` command
|
|
285
|
+
daemon.py CortexDaemon: owns every store for one workspace
|
|
286
|
+
extractors/ code (tree-sitter), markdown, git, schema, OpenAPI, PDF, notes, …
|
|
287
|
+
ingestion/ pipeline, entity resolver, ignore rules
|
|
288
|
+
storage/ graph, keyword, vector and provenance stores
|
|
289
|
+
retrieval/ search, ranking, target lookup, traversal / impact
|
|
290
|
+
context/ context briefs and agent-facing presentation
|
|
291
|
+
mcp_server/ tools.py (the one tool implementation) + transports
|
|
292
|
+
setup/ agent config generators
|
|
293
|
+
sync/ watcher, read-time freshness, change feed, job queue
|
|
294
|
+
api/ REST API, HTTP tool endpoint, Brain UI backend
|
|
295
|
+
analysis/, review/ hubs, flows, orientation, change review
|
|
296
|
+
security/, workspace/, versioning/, plugins/, replication/, server_profile/
|
|
297
|
+
sdk/ Python and TypeScript REST clients
|
|
298
|
+
web/ Web UI source (built into src/cortex/static/brain)
|
|
299
|
+
tests/ 213 tests
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Design notes:
|
|
303
|
+
|
|
304
|
+
- **Embeddings are lexical by default** (`HashingEmbeddingProvider`, a hashed
|
|
305
|
+
character-trigram vector) so nothing is downloaded and everything works
|
|
306
|
+
offline. They add recall for docs; code retrieval leans on the name-weighted
|
|
307
|
+
keyword index and the graph. A trained model can be plugged in by
|
|
308
|
+
implementing `EmbeddingProvider`.
|
|
309
|
+
- **No type inference.** Call edges come from syntax plus naming; calls through
|
|
310
|
+
attributes are best-effort and carry lower confidence than direct calls.
|
|
311
|
+
- **A team-scale profile** (`server_profile/`: Neo4j / Memgraph behind the same
|
|
312
|
+
`GraphStore` port) exists but the embedded stores are the tested path.
|
|
313
|
+
|
|
314
|
+
## Development
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
git clone https://github.com/RoshanGamage01/Cortex.git && cd Cortex
|
|
318
|
+
git config core.hooksPath .githooks # supply-chain scan on commit and push
|
|
319
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
320
|
+
pip install -e ".[dev]"
|
|
321
|
+
python -m pytest tests/ -q
|
|
322
|
+
python scripts/security_scan.py --all-history
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
MIT licensed.
|