claude-smart 0.2.41 → 0.2.43

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 (396) hide show
  1. package/.claude-plugin/marketplace.json +17 -0
  2. package/README.md +1 -1
  3. package/bin/claude-smart.js +86 -48
  4. package/package.json +10 -3
  5. package/plugin/.claude-plugin/plugin.json +9 -3
  6. package/plugin/.codex-plugin/plugin.json +1 -1
  7. package/plugin/README.md +2 -2
  8. package/plugin/dashboard/next.config.ts +9 -1
  9. package/plugin/pyproject.toml +2 -2
  10. package/plugin/scripts/_lib.sh +91 -0
  11. package/plugin/scripts/backend-service.sh +46 -15
  12. package/plugin/scripts/cli.sh +29 -1
  13. package/plugin/scripts/codex-hook.js +72 -4
  14. package/plugin/scripts/dashboard-build.sh +1 -0
  15. package/plugin/scripts/dashboard-service.sh +1 -0
  16. package/plugin/scripts/ensure-plugin-root.sh +7 -14
  17. package/plugin/scripts/hook_entry.sh +1 -0
  18. package/plugin/scripts/smart-install.sh +18 -2
  19. package/plugin/src/claude_smart/cli.py +72 -38
  20. package/plugin/src/claude_smart/context_format.py +11 -12
  21. package/plugin/src/claude_smart/cs_cite.py +26 -12
  22. package/plugin/src/claude_smart/ids.py +13 -5
  23. package/plugin/uv.lock +1 -1
  24. package/plugin/vendor/reflexio/.env.example +53 -0
  25. package/plugin/vendor/reflexio/LICENSE +201 -0
  26. package/plugin/vendor/reflexio/README.md +338 -0
  27. package/plugin/vendor/reflexio/pyproject.toml +271 -0
  28. package/plugin/vendor/reflexio/reflexio/README.md +184 -0
  29. package/plugin/vendor/reflexio/reflexio/__init__.py +166 -0
  30. package/plugin/vendor/reflexio/reflexio/benchmarks/__init__.py +1 -0
  31. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/README.md +109 -0
  32. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/__init__.py +1 -0
  33. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/backends.py +175 -0
  34. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/bench.py +642 -0
  35. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/embed_cache.py +330 -0
  36. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/report.py +317 -0
  37. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/report.md +43 -0
  38. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/results.json +4478 -0
  39. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/scenarios.py +134 -0
  40. package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/seed.py +255 -0
  41. package/plugin/vendor/reflexio/reflexio/cli/README.md +287 -0
  42. package/plugin/vendor/reflexio/reflexio/cli/__init__.py +0 -0
  43. package/plugin/vendor/reflexio/reflexio/cli/__main__.py +56 -0
  44. package/plugin/vendor/reflexio/reflexio/cli/_client.py +86 -0
  45. package/plugin/vendor/reflexio/reflexio/cli/app.py +127 -0
  46. package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +266 -0
  47. package/plugin/vendor/reflexio/reflexio/cli/codex_auth.py +503 -0
  48. package/plugin/vendor/reflexio/reflexio/cli/commands/__init__.py +0 -0
  49. package/plugin/vendor/reflexio/reflexio/cli/commands/admin_cmd.py +65 -0
  50. package/plugin/vendor/reflexio/reflexio/cli/commands/agent_playbooks.py +503 -0
  51. package/plugin/vendor/reflexio/reflexio/cli/commands/api.py +114 -0
  52. package/plugin/vendor/reflexio/reflexio/cli/commands/auth.py +109 -0
  53. package/plugin/vendor/reflexio/reflexio/cli/commands/config_cmd.py +511 -0
  54. package/plugin/vendor/reflexio/reflexio/cli/commands/doctor.py +127 -0
  55. package/plugin/vendor/reflexio/reflexio/cli/commands/embeddings.py +53 -0
  56. package/plugin/vendor/reflexio/reflexio/cli/commands/interactions.py +478 -0
  57. package/plugin/vendor/reflexio/reflexio/cli/commands/profiles.py +303 -0
  58. package/plugin/vendor/reflexio/reflexio/cli/commands/services.py +289 -0
  59. package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +961 -0
  60. package/plugin/vendor/reflexio/reflexio/cli/commands/shortcuts.py +285 -0
  61. package/plugin/vendor/reflexio/reflexio/cli/commands/status_cmd.py +143 -0
  62. package/plugin/vendor/reflexio/reflexio/cli/commands/user_playbooks.py +373 -0
  63. package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +284 -0
  64. package/plugin/vendor/reflexio/reflexio/cli/errors.py +217 -0
  65. package/plugin/vendor/reflexio/reflexio/cli/log_format.py +247 -0
  66. package/plugin/vendor/reflexio/reflexio/cli/output.py +867 -0
  67. package/plugin/vendor/reflexio/reflexio/cli/paths.py +41 -0
  68. package/plugin/vendor/reflexio/reflexio/cli/run_services.py +391 -0
  69. package/plugin/vendor/reflexio/reflexio/cli/state.py +204 -0
  70. package/plugin/vendor/reflexio/reflexio/cli/stop_services.py +96 -0
  71. package/plugin/vendor/reflexio/reflexio/cli/utils.py +329 -0
  72. package/plugin/vendor/reflexio/reflexio/client/__init__.py +3 -0
  73. package/plugin/vendor/reflexio/reflexio/client/cache.py +150 -0
  74. package/plugin/vendor/reflexio/reflexio/client/client.py +2613 -0
  75. package/plugin/vendor/reflexio/reflexio/defaults.py +23 -0
  76. package/plugin/vendor/reflexio/reflexio/integrations/__init__.py +0 -0
  77. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/.clawhubignore +7 -0
  78. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/README.md +274 -0
  79. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/TESTING.md +517 -0
  80. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/hook/handler.js +473 -0
  81. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package-lock.json +2156 -0
  82. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package.json +18 -0
  83. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/handler.ts +241 -0
  84. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/setup.ts +140 -0
  85. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/index.ts +130 -0
  86. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/publish.ts +113 -0
  87. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/search.ts +52 -0
  88. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/server.ts +103 -0
  89. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/sqlite-buffer.ts +156 -0
  90. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/user-id.ts +134 -0
  91. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/openclaw.plugin.json +41 -0
  92. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/package.json +17 -0
  93. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/rules/reflexio.md +24 -0
  94. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/reflexio/SKILL.md +48 -0
  95. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/publish_clawhub.sh +278 -0
  96. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/references/HOOK.md +164 -0
  97. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/install.sh +36 -0
  98. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/uninstall.sh +35 -0
  99. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/publish.test.ts +27 -0
  100. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/search.test.ts +31 -0
  101. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/server.test.ts +42 -0
  102. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/setup.test.ts +49 -0
  103. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/sqlite-buffer.test.ts +91 -0
  104. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/user-id.test.ts +50 -0
  105. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tsconfig.json +16 -0
  106. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/types/openclaw.d.ts +230 -0
  107. package/plugin/vendor/reflexio/reflexio/integrations/openclaw/vitest.config.ts +13 -0
  108. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/README.md +120 -0
  109. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/TESTING.md +168 -0
  110. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package-lock.json +1657 -0
  111. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package.json +16 -0
  112. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/HEARTBEAT.md +6 -0
  113. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/README.md +84 -0
  114. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/SKILL.md +194 -0
  115. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/_meta.json +6 -0
  116. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/agents/reflexio-extractor.md +45 -0
  117. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/handler.ts +214 -0
  118. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/setup.ts +55 -0
  119. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/index.ts +327 -0
  120. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/consolidate.ts +233 -0
  121. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/dedup.ts +80 -0
  122. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/io.ts +155 -0
  123. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/openclaw-cli.ts +67 -0
  124. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/search.ts +33 -0
  125. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-playbook.ts +76 -0
  126. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-profile.ts +79 -0
  127. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/openclaw.plugin.json +46 -0
  128. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/package.json +18 -0
  129. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/README.md +36 -0
  130. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/full_consolidation.md +56 -0
  131. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/playbook_extraction.md +217 -0
  132. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/profile_extraction.md +132 -0
  133. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-consolidate/SKILL.md +33 -0
  134. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-embedded/SKILL.md +194 -0
  135. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/HOOK.md +18 -0
  136. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/architecture.md +49 -0
  137. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/comparison.md +31 -0
  138. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/future-work.md +47 -0
  139. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/porting-notes.md +52 -0
  140. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/install.sh +52 -0
  141. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/uninstall.sh +36 -0
  142. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/consolidate.test.ts +135 -0
  143. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/dedup.test.ts +104 -0
  144. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/io.test.ts +175 -0
  145. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/search.test.ts +66 -0
  146. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/smoke-test.ts +140 -0
  147. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-playbook.test.ts +93 -0
  148. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-profile.test.ts +174 -0
  149. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tsconfig.json +16 -0
  150. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/types/openclaw.d.ts +230 -0
  151. package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/vitest.config.ts +7 -0
  152. package/plugin/vendor/reflexio/reflexio/lib/__init__.py +23 -0
  153. package/plugin/vendor/reflexio/reflexio/lib/_agent_playbook.py +310 -0
  154. package/plugin/vendor/reflexio/reflexio/lib/_base.py +225 -0
  155. package/plugin/vendor/reflexio/reflexio/lib/_config.py +83 -0
  156. package/plugin/vendor/reflexio/reflexio/lib/_dashboard.py +266 -0
  157. package/plugin/vendor/reflexio/reflexio/lib/_generation.py +176 -0
  158. package/plugin/vendor/reflexio/reflexio/lib/_interactions.py +334 -0
  159. package/plugin/vendor/reflexio/reflexio/lib/_operations.py +153 -0
  160. package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +545 -0
  161. package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +52 -0
  162. package/plugin/vendor/reflexio/reflexio/lib/_search.py +167 -0
  163. package/plugin/vendor/reflexio/reflexio/lib/_storage_labels.py +103 -0
  164. package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +288 -0
  165. package/plugin/vendor/reflexio/reflexio/lib/reflexio_lib.py +27 -0
  166. package/plugin/vendor/reflexio/reflexio/models/__init__.py +0 -0
  167. package/plugin/vendor/reflexio/reflexio/models/api_schema/__init__.py +0 -0
  168. package/plugin/vendor/reflexio/reflexio/models/api_schema/braintrust_schema.py +141 -0
  169. package/plugin/vendor/reflexio/reflexio/models/api_schema/common.py +41 -0
  170. package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/__init__.py +3 -0
  171. package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +1103 -0
  172. package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/enums.py +63 -0
  173. package/plugin/vendor/reflexio/reflexio/models/api_schema/eval_overview_schema.py +487 -0
  174. package/plugin/vendor/reflexio/reflexio/models/api_schema/internal_schema.py +28 -0
  175. package/plugin/vendor/reflexio/reflexio/models/api_schema/pending_tool_call_schema.py +83 -0
  176. package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +766 -0
  177. package/plugin/vendor/reflexio/reflexio/models/api_schema/service_schemas.py +9 -0
  178. package/plugin/vendor/reflexio/reflexio/models/api_schema/stall_state_schema.py +32 -0
  179. package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/__init__.py +3 -0
  180. package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/converters.py +177 -0
  181. package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/entities.py +129 -0
  182. package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/enums.py +25 -0
  183. package/plugin/vendor/reflexio/reflexio/models/api_schema/validators.py +280 -0
  184. package/plugin/vendor/reflexio/reflexio/models/config_schema.py +908 -0
  185. package/plugin/vendor/reflexio/reflexio/models/py.typed +0 -0
  186. package/plugin/vendor/reflexio/reflexio/server/OVERVIEW.md +90 -0
  187. package/plugin/vendor/reflexio/reflexio/server/README.md +616 -0
  188. package/plugin/vendor/reflexio/reflexio/server/__init__.py +210 -0
  189. package/plugin/vendor/reflexio/reflexio/server/__main__.py +132 -0
  190. package/plugin/vendor/reflexio/reflexio/server/_auth.py +25 -0
  191. package/plugin/vendor/reflexio/reflexio/server/api.py +2714 -0
  192. package/plugin/vendor/reflexio/reflexio/server/api_endpoints/account_api.py +143 -0
  193. package/plugin/vendor/reflexio/reflexio/server/api_endpoints/health_api.py +91 -0
  194. package/plugin/vendor/reflexio/reflexio/server/api_endpoints/pending_tool_call_api.py +572 -0
  195. package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +66 -0
  196. package/plugin/vendor/reflexio/reflexio/server/api_endpoints/publisher_api.py +540 -0
  197. package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +50 -0
  198. package/plugin/vendor/reflexio/reflexio/server/api_endpoints/stall_state_api.py +100 -0
  199. package/plugin/vendor/reflexio/reflexio/server/cache/__init__.py +15 -0
  200. package/plugin/vendor/reflexio/reflexio/server/cache/reflexio_cache.py +208 -0
  201. package/plugin/vendor/reflexio/reflexio/server/correlation.py +46 -0
  202. package/plugin/vendor/reflexio/reflexio/server/llm/__init__.py +30 -0
  203. package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +110 -0
  204. package/plugin/vendor/reflexio/reflexio/server/llm/image_utils.py +55 -0
  205. package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +1595 -0
  206. package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +112 -0
  207. package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +469 -0
  208. package/plugin/vendor/reflexio/reflexio/server/llm/providers/__init__.py +1 -0
  209. package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_provider.py +1122 -0
  210. package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_stream_parser.py +197 -0
  211. package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +210 -0
  212. package/plugin/vendor/reflexio/reflexio/server/llm/providers/local_embedding_provider.py +213 -0
  213. package/plugin/vendor/reflexio/reflexio/server/llm/providers/nomic_embedding_provider.py +255 -0
  214. package/plugin/vendor/reflexio/reflexio/server/llm/rerank/__init__.py +6 -0
  215. package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +177 -0
  216. package/plugin/vendor/reflexio/reflexio/server/llm/rerank/llm_reranker.py +148 -0
  217. package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +699 -0
  218. package/plugin/vendor/reflexio/reflexio/server/operation_limiter.py +179 -0
  219. package/plugin/vendor/reflexio/reflexio/server/prompt/__init__.py +0 -0
  220. package/plugin/vendor/reflexio/reflexio/server/prompt/_dispatchers.py +54 -0
  221. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/README.md +121 -0
  222. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation/v1.0.0.prompt.md +58 -0
  223. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation_with_comparison/v1.0.0.prompt.md +76 -0
  224. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/answer_synthesis/v1.5.2.prompt.md +88 -0
  225. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/compress_session_for_query/v1.3.0.prompt.md +31 -0
  226. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/document_expansion/v1.0.0.prompt.md +20 -0
  227. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.0.0.prompt.md +53 -0
  228. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.1.0.prompt.md +57 -0
  229. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.2.0.prompt.md +68 -0
  230. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.3.0.prompt.md +70 -0
  231. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.4.0.prompt.md +77 -0
  232. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.5.0.prompt.md +82 -0
  233. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md +83 -0
  234. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.1.0.prompt.md +193 -0
  235. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.2.0.prompt.md +206 -0
  236. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0-deprecated.prompt.md +66 -0
  237. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0.prompt.md +43 -0
  238. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.1.0.prompt.md +46 -0
  239. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0-deprecated.prompt.md +64 -0
  240. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0.prompt.md +39 -0
  241. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.1.0.prompt.md +39 -0
  242. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.2.0.prompt.md +47 -0
  243. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.0.prompt.md +58 -0
  244. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.0.2.prompt.md +254 -0
  245. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.1.0.prompt.md +274 -0
  246. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.0.prompt.md +279 -0
  247. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v1.0.0.prompt.md +73 -0
  248. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v2.0.0.prompt.md +86 -0
  249. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.0.0.prompt.md +97 -0
  250. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.1.0.prompt.md +119 -0
  251. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.2.0.prompt.md +123 -0
  252. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.3.0.prompt.md +127 -0
  253. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.0.0.prompt.md +14 -0
  254. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.1.0.prompt.md +24 -0
  255. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.2.0.prompt.md +29 -0
  256. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.0.0.prompt.md +11 -0
  257. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.1.0.prompt.md +21 -0
  258. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.2.0.prompt.md +25 -0
  259. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.0.0.prompt.md +37 -0
  260. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.1.0.prompt.md +40 -0
  261. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.2.0.prompt.md +36 -0
  262. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v1.0.0.prompt.md +45 -0
  263. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v2.0.0.prompt.md +81 -0
  264. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v3.0.0.prompt.md +80 -0
  265. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate_expert/v1.0.0.prompt.md +34 -0
  266. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_deduplication/v1.0.0.prompt.md +116 -0
  267. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate/v1.0.0.prompt.md +33 -0
  268. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate_override/v1.0.0.prompt.md +16 -0
  269. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.0.0.prompt.md +140 -0
  270. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.1.0.prompt.md +160 -0
  271. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_main/v1.0.0.prompt.md +14 -0
  272. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/query_reformulation/v1.0.0.prompt.md +19 -0
  273. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/rerank_relevance/v1.1.0.prompt.md +44 -0
  274. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_comparison/v1.0.0.prompt.md +43 -0
  275. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_content_evaluation/v1.0.0.prompt.md +33 -0
  276. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/feedback_extraction_main_v1.jsonl +10 -0
  277. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/profile_update_main_v1.jsonl +10 -0
  278. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_manager.py +280 -0
  279. package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_schema.py +11 -0
  280. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/_eval_health.py +131 -0
  281. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_constants.py +60 -0
  282. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_service.py +228 -0
  283. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_utils.py +87 -0
  284. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluator.py +372 -0
  285. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/delayed_group_evaluator.py +156 -0
  286. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/group_evaluation_runner.py +340 -0
  287. package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/regen_jobs.py +471 -0
  288. package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +1626 -0
  289. package/plugin/vendor/reflexio/reflexio/server/services/braintrust/__init__.py +0 -0
  290. package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_cron.py +196 -0
  291. package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_encryption.py +101 -0
  292. package/plugin/vendor/reflexio/reflexio/server/services/braintrust/client.py +167 -0
  293. package/plugin/vendor/reflexio/reflexio/server/services/braintrust/service.py +281 -0
  294. package/plugin/vendor/reflexio/reflexio/server/services/configurator/base_configurator.py +179 -0
  295. package/plugin/vendor/reflexio/reflexio/server/services/configurator/config_storage.py +62 -0
  296. package/plugin/vendor/reflexio/reflexio/server/services/configurator/configurator.py +87 -0
  297. package/plugin/vendor/reflexio/reflexio/server/services/configurator/local_file_config_storage.py +187 -0
  298. package/plugin/vendor/reflexio/reflexio/server/services/configurator/test_config_storage.py +162 -0
  299. package/plugin/vendor/reflexio/reflexio/server/services/deduplication_utils.py +112 -0
  300. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/__init__.py +0 -0
  301. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/distribution.py +33 -0
  302. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/eval_sampler.py +126 -0
  303. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/group_aggregation.py +192 -0
  304. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/hero_state.py +75 -0
  305. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/rule_attribution.py +97 -0
  306. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/service.py +515 -0
  307. package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/shadow_aggregation.py +90 -0
  308. package/plugin/vendor/reflexio/reflexio/server/services/extraction/__init__.py +0 -0
  309. package/plugin/vendor/reflexio/reflexio/server/services/extraction/agent_run_records.py +91 -0
  310. package/plugin/vendor/reflexio/reflexio/server/services/extraction/invariants.py +303 -0
  311. package/plugin/vendor/reflexio/reflexio/server/services/extraction/outcome.py +25 -0
  312. package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +351 -0
  313. package/plugin/vendor/reflexio/reflexio/server/services/extraction/plan.py +138 -0
  314. package/plugin/vendor/reflexio/reflexio/server/services/extraction/prior_answer_search.py +217 -0
  315. package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +468 -0
  316. package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_scheduler.py +171 -0
  317. package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +777 -0
  318. package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +1125 -0
  319. package/plugin/vendor/reflexio/reflexio/server/services/extractor_config_utils.py +91 -0
  320. package/plugin/vendor/reflexio/reflexio/server/services/extractor_interaction_utils.py +251 -0
  321. package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +689 -0
  322. package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +835 -0
  323. package/plugin/vendor/reflexio/reflexio/server/services/playbook/README.md +89 -0
  324. package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_aggregator.py +1388 -0
  325. package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_consolidator.py +960 -0
  326. package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_extractor.py +436 -0
  327. package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_generation_service.py +808 -0
  328. package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_constants.py +28 -0
  329. package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_utils.py +362 -0
  330. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/__init__.py +24 -0
  331. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/assistant_webhook.py +246 -0
  332. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/gepa_adapter.py +291 -0
  333. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/judge.py +97 -0
  334. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/models.py +96 -0
  335. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/optimizer.py +645 -0
  336. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/rollout.py +35 -0
  337. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scenario_resolver.py +93 -0
  338. package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scheduler.py +174 -0
  339. package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/__init__.py +26 -0
  340. package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_document_expander.py +179 -0
  341. package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_query_reformulator.py +297 -0
  342. package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_deduplicator.py +741 -0
  343. package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_extractor.py +462 -0
  344. package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service.py +734 -0
  345. package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service_utils.py +290 -0
  346. package/plugin/vendor/reflexio/reflexio/server/services/reflection/__init__.py +17 -0
  347. package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_extractor.py +247 -0
  348. package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service.py +800 -0
  349. package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service_utils.py +146 -0
  350. package/plugin/vendor/reflexio/reflexio/server/services/retrieval/__init__.py +0 -0
  351. package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +70 -0
  352. package/plugin/vendor/reflexio/reflexio/server/services/search/__init__.py +0 -0
  353. package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +671 -0
  354. package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/__init__.py +1 -0
  355. package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/judge.py +184 -0
  356. package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/outcome.py +81 -0
  357. package/plugin/vendor/reflexio/reflexio/server/services/storage/constants.py +2 -0
  358. package/plugin/vendor/reflexio/reflexio/server/services/storage/error.py +11 -0
  359. package/plugin/vendor/reflexio/reflexio/server/services/storage/retention.py +154 -0
  360. package/plugin/vendor/reflexio/reflexio/server/services/storage/retention_mixin.py +155 -0
  361. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/__init__.py +59 -0
  362. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +1253 -0
  363. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_base.py +1945 -0
  364. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +600 -0
  365. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_operations.py +346 -0
  366. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_playbook.py +1378 -0
  367. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +747 -0
  368. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +263 -0
  369. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_shadow_verdicts.py +193 -0
  370. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_share_links.py +166 -0
  371. package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_stall_state.py +217 -0
  372. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/__init__.py +153 -0
  373. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +372 -0
  374. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_base.py +71 -0
  375. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_extras.py +235 -0
  376. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +170 -0
  377. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_playbook.py +677 -0
  378. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +250 -0
  379. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +154 -0
  380. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py +130 -0
  381. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_share_links.py +93 -0
  382. package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_stall_state.py +76 -0
  383. package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +568 -0
  384. package/plugin/vendor/reflexio/reflexio/server/site_var/README.md +77 -0
  385. package/plugin/vendor/reflexio/reflexio/server/site_var/feature_flags.py +116 -0
  386. package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_manager.py +263 -0
  387. package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/feature_flags.json +13 -0
  388. package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/llm_model_setting.json +7 -0
  389. package/plugin/vendor/reflexio/reflexio/server/tracing.py +158 -0
  390. package/plugin/vendor/reflexio/reflexio/server/usage_metrics.py +113 -0
  391. package/plugin/vendor/reflexio/reflexio/server/uvicorn_logging.py +76 -0
  392. package/plugin/vendor/reflexio/reflexio/test_support/__init__.py +1 -0
  393. package/plugin/vendor/reflexio/reflexio/test_support/llm_fixtures.py +62 -0
  394. package/plugin/vendor/reflexio/reflexio/test_support/llm_mock.py +242 -0
  395. package/plugin/vendor/reflexio/reflexio/test_support/llm_model_registry.py +129 -0
  396. package/plugin/vendor/reflexio/reflexio/test_support/skip_decorators.py +43 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "reflexioai",
3
+ "owner": {
4
+ "name": "Yi Lu"
5
+ },
6
+ "metadata": {
7
+ "description": "claude-smart — self-improving Claude Code and Codex plugin via reflexio"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "claude-smart",
12
+ "version": "0.2.43",
13
+ "source": "./plugin",
14
+ "description": "Turns user corrections into project-specific and shared skills via reflexio — uses Claude Code or Codex as the LLM backend (no external API key required)"
15
+ }
16
+ ]
17
+ }
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
14
14
  </a>
15
15
  <a href="plugin/pyproject.toml">
16
- <img src="https://img.shields.io/badge/version-0.2.41-green.svg" alt="Version">
16
+ <img src="https://img.shields.io/badge/version-0.2.43-green.svg" alt="Version">
17
17
  </a>
18
18
  <a href="plugin/pyproject.toml">
19
19
  <img src="https://img.shields.io/badge/python-%3E%3D3.12-brightgreen.svg" alt="Python">
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * npx claude-smart install — thin wrapper around the native host plugin
4
- * CLIs. For Claude Code it registers the GitHub marketplace and installs the
5
- * plugin. For Codex it copies the bundled local marketplace, registers it,
6
- * and enables plugin hooks. Both paths seed ~/.reflexio/.env with the two
7
- * local-provider flags so reflexio can route generation through local tools
8
- * with no API key. Managed/read-only/global setup is handled by
9
- * `npx claude-smart setup`, which writes ~/.reflexio/.env before running this
10
- * installer.
4
+ * CLIs. Both Claude Code and Codex install from the bundled marketplace in
5
+ * this npm package: Claude Code registers the package root as a local
6
+ * marketplace, and Codex copies the bundled plugin into its own marketplace
7
+ * wrapper. Both paths seed ~/.reflexio/.env with the two local-provider flags
8
+ * so reflexio can route generation through local tools with no API key.
9
+ * Managed/read-only/global setup is handled by `npx claude-smart setup`,
10
+ * which writes ~/.reflexio/.env before running this installer.
11
11
  *
12
12
  * Keep this file dependency-free — it runs via `npx` with no install step.
13
13
  */
@@ -33,7 +33,6 @@ const https = require("https");
33
33
  const { arch, homedir, platform, release, tmpdir } = require("os");
34
34
  const { dirname, join } = require("path");
35
35
 
36
- const DEFAULT_MARKETPLACE_SOURCE = "ReflexioAI/claude-smart";
37
36
  const PLUGIN_SPEC = "claude-smart@reflexioai";
38
37
  const CODEX_MARKETPLACE_NAME = "reflexioai";
39
38
  const CODEX_MARKETPLACE_DISPLAY_NAME = "ReflexioAI";
@@ -358,7 +357,7 @@ function findClaudeCodePluginRoot() {
358
357
  }
359
358
  }
360
359
  } catch {
361
- // Fall through to marketplace/package fallbacks.
360
+ // Fall through to marketplace fallback.
362
361
  }
363
362
  candidates.sort((a, b) => {
364
363
  const versionCompare = compareSemverLikePathNames(b, a);
@@ -369,9 +368,13 @@ function findClaudeCodePluginRoot() {
369
368
  return 0;
370
369
  }
371
370
  });
371
+ // PACKAGE_ROOT/plugin is intentionally NOT a fallback: under `npx` it
372
+ // points at /root/.npm/_npx/<hash>/.../plugin which npm may prune between
373
+ // invocations, breaking the editable claude_smart install (.pth dangles,
374
+ // venv survives) and confusing every later `uv sync`. Require `claude
375
+ // plugin install` to have populated the cache dir instead, and fail loud.
372
376
  const fallbacks = [
373
377
  join(homedir(), ".claude", "plugins", "marketplaces", CODEX_MARKETPLACE_NAME, "plugin"),
374
- join(PACKAGE_ROOT, "plugin"),
375
378
  ];
376
379
  for (const candidate of [...candidates, ...fallbacks]) {
377
380
  if (
@@ -429,7 +432,19 @@ function forcePluginRoot(pluginRoot) {
429
432
  async function bootstrapClaudeCodeInstall() {
430
433
  const pluginRoot = findClaudeCodePluginRoot();
431
434
  if (!pluginRoot) {
432
- throw new Error("could not locate installed Claude Code plugin root after install");
435
+ const cacheRoot = join(
436
+ homedir(),
437
+ ".claude",
438
+ "plugins",
439
+ "cache",
440
+ CODEX_MARKETPLACE_NAME,
441
+ "claude-smart",
442
+ );
443
+ throw new Error(
444
+ `claude plugin install did not populate ${cacheRoot}. ` +
445
+ "Open Claude Code, run /plugins, verify claude-smart is installed " +
446
+ "from the ReflexioAI marketplace, then rerun `npx claude-smart install`.",
447
+ );
433
448
  }
434
449
  forcePluginRoot(pluginRoot);
435
450
  const bash = resolveCommand(isWindows() ? ["bash.exe", "bash"] : ["bash"]);
@@ -960,13 +975,12 @@ function printHelp() {
960
975
  "Usage:",
961
976
  " npx claude-smart install Install the plugin into Claude Code",
962
977
  " npx claude-smart install --host codex Register the plugin marketplace for Codex",
963
- " npx claude-smart install --source <owner/repo> Override the marketplace source",
964
978
  " npx claude-smart setup Configure managed/read-only/global setup",
965
979
  " npx claude-smart uninstall --host codex Remove the Codex marketplace registration",
966
980
  " npx claude-smart --help Show this help",
967
981
  "",
968
982
  "Claude Code install:",
969
- " 1. claude plugin marketplace add <source>",
983
+ " 1. claude plugin marketplace add <this package>",
970
984
  ` 2. claude plugin install ${PLUGIN_SPEC}`,
971
985
  " 3. Reads ~/.reflexio/.env when managed/read-only setup was configured.",
972
986
  "",
@@ -980,7 +994,8 @@ function printHelp() {
980
994
  " 7. Restart Codex.",
981
995
  "",
982
996
  "Update:",
983
- " npx claude-smart update Update to the latest version",
997
+ " npx claude-smart update Reinstall Claude Code support from this package",
998
+ " npx claude-smart update --host codex Reinstall Codex support from this package",
984
999
  " npx claude-smart setup Configure managed/read-only/global setup",
985
1000
  "",
986
1001
  "Uninstall:",
@@ -990,17 +1005,6 @@ function printHelp() {
990
1005
  );
991
1006
  }
992
1007
 
993
- function parseSource(args) {
994
- const idx = args.indexOf("--source");
995
- if (idx === -1) return DEFAULT_MARKETPLACE_SOURCE;
996
- const value = args[idx + 1];
997
- if (!value) {
998
- process.stderr.write("error: --source requires a value (e.g. owner/repo)\n");
999
- process.exit(1);
1000
- }
1001
- return value;
1002
- }
1003
-
1004
1008
  function parseHost(args) {
1005
1009
  const idx = args.indexOf("--host");
1006
1010
  if (idx === -1) return "claude-code";
@@ -1396,33 +1400,53 @@ function installCodexPluginCache(pluginRoot) {
1396
1400
  return cacheDir;
1397
1401
  }
1398
1402
 
1399
- async function runUpdate(args) {
1400
- const setup = configureReflexioSetup();
1401
- if (!hasClaudeCli()) {
1402
- process.stderr.write(
1403
- "error: 'claude' CLI not found on PATH. " +
1404
- "Install Claude Code first: https://claude.com/claude-code\n",
1405
- );
1406
- process.exit(1);
1403
+ function findCodexPluginRoot() {
1404
+ const candidates = [];
1405
+ try {
1406
+ for (const entry of readdirSync(CODEX_PLUGIN_CACHE_DIR, { withFileTypes: true })) {
1407
+ if (!entry.isDirectory()) continue;
1408
+ const candidate = join(CODEX_PLUGIN_CACHE_DIR, entry.name);
1409
+ if (
1410
+ existsSync(join(candidate, "pyproject.toml")) &&
1411
+ existsSync(join(candidate, "scripts", "smart-install.sh"))
1412
+ ) {
1413
+ candidates.push(candidate);
1414
+ }
1415
+ }
1416
+ } catch {
1417
+ // No Codex cache yet.
1407
1418
  }
1408
-
1409
- const code = await runClaude(["plugin", "update", PLUGIN_SPEC], {
1410
- spinnerLabel: "Checking for claude-smart updates…",
1419
+ candidates.sort((a, b) => {
1420
+ const versionCompare = compareSemverLikePathNames(b, a);
1421
+ if (versionCompare !== 0) return versionCompare;
1422
+ try {
1423
+ return statSync(b).mtimeMs - statSync(a).mtimeMs;
1424
+ } catch {
1425
+ return 0;
1426
+ }
1411
1427
  });
1412
- if (code !== 0) {
1413
- process.stderr.write(`error: \`claude plugin update ${PLUGIN_SPEC}\` failed (exit ${code})\n`);
1414
- process.exit(code);
1428
+ return candidates[0] || null;
1429
+ }
1430
+
1431
+ async function runUpdate(args) {
1432
+ if (parseHost(args) === "codex") {
1433
+ await runUpdateCodex(args);
1434
+ return;
1415
1435
  }
1416
1436
 
1417
- process.stdout.write("\nclaude-smart updated. Restart Claude Code to apply.\n");
1418
1437
  const pluginRoot = findClaudeCodePluginRoot();
1419
1438
  if (pluginRoot) {
1420
- restorePublishHooksFromSource(pluginRoot);
1421
- if (setup.readOnly) {
1422
- prunePublishHooksForReadOnly(pluginRoot);
1423
- process.stdout.write("Installed read-only hook manifest; publish interactions hooks are disabled.\n");
1424
- }
1439
+ stopClaudeSmartServices(pluginRoot);
1425
1440
  }
1441
+ process.stdout.write("Updating claude-smart by reinstalling from this package...\n");
1442
+ await runInstall(args, { retryInstallAfterUninstall: true });
1443
+ }
1444
+
1445
+ async function runUpdateCodex(args) {
1446
+ const pluginRoot = findCodexPluginRoot() || join(PACKAGE_ROOT, "plugin");
1447
+ stopClaudeSmartServices(pluginRoot);
1448
+ process.stdout.write("Updating claude-smart Codex support by reinstalling from this package...\n");
1449
+ await runInstallCodex(args);
1426
1450
  }
1427
1451
 
1428
1452
  async function runUninstall(args) {
@@ -1475,7 +1499,7 @@ async function runSetup(args) {
1475
1499
  if (code !== 0) process.exit(code);
1476
1500
  }
1477
1501
 
1478
- async function runInstall(args) {
1502
+ async function runInstall(args, options = {}) {
1479
1503
  if (parseHost(args) === "codex") {
1480
1504
  await runInstallCodex(args);
1481
1505
  return;
@@ -1489,7 +1513,7 @@ async function runInstall(args) {
1489
1513
  process.exit(1);
1490
1514
  }
1491
1515
 
1492
- const source = parseSource(args);
1516
+ const source = PACKAGE_ROOT;
1493
1517
  const setup = configureReflexioSetup();
1494
1518
  const readOnly = setup.readOnly;
1495
1519
 
@@ -1499,7 +1523,21 @@ async function runInstall(args) {
1499
1523
  ];
1500
1524
 
1501
1525
  for (const step of steps) {
1502
- const code = await runClaude(step.args, { spinnerLabel: step.label });
1526
+ let code = await runClaude(step.args, { spinnerLabel: step.label });
1527
+ if (
1528
+ code !== 0 &&
1529
+ options.retryInstallAfterUninstall &&
1530
+ step.args[0] === "plugin" &&
1531
+ step.args[1] === "install"
1532
+ ) {
1533
+ process.stderr.write(
1534
+ `warning: \`claude ${step.args.join(" ")}\` failed (exit ${code}); retrying after uninstalling ${PLUGIN_SPEC}.\n`,
1535
+ );
1536
+ await runClaude(["plugin", "uninstall", PLUGIN_SPEC], {
1537
+ spinnerLabel: "Removing existing claude-smart install…",
1538
+ });
1539
+ code = await runClaude(step.args, { spinnerLabel: step.label });
1540
+ }
1503
1541
  if (code !== 0) {
1504
1542
  process.stderr.write(
1505
1543
  `error: \`claude ${step.args.join(" ")}\` failed (exit ${code})\n`,
package/package.json CHANGED
@@ -1,14 +1,20 @@
1
1
  {
2
2
  "name": "claude-smart",
3
- "version": "0.2.41",
4
- "description": "Self-improving Claude Code plugin — learns from corrections via reflexio",
3
+ "version": "0.2.43",
4
+ "description": "Self-improving Claude Code and Codex plugin — turns corrections into durable skills via reflexio",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
8
+ "claude-code-plugin",
9
+ "codex",
10
+ "codex-plugin",
11
+ "memory",
12
+ "agent-memory",
8
13
  "plugin",
9
14
  "reflexio",
10
15
  "self-improvement",
11
- "playbook",
16
+ "self-improving-agents",
17
+ "skills",
12
18
  "learning"
13
19
  ],
14
20
  "homepage": "https://github.com/ReflexioAI/claude-smart#readme",
@@ -29,6 +35,7 @@
29
35
  "bin",
30
36
  "scripts/setup-claude-smart.sh",
31
37
  ".agents/plugins/marketplace.json",
38
+ ".claude-plugin/marketplace.json",
32
39
  "plugin",
33
40
  "!plugin/**/__pycache__",
34
41
  "!plugin/**/*.py[cod]",
@@ -1,17 +1,23 @@
1
1
  {
2
2
  "name": "claude-smart",
3
- "version": "0.2.41",
4
- "description": "Self-improving Claude Code plugin — learns from corrections across sessions via reflexio",
3
+ "version": "0.2.43",
4
+ "description": "Self-improving Claude Code and Codex plugin — turns corrections into durable skills via reflexio",
5
5
  "author": {
6
6
  "name": "Yi Lu"
7
7
  },
8
8
  "keywords": [
9
9
  "claude",
10
10
  "claude-code",
11
+ "claude-code-plugin",
12
+ "codex",
13
+ "codex-plugin",
14
+ "memory",
15
+ "agent-memory",
11
16
  "plugin",
12
17
  "reflexio",
13
18
  "self-improvement",
14
- "playbook",
19
+ "self-improving-agents",
20
+ "skills",
15
21
  "learning"
16
22
  ]
17
23
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-smart",
3
- "version": "0.2.41",
3
+ "version": "0.2.43",
4
4
  "description": "Self-improving coding assistant plugin — learns from corrections across sessions via reflexio",
5
5
  "author": {
6
6
  "name": "Yi Lu"
package/plugin/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # claude-smart
2
2
 
3
- Self-improving [Claude Code](https://claude.com/claude-code) plugin — turns your corrections into durable rules that Claude Code follows in future sessions, via [reflexio](https://github.com/ReflexioAI/reflexio).
3
+ Self-improving [Claude Code](https://claude.com/claude-code) and Codex plugin — turns your corrections into durable skills that future sessions follow, via [reflexio](https://github.com/ReflexioAI/reflexio).
4
4
 
5
- This directory is the published Python package (`claude-smart` on PyPI) and the Claude Code plugin payload shipped through the marketplace. For the project overview, install instructions, benchmarks, and feature walkthrough, see the [top-level README](https://github.com/ReflexioAI/claude-smart#readme).
5
+ This directory is the published Python package (`claude-smart` on PyPI) and the Claude Code/Codex plugin payload shipped through the marketplace. For the project overview, install instructions, benchmarks, and feature walkthrough, see the [top-level README](https://github.com/ReflexioAI/claude-smart#readme).
6
6
 
7
7
  ## Install
8
8
 
@@ -1,7 +1,15 @@
1
1
  import type { NextConfig } from "next";
2
+ import path from "path";
2
3
 
4
+ // Pin Turbopack's workspace root to this dashboard directory. When the
5
+ // plugin is installed via npx (e.g. ~/.npm/_npx/<hash>/node_modules/...),
6
+ // Next would otherwise detect the npx parent's package-lock.json as the
7
+ // workspace root and panic in `next build` ("Failed to write app endpoint
8
+ // /page"). Pinning the root avoids that misdetection.
3
9
  const nextConfig: NextConfig = {
4
- /* config options here */
10
+ turbopack: {
11
+ root: path.resolve(__dirname),
12
+ },
5
13
  };
6
14
 
7
15
  export default nextConfig;
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "claude-smart"
3
- version = "0.2.41"
4
- description = "Self-improving Claude Code plugin — learns from corrections via reflexio"
3
+ version = "0.2.43"
4
+ description = "Self-improving Claude Code and Codex plugin — turns corrections into durable skills via reflexio"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
7
  dependencies = [
@@ -220,6 +220,97 @@ importlib.import_module(sys.argv[1])
220
220
  PY
221
221
  }
222
222
 
223
+ claude_smart_canonical_dir() {
224
+ local dir
225
+ dir="$1"
226
+ [ -d "$dir" ] || return 1
227
+ (cd "$dir" 2>/dev/null && pwd -P)
228
+ }
229
+
230
+ # True when $1 canonicalizes to a plugin directory that physically lives
231
+ # *inside* ~/.reflexio. claude-smart's real install never places the live
232
+ # plugin tree there: the only entry under ~/.reflexio is the `plugin-root`
233
+ # symlink, whose `pwd -P` resolves to a cache dir *outside* ~/.reflexio
234
+ # (~/.claude, ~/.codex, or the npm global). So any plugin root that resolves
235
+ # to a descendant of ~/.reflexio is a stray host-made copy — e.g. the Windows
236
+ # cwd-derived `CUsers...` directories from issue #65 — that we must not
237
+ # bootstrap a heavy .venv/node_modules into.
238
+ #
239
+ # Detection is structural (descendant-of-~/.reflexio + plugin markers) rather
240
+ # than name-based on purpose: the host mangles the cwd differently per drive
241
+ # and user dir (C:\Users -> CUsers..., D:\repos -> Drepos..., varying case),
242
+ # so matching a fixed prefix like `Cu*` misses most real copies.
243
+ claude_smart_is_reflexio_session_copy() {
244
+ local plugin_root reflexio_root
245
+ plugin_root="$(claude_smart_canonical_dir "$1" 2>/dev/null || true)"
246
+ [ -n "$plugin_root" ] || return 1
247
+ # Must look like a plugin root — not ~/.reflexio/data, /configs, or .env.
248
+ [ -f "$plugin_root/pyproject.toml" ] || return 1
249
+ [ -d "$plugin_root/scripts" ] || return 1
250
+ reflexio_root="$(claude_smart_canonical_dir "$HOME/.reflexio" 2>/dev/null || true)"
251
+ [ -n "$reflexio_root" ] || return 1
252
+ # Descendant of ~/.reflexio. The trailing slash on the subject plus the
253
+ # "/" before * pins the boundary so a sibling like ~/.reflexio-bak/plugin
254
+ # does not match.
255
+ case "$plugin_root/" in
256
+ "$reflexio_root"/*) return 0 ;;
257
+ esac
258
+ return 1
259
+ }
260
+
261
+ claude_smart_stable_plugin_root_for_session_copy() {
262
+ local current candidate current_real candidate_real glob
263
+ current="$1"
264
+ if ! claude_smart_is_reflexio_session_copy "$current"; then
265
+ return 1
266
+ fi
267
+ current_real="$(claude_smart_canonical_dir "$current" 2>/dev/null || true)"
268
+
269
+ for candidate in \
270
+ "$HOME/.reflexio/plugin-root" \
271
+ "$HOME/.claude/plugins/marketplaces/reflexioai/plugin" \
272
+ "$HOME/.codex/plugins/cache/reflexioai/claude-smart/current"
273
+ do
274
+ [ -f "$candidate/pyproject.toml" ] || continue
275
+ candidate_real="$(claude_smart_canonical_dir "$candidate" 2>/dev/null || true)"
276
+ [ -n "$candidate_real" ] || continue
277
+ [ "$candidate_real" != "$current_real" ] || continue
278
+ if claude_smart_is_reflexio_session_copy "$candidate_real"; then
279
+ continue
280
+ fi
281
+ printf '%s\n' "$candidate_real"
282
+ return 0
283
+ done
284
+
285
+ for glob in "$HOME/.claude/plugins/cache/reflexioai/claude-smart"/* "$HOME/.codex/plugins/cache/reflexioai/claude-smart"/*; do
286
+ [ -f "$glob/pyproject.toml" ] || continue
287
+ candidate_real="$(claude_smart_canonical_dir "$glob" 2>/dev/null || true)"
288
+ [ -n "$candidate_real" ] || continue
289
+ [ "$candidate_real" != "$current_real" ] || continue
290
+ if claude_smart_is_reflexio_session_copy "$candidate_real"; then
291
+ continue
292
+ fi
293
+ printf '%s\n' "$candidate_real"
294
+ return 0
295
+ done
296
+ return 1
297
+ }
298
+
299
+ claude_smart_reexec_stable_plugin_root_if_needed() {
300
+ local plugin_root script stable
301
+ plugin_root="$1"
302
+ script="$2"
303
+ stable="$(claude_smart_stable_plugin_root_for_session_copy "$plugin_root" 2>/dev/null || true)"
304
+ [ -n "$stable" ] || return 0
305
+ # `-f` not `-x`: we re-run via `exec bash <script>`, which does not need the
306
+ # executable bit. Cached copies on Windows/NTFS often lack +x, so requiring
307
+ # -x would no-op the guard on the very platform issue #65 affects.
308
+ [ -f "$stable/scripts/$script" ] || return 0
309
+ echo "[claude-smart] redirecting stray plugin copy under ~/.reflexio ($plugin_root) to stable root $stable" >&2
310
+ shift 2
311
+ exec bash "$stable/scripts/$script" "$@"
312
+ }
313
+
223
314
  claude_smart_download() {
224
315
  local url dest src _CS_PY
225
316
  url="$1"
@@ -45,6 +45,7 @@ fi
45
45
  # CLI dir (commonly ~/.local/bin or /opt/homebrew/bin). Pin the CLI
46
46
  # explicitly if we can resolve it from our own (post-login-path) PATH.
47
47
  PLUGIN_ROOT="$(cd "$HERE/.." && pwd)"
48
+ claude_smart_reexec_stable_plugin_root_if_needed "$PLUGIN_ROOT" "backend-service.sh" "$@"
48
49
 
49
50
  if [ -z "${CLAUDE_SMART_CLI_PATH:-}" ]; then
50
51
  if [ "${CLAUDE_SMART_HOST:-claude-code}" = "codex" ]; then
@@ -138,20 +139,27 @@ port_occupied() {
138
139
  (echo >"/dev/tcp/127.0.0.1/$PORT") 2>/dev/null
139
140
  }
140
141
 
141
- # Reap any reflexio/uvicorn listener still holding $PORT after the PID
142
- # file kill. Filters by cmdline so we don't knock over an unrelated
143
- # service a user has bound to 8071 — symmetric with start's refusal to
144
- # stomp on a foreign listener. Silent on failure.
142
+ # Reap listeners still holding the given port after the PID file kill
143
+ # when their command line matches one of the supplied patterns. Filters
144
+ # by cmdline so we don't knock over an
145
+ # unrelated service a user has bound there — symmetric with start's
146
+ # refusal to stomp on a foreign listener. Silent on failure.
145
147
  reap_port_listeners() {
148
+ port="${1:-$PORT}"
149
+ shift || true
150
+ [ "$#" -eq 0 ] && return 0
146
151
  command -v lsof >/dev/null 2>&1 || return 0
147
- candidates=$(lsof -ti:"$PORT" 2>/dev/null) || candidates=""
152
+ candidates=$(lsof -ti:"$port" 2>/dev/null) || candidates=""
148
153
  [ -z "$candidates" ] && return 0
149
154
  ours=""
150
155
  for pid in $candidates; do
151
156
  cmdline=$(ps -p "$pid" -o command= 2>/dev/null || true)
152
- case "$cmdline" in
153
- *reflexio*|*uvicorn*) ours="$ours $pid" ;;
154
- esac
157
+ for pattern in "$@"; do
158
+ if [[ "$cmdline" == $pattern ]]; then
159
+ ours="$ours $pid"
160
+ break
161
+ fi
162
+ done
155
163
  done
156
164
  [ -z "$ours" ] && return 0
157
165
  # shellcheck disable=SC2086
@@ -166,16 +174,33 @@ reap_port_listeners() {
166
174
  kill -KILL $remaining 2>/dev/null || true
167
175
  }
168
176
 
169
- # Full shutdown: kill the recorded process group (if any) then sweep the
170
- # port for surviving reflexio listeners. Used by both `stop` and the
171
- # opt-in `session-end` path so a stale/missing PID file doesn't produce
172
- # a silent no-op.
177
+ # Describe what (if anything) is currently listening on $1. Returns
178
+ # "<command> (pid <pid>)" or empty if the port is free or lsof is
179
+ # unavailable. Used to make port-conflict log lines diagnosable.
180
+ port_holder() {
181
+ command -v lsof >/dev/null 2>&1 || return 0
182
+ lsof -i:"$1" -sTCP:LISTEN -P -n 2>/dev/null \
183
+ | awk 'NR==2 {print $1" (pid "$2")"; exit}'
184
+ }
185
+
186
+ # Full shutdown: kill the recorded process group (if any) then sweep
187
+ # both the backend port and the embedding-service port for surviving
188
+ # reflexio listeners. Used by both `stop` and the opt-in `session-end`
189
+ # path so a stale/missing PID file doesn't produce a silent no-op, and
190
+ # so a stale embedding service on EMBEDDING_PORT doesn't block the next
191
+ # fresh boot (e.g. when codex-hook.js falls back to 8072 for the main
192
+ # backend because 8071 is held by another app).
173
193
  full_stop() {
174
194
  if [ -f "$PID_FILE" ]; then
175
195
  kill_group "$(cat "$PID_FILE" 2>/dev/null)"
176
196
  rm -f "$PID_FILE"
177
197
  fi
178
- reap_port_listeners
198
+ reap_port_listeners "$PORT" '*reflexio*' '*uvicorn*'
199
+ if [ -n "${EMBEDDING_PORT:-}" ] && [ "$EMBEDDING_PORT" != "$PORT" ]; then
200
+ reap_port_listeners "$EMBEDDING_PORT" \
201
+ '*reflexio.server.llm.embedding_service:app*' \
202
+ '*reflexio*embedding_service*'
203
+ fi
179
204
  }
180
205
 
181
206
  case "$CMD" in
@@ -195,8 +220,14 @@ case "$CMD" in
195
220
  if is_our_backend_running; then emit_ok; exit 0; fi
196
221
  if port_occupied; then
197
222
  # Something answered the TCP probe but /health didn't — don't
198
- # start a second uvicorn on top of it.
199
- claude_smart_append_capped_log "$LOG_FILE" "$LOG_MAX_BYTES" "[claude-smart] backend: port $PORT held by another process; skipping"
223
+ # start a second uvicorn on top of it. Surface the holder so the
224
+ # user knows which process to quit (common case: editor/dev tool
225
+ # squatting 8071) instead of silently failing.
226
+ holder="$(port_holder "$PORT" 2>/dev/null || true)"
227
+ msg="[claude-smart] backend: port $PORT held by another process${holder:+ ($holder)}; skipping start"
228
+ claude_smart_append_capped_log "$LOG_FILE" "$LOG_MAX_BYTES" "$msg"
229
+ echo "$msg" >&2
230
+ echo "Free port $PORT (or stop the process above) and run /claude-smart:restart again." >&2
200
231
  emit_ok; exit 0
201
232
  fi
202
233
  if ! command -v uv >/dev/null 2>&1; then
@@ -18,6 +18,7 @@ claude_smart_prepend_node_bins
18
18
  claude_smart_source_reflexio_env
19
19
 
20
20
  PLUGIN_ROOT="$(cd "$HERE/.." && pwd)"
21
+ claude_smart_reexec_stable_plugin_root_if_needed "$PLUGIN_ROOT" "cli.sh" "$@"
21
22
 
22
23
  # If the Setup hook recorded an install failure, surface that reason
23
24
  # instead of falling through to a generic "uv not found" — mirrors the
@@ -45,7 +46,7 @@ if ! command -v uv >/dev/null 2>&1; then
45
46
  fi
46
47
  if [ -x "$PLUGIN_ROOT/scripts/smart-install.sh" ]; then
47
48
  echo "claude-smart: 'uv' not found — bootstrapping dependencies (~1-3 min on first install)..." >&2
48
- CLAUDE_SMART_BOOTSTRAPPING=1 bash "$PLUGIN_ROOT/scripts/smart-install.sh" >&2
49
+ CLAUDE_SMART_BOOTSTRAPPING=1 bash "$PLUGIN_ROOT/scripts/smart-install.sh" >/dev/null
49
50
  claude_smart_prepend_astral_bins
50
51
  claude_smart_prepend_node_bins
51
52
  fi
@@ -63,4 +64,31 @@ if ! command -v uv >/dev/null 2>&1; then
63
64
  fi
64
65
  fi
65
66
 
67
+ # Slash commands run synchronously and surface stderr directly to the user,
68
+ # so a bare `python -m claude_smart.cli` ModuleNotFoundError leaks to the
69
+ # transcript when the install is mid-bootstrap (e.g. SessionStart's
70
+ # background smart-install.sh hasn't finished yet). Mirror hook_entry.sh's
71
+ # ensure_hook_package_importable check: run smart-install.sh inline once,
72
+ # then re-check, then surface either the install-failed marker reason or a
73
+ # clear "still bootstrapping" message instead of letting Python crash.
74
+ if ! claude_smart_python_imports "$PLUGIN_ROOT" claude_smart.cli; then
75
+ if [ "${CLAUDE_SMART_BOOTSTRAPPING:-}" != "1" ] \
76
+ && [ -x "$PLUGIN_ROOT/scripts/smart-install.sh" ]; then
77
+ echo "claude-smart: finishing install (~1-3 min on first install)..." >&2
78
+ CLAUDE_SMART_BOOTSTRAPPING=1 bash "$PLUGIN_ROOT/scripts/smart-install.sh" >/dev/null || true
79
+ fi
80
+ if ! claude_smart_python_imports "$PLUGIN_ROOT" claude_smart.cli; then
81
+ if [ -f "$FAILURE_MARKER" ]; then
82
+ msg="$(head -n 1 "$FAILURE_MARKER" 2>/dev/null || echo "")"
83
+ [ -n "$msg" ] || msg="unknown error"
84
+ echo "claude-smart is not installed correctly: $msg" >&2
85
+ echo "Re-run the plugin's Setup (restart Claude Code) or fix the underlying issue and delete $FAILURE_MARKER to retry." >&2
86
+ else
87
+ echo "claude-smart: claude_smart package is not importable in $PLUGIN_ROOT/.venv." >&2
88
+ echo "Run $PLUGIN_ROOT/scripts/smart-install.sh manually to diagnose." >&2
89
+ fi
90
+ exit 1
91
+ fi
92
+ fi
93
+
66
94
  exec uv run --project "$PLUGIN_ROOT" --no-sync --quiet python -m claude_smart.cli "$@"