@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,174 @@
1
+ # Cost Analyzer
2
+ # Analyzes runs for token usage and cost patterns
3
+ #
4
+ # Usage:
5
+ # prose run @openprose/lib/cost-analyzer
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
+ # - Token usage breakdown by agent/phase
13
+ # - Model tier efficiency analysis
14
+ # - Cost hotspots
15
+ # - Optimization recommendations
16
+
17
+ input run_path: "Path to run, or 'recent' for latest runs in .prose/runs/"
18
+ input scope: "Scope: single (one run) | compare (multiple runs) | trend (over time)"
19
+
20
+ # ============================================================
21
+ # Agents
22
+ # ============================================================
23
+
24
+ agent collector:
25
+ model: sonnet
26
+ prompt: """
27
+ You collect and structure cost/token data from .prose runs.
28
+
29
+ Extract from run artifacts:
30
+ - Model used per session (haiku/sonnet/opus)
31
+ - Approximate token counts (estimate from content length)
32
+ - Session count per agent
33
+ - Parallel vs sequential execution
34
+ """
35
+
36
+ agent analyzer:
37
+ model: opus
38
+ prompt: """
39
+ You analyze cost patterns and identify optimization opportunities.
40
+
41
+ Consider:
42
+ - Model tier appropriateness (is opus needed, or would sonnet suffice?)
43
+ - Token efficiency (are contexts bloated?)
44
+ - Parallelization (could sequential steps run in parallel?)
45
+ - Caching opportunities (repeated computations?)
46
+ """
47
+
48
+ agent tracker:
49
+ model: haiku
50
+ persist: user
51
+ prompt: """
52
+ You track cost metrics across runs for trend analysis.
53
+ Store compactly: run_id, program, total_cost_estimate, breakdown.
54
+ """
55
+
56
+ # ============================================================
57
+ # Phase 1: Collect Run Data
58
+ # ============================================================
59
+
60
+ let runs_to_analyze = session: collector
61
+ prompt: """
62
+ Find runs to analyze.
63
+
64
+ Input: {run_path}
65
+ Scope: {scope}
66
+
67
+ If run_path is a specific path, use that run.
68
+ If run_path is "recent", find the latest 5-10 runs in .prose/runs/
69
+
70
+ For scope=compare, find runs of the same program.
71
+ For scope=trend, find runs over time.
72
+
73
+ Return: list of run paths to analyze
74
+ """
75
+
76
+ let run_data = runs_to_analyze | pmap:
77
+ session: collector
78
+ prompt: """
79
+ Extract cost data from run: {item}
80
+
81
+ Read state.md and bindings to determine:
82
+ 1. Program name
83
+ 2. Each session spawned:
84
+ - Agent name (or "anonymous")
85
+ - Model tier
86
+ - Estimated input tokens (context size)
87
+ - Estimated output tokens (binding size)
88
+ 3. Parallel blocks (how many concurrent sessions)
89
+ 4. Total session count
90
+
91
+ Estimate costs using rough rates:
92
+ - haiku: $0.25 / 1M input, $1.25 / 1M output
93
+ - sonnet: $3 / 1M input, $15 / 1M output
94
+ - opus: $15 / 1M input, $75 / 1M output
95
+
96
+ Return structured JSON.
97
+ """
98
+ context: item
99
+
100
+ # ============================================================
101
+ # Phase 2: Analyze
102
+ # ============================================================
103
+
104
+ let analysis = session: analyzer
105
+ prompt: """
106
+ Analyze cost patterns across these runs.
107
+
108
+ Data: {run_data}
109
+ Scope: {scope}
110
+
111
+ For single run:
112
+ - Break down cost by agent and phase
113
+ - Identify the most expensive operations
114
+ - Flag potential inefficiencies
115
+
116
+ For compare:
117
+ - Show cost differences between runs
118
+ - Identify which changes affected cost
119
+ - Note if cost increased/decreased
120
+
121
+ For trend:
122
+ - Show cost over time
123
+ - Identify if costs are stable, growing, or improving
124
+ - Flag anomalies
125
+
126
+ Always include:
127
+ - Model tier efficiency (are expensive models used appropriately?)
128
+ - Context efficiency (are contexts lean or bloated?)
129
+ - Specific optimization recommendations
130
+
131
+ Return structured JSON with:
132
+ {
133
+ "summary": { total_cost, session_count, by_model: {...} },
134
+ "hotspots": [ { agent, cost, percent, issue } ],
135
+ "recommendations": [ { priority, description, estimated_savings } ],
136
+ "details": { ... }
137
+ }
138
+ """
139
+ context: run_data
140
+
141
+ # ============================================================
142
+ # Phase 3: Track for Trends
143
+ # ============================================================
144
+
145
+ resume: tracker
146
+ prompt: """
147
+ Record this cost analysis for future trend tracking.
148
+
149
+ {analysis.summary}
150
+
151
+ Add to your historical record.
152
+ """
153
+ context: analysis
154
+
155
+ # ============================================================
156
+ # Output
157
+ # ============================================================
158
+
159
+ output report = session "Format report"
160
+ prompt: """
161
+ Format the cost analysis as a readable report.
162
+
163
+ Analysis: {analysis}
164
+
165
+ Include:
166
+ 1. Executive summary (total cost, key finding)
167
+ 2. Cost breakdown table
168
+ 3. Hotspots (where money goes)
169
+ 4. Recommendations (prioritized)
170
+ 5. If scope=trend, include trend chart (ascii or description)
171
+
172
+ Format as markdown.
173
+ """
174
+ context: analysis
@@ -0,0 +1,250 @@
1
+ # Error Forensics
2
+ # Deep investigation of failed or problematic runs
3
+ #
4
+ # Usage:
5
+ # prose run @openprose/lib/error-forensics
6
+ #
7
+ # Inputs:
8
+ # run_path: Path to the failed/problematic run
9
+ # focus: Optional focus area (vm | program | context | external)
10
+ #
11
+ # Outputs:
12
+ # - Root cause analysis
13
+ # - Error classification
14
+ # - Fix recommendations
15
+ # - Prevention suggestions
16
+
17
+ input run_path: "Path to the run to investigate"
18
+ input focus: "Optional focus: vm | program | context | external (default: auto-detect)"
19
+
20
+ # ============================================================
21
+ # Agents
22
+ # ============================================================
23
+
24
+ agent investigator:
25
+ model: opus
26
+ prompt: """
27
+ You are a forensic investigator for failed .prose runs.
28
+
29
+ You methodically trace execution to find root causes:
30
+ - Read state.md for execution trace
31
+ - Check each binding for errors or unexpected content
32
+ - Look for patterns: where did things go wrong?
33
+ - Distinguish symptoms from causes
34
+ """
35
+
36
+ agent classifier:
37
+ model: sonnet
38
+ prompt: """
39
+ You classify errors into actionable categories:
40
+
41
+ VM errors: The OpenProse VM itself misbehaved
42
+ - State management bugs
43
+ - Incorrect control flow
44
+ - Context passing failures
45
+
46
+ Program errors: The .prose program has issues
47
+ - Logic errors
48
+ - Missing error handling
49
+ - Bad agent prompts
50
+
51
+ Context errors: Context degradation or bloat
52
+ - Information lost between agents
53
+ - Context too large
54
+ - Wrong context passed
55
+
56
+ External errors: Outside factors
57
+ - Tool failures
58
+ - Network issues
59
+ - Resource limits
60
+ """
61
+
62
+ agent fixer:
63
+ model: opus
64
+ prompt: """
65
+ You propose specific fixes for identified issues.
66
+ Be concrete: show the change, not just describe it.
67
+ """
68
+
69
+ # ============================================================
70
+ # Phase 1: Gather Evidence
71
+ # ============================================================
72
+
73
+ let evidence = session: investigator
74
+ prompt: """
75
+ Gather evidence from the failed run.
76
+
77
+ Run: {run_path}
78
+
79
+ Read and analyze:
80
+ 1. state.md - What was the execution trace? Where did it stop?
81
+ 2. bindings/ - Which bindings exist? Any with errors or empty?
82
+ 3. program.prose - What was the program trying to do?
83
+ 4. agents/ - Any agent memory files with clues?
84
+
85
+ Document:
86
+ - Last successful step
87
+ - First sign of trouble
88
+ - Error messages (if any)
89
+ - Unexpected states
90
+
91
+ Return structured evidence.
92
+ """
93
+
94
+ # ============================================================
95
+ # Phase 2: Trace Execution
96
+ # ============================================================
97
+
98
+ let trace = session: investigator
99
+ prompt: """
100
+ Trace execution step by step to find the failure point.
101
+
102
+ Evidence: {evidence}
103
+
104
+ Walk through the execution:
105
+ 1. What was the program supposed to do at each step?
106
+ 2. What actually happened (according to state.md)?
107
+ 3. Where do expected and actual diverge?
108
+
109
+ For the divergence point:
110
+ - What was the input to that step?
111
+ - What was the output (or lack thereof)?
112
+ - What should have happened?
113
+
114
+ Return:
115
+ {
116
+ "failure_point": { step, statement, expected, actual },
117
+ "chain_of_events": [...],
118
+ "contributing_factors": [...]
119
+ }
120
+ """
121
+ context: evidence
122
+
123
+ # ============================================================
124
+ # Phase 3: Classify Error
125
+ # ============================================================
126
+
127
+ let classification = session: classifier
128
+ prompt: """
129
+ Classify this error.
130
+
131
+ Trace: {trace}
132
+ Evidence: {evidence}
133
+ Focus hint: {focus}
134
+
135
+ Determine:
136
+ - Primary category (vm | program | context | external)
137
+ - Subcategory (specific type within category)
138
+ - Severity (critical | major | minor)
139
+ - Reproducibility (always | sometimes | rare)
140
+
141
+ Return:
142
+ {
143
+ "category": "...",
144
+ "subcategory": "...",
145
+ "severity": "...",
146
+ "reproducibility": "...",
147
+ "confidence": "high" | "medium" | "low",
148
+ "reasoning": "..."
149
+ }
150
+ """
151
+ context: { trace, evidence }
152
+
153
+ # ============================================================
154
+ # Phase 4: Root Cause Analysis
155
+ # ============================================================
156
+
157
+ let root_cause = session: investigator
158
+ prompt: """
159
+ Determine the root cause (not just symptoms).
160
+
161
+ Trace: {trace}
162
+ Classification: {classification}
163
+
164
+ Ask "why" repeatedly until you reach the root:
165
+ - Why did this step fail?
166
+ - Why was that input malformed?
167
+ - Why did that agent produce that output?
168
+ - ...
169
+
170
+ The root cause is the earliest point where an intervention
171
+ would have prevented the failure.
172
+
173
+ Return:
174
+ {
175
+ "root_cause": "...",
176
+ "causal_chain": ["step 1", "led to step 2", "which caused failure"],
177
+ "root_cause_category": "vm" | "program" | "context" | "external"
178
+ }
179
+ """
180
+ context: { trace, classification }
181
+
182
+ # ============================================================
183
+ # Phase 5: Fix Recommendations
184
+ # ============================================================
185
+
186
+ let fixes = session: fixer
187
+ prompt: """
188
+ Propose fixes for this failure.
189
+
190
+ Root cause: {root_cause}
191
+ Classification: {classification}
192
+ Evidence: {evidence}
193
+
194
+ Provide:
195
+ 1. Immediate fix (how to make this specific run work)
196
+ 2. Permanent fix (how to prevent this class of error)
197
+ 3. Detection (how to catch this earlier next time)
198
+
199
+ Be specific. If it's a code change, show the diff.
200
+ If it's a process change, describe the new process.
201
+
202
+ Return:
203
+ {
204
+ "immediate": { action, details },
205
+ "permanent": { action, details, files_to_change },
206
+ "detection": { action, details },
207
+ "prevention": "how to avoid this in future programs"
208
+ }
209
+ """
210
+ context: { root_cause, classification, evidence }
211
+
212
+ # ============================================================
213
+ # Output
214
+ # ============================================================
215
+
216
+ output report = session "Format report"
217
+ prompt: """
218
+ Format the forensic analysis as a report.
219
+
220
+ Evidence: {evidence}
221
+ Trace: {trace}
222
+ Classification: {classification}
223
+ Root cause: {root_cause}
224
+ Fixes: {fixes}
225
+
226
+ Structure:
227
+ 1. Executive Summary
228
+ - What failed
229
+ - Why it failed (root cause)
230
+ - How to fix it
231
+
232
+ 2. Timeline
233
+ - Execution trace with failure point highlighted
234
+
235
+ 3. Root Cause Analysis
236
+ - Causal chain
237
+ - Classification
238
+
239
+ 4. Recommendations
240
+ - Immediate fix
241
+ - Permanent fix
242
+ - Prevention
243
+
244
+ 5. Technical Details
245
+ - Evidence gathered
246
+ - Files examined
247
+
248
+ Format as markdown.
249
+ """
250
+ context: { evidence, trace, classification, root_cause, fixes }
@@ -0,0 +1,196 @@
1
+ # Post-Run Inspector
2
+ # Analyzes completed .prose runs for runtime fidelity and task effectiveness
3
+ #
4
+ # Usage:
5
+ # prose run @openprose/lib/inspector
6
+ #
7
+ # Inputs:
8
+ # run_path: Path to the run to inspect (e.g., .prose/runs/20260119-100000-abc123)
9
+ # depth: light | deep
10
+ # target: vm | task | all
11
+ #
12
+ # Compounding: Each inspection builds on prior inspections via persistent index agent.
13
+ # The index agent uses `persist: user` so inspection history spans all projects.
14
+
15
+ input run_path: "Path to the run to inspect (e.g., .prose/runs/20260119-100000-abc123)"
16
+ input depth: "Inspection depth: light or deep"
17
+ input target: "Evaluation target: vm, task, or all"
18
+
19
+ # ============================================================
20
+ # Agents
21
+ # ============================================================
22
+
23
+ agent index:
24
+ model: haiku
25
+ persist: user
26
+ prompt: """
27
+ You maintain the inspection registry across all projects.
28
+ Track: target_run_id, depth, target, timestamp, verdict.
29
+ Return JSON when queried. Store compactly.
30
+ """
31
+
32
+ agent extractor:
33
+ model: sonnet
34
+ prompt: """
35
+ You extract structured data from .prose run artifacts.
36
+ Read state.md, bindings/, and logs carefully.
37
+ Return clean JSON.
38
+ """
39
+
40
+ agent evaluator:
41
+ model: opus
42
+ prompt: """
43
+ You evaluate .prose runs with intelligent judgment.
44
+ Rate 1-10 with specific rationale. Be concrete.
45
+ """
46
+
47
+ agent synthesizer:
48
+ model: sonnet
49
+ prompt: """
50
+ You produce clear reports in requested formats.
51
+ """
52
+
53
+ # ============================================================
54
+ # Phase 0: Check Prior Work
55
+ # ============================================================
56
+
57
+ let prior = resume: index
58
+ prompt: """
59
+ Any prior inspections for: {run_path}?
60
+ Return JSON: { "inspections": [...], "has_light": bool, "has_deep": bool }
61
+ """
62
+
63
+ # ============================================================
64
+ # Phase 1: Extraction
65
+ # ============================================================
66
+
67
+ let extraction = session: extractor
68
+ prompt: """
69
+ Extract from run at: {run_path}
70
+ Depth: {depth}
71
+ Prior work: {prior}
72
+
73
+ ALWAYS get:
74
+ - run_id (from path)
75
+ - completed (did state.md show completion?)
76
+ - error_count (failures in state.md)
77
+ - binding_names (list all bindings/)
78
+ - output_names (bindings with kind: output)
79
+
80
+ IF depth=deep AND no prior deep inspection:
81
+ - program_source (contents of program.prose)
82
+ - execution_summary (key statements from state.md)
83
+ - binding_previews (first 300 chars of each binding)
84
+
85
+ IF prior deep exists, skip deep extraction and note "using cached".
86
+
87
+ Return JSON.
88
+ """
89
+ context: prior
90
+
91
+ # ============================================================
92
+ # Phase 2: Evaluation
93
+ # ============================================================
94
+
95
+ let evaluation = session: evaluator
96
+ prompt: """
97
+ Evaluate this run.
98
+
99
+ Target: {target}
100
+ Depth: {depth}
101
+ Data: {extraction}
102
+ Prior findings: {prior}
103
+
104
+ FOR vm (if target=vm or all):
105
+ - completion (1-10): Clean finish?
106
+ - binding_integrity (1-10): Expected outputs exist with content?
107
+ - vm_verdict: pass/partial/fail
108
+ - vm_notes: 1-2 sentences
109
+
110
+ FOR task (if target=task or all):
111
+ - output_substance (1-10): Outputs look real, not empty/error?
112
+ - goal_alignment (1-10): Based on program name, does output fit?
113
+ - task_verdict: pass/partial/fail
114
+ - task_notes: 1-2 sentences
115
+
116
+ IF depth=deep, add:
117
+ - fidelity (1-10): Execution trace matches program structure?
118
+ - efficiency (1-10): Reasonable number of steps for the job?
119
+
120
+ Return JSON with all applicable fields.
121
+ """
122
+ context: extraction
123
+
124
+ # ============================================================
125
+ # Phase 3: Synthesis
126
+ # ============================================================
127
+
128
+ parallel:
129
+ verdict = session: synthesizer
130
+ prompt: """
131
+ Machine-readable verdict as JSON:
132
+ {
133
+ "run_id": "...",
134
+ "depth": "{depth}",
135
+ "target": "{target}",
136
+ "vm": { "verdict": "...", "scores": {...} },
137
+ "task": { "verdict": "...", "scores": {...} },
138
+ "flags": []
139
+ }
140
+
141
+ Data: {evaluation}
142
+ """
143
+ context: evaluation
144
+
145
+ diagram = session: synthesizer
146
+ prompt: """
147
+ Simple mermaid flowchart of the run.
148
+ Show: inputs -> key steps -> outputs.
149
+ Use execution_summary if available, else infer from bindings.
150
+ Output only the mermaid code.
151
+
152
+ Data: {extraction}
153
+ """
154
+ context: extraction
155
+
156
+ report = session: synthesizer
157
+ prompt: """
158
+ 2-paragraph markdown summary:
159
+ 1. What was inspected, key metrics
160
+ 2. Findings and any recommendations
161
+
162
+ Data: {extraction}, {evaluation}
163
+ """
164
+ context: { extraction, evaluation }
165
+
166
+ # ============================================================
167
+ # Phase 4: Register
168
+ # ============================================================
169
+
170
+ resume: index
171
+ prompt: """
172
+ Register this inspection:
173
+ run_path: {run_path}
174
+ depth: {depth}
175
+ target: {target}
176
+ verdict: {verdict}
177
+
178
+ Update your memory with this entry.
179
+ """
180
+ context: verdict
181
+
182
+ # ============================================================
183
+ # Output
184
+ # ============================================================
185
+
186
+ output inspection = session: synthesizer
187
+ prompt: """
188
+ Combine into final output structure:
189
+
190
+ verdict_json: {verdict}
191
+ mermaid: {diagram}
192
+ summary: {report}
193
+
194
+ Return as JSON with these three fields.
195
+ """
196
+ context: { verdict, diagram, report }