@hera-al/server 1.6.1

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 (348) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +325 -0
  3. package/bundled/apple-notes/SKILL.md +77 -0
  4. package/bundled/apple-reminders/SKILL.md +96 -0
  5. package/bundled/blogwatcher/SKILL.md +69 -0
  6. package/bundled/camsnap/SKILL.md +45 -0
  7. package/bundled/discord/SKILL.md +578 -0
  8. package/bundled/gemini/SKILL.md +43 -0
  9. package/bundled/gifgrep/SKILL.md +79 -0
  10. package/bundled/github/SKILL.md +77 -0
  11. package/bundled/gog/SKILL.md +116 -0
  12. package/bundled/goplaces/SKILL.md +52 -0
  13. package/bundled/himalaya/SKILL.md +257 -0
  14. package/bundled/himalaya/references/configuration.md +184 -0
  15. package/bundled/himalaya/references/message-composition.md +199 -0
  16. package/bundled/homebrew/SKILL.md +82 -0
  17. package/bundled/local-places/SERVER_README.md +101 -0
  18. package/bundled/local-places/SKILL.md +102 -0
  19. package/bundled/local-places/pyproject.toml +21 -0
  20. package/bundled/local-places/src/local_places/__init__.py +2 -0
  21. package/bundled/local-places/src/local_places/google_places.py +314 -0
  22. package/bundled/local-places/src/local_places/main.py +65 -0
  23. package/bundled/local-places/src/local_places/schemas.py +107 -0
  24. package/bundled/markitdown/SKILL.md +96 -0
  25. package/bundled/mcporter/SKILL.md +61 -0
  26. package/bundled/merge-pr/SKILL.md +187 -0
  27. package/bundled/merge-pr/agents/openai.yaml +4 -0
  28. package/bundled/nano-banana-pro/SKILL.md +58 -0
  29. package/bundled/nano-banana-pro/scripts/generate_image.py +184 -0
  30. package/bundled/nano-pdf/SKILL.md +38 -0
  31. package/bundled/open-prose/README.md +25 -0
  32. package/bundled/open-prose/index.ts +5 -0
  33. package/bundled/open-prose/openclaw.plugin.json +11 -0
  34. package/bundled/open-prose/package.json +15 -0
  35. package/bundled/open-prose/skills/prose/LICENSE +21 -0
  36. package/bundled/open-prose/skills/prose/SKILL.md +323 -0
  37. package/bundled/open-prose/skills/prose/alt-borges.md +141 -0
  38. package/bundled/open-prose/skills/prose/alts/arabian-nights.md +358 -0
  39. package/bundled/open-prose/skills/prose/alts/borges.md +360 -0
  40. package/bundled/open-prose/skills/prose/alts/folk.md +322 -0
  41. package/bundled/open-prose/skills/prose/alts/homer.md +346 -0
  42. package/bundled/open-prose/skills/prose/alts/kafka.md +373 -0
  43. package/bundled/open-prose/skills/prose/compiler.md +2971 -0
  44. package/bundled/open-prose/skills/prose/examples/01-hello-world.prose +4 -0
  45. package/bundled/open-prose/skills/prose/examples/02-research-and-summarize.prose +6 -0
  46. package/bundled/open-prose/skills/prose/examples/03-code-review.prose +17 -0
  47. package/bundled/open-prose/skills/prose/examples/04-write-and-refine.prose +14 -0
  48. package/bundled/open-prose/skills/prose/examples/05-debug-issue.prose +20 -0
  49. package/bundled/open-prose/skills/prose/examples/06-explain-codebase.prose +17 -0
  50. package/bundled/open-prose/skills/prose/examples/07-refactor.prose +20 -0
  51. package/bundled/open-prose/skills/prose/examples/08-blog-post.prose +20 -0
  52. package/bundled/open-prose/skills/prose/examples/09-research-with-agents.prose +25 -0
  53. package/bundled/open-prose/skills/prose/examples/10-code-review-agents.prose +32 -0
  54. package/bundled/open-prose/skills/prose/examples/11-skills-and-imports.prose +27 -0
  55. package/bundled/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +43 -0
  56. package/bundled/open-prose/skills/prose/examples/13-variables-and-context.prose +51 -0
  57. package/bundled/open-prose/skills/prose/examples/14-composition-blocks.prose +48 -0
  58. package/bundled/open-prose/skills/prose/examples/15-inline-sequences.prose +23 -0
  59. package/bundled/open-prose/skills/prose/examples/16-parallel-reviews.prose +19 -0
  60. package/bundled/open-prose/skills/prose/examples/17-parallel-research.prose +19 -0
  61. package/bundled/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +36 -0
  62. package/bundled/open-prose/skills/prose/examples/19-advanced-parallel.prose +71 -0
  63. package/bundled/open-prose/skills/prose/examples/20-fixed-loops.prose +20 -0
  64. package/bundled/open-prose/skills/prose/examples/21-pipeline-operations.prose +35 -0
  65. package/bundled/open-prose/skills/prose/examples/22-error-handling.prose +51 -0
  66. package/bundled/open-prose/skills/prose/examples/23-retry-with-backoff.prose +63 -0
  67. package/bundled/open-prose/skills/prose/examples/24-choice-blocks.prose +86 -0
  68. package/bundled/open-prose/skills/prose/examples/25-conditionals.prose +114 -0
  69. package/bundled/open-prose/skills/prose/examples/26-parameterized-blocks.prose +100 -0
  70. package/bundled/open-prose/skills/prose/examples/27-string-interpolation.prose +105 -0
  71. package/bundled/open-prose/skills/prose/examples/28-automated-pr-review.prose +37 -0
  72. package/bundled/open-prose/skills/prose/examples/28-gas-town.prose +1572 -0
  73. package/bundled/open-prose/skills/prose/examples/29-captains-chair.prose +218 -0
  74. package/bundled/open-prose/skills/prose/examples/30-captains-chair-simple.prose +42 -0
  75. package/bundled/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +145 -0
  76. package/bundled/open-prose/skills/prose/examples/33-pr-review-autofix.prose +168 -0
  77. package/bundled/open-prose/skills/prose/examples/34-content-pipeline.prose +204 -0
  78. package/bundled/open-prose/skills/prose/examples/35-feature-factory.prose +296 -0
  79. package/bundled/open-prose/skills/prose/examples/36-bug-hunter.prose +237 -0
  80. package/bundled/open-prose/skills/prose/examples/37-the-forge.prose +1474 -0
  81. package/bundled/open-prose/skills/prose/examples/38-skill-scan.prose +455 -0
  82. package/bundled/open-prose/skills/prose/examples/39-architect-by-simulation.prose +277 -0
  83. package/bundled/open-prose/skills/prose/examples/40-rlm-self-refine.prose +32 -0
  84. package/bundled/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +38 -0
  85. package/bundled/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +46 -0
  86. package/bundled/open-prose/skills/prose/examples/43-rlm-pairwise.prose +50 -0
  87. package/bundled/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +261 -0
  88. package/bundled/open-prose/skills/prose/examples/45-plugin-release.prose +159 -0
  89. package/bundled/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +637 -0
  90. package/bundled/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +148 -0
  91. package/bundled/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +225 -0
  92. package/bundled/open-prose/skills/prose/examples/47-language-self-improvement.prose +356 -0
  93. package/bundled/open-prose/skills/prose/examples/48-habit-miner.prose +445 -0
  94. package/bundled/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +210 -0
  95. package/bundled/open-prose/skills/prose/examples/README.md +391 -0
  96. package/bundled/open-prose/skills/prose/examples/roadmap/README.md +22 -0
  97. package/bundled/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +20 -0
  98. package/bundled/open-prose/skills/prose/examples/roadmap/parallel-review.prose +18 -0
  99. package/bundled/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +17 -0
  100. package/bundled/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +223 -0
  101. package/bundled/open-prose/skills/prose/guidance/antipatterns.md +951 -0
  102. package/bundled/open-prose/skills/prose/guidance/patterns.md +700 -0
  103. package/bundled/open-prose/skills/prose/guidance/system-prompt.md +180 -0
  104. package/bundled/open-prose/skills/prose/help.md +144 -0
  105. package/bundled/open-prose/skills/prose/lib/README.md +108 -0
  106. package/bundled/open-prose/skills/prose/lib/calibrator.prose +215 -0
  107. package/bundled/open-prose/skills/prose/lib/cost-analyzer.prose +174 -0
  108. package/bundled/open-prose/skills/prose/lib/error-forensics.prose +250 -0
  109. package/bundled/open-prose/skills/prose/lib/inspector.prose +196 -0
  110. package/bundled/open-prose/skills/prose/lib/profiler.prose +460 -0
  111. package/bundled/open-prose/skills/prose/lib/program-improver.prose +275 -0
  112. package/bundled/open-prose/skills/prose/lib/project-memory.prose +118 -0
  113. package/bundled/open-prose/skills/prose/lib/user-memory.prose +93 -0
  114. package/bundled/open-prose/skills/prose/lib/vm-improver.prose +243 -0
  115. package/bundled/open-prose/skills/prose/primitives/session.md +593 -0
  116. package/bundled/open-prose/skills/prose/prose.md +1237 -0
  117. package/bundled/open-prose/skills/prose/state/filesystem.md +498 -0
  118. package/bundled/open-prose/skills/prose/state/in-context.md +384 -0
  119. package/bundled/open-prose/skills/prose/state/postgres.md +880 -0
  120. package/bundled/open-prose/skills/prose/state/sqlite.md +574 -0
  121. package/bundled/peekaboo/SKILL.md +190 -0
  122. package/bundled/prepare-pr/SKILL.md +277 -0
  123. package/bundled/prepare-pr/agents/openai.yaml +4 -0
  124. package/bundled/review-pr/SKILL.md +228 -0
  125. package/bundled/review-pr/agents/openai.yaml +4 -0
  126. package/bundled/sag/SKILL.md +87 -0
  127. package/bundled/skill-creator/SKILL.md +370 -0
  128. package/bundled/skill-creator/license.txt +202 -0
  129. package/bundled/skill-creator/scripts/init_skill.py +378 -0
  130. package/bundled/skill-creator/scripts/package_skill.py +111 -0
  131. package/bundled/skill-creator/scripts/quick_validate.py +101 -0
  132. package/bundled/spotify-player/SKILL.md +64 -0
  133. package/bundled/ssh/SKILL.md +119 -0
  134. package/bundled/summarize/SKILL.md +87 -0
  135. package/bundled/video-frames/SKILL.md +46 -0
  136. package/bundled/video-frames/scripts/frame.sh +81 -0
  137. package/bundled/voice-call/SKILL.md +45 -0
  138. package/bundled/wacli/SKILL.md +72 -0
  139. package/bundled/weather/SKILL.md +54 -0
  140. package/dist/agent/agent-service.d.ts +88 -0
  141. package/dist/agent/agent-service.js +1 -0
  142. package/dist/agent/message-queue.d.ts +24 -0
  143. package/dist/agent/message-queue.js +1 -0
  144. package/dist/agent/prompt-builder.d.ts +58 -0
  145. package/dist/agent/prompt-builder.js +1 -0
  146. package/dist/agent/session-agent.d.ts +197 -0
  147. package/dist/agent/session-agent.js +1 -0
  148. package/dist/agent/session-db.d.ts +26 -0
  149. package/dist/agent/session-db.js +1 -0
  150. package/dist/agent/session-error-handler.d.ts +37 -0
  151. package/dist/agent/session-error-handler.js +1 -0
  152. package/dist/agent/session-manager.d.ts +19 -0
  153. package/dist/agent/session-manager.js +1 -0
  154. package/dist/agent/workspace-files.d.ts +51 -0
  155. package/dist/agent/workspace-files.js +1 -0
  156. package/dist/auth/auth-middleware.d.ts +9 -0
  157. package/dist/auth/auth-middleware.js +1 -0
  158. package/dist/auth/node-signature-db.d.ts +30 -0
  159. package/dist/auth/node-signature-db.js +1 -0
  160. package/dist/auth/token-db.d.ts +38 -0
  161. package/dist/auth/token-db.js +1 -0
  162. package/dist/browser/browser-service.d.ts +9 -0
  163. package/dist/browser/browser-service.js +1 -0
  164. package/dist/channels/channel.d.ts +2 -0
  165. package/dist/channels/channel.js +1 -0
  166. package/dist/channels/responses.d.ts +21 -0
  167. package/dist/channels/responses.js +1 -0
  168. package/dist/commands/clear.d.ts +7 -0
  169. package/dist/commands/clear.js +1 -0
  170. package/dist/commands/cmd.d.ts +7 -0
  171. package/dist/commands/cmd.js +1 -0
  172. package/dist/commands/coder.d.ts +12 -0
  173. package/dist/commands/coder.js +1 -0
  174. package/dist/commands/command-registry.d.ts +12 -0
  175. package/dist/commands/command-registry.js +1 -0
  176. package/dist/commands/command.d.ts +22 -0
  177. package/dist/commands/command.js +1 -0
  178. package/dist/commands/compact.d.ts +7 -0
  179. package/dist/commands/compact.js +1 -0
  180. package/dist/commands/customsubagents.d.ts +15 -0
  181. package/dist/commands/customsubagents.js +1 -0
  182. package/dist/commands/help.d.ts +9 -0
  183. package/dist/commands/help.js +1 -0
  184. package/dist/commands/mcp.d.ts +9 -0
  185. package/dist/commands/mcp.js +1 -0
  186. package/dist/commands/model.d.ts +22 -0
  187. package/dist/commands/model.js +1 -0
  188. package/dist/commands/models.d.ts +11 -0
  189. package/dist/commands/models.js +1 -0
  190. package/dist/commands/new.d.ts +7 -0
  191. package/dist/commands/new.js +1 -0
  192. package/dist/commands/plugin.d.ts +7 -0
  193. package/dist/commands/plugin.js +1 -0
  194. package/dist/commands/sandbox.d.ts +12 -0
  195. package/dist/commands/sandbox.js +1 -0
  196. package/dist/commands/showtool.d.ts +12 -0
  197. package/dist/commands/showtool.js +1 -0
  198. package/dist/commands/status.d.ts +24 -0
  199. package/dist/commands/status.js +1 -0
  200. package/dist/commands/stop.d.ts +10 -0
  201. package/dist/commands/stop.js +1 -0
  202. package/dist/commands/subagents.d.ts +12 -0
  203. package/dist/commands/subagents.js +1 -0
  204. package/dist/commands/usage.d.ts +25 -0
  205. package/dist/commands/usage.js +1 -0
  206. package/dist/commands/useplugin.d.ts +7 -0
  207. package/dist/commands/useplugin.js +1 -0
  208. package/dist/config-watcher.d.ts +14 -0
  209. package/dist/config-watcher.js +1 -0
  210. package/dist/config.d.ts +267 -0
  211. package/dist/config.js +1 -0
  212. package/dist/cron/cron-service.d.ts +57 -0
  213. package/dist/cron/cron-service.js +1 -0
  214. package/dist/cron/heartbeat-token.d.ts +29 -0
  215. package/dist/cron/heartbeat-token.js +1 -0
  216. package/dist/cron/schedule.d.ts +3 -0
  217. package/dist/cron/schedule.js +1 -0
  218. package/dist/cron/store.d.ts +4 -0
  219. package/dist/cron/store.js +1 -0
  220. package/dist/cron/types.d.ts +47 -0
  221. package/dist/cron/types.js +1 -0
  222. package/dist/gateway/bridge.d.ts +38 -0
  223. package/dist/gateway/bridge.js +1 -0
  224. package/dist/gateway/channel-manager.d.ts +45 -0
  225. package/dist/gateway/channel-manager.js +1 -0
  226. package/dist/gateway/channels/qr-image.d.ts +5 -0
  227. package/dist/gateway/channels/qr-image.js +1 -0
  228. package/dist/gateway/channels/telegram.d.ts +39 -0
  229. package/dist/gateway/channels/telegram.js +1 -0
  230. package/dist/gateway/channels/webchat.d.ts +51 -0
  231. package/dist/gateway/channels/webchat.js +1 -0
  232. package/dist/gateway/channels/whatsapp.d.ts +40 -0
  233. package/dist/gateway/channels/whatsapp.js +1 -0
  234. package/dist/gateway/node-registry.d.ts +38 -0
  235. package/dist/gateway/node-registry.js +1 -0
  236. package/dist/heracli/index.d.ts +3 -0
  237. package/dist/heracli/index.js +2 -0
  238. package/dist/heracli/logs.d.ts +13 -0
  239. package/dist/heracli/logs.js +1 -0
  240. package/dist/heracli/security/audit.d.ts +17 -0
  241. package/dist/heracli/security/audit.js +1 -0
  242. package/dist/heracli/security/checks/channel-policies.d.ts +6 -0
  243. package/dist/heracli/security/checks/channel-policies.js +1 -0
  244. package/dist/heracli/security/checks/credentials.d.ts +6 -0
  245. package/dist/heracli/security/checks/credentials.js +1 -0
  246. package/dist/heracli/security/checks/fs-permissions.d.ts +6 -0
  247. package/dist/heracli/security/checks/fs-permissions.js +1 -0
  248. package/dist/heracli/security/checks/network.d.ts +4 -0
  249. package/dist/heracli/security/checks/network.js +1 -0
  250. package/dist/heracli/security/report.d.ts +4 -0
  251. package/dist/heracli/security/report.js +1 -0
  252. package/dist/index.d.ts +3 -0
  253. package/dist/index.js +2 -0
  254. package/dist/installer/hera.d.ts +3 -0
  255. package/dist/installer/hera.js +2 -0
  256. package/dist/media/message-processor.d.ts +23 -0
  257. package/dist/media/message-processor.js +1 -0
  258. package/dist/memory/memory-manager.d.ts +21 -0
  259. package/dist/memory/memory-manager.js +1 -0
  260. package/dist/memory/memory-provider.d.ts +22 -0
  261. package/dist/memory/memory-provider.js +1 -0
  262. package/dist/memory/memory-search.d.ts +102 -0
  263. package/dist/memory/memory-search.js +1 -0
  264. package/dist/memory/recall-strategies.d.ts +2 -0
  265. package/dist/memory/recall-strategies.js +1 -0
  266. package/dist/nostromo/auth.d.ts +29 -0
  267. package/dist/nostromo/auth.js +1 -0
  268. package/dist/nostromo/nostromo.d.ts +23 -0
  269. package/dist/nostromo/nostromo.js +1 -0
  270. package/dist/nostromo/ui-html-layout.d.ts +3 -0
  271. package/dist/nostromo/ui-html-layout.js +1 -0
  272. package/dist/nostromo/ui-html-modals.d.ts +3 -0
  273. package/dist/nostromo/ui-html-modals.js +1 -0
  274. package/dist/nostromo/ui-js-agent.d.ts +3 -0
  275. package/dist/nostromo/ui-js-agent.js +1 -0
  276. package/dist/nostromo/ui-js-channels.d.ts +3 -0
  277. package/dist/nostromo/ui-js-channels.js +1 -0
  278. package/dist/nostromo/ui-js-competences.d.ts +3 -0
  279. package/dist/nostromo/ui-js-competences.js +1 -0
  280. package/dist/nostromo/ui-js-config.d.ts +3 -0
  281. package/dist/nostromo/ui-js-config.js +1 -0
  282. package/dist/nostromo/ui-js-core.d.ts +3 -0
  283. package/dist/nostromo/ui-js-core.js +1 -0
  284. package/dist/nostromo/ui-js-ops.d.ts +3 -0
  285. package/dist/nostromo/ui-js-ops.js +1 -0
  286. package/dist/nostromo/ui-js-prompts.d.ts +3 -0
  287. package/dist/nostromo/ui-js-prompts.js +1 -0
  288. package/dist/nostromo/ui-styles.d.ts +3 -0
  289. package/dist/nostromo/ui-styles.js +1 -0
  290. package/dist/nostromo/ui.d.ts +2 -0
  291. package/dist/nostromo/ui.js +1 -0
  292. package/dist/server.d.ts +80 -0
  293. package/dist/server.js +1 -0
  294. package/dist/stt/local-whisper.d.ts +9 -0
  295. package/dist/stt/local-whisper.js +1 -0
  296. package/dist/stt/openai-whisper.d.ts +14 -0
  297. package/dist/stt/openai-whisper.js +1 -0
  298. package/dist/stt/stt-loader.d.ts +4 -0
  299. package/dist/stt/stt-loader.js +1 -0
  300. package/dist/stt/stt-provider.d.ts +4 -0
  301. package/dist/stt/stt-provider.js +1 -0
  302. package/dist/tools/browser-tools.d.ts +9 -0
  303. package/dist/tools/browser-tools.js +1 -0
  304. package/dist/tools/cron-tools.d.ts +4 -0
  305. package/dist/tools/cron-tools.js +1 -0
  306. package/dist/tools/memory-tools.d.ts +3 -0
  307. package/dist/tools/memory-tools.js +1 -0
  308. package/dist/tools/message-tools.d.ts +5 -0
  309. package/dist/tools/message-tools.js +1 -0
  310. package/dist/tools/node-tools.d.ts +3 -0
  311. package/dist/tools/node-tools.js +1 -0
  312. package/dist/tools/server-tools.d.ts +2 -0
  313. package/dist/tools/server-tools.js +1 -0
  314. package/dist/tools/tts-tools.d.ts +3 -0
  315. package/dist/tools/tts-tools.js +1 -0
  316. package/dist/tts/tts-service.d.ts +19 -0
  317. package/dist/tts/tts-service.js +1 -0
  318. package/dist/utils/chunk.d.ts +3 -0
  319. package/dist/utils/chunk.js +1 -0
  320. package/dist/utils/logger.d.ts +16 -0
  321. package/dist/utils/logger.js +1 -0
  322. package/dist/utils/markdown/fences.d.ts +11 -0
  323. package/dist/utils/markdown/fences.js +1 -0
  324. package/dist/utils/markdown/ir.d.ts +33 -0
  325. package/dist/utils/markdown/ir.js +1 -0
  326. package/dist/utils/markdown/render.d.ts +19 -0
  327. package/dist/utils/markdown/render.js +1 -0
  328. package/dist/utils/markdown/tables.d.ts +3 -0
  329. package/dist/utils/markdown/tables.js +1 -0
  330. package/dist/utils/media-response.d.ts +29 -0
  331. package/dist/utils/media-response.js +1 -0
  332. package/dist/utils/package-paths.d.ts +5 -0
  333. package/dist/utils/package-paths.js +1 -0
  334. package/dist/utils/telegram-format.d.ts +13 -0
  335. package/dist/utils/telegram-format.js +1 -0
  336. package/installationPkg/.env.example +26 -0
  337. package/installationPkg/AGENTS.md +143 -0
  338. package/installationPkg/BOOTSTRAP.md +45 -0
  339. package/installationPkg/CBINT.json +16 -0
  340. package/installationPkg/HEARTBEAT.md +5 -0
  341. package/installationPkg/IDENTITY.md +7 -0
  342. package/installationPkg/SOUL.md +36 -0
  343. package/installationPkg/SYSTEM_PROMPT.md +55 -0
  344. package/installationPkg/SYSTEM_PROMPT_SUBAGENT.md +40 -0
  345. package/installationPkg/TOOLS.md +36 -0
  346. package/installationPkg/USER.md +11 -0
  347. package/installationPkg/config.example.yaml +291 -0
  348. package/package.json +95 -0
@@ -0,0 +1,460 @@
1
+ # Profiler
2
+ # Analyzes OpenProse runs for cost, tokens, and time using actual API data
3
+ #
4
+ # Usage:
5
+ # prose run @openprose/lib/profiler
6
+ #
7
+ # Inputs:
8
+ # run_path: Path to run to analyze, or "recent" for latest runs
9
+ # scope: single | compare | trend
10
+ #
11
+ # Outputs:
12
+ # - Cost breakdown (VM vs subagents, by agent, by model)
13
+ # - Time breakdown (wall-clock, per-session, parallelism effectiveness)
14
+ # - Token usage patterns
15
+ # - Efficiency metrics ($/second, tokens/second)
16
+ # - Bottleneck identification
17
+ # - Optimization recommendations
18
+ #
19
+ # Data Sources:
20
+ # Primary: Claude Code's jsonl files in ~/.claude/projects/{project}/{session}/
21
+ # - Main session: {session}.jsonl (VM orchestration)
22
+ # - Subagents: subagents/agent-*.jsonl (OpenProse sessions)
23
+ #
24
+ # From each assistant message:
25
+ # - Tokens: input_tokens, output_tokens, cache_creation_input_tokens, cache_read_input_tokens
26
+ # - Model: message.model
27
+ # - Timestamps: for duration calculations
28
+ #
29
+ # Pricing: Fetched live from Anthropic's pricing page
30
+ #
31
+ # Supported Tools:
32
+ # - Claude Code (~/.claude) - full support
33
+ # - OpenCode, Amp, Codex - may have different structures, will warn
34
+
35
+ input run_path: "Path to run, or 'recent' for latest runs in .prose/runs/"
36
+ input scope: "Scope: single (one run) | compare (multiple runs) | trend (over time)"
37
+
38
+ const PRICING_URL = "https://platform.claude.com/docs/en/about-claude/pricing#model-pricing"
39
+
40
+ # ============================================================
41
+ # Agents
42
+ # ============================================================
43
+
44
+ agent detector:
45
+ model: haiku
46
+ prompt: """
47
+ You detect which AI coding tool was used and find its data files.
48
+
49
+ Check for:
50
+ 1. ~/.claude/projects/ - Claude Code (full support)
51
+ 2. ~/.opencode/ - OpenCode (may differ)
52
+ 3. ~/.amp/ - Amp (may differ)
53
+ 4. ~/.codex/ - Codex (may differ)
54
+
55
+ If not Claude Code, warn the user that analysis may be incomplete.
56
+ """
57
+
58
+ agent collector:
59
+ model: sonnet
60
+ prompt: """
61
+ You locate and inventory AI coding tool session files.
62
+
63
+ For Claude Code (~/.claude/projects/{project}/{session}/):
64
+ 1. Main session file: {session}.jsonl - VM orchestration
65
+ 2. Subagent files: subagents/agent-*.jsonl - OpenProse sessions
66
+
67
+ Your job is to FIND the files, not process them.
68
+ Return file paths for the calculator agent to process.
69
+ """
70
+
71
+ agent calculator:
72
+ model: sonnet
73
+ prompt: """
74
+ You calculate metrics by writing and executing inline Python scripts.
75
+
76
+ CRITICAL RULES:
77
+ 1. NEVER do math in your head - always use Python
78
+ 2. NEVER create standalone .py files - use inline scripts only
79
+ 3. Run scripts with heredoc style: python3 << 'EOF' ... EOF
80
+ 4. MUST process ALL files: main_jsonl AND EVERY file in subagent_jsonls[]
81
+
82
+ BEFORE CALCULATING:
83
+ Fetch current pricing from the pricing URL provided in your prompt.
84
+ Extract per-million-token rates for each Claude model.
85
+
86
+ YOUR PYTHON SCRIPT MUST:
87
+ 1. Process the main_jsonl file (VM orchestration data)
88
+ 2. Process EVERY file in subagent_jsonls[] (subagent session data)
89
+ - This is critical! There may be 10-20+ subagent files
90
+ - Each contains token usage that MUST be counted
91
+ 3. For each file, read line by line and extract from type="assistant":
92
+ - usage.input_tokens, usage.output_tokens
93
+ - usage.cache_creation_input_tokens, usage.cache_read_input_tokens
94
+ - message.model (for pricing tier)
95
+ - timestamp (for duration calculation)
96
+ 4. From Task prompts in subagent files, extract:
97
+ - Agent name: regex `You are the "([^"]+)" agent`
98
+ - Binding name: regex `/bindings/([^.]+)\\.md`
99
+ 5. Calculate costs using the pricing you fetched
100
+ 6. Calculate durations from first to last timestamp per file
101
+ 7. Output structured JSON with VM and subagent data SEPARATELY
102
+
103
+ VALIDATION: If subagents.total.cost is 0 but subagent_jsonls has files,
104
+ your script has a bug - fix it before outputting.
105
+ """
106
+ permissions:
107
+ network: [PRICING_URL]
108
+
109
+ agent analyzer:
110
+ model: opus
111
+ prompt: """
112
+ You analyze profiling data and identify optimization opportunities.
113
+
114
+ You receive pre-calculated data (computed by Python, not estimated).
115
+ Your job is interpretation and recommendations, not calculation.
116
+
117
+ COST ANALYSIS:
118
+ - VM overhead vs subagent costs (percentage split)
119
+ - Per-agent costs (which agents are most expensive?)
120
+ - Per-binding costs (which outputs cost the most?)
121
+ - Model tier usage (is opus used where sonnet would suffice?)
122
+ - Cache efficiency (cache_read vs cache_write ratio)
123
+
124
+ TIME ANALYSIS:
125
+ - Wall-clock duration vs sum of session durations
126
+ - Parallelism effectiveness (ratio shows how much parallelization helped)
127
+ - Per-agent time (which agents are slowest?)
128
+ - Bottlenecks (sequential operations that blocked progress)
129
+
130
+ EFFICIENCY ANALYSIS:
131
+ - Cost per second ($/s)
132
+ - Tokens per second (throughput)
133
+ - Cost vs time correlation (expensive but fast? cheap but slow?)
134
+
135
+ RECOMMENDATIONS:
136
+ - Model tier downgrades where appropriate
137
+ - Parallelization opportunities (sequential ops that could be parallel)
138
+ - Batching opportunities (many small sessions that could consolidate)
139
+ - Context trimming if input tokens seem excessive
140
+ """
141
+
142
+ agent tracker:
143
+ model: haiku
144
+ persist: user
145
+ prompt: """
146
+ You track profiling metrics across runs for trend analysis.
147
+ Store: run_id, program, timestamp, total_cost, total_time, vm_cost, subagent_cost, by_model.
148
+ Compare against historical data when available.
149
+ """
150
+
151
+ # ============================================================
152
+ # Phase 1: Detect Tool and Find Data
153
+ # ============================================================
154
+
155
+ let tool_detection = session: detector
156
+ prompt: """
157
+ Detect which AI coding tool was used for this OpenProse run.
158
+
159
+ Run path: {run_path}
160
+
161
+ 1. If run_path is in .prose/runs/, extract the run timestamp
162
+ 2. Look for corresponding session in:
163
+ - ~/.claude/projects/ (Claude Code) - check subfolders for sessions
164
+ - Other tool directories as fallback
165
+
166
+ 3. If found in ~/.claude:
167
+ - Return the full session path
168
+ - List the main jsonl file and subagent files
169
+ - This is the primary data source
170
+
171
+ 4. If NOT found in ~/.claude:
172
+ - Check for opencode/amp/codex directories
173
+ - WARN: "Non-Claude Code tool detected. Token data structure may differ."
174
+
175
+ 5. If no tool data found:
176
+ - Return tool="not-found" with clear error
177
+ - Do NOT attempt estimation
178
+
179
+ Return JSON:
180
+ {
181
+ "tool": "claude-code" | "opencode" | "amp" | "codex" | "not-found",
182
+ "session_path": "/path/to/session/" | null,
183
+ "main_jsonl": "/path/to/session.jsonl" | null,
184
+ "subagent_jsonls": [...] | [],
185
+ "error": null | "Error message",
186
+ "warnings": []
187
+ }
188
+ """
189
+
190
+ # ============================================================
191
+ # Guard: Exit if no data available
192
+ # ============================================================
193
+
194
+ assert tool_detection.tool != "not-found":
195
+ """
196
+ ERROR: Profiling requires actual data from AI tool session files.
197
+
198
+ Could not find session data for this run. This can happen if:
199
+ 1. The run was not executed with Claude Code (or supported tool)
200
+ 2. The Claude Code session has been deleted or moved
201
+ 3. The run path does not correspond to an existing session
202
+
203
+ Supported tools: Claude Code (~/.claude)
204
+ Partial support: OpenCode, Amp, Codex (structure may differ)
205
+ """
206
+
207
+ # ============================================================
208
+ # Phase 2: Locate Session Files
209
+ # ============================================================
210
+
211
+ let runs_to_analyze = session: collector
212
+ prompt: """
213
+ Find runs to analyze and locate their session files.
214
+
215
+ Input: {run_path}
216
+ Scope: {scope}
217
+ Tool detection: {tool_detection}
218
+
219
+ If run_path is a specific path, use that run.
220
+ If run_path is "recent", find the latest 5-10 runs in .prose/runs/
221
+
222
+ For each run, locate:
223
+ 1. The .prose/runs/{run_id}/ directory
224
+ 2. The corresponding Claude Code session
225
+ 3. List all jsonl files (main session + subagents/)
226
+
227
+ Return JSON array:
228
+ [
229
+ {
230
+ "run_id": "...",
231
+ "prose_run_path": "/path/to/.prose/runs/xxx/",
232
+ "session_path": "/path/to/claude/session/",
233
+ "main_jsonl": "/path/to/session.jsonl",
234
+ "subagent_jsonls": [...]
235
+ }
236
+ ]
237
+ """
238
+ context: tool_detection
239
+
240
+ # ============================================================
241
+ # Phase 3: Calculate Metrics (single Python pass per run)
242
+ # ============================================================
243
+
244
+ let metrics = runs_to_analyze | pmap:
245
+ session: calculator
246
+ prompt: """
247
+ Calculate all metrics for: {item}
248
+
249
+ STEP 1: Fetch current pricing from {PRICING_URL}
250
+ Note the per-million-token rates for each model (input, output, cache).
251
+
252
+ STEP 2: Write and execute an inline Python script that processes:
253
+ - Main jsonl: {item.main_jsonl}
254
+ - Subagent jsonls: {item.subagent_jsonls}
255
+
256
+ EXTRACT FROM EACH ASSISTANT MESSAGE:
257
+ - usage.input_tokens, usage.output_tokens
258
+ - usage.cache_creation_input_tokens, usage.cache_read_input_tokens
259
+ - model (for pricing tier)
260
+ - timestamp (for duration calculation)
261
+
262
+ EXTRACT FROM TASK PROMPTS (user messages in subagent files):
263
+ - Agent name: regex `You are the "([^"]+)" agent`
264
+ - Binding name: regex `/bindings/([^.]+)\.md`
265
+
266
+ CALCULATE:
267
+ - Cost: tokens * pricing rates you fetched
268
+ - Duration: time between first and last message per session
269
+ - Wall-clock: total run duration
270
+
271
+ OUTPUT JSON:
272
+ {
273
+ "run_id": "...",
274
+ "program": "...",
275
+ "wall_clock_seconds": N,
276
+ "vm_orchestration": {
277
+ "tokens": { "input": N, "output": N, "cache_write": N, "cache_read": N },
278
+ "cost": 0.00,
279
+ "duration_seconds": N,
280
+ "model": "...",
281
+ "message_count": N
282
+ },
283
+ "subagents": {
284
+ "total": { "tokens": {...}, "cost": 0.00, "duration_seconds": N },
285
+ "by_agent": {
286
+ "agent_name": {
287
+ "tokens": {...},
288
+ "cost": 0.00,
289
+ "duration_seconds": N,
290
+ "sessions": N,
291
+ "model": "..."
292
+ }
293
+ },
294
+ "by_binding": {
295
+ "binding_name": { "tokens": {...}, "cost": 0.00, "duration_seconds": N, "agent": "..." }
296
+ }
297
+ },
298
+ "by_model": {
299
+ "opus": { "tokens": {...}, "cost": 0.00 },
300
+ "sonnet": { "tokens": {...}, "cost": 0.00 },
301
+ "haiku": { "tokens": {...}, "cost": 0.00 }
302
+ },
303
+ "total": {
304
+ "tokens": { "input": N, "output": N, "cache_write": N, "cache_read": N, "total": N },
305
+ "cost": 0.00,
306
+ "duration_seconds": N
307
+ },
308
+ "efficiency": {
309
+ "cost_per_second": 0.00,
310
+ "tokens_per_second": N,
311
+ "parallelism_factor": N // sum(session_durations) / wall_clock
312
+ }
313
+ }
314
+ """
315
+ context: item
316
+
317
+ # ============================================================
318
+ # Phase 4: Analyze
319
+ # ============================================================
320
+
321
+ let analysis = session: analyzer
322
+ prompt: """
323
+ Analyze the profiling data.
324
+
325
+ Pre-calculated metrics: {metrics}
326
+ Scope: {scope}
327
+
328
+ All numbers were calculated by Python. Trust them - focus on insights.
329
+
330
+ FOR SINGLE RUN:
331
+
332
+ 1. COST ATTRIBUTION
333
+ - VM overhead vs subagent costs (percentage)
334
+ - Rank agents by cost
335
+ - Flag expensive models on simple tasks
336
+
337
+ 2. TIME ATTRIBUTION
338
+ - Wall-clock vs sum of session durations
339
+ - Parallelism factor interpretation:
340
+ - Factor near 1.0 = fully sequential
341
+ - Factor > 2.0 = good parallelization
342
+ - Factor > 5.0 = excellent parallelization
343
+ - Identify slowest agents/bindings
344
+
345
+ 3. EFFICIENCY
346
+ - Cost per second (is expensive time well-spent?)
347
+ - Tokens per second (throughput)
348
+ - Correlation: expensive-and-fast vs cheap-and-slow
349
+
350
+ 4. CACHE EFFICIENCY
351
+ - Read/write ratio
352
+ - Assessment: good (>5:1), fair (2-5:1), poor (<2:1)
353
+
354
+ 5. HOTSPOTS
355
+ - Top 5 by cost
356
+ - Top 5 by time
357
+ - Note any that appear in both lists
358
+
359
+ 6. RECOMMENDATIONS
360
+ - Model downgrades (specific: "agent X could use sonnet")
361
+ - Parallelization opportunities (specific sequential ops)
362
+ - Batching opportunities (many small similar sessions)
363
+ - Context trimming if input >> output
364
+
365
+ FOR COMPARE (multiple runs):
366
+ - Show cost and time differences
367
+ - Identify what changed between runs
368
+ - Note improvements or regressions
369
+
370
+ FOR TREND (over time):
371
+ - Show cost and time progression
372
+ - Identify trend direction
373
+ - Flag anomalies
374
+
375
+ Return structured JSON with all analysis sections.
376
+ """
377
+ context: metrics
378
+
379
+ # ============================================================
380
+ # Phase 5: Track for Trends
381
+ # ============================================================
382
+
383
+ resume: tracker
384
+ prompt: """
385
+ Record this profiling data for trend tracking.
386
+
387
+ Run: {metrics[0].run_id}
388
+ Program: {metrics[0].program}
389
+ Total cost: {analysis.summary.total_cost}
390
+ Total time: {analysis.summary.total_time}
391
+ Efficiency: {analysis.summary.efficiency}
392
+
393
+ Add to your historical record with timestamp.
394
+ If you have previous runs of the same program, note the trend.
395
+ """
396
+ context: analysis
397
+
398
+ # ============================================================
399
+ # Output
400
+ # ============================================================
401
+
402
+ output report = session "Format profiler report"
403
+ prompt: """
404
+ Format the profiling analysis as a professional report.
405
+
406
+ Analysis: {analysis}
407
+ Tool: {tool_detection.tool}
408
+
409
+ ## Report Structure:
410
+
411
+ ### 1. Executive Summary
412
+ - Total cost and wall-clock time
413
+ - Key finding (most significant insight)
414
+ - Tool used
415
+
416
+ ### 2. Cost Attribution
417
+ | Category | Cost | % of Total |
418
+ |----------|------|------------|
419
+ | VM Orchestration | $X.XX | XX% |
420
+ | Subagent Execution | $X.XX | XX% |
421
+ | **Total** | $X.XX | 100% |
422
+
423
+ ### 3. Time Attribution
424
+ | Category | Time | % of Wall-Clock |
425
+ |----------|------|-----------------|
426
+ | VM Orchestration | Xs | XX% |
427
+ | Subagent Execution | Xs | XX% |
428
+ | **Wall-Clock** | Xs | - |
429
+ | **Sum of Sessions** | Xs | - |
430
+ | **Parallelism Factor** | X.Xx | - |
431
+
432
+ ### 4. By Agent
433
+ | Agent | Model | Sessions | Cost | Time | $/s |
434
+ |-------|-------|----------|------|------|-----|
435
+
436
+ ### 5. By Model Tier
437
+ | Model | Cost | % | Tokens | % |
438
+ |-------|------|---|--------|---|
439
+
440
+ ### 6. Cache Efficiency
441
+ - Read/write ratio and assessment
442
+
443
+ ### 7. Hotspots
444
+ **By Cost:**
445
+ 1. ...
446
+
447
+ **By Time:**
448
+ 1. ...
449
+
450
+ ### 8. Efficiency Analysis
451
+ - Cost per second
452
+ - Tokens per second
453
+ - Parallelism effectiveness
454
+
455
+ ### 9. Recommendations
456
+ Prioritized list with estimated impact
457
+
458
+ Format as clean markdown with tables.
459
+ """
460
+ context: analysis