@octocodeai/octocode-tools-core 18.1.2 → 18.3.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 (224) hide show
  1. package/README.md +113 -162
  2. package/dist/cacheMaintenance.d.ts +8 -0
  3. package/dist/direct.js +41 -51
  4. package/dist/github/client.d.ts +1 -1
  5. package/dist/github/codeSearch.d.ts +2 -2
  6. package/dist/github/commit.d.ts +48 -0
  7. package/dist/github/compare.d.ts +2 -2
  8. package/dist/github/directoryFetch/fetchDirectoryContents.d.ts +1 -1
  9. package/dist/github/directoryFetch/fetchFileContentToDisk.d.ts +1 -1
  10. package/dist/github/directoryFetch/refResolution.d.ts +6 -0
  11. package/dist/github/fileContent.d.ts +1 -1
  12. package/dist/github/fileContentRaw/fetch.d.ts +2 -2
  13. package/dist/github/githubAPI.d.ts +1 -2
  14. package/dist/github/history/commitFiles.d.ts +5 -0
  15. package/dist/github/history.d.ts +1 -1
  16. package/dist/github/issues/fetchers.d.ts +1 -1
  17. package/dist/github/issues/orchestrator.d.ts +1 -1
  18. package/dist/github/issues/types.d.ts +5 -0
  19. package/dist/github/prByNumber.d.ts +1 -1
  20. package/dist/github/prContentFetcher/commits.d.ts +1 -1
  21. package/dist/github/prContentFetcher/transform.d.ts +1 -1
  22. package/dist/github/pullRequestSearch.d.ts +1 -1
  23. package/dist/github/queryBuilders/codeAndRepo.d.ts +1 -1
  24. package/dist/github/repoSearch.d.ts +2 -2
  25. package/dist/github/repoStructure/contentResolution.d.ts +1 -1
  26. package/dist/github/repoStructure/fetchOrchestration.d.ts +2 -2
  27. package/dist/github/repoStructurePagination.d.ts +1 -1
  28. package/dist/graph/advancedOperations.d.ts +22 -0
  29. package/dist/{tools/local_dead_code/graphBuilder.d.ts → graph/buildFileGraph.d.ts} +6 -5
  30. package/dist/graph/cycleOperations.d.ts +12 -0
  31. package/dist/{tools/local_dead_code → graph}/importResolver.d.ts +1 -1
  32. package/dist/graph/operations.d.ts +7 -0
  33. package/dist/{tools/local_dead_code → graph}/reachability.d.ts +1 -1
  34. package/dist/{tools/local_dead_code → graph}/types.d.ts +11 -0
  35. package/dist/graph/workspacePackageResolver.d.ts +2 -0
  36. package/dist/index.d.ts +11 -30
  37. package/dist/index.js +45 -55
  38. package/dist/providers/github/githubContent.d.ts +1 -1
  39. package/dist/providers/github/githubPullRequests.d.ts +1 -1
  40. package/dist/providers/github/githubSearch.d.ts +1 -1
  41. package/dist/providers/github/githubStructure.d.ts +1 -1
  42. package/dist/providers/github/paginationMetadata.d.ts +4 -5
  43. package/dist/providers/providerQueries.d.ts +1 -3
  44. package/dist/providers/providerResults.d.ts +4 -0
  45. package/dist/providers/types.d.ts +1 -1
  46. package/dist/responses.d.ts +1 -1
  47. package/dist/schema.d.ts +2 -0
  48. package/dist/schema.js +13 -1
  49. package/dist/scheme/conditionalSchemas.d.ts +12 -0
  50. package/dist/scheme/fields.d.ts +2 -1
  51. package/dist/security/bridge.d.ts +7 -10
  52. package/dist/shared/credentials/index.js +2 -2
  53. package/dist/shared/paths.d.ts +1 -0
  54. package/dist/shared/paths.js +1 -1
  55. package/dist/shared/session/index.js +1 -1
  56. package/dist/toolContract/descriptions.d.ts +14 -0
  57. package/dist/toolContract/input/resources/global.d.ts +15 -0
  58. package/dist/toolContract/input/resources/toolRelations.d.ts +1 -0
  59. package/dist/toolContract/input/resources/toolVariants.d.ts +9 -0
  60. package/dist/toolContract/input/resources/tools/_toolkit.d.ts +75 -0
  61. package/dist/toolContract/input/resources/tools/ghCloneRepo.d.ts +12 -0
  62. package/dist/toolContract/input/resources/tools/ghGetFileContent.d.ts +30 -0
  63. package/dist/toolContract/input/resources/tools/ghSearch.d.ts +76 -0
  64. package/dist/toolContract/input/resources/tools/githubCodeOperation.d.ts +29 -0
  65. package/dist/toolContract/input/resources/tools/githubHistorySchema.d.ts +114 -0
  66. package/dist/toolContract/input/resources/tools/githubRepositoriesOperation.d.ts +54 -0
  67. package/dist/toolContract/input/resources/tools/githubTreeOperation.d.ts +26 -0
  68. package/dist/toolContract/input/resources/tools/historyCommitInput.d.ts +21 -0
  69. package/dist/toolContract/input/resources/tools/historyIssueInput.d.ts +59 -0
  70. package/dist/toolContract/input/resources/tools/historyPullRequestInput.d.ts +98 -0
  71. package/dist/toolContract/input/resources/tools/localAnalyzeGraph.d.ts +75 -0
  72. package/dist/toolContract/input/resources/tools/localFilesOperation.d.ts +70 -0
  73. package/dist/toolContract/input/resources/tools/localGetFileContent.d.ts +22 -0
  74. package/dist/toolContract/input/resources/tools/localSearch.d.ts +258 -0
  75. package/dist/toolContract/input/resources/tools/localTextOperation.d.ts +113 -0
  76. package/dist/toolContract/input/resources/tools/localTreeOperation.d.ts +44 -0
  77. package/dist/toolContract/input/resources/tools/lspGetSemantics.d.ts +37 -0
  78. package/dist/toolContract/input/resources/tools/npmSearch.d.ts +10 -0
  79. package/dist/toolContract/input/types/index.d.ts +24 -0
  80. package/dist/toolContract/metadata.d.ts +11 -0
  81. package/dist/toolContract/runtime.d.ts +11 -0
  82. package/dist/toolContract/schemas.d.ts +31 -0
  83. package/dist/toolContract/types.d.ts +11 -0
  84. package/dist/tools/directToolCatalog/toolCatalogDefinitions.d.ts +6 -16
  85. package/dist/tools/directToolCatalog/toolCatalogFormatters.d.ts +1 -1
  86. package/dist/tools/directToolCatalog/toolCommandPatternUnifiedSearchQueries.d.ts +6 -0
  87. package/dist/tools/directToolCatalog/toolInputPreparation.d.ts +2 -2
  88. package/dist/tools/directToolCatalog/toolSchemaIntrospection.d.ts +10 -0
  89. package/dist/tools/directToolCatalog/toolSchemaRelations.d.ts +9 -0
  90. package/dist/tools/directToolCatalog/toolSpecifications.d.ts +13 -0
  91. package/dist/tools/directToolCatalog.exec.d.ts +1 -1
  92. package/dist/tools/directToolCatalog.meta.d.ts +1 -0
  93. package/dist/tools/executionGuard.d.ts +1 -2
  94. package/dist/tools/github_clone_repo/cache.d.ts +1 -2
  95. package/dist/tools/github_clone_repo/cacheArtifacts.d.ts +3 -0
  96. package/dist/tools/github_clone_repo/cachePaths.d.ts +1 -1
  97. package/dist/tools/github_clone_repo/cloneRepo.d.ts +1 -1
  98. package/dist/tools/github_clone_repo/execution.d.ts +1 -1
  99. package/dist/tools/github_clone_repo/scheme.d.ts +24 -24
  100. package/dist/tools/github_fetch_content/execution.d.ts +1 -1
  101. package/dist/tools/github_fetch_content/finalizer/types.d.ts +19 -16
  102. package/dist/tools/github_fetch_content/scheme.d.ts +19 -16
  103. package/dist/tools/github_fetch_content/types.d.ts +4 -3
  104. package/dist/tools/github_search/execution.d.ts +4 -0
  105. package/dist/tools/github_search/finalizer.d.ts +3 -0
  106. package/dist/tools/github_search/scheme.d.ts +79 -0
  107. package/dist/tools/github_search_code/execution.d.ts +4 -2
  108. package/dist/tools/github_search_code/finalizer/groups.d.ts +3 -3
  109. package/dist/tools/github_search_code/finalizer/ranking.d.ts +1 -2
  110. package/dist/tools/github_search_code/scheme.d.ts +10 -16
  111. package/dist/tools/github_search_pull_requests/contentRequest.d.ts +1 -4
  112. package/dist/tools/github_search_pull_requests/contentResponse/commentsShaping.d.ts +8 -4
  113. package/dist/tools/github_search_pull_requests/contentResponse/fileSurfaces.d.ts +13 -10
  114. package/dist/tools/github_search_pull_requests/contentResponse/nextCalls.d.ts +3 -2
  115. package/dist/tools/github_search_pull_requests/contentResponse/pagination.d.ts +10 -3
  116. package/dist/tools/github_search_pull_requests/execution/commitsMode.d.ts +2 -2
  117. package/dist/tools/github_search_pull_requests/execution/issuesMode.d.ts +2 -2
  118. package/dist/tools/github_search_pull_requests/execution/pullRequestsMode.d.ts +1 -1
  119. package/dist/tools/github_search_pull_requests/execution.d.ts +1 -1
  120. package/dist/tools/github_search_pull_requests/historyContinuations.d.ts +15 -0
  121. package/dist/tools/github_search_pull_requests/historyExecutions.d.ts +6 -0
  122. package/dist/tools/github_search_pull_requests/historyPartialContinuations.d.ts +5 -0
  123. package/dist/tools/github_search_pull_requests/historySchemes.d.ts +58 -0
  124. package/dist/tools/github_search_pull_requests/historySearchPagination.d.ts +3 -0
  125. package/dist/tools/github_search_pull_requests/scheme.d.ts +14 -30
  126. package/dist/tools/github_search_pull_requests/splitExecutions.d.ts +1 -2
  127. package/dist/tools/github_search_pull_requests/splitSchemes.d.ts +197 -181
  128. package/dist/tools/github_search_repos/execution/pagination.d.ts +4 -4
  129. package/dist/tools/github_search_repos/execution/queryVariants.d.ts +3 -1
  130. package/dist/tools/github_search_repos/execution.d.ts +3 -1
  131. package/dist/tools/github_search_repos/scheme.d.ts +5 -7
  132. package/dist/tools/github_view_repo_structure/execution.d.ts +4 -2
  133. package/dist/tools/github_view_repo_structure/scheme.d.ts +2 -4
  134. package/dist/tools/github_view_repo_structure/types.d.ts +3 -0
  135. package/dist/tools/local_analyze_graph/analysisTypes.d.ts +46 -0
  136. package/dist/tools/local_analyze_graph/analyzeGraph.d.ts +3 -0
  137. package/dist/tools/{local_dead_code → local_analyze_graph}/deadCodeScan.d.ts +2 -1
  138. package/dist/tools/{local_dead_code → local_analyze_graph}/entrypoints.d.ts +1 -0
  139. package/dist/tools/local_analyze_graph/execution.d.ts +4 -0
  140. package/dist/tools/local_analyze_graph/pagination.d.ts +3 -0
  141. package/dist/tools/{local_dead_code → local_analyze_graph}/retention.d.ts +1 -1
  142. package/dist/tools/{local_dead_code → local_analyze_graph}/scheme.d.ts +31 -15
  143. package/dist/tools/local_fetch_content/execution.d.ts +1 -1
  144. package/dist/tools/local_fetch_content/scheme.d.ts +2 -4
  145. package/dist/tools/local_find_files/execution.d.ts +1 -1
  146. package/dist/tools/local_find_files/findFiles.d.ts +1 -1
  147. package/dist/tools/local_find_files/findFilesNext.d.ts +3 -3
  148. package/dist/tools/local_find_files/scheme.d.ts +6 -2
  149. package/dist/tools/local_ripgrep/captureBudget.d.ts +1 -0
  150. package/dist/tools/local_ripgrep/execution.d.ts +1 -1
  151. package/dist/tools/local_ripgrep/rankingProfile/rankingLexical.d.ts +20 -0
  152. package/dist/tools/local_ripgrep/rankingProfile/rankingResults.d.ts +1 -18
  153. package/dist/tools/local_ripgrep/rankingProfile.d.ts +5 -4
  154. package/dist/tools/local_ripgrep/ripgrepResultBuilder/searchNext.d.ts +4 -1
  155. package/dist/tools/local_ripgrep/scheme.d.ts +9 -7
  156. package/dist/tools/local_ripgrep/structuralSearch.d.ts +1 -1
  157. package/dist/tools/local_search/execution.d.ts +5 -0
  158. package/dist/tools/local_search/scheme.d.ts +260 -0
  159. package/dist/tools/local_view_structure/execution.d.ts +1 -1
  160. package/dist/tools/local_view_structure/scheme.d.ts +8 -5
  161. package/dist/tools/local_view_structure/viewStructureNext.d.ts +3 -3
  162. package/dist/tools/lsp/semantic_content/execution.d.ts +1 -1
  163. package/dist/tools/lsp/semantic_content/scheme.d.ts +4 -42
  164. package/dist/tools/lsp/semantic_content/semanticEnvelopes/envelopeHelpers.d.ts +1 -1
  165. package/dist/tools/lsp/semantic_content/semanticFileOps/anchor.d.ts +1 -1
  166. package/dist/tools/lsp/semantic_content/semanticPresentation.d.ts +0 -1
  167. package/dist/tools/lsp/shared/semanticTypes.d.ts +6 -3
  168. package/dist/tools/package_search/execution.d.ts +6 -13
  169. package/dist/tools/package_search/pagination.d.ts +21 -0
  170. package/dist/tools/package_search/queryHelpers.d.ts +3 -5
  171. package/dist/tools/package_search/scheme.d.ts +12 -7
  172. package/dist/tools/providerExecution.d.ts +3 -4
  173. package/dist/tools/providerMappers/codeSearch.d.ts +3 -4
  174. package/dist/tools/providerMappers/fileContent.d.ts +1 -2
  175. package/dist/tools/providerMappers/pullRequests.d.ts +6 -6
  176. package/dist/tools/providerMappers/repoSearch.d.ts +7 -4
  177. package/dist/tools/providerMappers/repoStructure.d.ts +2 -3
  178. package/dist/tools/toolCatalogFactory.d.ts +5 -6
  179. package/dist/tools/toolConfig.d.ts +6 -17
  180. package/dist/tools/toolMetadata/baseSchema.d.ts +1 -2
  181. package/dist/tools/toolMetadata/descriptions.d.ts +1 -1
  182. package/dist/tools/toolMetadata/names.d.ts +18 -2
  183. package/dist/tools/toolMetadata/state.d.ts +3 -3
  184. package/dist/tools/toolMetadata/types.d.ts +1 -1
  185. package/dist/tools/toolNames.d.ts +16 -3
  186. package/dist/tools/toolSchemaImports.d.ts +5 -4
  187. package/dist/tools/utils.d.ts +3 -6
  188. package/dist/types/bulk.d.ts +11 -1
  189. package/dist/types/execution.d.ts +6 -1
  190. package/dist/types/server.d.ts +0 -2
  191. package/dist/types/toolOutput.d.ts +10 -9
  192. package/dist/types/toolResults.d.ts +17 -1
  193. package/dist/utils/contextUtils.d.ts +4 -2
  194. package/dist/utils/file/toolHelpers.d.ts +1 -1
  195. package/dist/utils/http/cache/conditional.d.ts +9 -4
  196. package/dist/utils/http/cache/dataCache.d.ts +7 -2
  197. package/dist/utils/http/cache/diskStore.d.ts +30 -0
  198. package/dist/utils/http/cache/management.d.ts +5 -0
  199. package/dist/utils/http/cache/store.d.ts +1 -0
  200. package/dist/utils/http/cache/trace.d.ts +10 -0
  201. package/dist/utils/http/cache.d.ts +1 -0
  202. package/dist/utils/package/types.d.ts +5 -2
  203. package/dist/utils/pagination/charLimit.d.ts +0 -2
  204. package/dist/utils/response/bulk/pagination.d.ts +2 -1
  205. package/dist/utils/response/bulk/paginationDiagnostics.d.ts +2 -0
  206. package/dist/utils/response/bulk/queries.d.ts +0 -9
  207. package/dist/utils/response/bulk/response.d.ts +3 -2
  208. package/dist/utils/response/bulk.d.ts +1 -1
  209. package/dist/utils/response/callToolResult.d.ts +1 -1
  210. package/dist/utils/response/error.d.ts +3 -4
  211. package/dist/utils/response/groupedFinalizer.d.ts +2 -6
  212. package/dist/utils/response/normalizedError.d.ts +6 -0
  213. package/dist/utils/response/responseChannels.d.ts +4 -0
  214. package/package.json +11 -10
  215. package/dist/github/discussions.d.ts +0 -45
  216. package/dist/github/releases.d.ts +0 -45
  217. package/dist/scheme/responseEnvelope.d.ts +0 -88
  218. package/dist/tools/github_search_discussions/execution.d.ts +0 -15
  219. package/dist/tools/github_search_discussions/scheme.d.ts +0 -16
  220. package/dist/tools/github_search_pull_requests/execution/releasesMode.d.ts +0 -4
  221. package/dist/tools/local_dead_code/execution.d.ts +0 -4
  222. package/dist/tools/local_dead_code/local_dead_code.d.ts +0 -5
  223. package/dist/tools/local_find_files/pathPatternBraces.d.ts +0 -20
  224. package/dist/tools/toolMetadata/gateway.d.ts +0 -7
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Octocode - Agentic Research Platform
1
+ # Octocode: agentic research platform
2
2
 
3
3
  <div align="center">
4
4
  <img src="https://github.com/bgauryy/octocode/raw/main/packages/octocode-mcp/assets/logo_white.png" width="400px" alt="Octocode Logo">
@@ -14,31 +14,31 @@
14
14
 
15
15
  **Evidence-first code research for AI agents and developers.**
16
16
 
17
- Octocode researches **your local code and external code alike** (GitHub repos, PRs, npm) with one toolset: ripgrep + AST search, trees, precise reads, and LSP. Use it as a **CLI** or **MCP server**, backed by a **Rust engine** for fast, token-efficient results across single files or mega-repos.
17
+ Octocode researches **your local code and external code alike** (GitHub repositories, PRs, npm) with one toolset: ripgrep + AST search, trees, precise reads, and LSP. Use it as a **CLI** or **MCP server**, backed by a **Rust engine** for fast, token-efficient results across single files or mega-repos.
18
18
 
19
19
  ---
20
20
 
21
- ## Table of Contents
21
+ ## Table of contents
22
22
 
23
- - [Quick Start](#quick-start)
23
+ - [Quick start](#quick-start)
24
24
  - [Why Octocode](#why-octocode)
25
- - [Built for Research (Benchmarks)](#built-for-research-benchmarks)
25
+ - [Built for research (benchmarks)](#built-for-research-benchmarks)
26
26
  - [Tools](#tools)
27
27
  - [MCP](#mcp)
28
28
  - [CLI](#cli)
29
29
  - [Configuration](#configuration)
30
- - [Authentication Methods](#authentication-methods)
30
+ - [Authentication methods](#authentication-methods)
31
31
  - [Security](#security)
32
- - [Language Support](#language-support)
32
+ - [Language support](#language-support)
33
33
  - [Skills](#skills)
34
34
  - [Architecture](#architecture)
35
35
  - [Documentation](#documentation)
36
36
  - [Troubleshooting](#troubleshooting)
37
- - [Agent Workflows](#agent-workflows)
37
+ - [Agent workflows](#agent-workflows)
38
38
 
39
39
  ---
40
40
 
41
- ## Quick Start
41
+ ## Quick start
42
42
 
43
43
  **Prerequisites:** Node.js 20.12+
44
44
 
@@ -108,23 +108,23 @@ Put a GitHub token and options under `env` (see [Configuration](#configuration))
108
108
 
109
109
  ### Use it as an agentic-friendly CLI
110
110
 
111
- Just run `npx octocode`, agents figure out the rest. The bare command prints built-in usage and the full tool catalog, so any coding agent knows how to drive it out of the box, no MCP client or extra wiring required.
111
+ Run `npx octocode` and agents figure out the rest. The bare command prints built-in usage and the full tool catalog, so any coding agent knows how to drive it out of the box, no MCP client or extra wiring required.
112
112
 
113
113
  ```bash
114
114
  npx octocode # self-describing usage for agents
115
115
  npx octocode tools # list every tool
116
- npx octocode tools localSearchCode --scheme # inspect a tool's schema
116
+ npx octocode tools localSearch --scheme # inspect all local discovery modes
117
117
  ```
118
118
 
119
119
  Every MCP tool is also a plain command: JSON in, token-efficient YAML out. Local paths route to local tools; `owner/repo[/path]` routes to GitHub.
120
120
 
121
121
  ```bash
122
- npx octocode tools localSearchCode \
123
- --queries '{"path":".","searchText":"authenticate","maxFiles":20}'
122
+ npx octocode tools localSearch \
123
+ --queries '{"operation":"text","path":"/absolute/path/to/project","searchText":"authenticate","maxFiles":20}'
124
124
  ```
125
125
  ```yaml
126
126
  results:
127
- - id: localSearchCode-1
127
+ - index: 0
128
128
  data:
129
129
  files:
130
130
  - path: src/auth.ts
@@ -141,12 +141,12 @@ Learn more at **[octocode.ai](https://octocode.ai)**.
141
141
 
142
142
  Agents code better from evidence than from guesses. Octocode researches **two worlds with one flow**, your **local code** and **external code** on GitHub and npm, and hands back compact, citable context before an agent changes, reviews, or explains code. *Code is truth; context is the map.*
143
143
 
144
- Most tools do one slice (web search, or grep your repo) and hand back a fixed blob. Octocode covers the whole loop and lets the **agent decide what data it needs next**:
144
+ Most tools do one slice (web search, or grep your repository) and hand back a fixed blob. Octocode covers the whole loop and lets the **agent decide what data it needs next**:
145
145
 
146
146
  - **Agent-driven, efficient flows.** Instead of one-shot dumps, Octocode chains cheap steps into an optimized research flow: broad code search, then fetch only the **exact matched lines/region**, with **smart pagination** and **out-of-the-box minification** so the model never over-fetches. Every result carries **next-step hints** to the cheapest follow-up.
147
- - **Scales to monorepos.** Spot a pattern in one repo, follow the PR that introduced it, then trace it across other repos and your own files, without leaving the chat. Clone any repo and study it locally.
148
- - **Smart GitHub flow.** Parallel bulk queries across code, PRs, commits, issues, and repos, all with the same search-broad, read-narrow, trace-semantically discipline.
149
- - **Works without GitHub.** Clone any repo and point the local tools (search, AST, LSP, content) at it, same evidence-first flow.
147
+ - **Scales to monorepos.** Spot a pattern in one repository, follow the PR that introduced it, then trace it across other repositories and your own files, without leaving the chat. Clone any repository and study it locally.
148
+ - **Smart GitHub flow.** Parallel bulk queries across code, PRs, commits, issues, and repositories, all with the same search-broad, read-narrow, trace-semantically discipline.
149
+ - **Works without GitHub.** Clone any repository and point the local tools (search, AST, LSP, content) at it, same evidence-first flow.
150
150
  - **Reads shape, not noise.** On-the-fly minify/skeletonize across 70+ languages: a 100 KB file in a few hundred tokens, not walls of boilerplate.
151
151
  - **Fast, self-contained.** Search, parsing, navigation, and redaction run in one prebuilt **Rust engine**: quick on a laptop or a mega-repo, nothing extra to install.
152
152
  - **Safe by default.** Every byte to the model is scanned and secrets redacted first (see [Security](#security)).
@@ -160,117 +160,66 @@ Most tools do one slice (web search, or grep your repo) and hand back a fixed bl
160
160
  | **Semantic navigation** | Resolve definitions, references, callers/callees, call hierarchy, hovers, symbols, diagnostics, and type relationships through LSP. |
161
161
  | **Structural matching** | Run AST-shaped searches with patterns or YAML rules so comments and strings do not become false positives. |
162
162
  | **Large-file context** | Minify, skeletonize, or paginate code so agents spend tokens on relevant structure instead of boilerplate. |
163
- | **Agent workflows** | Same engine via MCP, CLI, and Agent Skills. |
163
+ | **Agent workflows** | Same engine through MCP, CLI, and Agent Skills. |
164
164
 
165
165
  ---
166
166
 
167
- ## Built for Research (Benchmarks)
167
+ ## Built for research (benchmarks)
168
168
 
169
- Octocode is a **research layer for coding agents**: it finds and proves the context an agent
170
- needs *before* it writes, reviews, or explains code, via **CLI or MCP**. It shines at **deep
171
- research across many repositories**: connecting the dots from a symbol to its source, the PR
172
- that changed it, and the same pattern in other repos. The benchmark measures the two things a
173
- developer actually pays for:
169
+ A blind, head-to-head test on **research-oriented flows rather than plain lookups** (multi-hop traces,
170
+ dependency/call-graph chains, commit ranges, blast-radius, PR reviews across repositories).
174
171
 
175
- - **Accuracy**: did the agent get the answer right?
176
- - **Context cost**: how many characters the model had to read to get there. Fewer characters =
177
- **lower token spend, faster turns, and sharper focus** (the model isn't buried in boilerplate).
172
+ [![Octocode benchmark same answers, a fraction of the context](assets/benchmark.png)](https://raw.githack.com/bgauryy/octocode/main/packages/octocode-benchmark/results/index.html)
178
173
 
179
- We ran **30 real cross-repo questions** (dependency traces, call graphs, commit ranges, blast
180
- radius, PR reviews), 3 passes each, against three GitHub setups a developer might use today:
181
- plain `gh`, `gh` + Headroom (compression), and `gh` + RTK. A blind, neutral judge (gpt-5.5)
182
- graded every answer.
174
+ **How it works:** 30 GitHub questions × 3 passes; Octocode vs `gh`, `gh`+Headroom, and `gh`+RTK on
175
+ identical questions (only the CLI differs). A blind judge (gpt-5.5) grades correctness; the metric is
176
+ **characters through the model**, counted from instrumented logs (characters, not tokens). **Result:** at
177
+ near-parity correctness, Octocode answers with **~2.0× fewer characters than plain `gh`, ~2.6× fewer
178
+ than `gh`+Headroom, and ~3.2× fewer than `gh`+RTK** in the local-build headline runs.
183
179
 
184
- ### Scorecard (30 Q × 3 passes per matchup, local build v18.1.1, blind neutral gpt-5.5 judge, 95% bootstrap CIs)
185
-
186
- **Typical context per question**: how many characters the model reads to answer, relative to
187
- Octocode (lower is better):
188
-
189
- ```text
190
- Octocode ███ 1.0× (baseline)
191
- plain gh ██████ 2.0× more context
192
- gh + Headroom ████████ 2.6× more context
193
- gh + RTK ██████████ 3.2× more context
194
- ```
195
-
196
- | Dimension | Octocode | plain gh | gh + Headroom | gh + RTK |
197
- |---|---:|---:|---:|---:|
198
- | Correctness (/10) | ~9.2–9.3 | 9.3 | 8.6 | **9.4** |
199
- | Chars, per-Q geo-mean (baseline÷Octo, 95% CI) | 1.0× | **2.0×** (1.5–2.6) | **2.6×** (1.9–3.7) | **3.2×** (2.4–4.5) |
200
- | Correct-and-leaner wins (Octo / baseline) | n/a | 51 / 38 | 60 / 28 | 57 / 33 |
201
- | Questions Octocode leaner | n/a | 67/89 | 63/88 | 68/90 |
202
-
203
- **What this means for you:** at the **same accuracy** (all arms tie at ~9/10), Octocode answers
204
- in **2–3× fewer characters** than every baseline, every 95% CI stays above 1×, and it is
205
- leaner on ~72–75% of questions. That is directly less token spend and context bloat on each
206
- research step. Even versus bare, disciplined `gh` (the leanest baseline) it is ~2× leaner, and
207
- the lead grows on the hard multi-hop, large-file questions where agents usually derail.
208
-
209
- **Why it's leaner without losing anything:**
210
- - **Exact slices, not dumps**: reads the region, symbol, or diff you asked for, never a whole file or tree.
211
- - **Lossless minification**: strips boilerplate across 70+ languages with zero data loss: a 100 KB file becomes a few hundred tokens of real structure.
212
- - **No silent truncation**: you get the full slice; large results continue on demand via exact cursors.
213
- - **One research loop**: GitHub + local + LSP + npm behind a single flow: structure → search → exact read → prove.
214
-
215
- Full reports:
216
- [vs plain gh](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/results/full-octocode-vs-gh-152630-2026-08-07.md) ·
217
- [vs gh+Headroom](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/results/full-octocode-vs-headroom-134213-2026-08-07.md) ·
218
- [vs gh+RTK](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/results/full-octocode-vs-rtk-162848-2026-08-07.md).
219
-
220
- ### When to reach for Octocode vs a quick check
221
-
222
- | Reach for **Octocode** when… | A **quick check** is enough when… |
223
- |---|---|
224
- | You need **exact field membership** (peer vs optional vs dev, version ranges). | You already know the file+line and just want to eyeball it. |
225
- | The answer is a **trace across files/repos** (dependency → source → transport → parser chain). | You need one PR title, issue state, or a single `--json` field. |
226
- | You want to **stay lean in context**: targeted reads, not whole-file/tree dumps. | The file is tiny and a full fetch is trivially cheap. |
227
- | You need **reachability / call-graph proof** before a change. | A single grep hit already answers it. |
228
-
229
- **Dig deeper:** [run](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/skills/octocode-benchmark) ·
230
- [design](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/skills/octocode-benchmark/references/BENCHMARK.md) ·
231
- [questions](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/compare/github-questions) ·
232
- [stats method](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/skills/octocode-benchmark/references/aggregation-and-stats.md) ·
233
- [all reports](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/results) (historical runs carry their own caveats).
180
+ **[Open the interactive report](https://raw.githack.com/bgauryy/octocode/main/packages/octocode-benchmark/results/index.html)** · **[run it / method](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/skills/octocode-benchmark)** · [questions](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/compare/github-questions) · [all reports](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/results)
234
181
 
235
182
  ---
236
183
 
237
184
  ## Tools
238
185
 
239
- **17 tools in the full catalog.** MCP registers 14 by default; the CLI exposes 15
240
- because clone is enabled there by default. `ghCloneRepo` is opt-in on MCP
241
- (`ENABLE_CLONE=true`), while `ghListReleases` and `ghSearchDiscussions` are opt-in
242
- on both surfaces. Local tools default on for the **CLI** and off for the **MCP
243
- server** (`ENABLE_LOCAL=true` enables them on MCP; `ENABLE_LOCAL=false` disables on
244
- CLI). Flags: [Configuration](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md).
186
+ **10 tools in the full discovery catalog.** Repository cloning is enabled by
187
+ default on both CLI and MCP:
188
+
189
+ | Surface | Registers | What that set is |
190
+ |---|---:|---|
191
+ | MCP, no flags | 10 | Default GitHub, clone, package, local, graph, and LSP tools |
192
+ | CLI, no flags | 10 | Local tools and clone are on |
193
+
194
+ Use `TOOLS_TO_RUN` for a strict allowlist or `DISABLE_TOOLS` to remove tools from
195
+ the default set. `ENABLE_LOCAL=false` disables local, graph, and LSP tools;
196
+ `ENABLE_CLONE=false` disables cloning on both surfaces.
197
+ Flags: [Configuration](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md).
245
198
 
246
199
  **Token knobs.** `concise:true` returns path/title-only lists. `minify` controls file read density: `symbols` = skeleton with line numbers, `standard` = comments/blanks stripped (default), `none` = exact bytes.
247
200
 
248
- ### GitHub Tools
201
+ ### GitHub tools
249
202
 
250
203
  | Tool | What it does | Knob |
251
204
  |------|--------------|------|
252
- | `ghSearchCode` | Code and path search across GitHub by owner, repo, path, filename, extension, and match filters. Accepts 1 to 5 parallel queries. | `concise` |
205
+ | `ghSearch` | Discover GitHub code, repositories, or repository trees through strict `operation:"code"`, `"repositories"`, or `"tree"` queries. Accepts 1 to 5 parallel queries. | `operation` |
253
206
  | `ghGetFileContent` | Read a GitHub file or region: full file, line range, match slice, or paginated chars. | `minify` |
254
- | `ghViewRepoStructure` | Browse a repository's directory tree, plus opt-in repo enrichments. | `include` |
255
- | `ghSearchRepos` | Discover repositories by keywords, owner, topic, language, stars, updated, license, visibility. | `concise` |
256
- | `ghSearchPullRequests` | Search pull requests, or deep-read one PR: files, patches, comments, reviews, commits. | `content` |
257
- | `ghSearchIssues` | Search issues, or read one issue's body and comments. | `content` |
258
- | `ghSearchCommits` | Walk a repo's commit history, or compare two refs (`base`+`head`). | `includeDiff` |
259
- | `ghListReleases` | List releases + latest, with opt-in assets. **Opt-in** (`ENABLE_RELEASES=true`). | `includeAssets` |
260
- | `ghSearchDiscussions` | Search a repo's Discussions (Q&A, RFCs, announcements) via GraphQL. **Opt-in** (`ENABLE_DISCUSSIONS=true`). | `keywordsToSearch` |
261
- | `ghCloneRepo` | Clone a repo or sparse subtree into the local cache for local/LSP analysis. **Opt-in** on MCP (`ENABLE_CLONE=true`; CLI on by default). | `sparsePath` |
207
+ | `ghSearchHistory` | Search or list pull requests, issues, or commits through strict `operation:"pullRequests"`, `"issues"`, or `"commits"` queries. | `operation` |
208
+ | `ghGetHistoryItem` | Read one pull request or issue by `number`, one commit by `ref`, or a comparison by `base`+`head`. | `operation` |
209
+ | `ghCloneRepo` | Clone a repository or sparse subtree into the local cache for local and LSP analysis. Enabled by default on CLI and MCP; `ENABLE_CLONE=false` disables it. | `sparsePath` |
262
210
 
263
- ### Local Tools
211
+ `ghSearch` is the only GitHub discovery interface; select code, repositories,
212
+ or trees with its strict `operation` field.
213
+
214
+ ### Local tools
264
215
 
265
216
  | Tool | What it does | Knob |
266
217
  |------|--------------|------|
267
- | `localSearchCode` | Local code/text search returning file and line anchors. `mode:"structural"` runs Octocode AST shape queries (`pattern` or `rule`). | `mode` |
268
- | `localViewStructure` | Browse a local directory tree: depth, filters, pagination, metadata. | `detail` |
269
- | `localFindFiles` | Find local files and directories by name, path, regex, extension, size, time, permissions, type. | |
270
- | `localFindDeadCode` | Find likely-unreferenced exports and dead-code clusters using whole-repository reachability analysis. | `entrypoints` |
218
+ | `localSearch` | Discover local code and paths through one discriminated surface: `operation:"text"`, `"structural"`, `"files"`, or `"tree"`. | `operation` |
219
+ | `localAnalyzeGraph` | Analyze bounded file dependencies, paths, reachability, SCCs, and dead-code candidates. Cycle results separate runtime loading cycles from type-only SCCs and include directed edge witnesses. | `operation` |
271
220
  | `localGetFileContent` | Read a local file or region: exact slice, match string, line range, or paginated chars. | `minify` |
272
221
 
273
- ### Package Search
222
+ ### Package search
274
223
 
275
224
  | Tool | What it does | Knob |
276
225
  |------|--------------|------|
@@ -280,7 +229,7 @@ CLI). Flags: [Configuration](https://github.com/bgauryy/octocode/blob/main/docs/
280
229
 
281
230
  | Tool | What it does |
282
231
  |------|--------------|
283
- | `lspGetSemantics` | Typed semantic navigation: `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `documentSymbols`, `typeDefinition`, `implementation`, `workspaceSymbol`, `supertypes`, `subtypes`, and `diagnostic`. From the CLI, invoke it directly: `npx octocode tools lspGetSemantics --queries '<json>'`. Navigation runs through installed language servers (see the [LSP Tools Reference](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md#lsp-tools-reference)). |
232
+ | `lspGetSemantics` | Typed semantic navigation: `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `documentSymbols`, `typeDefinition`, `implementation`, `workspaceSymbol`, `supertypes`, `subtypes`, and `diagnostic`. From the CLI, invoke it directly: `npx octocode tools lspGetSemantics --queries '<json>'`. Navigation runs through installed language servers (see the [LSP tools reference](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md#lsp-tools-reference)). |
284
233
 
285
234
  Full schemas, fields, and examples for every tool live in [`docs/OCTOCODE_TOOLS.md`](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md) (linked under [Documentation](#documentation)).
286
235
 
@@ -292,7 +241,7 @@ The MCP server exposes the Octocode tool catalog directly to your AI assistant o
292
241
 
293
242
  https://github.com/user-attachments/assets/de8d14c0-2ead-46ed-895e-09144c9b5071
294
243
 
295
- ### Manual Configuration
244
+ ### Manual configuration
296
245
 
297
246
  Add to your MCP client config, using `octocode-mcp`:
298
247
 
@@ -318,7 +267,7 @@ Same research engine, no MCP client needed. Local paths route to local tools; `o
318
267
 
319
268
  ### Commands
320
269
 
321
- #### Tools
270
+ #### Tool commands
322
271
 
323
272
  | Command | What it does |
324
273
  |---------|--------------|
@@ -329,12 +278,12 @@ Same research engine, no MCP client needed. Local paths route to local tools; `o
329
278
 
330
279
  #### More commands
331
280
 
332
- - **Cache & clone** - `npx octocode clone`, `npx octocode cache fetch|status|clear`
333
- - **Skills** - `npx octocode skill list|install|check|info|remove` for bundled Octocode skills
334
- - **Language servers** - `npx octocode lsp-server list|install|status|uninstall|clean`
335
- - **Setup & introspection** - `npx octocode install`, `npx octocode auth`, `npx octocode status`, `npx octocode context`
281
+ - **Cache and materialize** `npx octocode cache fetch|status|clear`; use `npx octocode tools ghCloneRepo --scheme` for the clone tool
282
+ - **Skills** `npx octocode skill list|install|check|info|remove` for bundled Octocode skills
283
+ - **Language servers** `npx octocode lsp-server list|install|status|uninstall|clean`
284
+ - **Setup and introspection** `npx octocode install`, `npx octocode auth`, `npx octocode status`, `npx octocode context`
336
285
 
337
- Full syntax, flags, and exit codes: [Octocode CLI Guide](https://github.com/bgauryy/octocode/blob/main/packages/octocode/docs/OCTOCODE_CLI.md)
286
+ Full syntax, flags, and exit codes: [Octocode CLI guide](https://github.com/bgauryy/octocode/blob/main/packages/octocode/docs/OCTOCODE_CLI.md)
338
287
 
339
288
  ---
340
289
 
@@ -350,15 +299,13 @@ environment variables > <octocode-home>/.octocoderc > built-in defaults
350
299
  2. **Global config**: `<octocode-home>/.octocoderc`, machine-wide defaults read by **both the CLI and the MCP server**.
351
300
  3. **Built-in defaults**: used when neither is set.
352
301
 
353
- **Octocode home** (`<octocode-home>`) holds the global config, encrypted credentials, sessions, stats, and tmp materialization caches. It defaults by platform and can be overridden with `OCTOCODE_HOME`:
302
+ **Octocode home** (`<octocode-home>`) holds the global config, encrypted credentials, sessions, stats, and tmp materialization caches. On every platform it is `.octocode` inside the OS home directory — `~/.octocode` on macOS and Linux, `%USERPROFILE%\.octocode` on Windows. Override it with `OCTOCODE_HOME`.
303
+
304
+ Remote data is shared by the CLI and MCP under `<octocode-home>/tmp/`: git clones in `clone/`, commit-addressed file trees in `tree/`, and reusable API/package responses in `response/`. A persisted 24-hour maintenance gate bounds automatic cleanup across short-lived CLI processes and long-lived MCP sessions. See the [configuration reference](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md#cache-storage-and-lifecycle) for lifecycle and limit details.
354
305
 
355
- | Platform | Location |
356
- |----------|----------|
357
- | macOS | `~/.octocode` |
358
- | Linux | `${XDG_CONFIG_HOME:-~/.config}/.octocode` |
359
- | Windows | `%APPDATA%\.octocode` |
306
+ For memory-only operation, set `storage.mode` to `"memory"` in `.octocoderc` or set `OCTOCODE_STORAGE_MODE=memory`. This prevents persistent runtime cache, materialization, session, stats, and Pi SQLite writes without deleting existing files or credentials.
360
307
 
361
- Set values as MCP `env` entries (per client; these win over `.octocoderc`) or globally in `<octocode-home>/.octocoderc` (JSON with comments). **Tokens never go in `.octocoderc`** - use `env` or `npx octocode auth login`.
308
+ Set values as MCP `env` entries (per client; these win over `.octocoderc`) or globally in `<octocode-home>/.octocoderc` (JSON with comments). **Tokens never go in `.octocoderc`** use `env` or `npx octocode auth login`.
362
309
 
363
310
  ### Common settings
364
311
 
@@ -367,15 +314,16 @@ Most-used settings (both CLI and MCP unless noted):
367
314
  | Env var | `.octocoderc` key | Default | What it does |
368
315
  |---------|-------------------|---------|--------------|
369
316
  | `OCTOCODE_TOKEN` / `GH_TOKEN` / `GITHUB_TOKEN` | env only | unset | GitHub token, in priority order. Never in `.octocoderc`. |
370
- | `ENABLE_LOCAL` | `local.enabled` | CLI `true`, MCP `false` | Local filesystem + LSP tools on/off. |
371
- | `ENABLE_CLONE` | `local.enableClone` | CLI `true`, MCP `false` | `ghCloneRepo` + directory fetch on/off. |
317
+ | `ENABLE_LOCAL` | `local.enabled` | `true` | Local filesystem and LSP tools on or off. Set `false` to disable them. |
318
+ | `ENABLE_CLONE` | `local.enableClone` | `true` | `ghCloneRepo` + directory fetch on/off. Set `false` to disable them. |
372
319
  | `WORKSPACE_ROOT` | `local.workspaceRoot` | `cwd` | Root for resolving relative local paths. |
373
320
  | `ALLOWED_PATHS` | `local.allowedPaths` | `[]` | Extra path allowlist for local access. |
374
321
  | `OCTOCODE_OUTPUT_FORMAT` | `output.format` | `yaml` | Response format: `yaml` or `json`. |
322
+ | `OCTOCODE_STORAGE_MODE` | `storage.mode` | `persistent` | Set `memory` to prevent persistent runtime state and materialization. |
375
323
 
376
- `OCTOCODE_HOME`, GitHub Enterprise (`GITHUB_API_URL`), MCP tool whitelisting (`TOOLS_TO_RUN`/`ENABLE_TOOLS`/`DISABLE_TOOLS`), and network timeouts/retries: see the [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md).
324
+ `OCTOCODE_HOME`, GitHub Enterprise (`GITHUB_API_URL`), MCP tool filtering (`TOOLS_TO_RUN`/`DISABLE_TOOLS`), and network timeouts/retries: see the [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md).
377
325
 
378
- ### Example Configuration
326
+ ### Example configuration
379
327
 
380
328
  **`~/.octocode/.octocoderc`:**
381
329
  ```json
@@ -389,6 +337,9 @@ Most-used settings (both CLI and MCP unless noted):
389
337
  },
390
338
  "output": {
391
339
  "format": "yaml"
340
+ },
341
+ "storage": {
342
+ "mode": "persistent"
392
343
  }
393
344
  }
394
345
  ```
@@ -397,11 +348,11 @@ Per-project overrides and custom LSP servers live in a workspace `.octocode/` fo
397
348
 
398
349
  ---
399
350
 
400
- ## Authentication Methods
351
+ ## Authentication methods
401
352
 
402
353
  GitHub-backed tools require authentication. Any one method is enough. Full details: [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md).
403
354
 
404
- ### Option 1: Octocode CLI (Recommended)
355
+ ### Option 1: Octocode CLI (recommended)
405
356
 
406
357
  ```bash
407
358
  npx octocode auth login
@@ -416,44 +367,44 @@ Interactive login lets you choose Octocode browser OAuth or `gh auth login`. Oct
416
367
  gh auth login
417
368
  ```
418
369
 
419
- Octocode reads the `gh` token automatically - no further config needed.
370
+ Octocode reads the `gh` token automatically no further config needed.
420
371
 
421
- ### Option 3: Personal Access Token (also supported)
372
+ ### Option 3: Personal access token (also supported)
422
373
 
423
374
  Set `OCTOCODE_TOKEN`, `GH_TOKEN`, or `GITHUB_TOKEN` in your shell. Required scopes: `repo`, `read:user`, `read:org`.
424
375
 
425
376
  Create a token at [github.com/settings/tokens](https://github.com/settings/tokens).
426
377
 
427
- > **Security tip**: Never commit tokens to version control. Use environment variables or secure secret management.
378
+ **Note:** Never commit tokens to version control. Use environment variables or secure secret management.
428
379
 
429
380
  ---
430
381
 
431
382
  ## Security
432
383
 
433
- **Every byte to the model is scanned and redacted first.** All content (local files, GitHub/npm responses, errors, tool output) passes through the Rust engine's secret scanner on the way *in* and *out*, so secrets never reach the LLM. Identical under MCP and CLI.
384
+ **Every byte to the model is scanned and redacted first.** All content passes through the Rust engine's secret scanner on the way *in* and *out*, so secrets never reach the model. That covers local files, GitHub and npm responses, errors, and tool output. The behavior is identical under MCP and the CLI.
434
385
 
435
386
  - **Secret redaction, in and out.** 300+ provider credential patterns (AWS, Azure, GCP, GitHub, OpenAI, Anthropic, Stripe, Slack, 1Password, and more) plus generic JWTs, PEM/private keys, bearer tokens, database connection strings, and high-entropy strings. Masked values surface a redaction warning so the agent knows.
436
387
  - **Content sanitized at the source.** Local reads (`localGetFileContent`, ripgrep, structural search, binary, file discovery, structure) and external fetches (GitHub code/files, npm) are scanned as they are read, not only at the boundary.
437
388
  - **Path safety.** Relative inputs resolve from `WORKSPACE_ROOT` / config / `cwd`, then local reads are bounded to the engine's allowed roots (home by default, plus `ALLOWED_PATHS` and Octocode-registered roots). Symlinks are resolved and the real target is **re-validated**, so a link cannot escape into a blocked location.
438
389
  - **Sensitive files blocked by default.** Reads of known secret-bearing files and folders return a redacted error instead of contents: keys/certs, `.env*`, `.npmrc`/`.netrc`, cloud/infra credentials (`.aws/`, `.kube/`, `*.tfstate`), `.git/`, browser logins, OS keychains, and wallets. Full list in [SECURITY.md](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md).
439
- - **Command safety.** Normal local search runs in-process inside `octocode-engine`. External helpers are fixed per lane, command/argument allowlisted, and run via `spawn` with argument arrays: no shell strings, no injection.
390
+ - **Command safety.** Normal local search runs in-process inside `octocode-engine`. External helpers are fixed per lane, command/argument allowlisted, and run through `spawn` with argument arrays: no shell strings, no injection.
440
391
  - **Schema validation** runs before any tool executes; untrusted input size and shape are bounded.
441
- - **Credentials.** GitHub auth via env tokens, AES-256-GCM-encrypted on-disk OAuth, or the `gh` CLI; tokens are never logged.
392
+ - **Credentials.** GitHub auth through env tokens, AES-256-GCM-encrypted on-disk OAuth, or the `gh` CLI; tokens are never logged.
442
393
 
443
- **Full security model, pipeline, and threat coverage: [SECURITY.md](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md).** Related: [Configuration & Authentication](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md) · [Credentials](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md#github-token)
394
+ **Full security model, pipeline, and threat coverage: [SECURITY.md](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md).** Related: [Configuration and authentication](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md) · [Credentials](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md#github-token)
444
395
 
445
396
  ---
446
397
 
447
- ## Language Support
398
+ ## Language support
448
399
 
449
400
  Four code-intelligence axes; three are native to the Rust engine and need no external tooling:
450
401
 
451
402
  | Axis | What it does | How to use it |
452
403
  |------|--------------|---------------|
453
- | **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across 60+ extensions. | `localSearchCode mode:"structural"` · CLI `tools localSearchCode --scheme` |
454
- | **Signature outline** | Body-free skeleton with line numbers from real tree-sitter parsing, no heuristics. An anti-growth guard returns the real file when a skeleton wouldn't be smaller. | `minify:"symbols"` · CLI `tools localGetFileContent --scheme` |
404
+ | **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across 60+ extensions. | `localSearch operation:"structural"` · CLI `tools localSearch --scheme` |
405
+ | **Signature outline** | Body-free skeleton with line numbers from real tree-sitter parsing, no heuristics. An anti-growth guard returns the real file when a skeleton is not smaller. | `minify:"symbols"` · CLI `tools localGetFileContent --scheme` |
455
406
  | **Content minification** | Comment/whitespace stripping for 70+ languages and config formats; HTML/Vue/Svelte also minify embedded `<style>`/`<script>`. | `minify:"standard"` (default) |
456
- | **LSP navigation** | definition, references, callers/callees, callHierarchy, hover, typeDefinition, implementation, documentSymbols, via an installed language server; JS/TS also have a native, no-server path. | `lspGetSemantics` · CLI `tools lspGetSemantics --scheme` |
407
+ | **LSP navigation** | definition, references, callers/callees, callHierarchy, hover, typeDefinition, implementation, documentSymbols, through an installed language server; JS/TS also have a native, no-server path. | `lspGetSemantics` · CLI `tools lspGetSemantics --scheme` |
457
408
 
458
409
  📋 **Full support matrix:** every extension with its exact AST, signature, LSP,
459
410
  and minify capability lives in the
@@ -475,34 +426,33 @@ npx octocode skill check --json
475
426
  npx octocode skill help
476
427
  ```
477
428
 
478
- #### Core Research & Extraction
429
+ ### Core research and extraction
479
430
  | Skill | Use when |
480
431
  |-------|----------|
481
432
  | ⭐ [**octocode-research**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-research) | Evidence-first research, review, debugging, refactors, prior-art validation. |
433
+ | [**octocode-code-graph**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-code-graph) | Repository dependency topology: cycles, paths, layering, reachability, impact analysis, and verified dead-code candidates. |
482
434
  | [**octocode-scraping**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-scraping) | Public page extraction and crawl triage: static corpus + graph v2 (pages/data/actions/risks/evidence), then CDP handoff for dynamic actions and blocked pages. |
483
435
  | [**octocode-chrome-devtools**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-chrome-devtools) | Browser/CDP evidence: network, console, performance, cookies/storage, screenshots, auth-gated pages, and live validation of scrape-graph actions. |
484
436
 
485
- #### Planning & Architecture
437
+ ### Planning and architecture
486
438
  | Skill | Use when |
487
439
  |-------|----------|
488
440
  | [**octocode-brainstorming**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-brainstorming) | Disciplined idea exploration before building: options, worth-building tests, prior-art maps. |
489
441
  | [**octocode-rfc-generator**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-rfc-generator) | Evidence-backed RFCs, design docs, migration plans, option comparisons. |
490
442
  | [**octocode-documentation**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-documentation) | Writing or updating README, API docs, runbooks, AGENTS.md, ADRs. |
491
443
 
492
- #### Evaluation & Review
444
+ ### Evaluation and review
493
445
  | Skill | Use when |
494
446
  |-------|----------|
495
447
  | [**octocode-roast**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-roast) | Blunt, evidence-backed code critique with severity ranking and repair paths. |
496
- | [**octocode-graph-eval**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-graph-eval) | Measuring whether a change helped: goal→KPI contracts, baselines, accept/revert loops, eval suites. |
448
+ | [**octocode-eval-benchmark**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-eval-benchmark) | Smart evals and honest benchmarks: goal→KPI contracts, graders, held-out suites, guardrails, and accept/revert loops. |
497
449
  | [**octocode-prompt-optimizer**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-prompt-optimizer) | Making prompts, tool schemas, and agent contracts clearer, safer, cheaper, measurable. |
498
450
 
499
- #### Agent Orchestration
451
+ ### Agent orchestration
500
452
  | Skill | Use when |
501
453
  |-------|----------|
502
- | [**octocode-subagent**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-subagent) | Delegation: spawn gates, decomposition, sealed packets, coordination, synthesis. |
503
- | [**octocode-awareness**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-awareness) | Shared-repo coordination: collision avoidance, handoffs, verification debt, durable memory. |
454
+ | [**octocode-subagent**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-subagent) | Spawning workers / Task / A2A / challenge techniques, or offloading token-heavy text to local Ollama under a verify gate. |
504
455
  | [**octocode-skills**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-skills) | Agent-skill lifecycle: discover, review, create, improve, install, sync. |
505
- | [**octocode-orchestrator-local-worker**](https://github.com/bgauryy/octocode/tree/main/skills/octocode-orchestrator-local-worker) | Offloading token-heavy text work to a local Ollama worker under a verify gate. |
506
456
 
507
457
  **Web automation workflow:** `octocode-scraping` performs the safe static pass first (fetch/crawl/extract → local corpus → graph v2). When the graph exposes dynamic actions or static output is blocked/thin, `octocode-chrome-devtools` validates live actionability, cookies/storage, network/HAR bodies, screenshots, or auth-gated state; discovered URLs/data/artifacts can be fed back into the scraping corpus for continued proof.
508
458
 
@@ -510,7 +460,7 @@ npx octocode skill help
510
460
 
511
461
  ## Architecture
512
462
 
513
- A yarn-workspaces monorepo. The **MCP server** and the **CLI** are thin front-ends over one shared TypeScript tool core, which delegates every CPU-heavy path to a single **Rust engine** (compiled via [napi-rs](https://napi.rs) to prebuilt `.node` binaries). One tool catalog, one security layer, one response shaper, reached two ways.
463
+ A yarn-workspaces monorepo. The **MCP server** and the **CLI** are thin front-ends over one shared TypeScript tool core, which delegates every CPU-heavy path to a single **Rust engine** (compiled through [napi-rs](https://napi.rs) to prebuilt `.node` binaries). One tool catalog, one security layer, one response shaper, reached two ways.
514
464
 
515
465
  ```mermaid
516
466
  graph LR
@@ -537,7 +487,7 @@ graph LR
537
487
  client → sanitize inputs (Rust) → run tool (GitHub / FS / LSP) → sanitize + YAML-serialize + paginate (Rust) → result + next-step hints
538
488
  ```
539
489
 
540
- **One Rust engine** owns secret detection, sanitization, path/command validation, minification (70+ languages), signature extraction, structural AST search, ripgrep parsing, diff filtering, YAML serialization, and LSP, so the Node event loop stays unblocked and there is no duplicate native loader. It ships prebuilt for darwin (arm64/x64), linux (arm64/x64, gnu + musl), and win32-x64; no Rust toolchain is needed at runtime.
490
+ **One Rust engine** owns secret detection, sanitization, path and command validation, minification (70+ languages), signature extraction, structural AST search, ripgrep parsing, diff filtering, YAML serialization, and LSP. The Node event loop therefore stays unblocked, and there is no duplicate native loader. The engine ships prebuilt for darwin (arm64/x64), linux (arm64/x64, gnu and musl), and win32-x64; no Rust toolchain is needed at runtime.
541
491
 
542
492
  ### Packages
543
493
 
@@ -560,45 +510,46 @@ Website: **[octocode.ai](https://octocode.ai)** · Product docs: **[github.com/b
560
510
 
561
511
  | Area | Docs |
562
512
  |---|---|
563
- | MCP server | [Octocode MCP Server](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_MCP.md) · [Configuration & Authentication](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md) |
564
- | Tools and workflows | [Octocode Tools Reference](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md) · [RDD Manifest & Workflows](https://github.com/bgauryy/octocode/blob/main/MANIFEST.md) · [Octocode Research Skill](https://github.com/bgauryy/octocode/tree/main/skills/octocode-research) · [Search Guide](https://github.com/bgauryy/octocode/blob/main/docs/context/SEARCH_GUIDE.md) |
565
- | CLI | [Octocode CLI Guide](https://github.com/bgauryy/octocode/blob/main/packages/octocode/docs/OCTOCODE_CLI.md) |
513
+ | MCP server | [Octocode MCP server](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_MCP.md) · [Configuration and authentication](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md) |
514
+ | Tools and workflows | [Octocode tools reference](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md) · [RDD manifest and workflows](https://github.com/bgauryy/octocode/blob/main/MANIFEST.md) · [Octocode research skill](https://github.com/bgauryy/octocode/tree/main/skills/octocode-research) |
515
+ | CLI | [Octocode CLI guide](https://github.com/bgauryy/octocode/blob/main/packages/octocode/docs/OCTOCODE_CLI.md) |
516
+ | Research model | [Octocode research manifest](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_RESEARCH_MANIFEST.md) · [Routing and evidence position paper](https://github.com/bgauryy/octocode/blob/main/docs/ROUTING_EVIDENCE_POSITION_PAPER.md) · [MCP tool quality and agent workflow](https://github.com/bgauryy/octocode/blob/main/docs/MCP_TOOL_QUALITY_AND_AGENT_WORKFLOW.md) |
566
517
  | Skills | [Skills](https://github.com/bgauryy/octocode/tree/main/skills) |
567
- | Development and security | [Security Model](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md) · [LSP Server Lifecycle](https://github.com/bgauryy/octocode/blob/main/packages/octocode-engine/docs/LSP_SERVER_LIFECYCLE.md) |
568
- | Benchmarks and evals | [Benchmark Results](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/results) · [Benchmark Design](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/skills/octocode-benchmark/references/BENCHMARK.md) · [Benchmark Runbook](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/skills/octocode-benchmark/references/INSTRUCTIONS.md) · [Support Matrix](https://github.com/bgauryy/octocode/blob/main/packages/octocode-engine/docs/LSP_SERVER_LIFECYCLE.md#full-format-support-matrix) |
569
- | Shared internals | [Credentials Architecture](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md#github-token) · [Session Persistence](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_MCP.md#session-persistence) |
518
+ | Development and security | [Security model](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md) · [LSP server lifecycle](https://github.com/bgauryy/octocode/blob/main/packages/octocode-engine/docs/LSP_SERVER_LIFECYCLE.md) |
519
+ | Benchmarks and evals | [Benchmark results](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/results) · [Benchmark design](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/skills/octocode-benchmark/references/BENCHMARK.md) · [Benchmark runbook](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/skills/octocode-benchmark/references/INSTRUCTIONS.md) · [Support matrix](https://github.com/bgauryy/octocode/blob/main/packages/octocode-engine/docs/LSP_SERVER_LIFECYCLE.md#full-format-support-matrix) |
520
+ | Shared internals | [Token priority order](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md#github-token) · [Session persistence](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_MCP.md#session-persistence) |
570
521
 
571
522
  ---
572
523
 
573
524
  ## Troubleshooting
574
525
 
575
- **Node.js or Environment Issues?**
526
+ **Node.js or environment issues?**
576
527
  Run the built-in doctor command to check your environment:
577
528
 
578
529
  ```bash
579
- npx node-doctor check --json
530
+ npx node-doctor
580
531
  ```
581
532
 
582
- **Common Pitfalls:**
583
- - **GitHub Auth Failures:** Ensure your Personal Access Token (PAT) has the `repo` and `read:user` scopes. If using the CLI, run `npx octocode auth login` to refresh.
584
- - **MCP Connection Issues:** If your AI assistant (like Cursor or Windsurf) fails to connect, ensure you have run `npx octocode auth login` in your terminal first, or explicitly pass your `OCTOCODE_TOKEN` in the MCP `env` configuration.
585
- - **Native Engine Errors:** Octocode uses a prebuilt Rust engine. If it fails to load on Linux, ensure your system has `glibc` or `musl` compatibility. On macOS/Windows, ensure you are on a supported architecture (x64 or arm64).
533
+ **Common pitfalls:**
534
+ - **GitHub auth failures:** Ensure your Personal Access Token (PAT) has the `repo` and `read:user` scopes. If using the CLI, run `npx octocode auth login` to refresh.
535
+ - **MCP connection issues:** If your AI assistant (like Cursor or Windsurf) fails to connect, ensure you have run `npx octocode auth login` in your terminal first, or explicitly pass your `OCTOCODE_TOKEN` in the MCP `env` configuration.
536
+ - **Native engine errors:** Octocode uses a prebuilt Rust engine. If it fails to load on Linux, ensure your system has `glibc` or `musl` compatibility. On macOS/Windows, ensure you are on a supported architecture (x64 or arm64).
586
537
 
587
538
  ---
588
539
 
589
- ## Agent Workflows
540
+ ## Agent workflows
590
541
 
591
542
  ### Recommended dev mode: Pi + Octocode
592
543
 
593
- [Pi](https://github.com/earendil-works/pi) is a fast, local-first coding agent whose stated philosophy is *"CLI tools with READMEs (Skills) over MCP."* Pairing it with Octocode gives a lean, evidence-driven dev loop - **Pi edits, Octocode researches**. Two routes, pick by how much surface you need:
544
+ [Pi](https://github.com/earendil-works/pi) is a fast, local-first coding agent whose stated philosophy is *"CLI tools with READMEs (Skills) over MCP."* Pairing it with Octocode gives a lean, evidence-driven dev loop **Pi edits, Octocode researches**. Two routes, pick by how much surface you need:
594
545
 
595
- - **Skill route - recommended, leanest.** Drop the [`octocode-research`](https://www.skills.sh/bgauryy/octocode-mcp/octocode-research) skill into Pi's global skills dir. It drives the Octocode **CLI** directly - no MCP transport, minimal token overhead - and Pi auto-discovers it:
546
+ - **Skill route recommended, leanest.** Drop the [`octocode-research`](https://www.skills.sh/bgauryy/octocode-mcp/octocode-research) skill into Pi's global skills dir. It drives the Octocode **CLI** directly no MCP transport, minimal token overhead and Pi auto-discovers it:
596
547
 
597
548
  ```bash
598
549
  npx octocode skill install octocode-research --platform pi
599
550
  ```
600
551
 
601
- - **Adapter route - full tool surface.** Install [`pi-mcp-adapter`](https://github.com/nicobailon/pi-mcp-adapter) to expose Octocode MCP tools behind a single ~200-token proxy tool, so servers stay disconnected until a tool is actually called. Enable clone tools with `ENABLE_CLONE=true`.
552
+ - **Adapter route full tool surface.** Install [`pi-mcp-adapter`](https://github.com/nicobailon/pi-mcp-adapter) to expose Octocode MCP tools behind a single ~200-token proxy tool, so servers stay disconnected until a tool is called. Clone tools are available by default.
602
553
 
603
554
  ### Research-driven loop
604
555
 
@@ -0,0 +1,8 @@
1
+ export declare const CACHE_MAINTENANCE_INTERVAL_MS: number;
2
+ export declare function getCacheMaintenanceMarkerPath(octocodeHome: string): string;
3
+ export declare function getCacheMaintenanceDelayMs(octocodeHome: string, now?: number): number;
4
+ /** Cheap persisted bootstrap gate shared by short-lived CLI and MCP processes. */
5
+ export declare function runCacheMaintenanceIfDue(octocodeHome: string, now?: number): Promise<boolean>;
6
+ /** Starts the long-lived MCP cron-style scheduler without keeping Node alive. */
7
+ export declare function startCacheGC(octocodeHome: string): void;
8
+ export declare function stopCacheGC(): void;