java-codebase-rag 0.6.6__tar.gz → 0.8.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.
Files changed (116) hide show
  1. {java_codebase_rag-0.6.6/java_codebase_rag.egg-info → java_codebase_rag-0.8.0}/PKG-INFO +137 -94
  2. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/README.md +130 -90
  3. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/ast_java.py +8 -3
  4. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/build_ast_graph.py +72 -16
  5. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/graph_enrich.py +2 -1
  6. java_codebase_rag-0.8.0/graph_types.py +133 -0
  7. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/_fdlimit.py +10 -2
  8. java_codebase_rag-0.8.0/java_codebase_rag/_stdio.py +32 -0
  9. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/cli.py +135 -24
  10. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/config.py +128 -9
  11. java_codebase_rag-0.8.0/java_codebase_rag/install_data/agents/explorer-rag-cli.md +291 -0
  12. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/install_data/agents/explorer-rag-enhanced.md +8 -8
  13. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/install_data/skills/explore-codebase/SKILL.md +8 -8
  14. java_codebase_rag-0.8.0/java_codebase_rag/install_data/skills/explore-codebase-cli/SKILL.md +251 -0
  15. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/installer.py +438 -103
  16. java_codebase_rag-0.8.0/java_codebase_rag/jrag.py +4300 -0
  17. java_codebase_rag-0.8.0/java_codebase_rag/jrag_envelope.py +1085 -0
  18. java_codebase_rag-0.8.0/java_codebase_rag/jrag_hints.py +204 -0
  19. java_codebase_rag-0.8.0/java_codebase_rag/jrag_render.py +688 -0
  20. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/pipeline.py +20 -0
  21. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0/java_codebase_rag.egg-info}/PKG-INFO +137 -94
  22. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag.egg-info/SOURCES.txt +23 -0
  23. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag.egg-info/entry_points.txt +1 -0
  24. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag.egg-info/requires.txt +5 -3
  25. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag.egg-info/top_level.txt +2 -0
  26. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_index_flow_lancedb.py +34 -19
  27. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_ontology.py +12 -0
  28. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/ladybug_queries.py +233 -52
  29. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/mcp_hints.py +6 -6
  30. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/mcp_v2.py +205 -617
  31. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/pyproject.toml +14 -4
  32. java_codebase_rag-0.8.0/resolve_service.py +649 -0
  33. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/search_lancedb.py +10 -1
  34. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/server.py +20 -12
  35. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_agent_skills_static.py +30 -1
  36. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_ast_graph_build.py +5 -3
  37. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_config.py +249 -5
  38. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_cross_service_resolution_flag.py +1 -0
  39. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_fd_limit.py +12 -0
  40. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_feign_not_exposer.py +1 -0
  41. java_codebase_rag-0.8.0/tests/test_graph_only_boot.py +80 -0
  42. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_incremental_graph.py +169 -14
  43. java_codebase_rag-0.8.0/tests/test_install_data_sync.py +249 -0
  44. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_installer.py +145 -59
  45. java_codebase_rag-0.8.0/tests/test_installer_surface.py +467 -0
  46. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_java_codebase_rag_cli.py +116 -4
  47. java_codebase_rag-0.8.0/tests/test_jrag_auto_scope.py +266 -0
  48. java_codebase_rag-0.8.0/tests/test_jrag_envelope.py +711 -0
  49. java_codebase_rag-0.8.0/tests/test_jrag_listing.py +458 -0
  50. java_codebase_rag-0.8.0/tests/test_jrag_locate.py +515 -0
  51. java_codebase_rag-0.8.0/tests/test_jrag_orientation.py +858 -0
  52. java_codebase_rag-0.8.0/tests/test_jrag_render.py +718 -0
  53. java_codebase_rag-0.8.0/tests/test_jrag_status.py +174 -0
  54. java_codebase_rag-0.8.0/tests/test_jrag_token_budget.py +127 -0
  55. java_codebase_rag-0.8.0/tests/test_jrag_traversal_compose.py +727 -0
  56. java_codebase_rag-0.8.0/tests/test_jrag_traversal_direct.py +816 -0
  57. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_ladybug_queries.py +60 -2
  58. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_mcp_hints.py +2 -2
  59. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_mcp_server_project_root.py +46 -1
  60. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_mcp_v2.py +207 -92
  61. java_codebase_rag-0.8.0/tests/test_packaging_metadata.py +52 -0
  62. java_codebase_rag-0.8.0/tests/test_resolve_service.py +173 -0
  63. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_search_lancedb.py +25 -0
  64. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_search_lancedb_capability.py +6 -0
  65. java_codebase_rag-0.6.6/tests/test_packaging_metadata.py +0 -14
  66. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/LICENSE +0 -0
  67. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/brownfield_events.py +0 -0
  68. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/chunk_heuristics.py +0 -0
  69. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/index_common.py +0 -0
  70. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/__init__.py +0 -0
  71. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/cli_format.py +0 -0
  72. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/cli_progress.py +0 -0
  73. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/lance_optimize.py +0 -0
  74. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag/progress.py +0 -0
  75. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_codebase_rag.egg-info/dependency_links.txt +0 -0
  76. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/java_index_v1_common.py +0 -0
  77. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/path_filtering.py +0 -0
  78. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/pr_analysis.py +0 -0
  79. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/setup.cfg +0 -0
  80. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_assign_endpoint_client_extraction.py +0 -0
  81. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_ast_java_calls.py +0 -0
  82. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_ast_java_capabilities.py +0 -0
  83. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_ast_java_thread_safety.py +0 -0
  84. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_bank_chat_brownfield_integration.py +0 -0
  85. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_brownfield_clients.py +0 -0
  86. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_brownfield_events.py +0 -0
  87. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_brownfield_overrides.py +0 -0
  88. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_brownfield_routes.py +0 -0
  89. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_call_edge_matching.py +0 -0
  90. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_call_edges_e2e.py +0 -0
  91. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_call_graph_receiver_resolution.py +0 -0
  92. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_call_graph_smoke_roundtrip.py +0 -0
  93. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_call_invariant.py +0 -0
  94. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_cli_progress_stdout_invariant.py +0 -0
  95. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_cli_quiet_parity.py +0 -0
  96. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_client_hint_recovery.py +0 -0
  97. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_client_node_extraction.py +0 -0
  98. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_client_role_rename.py +0 -0
  99. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_edge_navigation_doc.py +0 -0
  100. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_graph_enrich.py +0 -0
  101. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_installer_integration.py +0 -0
  102. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_lance_optimize.py +0 -0
  103. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_lancedb_e2e.py +0 -0
  104. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_mcp_tools.py +0 -0
  105. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_mcp_v2_compose.py +0 -0
  106. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_meta_chain_core.py +0 -0
  107. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_microservice_scope.py +0 -0
  108. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_outgoing_call_extraction.py +0 -0
  109. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_path_filtering.py +0 -0
  110. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_pr_analysis.py +0 -0
  111. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_progress.py +0 -0
  112. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_resolve_routes_messaging_layer_c.py +0 -0
  113. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_route_extraction.py +0 -0
  114. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_schema_consistency.py +0 -0
  115. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_string_value_atoms.py +0 -0
  116. {java_codebase_rag-0.6.6 → java_codebase_rag-0.8.0}/tests/test_vectors_progress.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: java-codebase-rag
3
- Version: 0.6.6
3
+ Version: 0.8.0
4
4
  Summary: MCP server for semantic + structural search over Java codebases
5
5
  Author: HumanBean17
6
6
  License-Expression: MIT
@@ -15,12 +15,15 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Operating System :: MacOS :: MacOS X
20
+ Classifier: Operating System :: Microsoft :: Windows
18
21
  Requires-Python: >=3.11
19
22
  Description-Content-Type: text/markdown
20
23
  License-File: LICENSE
21
- Requires-Dist: cocoindex[lancedb]<2,>=1.0.0a43
24
+ Requires-Dist: cocoindex[lancedb]<2,>=1.0.7; sys_platform != "darwin" or platform_machine != "x86_64"
22
25
  Requires-Dist: ladybug<0.18,>=0.17.1
23
- Requires-Dist: lancedb<0.31,>=0.25.3
26
+ Requires-Dist: lancedb<0.31,>=0.25.3; sys_platform != "darwin" or platform_machine != "x86_64"
24
27
  Requires-Dist: mcp<2,>=1.27.0
25
28
  Requires-Dist: numpy<2.5,>=1.26.4
26
29
  Requires-Dist: pathspec<2,>=1.0.4
@@ -29,7 +32,7 @@ Requires-Dist: pydantic<3,>=2.0
29
32
  Requires-Dist: PyYAML<7,>=6.0.3
30
33
  Requires-Dist: questionary<3,>=2.0
31
34
  Requires-Dist: rich<15,>=14
32
- Requires-Dist: sentence-transformers<6,>=5.4.0
35
+ Requires-Dist: sentence-transformers<6,>=5.4.0; sys_platform != "darwin" or platform_machine != "x86_64"
33
36
  Requires-Dist: tree-sitter<0.26,>=0.25.2
34
37
  Requires-Dist: tree-sitter-java<0.24,>=0.23.5
35
38
  Requires-Dist: unidiff<1,>=0.7.3
@@ -42,9 +45,9 @@ Dynamic: license-file
42
45
 
43
46
  # java-codebase-rag
44
47
 
45
- A graph-native code intelligence layer for Java microservice estates, exposed to LLM agents via the **Model Context Protocol (MCP)**.
48
+ A graph-native code intelligence layer for Java microservice estates usable as an **MCP server** or a **CLI** (`jrag`), two surfaces over the same graph.
46
49
 
47
- The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **LadybugDB** (graph) alongside a **LanceDB** vector index (chunks), and exposes a deliberately small MCP surface **five tools**: `search`, `find`, `describe`, `neighbors`, `resolve` — that collapse onto three primitive agent operations: **locate**, **inspect**, **walk**.
50
+ The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **LadybugDB** (graph) alongside a **LanceDB** vector index (chunks), and exposes two agent surfaces, picked at install time (`java-codebase-rag install --surface mcp|cli`): the **MCP** surface ships five tools `search`, `find`, `describe`, `neighbors`, `resolve` — over stdio; the **CLI** surface ships `jrag`, one command per engineering intent. Both collapse onto three primitive operations: **locate**, **inspect**, **walk**.
48
51
 
49
52
  > **What this MCP is:** a **GPS for code navigation**, not a reasoning engine.
50
53
  > Agents use a simple loop:
@@ -73,7 +76,7 @@ Generic code-search tools (grep, ctags, vector-only RAG) hit a ceiling on real J
73
76
 
74
77
  - **Brownfield annotations as a first-class override.** Real Java estates have hand-rolled HTTP clients, dynamic topic names, reflection-heavy routing. `@CodebaseHttpRoute`, `@CodebaseAsyncRoute`, `@CodebaseHttpClient`, and `@CodebaseProducer` let you pin the truth in source. They have **exclusive priority** — when a symbol is annotated, framework-convention inference is skipped entirely. You get a correct graph on legacy code without rewriting it.
75
78
 
76
- The rest of this README is the install, walkthrough, and tool cheat sheet for putting that to work.
79
+ The rest of this README is the install, the tool/command orientation, and the reference for putting that to work.
77
80
 
78
81
  ---
79
82
 
@@ -83,8 +86,8 @@ The rest of this README is the install, walkthrough, and tool cheat sheet for pu
83
86
  pip install java-codebase-rag
84
87
  ```
85
88
 
86
- Python **3.11+** required. After install, `java-codebase-rag --help` should print the CLI groups.
87
- The package includes the CocoIndex lifecycle dependency used by `init`, `increment`, `reprocess`, and `erase`.
89
+ Python **3.11+** required, on **Linux, macOS, and Windows**. On Linux, Windows, and **Apple Silicon** Macs every native dependency (LanceDB, LadybugDB/kuzu, CocoIndex) ships a wheel and you get the full semantic + graph search. **Intel Macs (x86_64) install graph-only**: PyTorch ≥2.3 and LanceDB ≥0.26 dropped macOS Intel wheels, so the vector stack is auto-excluded via PEP 508 markers — `pip install java-codebase-rag` works out of the box, the graph layer (`find` / `describe` / `neighbors` / `resolve`) is fully usable, and the `search` (semantic) tool reports it is unavailable rather than failing. After install, `java-codebase-rag --help` should print the CLI groups.
90
+ The package includes the CocoIndex lifecycle dependency used by `init`, `increment`, `reprocess`, and `erase` on platforms that have it (it is absent on Intel Mac).
88
91
 
89
92
  ### Interactive setup (recommended)
90
93
 
@@ -117,89 +120,11 @@ If you prefer manual configuration, see [`docs/JAVA-CODEBASE-RAG-CLI.md`](./docs
117
120
 
118
121
  ---
119
122
 
120
- ## 5-minute walkthrough index this repo's bank-chat fixture
123
+ ## Tools & commands at a glance
121
124
 
122
- This repo ships a small multi-module Spring fixture under [`tests/bank-chat-system/`](./tests/bank-chat-system/) (`chat-core` + `chat-assign`) that the test suite uses for calibration. You can index it and confirm the install works end-to-end in under five minutes — no agent host required.
125
+ Pick a surface once at install time `java-codebase-rag install --surface mcp|cli` (default `mcp`). Both surfaces walk the same LanceDB vectors + LadybugDB graph.
123
126
 
124
- ```bash
125
- # 1. Clone the repo to get the fixture (the published package doesn't include tests/)
126
- git clone https://github.com/HumanBean17/java-codebase-rag
127
- cd java-codebase-rag
128
-
129
- # 2. Build the index (Lance vectors + LadybugDB graph). First run downloads the
130
- # embedding model (~90 MB) and takes ~30-60s on the fixture.
131
- java-codebase-rag init --source-root tests/bank-chat-system --index-dir /tmp/bank-chat-index
132
-
133
- # 3. Inspect what landed (resolved config, edge counts, ontology version)
134
- java-codebase-rag meta --source-root tests/bank-chat-system --index-dir /tmp/bank-chat-index
135
- ```
136
-
137
- Smoke-test the index with two checks (`search_lancedb` ships with the package):
138
-
139
- ```bash
140
- # Vector search — proves the LanceDB side works
141
- JAVA_CODEBASE_RAG_INDEX_DIR=/tmp/bank-chat-index \
142
- python -m search_lancedb "chat ingress controller" --table java --limit 3
143
-
144
- # Vector + graph expansion — proves LadybugDB is wired in
145
- JAVA_CODEBASE_RAG_INDEX_DIR=/tmp/bank-chat-index \
146
- python -m search_lancedb "chat ingress controller" --table java --limit 3 \
147
- --graph-expand --expand-depth 2
148
- ```
149
-
150
- If vector hits come back and graph expansion adds neighbor symbols, the install works end-to-end. Wire it into your agent next — the five MCP tools (`search`, `find`, `describe`, `neighbors`, `resolve`) are reachable over stdio.
151
-
152
- ---
153
-
154
- ## Wire into an MCP host
155
-
156
- > **Quick setup:** Run `java-codebase-rag install` from your Java project root. The interactive wizard handles MCP registration, skill deployment, and configuration for Claude Code, Qwen Code, and GigaCode in one step.
157
-
158
- ### Claude Code (manual)
159
-
160
- With the package installed, the console script `java-codebase-rag-mcp` is on your `PATH`. Register it project-scoped:
161
-
162
- ```bash
163
- claude mcp add --transport stdio java-codebase-rag -- java-codebase-rag-mcp
164
- ```
165
-
166
- **Zero-env-var configuration:** The tool automatically walks up the directory tree to find `.java-codebase-rag.yml`, so you don't need to set `JAVA_CODEBASE_RAG_SOURCE_ROOT` when working from within a project. Just place the config file at your project root and the tool will find it. See [`mcp.json.example`](./mcp.json.example) for the minimal configuration.
167
-
168
- If you need to override defaults, you can set env vars (`JAVA_CODEBASE_RAG_INDEX_DIR`, `JAVA_CODEBASE_RAG_SOURCE_ROOT`, `SBERT_MODEL`, …) in `.mcp.json` or your shell profile. For a full configuration template, see [`mcp.json.example`](./mcp.json.example). Official docs: [Claude Code settings](https://docs.anthropic.com/en/docs/claude-code/settings).
169
-
170
- ### Claude Desktop
171
-
172
- Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`) and add under `mcpServers`:
173
-
174
- ```json
175
- {
176
- "mcpServers": {
177
- "java-codebase-rag": {
178
- "command": "java-codebase-rag-mcp",
179
- "env": {
180
- "JAVA_CODEBASE_RAG_INDEX_DIR": "/ABSOLUTE/PATH/TO/.java-codebase-rag",
181
- "JAVA_CODEBASE_RAG_SOURCE_ROOT": "/ABSOLUTE/PATH/TO/your-java-project"
182
- }
183
- }
184
- }
185
- }
186
- ```
187
-
188
- See [`mcp.json.example`](./mcp.json.example) for the same shape in `.mcp.json` (Claude Code project-scoped) form.
189
-
190
- ### Driving the MCP from an agent
191
-
192
- Pick **one** of two options (not both — they cover the same navigation intents):
193
-
194
- 1. **[`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md)** (recommended for most) — standalone MCP operating manual. Copy-paste the `BEGIN`/`END` block into your project's `QWEN.md`, `CLAUDE.md`, or `AGENTS.md`. Contains: five-tool reference, `NodeFilter` / edge taxonomy, ontology glossary, recovery playbook, and navigation patterns. Self-contained — no external file dependencies.
195
-
196
- 2. **[`/explore-codebase`](./skills/explore-codebase/SKILL.md)** (for hosts with skill discovery) — single self-contained skill with the complete operating manual. If your MCP host supports skill discovery (Claude Code, Qwen Code, Cursor), load `/explore-codebase` to get the full tool reference, edge taxonomy, decision tree, and recovery playbook in one shot.
197
-
198
- Also: **[`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHECKLIST.md)** — 7-phase agent-driven verification you run after indexing your real project.
199
-
200
- ---
201
-
202
- ## The five tools, at a glance
127
+ **MCP surface — five tools over stdio**
203
128
 
204
129
  | Tool | Purpose | Required args |
205
130
  |---|---|---|
@@ -211,9 +136,63 @@ Also: **[`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHE
211
136
 
212
137
  Full schemas, `NodeFilter` / `EdgeFilter` semantics, and the hints contract live in [`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md). Edge types and traversal directions are listed in [`docs/EDGE-NAVIGATION.md`](./docs/EDGE-NAVIGATION.md).
213
138
 
139
+ **CLI surface — `jrag`, one command per engineering intent**
140
+
141
+ ```bash
142
+ # Orientation
143
+ jrag status # index health (ontology version, freshness, counts)
144
+ jrag microservices # microservices with resolved type counts
145
+ jrag map # counts per kind per service/module
146
+ jrag map --module # group by module instead
147
+ jrag conventions # dominant roles + framework tallies
148
+ jrag overview chat-core # bundle for a microservice
149
+ jrag overview /chat/assign # route flow (inbound callers + outbound CALLS)
150
+ jrag overview banking.chat # topic producers + consumers
151
+ jrag overview chat-core --as microservice # override auto-detection
152
+
153
+ # Locate
154
+ jrag find ChatService # exact name/FQN lookup (symbols)
155
+ jrag find --role CONTROLLER # filter mode (NodeFilter flags)
156
+ jrag inspect ChatService # full node details + edge_summary
157
+ jrag outline src/main/.../Foo.java # all symbols declared in a file
158
+ jrag imports src/main/.../Foo.java # imports resolved to graph nodes
159
+
160
+ # Listings
161
+ jrag http-routes # HTTP routes
162
+ jrag http-clients # HTTP clients (Feign / RestTemplate / WebClient)
163
+ jrag producers # async message producers (Kafka / StreamBridge)
164
+ jrag topics # message topics grouped by producer
165
+ jrag jobs # scheduled tasks (@Scheduled)
166
+ jrag listeners # message listeners (@KafkaListener etc.)
167
+ jrag entities # JPA entities
168
+
169
+ # Traversals (all resolve-first)
170
+ jrag callers ChatService#assign(Request) # who calls me?
171
+ jrag callees ChatService#assign(Request) # what do I call?
172
+ jrag hierarchy AbstractBase # type tree (parents + children)
173
+ jrag implementations PaymentProcessor # classes implementing an interface
174
+ jrag subclasses AbstractRepository # classes extending a type
175
+ jrag overrides Impl#run() # methods this overrides (dispatch UP)
176
+ jrag overridden-by Iface#run() # methods overriding this (dispatch DOWN)
177
+ jrag dependents PaymentGateway # who injects this type?
178
+ jrag dependencies ChatService # types this injects
179
+ jrag impact PaymentGateway # fleet-wide blast radius
180
+ jrag decompose ChatIngressController#assign # role-waterfall flow
181
+ jrag flow /chat/assign # request flow through a route
182
+ jrag connection chat-core # cross-service connections
183
+
184
+ # Semantic search
185
+ jrag search "assign a chat agent" # semantic over Lance (java table)
186
+ jrag search "kafka" --table all # java + sql + yaml tables
187
+ jrag search "audit" --hybrid # vector + keyword hybrid
188
+ jrag search "audit" --offset 5 # paginated
189
+ ```
190
+
191
+ Every `<query>` command takes human-readable identifiers (FQN / simple name / route path / topic) — never raw node IDs. Output contract, flags, and the resolve-first rule are in [`jrag` — agent CLI](#jrag--agent-cli) below.
192
+
214
193
  ### Three-layer architecture
215
194
 
216
- Layer 1 (storage) → Layer 2 (5 MCP tools) → Layer 3 (skill). The [`/explore-codebase`](./skills/explore-codebase/SKILL.md) skill provides the full operating manual for Layer 2. See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
195
+ Layer 1 (storage) → Layer 2 (5 MCP tools **or** the `jrag` CLI) → Layer 3 (skill). The MCP-surface skill **[`/explore-codebase`](./skills/explore-codebase/SKILL.md)** documents the 5-tool MCP; the CLI-surface skill **[`/explore-codebase-cli`](./skills/explore-codebase-cli/SKILL.md)** documents the `jrag` CLI (PR-JRAG-5). See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
217
196
 
218
197
  ---
219
198
 
@@ -249,6 +228,71 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
249
228
 
250
229
  ---
251
230
 
231
+ ## jrag — agent CLI
232
+
233
+ `jrag` is a separate console script (alongside `java-codebase-rag`) built for AI
234
+ coding agents. It gives the agent **one command per engineering intent** and
235
+ takes human-readable identifiers (FQN / simple name / route path / topic) —
236
+ never raw node IDs. Every `<query>` command resolves the identifier via
237
+ `resolve_v2` as the first step; on `many` it returns candidates and stops, on
238
+ `none` it returns `not_found`. Auto-pick is forbidden.
239
+
240
+ The default output is compact text (a deliberate divergence from the operator
241
+ CLI's TTY heuristic — `jrag` is agent-facing/non-TTY). `--format json` emits the
242
+ shared envelope verbatim. Every command emits the same envelope shape:
243
+
244
+ ```json
245
+ {
246
+ "status": "ok",
247
+ "nodes": {"com.example.Foo": {"kind": "symbol", "fqn": "com.example.Foo"}},
248
+ "edges": [{"edge_type": "CALLS", "confidence": 0.9, "target": "com.example.Bar#baz()"}],
249
+ "root": "com.example.Foo",
250
+ "agent_next_actions": ["jrag callees com.example.Foo#bar()"],
251
+ "truncated": false
252
+ }
253
+ ```
254
+
255
+ No raw graph node id ever appears on either surface: `nodes` is keyed by each
256
+ node's natural identifier (FQN for symbols, `METHOD path` for routes,
257
+ `member_fqn->target` for clients, `topic:<name>` for topics), `root` is the
258
+ root's natural identifier, and each edge carries `target` (the referenced node's
259
+ identifier) instead of a graph id. The agent reuses these identifiers directly
260
+ as the next command's `<query>` — there is nothing else to pass.
261
+
262
+ `agent_next_actions` carries up to 5 contextual next-step hints (e.g. after
263
+ `inspect`, the agent sees `jrag callers <fqn>`, `jrag callees <fqn>`, etc. for
264
+ the edges the root actually has). Omitted from JSON when empty.
265
+
266
+ The full command catalog lives in [Tools & commands at a glance](#tools--commands-at-a-glance).
267
+
268
+ ### Flags
269
+
270
+ | Flag | Scope | Effect |
271
+ |------|-------|--------|
272
+ | `--format text\|json` | all | output format (default: text) |
273
+ | `--service <name>` | listings/traversals | filter by microservice |
274
+ | `--module <name>` | listings/traversals | filter by module |
275
+ | `--limit <n>` | listings/traversals | cap results (default 20; `limit+1` fetch detects truncation) |
276
+ | `--offset <n>` | `find`, `search` only | paginate (other commands reject it) |
277
+ | `--kind symbol\|route\|client\|producer` | `<query>` commands | resolve hint |
278
+ | `--java-kind`, `--role`, `--fqn-contains` | `<query>` commands | client-side post-filters |
279
+ | `--index-dir <path>` | all | override index directory |
280
+
281
+ `--offset` is intentionally NOT a global flag: only `find` and `search` route
282
+ through backends that accept it. Every other command rejects it.
283
+
284
+ A missing or stale index produces an actionable `status: error` envelope (exit
285
+ 2) rather than a traceback:
286
+
287
+ ```
288
+ error: No index at /path/to/code_graph.lbug. Run: java-codebase-rag init --source-root <root>
289
+ ```
290
+
291
+ See [`plans/active/PLAN-JRAG-CLI.md`](./plans/active/PLAN-JRAG-CLI.md) for the
292
+ full design and per-PR breakdown.
293
+
294
+ ---
295
+
252
296
  ## Further reading
253
297
 
254
298
  | Document | What's in it |
@@ -258,10 +302,9 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
258
302
  | [`docs/CONFIGURATION.md`](./docs/CONFIGURATION.md) | Environment variables, project YAML, graph ontology, brownfield overrides, ignore patterns. |
259
303
  | [`docs/JAVA-CODEBASE-RAG-CLI.md`](./docs/JAVA-CODEBASE-RAG-CLI.md) | CLI operator playbook: workflows, exit codes, env alignment. |
260
304
  | [`docs/EDGE-NAVIGATION.md`](./docs/EDGE-NAVIGATION.md) | MCP-traversable edges, directions, dot-key composition. |
261
- | [`skills/`](./skills/) | Single `/explore-codebase` skill complete MCP operating manual for hosts with skill discovery (alternative to copy-pasting AGENT-GUIDE). See [`skills/README.md`](./skills/README.md). |
305
+ | [`skills/`](./skills/) | `/explore-codebase` (MCP surface) + `/explore-codebase-cli` (CLI surface) skills operating manuals for hosts with skill discovery (alternative to copy-pasting AGENT-GUIDE). See [`skills/README.md`](./skills/README.md). |
262
306
  | [`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHECKLIST.md) | 7-phase agent-driven verification after indexing your project. |
263
307
  | [`docs/CODEBASE_REQUIREMENTS.md`](./docs/CODEBASE_REQUIREMENTS.md) | Assumptions about your Java repo + per-file edit map for non-conforming codebases. |
264
- | [`automation/cursor_propose_only/README.md`](./automation/cursor_propose_only/README.md) | Optional proposal orchestration workflow (single-command autopilot, planning bundles, automated execution/review loops). |
265
308
  | [`docs/PRODUCT-VISION.md`](./docs/PRODUCT-VISION.md) | Long-term product direction. |
266
309
 
267
310
  ---
@@ -272,7 +315,7 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
272
315
  git clone https://github.com/HumanBean17/java-codebase-rag
273
316
  cd java-codebase-rag
274
317
  python3 -m venv .venv
275
- .venv/bin/pip install -r requirements.txt
318
+ .venv/bin/pip install -e ".[dev]"
276
319
  ```
277
320
 
278
321
  The `cocoindex` package powers lifecycle commands that run the indexer (`init`, `increment`, `reprocess`, `erase`). Search and MCP navigation do not invoke it directly.
@@ -1,8 +1,8 @@
1
1
  # java-codebase-rag
2
2
 
3
- A graph-native code intelligence layer for Java microservice estates, exposed to LLM agents via the **Model Context Protocol (MCP)**.
3
+ A graph-native code intelligence layer for Java microservice estates usable as an **MCP server** or a **CLI** (`jrag`), two surfaces over the same graph.
4
4
 
5
- The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **LadybugDB** (graph) alongside a **LanceDB** vector index (chunks), and exposes a deliberately small MCP surface **five tools**: `search`, `find`, `describe`, `neighbors`, `resolve` — that collapse onto three primitive agent operations: **locate**, **inspect**, **walk**.
5
+ The system extracts a deterministic property graph from Java source (tree-sitter), stores it in **LadybugDB** (graph) alongside a **LanceDB** vector index (chunks), and exposes two agent surfaces, picked at install time (`java-codebase-rag install --surface mcp|cli`): the **MCP** surface ships five tools `search`, `find`, `describe`, `neighbors`, `resolve` — over stdio; the **CLI** surface ships `jrag`, one command per engineering intent. Both collapse onto three primitive operations: **locate**, **inspect**, **walk**.
6
6
 
7
7
  > **What this MCP is:** a **GPS for code navigation**, not a reasoning engine.
8
8
  > Agents use a simple loop:
@@ -31,7 +31,7 @@ Generic code-search tools (grep, ctags, vector-only RAG) hit a ceiling on real J
31
31
 
32
32
  - **Brownfield annotations as a first-class override.** Real Java estates have hand-rolled HTTP clients, dynamic topic names, reflection-heavy routing. `@CodebaseHttpRoute`, `@CodebaseAsyncRoute`, `@CodebaseHttpClient`, and `@CodebaseProducer` let you pin the truth in source. They have **exclusive priority** — when a symbol is annotated, framework-convention inference is skipped entirely. You get a correct graph on legacy code without rewriting it.
33
33
 
34
- The rest of this README is the install, walkthrough, and tool cheat sheet for putting that to work.
34
+ The rest of this README is the install, the tool/command orientation, and the reference for putting that to work.
35
35
 
36
36
  ---
37
37
 
@@ -41,8 +41,8 @@ The rest of this README is the install, walkthrough, and tool cheat sheet for pu
41
41
  pip install java-codebase-rag
42
42
  ```
43
43
 
44
- Python **3.11+** required. After install, `java-codebase-rag --help` should print the CLI groups.
45
- The package includes the CocoIndex lifecycle dependency used by `init`, `increment`, `reprocess`, and `erase`.
44
+ Python **3.11+** required, on **Linux, macOS, and Windows**. On Linux, Windows, and **Apple Silicon** Macs every native dependency (LanceDB, LadybugDB/kuzu, CocoIndex) ships a wheel and you get the full semantic + graph search. **Intel Macs (x86_64) install graph-only**: PyTorch ≥2.3 and LanceDB ≥0.26 dropped macOS Intel wheels, so the vector stack is auto-excluded via PEP 508 markers — `pip install java-codebase-rag` works out of the box, the graph layer (`find` / `describe` / `neighbors` / `resolve`) is fully usable, and the `search` (semantic) tool reports it is unavailable rather than failing. After install, `java-codebase-rag --help` should print the CLI groups.
45
+ The package includes the CocoIndex lifecycle dependency used by `init`, `increment`, `reprocess`, and `erase` on platforms that have it (it is absent on Intel Mac).
46
46
 
47
47
  ### Interactive setup (recommended)
48
48
 
@@ -75,89 +75,11 @@ If you prefer manual configuration, see [`docs/JAVA-CODEBASE-RAG-CLI.md`](./docs
75
75
 
76
76
  ---
77
77
 
78
- ## 5-minute walkthrough index this repo's bank-chat fixture
78
+ ## Tools & commands at a glance
79
79
 
80
- This repo ships a small multi-module Spring fixture under [`tests/bank-chat-system/`](./tests/bank-chat-system/) (`chat-core` + `chat-assign`) that the test suite uses for calibration. You can index it and confirm the install works end-to-end in under five minutes — no agent host required.
80
+ Pick a surface once at install time `java-codebase-rag install --surface mcp|cli` (default `mcp`). Both surfaces walk the same LanceDB vectors + LadybugDB graph.
81
81
 
82
- ```bash
83
- # 1. Clone the repo to get the fixture (the published package doesn't include tests/)
84
- git clone https://github.com/HumanBean17/java-codebase-rag
85
- cd java-codebase-rag
86
-
87
- # 2. Build the index (Lance vectors + LadybugDB graph). First run downloads the
88
- # embedding model (~90 MB) and takes ~30-60s on the fixture.
89
- java-codebase-rag init --source-root tests/bank-chat-system --index-dir /tmp/bank-chat-index
90
-
91
- # 3. Inspect what landed (resolved config, edge counts, ontology version)
92
- java-codebase-rag meta --source-root tests/bank-chat-system --index-dir /tmp/bank-chat-index
93
- ```
94
-
95
- Smoke-test the index with two checks (`search_lancedb` ships with the package):
96
-
97
- ```bash
98
- # Vector search — proves the LanceDB side works
99
- JAVA_CODEBASE_RAG_INDEX_DIR=/tmp/bank-chat-index \
100
- python -m search_lancedb "chat ingress controller" --table java --limit 3
101
-
102
- # Vector + graph expansion — proves LadybugDB is wired in
103
- JAVA_CODEBASE_RAG_INDEX_DIR=/tmp/bank-chat-index \
104
- python -m search_lancedb "chat ingress controller" --table java --limit 3 \
105
- --graph-expand --expand-depth 2
106
- ```
107
-
108
- If vector hits come back and graph expansion adds neighbor symbols, the install works end-to-end. Wire it into your agent next — the five MCP tools (`search`, `find`, `describe`, `neighbors`, `resolve`) are reachable over stdio.
109
-
110
- ---
111
-
112
- ## Wire into an MCP host
113
-
114
- > **Quick setup:** Run `java-codebase-rag install` from your Java project root. The interactive wizard handles MCP registration, skill deployment, and configuration for Claude Code, Qwen Code, and GigaCode in one step.
115
-
116
- ### Claude Code (manual)
117
-
118
- With the package installed, the console script `java-codebase-rag-mcp` is on your `PATH`. Register it project-scoped:
119
-
120
- ```bash
121
- claude mcp add --transport stdio java-codebase-rag -- java-codebase-rag-mcp
122
- ```
123
-
124
- **Zero-env-var configuration:** The tool automatically walks up the directory tree to find `.java-codebase-rag.yml`, so you don't need to set `JAVA_CODEBASE_RAG_SOURCE_ROOT` when working from within a project. Just place the config file at your project root and the tool will find it. See [`mcp.json.example`](./mcp.json.example) for the minimal configuration.
125
-
126
- If you need to override defaults, you can set env vars (`JAVA_CODEBASE_RAG_INDEX_DIR`, `JAVA_CODEBASE_RAG_SOURCE_ROOT`, `SBERT_MODEL`, …) in `.mcp.json` or your shell profile. For a full configuration template, see [`mcp.json.example`](./mcp.json.example). Official docs: [Claude Code settings](https://docs.anthropic.com/en/docs/claude-code/settings).
127
-
128
- ### Claude Desktop
129
-
130
- Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`) and add under `mcpServers`:
131
-
132
- ```json
133
- {
134
- "mcpServers": {
135
- "java-codebase-rag": {
136
- "command": "java-codebase-rag-mcp",
137
- "env": {
138
- "JAVA_CODEBASE_RAG_INDEX_DIR": "/ABSOLUTE/PATH/TO/.java-codebase-rag",
139
- "JAVA_CODEBASE_RAG_SOURCE_ROOT": "/ABSOLUTE/PATH/TO/your-java-project"
140
- }
141
- }
142
- }
143
- }
144
- ```
145
-
146
- See [`mcp.json.example`](./mcp.json.example) for the same shape in `.mcp.json` (Claude Code project-scoped) form.
147
-
148
- ### Driving the MCP from an agent
149
-
150
- Pick **one** of two options (not both — they cover the same navigation intents):
151
-
152
- 1. **[`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md)** (recommended for most) — standalone MCP operating manual. Copy-paste the `BEGIN`/`END` block into your project's `QWEN.md`, `CLAUDE.md`, or `AGENTS.md`. Contains: five-tool reference, `NodeFilter` / edge taxonomy, ontology glossary, recovery playbook, and navigation patterns. Self-contained — no external file dependencies.
153
-
154
- 2. **[`/explore-codebase`](./skills/explore-codebase/SKILL.md)** (for hosts with skill discovery) — single self-contained skill with the complete operating manual. If your MCP host supports skill discovery (Claude Code, Qwen Code, Cursor), load `/explore-codebase` to get the full tool reference, edge taxonomy, decision tree, and recovery playbook in one shot.
155
-
156
- Also: **[`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHECKLIST.md)** — 7-phase agent-driven verification you run after indexing your real project.
157
-
158
- ---
159
-
160
- ## The five tools, at a glance
82
+ **MCP surface — five tools over stdio**
161
83
 
162
84
  | Tool | Purpose | Required args |
163
85
  |---|---|---|
@@ -169,9 +91,63 @@ Also: **[`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHE
169
91
 
170
92
  Full schemas, `NodeFilter` / `EdgeFilter` semantics, and the hints contract live in [`docs/AGENT-GUIDE.md`](./docs/AGENT-GUIDE.md). Edge types and traversal directions are listed in [`docs/EDGE-NAVIGATION.md`](./docs/EDGE-NAVIGATION.md).
171
93
 
94
+ **CLI surface — `jrag`, one command per engineering intent**
95
+
96
+ ```bash
97
+ # Orientation
98
+ jrag status # index health (ontology version, freshness, counts)
99
+ jrag microservices # microservices with resolved type counts
100
+ jrag map # counts per kind per service/module
101
+ jrag map --module # group by module instead
102
+ jrag conventions # dominant roles + framework tallies
103
+ jrag overview chat-core # bundle for a microservice
104
+ jrag overview /chat/assign # route flow (inbound callers + outbound CALLS)
105
+ jrag overview banking.chat # topic producers + consumers
106
+ jrag overview chat-core --as microservice # override auto-detection
107
+
108
+ # Locate
109
+ jrag find ChatService # exact name/FQN lookup (symbols)
110
+ jrag find --role CONTROLLER # filter mode (NodeFilter flags)
111
+ jrag inspect ChatService # full node details + edge_summary
112
+ jrag outline src/main/.../Foo.java # all symbols declared in a file
113
+ jrag imports src/main/.../Foo.java # imports resolved to graph nodes
114
+
115
+ # Listings
116
+ jrag http-routes # HTTP routes
117
+ jrag http-clients # HTTP clients (Feign / RestTemplate / WebClient)
118
+ jrag producers # async message producers (Kafka / StreamBridge)
119
+ jrag topics # message topics grouped by producer
120
+ jrag jobs # scheduled tasks (@Scheduled)
121
+ jrag listeners # message listeners (@KafkaListener etc.)
122
+ jrag entities # JPA entities
123
+
124
+ # Traversals (all resolve-first)
125
+ jrag callers ChatService#assign(Request) # who calls me?
126
+ jrag callees ChatService#assign(Request) # what do I call?
127
+ jrag hierarchy AbstractBase # type tree (parents + children)
128
+ jrag implementations PaymentProcessor # classes implementing an interface
129
+ jrag subclasses AbstractRepository # classes extending a type
130
+ jrag overrides Impl#run() # methods this overrides (dispatch UP)
131
+ jrag overridden-by Iface#run() # methods overriding this (dispatch DOWN)
132
+ jrag dependents PaymentGateway # who injects this type?
133
+ jrag dependencies ChatService # types this injects
134
+ jrag impact PaymentGateway # fleet-wide blast radius
135
+ jrag decompose ChatIngressController#assign # role-waterfall flow
136
+ jrag flow /chat/assign # request flow through a route
137
+ jrag connection chat-core # cross-service connections
138
+
139
+ # Semantic search
140
+ jrag search "assign a chat agent" # semantic over Lance (java table)
141
+ jrag search "kafka" --table all # java + sql + yaml tables
142
+ jrag search "audit" --hybrid # vector + keyword hybrid
143
+ jrag search "audit" --offset 5 # paginated
144
+ ```
145
+
146
+ Every `<query>` command takes human-readable identifiers (FQN / simple name / route path / topic) — never raw node IDs. Output contract, flags, and the resolve-first rule are in [`jrag` — agent CLI](#jrag--agent-cli) below.
147
+
172
148
  ### Three-layer architecture
173
149
 
174
- Layer 1 (storage) → Layer 2 (5 MCP tools) → Layer 3 (skill). The [`/explore-codebase`](./skills/explore-codebase/SKILL.md) skill provides the full operating manual for Layer 2. See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
150
+ Layer 1 (storage) → Layer 2 (5 MCP tools **or** the `jrag` CLI) → Layer 3 (skill). The MCP-surface skill **[`/explore-codebase`](./skills/explore-codebase/SKILL.md)** documents the 5-tool MCP; the CLI-surface skill **[`/explore-codebase-cli`](./skills/explore-codebase-cli/SKILL.md)** documents the `jrag` CLI (PR-JRAG-5). See the [architecture diagram in `skills/README.md`](./skills/README.md#three-layer-architecture).
175
151
 
176
152
  ---
177
153
 
@@ -207,6 +183,71 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
207
183
 
208
184
  ---
209
185
 
186
+ ## jrag — agent CLI
187
+
188
+ `jrag` is a separate console script (alongside `java-codebase-rag`) built for AI
189
+ coding agents. It gives the agent **one command per engineering intent** and
190
+ takes human-readable identifiers (FQN / simple name / route path / topic) —
191
+ never raw node IDs. Every `<query>` command resolves the identifier via
192
+ `resolve_v2` as the first step; on `many` it returns candidates and stops, on
193
+ `none` it returns `not_found`. Auto-pick is forbidden.
194
+
195
+ The default output is compact text (a deliberate divergence from the operator
196
+ CLI's TTY heuristic — `jrag` is agent-facing/non-TTY). `--format json` emits the
197
+ shared envelope verbatim. Every command emits the same envelope shape:
198
+
199
+ ```json
200
+ {
201
+ "status": "ok",
202
+ "nodes": {"com.example.Foo": {"kind": "symbol", "fqn": "com.example.Foo"}},
203
+ "edges": [{"edge_type": "CALLS", "confidence": 0.9, "target": "com.example.Bar#baz()"}],
204
+ "root": "com.example.Foo",
205
+ "agent_next_actions": ["jrag callees com.example.Foo#bar()"],
206
+ "truncated": false
207
+ }
208
+ ```
209
+
210
+ No raw graph node id ever appears on either surface: `nodes` is keyed by each
211
+ node's natural identifier (FQN for symbols, `METHOD path` for routes,
212
+ `member_fqn->target` for clients, `topic:<name>` for topics), `root` is the
213
+ root's natural identifier, and each edge carries `target` (the referenced node's
214
+ identifier) instead of a graph id. The agent reuses these identifiers directly
215
+ as the next command's `<query>` — there is nothing else to pass.
216
+
217
+ `agent_next_actions` carries up to 5 contextual next-step hints (e.g. after
218
+ `inspect`, the agent sees `jrag callers <fqn>`, `jrag callees <fqn>`, etc. for
219
+ the edges the root actually has). Omitted from JSON when empty.
220
+
221
+ The full command catalog lives in [Tools & commands at a glance](#tools--commands-at-a-glance).
222
+
223
+ ### Flags
224
+
225
+ | Flag | Scope | Effect |
226
+ |------|-------|--------|
227
+ | `--format text\|json` | all | output format (default: text) |
228
+ | `--service <name>` | listings/traversals | filter by microservice |
229
+ | `--module <name>` | listings/traversals | filter by module |
230
+ | `--limit <n>` | listings/traversals | cap results (default 20; `limit+1` fetch detects truncation) |
231
+ | `--offset <n>` | `find`, `search` only | paginate (other commands reject it) |
232
+ | `--kind symbol\|route\|client\|producer` | `<query>` commands | resolve hint |
233
+ | `--java-kind`, `--role`, `--fqn-contains` | `<query>` commands | client-side post-filters |
234
+ | `--index-dir <path>` | all | override index directory |
235
+
236
+ `--offset` is intentionally NOT a global flag: only `find` and `search` route
237
+ through backends that accept it. Every other command rejects it.
238
+
239
+ A missing or stale index produces an actionable `status: error` envelope (exit
240
+ 2) rather than a traceback:
241
+
242
+ ```
243
+ error: No index at /path/to/code_graph.lbug. Run: java-codebase-rag init --source-root <root>
244
+ ```
245
+
246
+ See [`plans/active/PLAN-JRAG-CLI.md`](./plans/active/PLAN-JRAG-CLI.md) for the
247
+ full design and per-PR breakdown.
248
+
249
+ ---
250
+
210
251
  ## Further reading
211
252
 
212
253
  | Document | What's in it |
@@ -216,10 +257,9 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
216
257
  | [`docs/CONFIGURATION.md`](./docs/CONFIGURATION.md) | Environment variables, project YAML, graph ontology, brownfield overrides, ignore patterns. |
217
258
  | [`docs/JAVA-CODEBASE-RAG-CLI.md`](./docs/JAVA-CODEBASE-RAG-CLI.md) | CLI operator playbook: workflows, exit codes, env alignment. |
218
259
  | [`docs/EDGE-NAVIGATION.md`](./docs/EDGE-NAVIGATION.md) | MCP-traversable edges, directions, dot-key composition. |
219
- | [`skills/`](./skills/) | Single `/explore-codebase` skill complete MCP operating manual for hosts with skill discovery (alternative to copy-pasting AGENT-GUIDE). See [`skills/README.md`](./skills/README.md). |
260
+ | [`skills/`](./skills/) | `/explore-codebase` (MCP surface) + `/explore-codebase-cli` (CLI surface) skills operating manuals for hosts with skill discovery (alternative to copy-pasting AGENT-GUIDE). See [`skills/README.md`](./skills/README.md). |
220
261
  | [`docs/MANUAL-VERIFICATION-CHECKLIST.md`](./docs/MANUAL-VERIFICATION-CHECKLIST.md) | 7-phase agent-driven verification after indexing your project. |
221
262
  | [`docs/CODEBASE_REQUIREMENTS.md`](./docs/CODEBASE_REQUIREMENTS.md) | Assumptions about your Java repo + per-file edit map for non-conforming codebases. |
222
- | [`automation/cursor_propose_only/README.md`](./automation/cursor_propose_only/README.md) | Optional proposal orchestration workflow (single-command autopilot, planning bundles, automated execution/review loops). |
223
263
  | [`docs/PRODUCT-VISION.md`](./docs/PRODUCT-VISION.md) | Long-term product direction. |
224
264
 
225
265
  ---
@@ -230,7 +270,7 @@ Run `java-codebase-rag --help` to list grouped subcommands. Operator playbook wi
230
270
  git clone https://github.com/HumanBean17/java-codebase-rag
231
271
  cd java-codebase-rag
232
272
  python3 -m venv .venv
233
- .venv/bin/pip install -r requirements.txt
273
+ .venv/bin/pip install -e ".[dev]"
234
274
  ```
235
275
 
236
276
  The `cocoindex` package powers lifecycle commands that run the indexer (`init`, `increment`, `reprocess`, `erase`). Search and MCP navigation do not invoke it directly.
@@ -1868,6 +1868,11 @@ def _collect_outgoing_calls(
1868
1868
  file_rel: str,
1869
1869
  ) -> list[OutgoingCallDecl]:
1870
1870
  del project_root
1871
+ from java_ontology import ( # deferred: java_ontology imports ast_java
1872
+ CLIENT_KIND_FEIGN_METHOD,
1873
+ CLIENT_KIND_REST_TEMPLATE,
1874
+ CLIENT_KIND_WEB_CLIENT,
1875
+ )
1871
1876
  out: list[OutgoingCallDecl] = []
1872
1877
  method_fqn = f"{type_fqn}#{method_decl.signature}"
1873
1878
  type_mods = _find_modifiers_child(type_node) if type_node is not None else None
@@ -1899,7 +1904,7 @@ def _collect_outgoing_calls(
1899
1904
  OutgoingCallDecl(
1900
1905
  method_fqn=method_fqn,
1901
1906
  method_sig=method_decl.signature,
1902
- client_kind="feign_method",
1907
+ client_kind=CLIENT_KIND_FEIGN_METHOD,
1903
1908
  channel="http",
1904
1909
  feign_target_name=feign_target_name,
1905
1910
  feign_target_url=feign_target_url,
@@ -1998,7 +2003,7 @@ def _collect_outgoing_calls(
1998
2003
  OutgoingCallDecl(
1999
2004
  method_fqn=method_fqn,
2000
2005
  method_sig=method_decl.signature,
2001
- client_kind="rest_template",
2006
+ client_kind=CLIENT_KIND_REST_TEMPLATE,
2002
2007
  channel="http",
2003
2008
  feign_target_name="",
2004
2009
  feign_target_url="",
@@ -2051,7 +2056,7 @@ def _collect_outgoing_calls(
2051
2056
  OutgoingCallDecl(
2052
2057
  method_fqn=method_fqn,
2053
2058
  method_sig=method_decl.signature,
2054
- client_kind="web_client",
2059
+ client_kind=CLIENT_KIND_WEB_CLIENT,
2055
2060
  channel="http",
2056
2061
  feign_target_name="",
2057
2062
  feign_target_url="",