ashlr-plugin 1.36.4

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 (499) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +39 -0
  3. package/.claude-plugin/plugin.json +36 -0
  4. package/.codex/agents/README.md +9 -0
  5. package/.codex/agents/ashlr-explorer.md +36 -0
  6. package/.codex/agents/ashlr-worker.md +38 -0
  7. package/.codex-plugin/plugin.json +45 -0
  8. package/.mcp.json +14 -0
  9. package/LICENSE +21 -0
  10. package/README.md +311 -0
  11. package/agents/ashlr-code.md +69 -0
  12. package/agents/ashlr-explore.md +44 -0
  13. package/agents/ashlr-plan.md +54 -0
  14. package/bench/fixtures/notebook-large.ipynb +660 -0
  15. package/bench/fixtures/notebook-small.ipynb +39 -0
  16. package/bench/fixtures/tasklist-closed.json +62 -0
  17. package/bench/fixtures/tasklist-large-mixed.json +27 -0
  18. package/bench/fixtures/tasklist-sprint-open.json +79 -0
  19. package/bench/fixtures/websearch-bun-runtime.json +32 -0
  20. package/bench/fixtures/websearch-react-hooks-patterns.json +32 -0
  21. package/bench/fixtures/websearch-typescript-generics.json +38 -0
  22. package/bench/refs/node-sdk/.refrev +1 -0
  23. package/bench/refs/node-sdk/README.md +17 -0
  24. package/bench/refs/node-sdk/src/agent/agent.ts +163 -0
  25. package/bench/refs/node-sdk/src/agent/create-agent-ui-stream.ts +83 -0
  26. package/bench/refs/node-sdk/src/agent/tool-loop-agent.ts +238 -0
  27. package/bench/refs/node-sdk/src/embed/embed-many.ts +409 -0
  28. package/bench/refs/node-sdk/src/embed/embed-result.ts +50 -0
  29. package/bench/refs/node-sdk/src/embed/embed.ts +257 -0
  30. package/bench/refs/node-sdk/src/error/invalid-argument-error.ts +34 -0
  31. package/bench/refs/node-sdk/src/error/invalid-tool-input-error.ts +33 -0
  32. package/bench/refs/node-sdk/src/error/no-object-generated-error.ts +70 -0
  33. package/bench/refs/node-sdk/src/generate-image/generate-image-result.ts +42 -0
  34. package/bench/refs/node-sdk/src/generate-image/generate-image.ts +362 -0
  35. package/bench/refs/node-sdk/src/generate-object/generate-object-result.ts +67 -0
  36. package/bench/refs/node-sdk/src/generate-object/generate-object.ts +501 -0
  37. package/bench/refs/node-sdk/src/generate-object/inject-json-instruction.ts +30 -0
  38. package/bench/refs/node-sdk/src/generate-object/output-strategy.ts +415 -0
  39. package/bench/refs/node-sdk/src/generate-object/repair-text.ts +12 -0
  40. package/bench/refs/node-sdk/src/generate-object/stream-object.ts +960 -0
  41. package/bench/refs/node-sdk/src/generate-speech/generate-speech.ts +191 -0
  42. package/bench/refs/node-sdk/src/generate-text/generate-text.ts +1484 -0
  43. package/bench/refs/node-sdk/src/generate-text/stream-text.ts +2708 -0
  44. package/bench/refs/node-sdk/src/generate-text/tool-call.ts +59 -0
  45. package/bench/refs/node-sdk/src/generate-text/tool-result.ts +36 -0
  46. package/bench/refs/node-sdk/src/telemetry/create-telemetry-dispatcher.ts +146 -0
  47. package/bench/refs/node-sdk/src/telemetry/telemetry-registry.ts +15 -0
  48. package/bench/refs/node-sdk/src/telemetry/telemetry.ts +223 -0
  49. package/bench/refs/node-sdk/src/util/async-iterable-stream.ts +94 -0
  50. package/bench/refs/node-sdk/src/util/consume-stream.ts +31 -0
  51. package/bench/refs/node-sdk/src/util/create-stitchable-stream.ts +112 -0
  52. package/bench/refs/node-sdk/src/util/download/download.ts +74 -0
  53. package/bench/refs/node-sdk/src/util/error-handler.ts +1 -0
  54. package/bench/refs/node-sdk/src/util/fix-json.ts +401 -0
  55. package/bench/refs/node-sdk/src/util/merge-objects.ts +79 -0
  56. package/bench/refs/python-lib/.refrev +1 -0
  57. package/bench/refs/python-lib/README.md +18 -0
  58. package/bench/refs/python-lib/pandas/core/_numba/executor.py +249 -0
  59. package/bench/refs/python-lib/pandas/core/_numba/extensions.py +586 -0
  60. package/bench/refs/python-lib/pandas/core/_numba/kernels/mean_.py +198 -0
  61. package/bench/refs/python-lib/pandas/core/_numba/kernels/min_max_.py +178 -0
  62. package/bench/refs/python-lib/pandas/core/_numba/kernels/sum_.py +255 -0
  63. package/bench/refs/python-lib/pandas/core/_numba/kernels/var_.py +251 -0
  64. package/bench/refs/python-lib/pandas/core/accessor.py +520 -0
  65. package/bench/refs/python-lib/pandas/core/api.py +138 -0
  66. package/bench/refs/python-lib/pandas/core/array_algos/masked_accumulations.py +97 -0
  67. package/bench/refs/python-lib/pandas/core/array_algos/masked_reductions.py +252 -0
  68. package/bench/refs/python-lib/pandas/core/array_algos/putmask.py +150 -0
  69. package/bench/refs/python-lib/pandas/core/array_algos/quantile.py +232 -0
  70. package/bench/refs/python-lib/pandas/core/array_algos/replace.py +159 -0
  71. package/bench/refs/python-lib/pandas/core/array_algos/take.py +609 -0
  72. package/bench/refs/python-lib/pandas/core/arraylike.py +534 -0
  73. package/bench/refs/python-lib/pandas/core/arrays/_arrow_string_mixins.py +434 -0
  74. package/bench/refs/python-lib/pandas/core/arrays/_mixins.py +630 -0
  75. package/bench/refs/python-lib/pandas/core/arrays/_ranges.py +276 -0
  76. package/bench/refs/python-lib/pandas/core/arrays/_utils.py +77 -0
  77. package/bench/refs/python-lib/pandas/core/arrays/arrow/accessors.py +521 -0
  78. package/bench/refs/python-lib/pandas/core/arrays/arrow/extension_types.py +174 -0
  79. package/bench/refs/python-lib/pandas/core/arrays/boolean.py +454 -0
  80. package/bench/refs/python-lib/pandas/core/arrays/floating.py +192 -0
  81. package/bench/refs/python-lib/pandas/core/arrays/integer.py +296 -0
  82. package/bench/refs/python-lib/pandas/core/arrays/masked.py +2140 -0
  83. package/bench/refs/python-lib/pandas/core/arrays/numeric.py +305 -0
  84. package/bench/refs/python-lib/pandas/core/arrays/numpy_.py +701 -0
  85. package/bench/refs/python-lib/pandas/core/arrays/period.py +1586 -0
  86. package/bench/refs/python-lib/pandas/core/arrays/sparse/accessor.py +505 -0
  87. package/bench/refs/python-lib/pandas/core/arrays/sparse/scipy_sparse.py +208 -0
  88. package/bench/refs/rust-project/.refrev +1 -0
  89. package/bench/refs/rust-project/README.md +17 -0
  90. package/bench/refs/rust-project/tokio/src/doc/os.rs +68 -0
  91. package/bench/refs/rust-project/tokio/src/fs/dir_builder.rs +129 -0
  92. package/bench/refs/rust-project/tokio/src/fs/file.rs +1113 -0
  93. package/bench/refs/rust-project/tokio/src/fs/mocks.rs +176 -0
  94. package/bench/refs/rust-project/tokio/src/fs/mod.rs +324 -0
  95. package/bench/refs/rust-project/tokio/src/fs/open_options.rs +856 -0
  96. package/bench/refs/rust-project/tokio/src/fs/read.rs +80 -0
  97. package/bench/refs/rust-project/tokio/src/fs/read_dir.rs +357 -0
  98. package/bench/refs/rust-project/tokio/src/fs/write.rs +99 -0
  99. package/bench/refs/rust-project/tokio/src/future/maybe_done.rs +123 -0
  100. package/bench/refs/rust-project/tokio/src/future/try_join.rs +82 -0
  101. package/bench/refs/rust-project/tokio/src/io/async_buf_read.rs +117 -0
  102. package/bench/refs/rust-project/tokio/src/io/async_read.rs +133 -0
  103. package/bench/refs/rust-project/tokio/src/io/async_seek.rs +96 -0
  104. package/bench/refs/rust-project/tokio/src/io/async_write.rs +402 -0
  105. package/bench/refs/rust-project/tokio/src/io/blocking.rs +339 -0
  106. package/bench/refs/rust-project/tokio/src/io/interest.rs +345 -0
  107. package/bench/refs/rust-project/tokio/src/io/join.rs +130 -0
  108. package/bench/refs/rust-project/tokio/src/io/mod.rs +308 -0
  109. package/bench/refs/rust-project/tokio/src/io/poll_evented.rs +319 -0
  110. package/bench/refs/rust-project/tokio/src/io/read_buf.rs +344 -0
  111. package/bench/refs/rust-project/tokio/src/io/ready.rs +322 -0
  112. package/bench/refs/rust-project/tokio/src/io/split.rs +166 -0
  113. package/bench/refs/rust-project/tokio/src/io/stderr.rs +148 -0
  114. package/bench/refs/rust-project/tokio/src/io/stdin.rs +98 -0
  115. package/bench/refs/rust-project/tokio/src/io/stdio_common.rs +222 -0
  116. package/bench/refs/rust-project/tokio/src/io/stdout.rs +197 -0
  117. package/bench/refs/rust-project/tokio/src/io/util/buf_reader.rs +311 -0
  118. package/bench/refs/rust-project/tokio/src/io/util/buf_stream.rs +207 -0
  119. package/bench/refs/rust-project/tokio/src/io/util/buf_writer.rs +310 -0
  120. package/bench/refs/rust-project/tokio/src/io/util/chain.rs +144 -0
  121. package/commands/_spawn-patterns.json +32 -0
  122. package/commands/ashlr-allow.md +21 -0
  123. package/commands/ashlr-benchmark.md +53 -0
  124. package/commands/ashlr-brief.md +97 -0
  125. package/commands/ashlr-budget.md +76 -0
  126. package/commands/ashlr-compact.md +54 -0
  127. package/commands/ashlr-dashboard.md +37 -0
  128. package/commands/ashlr-doctor.md +56 -0
  129. package/commands/ashlr-eco-mode.md +92 -0
  130. package/commands/ashlr-genome-init.md +24 -0
  131. package/commands/ashlr-genome-keygen.md +36 -0
  132. package/commands/ashlr-genome-loop.md +118 -0
  133. package/commands/ashlr-genome-push.md +36 -0
  134. package/commands/ashlr-genome-rewrap.md +48 -0
  135. package/commands/ashlr-genome-team-init.md +67 -0
  136. package/commands/ashlr-handoff.md +23 -0
  137. package/commands/ashlr-help.md +86 -0
  138. package/commands/ashlr-hook-timings.md +30 -0
  139. package/commands/ashlr-leaderboard.md +50 -0
  140. package/commands/ashlr-ollama-setup.md +39 -0
  141. package/commands/ashlr-orchestrate-status.md +72 -0
  142. package/commands/ashlr-orchestrate.md +83 -0
  143. package/commands/ashlr-parallelize.md +63 -0
  144. package/commands/ashlr-report-crash.md +33 -0
  145. package/commands/ashlr-resume.md +72 -0
  146. package/commands/ashlr-savings.md +24 -0
  147. package/commands/ashlr-settings.md +50 -0
  148. package/commands/ashlr-spawn.md +61 -0
  149. package/commands/ashlr-start.md +60 -0
  150. package/commands/ashlr-status.md +64 -0
  151. package/commands/ashlr-team-invite.md +47 -0
  152. package/commands/ashlr-tier.md +122 -0
  153. package/commands/ashlr-tour.md +60 -0
  154. package/commands/ashlr-update.md +155 -0
  155. package/commands/ashlr-upgrade.md +96 -0
  156. package/commands/goal.md +58 -0
  157. package/commands/loop.md +40 -0
  158. package/docs/CNAME +1 -0
  159. package/docs/PRO_TIER.md +104 -0
  160. package/docs/README.md +21 -0
  161. package/docs/architecture.md +415 -0
  162. package/docs/ashlr-pipe.md +161 -0
  163. package/docs/assets/logo.svg +19 -0
  164. package/docs/assets/og.png +0 -0
  165. package/docs/assets/og.svg +41 -0
  166. package/docs/benchmarks-v2.json +355 -0
  167. package/docs/benchmarks.json +102 -0
  168. package/docs/benchmarks.md +211 -0
  169. package/docs/billing.md +185 -0
  170. package/docs/cloud-genome.md +155 -0
  171. package/docs/competitive-wozcode.md +92 -0
  172. package/docs/deploy.md +325 -0
  173. package/docs/email-templates.md +113 -0
  174. package/docs/embed-tuning.md +103 -0
  175. package/docs/genome.md +120 -0
  176. package/docs/github-oauth-onboarding.md +127 -0
  177. package/docs/hero-video-script.md +129 -0
  178. package/docs/index.html +2262 -0
  179. package/docs/install-prompt.md +78 -0
  180. package/docs/install-windows.md +132 -0
  181. package/docs/install.ps1 +171 -0
  182. package/docs/install.sh +146 -0
  183. package/docs/launch/README.md +114 -0
  184. package/docs/launch/hn.md +49 -0
  185. package/docs/launch/reddit.md +45 -0
  186. package/docs/launch/x.md +65 -0
  187. package/docs/launch-post.md +112 -0
  188. package/docs/legal.md +78 -0
  189. package/docs/llm-providers.md +99 -0
  190. package/docs/multi-host-mcp.md +217 -0
  191. package/docs/multi-turn-architecture.md +108 -0
  192. package/docs/operations/deployment.md +108 -0
  193. package/docs/operations/error-monitoring.md +70 -0
  194. package/docs/operations/weekly-digest.md +70 -0
  195. package/docs/operations.md +494 -0
  196. package/docs/platform-support.md +133 -0
  197. package/docs/policy-packs.md +188 -0
  198. package/docs/press-kit/fact-sheet.md +78 -0
  199. package/docs/press-kit/founder-bio.md +3 -0
  200. package/docs/press-kit/logo.svg +33 -0
  201. package/docs/press-kit/screenshots.md +146 -0
  202. package/docs/pricing.md +251 -0
  203. package/docs/pro-backend-architecture.md +523 -0
  204. package/docs/producthunt.md +52 -0
  205. package/docs/router-migration.md +110 -0
  206. package/docs/session-log-schema.md +68 -0
  207. package/docs/social.md +95 -0
  208. package/docs/team-genome.md +528 -0
  209. package/docs/telemetry.md +194 -0
  210. package/docs/test-isolation.md +100 -0
  211. package/docs/upgrade.md +159 -0
  212. package/hooks/_hook-errors.ts +87 -0
  213. package/hooks/_hook-perf-emit.ts +113 -0
  214. package/hooks/_hook-timing-ledger.ts +1133 -0
  215. package/hooks/_nudge-throttle.ts +127 -0
  216. package/hooks/_recent-blocks.ts +127 -0
  217. package/hooks/audit-upload.ts +86 -0
  218. package/hooks/codex-hooks.json +171 -0
  219. package/hooks/commit-attribution.ts +179 -0
  220. package/hooks/edit-batching-nudge.ts +154 -0
  221. package/hooks/genome-scribe-hook.ts +219 -0
  222. package/hooks/hooks.json +294 -0
  223. package/hooks/orient-nudge-hook.ts +242 -0
  224. package/hooks/policy-enforce.ts +214 -0
  225. package/hooks/post-tool-use-embedding.ts +93 -0
  226. package/hooks/post-tool-use-genome.sh +37 -0
  227. package/hooks/post-tool-use-genome.ts +69 -0
  228. package/hooks/posttooluse-correlate.ts +122 -0
  229. package/hooks/posttooluse-dedupe-output.ts +241 -0
  230. package/hooks/posttooluse-genome-refresh.ts +223 -0
  231. package/hooks/posttooluse-native-nudge.ts +205 -0
  232. package/hooks/posttooluse-stale-result.ts +277 -0
  233. package/hooks/pretooluse-bash.ts +63 -0
  234. package/hooks/pretooluse-budget-guard.ts +318 -0
  235. package/hooks/pretooluse-common.ts +985 -0
  236. package/hooks/pretooluse-eco-router.ts +196 -0
  237. package/hooks/pretooluse-edit.sh +93 -0
  238. package/hooks/pretooluse-edit.ts +197 -0
  239. package/hooks/pretooluse-glob.ts +70 -0
  240. package/hooks/pretooluse-grep.sh +85 -0
  241. package/hooks/pretooluse-grep.ts +96 -0
  242. package/hooks/pretooluse-notebookedit.ts +121 -0
  243. package/hooks/pretooluse-read.sh +118 -0
  244. package/hooks/pretooluse-read.ts +118 -0
  245. package/hooks/pretooluse-task.ts +130 -0
  246. package/hooks/pretooluse-webfetch.ts +66 -0
  247. package/hooks/pretooluse-websearch.ts +85 -0
  248. package/hooks/pretooluse-write.ts +128 -0
  249. package/hooks/pulse-emit.ts +197 -0
  250. package/hooks/session-end-consolidate.sh +35 -0
  251. package/hooks/session-end-consolidate.ts +188 -0
  252. package/hooks/session-end-stats-gc.ts +80 -0
  253. package/hooks/session-log-append.sh +94 -0
  254. package/hooks/session-log-append.ts +116 -0
  255. package/hooks/session-start.ts +993 -0
  256. package/hooks/sessionend-hook-health-nudge.ts +451 -0
  257. package/hooks/sessionend-savings-nudge.ts +318 -0
  258. package/hooks/sessionend-status-line-nudge.ts +296 -0
  259. package/hooks/sessionstart-brief.ts +140 -0
  260. package/hooks/sessionstart-cost-refactor.ts +95 -0
  261. package/hooks/sessionstart-efficient.ts +110 -0
  262. package/hooks/sessionstart-genome-author.ts +93 -0
  263. package/hooks/sessionstart-lean-tools.ts +98 -0
  264. package/hooks/sessionstart-search.ts +97 -0
  265. package/hooks/stop-accounting.ts +152 -0
  266. package/hooks/subagent-stop-rollup.ts +162 -0
  267. package/hooks/userpromptsubmit-brief-trigger.ts +156 -0
  268. package/package.json +56 -0
  269. package/ports/README.md +108 -0
  270. package/ports/cursor/mcp.json +11 -0
  271. package/ports/goose/recipe.yaml +26 -0
  272. package/scripts/ashlr-mcp.ts +40 -0
  273. package/scripts/auto-update.ts +177 -0
  274. package/scripts/baseline-scan.ts +831 -0
  275. package/scripts/bench-orchestrate.ts +377 -0
  276. package/scripts/benchmark-refs.ts +292 -0
  277. package/scripts/bootstrap.mjs +100 -0
  278. package/scripts/brief-eval.ts +234 -0
  279. package/scripts/bump-version.ts +82 -0
  280. package/scripts/bun-resolve.d.mts +11 -0
  281. package/scripts/bun-resolve.mjs +59 -0
  282. package/scripts/calibrate-grep.ts +467 -0
  283. package/scripts/capture-grep-workload.ts +260 -0
  284. package/scripts/check-tier.ts +61 -0
  285. package/scripts/check-version-sync.ts +97 -0
  286. package/scripts/cli-orchestrate-status.ts +386 -0
  287. package/scripts/cli-orchestrate.ts +303 -0
  288. package/scripts/cli.ts +478 -0
  289. package/scripts/cloud-smoke-test.ts +313 -0
  290. package/scripts/coach-report.ts +373 -0
  291. package/scripts/context-db-migrate.ts +137 -0
  292. package/scripts/context-status.ts +43 -0
  293. package/scripts/demo-run.ts +255 -0
  294. package/scripts/deploy-smoke.sh +140 -0
  295. package/scripts/doctor.ts +992 -0
  296. package/scripts/embed-file-worker.ts +104 -0
  297. package/scripts/embed-tune.ts +308 -0
  298. package/scripts/errors-report.ts +428 -0
  299. package/scripts/find-test-leak.ts +69 -0
  300. package/scripts/generate-badge.ts +357 -0
  301. package/scripts/genome-auto-consolidate.ts +533 -0
  302. package/scripts/genome-auto-propose.ts +578 -0
  303. package/scripts/genome-cloud-pull.ts +363 -0
  304. package/scripts/genome-cloud-push.ts +382 -0
  305. package/scripts/genome-cloud-sync.ts +587 -0
  306. package/scripts/genome-commit-watcher.ts +295 -0
  307. package/scripts/genome-init.ts +986 -0
  308. package/scripts/genome-key.ts +233 -0
  309. package/scripts/genome-keygen.ts +168 -0
  310. package/scripts/genome-link.ts +59 -0
  311. package/scripts/genome-refresh-worker.ts +364 -0
  312. package/scripts/genome-rewrap.ts +90 -0
  313. package/scripts/genome-synthesizer.ts +679 -0
  314. package/scripts/genome-team-init.ts +312 -0
  315. package/scripts/handoff-pack.ts +438 -0
  316. package/scripts/hook-bootstrap.mjs +75 -0
  317. package/scripts/hook-timing-reader.ts +371 -0
  318. package/scripts/hook-timings-report.ts +554 -0
  319. package/scripts/install-genome-hooks.ts +196 -0
  320. package/scripts/install-onnx-model.ts +154 -0
  321. package/scripts/install-permissions.ts +276 -0
  322. package/scripts/install-status-line.ts +150 -0
  323. package/scripts/mcp-entrypoint.sh +78 -0
  324. package/scripts/mcp-entrypoint.ts +130 -0
  325. package/scripts/mdx-angle-bracket-lint.ts +152 -0
  326. package/scripts/measure-cold-start.ts +126 -0
  327. package/scripts/migrate-stats-to-sqlite.ts +86 -0
  328. package/scripts/ollama-setup.ts +498 -0
  329. package/scripts/onboarding-wizard.ts +1691 -0
  330. package/scripts/orchestrate-emit-telemetry.ts +177 -0
  331. package/scripts/orchestrate-expand.ts +517 -0
  332. package/scripts/orchestrate-run.ts +744 -0
  333. package/scripts/print-legend.ts +50 -0
  334. package/scripts/product-metadata.ts +38 -0
  335. package/scripts/prune-old-memories.ts +208 -0
  336. package/scripts/publish.sh +88 -0
  337. package/scripts/read-calibration.ts +122 -0
  338. package/scripts/report-crash.ts +226 -0
  339. package/scripts/run-benchmark.ts +750 -0
  340. package/scripts/run-root-tests.ts +28 -0
  341. package/scripts/savings-dashboard.ts +1258 -0
  342. package/scripts/savings-report-extras.ts +447 -0
  343. package/scripts/savings-status-line.ts +873 -0
  344. package/scripts/session-event-emit.ts +266 -0
  345. package/scripts/session-greet.ts +686 -0
  346. package/scripts/session-log-report.ts +551 -0
  347. package/scripts/session-resume.ts +614 -0
  348. package/scripts/set-hook-mode.ts +83 -0
  349. package/scripts/smoke-cross-platform.ts +117 -0
  350. package/scripts/smoke-realtime.ts +257 -0
  351. package/scripts/smoke-tools.ts +21 -0
  352. package/scripts/stats-cloud-pull.ts +213 -0
  353. package/scripts/stats-cloud-sync.ts +261 -0
  354. package/scripts/telemetry-flush.ts +160 -0
  355. package/scripts/telemetry-status.ts +266 -0
  356. package/scripts/timing-budget.ts +35 -0
  357. package/scripts/ui-animation.ts +120 -0
  358. package/scripts/ui.ts +431 -0
  359. package/scripts/upgrade-flow.ts +775 -0
  360. package/scripts/weekly-digest.ts +394 -0
  361. package/servers/_accounting.ts +78 -0
  362. package/servers/_ask-router.ts +84 -0
  363. package/servers/_ast-chunker.ts +434 -0
  364. package/servers/_ast-helpers.ts +183 -0
  365. package/servers/_ast-languages.ts +153 -0
  366. package/servers/_ast-refactor/_shared.ts +221 -0
  367. package/servers/_ast-refactor/cross-file-rename.ts +560 -0
  368. package/servers/_ast-refactor/extract-function.ts +357 -0
  369. package/servers/_ast-refactor/file-local-rename.ts +172 -0
  370. package/servers/_ast-refactor.ts +41 -0
  371. package/servers/_ast-skeleton.ts +107 -0
  372. package/servers/_bash-summarizers-registry.ts +1096 -0
  373. package/servers/_crash-dump.ts +210 -0
  374. package/servers/_cwd-clamp.ts +342 -0
  375. package/servers/_edit-log.ts +28 -0
  376. package/servers/_edit-match.ts +236 -0
  377. package/servers/_edit-validate.ts +196 -0
  378. package/servers/_embed-calibration.ts +123 -0
  379. package/servers/_embedding-cache.ts +401 -0
  380. package/servers/_embedding-model.ts +329 -0
  381. package/servers/_events.ts +113 -0
  382. package/servers/_genome-cache.ts +154 -0
  383. package/servers/_genome-commits.ts +172 -0
  384. package/servers/_genome-crypto-v2.ts +242 -0
  385. package/servers/_genome-crypto.ts +259 -0
  386. package/servers/_genome-discoveries.ts +140 -0
  387. package/servers/_genome-embed-populator.ts +216 -0
  388. package/servers/_genome-freshness.ts +134 -0
  389. package/servers/_genome-issues.ts +171 -0
  390. package/servers/_genome-live.ts +263 -0
  391. package/servers/_genome-prs.ts +188 -0
  392. package/servers/_genome-search.ts +479 -0
  393. package/servers/_genome-sync.ts +297 -0
  394. package/servers/_history-tracker.ts +279 -0
  395. package/servers/_http-helpers.ts +151 -0
  396. package/servers/_identity-hash.ts +151 -0
  397. package/servers/_llm-providers/anthropic.ts +132 -0
  398. package/servers/_llm-providers/cloud.ts +195 -0
  399. package/servers/_llm-providers/index.ts +350 -0
  400. package/servers/_llm-providers/local.ts +127 -0
  401. package/servers/_llm-providers/onnx.ts +393 -0
  402. package/servers/_llm-providers/types.ts +27 -0
  403. package/servers/_manifest-v2.ts +447 -0
  404. package/servers/_mcp-host.ts +93 -0
  405. package/servers/_nudge-events.ts +451 -0
  406. package/servers/_orchestrate-executor.ts +316 -0
  407. package/servers/_prefetch.ts +435 -0
  408. package/servers/_pricing.ts +256 -0
  409. package/servers/_pro.ts +381 -0
  410. package/servers/_read-cache.ts +44 -0
  411. package/servers/_router-handlers.ts +46 -0
  412. package/servers/_router.ts +55 -0
  413. package/servers/_run-with-timeout.ts +173 -0
  414. package/servers/_savings-render.ts +214 -0
  415. package/servers/_stats-sqlite.ts +640 -0
  416. package/servers/_stats.ts +1183 -0
  417. package/servers/_status-line-cells.ts +469 -0
  418. package/servers/_streaks.ts +162 -0
  419. package/servers/_summarize.ts +208 -0
  420. package/servers/_task-graph-render.ts +217 -0
  421. package/servers/_task-graph.ts +545 -0
  422. package/servers/_telemetry.ts +719 -0
  423. package/servers/_test-parsers.ts +530 -0
  424. package/servers/_test-watch.ts +626 -0
  425. package/servers/_text-helpers.ts +37 -0
  426. package/servers/_token-measure.ts +160 -0
  427. package/servers/_tool-base.ts +248 -0
  428. package/servers/_weekly-digest.ts +391 -0
  429. package/servers/ask-server-handlers.ts +49 -0
  430. package/servers/ask-server.ts +174 -0
  431. package/servers/bash-server-handlers.ts +138 -0
  432. package/servers/bash-server.ts +1136 -0
  433. package/servers/bench.ts +186 -0
  434. package/servers/diff-semantic-server-handlers.ts +39 -0
  435. package/servers/diff-semantic-server.ts +566 -0
  436. package/servers/diff-server-handlers.ts +317 -0
  437. package/servers/diff-server.ts +20 -0
  438. package/servers/edit-server-handlers.ts +31 -0
  439. package/servers/edit-server.ts +209 -0
  440. package/servers/edit-structural-server-handlers.ts +322 -0
  441. package/servers/efficiency-server-handlers.ts +161 -0
  442. package/servers/efficiency-server.ts +1135 -0
  443. package/servers/flush-server-handlers.ts +21 -0
  444. package/servers/flush-server.ts +19 -0
  445. package/servers/genome-server-handlers.ts +118 -0
  446. package/servers/genome-server.ts +397 -0
  447. package/servers/github-server-handlers.ts +187 -0
  448. package/servers/github-server.ts +856 -0
  449. package/servers/glob-server-handlers.ts +233 -0
  450. package/servers/glob-server.ts +20 -0
  451. package/servers/grep-server-handlers.ts +61 -0
  452. package/servers/grep-server.ts +564 -0
  453. package/servers/http-server-handlers.ts +36 -0
  454. package/servers/http-server.ts +149 -0
  455. package/servers/logs-server-handlers.ts +42 -0
  456. package/servers/logs-server.ts +359 -0
  457. package/servers/ls-server-handlers.ts +166 -0
  458. package/servers/ls-server.ts +20 -0
  459. package/servers/multi-edit-server-handlers.ts +51 -0
  460. package/servers/multi-edit-server.ts +422 -0
  461. package/servers/notebook-edit-server-handlers.ts +34 -0
  462. package/servers/notebook-edit-server.ts +181 -0
  463. package/servers/orient-server-handlers.ts +52 -0
  464. package/servers/orient-server.ts +436 -0
  465. package/servers/pipe-server-handlers.ts +68 -0
  466. package/servers/pipe-server.ts +300 -0
  467. package/servers/read-server-handlers.ts +42 -0
  468. package/servers/read-server.ts +206 -0
  469. package/servers/rename-file-server-handlers.ts +67 -0
  470. package/servers/rename-file-server.ts +699 -0
  471. package/servers/savings-server-handlers.ts +27 -0
  472. package/servers/savings-server.ts +54 -0
  473. package/servers/search-replace-regex-server-handlers.ts +96 -0
  474. package/servers/search-replace-regex-server.ts +751 -0
  475. package/servers/sql-server-handlers.ts +58 -0
  476. package/servers/sql-server.ts +505 -0
  477. package/servers/task-server-handlers.ts +358 -0
  478. package/servers/task-server.ts +24 -0
  479. package/servers/test-server-handlers.ts +351 -0
  480. package/servers/test-server.ts +20 -0
  481. package/servers/tree-server-handlers.ts +503 -0
  482. package/servers/tree-server.ts +20 -0
  483. package/servers/webfetch-server-handlers.ts +166 -0
  484. package/servers/webfetch-server.ts +20 -0
  485. package/servers/websearch-server-handlers.ts +215 -0
  486. package/servers/websearch-server.ts +19 -0
  487. package/servers/write-server-handlers.ts +27 -0
  488. package/servers/write-server.ts +97 -0
  489. package/skills/ashlr-brief/SKILL.md +80 -0
  490. package/skills/ashlr-codex-doctor/SKILL.md +21 -0
  491. package/skills/ashlr-codex-efficient-tools/SKILL.md +17 -0
  492. package/skills/ashlr-codex-genome-refresh/SKILL.md +20 -0
  493. package/skills/ashlr-codex-parallel-explore/SKILL.md +20 -0
  494. package/skills/ashlr-codex-savings/SKILL.md +17 -0
  495. package/skills/ashlr-cost-refactor/SKILL.md +50 -0
  496. package/skills/ashlr-efficient/SKILL.md +64 -0
  497. package/skills/ashlr-genome-author/SKILL.md +43 -0
  498. package/skills/ashlr-lean-tools/SKILL.md +43 -0
  499. package/skills/ashlr-search/SKILL.md +46 -0
@@ -0,0 +1,494 @@
1
+ # Operations Runbook — ashlr-server
2
+
3
+ This document covers monitoring, alerting, and incident response for the ashlr pro backend.
4
+
5
+ ---
6
+
7
+ ## What to Monitor
8
+
9
+ ### Health Endpoints
10
+
11
+ | Endpoint | Purpose | Expected |
12
+ |----------|---------|---------|
13
+ | `GET /healthz` | Liveness — is the process alive? | 200 always |
14
+ | `GET /readyz` | Readiness — is SQLite reachable? | 200 in normal operation |
15
+
16
+ Configure your uptime monitor (e.g. Fly.io checks, Better Uptime, Checkly) to hit `/readyz` every 15–30 seconds with a 5-second timeout. Alert on 2+ consecutive failures.
17
+
18
+ ### Prometheus Metrics
19
+
20
+ Scrape `GET /metrics` (Basic Auth or IP allowlist required). Key metrics to dashboard:
21
+
22
+ #### Request Traffic
23
+ ```
24
+ # Total request rate
25
+ rate(ashlr_http_requests_total[5m])
26
+
27
+ # Error rate (5xx)
28
+ rate(ashlr_http_requests_total{status=~"5.."}[5m])
29
+
30
+ # p95 latency
31
+ histogram_quantile(0.95, rate(ashlr_http_request_duration_seconds_bucket[5m]))
32
+ ```
33
+
34
+ #### Business Metrics
35
+ ```
36
+ ashlr_users_total # total registered users
37
+ ashlr_subscriptions_active # paying customers right now
38
+ ashlr_stats_uploads_total # plugin upload volume
39
+ rate(ashlr_magic_links_sent_total[1h]) # sign-up velocity
40
+ rate(ashlr_llm_requests_total[5m]) # LLM usage by tier
41
+ ```
42
+
43
+ #### LLM Token Spend
44
+ ```
45
+ histogram_quantile(0.95, rate(ashlr_llm_request_tokens_bucket{type="input"}[5m]))
46
+ ```
47
+
48
+ ### Logs
49
+
50
+ All logs are structured JSON on stdout. Use your platform's log aggregator (Railway → `railway logs --service ashlr-plugin-api`, Datadog, Loki, etc.).
51
+
52
+ **Key log fields to alert on:**
53
+ - `level: "error"` — unexpected server errors
54
+ - `status: 502` — xAI Grok API failures
55
+ - `status: 429` on `/llm/summarize` at high rate — rate-limit flood
56
+
57
+ **PII note:** `authorization`, `cookie`, `email`, `text`, `systemPrompt` are always `[REDACTED]` in logs.
58
+
59
+ ---
60
+
61
+ ## Alert Thresholds (Recommended)
62
+
63
+ | Alert | Condition | Severity |
64
+ |-------|-----------|---------|
65
+ | DB down | `/readyz` returns non-200 for 2+ checks | Critical |
66
+ | High error rate | 5xx rate > 1% of requests over 5m | Warning |
67
+ | LLM unavailable | `/llm/summarize` returning 502 > 5 times / minute | Warning |
68
+ | Stripe webhook lag | No `billing/webhook` calls in 2h during business hours | Info |
69
+ | Rate-limit flood | `status=429` > 50/min on any single path | Warning |
70
+
71
+ ---
72
+
73
+ ## Runbooks
74
+
75
+ ### DB Down (`/readyz` returning 503)
76
+
77
+ **Symptoms:** `/readyz` returns `{ "db": "error" }`. Authenticated routes returning 500.
78
+
79
+ **Likely causes:**
80
+ 1. SQLite file on a volume that wasn't mounted (Fly.io machine restart without persistent volume).
81
+ 2. Disk full on the volume.
82
+ 3. WAL corruption from an unclean shutdown.
83
+
84
+ **Steps:**
85
+ 1. `railway run --service ashlr-plugin-api -- bash -c 'df -h'` → check disk space on the volume backing the sqlite db.
86
+ 2. Verify `ASHLR_DB_PATH` points to the mounted volume: `echo $ASHLR_DB_PATH`.
87
+ 3. If the file exists, try `sqlite3 $ASHLR_DB_PATH "PRAGMA integrity_check;"`.
88
+ 4. If corrupt: restore from the most recent backup. Backups should be scheduled via `fly volumes snapshots list`.
89
+ 5. If disk full: delete old WAL files or scale up the volume.
90
+
91
+ ### xAI Grok API Failure (502 on `/llm/summarize`)
92
+
93
+ **Symptoms:** LLM route returning 502. Sentry shows `Service temporarily unavailable` errors.
94
+
95
+ **Steps:**
96
+ 1. Check [status.x.ai](https://status.x.ai) for an active incident.
97
+ 2. Verify `XAI_API_KEY` is still valid: `railway variables --service ashlr-plugin-api --kv | grep XAI`.
98
+ 3. If key rotated, update: `railway variables --service ashlr-plugin-api --set XAI_API_KEY=xai-...`.
99
+ 4. Check if the error is transient — a retry after 60 seconds often resolves API blips.
100
+ 5. If the xAI outage is prolonged, consider returning a user-friendly degraded-mode message and disabling the LLM route via a feature flag.
101
+
102
+ ### Stripe Webhook Lag
103
+
104
+ **Symptoms:** Subscriptions not updating after payments. Billing status stale.
105
+
106
+ **Steps:**
107
+ 1. In Stripe Dashboard → Developers → Webhooks → select the endpoint → view recent deliveries.
108
+ 2. Look for failed deliveries (non-2xx responses from `/billing/webhook`).
109
+ 3. If the server was down, Stripe retries automatically for up to 3 days — re-deliveries will self-heal.
110
+ 4. If `STRIPE_WEBHOOK_SECRET` was rotated, update: `railway variables --service ashlr-plugin-api --set STRIPE_WEBHOOK_SECRET=whsec_...`.
111
+ 5. For persistent failures, check Sentry for errors in the webhook handler and review the server logs around the timestamp of failed deliveries.
112
+
113
+ ### Rate-Limit Flood
114
+
115
+ **Symptoms:** Spike in 429 responses. Possibly automated abuse of `/auth/send` or `/llm/summarize`.
116
+
117
+ **Steps:**
118
+ 1. Check logs for the offending IP or user ID pattern:
119
+ ```
120
+ railway logs --service ashlr-plugin-api | grep '"status":429' | head -50
121
+ ```
122
+ 2. `/auth/send` is rate-limited per email (5/hour). A flood suggests credential stuffing — no immediate action needed if email enumeration is not exposed (it isn't — the endpoint always returns `{ sent: true }`).
123
+ 3. `/llm/summarize` is rate-limited per API token (30/min). If a single user is flooding, you can revoke their token in the DB:
124
+ ```sql
125
+ DELETE FROM api_tokens WHERE user_id = '<uid>';
126
+ ```
127
+ 4. If a bot is probing unauthenticated endpoints, add their IP to a Fly.io firewall rule.
128
+
129
+ ### Sentry Error Spike
130
+
131
+ **Symptoms:** Sentry alert for high error volume.
132
+
133
+ **Steps:**
134
+ 1. Check the Sentry issue for the stack trace and `requestId`.
135
+ 2. Correlate `requestId` to server logs for full context.
136
+ 3. Check if the error is tied to a recent deploy: `fly releases`.
137
+ 4. If a bad deploy: `fly deploy --image <previous-image>` to roll back.
138
+
139
+ ---
140
+
141
+ ## Deployment Checklist
142
+
143
+ Before deploying to production:
144
+
145
+ - [ ] `cd server && bun test` passes
146
+ - [ ] `cd site && bun run build` passes
147
+ - [ ] All required env vars set in Railway (see "Required environment variables" below)
148
+ - [ ] `XAI_API_KEY` is valid
149
+ - [ ] Stripe webhook endpoint is registered and `STRIPE_WEBHOOK_SECRET` matches
150
+ - [ ] `/readyz` returns 200 after deploy
151
+
152
+ ---
153
+
154
+ ## Required environment variables
155
+
156
+ The server reads these via `process.env`. Set them in the Railway dashboard
157
+ (Project > ashlr-plugin-api > Variables) or via `railway variables --service
158
+ ashlr-plugin-api --set KEY=value`.
159
+
160
+ ### Core (required to boot)
161
+
162
+ | Variable | Purpose |
163
+ |----------|---------|
164
+ | `ASHLR_MASTER_KEY` | 32-byte base64 — encryption key for genome blob storage. Generate once: `openssl rand -base64 32`. **Rotating destroys access to all encrypted genomes.** |
165
+ | `NODE_ENV` | `production` |
166
+ | `FRONTEND_URL` | Magic-link redirect target. Default: `https://plugin.ashlr.ai` |
167
+
168
+ ### Auth (GitHub OAuth)
169
+
170
+ | Variable | Purpose |
171
+ |----------|---------|
172
+ | `GITHUB_CLIENT_ID` | OAuth app client ID (GitHub > Settings > Developer settings > OAuth Apps) |
173
+ | `GITHUB_CLIENT_SECRET` | OAuth app client secret |
174
+ | `GITHUB_WEBHOOK_SECRET` | (Optional) Shared secret if you wire up a GitHub webhook |
175
+
176
+ ### Email (magic-link sign-in)
177
+
178
+ | Variable | Purpose |
179
+ |----------|---------|
180
+ | `SENDGRID_API_KEY` | SendGrid API key, scope: "Sending access". Without it, magic-link tokens are printed to stderr (dev mode). |
181
+
182
+ ### Billing (Stripe)
183
+
184
+ | Variable | Purpose |
185
+ |----------|---------|
186
+ | `STRIPE_SECRET_KEY` | `sk_live_...` for prod, `sk_test_...` for staging |
187
+ | `STRIPE_WEBHOOK_SECRET` | `whsec_...` from the webhook endpoint registered at `/billing/webhook` |
188
+
189
+ ### LLM summarization
190
+
191
+ The hosted summarizer talks to xAI Grok (`grok-4.3`) via the
192
+ OpenAI-compatible endpoint at `https://api.x.ai/v1`. ~75% cheaper per
193
+ request than the prior Anthropic Haiku 4.5 path.
194
+
195
+ | Variable | Purpose |
196
+ |----------|---------|
197
+ | `XAI_API_KEY` | Powers `/llm/summarize`. Get one at https://console.x.ai/. Required for hosted summarization. |
198
+
199
+ ### URLs (used in email templates, redirects, marketing copy)
200
+
201
+ | Variable | Default | Purpose |
202
+ |----------|---------|---------|
203
+ | `SITE_URL` | `https://ashlr.ai` | Main marketing site |
204
+ | `BASE_URL` | `https://api.ashlr.ai` | This API server's base |
205
+ | `API_BASE_URL` | mirror of `BASE_URL` | Alias used in some email links |
206
+ | `PLUGIN_BASE_URL` | `https://plugin.ashlr.ai` | Plugin landing page |
207
+ | `DOCS_BASE_URL` | `https://plugin.ashlr.ai/docs` | Docs link in emails |
208
+ | `STATUS_BASE_URL` | `https://status.ashlr.ai` | Status page link |
209
+
210
+ ### Observability (optional but recommended)
211
+
212
+ | Variable | Purpose |
213
+ |----------|---------|
214
+ | `SENTRY_DSN` | Error tracking |
215
+ | `SENTRY_ORG`, `SENTRY_PROJECT`, `SENTRY_INTERNAL_TOKEN` | Source-map upload during build |
216
+ | `LOG_LEVEL` | `info` (default) / `debug` / `warn` |
217
+
218
+ ### Admin metrics endpoint (optional)
219
+
220
+ | Variable | Purpose |
221
+ |----------|---------|
222
+ | `METRICS_USER`, `METRICS_PASS` | Basic-auth on `/metrics` |
223
+ | `METRICS_ALLOWED_IPS` | Comma-separated allowlist |
224
+
225
+ ### Auto-provided by Railway (don't set)
226
+
227
+ - `PORT` — Railway injects this. The server respects it via `process.env.PORT`.
228
+
229
+ ### Behavior toggles (rare)
230
+
231
+ | Variable | Purpose |
232
+ |----------|---------|
233
+ | `ASHLR_DB_PATH` | Override default sqlite path. Leave unset in prod. |
234
+ | `ASHLR_DISABLE_TRIAL` | `1` to disable the 7-day Pro trial |
235
+ | `LLM_COST_CAP_USD` | Per-user monthly cost cap on `/llm/summarize`. Default: `5`. |
236
+ | `ASHLR_PREFETCH` | `off` disables the Predictive Prefetch MVP (Q3 supporting pillar — fire-and-forget background import-graph pre-cache). Free tier is a no-op anyway; Pro caps at 3 neighbours, Team at 10. Hard 1.5s wallclock cap on the background task. |
237
+
238
+ ---
239
+
240
+ ## Useful Commands
241
+
242
+ ```bash
243
+ # Tail live logs
244
+ railway logs --service ashlr-plugin-api
245
+
246
+ # Open a shell in the running container (Railway "Run" tab or CLI)
247
+ railway run --service ashlr-plugin-api -- bash
248
+
249
+ # List variables (names only, not values)
250
+ railway variables --service ashlr-plugin-api --kv
251
+
252
+ # View recent deploys
253
+ railway status --service ashlr-plugin-api
254
+
255
+ # Adjust resources (CPU / memory) via the dashboard:
256
+ # Project > ashlr-plugin-api > Settings > Resources
257
+
258
+ # Prometheus scrape (local test)
259
+ curl -u prometheus:secret https://api.ashlr.ai/metrics
260
+ ```
261
+
262
+
263
+ ---
264
+
265
+ # v1.32 Northstar Surfaces — On-Call Cheat Sheet
266
+
267
+ > *Audience: founder + on-call. Goal: find the right env var, endpoint, log, or dashboard in <30s at 2am.*
268
+
269
+ ## 1. Production topology
270
+
271
+ ```
272
+ +-------------------------------+
273
+ | GitHub (registry source) |
274
+ | branch: main |
275
+ +---------------+---------------+
276
+ |
277
+ +-----------------------+-----------------------+
278
+ | | |
279
+ v v v
280
+ +----------------+ +------------------+ +-------------------+
281
+ | Plugin | | Site (site/) | | Server (server/) |
282
+ | (Claude Code | | Vercel — auto | | Railway — |
283
+ | plugin via | | deploy on push | | deploy via GH |
284
+ | main registry)| | to main | | Actions workflow |
285
+ +----------------+ +------------------+ +---------+---------+
286
+ |
287
+ v
288
+ +-------------------+
289
+ | bun:sqlite |
290
+ | (Railway volume) |
291
+ | ASHLR_DB_PATH |
292
+ +-------------------+
293
+ ```
294
+
295
+ - **Plugin:** distributed as a Codex and Claude Code plugin; the public registry resolves from `main`.
296
+ - **Site:** `site/` auto-deploys to Vercel on every push to `main` (deploy-site.yml).
297
+ - **Server:** `server/` deploys to Railway via `.github/workflows/deploy-server.yml` on push to `main`.
298
+ - **DB:** `bun:sqlite` inside the Railway container, file at `$ASHLR_DB_PATH` on a persistent volume.
299
+
300
+ ### Running outside Claude Code
301
+
302
+ The ashlr MCP tools run anywhere MCP is supported. Set `ASHLR_MCP_HOST` to tell the plugin which host it's running in so it can adapt behaviors that differ between hosts:
303
+
304
+ | `ASHLR_MCP_HOST` value | Host |
305
+ |------------------------|------|
306
+ | `claude-code` (default when unset) | Anthropic Claude Code CLI |
307
+ | `cline` | Cline (VS Code extension) |
308
+ | `claude-desktop` | Claude Desktop app |
309
+ | `codex-cli` | OpenAI Codex CLI |
310
+ | `generic` | Any other MCP-capable host |
311
+
312
+ Per-host setup snippets (config file paths, transport, env wiring) live in [`docs/multi-host-mcp.md`](./multi-host-mcp.md).
313
+
314
+ **Host-specific features:** Claude Code owns redirect-mode hooks, the status line, milestone celebrations, slash commands (`/ashlr-*`), and OAuth bootstrap. Codex owns `hooks/codex-hooks.json`, Codex skills, and nudge-first `additionalContext` hooks. MCP tools (`ashlr__grep`, `ashlr__bash`, `ashlr__read`, etc.) work everywhere.
315
+
316
+ ---
317
+
318
+ ## 2. Secrets cheat sheet
319
+
320
+ | Var | Lives in | Read by | Generate | Blast radius if missing/wrong |
321
+ |-----|----------|---------|----------|-------------------------------|
322
+ | `ASHLR_MASTER_KEY` | Railway env | `server/` — genome blob crypto | `openssl rand -base64 32` (one-time, never rotate) | All encrypted genomes unreadable; team-cloud genome puller returns garbage. |
323
+ | `ASHLR_ADMIN_TRIGGER_TOKEN` | Railway env + GH Actions secret | `server/` admin-write routes (`/admin/jobs/*`) + daily-wad-d-aggregate cron | `openssl rand -hex 32`; set on Railway and as GH secret with identical value | Daily WAD-D cron 503s; discovery-propagation aggregate never runs. |
324
+ | `ASHLR_ADMIN_READ_TOKEN` | Vercel env (site) + Railway env (server) | `site/` admin pages → server admin-read routes (`/admin/wad-d-snapshots`, `/admin/sessions`, `/admin/discoveries/propagation`) | `openssl rand -hex 32`; set on **both** Vercel and Railway with identical value | All founder dashboards 404/401. |
325
+ | `ASHLR_API_BASE_URL` | Vercel env (site) | `site/` server components → server | `https://api.ashlr.ai` | Site → server calls fail; admin UI dead. |
326
+ | `ASHLR_ADMIN_URL` | GH Actions secret | `daily-wad-d-aggregate.yml`, `weekly-digest.yml` | `https://api.ashlr.ai` | Cron exits early; alarm fires on next morning's no-snapshot check. |
327
+ | `ANTHROPIC_API_KEY` | Railway env (optional) | `server/src/routes/llm.ts` fallback path | Anthropic console | Hosted summarizer falls back to xAI only; no immediate user impact. |
328
+ | `XAI_API_KEY` | Railway env | `server/` `/llm/summarize` primary path | https://console.x.ai/ | `/llm/summarize` 502s; plugin summarizers fall back to local. |
329
+ | `STRIPE_SECRET_KEY` | Railway env | `server/src/routes/billing.ts` | `sk_live_...` / `sk_test_...` | Checkout 500s; trials cannot start. |
330
+ | `STRIPE_WEBHOOK_SECRET` | Railway env | `/billing/webhook` HMAC verify | `whsec_...` from Stripe dashboard | Webhooks rejected; subs out of sync (Stripe auto-retries 3d — usually self-heals). |
331
+ | `STRIPE_PRICE_PRO` / `STRIPE_PRICE_TEAM` | Railway env | Checkout session creation (PR #68) | Stripe price IDs | Upgrade flow stuck on "loading"; checkout never starts. |
332
+ | `RAILWAY_TOKEN` | GH Actions secret | `deploy-server.yml` | Railway dashboard → Account → Tokens (project-scoped) | Server deploys fail with "Invalid RAILWAY_TOKEN". |
333
+ | `RAILWAY_PROJECT_ID` | Hardcoded in workflow | `deploy-server.yml` | `cc997995-c95d-4f1b-9d43-86cd41aa1d66` | Deploys to wrong project. |
334
+ | `RAILWAY_SERVICE_ID` | Hardcoded in workflow | `deploy-server.yml` | `82d8e992-81d5-4a30-88bf-8e90fbd3f044` | Deploys to wrong service. |
335
+
336
+ > **Secret rotation drill:** when rotating `ASHLR_ADMIN_TRIGGER_TOKEN` or `ASHLR_ADMIN_READ_TOKEN`, update **both** sides (Railway *and* the consumer — GH Actions or Vercel) within the same window or the next cron run / dashboard hit will 503/401.
337
+
338
+ ---
339
+
340
+ ## 3. New endpoints reference (PRs #67-83)
341
+
342
+ | Method | Path | Auth | Source | What it does |
343
+ |--------|------|------|--------|--------------|
344
+ | POST | `/stats/daily-active` | anonymous; identity-hash payload | PR #67 — `routes/daily-active.ts` | DAU counter; plugin emits one hashed ping per day. |
345
+ | POST | `/v1/session-events` | anonymous; session-id-hash payload | PR #79 — `routes/session-events.ts` | SessionEnd capture for session-graph (replay UI feeder). |
346
+ | POST | `/v1/events` | anonymous | existing — `routes/telemetry.ts` | Generic opt-in telemetry. |
347
+ | POST | `/webhooks/github` | GitHub HMAC | existing — extended by PR #75 | Now also writes genome cloud-deltas. |
348
+ | POST | `/admin/jobs/daily-wad-d-aggregate` | `Bearer $ASHLR_ADMIN_TRIGGER_TOKEN` | PR #73 — `routes/admin-jobs.ts` | Cron-invoked WAD-D snapshot aggregator; PR #83 chains discovery-propagation aggregate after. |
349
+ | GET | `/admin/wad-d-snapshots` | `Bearer $ASHLR_ADMIN_READ_TOKEN` | PR #74 — `routes/admin-wad-d.ts` | Dashboard read: WAD-D snapshot history + sparkline data (PR #81 added date-range filter). |
350
+ | GET | `/admin/wad-d-breakdown` | `Bearer $ASHLR_ADMIN_READ_TOKEN` | PR #78 — `routes/admin-wad-d-breakdown.ts` | Segment breakdown across the 6 WAD-D indicators. |
351
+ | GET | `/admin/sessions` | `Bearer $ASHLR_ADMIN_READ_TOKEN` | PR #82 — `routes/admin-sessions.ts` | Session replay index. |
352
+ | GET | `/admin/sessions/:session_id_hash` | `Bearer $ASHLR_ADMIN_READ_TOKEN` | PR #82 — `routes/admin-sessions.ts` | Single-session replay payload. |
353
+ | GET | `/admin/discoveries/propagation` | `Bearer $ASHLR_ADMIN_READ_TOKEN` | PR #83 — `routes/admin-discovery-propagation.ts` | Cross-session discovery propagation read. |
354
+ | GET | `/genome/cloud-deltas` | API token (Pro/Team gated) | PR #75 — `routes/genome-cloud-deltas.ts` | Pro/Team puller for team-cloud genome deltas. |
355
+
356
+ > Admin endpoints return **404 (not 401)** for missing/bad bearer to avoid leaking the surface — keep that in mind when debugging.
357
+
358
+ ---
359
+
360
+ ## 4. Cron + scheduled jobs
361
+
362
+ | Workflow | Cadence (UTC) | Calls | Notes |
363
+ |----------|---------------|-------|-------|
364
+ | `.github/workflows/daily-wad-d-aggregate.yml` | `0 2 * * *` (02:00 daily) | `POST $ASHLR_ADMIN_URL/admin/jobs/daily-wad-d-aggregate` with bearer | Computes WAD-D snapshot. Per PR #83, the aggregator now also runs the **discovery-propagation aggregate** as a chained step after the WAD-D snapshot completes. Fails fast on missing secrets (validates `ASHLR_ADMIN_URL` + `ASHLR_ADMIN_TRIGGER_TOKEN` first). |
365
+ | `.github/workflows/weekly-digest.yml` | `0 14 * * 0` (Sun 14:00) | Local digest job — reads server DB via Railway-shared `ASHLR_MASTER_KEY` | Sends the weekly digest email to all opted-in users. `dry_run` input available for manual runs. |
366
+
367
+ **Re-running a failed cron:** `gh workflow run "Daily WAD-D aggregate"` from the repo root (or the Actions tab → workflow → "Run workflow"). The aggregator is idempotent — same day re-runs overwrite the snapshot.
368
+
369
+ ---
370
+
371
+ ## 5. Logs + telemetry locations
372
+
373
+ ### Server (Railway)
374
+ - **Logs:** structured JSON on stdout. `railway logs --service ashlr-plugin-api`.
375
+ - **Key events to grep for:**
376
+ - `cron_start`, `cron_end` — daily WAD-D + discovery-propagation aggregator lifecycle.
377
+ - `crash_report` — plugin crash dumps uploaded via `/v1/events`.
378
+ - `"status":429` — rate-limit hits.
379
+ - `"status":5` — server errors.
380
+ - **DB:** `$ASHLR_DB_PATH` on the persistent volume. Snapshot via `fly volumes snapshots list` (volume backups configured at the Railway level).
381
+
382
+ ### Plugin (local, per-user)
383
+ - `~/.ashlr/hook-errors.jsonl` — every hook crash (one line per event).
384
+ - `~/.ashlr/hook-timings.jsonl` — per-hook latency (consumed by `/ashlr-hook-timings`).
385
+ - `~/.ashlr/stats.json` — running token-savings counter (consumed by `/ashlr-savings` and `/ashlr-dashboard`).
386
+ - `~/.ashlr/config.json` — `ASHLR_HOOK_MODE` and other per-user toggles.
387
+
388
+ ### Genome (per project)
389
+ - `.ashlrcode/genome/manifest.json` — local genome manifest.
390
+ - `.ashlrcode/genome/knowledge/*.md` — local discoveries + architecture notes.
391
+ - Team-cloud copy at server-side (encrypted with `ASHLR_MASTER_KEY`); pulled via `/genome/cloud-deltas`.
392
+
393
+ ### First-call projection
394
+
395
+ On the first successful MCP tool call after the wizard, the plugin emits a one-shot celebration with a savings projection ("at this rate ≈ $X/year"). It only fires once per machine — a flag at `~/.ashlr/milestones.json` (key: `first_call_celebrated`) gates the trigger so subsequent calls run silently.
396
+
397
+ **Dev test:** `rm ~/.ashlr/milestones.json`, then run any ashlr MCP tool (e.g. `ashlr__read` on a file) — the celebration should fire exactly once and the flag should be re-written.
398
+
399
+ ---
400
+
401
+ ## 6. Common-fire troubleshooting
402
+
403
+ ### A. "Railway deploy failed"
404
+ - **Diagnose:** `gh run list --workflow="Deploy server to Railway" --limit 5`; then `gh run view <id> --log-failed`.
405
+ - **Common cause:** Stripe block from PR #69 — boot-time guard that aborts if `STRIPE_PRICE_PRO` / `STRIPE_PRICE_TEAM` are unset in prod. Check `Run tests` job for the assertion message.
406
+ - **Fix:** `railway variables --service ashlr-plugin-api --set STRIPE_PRICE_PRO=price_...` then re-run the workflow.
407
+
408
+ ### B. "Daily WAD-D cron failed"
409
+ - **Diagnose:** `gh run list --workflow="Daily WAD-D aggregate" --limit 5` → `gh run view <id> --log-failed`.
410
+ - **Common causes:** (1) missing `ASHLR_ADMIN_URL` / `ASHLR_ADMIN_TRIGGER_TOKEN` GH secrets — workflow logs "secret is not configured"; (2) Railway server down — curl returns connection error; (3) token drift between GH and Railway — server returns 401/404.
411
+ - **Fix:** check `Validate required secrets` step output first. If tokens drifted, rotate both ends together.
412
+
413
+ ### C. "/admin/wad-d-* returns 404"
414
+ - **Diagnose:** `curl -i -H "Authorization: Bearer $TOKEN" https://api.ashlr.ai/admin/wad-d-snapshots`. If the site UI is the caller, check Vercel env in dashboard → Settings → Environment Variables.
415
+ - **Common cause:** missing/wrong `ASHLR_ADMIN_READ_TOKEN` on Vercel. Admin routes deliberately 404 on bad bearer (not 401) so this masquerades as a missing route.
416
+ - **Fix:** set `ASHLR_ADMIN_READ_TOKEN` on Vercel to match Railway's; redeploy site (Vercel → Redeploy without cache).
417
+
418
+ ### D. "/admin/jobs/* returns 503 (or cron job 503s)"
419
+ - **Diagnose:** Railway logs grep for `admin_jobs.unauthorized` or `cron_start` absence. `railway variables --service ashlr-plugin-api --kv | grep ASHLR_ADMIN_TRIGGER`.
420
+ - **Common cause:** missing/wrong `ASHLR_ADMIN_TRIGGER_TOKEN` on Railway, or the server hasn't picked up the new value after a rotation.
421
+ - **Fix:** `railway variables --service ashlr-plugin-api --set ASHLR_ADMIN_TRIGGER_TOKEN=...` then `railway redeploy --service ashlr-plugin-api`.
422
+
423
+ ### E. "Plugin hook timing out"
424
+ - **Diagnose:** in the affected user's shell: `/ashlr-doctor` (look at the hook-perf surface) and `tail -50 ~/.ashlr/hook-errors.jsonl`. Per-hook p50/p95/max via `/ashlr-hook-timings`.
425
+ - **Common causes:** (1) `ASHLR_HOOK_MODE=redirect` on a host where MCP tools aren't loaded — switch to `nudge`; (2) MCP server crash — `/ashlr-status`; (3) genome retrieval hung — set `ASHLR_GENOME_RETRIEVAL=off` as the kill-switch (v1.30 shipped this).
426
+ - **Fix:** `~/.ashlr/config.json` → `{"ASHLR_HOOK_MODE":"nudge"}`; restart Claude Code session.
427
+
428
+ ### F. "I ran the wizard but the plugin doesn't seem to work"
429
+ - **Symptom:** user completes `/ashlr-start` but tool calls still route through native Read/Grep/Bash instead of `ashlr__*`, and `/ashlr-status` reports MCP servers as not-loaded.
430
+ - **Diagnose:** `cat ~/.ashlr/restart-required` — if the file exists with a recent `writtenAt` AND the same `pid` as the current Claude Code process, the user skipped the post-wizard restart (the MCP server registration only takes effect on a fresh session).
431
+ - **Fix:** `/quit` Claude Code, fully reopen the terminal / app, then run any tool — it should route through ashlr. The wizard removes the marker file on the next successful start.
432
+
433
+ ---
434
+
435
+ ## 7. Tier gates summary
436
+
437
+ | Feature | Free | Pro | Team |
438
+ |---------|------|-----|------|
439
+ | Cloud sync (`/genome/cloud-deltas`) | off | on | on (shared team genome) |
440
+ | AI synthesis (hosted `/llm/summarize`) | off (local-only) | on (`LLM_COST_CAP_USD` default $5) | on (shared cap) |
441
+ | Predictive prefetch (`ASHLR_PREFETCH`) | no-op | 3 neighbours | 10 neighbours |
442
+ | Distributed orchestration (planned) | — | — | on (post-v1.32) |
443
+ | Session replay UI consumer | n/a (founder-only) | n/a | n/a |
444
+
445
+ ---
446
+
447
+ ## 8. Pre-existing test failures (don't chase these at 2am)
448
+
449
+ These failures exist on `main` already — they are **not** caused by the v1.32 changes:
450
+
451
+ - `server/tests/wadd-lead-indicators.test.ts:155` — server `tsc` type error; pre-existing on `main`.
452
+ - `site/app/source.ts:1` — site `tsc` error; pre-existing on `main`.
453
+ - `tests/ast-chunker.test.ts` — 40 tree-sitter timeouts in the ast-refactor suite; pre-existing flakes, not regressions.
454
+
455
+ If a PR check goes red on **only** these, the change is safe — verify the rest of the suite is green and merge.
456
+
457
+ ---
458
+
459
+ ## 9. Performance characteristics
460
+
461
+ The Q1'27 distributed orchestrator (`scripts/orchestrate-run.ts`) has a measurable per-node overhead — captured by `scripts/bench-orchestrate.ts`, a stub-mode benchmark that exercises 5 synthetic graph shapes (chain-3, chain-10, wide-3, wide-10, diamond).
462
+
463
+ What the bench measures:
464
+ - **Stub-mode orchestrator overhead is bounded** — typically ~5–30ms per node. This is the floor for any orchestration run; it covers `Bun.spawn` + per-node IPC + the scheduler's ready-queue management. The smoke test in `__tests__/bench-orchestrate.smoke.test.ts` asserts `per_node_ms_median < 100ms` for every shape as a regression guard.
465
+ - **Real-LLM mode is dominated by the LLM call** — set `ASHLR_ORCHESTRATE_REAL_LLM=1` to dispatch through `servers/_orchestrate-executor.ts`. Each subagent call is typically 1–5 seconds, so orchestrator overhead becomes noise (<1% of total wallclock).
466
+ - **Parallel speedup approaches the theoretical N/maxConcurrency ratio for wide DAGs** — wide-3 under the Pro cap (3 concurrent agents) collapses 3 sequential per-node-ms units into one wave, yielding ~3× speedup vs chain-3. wide-10 under the Team cap (10 agents) collapses 9 leaves into one wave after the root.
467
+
468
+ Re-run the bench locally:
469
+
470
+ ```
471
+ bun scripts/bench-orchestrate.ts # 20 iterations, formatted table
472
+ bun scripts/bench-orchestrate.ts --iterations 5 # quick smoke
473
+ bun scripts/bench-orchestrate.ts --json # machine-readable for diffing
474
+ ```
475
+
476
+ The bench refuses to run with `ASHLR_ORCHESTRATE_REAL_LLM=1` set — it's stub-only by contract so it stays free, fast, and deterministic.
477
+
478
+ ---
479
+
480
+ ## 10. References (local plan docs)
481
+
482
+ All under `~/.claude/plans/` on the founder's workstation (not committed to the repo):
483
+
484
+ - `integration-architecture-north-star.md` — v1.32 northstar spec.
485
+ - `genome-2-0-architecture.md` — Genome 2.0 architecture.
486
+ - `wad-d-instrumentation-genome-2-sequencing.md` — WAD-D + Genome 2.0 sequencing.
487
+ - `distributed-orchestration-design.md` — Distributed orchestration design (planned for post-v1.32).
488
+
489
+ In-repo:
490
+ - `.github/workflows/deploy-server.yml` — Railway deploy pipeline.
491
+ - `.github/workflows/daily-wad-d-aggregate.yml` — daily aggregator cron.
492
+ - `.github/workflows/weekly-digest.yml` — weekly digest cron.
493
+ - `server/src/routes/admin-*.ts` — admin read/write routes.
494
+ - `server/src/jobs/daily-wad-d-aggregate.ts`, `discovery-propagation-aggregate.ts` — aggregator job bodies.
@@ -0,0 +1,133 @@
1
+ # Platform Support
2
+
3
+ ashlr-plugin is tested on Linux, macOS, and Windows in CI on every push via a matrix strategy.
4
+
5
+ ---
6
+
7
+ ## CI Matrix
8
+
9
+ | Job | Ubuntu 22.04 | macOS 14 | Windows Server 2022 |
10
+ |---|---|---|---|
11
+ | `typecheck` | yes | yes | yes |
12
+ | `test` | yes | yes | yes |
13
+ | `smoke` (realtime) | yes | yes | yes |
14
+ | `smoke` (cross-platform) | yes | yes | yes |
15
+ | `benchmark-check` | yes | — | — |
16
+ | `integration` | yes | — | — |
17
+
18
+ `benchmark-check` and `integration` run Linux-only. Benchmarks are not OS-sensitive; integration tests spawn the backend server which is deployed on Linux.
19
+
20
+ ---
21
+
22
+ ## ripgrep Installation
23
+
24
+ ripgrep must be on `PATH`. Install guidance per platform:
25
+
26
+ | Platform | Recommended command |
27
+ |---|---|
28
+ | Linux (Debian/Ubuntu) | `sudo apt-get install -y ripgrep` |
29
+ | macOS | `brew install ripgrep` |
30
+ | Windows | `winget install BurntSushi.ripgrep.MSVC` or `choco install ripgrep` |
31
+
32
+ The CI workflow installs ripgrep automatically in each matrix leg.
33
+
34
+ ---
35
+
36
+ ## Known Limitations by Platform
37
+
38
+ ### Windows
39
+
40
+ | Feature | Status | Notes |
41
+ |---|---|---|
42
+ | `ashlr__read` | Full | Path separator handled via `path.join`; URL pathname stripping for `file://` on Windows |
43
+ | `ashlr__grep` | Full | ripgrep binary must be installed separately (see above) |
44
+ | `ashlr__edit` | Full | No known issues |
45
+ | `ashlr__savings` | Full | No known issues |
46
+ | `ashlr-bash` server | Partial | Spawns `sh -c`; requires Git for Windows or WSL in `PATH`. Tests that call `sh` directly are skipped on Windows in CI. |
47
+ | File permissions (chmod) | N/A | Windows does not honour POSIX mode bits. Three tests are explicitly skipped — see below. |
48
+ | Genome init | Full | No known issues |
49
+ | VS Code extension | Full | `.vsix` packaged and attached to release |
50
+
51
+ #### Tests skipped on Windows
52
+
53
+ These tests are marked `test.skipIf(process.platform === "win32")` with an explanatory comment:
54
+
55
+ | File | Test name | Reason |
56
+ |---|---|---|
57
+ | `__tests__/genome-crypto.test.ts` | `key file is written with mode 0600` | `stat.mode & 0o077` is meaningless on Windows — the OS does not set POSIX permission bits |
58
+ | `__tests__/genome-init.test.ts` | `handles unreadable dir (graceful fallback to empty graph)` | `chmodSync(dir, 0o000)` does not make the directory unreadable on Windows; the test would give a false pass |
59
+ | `__tests__/doctor.test.ts` | `non-executable hooks produce warnings with chmod fix` | Windows has no execute bit concept; `chmod 0o644` is a no-op and the `chmod +x` fix suggestion is irrelevant |
60
+
61
+ These skips are explicit — the test runner reports them as `skipped`, not silently passing.
62
+
63
+ #### Protecting `~/.ashlr/team-keys/` on Windows
64
+
65
+ `saveKey` in `servers/_genome-crypto.ts` calls `writeFile(..., { mode: 0o600 })` and `chmod(p, 0o600)`. Both are silent no-ops on NTFS — the file inherits whatever ACLs the parent directory had. Under the user profile (`%USERPROFILE%\.ashlr\team-keys\`) the default ACLs typically resolve to user + Administrators + SYSTEM, but that is not guaranteed on roaming profiles, domain-joined machines, or directories the user created manually. ashlr prints a per-file warning every time a team key is written so you can't miss it.
66
+
67
+ Recommended mitigations (in order of strength):
68
+
69
+ - **BitLocker** — encrypts the whole drive, including `~/.ashlr/`. Enable via Settings → Privacy & security → Device encryption, or `manage-bde -on C:` from an elevated prompt.
70
+ - **Windows EFS** — per-file encryption bound to the user account: `cipher /e /s:%USERPROFILE%\.ashlr\team-keys`. Survives disk-level theft; does not protect against an attacker who gains the user's login credentials.
71
+ - **Tight ACLs** — explicitly restrict to the current user: `icacls "%USERPROFILE%\.ashlr\team-keys" /inheritance:r /grant:r "%USERNAME%:(OI)(CI)F"`. Verify with `icacls "%USERPROFILE%\.ashlr\team-keys"`.
72
+
73
+ POSIX systems (Linux, macOS) honour the `chmod 0600` directly and don't need any of the above.
74
+
75
+ ### macOS
76
+
77
+ | Feature | Status | Notes |
78
+ |---|---|---|
79
+ | All tools | Full | No known issues |
80
+ | File permissions | Full | POSIX mode bits work as expected |
81
+ | `ashlr-bash` server | Full | `sh` and `bash` available by default |
82
+ | Genome | Full | No known issues |
83
+
84
+ ### Linux
85
+
86
+ | Feature | Status | Notes |
87
+ |---|---|---|
88
+ | All tools | Full | Reference platform |
89
+ | Integration tests | Full | Only platform where `integration` job runs |
90
+ | File permissions | Full | POSIX mode bits work as expected |
91
+
92
+ ---
93
+
94
+ ## Line Endings
95
+
96
+ The CI checkout step sets `core.autocrlf false` on all matrix legs:
97
+
98
+ ```yaml
99
+ - name: Disable CRLF auto-conversion (Windows)
100
+ if: runner.os == 'Windows'
101
+ shell: bash
102
+ run: git config --global core.autocrlf false
103
+ ```
104
+
105
+ This prevents git from silently converting LF to CRLF on Windows, which would break hash-based cache keys and text-comparison assertions in tests.
106
+
107
+ Source files in this repository use LF line endings exclusively (enforced by `.gitattributes` if present).
108
+
109
+ ---
110
+
111
+ ## Cache Keys
112
+
113
+ Node module caches are keyed by `runner.os` to prevent cross-platform cache poisoning:
114
+
115
+ ```yaml
116
+ key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
117
+ ```
118
+
119
+ Without the `runner.os` prefix, a Linux-built `node_modules` cache could be restored on Windows, causing native module mismatches.
120
+
121
+ ---
122
+
123
+ ## Expected CI Wall Times
124
+
125
+ Approximate worst-case times per OS based on job structure:
126
+
127
+ | OS | `typecheck` | `test` | `smoke` | Total |
128
+ |---|---|---|---|---|
129
+ | Ubuntu | ~1 min | ~3 min | ~1 min | ~5 min |
130
+ | macOS | ~2 min | ~4 min | ~2 min | ~8 min |
131
+ | Windows | ~3 min | ~6 min | ~3 min | ~12 min |
132
+
133
+ Windows is slowest due to ripgrep install via winget/choco and generally slower I/O on GitHub-hosted runners. All jobs target under 15 minutes.