@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,574 @@
1
+ ---
2
+ role: sqlite-state-management
3
+ status: experimental
4
+ summary: |
5
+ SQLite-based state management for OpenProse programs. This approach persists
6
+ execution state to a SQLite database, enabling structured queries, atomic
7
+ transactions, and flexible schema evolution.
8
+ requires: sqlite3 CLI tool in PATH
9
+ see-also:
10
+ - ../prose.md: VM execution semantics
11
+ - filesystem.md: File-based state (default, more prescriptive)
12
+ - in-context.md: In-context state (for simple programs)
13
+ - ../primitives/session.md: Session context and compaction guidelines
14
+ ---
15
+
16
+ # SQLite State Management (Experimental)
17
+
18
+ This document describes how the OpenProse VM tracks execution state using a **SQLite database**. This is an experimental alternative to file-based state (`filesystem.md`) and in-context state (`in-context.md`).
19
+
20
+ ## Prerequisites
21
+
22
+ **Requires:** The `sqlite3` command-line tool must be available in your PATH.
23
+
24
+ | Platform | Installation |
25
+ | -------- | ---------------------------------------------------------- |
26
+ | macOS | Pre-installed |
27
+ | Linux | `apt install sqlite3` / `dnf install sqlite3` / etc. |
28
+ | Windows | `winget install SQLite.SQLite` or download from sqlite.org |
29
+
30
+ If `sqlite3` is not available, the VM will fall back to filesystem state and warn the user.
31
+
32
+ ---
33
+
34
+ ## Overview
35
+
36
+ SQLite state provides:
37
+
38
+ - **Atomic transactions**: State changes are ACID-compliant
39
+ - **Structured queries**: Find specific bindings, filter by status, aggregate results
40
+ - **Flexible schema**: Add columns and tables as needed
41
+ - **Single-file portability**: The entire run state is one `.db` file
42
+ - **Concurrent access**: SQLite handles locking automatically
43
+
44
+ **Key principle:** The database is a flexible workspace. The VM and subagents share it as a coordination mechanism, not a rigid contract.
45
+
46
+ ---
47
+
48
+ ## Database Location
49
+
50
+ The database lives within the standard run directory:
51
+
52
+ ```
53
+ .prose/runs/{YYYYMMDD}-{HHMMSS}-{random}/
54
+ ├── state.db # SQLite database (this file)
55
+ ├── program.prose # Copy of running program
56
+ └── attachments/ # Large outputs that don't fit in DB (optional)
57
+ ```
58
+
59
+ **Run ID format:** Same as filesystem state: `{YYYYMMDD}-{HHMMSS}-{random6}`
60
+
61
+ Example: `.prose/runs/20260116-143052-a7b3c9/state.db`
62
+
63
+ ### Project-Scoped and User-Scoped Agents
64
+
65
+ Execution-scoped agents (the default) live in the per-run `state.db`. However, **project-scoped agents** (`persist: project`) and **user-scoped agents** (`persist: user`) must survive across runs.
66
+
67
+ For project-scoped agents, use a separate database:
68
+
69
+ ```
70
+ .prose/
71
+ ├── agents.db # Project-scoped agent memory (survives runs)
72
+ └── runs/
73
+ └── {id}/
74
+ └── state.db # Execution-scoped state (dies with run)
75
+ ```
76
+
77
+ For user-scoped agents, use a database in the home directory:
78
+
79
+ ```
80
+ ~/.prose/
81
+ └── agents.db # User-scoped agent memory (survives across projects)
82
+ ```
83
+
84
+ The `agents` and `agent_segments` tables for project-scoped agents live in `.prose/agents.db`, and for user-scoped agents live in `~/.prose/agents.db`. The VM initializes these databases on first use and provides the correct path to subagents.
85
+
86
+ ---
87
+
88
+ ## Responsibility Separation
89
+
90
+ This section defines **who does what**. This is the contract between the VM and subagents.
91
+
92
+ ### VM Responsibilities
93
+
94
+ The VM (the orchestrating agent running the .prose program) is responsible for:
95
+
96
+ | Responsibility | Description |
97
+ | ------------------------- | -------------------------------------------------------------------------------------------------------- |
98
+ | **Database creation** | Create `state.db` and initialize core tables at run start |
99
+ | **Program registration** | Store the program source and metadata |
100
+ | **Execution tracking** | Update position, status, and timing as statements execute |
101
+ | **Subagent spawning** | Spawn sessions via Task tool with database path and instructions |
102
+ | **Parallel coordination** | Track branch status, implement join strategies |
103
+ | **Loop management** | Track iteration counts, evaluate conditions |
104
+ | **Error aggregation** | Record failures, manage retry state |
105
+ | **Context preservation** | Maintain sufficient narration in the main conversation thread so execution can be understood and resumed |
106
+ | **Completion detection** | Mark the run as complete when finished |
107
+
108
+ **Critical:** The VM must preserve enough context in its own conversation to understand execution state without re-reading the entire database. The database is for coordination and persistence, not a replacement for working memory.
109
+
110
+ ### Subagent Responsibilities
111
+
112
+ Subagents (sessions spawned by the VM) are responsible for:
113
+
114
+ | Responsibility | Description |
115
+ | ----------------------- | ----------------------------------------------------------------- |
116
+ | **Writing own outputs** | Insert/update their binding in the `bindings` table |
117
+ | **Memory management** | For persistent agents: read and update their memory record |
118
+ | **Segment recording** | For persistent agents: append segment history |
119
+ | **Attachment handling** | Write large outputs to `attachments/` directory, store path in DB |
120
+ | **Atomic writes** | Use transactions when updating multiple related records |
121
+
122
+ **Critical:** Subagents write ONLY to `bindings`, `agents`, and `agent_segments` tables. The VM owns the `execution` table entirely. Completion signaling happens through the substrate (Task tool return), not database updates.
123
+
124
+ **Critical:** Subagents must write their outputs directly to the database. The VM does not write subagent outputs—it only reads them after the subagent completes.
125
+
126
+ **What subagents return to the VM:** A confirmation message with the binding location—not the full content:
127
+
128
+ **Root scope:**
129
+
130
+ ```
131
+ Binding written: research
132
+ Location: .prose/runs/20260116-143052-a7b3c9/state.db (bindings table, name='research', execution_id=NULL)
133
+ Summary: AI safety research covering alignment, robustness, and interpretability with 15 citations.
134
+ ```
135
+
136
+ **Inside block invocation:**
137
+
138
+ ```
139
+ Binding written: result
140
+ Location: .prose/runs/20260116-143052-a7b3c9/state.db (bindings table, name='result', execution_id=43)
141
+ Execution ID: 43
142
+ Summary: Processed chunk into 3 sub-parts for recursive processing.
143
+ ```
144
+
145
+ The VM tracks locations, not values. This keeps the VM's context lean and enables arbitrarily large intermediate values.
146
+
147
+ ### Shared Concerns
148
+
149
+ | Concern | Who Handles |
150
+ | ---------------- | ------------------------------------------------------------------ |
151
+ | Schema evolution | Either (use `CREATE TABLE IF NOT EXISTS`, `ALTER TABLE` as needed) |
152
+ | Custom tables | Either (prefix with `x_` for extensions) |
153
+ | Indexing | Either (add indexes for frequently-queried columns) |
154
+ | Cleanup | VM (at run end, optionally vacuum) |
155
+
156
+ ---
157
+
158
+ ## Core Schema
159
+
160
+ The VM initializes these tables. This is a **minimum viable schema**—extend freely.
161
+
162
+ ```sql
163
+ -- Run metadata
164
+ CREATE TABLE IF NOT EXISTS run (
165
+ id TEXT PRIMARY KEY,
166
+ program_path TEXT,
167
+ program_source TEXT,
168
+ started_at TEXT DEFAULT (datetime('now')),
169
+ updated_at TEXT DEFAULT (datetime('now')),
170
+ status TEXT DEFAULT 'running', -- running, completed, failed, interrupted
171
+ state_mode TEXT DEFAULT 'sqlite'
172
+ );
173
+
174
+ -- Execution position and history
175
+ CREATE TABLE IF NOT EXISTS execution (
176
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
177
+ statement_index INTEGER,
178
+ statement_text TEXT,
179
+ status TEXT, -- pending, executing, completed, failed, skipped
180
+ started_at TEXT,
181
+ completed_at TEXT,
182
+ error_message TEXT,
183
+ parent_id INTEGER REFERENCES execution(id), -- for nested blocks
184
+ metadata TEXT -- JSON for construct-specific data (loop iteration, parallel branch, etc.)
185
+ );
186
+
187
+ -- All named values (input, output, let, const)
188
+ CREATE TABLE IF NOT EXISTS bindings (
189
+ name TEXT,
190
+ execution_id INTEGER, -- NULL for root scope, non-null for block invocations
191
+ kind TEXT, -- input, output, let, const
192
+ value TEXT,
193
+ source_statement TEXT,
194
+ created_at TEXT DEFAULT (datetime('now')),
195
+ updated_at TEXT DEFAULT (datetime('now')),
196
+ attachment_path TEXT, -- if value is too large, store path to file
197
+ PRIMARY KEY (name, IFNULL(execution_id, -1)) -- IFNULL handles NULL for root scope
198
+ );
199
+
200
+ -- Persistent agent memory
201
+ CREATE TABLE IF NOT EXISTS agents (
202
+ name TEXT PRIMARY KEY,
203
+ scope TEXT, -- execution, project, user, custom
204
+ memory TEXT,
205
+ created_at TEXT DEFAULT (datetime('now')),
206
+ updated_at TEXT DEFAULT (datetime('now'))
207
+ );
208
+
209
+ -- Agent invocation history
210
+ CREATE TABLE IF NOT EXISTS agent_segments (
211
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
212
+ agent_name TEXT REFERENCES agents(name),
213
+ segment_number INTEGER,
214
+ timestamp TEXT DEFAULT (datetime('now')),
215
+ prompt TEXT,
216
+ summary TEXT,
217
+ UNIQUE(agent_name, segment_number)
218
+ );
219
+
220
+ -- Import registry
221
+ CREATE TABLE IF NOT EXISTS imports (
222
+ alias TEXT PRIMARY KEY,
223
+ source_url TEXT,
224
+ fetched_at TEXT,
225
+ inputs_schema TEXT, -- JSON
226
+ outputs_schema TEXT -- JSON
227
+ );
228
+ ```
229
+
230
+ ### Schema Conventions
231
+
232
+ - **Timestamps**: Use ISO 8601 format (`datetime('now')`)
233
+ - **JSON fields**: Store structured data as JSON text in `metadata`, `*_schema` columns
234
+ - **Large values**: If a binding value exceeds ~100KB, write to `attachments/{name}.md` and store path
235
+ - **Extension tables**: Prefix with `x_` (e.g., `x_metrics`, `x_audit_log`)
236
+ - **Anonymous bindings**: Sessions without explicit capture (`session "..."` without `let x =`) use auto-generated names: `anon_001`, `anon_002`, etc.
237
+ - **Import bindings**: Prefix with import alias for scoping: `research.findings`, `research.sources`
238
+ - **Scoped bindings**: Use `execution_id` column—NULL for root scope, non-null for block invocations
239
+
240
+ ### Scope Resolution Query
241
+
242
+ For recursive blocks, bindings are scoped to their execution frame. Resolve variables by walking up the call stack:
243
+
244
+ ```sql
245
+ -- Find binding 'result' starting from execution_id 43
246
+ WITH RECURSIVE scope_chain AS (
247
+ -- Start with current execution
248
+ SELECT id, parent_id FROM execution WHERE id = 43
249
+ UNION ALL
250
+ -- Walk up to parent
251
+ SELECT e.id, e.parent_id
252
+ FROM execution e
253
+ JOIN scope_chain s ON e.id = s.parent_id
254
+ )
255
+ SELECT b.* FROM bindings b
256
+ LEFT JOIN scope_chain s ON b.execution_id = s.id
257
+ WHERE b.name = 'result'
258
+ AND (b.execution_id IN (SELECT id FROM scope_chain) OR b.execution_id IS NULL)
259
+ ORDER BY
260
+ CASE WHEN b.execution_id IS NULL THEN 1 ELSE 0 END, -- Prefer scoped over root
261
+ s.id DESC NULLS LAST -- Prefer deeper (more local) scope
262
+ LIMIT 1;
263
+ ```
264
+
265
+ **Simpler version if you know the scope chain:**
266
+
267
+ ```sql
268
+ -- Direct lookup: check current scope, then parent, then root
269
+ SELECT * FROM bindings
270
+ WHERE name = 'result'
271
+ AND (execution_id = 43 OR execution_id = 42 OR execution_id IS NULL)
272
+ ORDER BY execution_id DESC NULLS LAST
273
+ LIMIT 1;
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Database Interaction
279
+
280
+ Both VM and subagents interact via the `sqlite3` CLI.
281
+
282
+ ### From the VM
283
+
284
+ ```bash
285
+ # Initialize database
286
+ sqlite3 .prose/runs/20260116-143052-a7b3c9/state.db "CREATE TABLE IF NOT EXISTS..."
287
+
288
+ # Update execution position
289
+ sqlite3 .prose/runs/20260116-143052-a7b3c9/state.db "
290
+ INSERT INTO execution (statement_index, statement_text, status, started_at)
291
+ VALUES (3, 'session \"Research AI safety\"', 'executing', datetime('now'))
292
+ "
293
+
294
+ # Read a binding
295
+ sqlite3 -json .prose/runs/20260116-143052-a7b3c9/state.db "
296
+ SELECT value FROM bindings WHERE name = 'research'
297
+ "
298
+
299
+ # Check parallel branch status
300
+ sqlite3 .prose/runs/20260116-143052-a7b3c9/state.db "
301
+ SELECT statement_text, status FROM execution
302
+ WHERE json_extract(metadata, '$.parallel_id') = 'p1'
303
+ "
304
+ ```
305
+
306
+ ### From Subagents
307
+
308
+ The VM provides the database path and instructions when spawning:
309
+
310
+ **Root scope (outside block invocations):**
311
+
312
+ ```
313
+ Your output database is:
314
+ .prose/runs/20260116-143052-a7b3c9/state.db
315
+
316
+ When complete, write your output:
317
+
318
+ sqlite3 .prose/runs/20260116-143052-a7b3c9/state.db "
319
+ INSERT OR REPLACE INTO bindings (name, execution_id, kind, value, source_statement, updated_at)
320
+ VALUES (
321
+ 'research',
322
+ NULL, -- root scope
323
+ 'let',
324
+ 'AI safety research covers alignment, robustness...',
325
+ 'let research = session: researcher',
326
+ datetime('now')
327
+ )
328
+ "
329
+ ```
330
+
331
+ **Inside block invocation (include execution_id):**
332
+
333
+ ```
334
+ Execution scope:
335
+ execution_id: 43
336
+ block: process
337
+ depth: 3
338
+
339
+ Your output database is:
340
+ .prose/runs/20260116-143052-a7b3c9/state.db
341
+
342
+ When complete, write your output:
343
+
344
+ sqlite3 .prose/runs/20260116-143052-a7b3c9/state.db "
345
+ INSERT OR REPLACE INTO bindings (name, execution_id, kind, value, source_statement, updated_at)
346
+ VALUES (
347
+ 'result',
348
+ 43, -- scoped to this execution
349
+ 'let',
350
+ 'Processed chunk into 3 sub-parts...',
351
+ 'let result = session \"Process chunk\"',
352
+ datetime('now')
353
+ )
354
+ "
355
+ ```
356
+
357
+ For persistent agents (execution-scoped):
358
+
359
+ ```
360
+ Your memory is in the database:
361
+ .prose/runs/20260116-143052-a7b3c9/state.db
362
+
363
+ Read your current state:
364
+ sqlite3 -json .prose/runs/20260116-143052-a7b3c9/state.db "SELECT memory FROM agents WHERE name = 'captain'"
365
+
366
+ Update when done:
367
+ sqlite3 .prose/runs/20260116-143052-a7b3c9/state.db "UPDATE agents SET memory = '...', updated_at = datetime('now') WHERE name = 'captain'"
368
+
369
+ Record this segment:
370
+ sqlite3 .prose/runs/20260116-143052-a7b3c9/state.db "INSERT INTO agent_segments (agent_name, segment_number, prompt, summary) VALUES ('captain', 3, '...', '...')"
371
+ ```
372
+
373
+ For project-scoped agents, use `.prose/agents.db`. For user-scoped agents, use `~/.prose/agents.db`.
374
+
375
+ ---
376
+
377
+ ## Context Preservation in Main Thread
378
+
379
+ **This is critical.** The database is for persistence and coordination, but the VM must still maintain conversational context.
380
+
381
+ ### What the VM Must Narrate
382
+
383
+ Even with SQLite state, the VM should narrate key events in its conversation:
384
+
385
+ ```
386
+ [Position] Statement 3: let research = session: researcher
387
+ Spawning session, will write to state.db
388
+ [Task tool call]
389
+ [Success] Session complete, binding written to DB
390
+ [Binding] research = <stored in state.db>
391
+ ```
392
+
393
+ ### Why Both?
394
+
395
+ | Purpose | Mechanism |
396
+ | ------------------------- | -------------------------------------------------------------------- |
397
+ | **Working memory** | Conversation narration (what the VM "remembers" without re-querying) |
398
+ | **Durable state** | SQLite database (survives context limits, enables resumption) |
399
+ | **Subagent coordination** | SQLite database (shared access point) |
400
+ | **Debugging/inspection** | SQLite database (queryable history) |
401
+
402
+ The narration is the VM's "mental model" of execution. The database is the "source of truth" for resumption and inspection.
403
+
404
+ ---
405
+
406
+ ## Parallel Execution
407
+
408
+ For parallel blocks, the VM uses the `metadata` JSON field to track branches. **Only the VM writes to the `execution` table.**
409
+
410
+ ```sql
411
+ -- VM marks parallel start
412
+ INSERT INTO execution (statement_index, statement_text, status, metadata)
413
+ VALUES (5, 'parallel:', 'executing', '{"parallel_id": "p1", "strategy": "all", "branches": ["a", "b", "c"]}');
414
+
415
+ -- VM creates execution record for each branch
416
+ INSERT INTO execution (statement_index, statement_text, status, parent_id, metadata)
417
+ VALUES (6, 'a = session "Task A"', 'executing', 5, '{"parallel_id": "p1", "branch": "a"}');
418
+
419
+ -- Subagent writes its output to bindings table (see "From Subagents" section)
420
+ -- Task tool signals completion to VM via substrate
421
+
422
+ -- VM marks branch complete after Task returns
423
+ UPDATE execution SET status = 'completed', completed_at = datetime('now')
424
+ WHERE json_extract(metadata, '$.parallel_id') = 'p1' AND json_extract(metadata, '$.branch') = 'a';
425
+
426
+ -- VM checks if all branches complete
427
+ SELECT COUNT(*) as pending FROM execution
428
+ WHERE json_extract(metadata, '$.parallel_id') = 'p1' AND status != 'completed';
429
+ ```
430
+
431
+ ---
432
+
433
+ ## Loop Tracking
434
+
435
+ ```sql
436
+ -- Loop metadata tracks iteration state
437
+ INSERT INTO execution (statement_index, statement_text, status, metadata)
438
+ VALUES (10, 'loop until **analysis complete** (max: 5):', 'executing',
439
+ '{"loop_id": "l1", "max_iterations": 5, "current_iteration": 0, "condition": "**analysis complete**"}');
440
+
441
+ -- Update iteration
442
+ UPDATE execution
443
+ SET metadata = json_set(metadata, '$.current_iteration', 2),
444
+ updated_at = datetime('now')
445
+ WHERE json_extract(metadata, '$.loop_id') = 'l1';
446
+ ```
447
+
448
+ ---
449
+
450
+ ## Error Handling
451
+
452
+ ```sql
453
+ -- Record failure
454
+ UPDATE execution
455
+ SET status = 'failed',
456
+ error_message = 'Connection timeout after 30s',
457
+ completed_at = datetime('now')
458
+ WHERE id = 15;
459
+
460
+ -- Track retry attempts in metadata
461
+ UPDATE execution
462
+ SET metadata = json_set(metadata, '$.retry_attempt', 2, '$.max_retries', 3)
463
+ WHERE id = 15;
464
+ ```
465
+
466
+ ---
467
+
468
+ ## Large Outputs
469
+
470
+ When a binding value is too large for comfortable database storage (>100KB):
471
+
472
+ 1. Write content to `attachments/{binding_name}.md`
473
+ 2. Store the path in the `attachment_path` column
474
+ 3. Leave `value` as a summary or null
475
+
476
+ ```sql
477
+ INSERT INTO bindings (name, kind, value, attachment_path, source_statement)
478
+ VALUES (
479
+ 'full_report',
480
+ 'let',
481
+ 'Full analysis report (847KB) - see attachment',
482
+ 'attachments/full_report.md',
483
+ 'let full_report = session "Generate comprehensive report"'
484
+ );
485
+ ```
486
+
487
+ ---
488
+
489
+ ## Resuming Execution
490
+
491
+ To resume an interrupted run:
492
+
493
+ ```sql
494
+ -- Find current position
495
+ SELECT statement_index, statement_text, status
496
+ FROM execution
497
+ WHERE status = 'executing'
498
+ ORDER BY id DESC LIMIT 1;
499
+
500
+ -- Get all completed bindings
501
+ SELECT name, kind, value, attachment_path FROM bindings;
502
+
503
+ -- Get agent memory states
504
+ SELECT name, memory FROM agents;
505
+
506
+ -- Check parallel block status
507
+ SELECT json_extract(metadata, '$.branch') as branch, status
508
+ FROM execution
509
+ WHERE json_extract(metadata, '$.parallel_id') IS NOT NULL
510
+ AND parent_id = (SELECT id FROM execution WHERE status = 'executing' AND statement_text LIKE 'parallel:%');
511
+ ```
512
+
513
+ ---
514
+
515
+ ## Flexibility Encouragement
516
+
517
+ Unlike filesystem state, SQLite state is intentionally **less prescriptive**. The core schema is a starting point. You are encouraged to:
518
+
519
+ - **Add columns** to existing tables as needed
520
+ - **Create extension tables** (prefix with `x_`)
521
+ - **Store custom metrics** (timing, token counts, model info)
522
+ - **Build indexes** for your query patterns
523
+ - **Use JSON functions** for semi-structured data
524
+
525
+ Example extensions:
526
+
527
+ ```sql
528
+ -- Custom metrics table
529
+ CREATE TABLE x_metrics (
530
+ execution_id INTEGER REFERENCES execution(id),
531
+ metric_name TEXT,
532
+ metric_value REAL,
533
+ recorded_at TEXT DEFAULT (datetime('now'))
534
+ );
535
+
536
+ -- Add custom column
537
+ ALTER TABLE bindings ADD COLUMN token_count INTEGER;
538
+
539
+ -- Create index for common query
540
+ CREATE INDEX idx_execution_status ON execution(status);
541
+ ```
542
+
543
+ The database is your workspace. Use it.
544
+
545
+ ---
546
+
547
+ ## Comparison with Other Modes
548
+
549
+ | Aspect | filesystem.md | in-context.md | sqlite.md |
550
+ | ---------------------- | ------------------------- | -------------------- | ----------------------------- |
551
+ | **State location** | `.prose/runs/{id}/` files | Conversation history | `.prose/runs/{id}/state.db` |
552
+ | **Queryable** | Via file reads | No | Yes (SQL) |
553
+ | **Atomic updates** | No | N/A | Yes (transactions) |
554
+ | **Schema flexibility** | Rigid file structure | N/A | Flexible (add tables/columns) |
555
+ | **Resumption** | Read state.md | Re-read conversation | Query database |
556
+ | **Complexity ceiling** | High | Low (<30 statements) | High |
557
+ | **Dependency** | None | None | sqlite3 CLI |
558
+ | **Status** | Stable | Stable | **Experimental** |
559
+
560
+ ---
561
+
562
+ ## Summary
563
+
564
+ SQLite state management:
565
+
566
+ 1. Uses a **single database file** per run
567
+ 2. Provides **clear responsibility separation** between VM and subagents
568
+ 3. Enables **structured queries** for state inspection
569
+ 4. Supports **atomic transactions** for reliable updates
570
+ 5. Allows **flexible schema evolution** as needed
571
+ 6. Requires the **sqlite3 CLI** tool
572
+ 7. Is **experimental**—expect changes
573
+
574
+ The core contract: the VM manages execution flow and spawns subagents; subagents write their own outputs directly to the database. Both maintain the principle that what happens is recorded, and what is recorded can be queried.