carto-md 2.0.9 → 2.1.0

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 (172) hide show
  1. package/CONTRIBUTING.md +19 -15
  2. package/README.md +192 -415
  3. package/docs/api/README.md +99 -0
  4. package/docs/api/did_we_discuss_this.md +34 -0
  5. package/docs/api/dismiss_suggestion.md +34 -0
  6. package/docs/api/explain_change_in_natural_language.md +33 -0
  7. package/docs/api/find_consumers_of_api.md +34 -0
  8. package/docs/api/get_action_patterns.md +32 -0
  9. package/docs/api/get_active_drift.md +32 -0
  10. package/docs/api/get_active_suggestions.md +25 -0
  11. package/docs/api/get_ai_cost_attribution.md +32 -0
  12. package/docs/api/get_arch_events.md +42 -0
  13. package/docs/api/get_architectural_drift.md +37 -0
  14. package/docs/api/get_architecture.md +25 -0
  15. package/docs/api/get_blast_radius.md +34 -0
  16. package/docs/api/get_canonical_pattern.md +39 -0
  17. package/docs/api/get_change_plan.md +34 -0
  18. package/docs/api/get_change_velocity.md +32 -0
  19. package/docs/api/get_churn_vs_blast_radius.md +32 -0
  20. package/docs/api/get_complexity_trend.md +39 -0
  21. package/docs/api/get_context.md +34 -0
  22. package/docs/api/get_conventions.md +32 -0
  23. package/docs/api/get_cross_domain.md +25 -0
  24. package/docs/api/get_cross_language_call_graph.md +25 -0
  25. package/docs/api/get_cross_repo_blast_radius.md +34 -0
  26. package/docs/api/get_cross_team_coupling.md +25 -0
  27. package/docs/api/get_data_flow.md +33 -0
  28. package/docs/api/get_dead_code_with_confidence.md +32 -0
  29. package/docs/api/get_decision_log.md +32 -0
  30. package/docs/api/get_dependency_surface.md +25 -0
  31. package/docs/api/get_domain.md +34 -0
  32. package/docs/api/get_domain_evolution.md +39 -0
  33. package/docs/api/get_domain_health.md +32 -0
  34. package/docs/api/get_domains_list.md +25 -0
  35. package/docs/api/get_drift_digest.md +32 -0
  36. package/docs/api/get_env_vars.md +32 -0
  37. package/docs/api/get_evolution_delta.md +36 -0
  38. package/docs/api/get_file_ownership.md +33 -0
  39. package/docs/api/get_file_summary.md +34 -0
  40. package/docs/api/get_high_impact_files.md +32 -0
  41. package/docs/api/get_hot_in_prod_no_tests.md +34 -0
  42. package/docs/api/get_hotspot_files.md +37 -0
  43. package/docs/api/get_iac_resources.md +25 -0
  44. package/docs/api/get_interface_contract.md +33 -0
  45. package/docs/api/get_intervention_history.md +32 -0
  46. package/docs/api/get_invariants.md +37 -0
  47. package/docs/api/get_llm_enrichment.md +33 -0
  48. package/docs/api/get_microservice_cut_points.md +32 -0
  49. package/docs/api/get_microservices_migration_cut_points.md +25 -0
  50. package/docs/api/get_minimal_context_for_intent.md +39 -0
  51. package/docs/api/get_models.md +32 -0
  52. package/docs/api/get_neighbors.md +39 -0
  53. package/docs/api/get_org_architecture.md +25 -0
  54. package/docs/api/get_org_domain_mapping.md +25 -0
  55. package/docs/api/get_pending_decisions.md +32 -0
  56. package/docs/api/get_predictive_risk.md +32 -0
  57. package/docs/api/get_progressive_disclosure_tree.md +25 -0
  58. package/docs/api/get_recent_decisions.md +37 -0
  59. package/docs/api/get_risk_weighted_blast_radius.md +32 -0
  60. package/docs/api/get_routes.md +25 -0
  61. package/docs/api/get_safety_checklist.md +33 -0
  62. package/docs/api/get_semantic_diff.md +34 -0
  63. package/docs/api/get_service_boundary_violations.md +25 -0
  64. package/docs/api/get_service_dependency_graph.md +25 -0
  65. package/docs/api/get_session_context.md +32 -0
  66. package/docs/api/get_similar_patterns.md +39 -0
  67. package/docs/api/get_stale_docs.md +25 -0
  68. package/docs/api/get_structure.md +25 -0
  69. package/docs/api/get_temporal_context.md +34 -0
  70. package/docs/api/get_test_coverage_map.md +25 -0
  71. package/docs/api/get_token_budget_report.md +36 -0
  72. package/docs/api/get_upgrade_risk.md +25 -0
  73. package/docs/api/get_working_memory.md +25 -0
  74. package/docs/api/ingest_otlp_traces.md +34 -0
  75. package/docs/api/scaffold_for_intent.md +34 -0
  76. package/docs/api/search_routes.md +34 -0
  77. package/docs/api/simulate_change_impact.md +37 -0
  78. package/docs/api/validate_change.md +39 -0
  79. package/docs/api/validate_diff.md +39 -0
  80. package/docs/concepts/anci.md +87 -0
  81. package/docs/concepts/blast-radius.md +66 -0
  82. package/docs/concepts/domains.md +91 -0
  83. package/docs/concepts/import-graph.md +102 -0
  84. package/docs/concepts/mcp-integration.md +148 -0
  85. package/docs/guides/adding-feature-safely.md +101 -0
  86. package/docs/guides/ci-integration.md +175 -0
  87. package/docs/guides/monorepo-setup.md +121 -0
  88. package/docs/guides/onboarding-new-engineer.md +121 -0
  89. package/docs/guides/pre-merge-review.md +139 -0
  90. package/docs/migration/v1-to-v2.md +110 -0
  91. package/docs/quickstart.md +95 -0
  92. package/docs/scale.md +2 -2
  93. package/docs/troubleshooting.md +180 -0
  94. package/package.json +10 -4
  95. package/scripts/gen-api-docs.js +170 -0
  96. package/src/acp/agent.js +83 -11
  97. package/src/acp/config.js +64 -0
  98. package/src/acp/persistence.js +146 -0
  99. package/src/acp/providers/anthropic.js +179 -27
  100. package/src/acp/providers/index.js +15 -2
  101. package/src/acp/providers/openai.js +164 -38
  102. package/src/acp/providers/sse.js +82 -0
  103. package/src/acp/safety.js +128 -0
  104. package/src/acp/session.js +73 -0
  105. package/src/adjacent/call-graph.js +170 -0
  106. package/src/adjacent/iac.js +167 -0
  107. package/src/adjacent/llm-enrich.js +35 -0
  108. package/src/adjacent/runtime.js +216 -0
  109. package/src/adjacent/semantic-diff.js +143 -0
  110. package/src/agents/scan-structure.js +1 -1
  111. package/src/ai/context-builder.js +215 -0
  112. package/src/ai/retrieval/lexical.js +122 -0
  113. package/src/ai/retrieval/rrf.js +121 -0
  114. package/src/ai/retrieval/semantic.js +35 -0
  115. package/src/ai/retrieval/structural.js +82 -0
  116. package/src/ai/tools.js +423 -0
  117. package/src/anci/emit.js +2 -2
  118. package/src/bitmap/index.js +1 -1
  119. package/src/bitmap/tools.js +2 -2
  120. package/src/brain/conventions/index.js +185 -0
  121. package/src/brain/index.js +31 -0
  122. package/src/brain/invariants/index.js +252 -0
  123. package/src/brain/procedural/index.js +181 -0
  124. package/src/brain/suggestions/index.js +153 -0
  125. package/src/brain/working/index.js +170 -0
  126. package/src/cli/check.js +47 -1
  127. package/src/cli/diff.js +83 -0
  128. package/src/cli/doctor.js +270 -0
  129. package/src/cli/explain.js +61 -0
  130. package/src/cli/index.js +101 -0
  131. package/src/cli/init.js +143 -5
  132. package/src/cli/org.js +172 -0
  133. package/src/cli/pr-impact.js +59 -2
  134. package/src/cli/serve.js +1 -1
  135. package/src/cli/status.js +211 -0
  136. package/src/cli/sync.js +2 -2
  137. package/src/cli/temporal.js +188 -0
  138. package/src/cli/validate.js +201 -0
  139. package/src/cli/watch.js +4 -4
  140. package/src/cli/why.js +101 -0
  141. package/src/extractors/frameworks.js +236 -0
  142. package/src/extractors/languages/dart.js +138 -0
  143. package/src/extractors/languages/go.js +11 -1
  144. package/src/extractors/languages/javascript.js +13 -3
  145. package/src/extractors/languages/kotlin.js +169 -0
  146. package/src/extractors/languages/php.js +195 -0
  147. package/src/extractors/languages/python.js +12 -1
  148. package/src/extractors/languages/swift.js +140 -0
  149. package/src/extractors/languages/typescript.js +15 -2
  150. package/src/extractors/plugin-api.js +102 -0
  151. package/src/mcp/files-without-tests.js +285 -0
  152. package/src/mcp/middleware/index.js +451 -0
  153. package/src/mcp/server.js +2292 -0
  154. package/src/mcp/validate.js +1 -1
  155. package/src/org/detect.js +262 -0
  156. package/src/org/queries.js +144 -0
  157. package/src/org/store.js +173 -0
  158. package/src/org/sync.js +106 -0
  159. package/src/predictive/cut-points.js +83 -0
  160. package/src/predictive/drift-digest.js +88 -0
  161. package/src/predictive/ownership.js +145 -0
  162. package/src/predictive/risk-score.js +121 -0
  163. package/src/predictive/validate-change.js +55 -0
  164. package/src/store/store-adapter.js +3 -3
  165. package/src/store/{sync-v2.js → sync.js} +53 -13
  166. package/src/temporal/backfill.js +211 -0
  167. package/src/temporal/delta.js +85 -0
  168. package/src/temporal/events.js +180 -0
  169. package/src/temporal/queries.js +358 -0
  170. package/src/temporal/snapshot.js +151 -0
  171. package/src/temporal/store.js +400 -0
  172. package/src/mcp/server-v2.js +0 -986
@@ -0,0 +1,25 @@
1
+ # `get_service_boundary_violations`
2
+
3
+ Cross-repo edges that import private/internal surface (heuristic: target path contains internal / private / _lib).
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {},
11
+ "required": []
12
+ }
13
+ ```
14
+
15
+ ## Required arguments
16
+
17
+ _None._
18
+
19
+ ## Properties
20
+
21
+ _None._
22
+
23
+ ## See also
24
+
25
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,25 @@
1
+ # `get_service_dependency_graph`
2
+
3
+ Aggregated cross-repo graph: each repo is a node, edges grouped by (from_repo, to_repo, edge_kind).
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {},
11
+ "required": []
12
+ }
13
+ ```
14
+
15
+ ## Required arguments
16
+
17
+ _None._
18
+
19
+ ## Properties
20
+
21
+ _None._
22
+
23
+ ## See also
24
+
25
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,32 @@
1
+ # `get_session_context`
2
+
3
+ Full context for an AI session: every decision and every intervention, ordered chronologically. Use to recap what happened in a long-running session.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "session_id": {
12
+ "type": "number",
13
+ "description": "Session id. Defaults to the most recent active session."
14
+ }
15
+ },
16
+ "required": []
17
+ }
18
+ ```
19
+
20
+ ## Required arguments
21
+
22
+ _None._
23
+
24
+ ## Properties
25
+
26
+ | Name | Type | Description |
27
+ |------|------|-------------|
28
+ | `session_id` | number | Session id. Defaults to the most recent active session. |
29
+
30
+ ## See also
31
+
32
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,39 @@
1
+ # `get_similar_patterns`
2
+
3
+ Given a file, find structurally similar files — same import pattern, same route shape, or same domain. Use to find conventions to follow before writing new code.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "file": {
12
+ "type": "string",
13
+ "description": "Relative file path from project root"
14
+ },
15
+ "limit": {
16
+ "type": "number",
17
+ "description": "Max results to return (default 5)"
18
+ }
19
+ },
20
+ "required": [
21
+ "file"
22
+ ]
23
+ }
24
+ ```
25
+
26
+ ## Required arguments
27
+
28
+ - `file`
29
+
30
+ ## Properties
31
+
32
+ | Name | Type | Description |
33
+ |------|------|-------------|
34
+ | `file` | string | Relative file path from project root |
35
+ | `limit` | number | Max results to return (default 5) |
36
+
37
+ ## See also
38
+
39
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,25 @@
1
+ # `get_stale_docs`
2
+
3
+ Docs/markdown files older than 30 days. Heuristic surface for documentation that probably needs refresh.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {},
11
+ "required": []
12
+ }
13
+ ```
14
+
15
+ ## Required arguments
16
+
17
+ _None._
18
+
19
+ ## Properties
20
+
21
+ _None._
22
+
23
+ ## See also
24
+
25
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,25 @@
1
+ # `get_structure`
2
+
3
+ Get project structure: import graph, entry points, high impact files, tech stack, and domains.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {},
11
+ "required": []
12
+ }
13
+ ```
14
+
15
+ ## Required arguments
16
+
17
+ _None._
18
+
19
+ ## Properties
20
+
21
+ _None._
22
+
23
+ ## See also
24
+
25
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,34 @@
1
+ # `get_temporal_context`
2
+
3
+ A file's full temporal context: first_seen_ts, last_modified_ts, commit_count, blast_radius, recent events, age in days.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "file": {
12
+ "type": "string",
13
+ "description": "Relative file path."
14
+ }
15
+ },
16
+ "required": [
17
+ "file"
18
+ ]
19
+ }
20
+ ```
21
+
22
+ ## Required arguments
23
+
24
+ - `file`
25
+
26
+ ## Properties
27
+
28
+ | Name | Type | Description |
29
+ |------|------|-------------|
30
+ | `file` | string | Relative file path. |
31
+
32
+ ## See also
33
+
34
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,25 @@
1
+ # `get_test_coverage_map`
2
+
3
+ Surfaces files with no detected test alongside their blast radius. High-blast untested files are the riskiest.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {},
11
+ "required": []
12
+ }
13
+ ```
14
+
15
+ ## Required arguments
16
+
17
+ _None._
18
+
19
+ ## Properties
20
+
21
+ _None._
22
+
23
+ ## See also
24
+
25
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,36 @@
1
+ # `get_token_budget_report`
2
+
3
+ Diagnostic complement to get_minimal_context_for_intent. Returns context efficiency as a fraction of repo size (used / total tokens approx).
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "intent": {
12
+ "type": "string",
13
+ "description": "Intent to budget for."
14
+ },
15
+ "budget_tokens": {
16
+ "type": "number"
17
+ }
18
+ },
19
+ "required": []
20
+ }
21
+ ```
22
+
23
+ ## Required arguments
24
+
25
+ _None._
26
+
27
+ ## Properties
28
+
29
+ | Name | Type | Description |
30
+ |------|------|-------------|
31
+ | `intent` | string | Intent to budget for. |
32
+ | `budget_tokens` | number | |
33
+
34
+ ## See also
35
+
36
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,25 @@
1
+ # `get_upgrade_risk`
2
+
3
+ Cross-references each external dep against the import graph. Returns usage count + domain count + LOW/MEDIUM/HIGH risk per dep. Use before bumping a dep version.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {},
11
+ "required": []
12
+ }
13
+ ```
14
+
15
+ ## Required arguments
16
+
17
+ _None._
18
+
19
+ ## Properties
20
+
21
+ _None._
22
+
23
+ ## See also
24
+
25
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,25 @@
1
+ # `get_working_memory`
2
+
3
+ Live state snapshot: branch, HEAD, uncommitted files, recent decision count, open HIGH-severity warnings, recent drift. Read this at the start of every AI session.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {},
11
+ "required": []
12
+ }
13
+ ```
14
+
15
+ ## Required arguments
16
+
17
+ _None._
18
+
19
+ ## Properties
20
+
21
+ _None._
22
+
23
+ ## See also
24
+
25
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,34 @@
1
+ # `ingest_otlp_traces`
2
+
3
+ Parse an OpenTelemetry OTLP JSON/JSONL trace file and aggregate per-route hit counts. Use the resulting counts with get_risk_weighted_blast_radius.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "path": {
12
+ "type": "string",
13
+ "description": "Path to OTLP file"
14
+ }
15
+ },
16
+ "required": [
17
+ "path"
18
+ ]
19
+ }
20
+ ```
21
+
22
+ ## Required arguments
23
+
24
+ - `path`
25
+
26
+ ## Properties
27
+
28
+ | Name | Type | Description |
29
+ |------|------|-------------|
30
+ | `path` | string | Path to OTLP file |
31
+
32
+ ## See also
33
+
34
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,34 @@
1
+ # `scaffold_for_intent`
2
+
3
+ For a natural-language intent ("add a payment route"), returns: anchor file + co-changed files + canonical pattern + conventions to follow. Combines invariants, conventions, and procedural memory.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "intent": {
12
+ "type": "string",
13
+ "description": "Natural-language description of the change."
14
+ }
15
+ },
16
+ "required": [
17
+ "intent"
18
+ ]
19
+ }
20
+ ```
21
+
22
+ ## Required arguments
23
+
24
+ - `intent`
25
+
26
+ ## Properties
27
+
28
+ | Name | Type | Description |
29
+ |------|------|-------------|
30
+ | `intent` | string | Natural-language description of the change. |
31
+
32
+ ## See also
33
+
34
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,34 @@
1
+ # `search_routes`
2
+
3
+ Search API routes by path or method. Case-insensitive.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "query": {
12
+ "type": "string",
13
+ "description": "Search query e.g. \"auth\", \"POST\", \"/api/users\""
14
+ }
15
+ },
16
+ "required": [
17
+ "query"
18
+ ]
19
+ }
20
+ ```
21
+
22
+ ## Required arguments
23
+
24
+ - `query`
25
+
26
+ ## Properties
27
+
28
+ | Name | Type | Description |
29
+ |------|------|-------------|
30
+ | `query` | string | Search query e.g. "auth", "POST", "/api/users" |
31
+
32
+ ## See also
33
+
34
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,37 @@
1
+ # `simulate_change_impact`
2
+
3
+ Given a list of files, returns all files transitively affected by changing them simultaneously, with hop distance. Powered by the bitmap engine — only feasible at this speed (sub-millisecond) with bitmap OR-aggregation. Use when planning a refactor that touches multiple files.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "files": {
12
+ "type": "array",
13
+ "items": {
14
+ "type": "string"
15
+ },
16
+ "description": "Array of relative file paths from project root"
17
+ }
18
+ },
19
+ "required": [
20
+ "files"
21
+ ]
22
+ }
23
+ ```
24
+
25
+ ## Required arguments
26
+
27
+ - `files`
28
+
29
+ ## Properties
30
+
31
+ | Name | Type | Description |
32
+ |------|------|-------------|
33
+ | `files` | array | Array of relative file paths from project root |
34
+
35
+ ## See also
36
+
37
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,39 @@
1
+ # `validate_change`
2
+
3
+ Pre-write governance: given a file + proposed full content, synthesizes a diff vs disk and runs validate_diff. Use in IDE onWillSaveTextDocument hooks.
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "file": {
12
+ "type": "string"
13
+ },
14
+ "content": {
15
+ "type": "string"
16
+ }
17
+ },
18
+ "required": [
19
+ "file",
20
+ "content"
21
+ ]
22
+ }
23
+ ```
24
+
25
+ ## Required arguments
26
+
27
+ - `file`
28
+ - `content`
29
+
30
+ ## Properties
31
+
32
+ | Name | Type | Description |
33
+ |------|------|-------------|
34
+ | `file` | string | |
35
+ | `content` | string | |
36
+
37
+ ## See also
38
+
39
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,39 @@
1
+ # `validate_diff`
2
+
3
+ Given a unified diff, returns: violations (cross-domain imports, high-blast files), blast radius per file, risk level (SAFE/LOW/MEDIUM/HIGH), and suggestions. Sub-15ms p99 on a 7K-file repo. Each call is recorded in the episodic memory log so other tools can ask "did we discuss this?".
4
+
5
+ ## Input schema
6
+
7
+ ```json
8
+ {
9
+ "type": "object",
10
+ "properties": {
11
+ "diff": {
12
+ "type": "string",
13
+ "description": "Unified diff text (output of `git diff` / GitHub PR patch)."
14
+ },
15
+ "session_id": {
16
+ "type": "number",
17
+ "description": "Optional session id. Defaults to the most recent active session, or a fresh one."
18
+ }
19
+ },
20
+ "required": [
21
+ "diff"
22
+ ]
23
+ }
24
+ ```
25
+
26
+ ## Required arguments
27
+
28
+ - `diff`
29
+
30
+ ## Properties
31
+
32
+ | Name | Type | Description |
33
+ |------|------|-------------|
34
+ | `diff` | string | Unified diff text (output of `git diff` / GitHub PR patch). |
35
+ | `session_id` | number | Optional session id. Defaults to the most recent active session, or a fresh one. |
36
+
37
+ ## See also
38
+
39
+ - [Index of all MCP tools](./README.md)
@@ -0,0 +1,87 @@
1
+ # Concept: ANCI
2
+
3
+ > **Architecturally Normalized Code Index** — the open file format for any codebase to describe its architecture to AI tools.
4
+
5
+ ## The problem
6
+
7
+ Every AI coding tool today re-discovers a codebase's architecture from scratch on every session. Cursor builds its own embedding index. Cline builds its own. Continue builds its own. Same parsing, every tool, every session, every time. Wasted CPU; wasted disk; inconsistent results.
8
+
9
+ What's missing is a *format*. OpenAPI did this for REST APIs — once any API has an `openapi.yaml`, every tool consumes it the same way. ANCI is the equivalent for codebases.
10
+
11
+ ## What it is
12
+
13
+ Two files at `.carto/anci.{yaml,bin}`. Together they describe:
14
+
15
+ - the domain partition (which files belong to which cluster)
16
+ - the import graph (forward + reverse adjacency)
17
+ - per-file metadata (path, language, exports)
18
+ - popcount index (files ranked by transitive dependents)
19
+
20
+ The split is hybrid by design:
21
+
22
+ - **`anci.yaml`** — strict-subset YAML 1.2, human-readable, grep-able. Holds the schema version, generator info, domain names, and counts. ~1–4 KB.
23
+ - **`anci.bin`** — binary body. Magic `0x49434E41` ("ANCI"), version byte, six sections (forward graph, reverse graph, popcount, paths, file→domain, domain names) packed via Roaring-bitmap-like compression. ~200 KB to ~5 MB depending on repo size.
24
+
25
+ Why split: a 100K-file repo as pure YAML is 50–500 MB — too large for an AI tool to consume per-session. The binary section solves the size problem without sacrificing the human-readable header.
26
+
27
+ ## Carto is the reference implementation
28
+
29
+ `carto sync` writes both files automatically on every full sync. The same data the MCP server hands the AI is what ANCI captures on disk. Any tool can consume it without speaking MCP:
30
+
31
+ ```js
32
+ const { loadAnci } = require('carto-md/src/anci/consumer');
33
+
34
+ const reader = loadAnci('./.carto');
35
+ console.log(reader.domains); // [{name, file_count}, ...]
36
+ console.log(reader.getHighImpactFiles(5)); // top 5 by transitive dependents
37
+ console.log(reader.blastRadius('src/auth/session.ts')); // { count, hops, files }
38
+ console.log(reader.simulateChangeImpact([ // multi-file change blast radius
39
+ 'src/auth/session.ts',
40
+ 'src/db/connection.ts',
41
+ ]));
42
+ ```
43
+
44
+ `loadAnci()` has zero dependencies. Anyone shipping an AI tool can drop it in and consume Carto's index without taking on Carto's whole tarball.
45
+
46
+ ## The CLI surface
47
+
48
+ ```bash
49
+ carto anci publish # re-emit anci.{yaml,bin} from the current index
50
+ carto anci show # human-readable summary
51
+ carto anci validate ./.carto # validate a published pair
52
+ ```
53
+
54
+ Publish runs implicitly on `carto sync`, so you only need to invoke these manually if you're debugging.
55
+
56
+ ## Versioning
57
+
58
+ The spec is at `docs/anci/v0.1-DRAFT.md`. It's a draft; the wire format may break between v0.1.x patches. v1.0+ will follow semver and consumers refusing unsupported major versions is the contract.
59
+
60
+ The header version is what consumers look at first:
61
+
62
+ ```yaml
63
+ anci:
64
+ version: "0.1.0-DRAFT"
65
+ generator: "carto-md@2.0.9"
66
+ generated_at: "2026-06-26T12:34:56Z"
67
+ ```
68
+
69
+ A consumer should reject anything outside its supported major.minor prefix.
70
+
71
+ ## Why publish a spec at all
72
+
73
+ If only Carto consumes Carto's binary format, it's just an internal optimization. If three AI tools agree on a format, it becomes the standard. The OpenAPI precedent: Swagger shipped as a proprietary format in 2011, became de-facto by 2014, formalized as the OpenAPI Initiative by 2016.
74
+
75
+ Carto's bet is the same: publish the binary spec early, support it as the reference implementation, and let the ecosystem coalesce. Once 3+ AI tools read ANCI, every AI tool has to.
76
+
77
+ ## Status
78
+
79
+ - Spec: v0.1 DRAFT, published in [`docs/anci/v0.1-DRAFT.md`](../anci/v0.1-DRAFT.md)
80
+ - Carto generates the files on every `carto sync`
81
+ - Consumer library shipped: `src/anci/consumer.js`
82
+ - Partner integration: TBD — first one is the unblocker
83
+
84
+ ## Related
85
+
86
+ - [`docs/anci/v0.1-DRAFT.md`](../anci/v0.1-DRAFT.md) — the spec itself
87
+ - [`mcp-integration.md`](./mcp-integration.md) — the alternative consumption path (live, slightly more flexible, but every consumer pays the MCP-protocol surface tax)