cortex-kg 0.2.2__tar.gz → 0.3.1__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.
Files changed (127) hide show
  1. {cortex_kg-0.2.2/src/cortex_kg.egg-info → cortex_kg-0.3.1}/PKG-INFO +1 -1
  2. cortex_kg-0.3.1/docs/benchmarks/graphify-vs-cortex-2026-07-25-post.json +99 -0
  3. cortex_kg-0.3.1/docs/benchmarks/graphify-vs-cortex-2026-07-25-rerun.json +112 -0
  4. cortex_kg-0.3.1/docs/benchmarks/graphify-vs-cortex-2026-07-25.json +179 -0
  5. cortex_kg-0.3.1/docs/benchmarks/graphify-vs-cortex-2026-07-25.md +127 -0
  6. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/cortex-brain.md +43 -26
  7. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/cursor.md +31 -25
  8. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/installation.md +3 -0
  9. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/other-platforms.md +8 -6
  10. cortex_kg-0.3.1/docs/templates/cortex-mcp.json +11 -0
  11. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/pyproject.toml +1 -1
  12. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/__init__.py +1 -1
  13. cortex_kg-0.3.1/src/cortex/__main__.py +6 -0
  14. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/api/graph_viz.py +29 -12
  15. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/api/rest.py +135 -3
  16. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/api/workspace_viz.py +4 -2
  17. cortex_kg-0.3.1/src/cortex/api_client.py +77 -0
  18. cortex_kg-0.3.1/src/cortex/cli.py +578 -0
  19. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/config.py +3 -0
  20. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/context/generator.py +16 -1
  21. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/daemon.py +14 -13
  22. cortex_kg-0.3.1/src/cortex/evidence.py +70 -0
  23. cortex_kg-0.3.1/src/cortex/export/__init__.py +1 -0
  24. cortex_kg-0.3.1/src/cortex/export/studio.py +247 -0
  25. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/base.py +3 -0
  26. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/code_extractor.py +7 -0
  27. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/ingestion/pipeline.py +135 -19
  28. cortex_kg-0.3.1/src/cortex/ingestion/resolver.py +207 -0
  29. cortex_kg-0.3.1/src/cortex/mcp_server/server.py +424 -0
  30. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/ontology/registry.py +14 -10
  31. cortex_kg-0.3.1/src/cortex/project_binding.py +51 -0
  32. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/retrieval/query_engine.py +92 -7
  33. cortex_kg-0.3.1/src/cortex/review/__init__.py +1 -0
  34. cortex_kg-0.3.1/src/cortex/review/pack.py +141 -0
  35. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/security/acl.py +27 -25
  36. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/setup/generators.py +83 -11
  37. cortex_kg-0.3.1/src/cortex/static/brain/assets/index-ChFJ4Pm_.css +1 -0
  38. cortex_kg-0.3.1/src/cortex/static/brain/assets/index-DBshxnnz.js +486 -0
  39. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/static/brain/index.html +2 -2
  40. cortex_kg-0.3.1/src/cortex/storage/graph_store.py +438 -0
  41. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/storage/keyword_store.py +16 -3
  42. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/storage/provenance.py +155 -37
  43. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/storage/vector_store.py +32 -26
  44. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/workspace/registry.py +39 -24
  45. {cortex_kg-0.2.2 → cortex_kg-0.3.1/src/cortex_kg.egg-info}/PKG-INFO +1 -1
  46. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex_kg.egg-info/SOURCES.txt +14 -2
  47. cortex_kg-0.2.2/docs/templates/cortex-mcp.json +0 -11
  48. cortex_kg-0.2.2/src/cortex/cli.py +0 -238
  49. cortex_kg-0.2.2/src/cortex/ingestion/resolver.py +0 -131
  50. cortex_kg-0.2.2/src/cortex/mcp_server/server.py +0 -189
  51. cortex_kg-0.2.2/src/cortex/static/brain/assets/index-BUW5gdiE.js +0 -486
  52. cortex_kg-0.2.2/src/cortex/static/brain/assets/index-C5hkz5MJ.css +0 -1
  53. cortex_kg-0.2.2/src/cortex/storage/graph_store.py +0 -405
  54. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/LICENSE +0 -0
  55. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/MANIFEST.in +0 -0
  56. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/README.md +0 -0
  57. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/README.md +0 -0
  58. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/automation.md +0 -0
  59. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/project-workflow.md +0 -0
  60. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/publishing.md +0 -0
  61. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/docs/templates/cortex-agent-rule.mdc +0 -0
  62. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/examples/sample_repo/api/openapi.yaml +0 -0
  63. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/examples/sample_repo/docs/adr-001-session-tokens.md +0 -0
  64. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/examples/sample_repo/docs/architecture.md +0 -0
  65. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/examples/sample_repo/notes/meeting-2026-07-10-billing-sync.md +0 -0
  66. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/examples/sample_repo/schema/schema.sql +0 -0
  67. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/examples/sample_repo/src/auth_service.py +0 -0
  68. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/examples/sample_repo/src/billing_service.py +0 -0
  69. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/scripts/build_brain_ui.sh +0 -0
  70. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/sdk/python/cortex_sdk/__init__.py +0 -0
  71. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/sdk/python/pyproject.toml +0 -0
  72. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/sdk/typescript/package.json +0 -0
  73. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/sdk/typescript/src/index.ts +0 -0
  74. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/sdk/typescript/tsconfig.json +0 -0
  75. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/setup.cfg +0 -0
  76. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/agents/__init__.py +0 -0
  77. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/agents/hooks.py +0 -0
  78. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/agents/writeback.py +0 -0
  79. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/api/__init__.py +0 -0
  80. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/context/__init__.py +0 -0
  81. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/__init__.py +0 -0
  82. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/api_spec_extractor.py +0 -0
  83. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/db_schema_extractor.py +0 -0
  84. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/git_extractor.py +0 -0
  85. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/image_extractor.py +0 -0
  86. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/llm_relation_extractor.py +0 -0
  87. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/markdown_extractor.py +0 -0
  88. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/notes_extractor.py +0 -0
  89. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/extractors/pdf_extractor.py +0 -0
  90. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/ingestion/__init__.py +0 -0
  91. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/ingestion/content_hash.py +0 -0
  92. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/mcp_server/__init__.py +0 -0
  93. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/models.py +0 -0
  94. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/offline/__init__.py +0 -0
  95. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/offline/local_llm.py +0 -0
  96. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/ontology/__init__.py +0 -0
  97. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/plugins/__init__.py +0 -0
  98. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/plugins/examples/jira_like_plugin/plugin.py +0 -0
  99. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/plugins/interface.py +0 -0
  100. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/plugins/loader.py +0 -0
  101. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/replication/__init__.py +0 -0
  102. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/replication/crdt.py +0 -0
  103. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/retrieval/__init__.py +0 -0
  104. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/retrieval/embeddings.py +0 -0
  105. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/retrieval/fusion.py +0 -0
  106. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/retrieval/planner.py +0 -0
  107. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/retrieval/traversal.py +0 -0
  108. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/security/__init__.py +0 -0
  109. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/security/audit.py +0 -0
  110. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/security/encryption.py +0 -0
  111. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/security/secrets_scanner.py +0 -0
  112. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/server_profile/__init__.py +0 -0
  113. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/server_profile/neo4j_store.py +0 -0
  114. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/setup/__init__.py +0 -0
  115. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/storage/__init__.py +0 -0
  116. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/sync/__init__.py +0 -0
  117. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/sync/change_feed.py +0 -0
  118. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/sync/job_queue.py +0 -0
  119. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/sync/watcher.py +0 -0
  120. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/versioning/__init__.py +0 -0
  121. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/versioning/bitemporal.py +0 -0
  122. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/workspace/__init__.py +0 -0
  123. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex/workspace/federation.py +0 -0
  124. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex_kg.egg-info/dependency_links.txt +0 -0
  125. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex_kg.egg-info/entry_points.txt +0 -0
  126. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex_kg.egg-info/requires.txt +0 -0
  127. {cortex_kg-0.2.2 → cortex_kg-0.3.1}/src/cortex_kg.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortex-kg
3
- Version: 0.2.2
3
+ Version: 0.3.1
4
4
  Summary: Cortex: a persistent, workspace-level Engineering Knowledge Graph.
5
5
  Author-email: Roshan Gamage <roshangamage01@users.noreply.github.com>
6
6
  License: MIT
@@ -0,0 +1,99 @@
1
+ {
2
+ "date": "2026-07-25",
3
+ "post_optimization": true,
4
+ "ingest": {
5
+ "sample_repo": {
6
+ "full": {
7
+ "wall_sec": 0.928,
8
+ "files_extracted": 7,
9
+ "candidates": 74,
10
+ "nodes_created": 38,
11
+ "edges_created": 30,
12
+ "extract_ms": 3.1,
13
+ "resolve_ms": 581.8,
14
+ "link_ms": 337.4
15
+ },
16
+ "fast": {
17
+ "wall_sec": 0.089,
18
+ "files_extracted": 2,
19
+ "candidates": 8,
20
+ "nodes_created": 7,
21
+ "edges_created": 1,
22
+ "extract_ms": 0.5,
23
+ "resolve_ms": 72.5,
24
+ "link_ms": 9.7
25
+ }
26
+ },
27
+ "web/src": {
28
+ "full": {
29
+ "wall_sec": 1.676,
30
+ "files_extracted": 25,
31
+ "candidates": 124,
32
+ "nodes_created": 80,
33
+ "edges_created": 29,
34
+ "extract_ms": 32.3,
35
+ "resolve_ms": 916.9,
36
+ "link_ms": 709.2
37
+ },
38
+ "fast": {
39
+ "wall_sec": 0.691,
40
+ "files_extracted": 25,
41
+ "candidates": 66,
42
+ "nodes_created": 66,
43
+ "edges_created": 0,
44
+ "extract_ms": 24.5,
45
+ "resolve_ms": 635.6,
46
+ "link_ms": 12.7
47
+ }
48
+ },
49
+ "src/cortex": {
50
+ "full": {
51
+ "wall_sec": 22.433,
52
+ "files_extracted": 78,
53
+ "candidates": 2060,
54
+ "nodes_created": 1160,
55
+ "edges_created": 436,
56
+ "extract_ms": 213.3,
57
+ "resolve_ms": 13026.6,
58
+ "link_ms": 9145.7
59
+ },
60
+ "fast": {
61
+ "wall_sec": 9.507,
62
+ "files_extracted": 78,
63
+ "candidates": 1260,
64
+ "nodes_created": 1077,
65
+ "edges_created": 36,
66
+ "extract_ms": 219.2,
67
+ "resolve_ms": 9231.9,
68
+ "link_ms": 10.9
69
+ }
70
+ }
71
+ },
72
+ "concurrency": {
73
+ "errors_per_burst": [
74
+ 0,
75
+ 0,
76
+ 0,
77
+ 0,
78
+ 0
79
+ ],
80
+ "wall_ms_per_burst": [
81
+ 8.1,
82
+ 6.3,
83
+ 6.0,
84
+ 6.8,
85
+ 6.6
86
+ ],
87
+ "total_errors": 0
88
+ },
89
+ "query": {
90
+ "search_ms_median": 11.54,
91
+ "token_estimate": 886,
92
+ "naive_baseline_tokens": 4051,
93
+ "reduction_factor": 4.57
94
+ },
95
+ "soak_30s": {
96
+ "ok": 35840,
97
+ "errors": 0
98
+ }
99
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "date": "2026-07-25",
3
+ "label": "fresh-rerun",
4
+ "ingest": {
5
+ "sample_repo": {
6
+ "full": {
7
+ "wall_sec": 1.01,
8
+ "files_extracted": 7,
9
+ "candidates": 74,
10
+ "nodes_created": 38,
11
+ "edges_created": 30,
12
+ "extract_ms": 4.7,
13
+ "resolve_ms": 632.4,
14
+ "link_ms": 363.1
15
+ },
16
+ "fast": {
17
+ "wall_sec": 0.091,
18
+ "files_extracted": 2,
19
+ "candidates": 8,
20
+ "nodes_created": 7,
21
+ "edges_created": 1,
22
+ "extract_ms": 0.8,
23
+ "resolve_ms": 72.7,
24
+ "link_ms": 11.1
25
+ }
26
+ },
27
+ "web/src": {
28
+ "full": {
29
+ "wall_sec": 1.849,
30
+ "files_extracted": 25,
31
+ "candidates": 124,
32
+ "nodes_created": 80,
33
+ "edges_created": 29,
34
+ "extract_ms": 44.8,
35
+ "resolve_ms": 1009.3,
36
+ "link_ms": 772.6
37
+ },
38
+ "fast": {
39
+ "wall_sec": 0.65,
40
+ "files_extracted": 25,
41
+ "candidates": 66,
42
+ "nodes_created": 66,
43
+ "edges_created": 0,
44
+ "extract_ms": 26.5,
45
+ "resolve_ms": 596.1,
46
+ "link_ms": 9.3
47
+ }
48
+ },
49
+ "src/cortex": {
50
+ "full": {
51
+ "wall_sec": 23.641,
52
+ "files_extracted": 78,
53
+ "candidates": 2060,
54
+ "nodes_created": 1160,
55
+ "edges_created": 436,
56
+ "extract_ms": 209.8,
57
+ "resolve_ms": 13503.8,
58
+ "link_ms": 9870.7
59
+ },
60
+ "fast": {
61
+ "wall_sec": 9.464,
62
+ "files_extracted": 78,
63
+ "candidates": 1260,
64
+ "nodes_created": 1077,
65
+ "edges_created": 36,
66
+ "extract_ms": 233.6,
67
+ "resolve_ms": 9167.0,
68
+ "link_ms": 9.5
69
+ }
70
+ }
71
+ },
72
+ "concurrency": {
73
+ "errors_per_burst": [
74
+ 0,
75
+ 0,
76
+ 0,
77
+ 0,
78
+ 0
79
+ ],
80
+ "wall_ms_per_burst": [
81
+ 7.3,
82
+ 5.7,
83
+ 6.9,
84
+ 6.4,
85
+ 7.0
86
+ ],
87
+ "total_errors": 0
88
+ },
89
+ "query": {
90
+ "search_ms_median": 0.8,
91
+ "context_ms": 20.9,
92
+ "token_estimate": 895,
93
+ "naive_baseline_tokens": 4051,
94
+ "reduction_factor": 4.53
95
+ },
96
+ "graphify": {
97
+ "sample_repo": {
98
+ "wall_sec": 0.344,
99
+ "exit": 1,
100
+ "stderr_tail": "error: detected non-code corpus files that require semantic extraction; provide --semantic <path>, pass --backend <provider>, or use the graphify assistant skill/runtime pipeline.\n"
101
+ },
102
+ "web/src": {
103
+ "wall_sec": 0.386,
104
+ "exit": 0,
105
+ "stderr_tail": "eal description. A ~0%-description graph almost always means the description pass never ran. Run `graphify describe .` (no API key needed \u2014 assistant mode) before exporting for non-null descriptions.\n"
106
+ }
107
+ },
108
+ "soak_30s": {
109
+ "ok": 35384,
110
+ "errors": 0
111
+ }
112
+ }
@@ -0,0 +1,179 @@
1
+ {
2
+ "meta": {
3
+ "graphify_version": "0.16.0",
4
+ "cortex_install": "/Users/roshan/Projects/Cortex/.venv/bin/cortex",
5
+ "cortex_api": "http://127.0.0.1:8420",
6
+ "notes": [
7
+ "Graphify headless extract is AST/code-only here (--no-description/--no-label; no LLM).",
8
+ "Mixed corpus (md/docs) requires Graphify semantic backend; Cortex ingests mixed corpus natively.",
9
+ "Fair cold builds: sample code-only, web/src, Cortex src/ vs prior Cortex ingest benches."
10
+ ]
11
+ },
12
+ "build_ingest": {
13
+ "graphify_cold_sample_code_only": {
14
+ "wall_s": 0.23,
15
+ "nodes": 15,
16
+ "links": 17,
17
+ "files": 2
18
+ },
19
+ "graphify_cold_web_src": {
20
+ "wall_s": 0.37,
21
+ "nodes": 157,
22
+ "links": 323,
23
+ "files": 25
24
+ },
25
+ "graphify_cold_cortex_src": {
26
+ "wall_s": 0.64,
27
+ "nodes": 643,
28
+ "links": 1264,
29
+ "files": 70,
30
+ "communities": 62
31
+ },
32
+ "graphify_full_repo_auto_scope": {
33
+ "ok": false,
34
+ "error": "requires semantic extraction for non-code corpus"
35
+ },
36
+ "cortex_cold_sample": {
37
+ "wall_s": 1.31,
38
+ "server_s": 1.17,
39
+ "nodes_created": 38,
40
+ "edges_created": 30,
41
+ "files_extracted": 7
42
+ },
43
+ "cortex_cold_web_src": {
44
+ "wall_s": 2.43,
45
+ "server_s": 2.34,
46
+ "nodes_created": 79,
47
+ "edges_created": 29,
48
+ "files_extracted": 25
49
+ },
50
+ "cortex_incremental_full_repo": {
51
+ "wall_s": 27.34,
52
+ "server_s": 27.27,
53
+ "files_extracted": 22,
54
+ "files_skipped": 144,
55
+ "nodes_created": 59,
56
+ "edges_created": 192
57
+ },
58
+ "cortex_graph_after": {
59
+ "nodes": 1492,
60
+ "edges": 2234
61
+ }
62
+ },
63
+ "query_latency_ms": {
64
+ "graphify_query_AuthService_sample": {
65
+ "median_ms": 95.8,
66
+ "mean_ms": 95.69,
67
+ "out_bytes": 1837,
68
+ "ok": true,
69
+ "preview": "NODE AuthService [src=src/auth_service.py loc=L9 community=2] | NODE BillingService [src=src/billing_service.py loc=L7 community=0] | NODE auth_service.py [src=src/auth_service.py loc="
70
+ },
71
+ "graphify_query_daemon_src": {
72
+ "median_ms": 101.84,
73
+ "mean_ms": 102.12,
74
+ "out_bytes": 2438,
75
+ "ok": true,
76
+ "preview": "NODE Node [src=cortex/models.py loc=L90 community=0] | NODE Edge [src=cortex/models.py loc=L137 community=0] | NODE Provenance [src=cortex/models.py loc=L62 community=22] | NODE CortexDa"
77
+ },
78
+ "graphify_explain": {
79
+ "median_ms": 99.99,
80
+ "mean_ms": 100.62,
81
+ "out_bytes": 380,
82
+ "ok": true,
83
+ "preview": "Node: get_daemon() | ID: daemon_get_daemon | Source: cortex/daemon.py L129 | Type: code | Community: 28 | Degree: 4 | | Connections (4): | --> CortexDaemon [calls] ["
84
+ },
85
+ "graphify_summary": {
86
+ "median_ms": 101.47,
87
+ "mean_ms": 101.17,
88
+ "out_bytes": 1237,
89
+ "ok": true,
90
+ "preview": "Graphify First-Hop Summary | Graph: 643 nodes, 1264 edges, 62 communities, density 0.0061, average degree 3.9316, undirected | | Top hubs: | 1. Node (degree 77, community 0 Community 0,"
91
+ },
92
+ "cortex_search_AuthService": {
93
+ "median_ms": 0.71,
94
+ "mean_ms": 9.8,
95
+ "min_ms": 0.62,
96
+ "max_ms": 46.24
97
+ },
98
+ "cortex_context_ingest": {
99
+ "median_ms": 28.96,
100
+ "mean_ms": 45.69,
101
+ "min_ms": 28.73,
102
+ "max_ms": 79.36
103
+ },
104
+ "cortex_impact": {
105
+ "median_ms": 17.35,
106
+ "mean_ms": 17.67,
107
+ "min_ms": 17.22,
108
+ "max_ms": 18.44
109
+ },
110
+ "cortex_path": {
111
+ "median_ms": 9.15,
112
+ "mean_ms": 9.19,
113
+ "min_ms": 8.97,
114
+ "max_ms": 9.44
115
+ },
116
+ "cortex_snapshot_500": {
117
+ "median_ms": 15.42,
118
+ "mean_ms": 15.55,
119
+ "min_ms": 15.18,
120
+ "max_ms": 16.06
121
+ },
122
+ "cortex_mcp_initialize": {
123
+ "median_ms": 1.34,
124
+ "mean_ms": 2.83,
125
+ "min_ms": 1.29,
126
+ "max_ms": 5.87
127
+ },
128
+ "cortex_cli_search": {
129
+ "median_ms": 53.65,
130
+ "mean_ms": 54.54,
131
+ "min_ms": 52.12,
132
+ "max_ms": 57.86
133
+ }
134
+ },
135
+ "concurrency": {
136
+ "graphify_8_query_wall_ms": {
137
+ "median": 208.56,
138
+ "max": 245.33
139
+ },
140
+ "graphify_8_json_load_ms": {
141
+ "median": 6.72
142
+ },
143
+ "cortex_8_search_wall_ms": {
144
+ "median": 78.08,
145
+ "max": 258.7,
146
+ "errors_per_burst": [
147
+ 2,
148
+ 0,
149
+ 0
150
+ ]
151
+ },
152
+ "cortex_simultaneous_ingest_search_mcp": {
153
+ "lock_conflicts": 0,
154
+ "ok": true
155
+ }
156
+ },
157
+ "architecture": {
158
+ "graphify": {
159
+ "storage": ".graphify/graph.json (file)",
160
+ "multi_process": "yes (multi-reader JSON)",
161
+ "mcp": "stdio graphify serve",
162
+ "ui": "static Ontology Studio (export)",
163
+ "workspaces": "per-folder .graphify (path-local)",
164
+ "extraction": "AST + optional LLM semantic",
165
+ "edge_audit": "EXTRACTED / INFERRED / AMBIGUOUS",
166
+ "agent_tools": "query, path, explain, review-*, minimal-context, wiki"
167
+ },
168
+ "cortex": {
169
+ "storage": "Kuzu + SQLite FTS + Lance vectors (~/.cortex/<workspace>)",
170
+ "multi_process": "single writer; share via serve-api",
171
+ "mcp": "HTTP /mcp + stdio proxy",
172
+ "ui": "live WebGL Brain + REST",
173
+ "workspaces": "named registry, federated views",
174
+ "extraction": "multi-extractor pipeline (code, docs, git, \u2026) no LLM required",
175
+ "edge_audit": "provenance + confidence + feedback confirm/reject",
176
+ "agent_tools": "search_knowledge, get_context, explain_impact, add_note, link, \u2026"
177
+ }
178
+ }
179
+ }
@@ -0,0 +1,127 @@
1
+ # Graphify vs Cortex — local benchmark report
2
+
3
+ **Date:** 2026-07-25
4
+ **Machines/installs:**
5
+ - Graphify `0.16.0` at `/Users/roshan/.local/bin/graphify`
6
+ - Cortex local venv `.venv/bin/cortex` + `serve-api` on `http://127.0.0.1:8420`
7
+ **Raw JSON:** [graphify-vs-cortex-2026-07-25.json](./graphify-vs-cortex-2026-07-25.json)
8
+ **Post-optimization JSON:** [graphify-vs-cortex-2026-07-25-post.json](./graphify-vs-cortex-2026-07-25-post.json)
9
+
10
+ ### Method notes (fairness)
11
+
12
+ - Graphify headless runs used **AST/code-only** (`--no-description --no-label`, no LLM). Mixed docs/markdown **failed** without a semantic backend.
13
+ - Cortex numbers reuse the earlier write-path suite on the same machine (cold `sample_repo`, cold `web/src`, incremental full-repo ingest) plus fresh matched query timings against `default` (1,492 nodes / 2,234 edges after ingest).
14
+ - “Query” is not identical: Graphify CLI BFS over `graph.json` vs Cortex hybrid search/context over Kuzu+FTS+vectors.
15
+
16
+ ---
17
+
18
+ ## 1. Executive summary
19
+
20
+ | Dimension | Winner | Why |
21
+ |---|---|---|
22
+ | Cold **code** graph build speed | **Graphify** | ~3–6× faster on same trees (file AST → JSON) |
23
+ | Mixed corpus (code+docs+git) without LLM | **Cortex** | Graphify headless blocks; Cortex extractors run |
24
+ | Hot query / search latency | **Cortex** | ~0.7 ms search vs ~100 ms Graphify CLI query |
25
+ | Concurrent multi-tool use (Brain+MCP+CLI+ingest) | **Cortex** (post shared-daemon) | 0 lock conflicts in suite; Graphify wins multi-process *reads* of JSON |
26
+ | Agent review tooling (PR blast radius, wiki, studio) | **Graphify** | Richer out-of-box review/wiki/studio CLI |
27
+ | Live interactive UI | **Cortex** | WebGL Brain + REST; Graphify is static studio export |
28
+ | Multi-workspace federation | **Cortex** | Named workspaces + federated views |
29
+ | Honest edge typology (EXTRACTED/INFERRED/AMBIGUOUS) | **Graphify** | First-class; Cortex uses provenance/confidence instead |
30
+ | Zero-setup “drop folder → graph” feel | **Graphify** | Path-local `.graphify/`; no long-lived server |
31
+
32
+ **Bottom line:** Graphify still feels smoother for *one-folder code graphs and agent review packs*. Cortex is stronger as a *persistent engineering KG service* (hybrid retrieval, live UI, multi-client via `serve-api`), but remains slower to build and less “instant CLI” than Graphify’s JSON pipeline.
33
+
34
+ ---
35
+
36
+ ## 2. Build / ingest
37
+
38
+ | Corpus | Graphify cold | Cortex (baseline) | Cortex **post-opt `--fast`** |
39
+ |---|---|---|---|
40
+ | `examples/sample_repo` (code-only for GFY) | **0.23 s** → 15 nodes / 17 links (2 files) | **1.31 s** → +38 nodes / +30 edges | **0.09 s** → 7 nodes (code-only) |
41
+ | `web/src` | **0.37 s** → 157 nodes / 323 links (25 files) | **2.43 s** → +79 nodes / +29 edges | **0.69 s** → 66 nodes (FTS/project link deferred) |
42
+ | `src/cortex` (Python) | **0.64 s** (whole `src/`) | ~22–34 s full resolve+link | **9.5 s** fast / **22.4 s** full |
43
+ | Full Cortex repo (`scope auto`) | **FAIL** — needs semantic backend for non-code | **27.3 s** incremental | (not re-run; warm hash skip unchanged) |
44
+
45
+ **Post-opt notes:** Stage profiling showed extract was only ~1–5% of wall time; wins came from batched Kuzu/FTS/provenance writes, deferred project linking + keyword index in `--fast`, and suppressing import-stub candidates. Graphify still wins raw AST→JSON on large trees; Cortex `--fast` now beats Graphify on `sample_repo`.
46
+
47
+ ---
48
+
49
+ ## 3. Query / agent-path latency (median)
50
+
51
+ | Operation | Graphify | Cortex |
52
+ |---|---:|---:|
53
+ | Question → answer (`query` / `search`) | ~96–102 ms (CLI+JSON) | **0.7 ms** HTTP search |
54
+ | Rich context | ~100 ms `summary` / query text | **29 ms** `/context` |
55
+ | Impact / blast | n/a as first-class (use review-*) | **17 ms** `/impact` |
56
+ | Shortest path | ~103 ms CLI | **9 ms** HTTP |
57
+ | Graph slice for UI | load JSON (~7 ms×8 concurrent) | **15 ms** snapshot(500) |
58
+ | MCP initialize | stdio process (not timed here) | **1.3 ms** HTTP `/mcp` |
59
+ | CLI process wrapper | ~(same ~100 ms floor) | **54 ms** `cortex search` (process start) |
60
+
61
+ Graphify’s built-in **token reduction benchmark** on the `src/` graph: **2.4×** fewer tokens vs naive corpus (avg query ~17.5k tokens vs ~43k naive).
62
+
63
+ ---
64
+
65
+ ## 4. Concurrency & locking
66
+
67
+ | Scenario | Graphify | Cortex baseline | Cortex **post-opt** |
68
+ |---|---|---|---|
69
+ | 8 parallel reads | OK — JSON multi-reader; 8× query wall ~**209 ms** | 8× search wall ~**78 ms** (intermittent 500s) | **0 errors** across 5 bursts; wall ~**6–8 ms**/burst |
70
+ | 30s soak (8-way `/search`) | n/a | n/a | **35,840 OK / 0 errors** |
71
+ | Ingest + search + MCP + Brain same workspace | N/A (rebuild replaces JSON; readers can race stale file) | **0 lock conflicts** in write-path suite | unchanged (shared `serve-api`) |
72
+ | Two OS processes opening DB | Fine for reads | Historically locked; mitigated by shared `serve-api` | `cortex up` keeps one owner |
73
+
74
+ ---
75
+
76
+ ## 5. Product surface comparison
77
+
78
+ | Aspect | Graphify | Cortex |
79
+ |---|---|---|
80
+ | Storage | `.graphify/graph.json` (+ studio, analysis) | `~/.cortex/<workspace>/` (Kuzu, FTS, vectors, meta) |
81
+ | Workspaces | Folder-local | Named registry + dropdown UI + federation modes |
82
+ | UI | Static Ontology Studio | Live Cortex Brain (WebGL) |
83
+ | MCP | `graphify serve` stdio | `/mcp` on `serve-api` (+ stdio proxy) |
84
+ | Extraction | AST + optional LLM semantic / describe / label | Deterministic extractors (code, markdown, git, …) |
85
+ | Agent extras | `review-*`, `minimal-context`, wiki, flows, commit advice | `get_context`, `explain_impact`, `add_note`, `link`, feedback |
86
+ | Edge honesty | EXTRACTED / INFERRED / AMBIGUOUS | Provenance records + confidence + confirm/reject |
87
+ | Hybrid retrieval | Graph traversal (+ optional LLM) | Keyword + vector + graph |
88
+ | Requires daemon | No | Yes for smooth multi-client (`serve-api`) |
89
+
90
+ ---
91
+
92
+ ## 6. Quality spot check (`AuthService`)
93
+
94
+ - **Graphify** (sample graph): returns structural neighborhood — `AuthService`, methods, `BillingService`, EXTRACTED edges, file/line communities. Excellent for “what is connected in code.”
95
+ - **Cortex** (default workspace): returns typed entities — `Service` AuthService, related `ArchitectureDecision`, `Concept`, with **keyword+vector** channels. Better for “what decisions/docs relate,” because docs/ADRs were ingested without an LLM.
96
+
97
+ ---
98
+
99
+ ## 7. Improvements list for Cortex — status after optimization pass
100
+
101
+ | # | Item | Status |
102
+ |---|---|---|
103
+ | 1 | Fast code-only ingest (`--fast` / `--scope code`) | **Done** — sample 0.09s; `web/src` 0.69s; `src/cortex` 9.5s (link+FTS deferred) |
104
+ | 2 | Always-on `serve-api` DX | **Done** — `cortex up` / `down` / `status` + TopBar health/queue chip |
105
+ | 3 | Fix concurrent HTTP 500s | **Done** — store locks + cache lock + embed single-flight; 0/35840 soak errors |
106
+ | 4 | Review pack tools | **Done** — `review_delta` / `minimal_context` REST + MCP |
107
+ | 5 | Edge honesty labels | **Done** — `EXTRACTED`/`INFERRED`/`AMBIGUOUS` in graph payloads + Brain filter |
108
+ | 6 | Token-budget report | **Done** — `naive_baseline_tokens` + `reduction_factor` (measured **4.57×** on sample) |
109
+ | 7 | Static studio export | **Done** — `cortex export studio` |
110
+ | 8 | Path-local `.cortex/project.json` | **Done** — written by `setup project` / `workspaces use` |
111
+ | 9 | Watch by default | **Done** — `cortex up --watch` |
112
+ | 10 | Community overlay | **Done** — “Color by community” toggle on Brain |
113
+ | 11 | CLI workspaces + completion | **Done** — `cortex workspaces list\|use` + `docs/completions/cortex.zsh` |
114
+ | 12 | CLI process tax | **Done** — `cortex shell` REPL |
115
+ | 13 | Docs happy path | **Done** — `cortex up` documented in install/brain/cursor |
116
+ | 14 | Hybrid channel badges | **Done** — SearchBox `kw`/`vec`/`graph` badges |
117
+ | 15 | Federation first-run wizard | **Done** — Workspaces rail onboarding panel |
118
+
119
+ **Remaining headroom:** large-tree `--fast` is still dominated by per-node Kuzu MERGE (~9s for ~1k nodes). Further gains need true bulk Cypher / COPY ingest, not more extractor skips.
120
+
121
+ ---
122
+
123
+ ## 8. Suggested next measurement
124
+
125
+ 1. Graphify **with** semantic backend (if API keys available) on full Cortex repo vs Cortex full ingest — quality + time.
126
+ 2. Agent task eval: same 10 architecture questions scored for answer usefulness (not just latency).
127
+ 3. ~~Soak test: 5-minute parallel Brain + MCP + ingest watch~~ — **30s 8-way `/search` soak done: 0 errors**; extend to full 5 min + watch in a follow-up.
@@ -3,24 +3,32 @@
3
3
  Cortex Brain is the WebGL visualization of your Engineering Knowledge Graph.
4
4
  After install, you open it in a browser — **no separate frontend server**.
5
5
 
6
- ## One-time setup (3 commands)
6
+ ## One-time setup (happy path)
7
7
 
8
8
  ```bash
9
9
  # 1. Install
10
10
  pipx install cortex-kg
11
11
  # or: pip install cortex-kg
12
12
 
13
- # 2. Index a project (creates knowledge in a workspace)
14
- cortex --workspace default ingest /path/to/your/repo --project MyApp
13
+ # 2. Start the shared daemon (Brain + MCP + CLI share one Kuzu process)
14
+ cortex up
15
+ # optional: also watch for file changes
16
+ # cortex up --watch /path/to/your/repo --project MyApp
15
17
 
16
- # 3. Start the API + UI
17
- cortex --workspace default serve-api
18
+ # 3. Index a project (CLI auto-detects serve-api)
19
+ cortex ingest /path/to/your/repo --project MyApp
20
+ # fast code-only path (Graphify-class speed):
21
+ # cortex ingest /path/to/your/repo --project MyApp --fast
18
22
  ```
19
23
 
20
24
  Open **http://localhost:8420** in your browser.
21
25
 
22
- In the top bar, set **Workspace** to the same name you used above
23
- (`default`, `demo`, `work`, …). If it doesn’t match, the canvas looks empty.
26
+ `cortex up` writes a pidfile under `~/.cortex/`, prints Brain + `/mcp` URLs,
27
+ and is safe to re-run (idempotent if already healthy). Use `cortex status`
28
+ / `cortex down` to inspect or stop.
29
+
30
+ In the top bar, pick **Workspace** from the dropdown (same name you used
31
+ above: `default`, `demo`, `work`, …). If it doesn’t match, the canvas looks empty.
24
32
 
25
33
  That’s the whole setup.
26
34
 
@@ -131,29 +139,38 @@ Open http://localhost:8420 and set **Workspace** to `demo`.
131
139
  - **Custom port:** `cortex serve-api --port 9000`
132
140
  - **Custom UI folder** (advanced): `export CORTEX_WEB_DIST=/path/to/dist`
133
141
  - Data lives in `~/.cortex/<workspace>/` (override with `CORTEX_HOME`)
134
- - The **Workspace** field in the top bar commits on blur/Enter, not every
135
- keystroke typing a workspace id auto-creates it on first use, so
136
- committing on every keystroke used to create (and lock-probe) a phantom
137
- workspace per partial string typed.
142
+ - The **Workspace** control in the top bar is a dropdown of known workspaces
143
+ (from `GET /workspaces`), with a create path for new ids.
144
+
145
+ ## Recommended layout: one `serve-api`
146
+
147
+ Run a single long-lived API process so Brain, Cursor MCP, and the CLI share
148
+ one Kuzu connection:
149
+
150
+ ```bash
151
+ cortex --workspace default serve-api
152
+ ```
153
+
154
+ - Brain UI: http://localhost:8420
155
+ - MCP (streamable HTTP): http://127.0.0.1:8420/mcp
156
+ - CLI (`ingest`, `search`, `info`, …) auto-detects the API and calls it over
157
+ HTTP when reachable (override with `CORTEX_API_URL`)
158
+
159
+ `cortex setup cursor` / `setup project` write an MCP config that points at
160
+ that `/mcp` URL. Stdio `serve-mcp` also proxies to the API when it is up.
138
161
 
139
162
  ## Troubleshooting: "Workspace 'X' is locked by another Cortex process"
140
163
 
141
164
  The embedded graph DB (Kuzu) only allows **one read-write process per
142
- workspace** at a time. If you see this error (a `503` in the graph
143
- canvas, or in `serve-api`'s logs), something else already has that
144
- workspace open most commonly:
145
-
146
- - **Cursor's Cortex MCP integration** (`cortex --workspace <ws> serve-mcp`),
147
- started automatically whenever Cursor uses `search_knowledge`,
148
- `get_context`, etc. against that workspace.
149
- - **Another `serve-api` / CLI command** (`cortex ingest`, `cortex info`, …)
150
- still running against the same workspace.
151
-
152
- Fix: either stop the other process, or point Brain at a workspace that
153
- isn't in use elsewhere (switch **Workspace** in the top bar). Ingesting
154
- into a workspace that Cursor's MCP server is actively using will hit the
155
- same conflict — pick a workspace Cursor doesn't reference, or briefly stop
156
- the MCP server, ingest, then restart it.
165
+ workspace** at a time. A lock usually means a second process tried to open
166
+ the same DB directory (for example an old stdio MCP that opened Kuzu
167
+ locally while `serve-api` was already running).
168
+
169
+ Fix: keep **one** `cortex serve-api` running for that workspace, point MCP at
170
+ `http://127.0.0.1:8420/mcp` (or use stdio `serve-mcp`, which proxies when
171
+ the API is healthy), and run CLI commands while the API is up so they do
172
+ not open Kuzu themselves. If you still see a lock, stop the stray process
173
+ that holds the file lock, then restart `serve-api`.
157
174
 
158
175
  ## Developing the UI itself
159
176