@ultrakit/ultrakit 0.0.0

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 (704) hide show
  1. package/README.md +95 -0
  2. package/dist/index.d.ts +6 -0
  3. package/dist/index.js +5991 -0
  4. package/dist/template/.opencode/.env.example +196 -0
  5. package/dist/template/.opencode/.template-manifest.json +718 -0
  6. package/dist/template/.opencode/.version +1 -0
  7. package/dist/template/.opencode/AGENTS.md +573 -0
  8. package/dist/template/.opencode/AGENT_ALIGNMENT.md +564 -0
  9. package/dist/template/.opencode/README.md +79 -0
  10. package/dist/template/.opencode/agent/build.md +447 -0
  11. package/dist/template/.opencode/agent/explore.md +114 -0
  12. package/dist/template/.opencode/agent/general.md +201 -0
  13. package/dist/template/.opencode/agent/painter.md +83 -0
  14. package/dist/template/.opencode/agent/plan.md +469 -0
  15. package/dist/template/.opencode/agent/review.md +235 -0
  16. package/dist/template/.opencode/agent/scout.md +142 -0
  17. package/dist/template/.opencode/agent/vision.md +169 -0
  18. package/dist/template/.opencode/command/compound.md +240 -0
  19. package/dist/template/.opencode/command/create.md +298 -0
  20. package/dist/template/.opencode/command/curate.md +299 -0
  21. package/dist/template/.opencode/command/design.md +130 -0
  22. package/dist/template/.opencode/command/explore.md +170 -0
  23. package/dist/template/.opencode/command/handoff.md +149 -0
  24. package/dist/template/.opencode/command/health.md +356 -0
  25. package/dist/template/.opencode/command/init-context.md +297 -0
  26. package/dist/template/.opencode/command/init-user.md +125 -0
  27. package/dist/template/.opencode/command/init.md +115 -0
  28. package/dist/template/.opencode/command/iterate.md +200 -0
  29. package/dist/template/.opencode/command/lfg.md +173 -0
  30. package/dist/template/.opencode/command/plan.md +436 -0
  31. package/dist/template/.opencode/command/pr.md +166 -0
  32. package/dist/template/.opencode/command/research.md +128 -0
  33. package/dist/template/.opencode/command/resume.md +78 -0
  34. package/dist/template/.opencode/command/review-codebase.md +135 -0
  35. package/dist/template/.opencode/command/ship.md +390 -0
  36. package/dist/template/.opencode/command/status.md +126 -0
  37. package/dist/template/.opencode/command/ui-review.md +111 -0
  38. package/dist/template/.opencode/command/ui-slop-check.md +169 -0
  39. package/dist/template/.opencode/command/verify.md +173 -0
  40. package/dist/template/.opencode/context/README.md +29 -0
  41. package/dist/template/.opencode/context/git-context.md +32 -0
  42. package/dist/template/.opencode/dcp-prompts/defaults/README.md +40 -0
  43. package/dist/template/.opencode/dcp-prompts/defaults/compress-message.md +42 -0
  44. package/dist/template/.opencode/dcp-prompts/defaults/compress-range.md +59 -0
  45. package/dist/template/.opencode/dcp-prompts/defaults/context-limit-nudge.md +15 -0
  46. package/dist/template/.opencode/dcp-prompts/defaults/iteration-nudge.md +3 -0
  47. package/dist/template/.opencode/dcp-prompts/defaults/system.md +31 -0
  48. package/dist/template/.opencode/dcp-prompts/defaults/turn-nudge.md +7 -0
  49. package/dist/template/.opencode/dcp-prompts/overrides/compress-message.md +71 -0
  50. package/dist/template/.opencode/dcp.jsonc +115 -0
  51. package/dist/template/.opencode/memory/README.md +89 -0
  52. package/dist/template/.opencode/memory/_templates/design.md +59 -0
  53. package/dist/template/.opencode/memory/_templates/prd.md +203 -0
  54. package/dist/template/.opencode/memory/_templates/project.md +58 -0
  55. package/dist/template/.opencode/memory/_templates/proposal.md +38 -0
  56. package/dist/template/.opencode/memory/_templates/roadmap.md +93 -0
  57. package/dist/template/.opencode/memory/_templates/state.md +89 -0
  58. package/dist/template/.opencode/memory/_templates/tasks.md +198 -0
  59. package/dist/template/.opencode/memory/_templates/tech-stack.md +85 -0
  60. package/dist/template/.opencode/memory/_templates/user.md +26 -0
  61. package/dist/template/.opencode/memory/project/gotchas.md +67 -0
  62. package/dist/template/.opencode/memory/project/project.md +92 -0
  63. package/dist/template/.opencode/memory/project/roadmap.md +142 -0
  64. package/dist/template/.opencode/memory/project/state.md +84 -0
  65. package/dist/template/.opencode/memory/project/tech-stack.md +53 -0
  66. package/dist/template/.opencode/memory/project/user.md +45 -0
  67. package/dist/template/.opencode/memory/research/benchmark-framework.md +162 -0
  68. package/dist/template/.opencode/memory/research/ccpm-analysis.md +334 -0
  69. package/dist/template/.opencode/memory/research/context-management-analysis.md +685 -0
  70. package/dist/template/.opencode/memory/research/effectiveness-audit.md +213 -0
  71. package/dist/template/.opencode/memory/research/opencode-mcp-bug-report.md +129 -0
  72. package/dist/template/.opencode/memory/research/openspec-analysis.md +226 -0
  73. package/dist/template/.opencode/memory/session-context.md +40 -0
  74. package/dist/template/.opencode/opencode.json +1148 -0
  75. package/dist/template/.opencode/opencodex-fast.jsonc +3 -0
  76. package/dist/template/.opencode/package.json +21 -0
  77. package/dist/template/.opencode/plugin/README.md +81 -0
  78. package/dist/template/.opencode/plugin/copilot-auth.ts +1285 -0
  79. package/dist/template/.opencode/plugin/lib/capture.ts +177 -0
  80. package/dist/template/.opencode/plugin/lib/compact.ts +194 -0
  81. package/dist/template/.opencode/plugin/lib/compile.ts +253 -0
  82. package/dist/template/.opencode/plugin/lib/context.ts +198 -0
  83. package/dist/template/.opencode/plugin/lib/curator.ts +234 -0
  84. package/dist/template/.opencode/plugin/lib/db/graph.ts +253 -0
  85. package/dist/template/.opencode/plugin/lib/db/maintenance.ts +312 -0
  86. package/dist/template/.opencode/plugin/lib/db/observations.ts +304 -0
  87. package/dist/template/.opencode/plugin/lib/db/pipeline.ts +520 -0
  88. package/dist/template/.opencode/plugin/lib/db/schema.ts +687 -0
  89. package/dist/template/.opencode/plugin/lib/db/types.ts +284 -0
  90. package/dist/template/.opencode/plugin/lib/distill.ts +376 -0
  91. package/dist/template/.opencode/plugin/lib/index-generator.ts +170 -0
  92. package/dist/template/.opencode/plugin/lib/inject.ts +126 -0
  93. package/dist/template/.opencode/plugin/lib/lint.ts +359 -0
  94. package/dist/template/.opencode/plugin/lib/memory-admin-tools.ts +277 -0
  95. package/dist/template/.opencode/plugin/lib/memory-db.ts +100 -0
  96. package/dist/template/.opencode/plugin/lib/memory-helpers.ts +141 -0
  97. package/dist/template/.opencode/plugin/lib/memory-hooks.ts +399 -0
  98. package/dist/template/.opencode/plugin/lib/memory-tools.ts +535 -0
  99. package/dist/template/.opencode/plugin/lib/notify.ts +89 -0
  100. package/dist/template/.opencode/plugin/lib/operation-log.ts +110 -0
  101. package/dist/template/.opencode/plugin/lib/validate.ts +243 -0
  102. package/dist/template/.opencode/plugin/memory.ts +90 -0
  103. package/dist/template/.opencode/plugin/package.json +7 -0
  104. package/dist/template/.opencode/plugin/prompt-leverage.ts +191 -0
  105. package/dist/template/.opencode/plugin/rtk.ts +43 -0
  106. package/dist/template/.opencode/plugin/sdk/copilot/chat/convert-to-openai-compatible-chat-messages.ts +172 -0
  107. package/dist/template/.opencode/plugin/sdk/copilot/chat/get-response-metadata.ts +15 -0
  108. package/dist/template/.opencode/plugin/sdk/copilot/chat/map-openai-compatible-finish-reason.ts +19 -0
  109. package/dist/template/.opencode/plugin/sdk/copilot/chat/openai-compatible-api-types.ts +72 -0
  110. package/dist/template/.opencode/plugin/sdk/copilot/chat/openai-compatible-chat-language-model.ts +835 -0
  111. package/dist/template/.opencode/plugin/sdk/copilot/chat/openai-compatible-chat-options.ts +30 -0
  112. package/dist/template/.opencode/plugin/sdk/copilot/chat/openai-compatible-metadata-extractor.ts +48 -0
  113. package/dist/template/.opencode/plugin/sdk/copilot/chat/openai-compatible-prepare-tools.ts +92 -0
  114. package/dist/template/.opencode/plugin/sdk/copilot/copilot-provider.ts +101 -0
  115. package/dist/template/.opencode/plugin/sdk/copilot/index.ts +5 -0
  116. package/dist/template/.opencode/plugin/sdk/copilot/openai-compatible-error.ts +30 -0
  117. package/dist/template/.opencode/plugin/sdk/copilot/responses/convert-to-openai-responses-input.ts +335 -0
  118. package/dist/template/.opencode/plugin/sdk/copilot/responses/map-openai-responses-finish-reason.ts +22 -0
  119. package/dist/template/.opencode/plugin/sdk/copilot/responses/openai-config.ts +18 -0
  120. package/dist/template/.opencode/plugin/sdk/copilot/responses/openai-error.ts +22 -0
  121. package/dist/template/.opencode/plugin/sdk/copilot/responses/openai-responses-api-types.ts +214 -0
  122. package/dist/template/.opencode/plugin/sdk/copilot/responses/openai-responses-language-model.ts +1770 -0
  123. package/dist/template/.opencode/plugin/sdk/copilot/responses/openai-responses-prepare-tools.ts +173 -0
  124. package/dist/template/.opencode/plugin/sdk/copilot/responses/openai-responses-settings.ts +1 -0
  125. package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/code-interpreter.ts +87 -0
  126. package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/file-search.ts +127 -0
  127. package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/image-generation.ts +114 -0
  128. package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/local-shell.ts +64 -0
  129. package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/web-search-preview.ts +103 -0
  130. package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/web-search.ts +102 -0
  131. package/dist/template/.opencode/plugin/sessions.ts +457 -0
  132. package/dist/template/.opencode/plugin/skill-mcp.ts +618 -0
  133. package/dist/template/.opencode/plugin/tsconfig.json +16 -0
  134. package/dist/template/.opencode/skill/accessibility-audit/SKILL.md +191 -0
  135. package/dist/template/.opencode/skill/agent-evals/SKILL.md +208 -0
  136. package/dist/template/.opencode/skill/agent-teams/SKILL.md +268 -0
  137. package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +76 -0
  138. package/dist/template/.opencode/skill/api-and-interface-design/SKILL.md +162 -0
  139. package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +122 -0
  140. package/dist/template/.opencode/skill/augment-context-engine/mcp.json +6 -0
  141. package/dist/template/.opencode/skill/beads/SKILL.md +182 -0
  142. package/dist/template/.opencode/skill/beads/references/BEST_PRACTICES.md +27 -0
  143. package/dist/template/.opencode/skill/beads/references/BOUNDARIES.md +219 -0
  144. package/dist/template/.opencode/skill/beads/references/DEPENDENCIES.md +124 -0
  145. package/dist/template/.opencode/skill/beads/references/EXAMPLES.md +45 -0
  146. package/dist/template/.opencode/skill/beads/references/FILE_CLAIMING.md +101 -0
  147. package/dist/template/.opencode/skill/beads/references/GIT_SYNC.md +25 -0
  148. package/dist/template/.opencode/skill/beads/references/HIERARCHY.md +71 -0
  149. package/dist/template/.opencode/skill/beads/references/MULTI_AGENT.md +40 -0
  150. package/dist/template/.opencode/skill/beads/references/RESUMABILITY.md +177 -0
  151. package/dist/template/.opencode/skill/beads/references/SESSION_PROTOCOL.md +61 -0
  152. package/dist/template/.opencode/skill/beads/references/TASK_CREATION.md +38 -0
  153. package/dist/template/.opencode/skill/beads/references/TROUBLESHOOTING.md +38 -0
  154. package/dist/template/.opencode/skill/beads/references/WORKFLOWS.md +226 -0
  155. package/dist/template/.opencode/skill/brainstorming/SKILL.md +114 -0
  156. package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +222 -0
  157. package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +76 -0
  158. package/dist/template/.opencode/skill/chrome-devtools/mcp.json +19 -0
  159. package/dist/template/.opencode/skill/ci-cd-and-automation/SKILL.md +202 -0
  160. package/dist/template/.opencode/skill/cloudflare/SKILL.md +253 -0
  161. package/dist/template/.opencode/skill/cloudflare/references/agents-sdk/README.md +35 -0
  162. package/dist/template/.opencode/skill/cloudflare/references/agents-sdk/api.md +100 -0
  163. package/dist/template/.opencode/skill/cloudflare/references/agents-sdk/configuration.md +99 -0
  164. package/dist/template/.opencode/skill/cloudflare/references/agents-sdk/gotchas.md +59 -0
  165. package/dist/template/.opencode/skill/cloudflare/references/agents-sdk/patterns.md +89 -0
  166. package/dist/template/.opencode/skill/cloudflare/references/ai-gateway/README.md +695 -0
  167. package/dist/template/.opencode/skill/cloudflare/references/ai-search/README.md +14 -0
  168. package/dist/template/.opencode/skill/cloudflare/references/ai-search/api.md +38 -0
  169. package/dist/template/.opencode/skill/cloudflare/references/ai-search/configuration.md +52 -0
  170. package/dist/template/.opencode/skill/cloudflare/references/ai-search/gotchas.md +41 -0
  171. package/dist/template/.opencode/skill/cloudflare/references/ai-search/patterns.md +45 -0
  172. package/dist/template/.opencode/skill/cloudflare/references/analytics-engine/README.md +14 -0
  173. package/dist/template/.opencode/skill/cloudflare/references/analytics-engine/api.md +27 -0
  174. package/dist/template/.opencode/skill/cloudflare/references/analytics-engine/configuration.md +45 -0
  175. package/dist/template/.opencode/skill/cloudflare/references/analytics-engine/gotchas.md +3 -0
  176. package/dist/template/.opencode/skill/cloudflare/references/analytics-engine/patterns.md +36 -0
  177. package/dist/template/.opencode/skill/cloudflare/references/api/README.md +21 -0
  178. package/dist/template/.opencode/skill/cloudflare/references/api/api.md +31 -0
  179. package/dist/template/.opencode/skill/cloudflare/references/api/configuration.md +20 -0
  180. package/dist/template/.opencode/skill/cloudflare/references/api/gotchas.md +28 -0
  181. package/dist/template/.opencode/skill/cloudflare/references/api/patterns.md +47 -0
  182. package/dist/template/.opencode/skill/cloudflare/references/api-shield/README.md +20 -0
  183. package/dist/template/.opencode/skill/cloudflare/references/api-shield/api.md +78 -0
  184. package/dist/template/.opencode/skill/cloudflare/references/api-shield/configuration.md +128 -0
  185. package/dist/template/.opencode/skill/cloudflare/references/api-shield/gotchas.md +51 -0
  186. package/dist/template/.opencode/skill/cloudflare/references/api-shield/patterns.md +145 -0
  187. package/dist/template/.opencode/skill/cloudflare/references/argo-smart-routing/README.md +16 -0
  188. package/dist/template/.opencode/skill/cloudflare/references/argo-smart-routing/api.md +50 -0
  189. package/dist/template/.opencode/skill/cloudflare/references/argo-smart-routing/configuration.md +53 -0
  190. package/dist/template/.opencode/skill/cloudflare/references/argo-smart-routing/gotchas.md +16 -0
  191. package/dist/template/.opencode/skill/cloudflare/references/argo-smart-routing/patterns.md +45 -0
  192. package/dist/template/.opencode/skill/cloudflare/references/bindings/README.md +14 -0
  193. package/dist/template/.opencode/skill/cloudflare/references/bindings/api.md +3 -0
  194. package/dist/template/.opencode/skill/cloudflare/references/bindings/configuration.md +58 -0
  195. package/dist/template/.opencode/skill/cloudflare/references/bindings/gotchas.md +35 -0
  196. package/dist/template/.opencode/skill/cloudflare/references/bindings/patterns.md +37 -0
  197. package/dist/template/.opencode/skill/cloudflare/references/bot-management/README.md +71 -0
  198. package/dist/template/.opencode/skill/cloudflare/references/bot-management/api.md +168 -0
  199. package/dist/template/.opencode/skill/cloudflare/references/bot-management/configuration.md +114 -0
  200. package/dist/template/.opencode/skill/cloudflare/references/bot-management/gotchas.md +99 -0
  201. package/dist/template/.opencode/skill/cloudflare/references/bot-management/patterns.md +125 -0
  202. package/dist/template/.opencode/skill/cloudflare/references/browser-rendering/README.md +16 -0
  203. package/dist/template/.opencode/skill/cloudflare/references/browser-rendering/api.md +54 -0
  204. package/dist/template/.opencode/skill/cloudflare/references/browser-rendering/configuration.md +47 -0
  205. package/dist/template/.opencode/skill/cloudflare/references/browser-rendering/gotchas.md +29 -0
  206. package/dist/template/.opencode/skill/cloudflare/references/browser-rendering/patterns.md +29 -0
  207. package/dist/template/.opencode/skill/cloudflare/references/c3/README.md +264 -0
  208. package/dist/template/.opencode/skill/cloudflare/references/cache-reserve/README.md +93 -0
  209. package/dist/template/.opencode/skill/cloudflare/references/cache-reserve/api.md +176 -0
  210. package/dist/template/.opencode/skill/cloudflare/references/cache-reserve/configuration.md +164 -0
  211. package/dist/template/.opencode/skill/cloudflare/references/cache-reserve/gotchas.md +203 -0
  212. package/dist/template/.opencode/skill/cloudflare/references/cache-reserve/patterns.md +180 -0
  213. package/dist/template/.opencode/skill/cloudflare/references/containers/README.md +16 -0
  214. package/dist/template/.opencode/skill/cloudflare/references/containers/api.md +43 -0
  215. package/dist/template/.opencode/skill/cloudflare/references/containers/configuration.md +56 -0
  216. package/dist/template/.opencode/skill/cloudflare/references/containers/gotchas.md +21 -0
  217. package/dist/template/.opencode/skill/cloudflare/references/containers/patterns.md +40 -0
  218. package/dist/template/.opencode/skill/cloudflare/references/cron-triggers/README.md +85 -0
  219. package/dist/template/.opencode/skill/cloudflare/references/cron-triggers/api.md +198 -0
  220. package/dist/template/.opencode/skill/cloudflare/references/cron-triggers/configuration.md +151 -0
  221. package/dist/template/.opencode/skill/cloudflare/references/cron-triggers/gotchas.md +129 -0
  222. package/dist/template/.opencode/skill/cloudflare/references/cron-triggers/patterns.md +122 -0
  223. package/dist/template/.opencode/skill/cloudflare/references/d1/README.md +92 -0
  224. package/dist/template/.opencode/skill/cloudflare/references/d1/api.md +141 -0
  225. package/dist/template/.opencode/skill/cloudflare/references/d1/configuration.md +127 -0
  226. package/dist/template/.opencode/skill/cloudflare/references/d1/gotchas.md +70 -0
  227. package/dist/template/.opencode/skill/cloudflare/references/d1/patterns.md +144 -0
  228. package/dist/template/.opencode/skill/cloudflare/references/ddos/README.md +34 -0
  229. package/dist/template/.opencode/skill/cloudflare/references/ddos/api.md +136 -0
  230. package/dist/template/.opencode/skill/cloudflare/references/ddos/configuration.md +67 -0
  231. package/dist/template/.opencode/skill/cloudflare/references/ddos/gotchas.md +114 -0
  232. package/dist/template/.opencode/skill/cloudflare/references/ddos/patterns.md +158 -0
  233. package/dist/template/.opencode/skill/cloudflare/references/do-storage/README.md +62 -0
  234. package/dist/template/.opencode/skill/cloudflare/references/do-storage/api.md +89 -0
  235. package/dist/template/.opencode/skill/cloudflare/references/do-storage/configuration.md +116 -0
  236. package/dist/template/.opencode/skill/cloudflare/references/do-storage/gotchas.md +93 -0
  237. package/dist/template/.opencode/skill/cloudflare/references/do-storage/patterns.md +112 -0
  238. package/dist/template/.opencode/skill/cloudflare/references/durable-objects/README.md +125 -0
  239. package/dist/template/.opencode/skill/cloudflare/references/durable-objects/api.md +152 -0
  240. package/dist/template/.opencode/skill/cloudflare/references/durable-objects/configuration.md +148 -0
  241. package/dist/template/.opencode/skill/cloudflare/references/durable-objects/gotchas.md +158 -0
  242. package/dist/template/.opencode/skill/cloudflare/references/durable-objects/patterns.md +255 -0
  243. package/dist/template/.opencode/skill/cloudflare/references/email-routing/README.md +18 -0
  244. package/dist/template/.opencode/skill/cloudflare/references/email-routing/api.md +46 -0
  245. package/dist/template/.opencode/skill/cloudflare/references/email-routing/configuration.md +63 -0
  246. package/dist/template/.opencode/skill/cloudflare/references/email-routing/gotchas.md +16 -0
  247. package/dist/template/.opencode/skill/cloudflare/references/email-routing/patterns.md +46 -0
  248. package/dist/template/.opencode/skill/cloudflare/references/email-workers/README.md +598 -0
  249. package/dist/template/.opencode/skill/cloudflare/references/hyperdrive/README.md +62 -0
  250. package/dist/template/.opencode/skill/cloudflare/references/hyperdrive/api.md +137 -0
  251. package/dist/template/.opencode/skill/cloudflare/references/hyperdrive/configuration.md +133 -0
  252. package/dist/template/.opencode/skill/cloudflare/references/hyperdrive/gotchas.md +184 -0
  253. package/dist/template/.opencode/skill/cloudflare/references/hyperdrive/patterns.md +176 -0
  254. package/dist/template/.opencode/skill/cloudflare/references/images/README.md +14 -0
  255. package/dist/template/.opencode/skill/cloudflare/references/images/api.md +3 -0
  256. package/dist/template/.opencode/skill/cloudflare/references/images/configuration.md +45 -0
  257. package/dist/template/.opencode/skill/cloudflare/references/images/gotchas.md +23 -0
  258. package/dist/template/.opencode/skill/cloudflare/references/images/patterns.md +31 -0
  259. package/dist/template/.opencode/skill/cloudflare/references/kv/README.md +60 -0
  260. package/dist/template/.opencode/skill/cloudflare/references/kv/api.md +114 -0
  261. package/dist/template/.opencode/skill/cloudflare/references/kv/configuration.md +92 -0
  262. package/dist/template/.opencode/skill/cloudflare/references/kv/gotchas.md +117 -0
  263. package/dist/template/.opencode/skill/cloudflare/references/kv/patterns.md +139 -0
  264. package/dist/template/.opencode/skill/cloudflare/references/miniflare/README.md +64 -0
  265. package/dist/template/.opencode/skill/cloudflare/references/miniflare/api.md +144 -0
  266. package/dist/template/.opencode/skill/cloudflare/references/miniflare/configuration.md +203 -0
  267. package/dist/template/.opencode/skill/cloudflare/references/miniflare/gotchas.md +187 -0
  268. package/dist/template/.opencode/skill/cloudflare/references/miniflare/patterns.md +211 -0
  269. package/dist/template/.opencode/skill/cloudflare/references/network-interconnect/README.md +60 -0
  270. package/dist/template/.opencode/skill/cloudflare/references/network-interconnect/api.md +240 -0
  271. package/dist/template/.opencode/skill/cloudflare/references/network-interconnect/configuration.md +127 -0
  272. package/dist/template/.opencode/skill/cloudflare/references/network-interconnect/gotchas.md +171 -0
  273. package/dist/template/.opencode/skill/cloudflare/references/network-interconnect/patterns.md +171 -0
  274. package/dist/template/.opencode/skill/cloudflare/references/observability/README.md +18 -0
  275. package/dist/template/.opencode/skill/cloudflare/references/observability/api.md +51 -0
  276. package/dist/template/.opencode/skill/cloudflare/references/observability/configuration.md +60 -0
  277. package/dist/template/.opencode/skill/cloudflare/references/observability/gotchas.md +36 -0
  278. package/dist/template/.opencode/skill/cloudflare/references/observability/patterns.md +42 -0
  279. package/dist/template/.opencode/skill/cloudflare/references/pages/README.md +76 -0
  280. package/dist/template/.opencode/skill/cloudflare/references/pages/api.md +200 -0
  281. package/dist/template/.opencode/skill/cloudflare/references/pages/configuration.md +228 -0
  282. package/dist/template/.opencode/skill/cloudflare/references/pages/gotchas.md +161 -0
  283. package/dist/template/.opencode/skill/cloudflare/references/pages/patterns.md +145 -0
  284. package/dist/template/.opencode/skill/cloudflare/references/pages-functions/README.md +57 -0
  285. package/dist/template/.opencode/skill/cloudflare/references/pages-functions/api.md +201 -0
  286. package/dist/template/.opencode/skill/cloudflare/references/pages-functions/configuration.md +159 -0
  287. package/dist/template/.opencode/skill/cloudflare/references/pages-functions/gotchas.md +151 -0
  288. package/dist/template/.opencode/skill/cloudflare/references/pages-functions/patterns.md +190 -0
  289. package/dist/template/.opencode/skill/cloudflare/references/pipelines/README.md +664 -0
  290. package/dist/template/.opencode/skill/cloudflare/references/pulumi/README.md +107 -0
  291. package/dist/template/.opencode/skill/cloudflare/references/pulumi/api.md +194 -0
  292. package/dist/template/.opencode/skill/cloudflare/references/pulumi/configuration.md +216 -0
  293. package/dist/template/.opencode/skill/cloudflare/references/pulumi/gotchas.md +223 -0
  294. package/dist/template/.opencode/skill/cloudflare/references/pulumi/patterns.md +139 -0
  295. package/dist/template/.opencode/skill/cloudflare/references/queues/README.md +69 -0
  296. package/dist/template/.opencode/skill/cloudflare/references/queues/api.md +138 -0
  297. package/dist/template/.opencode/skill/cloudflare/references/queues/configuration.md +125 -0
  298. package/dist/template/.opencode/skill/cloudflare/references/queues/gotchas.md +112 -0
  299. package/dist/template/.opencode/skill/cloudflare/references/queues/patterns.md +155 -0
  300. package/dist/template/.opencode/skill/cloudflare/references/r2/README.md +61 -0
  301. package/dist/template/.opencode/skill/cloudflare/references/r2/api.md +127 -0
  302. package/dist/template/.opencode/skill/cloudflare/references/r2/configuration.md +76 -0
  303. package/dist/template/.opencode/skill/cloudflare/references/r2/gotchas.md +94 -0
  304. package/dist/template/.opencode/skill/cloudflare/references/r2/patterns.md +127 -0
  305. package/dist/template/.opencode/skill/cloudflare/references/r2-data-catalog/README.md +18 -0
  306. package/dist/template/.opencode/skill/cloudflare/references/r2-data-catalog/api.md +29 -0
  307. package/dist/template/.opencode/skill/cloudflare/references/r2-data-catalog/configuration.md +39 -0
  308. package/dist/template/.opencode/skill/cloudflare/references/r2-data-catalog/gotchas.md +20 -0
  309. package/dist/template/.opencode/skill/cloudflare/references/r2-data-catalog/patterns.md +46 -0
  310. package/dist/template/.opencode/skill/cloudflare/references/r2-sql/README.md +512 -0
  311. package/dist/template/.opencode/skill/cloudflare/references/realtime-sfu/README.md +21 -0
  312. package/dist/template/.opencode/skill/cloudflare/references/realtime-sfu/api.md +135 -0
  313. package/dist/template/.opencode/skill/cloudflare/references/realtime-sfu/configuration.md +63 -0
  314. package/dist/template/.opencode/skill/cloudflare/references/realtime-sfu/gotchas.md +75 -0
  315. package/dist/template/.opencode/skill/cloudflare/references/realtime-sfu/patterns.md +102 -0
  316. package/dist/template/.opencode/skill/cloudflare/references/realtimekit/README.md +81 -0
  317. package/dist/template/.opencode/skill/cloudflare/references/realtimekit/api.md +164 -0
  318. package/dist/template/.opencode/skill/cloudflare/references/realtimekit/configuration.md +147 -0
  319. package/dist/template/.opencode/skill/cloudflare/references/realtimekit/gotchas.md +172 -0
  320. package/dist/template/.opencode/skill/cloudflare/references/realtimekit/patterns.md +155 -0
  321. package/dist/template/.opencode/skill/cloudflare/references/sandbox/README.md +90 -0
  322. package/dist/template/.opencode/skill/cloudflare/references/sandbox/api.md +178 -0
  323. package/dist/template/.opencode/skill/cloudflare/references/sandbox/configuration.md +131 -0
  324. package/dist/template/.opencode/skill/cloudflare/references/sandbox/gotchas.md +156 -0
  325. package/dist/template/.opencode/skill/cloudflare/references/sandbox/patterns.md +203 -0
  326. package/dist/template/.opencode/skill/cloudflare/references/secrets-store/README.md +58 -0
  327. package/dist/template/.opencode/skill/cloudflare/references/secrets-store/api.md +182 -0
  328. package/dist/template/.opencode/skill/cloudflare/references/secrets-store/configuration.md +140 -0
  329. package/dist/template/.opencode/skill/cloudflare/references/secrets-store/gotchas.md +129 -0
  330. package/dist/template/.opencode/skill/cloudflare/references/secrets-store/patterns.md +218 -0
  331. package/dist/template/.opencode/skill/cloudflare/references/smart-placement/README.md +91 -0
  332. package/dist/template/.opencode/skill/cloudflare/references/smart-placement/api.md +139 -0
  333. package/dist/template/.opencode/skill/cloudflare/references/smart-placement/configuration.md +129 -0
  334. package/dist/template/.opencode/skill/cloudflare/references/smart-placement/gotchas.md +87 -0
  335. package/dist/template/.opencode/skill/cloudflare/references/smart-placement/patterns.md +135 -0
  336. package/dist/template/.opencode/skill/cloudflare/references/snippets/README.md +15 -0
  337. package/dist/template/.opencode/skill/cloudflare/references/snippets/api.md +47 -0
  338. package/dist/template/.opencode/skill/cloudflare/references/snippets/configuration.md +33 -0
  339. package/dist/template/.opencode/skill/cloudflare/references/snippets/gotchas.md +21 -0
  340. package/dist/template/.opencode/skill/cloudflare/references/snippets/patterns.md +34 -0
  341. package/dist/template/.opencode/skill/cloudflare/references/spectrum/README.md +16 -0
  342. package/dist/template/.opencode/skill/cloudflare/references/spectrum/api.md +24 -0
  343. package/dist/template/.opencode/skill/cloudflare/references/spectrum/configuration.md +43 -0
  344. package/dist/template/.opencode/skill/cloudflare/references/spectrum/gotchas.md +42 -0
  345. package/dist/template/.opencode/skill/cloudflare/references/spectrum/patterns.md +40 -0
  346. package/dist/template/.opencode/skill/cloudflare/references/static-assets/README.md +14 -0
  347. package/dist/template/.opencode/skill/cloudflare/references/static-assets/api.md +3 -0
  348. package/dist/template/.opencode/skill/cloudflare/references/static-assets/configuration.md +47 -0
  349. package/dist/template/.opencode/skill/cloudflare/references/static-assets/gotchas.md +44 -0
  350. package/dist/template/.opencode/skill/cloudflare/references/static-assets/patterns.md +42 -0
  351. package/dist/template/.opencode/skill/cloudflare/references/stream/README.md +103 -0
  352. package/dist/template/.opencode/skill/cloudflare/references/stream/api.md +204 -0
  353. package/dist/template/.opencode/skill/cloudflare/references/stream/configuration.md +127 -0
  354. package/dist/template/.opencode/skill/cloudflare/references/stream/gotchas.md +131 -0
  355. package/dist/template/.opencode/skill/cloudflare/references/stream/patterns.md +152 -0
  356. package/dist/template/.opencode/skill/cloudflare/references/tail-workers/README.md +640 -0
  357. package/dist/template/.opencode/skill/cloudflare/references/terraform/README.md +76 -0
  358. package/dist/template/.opencode/skill/cloudflare/references/terraform/api.md +159 -0
  359. package/dist/template/.opencode/skill/cloudflare/references/terraform/configuration.md +156 -0
  360. package/dist/template/.opencode/skill/cloudflare/references/terraform/gotchas.md +207 -0
  361. package/dist/template/.opencode/skill/cloudflare/references/terraform/patterns.md +135 -0
  362. package/dist/template/.opencode/skill/cloudflare/references/tunnel/README.md +82 -0
  363. package/dist/template/.opencode/skill/cloudflare/references/tunnel/api.md +105 -0
  364. package/dist/template/.opencode/skill/cloudflare/references/tunnel/configuration.md +113 -0
  365. package/dist/template/.opencode/skill/cloudflare/references/tunnel/gotchas.md +115 -0
  366. package/dist/template/.opencode/skill/cloudflare/references/tunnel/patterns.md +157 -0
  367. package/dist/template/.opencode/skill/cloudflare/references/turn/README.md +699 -0
  368. package/dist/template/.opencode/skill/cloudflare/references/turnstile/README.md +14 -0
  369. package/dist/template/.opencode/skill/cloudflare/references/turnstile/api.md +3 -0
  370. package/dist/template/.opencode/skill/cloudflare/references/turnstile/configuration.md +19 -0
  371. package/dist/template/.opencode/skill/cloudflare/references/turnstile/gotchas.md +27 -0
  372. package/dist/template/.opencode/skill/cloudflare/references/turnstile/patterns.md +41 -0
  373. package/dist/template/.opencode/skill/cloudflare/references/vectorize/README.md +682 -0
  374. package/dist/template/.opencode/skill/cloudflare/references/waf/README.md +14 -0
  375. package/dist/template/.opencode/skill/cloudflare/references/waf/api.md +3 -0
  376. package/dist/template/.opencode/skill/cloudflare/references/waf/configuration.md +44 -0
  377. package/dist/template/.opencode/skill/cloudflare/references/waf/gotchas.md +24 -0
  378. package/dist/template/.opencode/skill/cloudflare/references/waf/patterns.md +29 -0
  379. package/dist/template/.opencode/skill/cloudflare/references/web-analytics/README.md +19 -0
  380. package/dist/template/.opencode/skill/cloudflare/references/web-analytics/api.md +52 -0
  381. package/dist/template/.opencode/skill/cloudflare/references/web-analytics/configuration.md +31 -0
  382. package/dist/template/.opencode/skill/cloudflare/references/web-analytics/gotchas.md +28 -0
  383. package/dist/template/.opencode/skill/cloudflare/references/web-analytics/patterns.md +52 -0
  384. package/dist/template/.opencode/skill/cloudflare/references/workerd/README.md +47 -0
  385. package/dist/template/.opencode/skill/cloudflare/references/workerd/api.md +199 -0
  386. package/dist/template/.opencode/skill/cloudflare/references/workerd/configuration.md +185 -0
  387. package/dist/template/.opencode/skill/cloudflare/references/workerd/gotchas.md +203 -0
  388. package/dist/template/.opencode/skill/cloudflare/references/workerd/patterns.md +216 -0
  389. package/dist/template/.opencode/skill/cloudflare/references/workers/README.md +96 -0
  390. package/dist/template/.opencode/skill/cloudflare/references/workers/api.md +137 -0
  391. package/dist/template/.opencode/skill/cloudflare/references/workers/configuration.md +147 -0
  392. package/dist/template/.opencode/skill/cloudflare/references/workers/gotchas.md +99 -0
  393. package/dist/template/.opencode/skill/cloudflare/references/workers/patterns.md +149 -0
  394. package/dist/template/.opencode/skill/cloudflare/references/workers-ai/README.md +116 -0
  395. package/dist/template/.opencode/skill/cloudflare/references/workers-for-platforms/README.md +48 -0
  396. package/dist/template/.opencode/skill/cloudflare/references/workers-for-platforms/api.md +169 -0
  397. package/dist/template/.opencode/skill/cloudflare/references/workers-for-platforms/configuration.md +136 -0
  398. package/dist/template/.opencode/skill/cloudflare/references/workers-for-platforms/gotchas.md +130 -0
  399. package/dist/template/.opencode/skill/cloudflare/references/workers-for-platforms/patterns.md +170 -0
  400. package/dist/template/.opencode/skill/cloudflare/references/workers-playground/README.md +16 -0
  401. package/dist/template/.opencode/skill/cloudflare/references/workers-playground/api.md +20 -0
  402. package/dist/template/.opencode/skill/cloudflare/references/workers-playground/configuration.md +3 -0
  403. package/dist/template/.opencode/skill/cloudflare/references/workers-playground/gotchas.md +35 -0
  404. package/dist/template/.opencode/skill/cloudflare/references/workers-playground/patterns.md +42 -0
  405. package/dist/template/.opencode/skill/cloudflare/references/workers-vpc/README.md +579 -0
  406. package/dist/template/.opencode/skill/cloudflare/references/workflows/README.md +62 -0
  407. package/dist/template/.opencode/skill/cloudflare/references/workflows/api.md +125 -0
  408. package/dist/template/.opencode/skill/cloudflare/references/workflows/configuration.md +177 -0
  409. package/dist/template/.opencode/skill/cloudflare/references/workflows/gotchas.md +136 -0
  410. package/dist/template/.opencode/skill/cloudflare/references/workflows/patterns.md +132 -0
  411. package/dist/template/.opencode/skill/cloudflare/references/wrangler/README.md +90 -0
  412. package/dist/template/.opencode/skill/cloudflare/references/wrangler/api.md +140 -0
  413. package/dist/template/.opencode/skill/cloudflare/references/wrangler/configuration.md +128 -0
  414. package/dist/template/.opencode/skill/cloudflare/references/wrangler/gotchas.md +93 -0
  415. package/dist/template/.opencode/skill/cloudflare/references/wrangler/patterns.md +150 -0
  416. package/dist/template/.opencode/skill/cloudflare/references/zaraz/README.md +360 -0
  417. package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +253 -0
  418. package/dist/template/.opencode/skill/code-simplification/SKILL.md +211 -0
  419. package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +135 -0
  420. package/dist/template/.opencode/skill/condition-based-waiting/example.ts +158 -0
  421. package/dist/template/.opencode/skill/context-condensation/SKILL.md +149 -0
  422. package/dist/template/.opencode/skill/context-engineering/SKILL.md +176 -0
  423. package/dist/template/.opencode/skill/context-initialization/SKILL.md +69 -0
  424. package/dist/template/.opencode/skill/context-management/SKILL.md +390 -0
  425. package/dist/template/.opencode/skill/core-data-expert/SKILL.md +93 -0
  426. package/dist/template/.opencode/skill/core-data-expert/references/batch-operations.md +543 -0
  427. package/dist/template/.opencode/skill/core-data-expert/references/cloudkit-integration.md +259 -0
  428. package/dist/template/.opencode/skill/core-data-expert/references/concurrency.md +522 -0
  429. package/dist/template/.opencode/skill/core-data-expert/references/fetch-requests.md +643 -0
  430. package/dist/template/.opencode/skill/core-data-expert/references/glossary.md +233 -0
  431. package/dist/template/.opencode/skill/core-data-expert/references/migration.md +393 -0
  432. package/dist/template/.opencode/skill/core-data-expert/references/model-configuration.md +597 -0
  433. package/dist/template/.opencode/skill/core-data-expert/references/performance.md +300 -0
  434. package/dist/template/.opencode/skill/core-data-expert/references/persistent-history.md +553 -0
  435. package/dist/template/.opencode/skill/core-data-expert/references/project-audit.md +60 -0
  436. package/dist/template/.opencode/skill/core-data-expert/references/saving.md +574 -0
  437. package/dist/template/.opencode/skill/core-data-expert/references/stack-setup.md +625 -0
  438. package/dist/template/.opencode/skill/core-data-expert/references/testing.md +300 -0
  439. package/dist/template/.opencode/skill/core-data-expert/references/threading.md +589 -0
  440. package/dist/template/.opencode/skill/deep-research/SKILL.md +384 -0
  441. package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +176 -0
  442. package/dist/template/.opencode/skill/deprecation-and-migration/SKILL.md +189 -0
  443. package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +139 -0
  444. package/dist/template/.opencode/skill/design-system-audit/SKILL.md +153 -0
  445. package/dist/template/.opencode/skill/design-taste-frontend/SKILL.md +238 -0
  446. package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +320 -0
  447. package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +191 -0
  448. package/dist/template/.opencode/skill/documentation-and-adrs/SKILL.md +220 -0
  449. package/dist/template/.opencode/skill/executing-plans/SKILL.md +247 -0
  450. package/dist/template/.opencode/skill/figma/SKILL.md +224 -0
  451. package/dist/template/.opencode/skill/figma-go/SKILL.md +65 -0
  452. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +357 -0
  453. package/dist/template/.opencode/skill/frontend-design/SKILL.md +235 -0
  454. package/dist/template/.opencode/skill/frontend-design/references/animation/motion-advanced.md +224 -0
  455. package/dist/template/.opencode/skill/frontend-design/references/animation/motion-core.md +181 -0
  456. package/dist/template/.opencode/skill/frontend-design/references/canvas/execution.md +90 -0
  457. package/dist/template/.opencode/skill/frontend-design/references/canvas/philosophy.md +94 -0
  458. package/dist/template/.opencode/skill/frontend-design/references/design/color-system.md +111 -0
  459. package/dist/template/.opencode/skill/frontend-design/references/design/interaction.md +149 -0
  460. package/dist/template/.opencode/skill/frontend-design/references/design/typography-rules.md +106 -0
  461. package/dist/template/.opencode/skill/frontend-design/references/design/ux-writing.md +99 -0
  462. package/dist/template/.opencode/skill/frontend-design/references/shadcn/accessibility.md +132 -0
  463. package/dist/template/.opencode/skill/frontend-design/references/shadcn/core-components.md +153 -0
  464. package/dist/template/.opencode/skill/frontend-design/references/shadcn/form-components.md +158 -0
  465. package/dist/template/.opencode/skill/frontend-design/references/shadcn/setup.md +69 -0
  466. package/dist/template/.opencode/skill/frontend-design/references/shadcn/theming.md +152 -0
  467. package/dist/template/.opencode/skill/frontend-design/references/tailwind/responsive.md +112 -0
  468. package/dist/template/.opencode/skill/frontend-design/references/tailwind/utilities-layout.md +134 -0
  469. package/dist/template/.opencode/skill/frontend-design/references/tailwind/utilities-styling.md +165 -0
  470. package/dist/template/.opencode/skill/frontend-design/references/tailwind/v4-config.md +147 -0
  471. package/dist/template/.opencode/skill/frontend-design/references/tailwind/v4-features.md +128 -0
  472. package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +62 -0
  473. package/dist/template/.opencode/skill/gemini-large-context/SKILL.md +216 -0
  474. package/dist/template/.opencode/skill/gh-address-comments/SKILL.md +29 -0
  475. package/dist/template/.opencode/skill/gh-address-comments/scripts/fetch_comments.py +237 -0
  476. package/dist/template/.opencode/skill/gh-fix-ci/SKILL.md +38 -0
  477. package/dist/template/.opencode/skill/gh-fix-ci/scripts/inspect_pr_checks.py +509 -0
  478. package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +253 -0
  479. package/dist/template/.opencode/skill/high-end-visual-design/SKILL.md +111 -0
  480. package/dist/template/.opencode/skill/html-deck-export/SKILL.md +189 -0
  481. package/dist/template/.opencode/skill/incremental-implementation/SKILL.md +191 -0
  482. package/dist/template/.opencode/skill/index-knowledge/SKILL.md +413 -0
  483. package/dist/template/.opencode/skill/industrial-brutalist-ui/SKILL.md +105 -0
  484. package/dist/template/.opencode/skill/jira/SKILL.md +283 -0
  485. package/dist/template/.opencode/skill/jira/mcp.json +6 -0
  486. package/dist/template/.opencode/skill/memory-grounding/SKILL.md +68 -0
  487. package/dist/template/.opencode/skill/memory-system/SKILL.md +148 -0
  488. package/dist/template/.opencode/skill/minimalist-ui/SKILL.md +98 -0
  489. package/dist/template/.opencode/skill/mockup-to-code/SKILL.md +184 -0
  490. package/dist/template/.opencode/skill/opensrc/SKILL.md +284 -0
  491. package/dist/template/.opencode/skill/opensrc/references/architecture.md +176 -0
  492. package/dist/template/.opencode/skill/opensrc/references/cli-usage.md +176 -0
  493. package/dist/template/.opencode/skill/opensrc/references/registry-support.md +137 -0
  494. package/dist/template/.opencode/skill/pdf-extract/SKILL.md +438 -0
  495. package/dist/template/.opencode/skill/performance-optimization/SKILL.md +236 -0
  496. package/dist/template/.opencode/skill/playwright/SKILL.md +381 -0
  497. package/dist/template/.opencode/skill/playwright/mcp.json +16 -0
  498. package/dist/template/.opencode/skill/playwright/references/agent-browser-cli.md +405 -0
  499. package/dist/template/.opencode/skill/playwriter/SKILL.md +158 -0
  500. package/dist/template/.opencode/skill/polar/SKILL.md +102 -0
  501. package/dist/template/.opencode/skill/portless/SKILL.md +109 -0
  502. package/dist/template/.opencode/skill/prd/SKILL.md +146 -0
  503. package/dist/template/.opencode/skill/prd-task/SKILL.md +182 -0
  504. package/dist/template/.opencode/skill/prd-task/references/prd-schema.json +124 -0
  505. package/dist/template/.opencode/skill/prompt-leverage/SKILL.md +90 -0
  506. package/dist/template/.opencode/skill/prompt-leverage/references/framework.md +91 -0
  507. package/dist/template/.opencode/skill/prompt-leverage/scripts/augment_prompt.py +157 -0
  508. package/dist/template/.opencode/skill/react-best-practices/AGENTS.md +2410 -0
  509. package/dist/template/.opencode/skill/react-best-practices/README.md +123 -0
  510. package/dist/template/.opencode/skill/react-best-practices/SKILL.md +133 -0
  511. package/dist/template/.opencode/skill/react-best-practices/metadata.json +15 -0
  512. package/dist/template/.opencode/skill/react-best-practices/rules/_sections.md +46 -0
  513. package/dist/template/.opencode/skill/react-best-practices/rules/_template.md +28 -0
  514. package/dist/template/.opencode/skill/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  515. package/dist/template/.opencode/skill/react-best-practices/rules/advanced-use-latest.md +49 -0
  516. package/dist/template/.opencode/skill/react-best-practices/rules/async-api-routes.md +38 -0
  517. package/dist/template/.opencode/skill/react-best-practices/rules/async-defer-await.md +80 -0
  518. package/dist/template/.opencode/skill/react-best-practices/rules/async-dependencies.md +36 -0
  519. package/dist/template/.opencode/skill/react-best-practices/rules/async-parallel.md +28 -0
  520. package/dist/template/.opencode/skill/react-best-practices/rules/async-suspense-boundaries.md +99 -0
  521. package/dist/template/.opencode/skill/react-best-practices/rules/bundle-barrel-imports.md +59 -0
  522. package/dist/template/.opencode/skill/react-best-practices/rules/bundle-conditional.md +31 -0
  523. package/dist/template/.opencode/skill/react-best-practices/rules/bundle-defer-third-party.md +49 -0
  524. package/dist/template/.opencode/skill/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  525. package/dist/template/.opencode/skill/react-best-practices/rules/bundle-preload.md +50 -0
  526. package/dist/template/.opencode/skill/react-best-practices/rules/client-event-listeners.md +74 -0
  527. package/dist/template/.opencode/skill/react-best-practices/rules/client-localstorage-schema.md +71 -0
  528. package/dist/template/.opencode/skill/react-best-practices/rules/client-passive-event-listeners.md +48 -0
  529. package/dist/template/.opencode/skill/react-best-practices/rules/client-swr-dedup.md +56 -0
  530. package/dist/template/.opencode/skill/react-best-practices/rules/js-batch-dom-css.md +82 -0
  531. package/dist/template/.opencode/skill/react-best-practices/rules/js-cache-function-results.md +80 -0
  532. package/dist/template/.opencode/skill/react-best-practices/rules/js-cache-property-access.md +28 -0
  533. package/dist/template/.opencode/skill/react-best-practices/rules/js-cache-storage.md +70 -0
  534. package/dist/template/.opencode/skill/react-best-practices/rules/js-combine-iterations.md +32 -0
  535. package/dist/template/.opencode/skill/react-best-practices/rules/js-early-exit.md +50 -0
  536. package/dist/template/.opencode/skill/react-best-practices/rules/js-hoist-regexp.md +45 -0
  537. package/dist/template/.opencode/skill/react-best-practices/rules/js-index-maps.md +37 -0
  538. package/dist/template/.opencode/skill/react-best-practices/rules/js-length-check-first.md +49 -0
  539. package/dist/template/.opencode/skill/react-best-practices/rules/js-min-max-loop.md +82 -0
  540. package/dist/template/.opencode/skill/react-best-practices/rules/js-set-map-lookups.md +24 -0
  541. package/dist/template/.opencode/skill/react-best-practices/rules/js-tosorted-immutable.md +57 -0
  542. package/dist/template/.opencode/skill/react-best-practices/rules/rendering-activity.md +26 -0
  543. package/dist/template/.opencode/skill/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  544. package/dist/template/.opencode/skill/react-best-practices/rules/rendering-conditional-render.md +40 -0
  545. package/dist/template/.opencode/skill/react-best-practices/rules/rendering-content-visibility.md +38 -0
  546. package/dist/template/.opencode/skill/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  547. package/dist/template/.opencode/skill/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  548. package/dist/template/.opencode/skill/react-best-practices/rules/rendering-svg-precision.md +28 -0
  549. package/dist/template/.opencode/skill/react-best-practices/rules/rerender-defer-reads.md +39 -0
  550. package/dist/template/.opencode/skill/react-best-practices/rules/rerender-dependencies.md +45 -0
  551. package/dist/template/.opencode/skill/react-best-practices/rules/rerender-derived-state.md +29 -0
  552. package/dist/template/.opencode/skill/react-best-practices/rules/rerender-functional-setstate.md +74 -0
  553. package/dist/template/.opencode/skill/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  554. package/dist/template/.opencode/skill/react-best-practices/rules/rerender-memo.md +44 -0
  555. package/dist/template/.opencode/skill/react-best-practices/rules/rerender-transitions.md +40 -0
  556. package/dist/template/.opencode/skill/react-best-practices/rules/server-after-nonblocking.md +73 -0
  557. package/dist/template/.opencode/skill/react-best-practices/rules/server-cache-lru.md +41 -0
  558. package/dist/template/.opencode/skill/react-best-practices/rules/server-cache-react.md +76 -0
  559. package/dist/template/.opencode/skill/react-best-practices/rules/server-parallel-fetching.md +83 -0
  560. package/dist/template/.opencode/skill/react-best-practices/rules/server-serialization.md +38 -0
  561. package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +263 -0
  562. package/dist/template/.opencode/skill/reconcile/SKILL.md +183 -0
  563. package/dist/template/.opencode/skill/redesign-existing-projects/SKILL.md +191 -0
  564. package/dist/template/.opencode/skill/reflection-checkpoints/SKILL.md +183 -0
  565. package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +443 -0
  566. package/dist/template/.opencode/skill/requesting-code-review/references/specialist-profiles.md +108 -0
  567. package/dist/template/.opencode/skill/requesting-code-review/review.md +160 -0
  568. package/dist/template/.opencode/skill/resend/SKILL.md +177 -0
  569. package/dist/template/.opencode/skill/resend/references/react-email.md +287 -0
  570. package/dist/template/.opencode/skill/resend/references/receive-email.md +248 -0
  571. package/dist/template/.opencode/skill/resend/references/send-email.md +318 -0
  572. package/dist/template/.opencode/skill/root-cause-tracing/SKILL.md +192 -0
  573. package/dist/template/.opencode/skill/root-cause-tracing/find-polluter.sh +63 -0
  574. package/dist/template/.opencode/skill/rtk-command-compression/SKILL.md +134 -0
  575. package/dist/template/.opencode/skill/screenshot/SKILL.md +48 -0
  576. package/dist/template/.opencode/skill/screenshot/scripts/ensure_macos_permissions.sh +54 -0
  577. package/dist/template/.opencode/skill/screenshot/scripts/macos_display_info.swift +22 -0
  578. package/dist/template/.opencode/skill/screenshot/scripts/macos_permissions.swift +40 -0
  579. package/dist/template/.opencode/skill/screenshot/scripts/macos_window_info.swift +126 -0
  580. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.ps1 +163 -0
  581. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.py +585 -0
  582. package/dist/template/.opencode/skill/security-and-hardening/SKILL.md +296 -0
  583. package/dist/template/.opencode/skill/security-threat-model/SKILL.md +36 -0
  584. package/dist/template/.opencode/skill/security-threat-model/references/prompt-template.md +255 -0
  585. package/dist/template/.opencode/skill/security-threat-model/references/security-controls-and-assets.md +32 -0
  586. package/dist/template/.opencode/skill/sharing-skills/SKILL.md +214 -0
  587. package/dist/template/.opencode/skill/skill-creator/SKILL.md +181 -0
  588. package/dist/template/.opencode/skill/skill-installer/SKILL.md +58 -0
  589. package/dist/template/.opencode/skill/skill-installer/scripts/github_utils.py +21 -0
  590. package/dist/template/.opencode/skill/skill-installer/scripts/install-skill-from-github.py +313 -0
  591. package/dist/template/.opencode/skill/skill-installer/scripts/list-skills.py +106 -0
  592. package/dist/template/.opencode/skill/structured-edit/SKILL.md +191 -0
  593. package/dist/template/.opencode/skill/subagent-driven-development/SKILL.md +237 -0
  594. package/dist/template/.opencode/skill/supabase/SKILL.md +130 -0
  595. package/dist/template/.opencode/skill/supabase/mcp.json +27 -0
  596. package/dist/template/.opencode/skill/supabase-postgres-best-practices/AGENTS.md +1490 -0
  597. package/dist/template/.opencode/skill/supabase-postgres-best-practices/SKILL.md +65 -0
  598. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/advanced-full-text-search.md +55 -0
  599. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/advanced-jsonb-indexing.md +49 -0
  600. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/conn-idle-timeout.md +46 -0
  601. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/conn-limits.md +44 -0
  602. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/conn-pooling.md +41 -0
  603. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/conn-prepared-statements.md +46 -0
  604. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/data-batch-inserts.md +54 -0
  605. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/data-n-plus-one.md +53 -0
  606. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/data-pagination.md +50 -0
  607. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/data-upsert.md +50 -0
  608. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/lock-advisory.md +56 -0
  609. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/lock-deadlock-prevention.md +68 -0
  610. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/lock-short-transactions.md +50 -0
  611. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/lock-skip-locked.md +54 -0
  612. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/monitor-explain-analyze.md +45 -0
  613. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/monitor-pg-stat-statements.md +55 -0
  614. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/monitor-vacuum-analyze.md +55 -0
  615. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/query-composite-indexes.md +44 -0
  616. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/query-covering-indexes.md +40 -0
  617. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/query-index-types.md +45 -0
  618. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/query-missing-indexes.md +43 -0
  619. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/query-partial-indexes.md +45 -0
  620. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/schema-data-types.md +46 -0
  621. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/schema-foreign-key-indexes.md +59 -0
  622. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/schema-lowercase-identifiers.md +55 -0
  623. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/schema-partitioning.md +55 -0
  624. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/schema-primary-keys.md +61 -0
  625. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/security-privileges.md +54 -0
  626. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/security-rls-basics.md +50 -0
  627. package/dist/template/.opencode/skill/supabase-postgres-best-practices/rules/security-rls-performance.md +57 -0
  628. package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +244 -0
  629. package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +39 -0
  630. package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +145 -0
  631. package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +50 -0
  632. package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +90 -0
  633. package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +20 -0
  634. package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +186 -0
  635. package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +172 -0
  636. package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +78 -0
  637. package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +134 -0
  638. package/dist/template/.opencode/skill/swift-concurrency/SKILL.md +266 -0
  639. package/dist/template/.opencode/skill/swift-concurrency/references/actors.md +640 -0
  640. package/dist/template/.opencode/skill/swift-concurrency/references/async-algorithms.md +822 -0
  641. package/dist/template/.opencode/skill/swift-concurrency/references/async-await-basics.md +249 -0
  642. package/dist/template/.opencode/skill/swift-concurrency/references/async-sequences.md +670 -0
  643. package/dist/template/.opencode/skill/swift-concurrency/references/core-data.md +533 -0
  644. package/dist/template/.opencode/skill/swift-concurrency/references/glossary.md +128 -0
  645. package/dist/template/.opencode/skill/swift-concurrency/references/linting.md +142 -0
  646. package/dist/template/.opencode/skill/swift-concurrency/references/memory-management.md +542 -0
  647. package/dist/template/.opencode/skill/swift-concurrency/references/migration.md +1076 -0
  648. package/dist/template/.opencode/skill/swift-concurrency/references/performance.md +574 -0
  649. package/dist/template/.opencode/skill/swift-concurrency/references/sendable.md +578 -0
  650. package/dist/template/.opencode/skill/swift-concurrency/references/tasks.md +604 -0
  651. package/dist/template/.opencode/skill/swift-concurrency/references/testing.md +565 -0
  652. package/dist/template/.opencode/skill/swift-concurrency/references/threading.md +452 -0
  653. package/dist/template/.opencode/skill/swiftui-expert-skill/SKILL.md +329 -0
  654. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-advanced.md +351 -0
  655. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-basics.md +284 -0
  656. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-transitions.md +326 -0
  657. package/dist/template/.opencode/skill/swiftui-expert-skill/references/image-optimization.md +286 -0
  658. package/dist/template/.opencode/skill/swiftui-expert-skill/references/layout-best-practices.md +312 -0
  659. package/dist/template/.opencode/skill/swiftui-expert-skill/references/liquid-glass.md +377 -0
  660. package/dist/template/.opencode/skill/swiftui-expert-skill/references/list-patterns.md +153 -0
  661. package/dist/template/.opencode/skill/swiftui-expert-skill/references/modern-apis.md +400 -0
  662. package/dist/template/.opencode/skill/swiftui-expert-skill/references/performance-patterns.md +377 -0
  663. package/dist/template/.opencode/skill/swiftui-expert-skill/references/scroll-patterns.md +305 -0
  664. package/dist/template/.opencode/skill/swiftui-expert-skill/references/sheet-navigation-patterns.md +292 -0
  665. package/dist/template/.opencode/skill/swiftui-expert-skill/references/state-management.md +447 -0
  666. package/dist/template/.opencode/skill/swiftui-expert-skill/references/text-formatting.md +285 -0
  667. package/dist/template/.opencode/skill/swiftui-expert-skill/references/view-structure.md +276 -0
  668. package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +402 -0
  669. package/dist/template/.opencode/skill/terse-output-mode/SKILL.md +95 -0
  670. package/dist/template/.opencode/skill/test-driven-development/SKILL.md +403 -0
  671. package/dist/template/.opencode/skill/testing-anti-patterns/SKILL.md +333 -0
  672. package/dist/template/.opencode/skill/think-in-code/SKILL.md +136 -0
  673. package/dist/template/.opencode/skill/using-git-worktrees/SKILL.md +259 -0
  674. package/dist/template/.opencode/skill/ux-quality-gates/SKILL.md +137 -0
  675. package/dist/template/.opencode/skill/v0/SKILL.md +158 -0
  676. package/dist/template/.opencode/skill/v1-run/SKILL.md +175 -0
  677. package/dist/template/.opencode/skill/v1-run/mcp.json +6 -0
  678. package/dist/template/.opencode/skill/vercel-deploy-claimable/SKILL.md +124 -0
  679. package/dist/template/.opencode/skill/vercel-deploy-claimable/scripts/deploy.sh +249 -0
  680. package/dist/template/.opencode/skill/verification-before-completion/SKILL.md +357 -0
  681. package/dist/template/.opencode/skill/verification-before-completion/references/VERIFICATION_PROTOCOL.md +171 -0
  682. package/dist/template/.opencode/skill/verification-gates/SKILL.md +63 -0
  683. package/dist/template/.opencode/skill/visual-analysis/SKILL.md +154 -0
  684. package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +46 -0
  685. package/dist/template/.opencode/skill/webclaw/SKILL.md +155 -0
  686. package/dist/template/.opencode/skill/workspace-setup/SKILL.md +76 -0
  687. package/dist/template/.opencode/skill/writing-plans/SKILL.md +320 -0
  688. package/dist/template/.opencode/skill/writing-skills/SKILL.md +324 -0
  689. package/dist/template/.opencode/skill/writing-skills/anthropic-best-practices.md +1173 -0
  690. package/dist/template/.opencode/skill/writing-skills/graphviz-conventions.dot +172 -0
  691. package/dist/template/.opencode/skill/writing-skills/persuasion-principles.md +220 -0
  692. package/dist/template/.opencode/skill/writing-skills/references/anti-patterns.md +25 -0
  693. package/dist/template/.opencode/skill/writing-skills/references/claude-search-optimization.md +140 -0
  694. package/dist/template/.opencode/skill/writing-skills/references/discovery-workflow.md +11 -0
  695. package/dist/template/.opencode/skill/writing-skills/references/file-organization.md +32 -0
  696. package/dist/template/.opencode/skill/writing-skills/references/flowcharts-and-examples.md +57 -0
  697. package/dist/template/.opencode/skill/writing-skills/references/rationalization-hardening.md +75 -0
  698. package/dist/template/.opencode/skill/writing-skills/references/testing-methodology.md +397 -0
  699. package/dist/template/.opencode/skill/writing-skills/references/testing-skill-types.md +52 -0
  700. package/dist/template/.opencode/tool/context7.ts +191 -0
  701. package/dist/template/.opencode/tool/grepsearch.ts +143 -0
  702. package/dist/template/.opencode/tsconfig.json +21 -0
  703. package/dist/template/.opencode/tui.json +15 -0
  704. package/package.json +78 -0
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Context Window Management Module
3
+ *
4
+ * Implements messages.transform: estimates token usage across conversation
5
+ * messages and compresses oldest messages when approaching the budget limit.
6
+ *
7
+ * Protects the most recent N messages from compression.
8
+ */
9
+
10
+ import { estimateTokens, MEMORY_CONFIG } from "./memory-db.js";
11
+
12
+ // ============================================================================
13
+ // Types
14
+ // ============================================================================
15
+
16
+ /** Minimal message shape from messages.transform output */
17
+ interface TransformMessage {
18
+ info: {
19
+ id?: string;
20
+ role?: string;
21
+ time?: {
22
+ created?: number;
23
+ };
24
+ };
25
+ parts: Array<{
26
+ type?: string;
27
+ text?: string;
28
+ data?: {
29
+ type?: string;
30
+ text?: string;
31
+ };
32
+ }>;
33
+ }
34
+
35
+ // ============================================================================
36
+ // Token Estimation
37
+ // ============================================================================
38
+
39
+ /**
40
+ * Estimate total tokens in a message (all text parts).
41
+ */
42
+ function estimateMessageTokens(msg: TransformMessage): number {
43
+ let total = 0;
44
+ for (const part of msg.parts) {
45
+ if (part.text) {
46
+ total += estimateTokens(part.text);
47
+ } else if (part.data?.text) {
48
+ total += estimateTokens(part.data.text);
49
+ }
50
+ }
51
+ // Add overhead for message framing (~10 tokens per message)
52
+ return total + 10;
53
+ }
54
+
55
+ /**
56
+ * Create a compressed summary of a message.
57
+ * Preserves non-text parts (tool calls, tool results, images) to maintain
58
+ * conversation coherence. Only compresses text parts.
59
+ */
60
+ function compressMessage(msg: TransformMessage): TransformMessage {
61
+ const role = msg.info.role ?? "unknown";
62
+
63
+ // Separate text parts from non-text parts (tool calls, tool results, etc.)
64
+ const textParts: Array<(typeof msg.parts)[number]> = [];
65
+ const nonTextParts: Array<(typeof msg.parts)[number]> = [];
66
+
67
+ for (const part of msg.parts) {
68
+ const isTextPart =
69
+ part.type === "text" || (!part.type && (part.text || part.data?.text));
70
+ if (isTextPart) {
71
+ textParts.push(part);
72
+ } else {
73
+ nonTextParts.push(part);
74
+ }
75
+ }
76
+
77
+ // Extract text content for summarization
78
+ const texts: string[] = [];
79
+ for (const part of textParts) {
80
+ if (part.text) texts.push(part.text);
81
+ else if (part.data?.text) texts.push(part.data.text);
82
+ }
83
+
84
+ const fullText = texts.join("\n");
85
+
86
+ // Build compressed parts: summarized text + preserved non-text parts
87
+ const compressedParts: typeof msg.parts = [];
88
+
89
+ if (fullText.length > 0) {
90
+ compressedParts.push({
91
+ type: "text",
92
+ text: createSummary(fullText, role),
93
+ });
94
+ }
95
+
96
+ // Preserve tool calls, tool results, and other structural parts
97
+ compressedParts.push(...nonTextParts);
98
+
99
+ return {
100
+ info: msg.info,
101
+ parts:
102
+ compressedParts.length > 0
103
+ ? compressedParts
104
+ : [{ type: "text", text: `[compressed ${role} message]` }],
105
+ };
106
+ }
107
+
108
+ /**
109
+ * Create a brief summary of message content.
110
+ * Keeps first and last sentence, truncates middle.
111
+ */
112
+ function createSummary(text: string, role: string): string {
113
+ const maxChars = 500;
114
+
115
+ if (text.length <= maxChars) return text;
116
+
117
+ // For very large messages (>5000 chars), be more aggressive
118
+ const isLarge = text.length > 5000;
119
+ const effectiveMax = isLarge ? 300 : maxChars;
120
+
121
+ // Split into sentences
122
+ const sentences = text
123
+ .split(/(?<=[.!?])\s+|\n+/)
124
+ .map((s) => s.trim())
125
+ .filter((s) => s.length > 0);
126
+
127
+ if (sentences.length <= 2) {
128
+ return `${text.slice(0, effectiveMax)}...`;
129
+ }
130
+
131
+ const first = sentences[0];
132
+ const last = sentences[sentences.length - 1];
133
+
134
+ const summary = `[compressed ${role}] ${first} [...${sentences.length - 2} sentences...] ${last}`;
135
+
136
+ return summary.length > effectiveMax
137
+ ? `${summary.slice(0, effectiveMax)}...`
138
+ : summary;
139
+ }
140
+
141
+ // ============================================================================
142
+ // Context Manager
143
+ // ============================================================================
144
+
145
+ /**
146
+ * Process messages through context management.
147
+ *
148
+ * If total tokens exceed maxContextTokens, compresses oldest messages
149
+ * (excluding the most recent `protectedMessages` count).
150
+ *
151
+ * @param messages - Current conversation messages
152
+ * @returns Potentially compressed messages array
153
+ */
154
+ export function manageContext(
155
+ messages: TransformMessage[],
156
+ ): TransformMessage[] {
157
+ if (!MEMORY_CONFIG.context.enabled) return messages;
158
+
159
+ const maxTokens = MEMORY_CONFIG.context.maxContextTokens;
160
+ const protectedCount = MEMORY_CONFIG.context.protectedMessages;
161
+
162
+ // Estimate total tokens
163
+ let totalTokens = 0;
164
+ const tokenCounts: number[] = [];
165
+
166
+ for (const msg of messages) {
167
+ const tokens = estimateMessageTokens(msg);
168
+ tokenCounts.push(tokens);
169
+ totalTokens += tokens;
170
+ }
171
+
172
+ // If under budget, return unchanged
173
+ if (totalTokens <= maxTokens) return messages;
174
+
175
+ // Calculate how many tokens to shed
176
+ const tokensToShed = totalTokens - maxTokens;
177
+
178
+ // Identify compressible messages (all except protected recent ones)
179
+ const compressibleEnd = Math.max(0, messages.length - protectedCount);
180
+ let shedSoFar = 0;
181
+
182
+ const result = [...messages];
183
+
184
+ // Compress from oldest to newest until we've shed enough
185
+ for (let i = 0; i < compressibleEnd && shedSoFar < tokensToShed; i++) {
186
+ const originalTokens = tokenCounts[i];
187
+ const compressed = compressMessage(messages[i]);
188
+ const compressedTokens = estimateMessageTokens(compressed);
189
+ const saved = originalTokens - compressedTokens;
190
+
191
+ if (saved > 0) {
192
+ result[i] = compressed;
193
+ shedSoFar += saved;
194
+ }
195
+ }
196
+
197
+ return result;
198
+ }
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Curator Module
3
+ *
4
+ * Pattern-matches distillations to automatically create observations.
5
+ * Uses regex patterns to detect decisions, bugfixes, patterns, discoveries, warnings.
6
+ * All curated observations are created with source='curator'.
7
+ *
8
+ * No LLM dependency — pure heuristic pattern matching.
9
+ */
10
+
11
+ import {
12
+ type DistillationRow,
13
+ getRecentDistillations,
14
+ MEMORY_CONFIG,
15
+ type ObservationInput,
16
+ type ObservationType,
17
+ storeObservation,
18
+ } from "./memory-db.js";
19
+
20
+ // ============================================================================
21
+ // Pattern Definitions
22
+ // ============================================================================
23
+
24
+ /** Curator patterns — regex + type mapping.
25
+ *
26
+ * Each pattern requires multi-word phrases or contextual markers to reduce
27
+ * false positives. Single common words like "using", "found", "always" are
28
+ * NOT matched alone — they must appear in decision/discovery phrases.
29
+ */
30
+ const CURATOR_PATTERNS: Array<{
31
+ type: ObservationType;
32
+ pattern: RegExp;
33
+ titleExtractor: (match: RegExpMatchArray, sentence: string) => string;
34
+ }> = [
35
+ {
36
+ type: "decision",
37
+ pattern:
38
+ /\b(decided to|chose to|selected\s+\w+\s+(?:over|instead)|went with|opted for|switched to|migrated to|picked\s+\w+\s+(?:over|for))\b/i,
39
+ titleExtractor: (_match, sentence) => truncateSentence(sentence, 80),
40
+ },
41
+ {
42
+ type: "bugfix",
43
+ pattern:
44
+ /\b(fixed (?:a|the|an)\b|resolved (?:a|the|an)\b|patched (?:a|the|an)\b|corrected (?:a|the|an)\b|bug in\b|error in\b|crash in\b|regression in\b)\b/i,
45
+ titleExtractor: (_match, sentence) => truncateSentence(sentence, 80),
46
+ },
47
+ {
48
+ type: "pattern",
49
+ pattern:
50
+ /\b(pattern(?::|is| for)\b|convention(?::|is)\b|best practice\b|standard practice\b|workflow for\b|(?:we|I|the team) (?:always|never)\b)\b/i,
51
+ titleExtractor: (_match, sentence) => truncateSentence(sentence, 80),
52
+ },
53
+ {
54
+ type: "discovery",
55
+ pattern:
56
+ /\b(found that|discovered that|noticed that|learned that|turns out|realized that|it (?:seems|appears) that)\b/i,
57
+ titleExtractor: (_match, sentence) => truncateSentence(sentence, 80),
58
+ },
59
+ {
60
+ type: "warning",
61
+ pattern:
62
+ /\b(warning:|caution:|careful with|gotcha:|pitfall(?:s|:)?\b|don't use\b|avoid (?:using|calling|importing)\b|beware of\b|watch out for\b|never (?:use|call|import|commit|push)\b)\b/i,
63
+ titleExtractor: (_match, sentence) => truncateSentence(sentence, 80),
64
+ },
65
+ ];
66
+
67
+ // ============================================================================
68
+ // Utilities
69
+ // ============================================================================
70
+
71
+ /**
72
+ * Truncate a sentence to max length, preserving word boundaries.
73
+ */
74
+ function truncateSentence(sentence: string, maxLen: number): string {
75
+ const clean = sentence.replace(/\s+/g, " ").trim();
76
+ if (clean.length <= maxLen) return clean;
77
+
78
+ const truncated = clean.slice(0, maxLen);
79
+ const lastSpace = truncated.lastIndexOf(" ");
80
+ return lastSpace > maxLen / 2
81
+ ? `${truncated.slice(0, lastSpace)}...`
82
+ : `${truncated}...`;
83
+ }
84
+
85
+ /**
86
+ * Split distillation content into sentences.
87
+ */
88
+ function splitSentences(content: string): string[] {
89
+ return content
90
+ .split(/(?<=[.!?])\s+|\n+/)
91
+ .map((s) => s.trim())
92
+ .filter((s) => s.length > 30); // Skip short fragments that lack enough context
93
+ }
94
+
95
+ /**
96
+ * Extract concept tags from a sentence (significant nouns/terms).
97
+ */
98
+ function extractConcepts(sentence: string): string[] {
99
+ // Extract potential concept words (3+ chars, not common stop words)
100
+ const words = sentence
101
+ .toLowerCase()
102
+ .replace(/[^a-z0-9_\-/.]+/g, " ")
103
+ .split(/\s+/)
104
+ .filter((w) => w.length > 3);
105
+
106
+ // Return unique terms, limited to 5
107
+ return [...new Set(words)].slice(0, 5);
108
+ }
109
+
110
+ /**
111
+ * Deduplicate against existing observation titles (simple guard).
112
+ * Returns true if a similar title already exists.
113
+ */
114
+ function isDuplicateTitle(title: string, existingTitles: Set<string>): boolean {
115
+ const normalized = title.toLowerCase().trim();
116
+ if (existingTitles.has(normalized)) return true;
117
+
118
+ // Also check prefix match (first 40 chars) for fuzzy dedup
119
+ const prefix = normalized.slice(0, 40);
120
+ for (const existing of existingTitles) {
121
+ if (
122
+ existing.startsWith(prefix) ||
123
+ prefix.startsWith(existing.slice(0, 40))
124
+ ) {
125
+ return true;
126
+ }
127
+ }
128
+
129
+ return false;
130
+ }
131
+
132
+ // ============================================================================
133
+ // Curator Pipeline
134
+ // ============================================================================
135
+
136
+ interface CuratorResult {
137
+ created: number;
138
+ skipped: number;
139
+ patterns: Record<string, number>;
140
+ }
141
+
142
+ /**
143
+ * Run curator on recent distillations to extract observations.
144
+ *
145
+ * @param sessionId - If provided, only process distillations from this session
146
+ * @param limit - Max distillations to process (default: MEMORY_CONFIG.curator.minDistillations)
147
+ */
148
+ export function curateFromDistillations(
149
+ sessionId?: string,
150
+ limit?: number,
151
+ ): CuratorResult {
152
+ if (!MEMORY_CONFIG.curator.enabled) {
153
+ return { created: 0, skipped: 0, patterns: {} };
154
+ }
155
+
156
+ const maxDistillations = limit ?? MEMORY_CONFIG.curator.minDistillations;
157
+ const distillations = getRecentDistillations(sessionId, maxDistillations);
158
+
159
+ if (distillations.length < MEMORY_CONFIG.curator.minDistillations) {
160
+ return { created: 0, skipped: 0, patterns: {} };
161
+ }
162
+
163
+ const result: CuratorResult = { created: 0, skipped: 0, patterns: {} };
164
+ const seenTitles = new Set<string>();
165
+
166
+ for (const distillation of distillations) {
167
+ const sentences = splitSentences(distillation.content);
168
+
169
+ for (const sentence of sentences) {
170
+ const observation = matchPatterns(sentence, distillation, seenTitles);
171
+
172
+ if (observation) {
173
+ try {
174
+ storeObservation(observation);
175
+ result.created++;
176
+ result.patterns[observation.type] =
177
+ (result.patterns[observation.type] ?? 0) + 1;
178
+ seenTitles.add(observation.title.toLowerCase().trim());
179
+ } catch {
180
+ result.skipped++;
181
+ }
182
+ }
183
+ }
184
+ }
185
+
186
+ return result;
187
+ }
188
+
189
+ /**
190
+ * Match a sentence against curator patterns and return an observation input if matched.
191
+ */
192
+ function matchPatterns(
193
+ sentence: string,
194
+ distillation: DistillationRow,
195
+ seenTitles: Set<string>,
196
+ ): ObservationInput | null {
197
+ for (const { type, pattern, titleExtractor } of CURATOR_PATTERNS) {
198
+ const match = sentence.match(pattern);
199
+ if (!match) continue;
200
+
201
+ const title = titleExtractor(match, sentence);
202
+
203
+ // Skip duplicates
204
+ if (isDuplicateTitle(title, seenTitles)) {
205
+ continue;
206
+ }
207
+
208
+ const concepts = extractConcepts(sentence);
209
+
210
+ // Parse distillation terms for additional concepts
211
+ let distTerms: string[] = [];
212
+ try {
213
+ distTerms = JSON.parse(distillation.terms);
214
+ } catch {
215
+ // Invalid JSON, skip
216
+ }
217
+
218
+ // Merge concepts from sentence + distillation terms (max 8)
219
+ const allConcepts = [
220
+ ...new Set([...concepts, ...distTerms.slice(0, 3)]),
221
+ ].slice(0, 8);
222
+
223
+ return {
224
+ type,
225
+ title,
226
+ narrative: sentence,
227
+ concepts: allConcepts,
228
+ confidence: MEMORY_CONFIG.curator.defaultConfidence,
229
+ source: "curator",
230
+ };
231
+ }
232
+
233
+ return null;
234
+ }
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Entity Graph Operations (v3)
3
+ *
4
+ * Temporal knowledge graph backed by SQLite entity_triples table.
5
+ * Supports time-aware queries (as_of), invalidation, and entity timeline.
6
+ *
7
+ * Inspired by MemPalace's temporal KG pattern: facts have valid_from/valid_to
8
+ * dates, enabling "what was true on date X?" queries.
9
+ */
10
+
11
+ import { getMemoryDB } from "./schema.js";
12
+ import type {
13
+ EntityQueryResult,
14
+ EntityTripleInput,
15
+ EntityTripleRow,
16
+ } from "./types.js";
17
+
18
+ // ============================================================================
19
+ // CRUD
20
+ // ============================================================================
21
+
22
+ /**
23
+ * Add a new entity triple to the knowledge graph.
24
+ */
25
+ export function addEntityTriple(input: EntityTripleInput): number {
26
+ const db = getMemoryDB();
27
+ const now = new Date();
28
+
29
+ const validFrom = input.valid_from ?? now.toISOString().slice(0, 10);
30
+
31
+ const result = db
32
+ .query(
33
+ `INSERT INTO entity_triples
34
+ (subject, predicate, object, valid_from, valid_to, confidence, source_observation_id, created_at, created_at_epoch)
35
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
36
+ )
37
+ .run(
38
+ input.subject.toLowerCase().trim(),
39
+ input.predicate.toLowerCase().trim(),
40
+ input.object.toLowerCase().trim(),
41
+ validFrom,
42
+ input.valid_to ?? null,
43
+ input.confidence ?? 1.0,
44
+ input.source_observation_id ?? null,
45
+ now.toISOString(),
46
+ now.getTime(),
47
+ );
48
+
49
+ return Number(result.lastInsertRowid);
50
+ }
51
+
52
+ /**
53
+ * Invalidate a triple by setting its valid_to date.
54
+ * Finds active triples matching subject+predicate+object and closes them.
55
+ */
56
+ export function invalidateTriple(
57
+ subject: string,
58
+ predicate: string,
59
+ object: string,
60
+ endDate?: string,
61
+ ): number {
62
+ const db = getMemoryDB();
63
+ const validTo = endDate ?? new Date().toISOString().slice(0, 10);
64
+
65
+ const result = db.run(
66
+ `UPDATE entity_triples
67
+ SET valid_to = ?
68
+ WHERE LOWER(subject) = LOWER(?) AND LOWER(predicate) = LOWER(?) AND LOWER(object) = LOWER(?)
69
+ AND valid_to IS NULL`,
70
+ [validTo, subject.trim(), predicate.trim(), object.trim()],
71
+ );
72
+
73
+ return result.changes;
74
+ }
75
+
76
+ /**
77
+ * Get a triple by ID.
78
+ */
79
+ export function getTripleById(id: number): EntityTripleRow | null {
80
+ const db = getMemoryDB();
81
+ return db
82
+ .query("SELECT * FROM entity_triples WHERE id = ?")
83
+ .get(id) as EntityTripleRow | null;
84
+ }
85
+
86
+ // ============================================================================
87
+ // Queries
88
+ // ============================================================================
89
+
90
+ /**
91
+ * Query entity relationships with optional time filtering.
92
+ * Returns triples where entity appears as subject or object.
93
+ */
94
+ export function queryEntity(
95
+ entity: string,
96
+ options: {
97
+ as_of?: string; // ISO date — filter to triples valid at this time
98
+ direction?: "out" | "in" | "both"; // out = subject, in = object, both = either
99
+ predicate?: string; // filter by predicate
100
+ activeOnly?: boolean; // only return currently active triples
101
+ limit?: number;
102
+ } = {},
103
+ ): EntityQueryResult[] {
104
+ const db = getMemoryDB();
105
+ const direction = options.direction ?? "both";
106
+ const limit = options.limit ?? 50;
107
+ const entityLower = entity.toLowerCase().trim();
108
+
109
+ const conditions: string[] = [];
110
+ const params: (string | number)[] = [];
111
+
112
+ // Direction filter
113
+ if (direction === "out") {
114
+ conditions.push("LOWER(subject) = ?");
115
+ params.push(entityLower);
116
+ } else if (direction === "in") {
117
+ conditions.push("LOWER(object) = ?");
118
+ params.push(entityLower);
119
+ } else {
120
+ conditions.push("(LOWER(subject) = ? OR LOWER(object) = ?)");
121
+ params.push(entityLower, entityLower);
122
+ }
123
+
124
+ // Predicate filter
125
+ if (options.predicate) {
126
+ conditions.push("LOWER(predicate) = ?");
127
+ params.push(options.predicate.toLowerCase().trim());
128
+ }
129
+
130
+ // Time filter
131
+ if (options.as_of) {
132
+ conditions.push("valid_from <= ?");
133
+ params.push(options.as_of);
134
+ conditions.push("(valid_to IS NULL OR valid_to >= ?)");
135
+ params.push(options.as_of);
136
+ } else if (options.activeOnly) {
137
+ conditions.push("valid_to IS NULL");
138
+ }
139
+
140
+ params.push(limit);
141
+
142
+ const sql = `
143
+ SELECT id, subject, predicate, object, valid_from, valid_to, confidence,
144
+ CASE WHEN valid_to IS NULL THEN 1 ELSE 0 END as is_active
145
+ FROM entity_triples
146
+ WHERE ${conditions.join(" AND ")}
147
+ ORDER BY valid_from DESC, created_at_epoch DESC
148
+ LIMIT ?
149
+ `;
150
+
151
+ return db.query(sql).all(...params) as EntityQueryResult[];
152
+ }
153
+
154
+ /**
155
+ * Get entity timeline — all triples involving an entity, sorted chronologically.
156
+ */
157
+ export function getEntityTimeline(
158
+ entity: string,
159
+ options: { limit?: number } = {},
160
+ ): EntityTripleRow[] {
161
+ const db = getMemoryDB();
162
+ const limit = options.limit ?? 100;
163
+ const entityLower = entity.toLowerCase().trim();
164
+
165
+ return db
166
+ .query(
167
+ `SELECT * FROM entity_triples
168
+ WHERE LOWER(subject) = ? OR LOWER(object) = ?
169
+ ORDER BY valid_from ASC, created_at_epoch ASC
170
+ LIMIT ?`,
171
+ )
172
+ .all(entityLower, entityLower, limit) as EntityTripleRow[];
173
+ }
174
+
175
+ /**
176
+ * Find contradictions: active triples with opposing predicates for same subject-object pair.
177
+ */
178
+ export function findContradictions(
179
+ subject: string,
180
+ predicate: string,
181
+ object: string,
182
+ ): EntityTripleRow[] {
183
+ const db = getMemoryDB();
184
+
185
+ return db
186
+ .query(
187
+ `SELECT * FROM entity_triples
188
+ WHERE LOWER(subject) = LOWER(?) AND LOWER(object) = LOWER(?)
189
+ AND LOWER(predicate) != LOWER(?)
190
+ AND valid_to IS NULL
191
+ ORDER BY created_at_epoch DESC`,
192
+ )
193
+ .all(subject.trim(), object.trim(), predicate.trim()) as EntityTripleRow[];
194
+ }
195
+
196
+ // ============================================================================
197
+ // Stats
198
+ // ============================================================================
199
+
200
+ /**
201
+ * Get entity graph statistics.
202
+ */
203
+ export function getEntityGraphStats(): {
204
+ total_triples: number;
205
+ active_triples: number;
206
+ unique_entities: number;
207
+ unique_predicates: number;
208
+ } {
209
+ const db = getMemoryDB();
210
+
211
+ const total = (
212
+ db.query("SELECT COUNT(*) as count FROM entity_triples").get() as {
213
+ count: number;
214
+ }
215
+ ).count;
216
+
217
+ const active = (
218
+ db
219
+ .query(
220
+ "SELECT COUNT(*) as count FROM entity_triples WHERE valid_to IS NULL",
221
+ )
222
+ .get() as {
223
+ count: number;
224
+ }
225
+ ).count;
226
+
227
+ const entities = (
228
+ db
229
+ .query(
230
+ `SELECT COUNT(DISTINCT entity) as count FROM (
231
+ SELECT subject as entity FROM entity_triples
232
+ UNION ALL
233
+ SELECT object as entity FROM entity_triples
234
+ )`,
235
+ )
236
+ .get() as { count: number }
237
+ ).count;
238
+
239
+ const predicates = (
240
+ db
241
+ .query("SELECT COUNT(DISTINCT predicate) as count FROM entity_triples")
242
+ .get() as {
243
+ count: number;
244
+ }
245
+ ).count;
246
+
247
+ return {
248
+ total_triples: total,
249
+ active_triples: active,
250
+ unique_entities: entities,
251
+ unique_predicates: predicates,
252
+ };
253
+ }