@cortexkit/opencode-magic-context 0.26.0 → 0.27.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 (285) hide show
  1. package/README.md +14 -12
  2. package/dist/agents/dreamer.d.ts +19 -0
  3. package/dist/agents/dreamer.d.ts.map +1 -1
  4. package/dist/agents/hidden-agent-registrations.d.ts +67 -0
  5. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -0
  6. package/dist/agents/historian.d.ts +1 -0
  7. package/dist/agents/historian.d.ts.map +1 -1
  8. package/dist/agents/permissions.d.ts +15 -44
  9. package/dist/agents/permissions.d.ts.map +1 -1
  10. package/dist/agents/smart-note-compiler.d.ts +2 -0
  11. package/dist/agents/smart-note-compiler.d.ts.map +1 -0
  12. package/dist/config/index.d.ts +1 -1
  13. package/dist/config/index.d.ts.map +1 -1
  14. package/dist/config/migrate-config-location.d.ts +89 -0
  15. package/dist/config/migrate-config-location.d.ts.map +1 -0
  16. package/dist/config/migrate-dreamer-v2.d.ts +37 -0
  17. package/dist/config/migrate-dreamer-v2.d.ts.map +1 -0
  18. package/dist/config/migrate-experimental.d.ts.map +1 -1
  19. package/dist/config/project-security.d.ts +3 -0
  20. package/dist/config/project-security.d.ts.map +1 -1
  21. package/dist/config/prune-config-leaf.d.ts.map +1 -1
  22. package/dist/config/schema/magic-context.d.ts +584 -60
  23. package/dist/config/schema/magic-context.d.ts.map +1 -1
  24. package/dist/features/magic-context/compaction-marker.d.ts +9 -3
  25. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  26. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
  27. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  28. package/dist/features/magic-context/dreamer/classify-prompt.d.ts +50 -0
  29. package/dist/features/magic-context/dreamer/classify-prompt.d.ts.map +1 -0
  30. package/dist/features/magic-context/dreamer/classify.d.ts +22 -0
  31. package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -0
  32. package/dist/features/magic-context/dreamer/cron.d.ts +72 -0
  33. package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -0
  34. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +30 -0
  35. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -0
  36. package/dist/features/magic-context/dreamer/index.d.ts +1 -3
  37. package/dist/features/magic-context/dreamer/index.d.ts.map +1 -1
  38. package/dist/features/magic-context/dreamer/lease.d.ts +44 -6
  39. package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
  40. package/dist/features/magic-context/dreamer/maintain-docs-protected-enforcement.d.ts +13 -0
  41. package/dist/features/magic-context/dreamer/maintain-docs-protected-enforcement.d.ts.map +1 -0
  42. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +36 -0
  43. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -0
  44. package/dist/features/magic-context/dreamer/map-memories.d.ts +22 -0
  45. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -0
  46. package/dist/features/magic-context/dreamer/open-opencode-db.d.ts +7 -0
  47. package/dist/features/magic-context/dreamer/open-opencode-db.d.ts.map +1 -0
  48. package/dist/features/magic-context/dreamer/primer-seed.d.ts +25 -0
  49. package/dist/features/magic-context/dreamer/primer-seed.d.ts.map +1 -0
  50. package/dist/features/magic-context/dreamer/promote-primers.d.ts +21 -0
  51. package/dist/features/magic-context/dreamer/promote-primers.d.ts.map +1 -0
  52. package/dist/features/magic-context/dreamer/protected-regions.d.ts +19 -0
  53. package/dist/features/magic-context/dreamer/protected-regions.d.ts.map +1 -0
  54. package/dist/features/magic-context/dreamer/refresh-primers.d.ts +30 -0
  55. package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -0
  56. package/dist/features/magic-context/dreamer/retrospective-learnings.d.ts +47 -0
  57. package/dist/features/magic-context/dreamer/retrospective-learnings.d.ts.map +1 -0
  58. package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts +48 -0
  59. package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -0
  60. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +81 -0
  61. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -0
  62. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +8 -0
  63. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
  64. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts +82 -0
  65. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts.map +1 -0
  66. package/dist/features/magic-context/dreamer/task-config.d.ts +28 -0
  67. package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -0
  68. package/dist/features/magic-context/dreamer/task-executor.d.ts +49 -0
  69. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -0
  70. package/dist/features/magic-context/dreamer/task-gates.d.ts +29 -0
  71. package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -0
  72. package/dist/features/magic-context/dreamer/task-prompts.d.ts +37 -6
  73. package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
  74. package/dist/features/magic-context/dreamer/task-registry.d.ts +48 -0
  75. package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -0
  76. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +88 -0
  77. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -0
  78. package/dist/features/magic-context/dreamer/verify-gate.d.ts +43 -0
  79. package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -0
  80. package/dist/features/magic-context/dreamer/verify-prompt.d.ts +41 -0
  81. package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -0
  82. package/dist/features/magic-context/dreamer/verify.d.ts +43 -0
  83. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -0
  84. package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
  85. package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
  86. package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts +4 -4
  87. package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts.map +1 -1
  88. package/dist/features/magic-context/index.d.ts +1 -0
  89. package/dist/features/magic-context/index.d.ts.map +1 -1
  90. package/dist/features/magic-context/memory/embedding-cache.d.ts +2 -2
  91. package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -1
  92. package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
  93. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  94. package/dist/features/magic-context/memory/embedding-openai.d.ts +12 -5
  95. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  96. package/dist/features/magic-context/memory/embedding.d.ts +2 -2
  97. package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
  98. package/dist/features/magic-context/memory/index.d.ts +4 -1
  99. package/dist/features/magic-context/memory/index.d.ts.map +1 -1
  100. package/dist/features/magic-context/memory/memory-migration.d.ts +1 -0
  101. package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -1
  102. package/dist/features/magic-context/memory/promotion.d.ts +16 -4
  103. package/dist/features/magic-context/memory/promotion.d.ts.map +1 -1
  104. package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts +2 -2
  105. package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts.map +1 -1
  106. package/dist/features/magic-context/memory/storage-memory-verifications.d.ts +31 -0
  107. package/dist/features/magic-context/memory/storage-memory-verifications.d.ts.map +1 -0
  108. package/dist/features/magic-context/memory/storage-memory.d.ts +12 -1
  109. package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
  110. package/dist/features/magic-context/memory/types.d.ts +4 -0
  111. package/dist/features/magic-context/memory/types.d.ts.map +1 -1
  112. package/dist/features/magic-context/memory/verification-paths.d.ts +32 -0
  113. package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -0
  114. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  115. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  116. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  117. package/dist/features/magic-context/primer-clustering.d.ts +29 -0
  118. package/dist/features/magic-context/primer-clustering.d.ts.map +1 -0
  119. package/dist/features/magic-context/project-embedding-registry.d.ts +25 -1
  120. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  121. package/dist/features/magic-context/search.d.ts +12 -2
  122. package/dist/features/magic-context/search.d.ts.map +1 -1
  123. package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -1
  124. package/dist/features/magic-context/smart-notes/capabilities.d.ts +31 -0
  125. package/dist/features/magic-context/smart-notes/capabilities.d.ts.map +1 -0
  126. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts +2 -0
  127. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts.map +1 -0
  128. package/dist/features/magic-context/smart-notes/compiler.d.ts +52 -0
  129. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -0
  130. package/dist/features/magic-context/smart-notes/index.d.ts +10 -0
  131. package/dist/features/magic-context/smart-notes/index.d.ts.map +1 -0
  132. package/dist/features/magic-context/smart-notes/runner.d.ts +18 -0
  133. package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -0
  134. package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +22 -0
  135. package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -0
  136. package/dist/features/magic-context/smart-notes/schedule.d.ts +9 -0
  137. package/dist/features/magic-context/smart-notes/schedule.d.ts.map +1 -0
  138. package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts +49 -0
  139. package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts.map +1 -0
  140. package/dist/features/magic-context/smart-notes/storage.d.ts +27 -0
  141. package/dist/features/magic-context/smart-notes/storage.d.ts.map +1 -0
  142. package/dist/features/magic-context/smart-notes/types.d.ts +63 -0
  143. package/dist/features/magic-context/smart-notes/types.d.ts.map +1 -0
  144. package/dist/features/magic-context/storage-db.d.ts +5 -1
  145. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  146. package/dist/features/magic-context/storage-meta-persisted.d.ts +8 -4
  147. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  148. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  149. package/dist/features/magic-context/storage-meta-shared.d.ts +3 -1
  150. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
  151. package/dist/features/magic-context/storage-notes.d.ts +15 -0
  152. package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
  153. package/dist/features/magic-context/storage-primers.d.ts +85 -0
  154. package/dist/features/magic-context/storage-primers.d.ts.map +1 -0
  155. package/dist/features/magic-context/storage-tags.d.ts +20 -0
  156. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  157. package/dist/features/magic-context/storage.d.ts +2 -1
  158. package/dist/features/magic-context/storage.d.ts.map +1 -1
  159. package/dist/features/magic-context/tagger.d.ts +6 -0
  160. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  161. package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
  162. package/dist/features/magic-context/transform-decision-log.d.ts +10 -0
  163. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  164. package/dist/features/magic-context/types.d.ts +2 -0
  165. package/dist/features/magic-context/types.d.ts.map +1 -1
  166. package/dist/features/magic-context/user-memory/review-user-memories.d.ts +5 -0
  167. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  168. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts +18 -0
  169. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
  170. package/dist/features/magic-context/v22-deferred-backfill.d.ts.map +1 -1
  171. package/dist/hooks/auto-update-checker/semver.d.ts +9 -0
  172. package/dist/hooks/auto-update-checker/semver.d.ts.map +1 -1
  173. package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
  174. package/dist/hooks/magic-context/command-handler.d.ts +8 -15
  175. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  176. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  177. package/dist/hooks/magic-context/compartment-parser.d.ts +9 -0
  178. package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
  179. package/dist/hooks/magic-context/compartment-prompt.d.ts +4 -1
  180. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  181. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +1 -0
  182. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  183. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  184. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
  185. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  186. package/dist/hooks/magic-context/compartment-runner-types.d.ts +8 -0
  187. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  188. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  189. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  190. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
  191. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  192. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  193. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
  194. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
  195. package/dist/hooks/magic-context/historian-state-file.d.ts.map +1 -1
  196. package/dist/hooks/magic-context/hook-handlers.d.ts +2 -1
  197. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  198. package/dist/hooks/magic-context/hook.d.ts +1 -0
  199. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  200. package/dist/hooks/magic-context/inject-compartments.d.ts +0 -3
  201. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  202. package/dist/hooks/magic-context/send-session-notification.d.ts +2 -0
  203. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  204. package/dist/hooks/magic-context/system-prompt-hash.d.ts +17 -0
  205. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  206. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +8 -5
  207. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  208. package/dist/hooks/magic-context/transform.d.ts +0 -2
  209. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  210. package/dist/index.d.ts +2 -2
  211. package/dist/index.d.ts.map +1 -1
  212. package/dist/index.js +17028 -4059
  213. package/dist/plugin/dream-timer.d.ts +17 -9
  214. package/dist/plugin/dream-timer.d.ts.map +1 -1
  215. package/dist/plugin/embedding-bootstrap-helpers.d.ts +1 -1
  216. package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
  217. package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
  218. package/dist/plugin/hooks/create-session-hooks.d.ts +211 -0
  219. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  220. package/dist/plugin/instance-disposal.d.ts +2 -0
  221. package/dist/plugin/instance-disposal.d.ts.map +1 -0
  222. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  223. package/dist/shared/announcement.d.ts +1 -1
  224. package/dist/shared/announcement.d.ts.map +1 -1
  225. package/dist/shared/data-path.d.ts +26 -7
  226. package/dist/shared/data-path.d.ts.map +1 -1
  227. package/dist/shared/model-suggestion-retry.d.ts +48 -2
  228. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  229. package/dist/shared/redaction.d.ts +7 -0
  230. package/dist/shared/redaction.d.ts.map +1 -0
  231. package/dist/shared/resolve-fallbacks.d.ts +12 -0
  232. package/dist/shared/resolve-fallbacks.d.ts.map +1 -1
  233. package/dist/shared/rpc-server.d.ts.map +1 -1
  234. package/dist/shared/rpc-types.d.ts +2 -0
  235. package/dist/shared/rpc-types.d.ts.map +1 -1
  236. package/dist/shared/subagent-runner.d.ts +12 -3
  237. package/dist/shared/subagent-runner.d.ts.map +1 -1
  238. package/dist/shared/tui-config.d.ts.map +1 -1
  239. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  240. package/dist/tools/ctx-memory/types.d.ts.map +1 -1
  241. package/dist/tools/ctx-memory/verification-recording.d.ts +8 -0
  242. package/dist/tools/ctx-memory/verification-recording.d.ts.map +1 -0
  243. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  244. package/dist/tools/ctx-search/types.d.ts +1 -1
  245. package/dist/tools/ctx-search/types.d.ts.map +1 -1
  246. package/dist/tui/data/context-db.d.ts +2 -0
  247. package/dist/tui/data/context-db.d.ts.map +1 -1
  248. package/package.json +3 -1
  249. package/src/shared/announcement.test.ts +20 -0
  250. package/src/shared/announcement.ts +19 -7
  251. package/src/shared/data-path.test.ts +70 -6
  252. package/src/shared/data-path.ts +50 -8
  253. package/src/shared/model-suggestion-retry.test.ts +79 -2
  254. package/src/shared/model-suggestion-retry.ts +181 -3
  255. package/src/shared/redaction.test.ts +48 -0
  256. package/src/shared/redaction.ts +240 -0
  257. package/src/shared/resolve-fallbacks.ts +14 -0
  258. package/src/shared/rpc-server.ts +24 -0
  259. package/src/shared/rpc-types.ts +2 -0
  260. package/src/shared/subagent-runner.ts +12 -3
  261. package/src/shared/tui-config.test.ts +63 -0
  262. package/src/shared/tui-config.ts +67 -39
  263. package/src/tui/data/context-db.ts +12 -0
  264. package/src/tui/index.tsx +87 -17
  265. package/src/tui/slots/sidebar-content.tsx +4 -0
  266. package/dist/features/magic-context/dreamer/queue.d.ts +0 -55
  267. package/dist/features/magic-context/dreamer/queue.d.ts.map +0 -1
  268. package/dist/features/magic-context/dreamer/runner.d.ts +0 -92
  269. package/dist/features/magic-context/dreamer/runner.d.ts.map +0 -1
  270. package/dist/features/magic-context/dreamer/scheduler.d.ts +0 -29
  271. package/dist/features/magic-context/dreamer/scheduler.d.ts.map +0 -1
  272. package/dist/features/magic-context/key-files/aft-availability.d.ts +0 -11
  273. package/dist/features/magic-context/key-files/aft-availability.d.ts.map +0 -1
  274. package/dist/features/magic-context/key-files/identify-key-files.d.ts +0 -84
  275. package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +0 -1
  276. package/dist/features/magic-context/key-files/project-key-files.d.ts +0 -42
  277. package/dist/features/magic-context/key-files/project-key-files.d.ts.map +0 -1
  278. package/dist/features/magic-context/key-files/read-history.d.ts +0 -26
  279. package/dist/features/magic-context/key-files/read-history.d.ts.map +0 -1
  280. package/dist/features/magic-context/key-files/read-stats.d.ts +0 -18
  281. package/dist/features/magic-context/key-files/read-stats.d.ts.map +0 -1
  282. package/dist/features/magic-context/key-files/storage-key-files.d.ts +0 -20
  283. package/dist/features/magic-context/key-files/storage-key-files.d.ts.map +0 -1
  284. package/dist/hooks/magic-context/key-files-block.d.ts +0 -27
  285. package/dist/hooks/magic-context/key-files-block.d.ts.map +0 -1
package/README.md CHANGED
@@ -26,6 +26,8 @@
26
26
  <a href="#-capture">Capture</a> ·
27
27
  <a href="#-consolidate">Consolidate</a> ·
28
28
  <a href="#-recall">Recall</a> ·
29
+ <a href="https://docs.cortexkit.io/magic-context">Docs</a> ·
30
+ <a href="./CONFIGURATION.md">Configuration</a> ·
29
31
  <a href="https://discord.gg/DSa65w8wuf">💬 Discord</a>
30
32
  </p>
31
33
 
@@ -40,7 +42,7 @@ Coding agents work the opposite way. Every task is a fresh hire with no memory o
40
42
  Magic Context gives them one. It is the **hippocampus** for coding agents, the part of the brain that forms memories, consolidates them, and recalls them, entirely in the background. One session stops being a disposable contractor and becomes a long-term teammate who was there for the whole project:
41
43
 
42
44
  - **Capture.** As the historian compresses your history, it lifts the durable knowledge (decisions, constraints, conventions) into project memory. You get a memory system for free, from work you are already doing.
43
- - **Consolidate.** Overnight, a dreamer agent does what sleep does for you: it merges duplicates, verifies memories against the codebase, retires the stale, and promotes what recurs.
45
+ - **Consolidate.** Overnight, dreamer agents do what sleep does for you: verify memories against the codebase, curate duplicates and stale entries, and promote what recurs.
44
46
  - **Recall.** The right memories surface automatically every turn, and the agent can search across memories, past conversations, and git history on demand. Across sessions, and across OpenCode and Pi.
45
47
 
46
48
  Two promises: your agent **never stops to manage its context** (no compaction pauses, no broken flow) and it **never forgets**.
@@ -72,7 +74,7 @@ The wizard auto-detects which harnesses you have (OpenCode, Pi, or both), adds t
72
74
 
73
75
  > **Why disable built-in compaction?** Magic Context manages context itself. The host's compaction would interfere with its cache-aware deferred operations and double-compress.
74
76
 
75
- **Manual setup** (OpenCode): add the plugin and turn compaction off in `opencode.json`, then drop a `magic-context.jsonc` in your project root. See the [configuration reference](./CONFIGURATION.md).
77
+ **Manual setup** (OpenCode): add the plugin and turn compaction off in `opencode.json`, then drop a `magic-context.jsonc` in `<project>/.cortexkit/` (or `~/.config/cortexkit/` for user-wide defaults). See the [configuration reference](./CONFIGURATION.md).
76
78
 
77
79
  ```jsonc
78
80
  {
@@ -164,10 +166,9 @@ ctx_memory(action="write", category="ARCHITECTURE", content="Event sourcing for
164
166
 
165
167
  *What sleep does for memory.* An optional **dreamer** agent runs overnight to keep memory quality high, spinning up ephemeral child sessions for each task:
166
168
 
167
- - **Consolidate**: merge semantically similar memories into canonical facts.
168
- - **Verify**: check memories against the current codebase (paths, configs, patterns).
169
- - **Archive stale**: retire memories about removed features or old paths.
170
- - **Improve**: rewrite verbose memories into terse, operational form.
169
+ - **Verify**: incrementally check memories against the current codebase (paths, configs, patterns) and fix/remove stale facts.
170
+ - **Curate**: scan the whole memory pool to merge duplicates, tighten wording, and archive low-value or redundant entries.
171
+ - **Classify**: score each memory's importance, scope, and safe shareability without disturbing the live prompt cache.
171
172
  - **Maintain docs**: keep `ARCHITECTURE.md` and `STRUCTURE.md` current from codebase changes.
172
173
  - **User memories**: promote recurring observations about how you work (communication style, review focus, working patterns) into a `<user-profile>` that travels with every session.
173
174
  - **Smart notes**: evaluate deferred notes whose `surface_condition` has come true and surface the ready ones.
@@ -214,7 +215,7 @@ Recall works **across sessions** (a new session inherits everything) and **acros
214
215
  | `/ctx-recomp` | Rebuild compartments from raw history (accepts a `start-end` range). Use when stored state seems wrong |
215
216
  | `/ctx-session-upgrade` | Upgrade this session to the latest history format: rebuild compartments and migrate project memories |
216
217
  | `/ctx-aug` | Run sidekick augmentation on a prompt: retrieve relevant memories via a separate model |
217
- | `/ctx-dream` | Run dreamer maintenance on demand: consolidate, verify, archive, improve |
218
+ | `/ctx-dream` | Run dreamer maintenance on demand: maintain memory, docs, smart notes, and user-profile review |
218
219
 
219
220
  ---
220
221
 
@@ -239,12 +240,13 @@ It reads directly from Magic Context's SQLite database. No extra server, no API.
239
240
 
240
241
  ## Configuration
241
242
 
242
- Settings live in `magic-context.jsonc`. Everything has sensible defaults; project config merges on top of user-wide settings. See **[CONFIGURATION.md](./CONFIGURATION.md)** for the full reference: cache TTL tuning, per-model execute thresholds, historian and dreamer model selection, embedding providers, and memory settings.
243
+ Settings live in `magic-context.jsonc`. Everything has sensible defaults; project config merges on top of user-wide settings. For the full reference cache TTL tuning, per-model execute thresholds, historian and dreamer model selection, embedding providers, and memory settings — see **[CONFIGURATION.md](./CONFIGURATION.md)** or the **[configuration reference on docs.cortexkit.io](https://docs.cortexkit.io/magic-context/reference/configuration/)**.
243
244
 
244
- **Config locations** (merged in order, project overrides user):
245
- 1. `<project-root>/magic-context.jsonc`
246
- 2. `<project-root>/.opencode/magic-context.jsonc`
247
- 3. `~/.config/opencode/magic-context.jsonc`
245
+ **Config locations** (one shared CortexKit location, project overrides user):
246
+ 1. `<project-root>/.cortexkit/magic-context.jsonc`
247
+ 2. `~/.config/cortexkit/magic-context.jsonc`
248
+
249
+ Upgrading from an earlier version? Your existing config is moved here automatically on first run (a `.MOVED_READPLEASE` breadcrumb is left at the old path).
248
250
 
249
251
  ---
250
252
 
@@ -1,2 +1,21 @@
1
1
  export declare const DREAMER_AGENT = "dreamer";
2
+ export declare const DREAMER_RETROSPECTIVE_AGENT = "dreamer-retrospective";
3
+ export declare const DREAMER_PRIMER_INVESTIGATOR_AGENT = "dreamer-primer-investigator";
4
+ export declare const DREAMER_MEMORY_MAPPER_AGENT = "dreamer-memory-mapper";
5
+ /** Read-only tool profile shared by the memory-maintenance reader agent.
6
+ * No ctx_search (local-source checks only), no write/bash/ctx_memory. */
7
+ export declare const DREAMER_MEMORY_MAPPER_ALLOWED_TOOLS: readonly ["read", "grep", "glob", "aft_outline", "aft_zoom", "aft_search"];
8
+ export declare const DREAMER_CLASSIFIER_AGENT = "dreamer-classifier";
9
+ export declare const DREAMER_DOCS_AGENT = "dreamer-docs";
10
+ /** Codebase-read + doc-write tool profile for the docs maintainer. No memory
11
+ * tools (it edits docs, not the memory store). */
12
+ export declare const DREAMER_DOCS_ALLOWED_TOOLS: readonly ["read", "grep", "glob", "bash", "write", "edit", "aft_outline", "aft_zoom", "aft_search"];
13
+ export declare const DREAMER_REVIEWER_AGENT = "dreamer-reviewer";
14
+ /** Tool profile for the base `dreamer` agent, now CURATE-ONLY (memory-pool
15
+ * hygiene). Curate edits the memory store through ctx_memory and never reads
16
+ * code (a separate verify task owns memory-vs-code correctness), so it needs
17
+ * only ctx_memory — not the former bash/write/edit/read/aft/ctx_search/ctx_note
18
+ * kitchen sink. Kept on the `dreamer` id so the ctx_memory dreamer-action gate
19
+ * (toolContext.agent === DREAMER_AGENT) still recognizes it. */
20
+ export declare const DREAMER_CURATE_ALLOWED_TOOLS: readonly ["ctx_memory"];
2
21
  //# sourceMappingURL=dreamer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dreamer.d.ts","sourceRoot":"","sources":["../../src/agents/dreamer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,YAAY,CAAC"}
1
+ {"version":3,"file":"dreamer.d.ts","sourceRoot":"","sources":["../../src/agents/dreamer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,2BAA2B,0BAA0B,CAAC;AAOnE,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAQ/E,eAAO,MAAM,2BAA2B,0BAA0B,CAAC;AAEnE;0EAC0E;AAC1E,eAAO,MAAM,mCAAmC,4EAOtC,CAAC;AAMX,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAO7D,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD;mDACmD;AACnD,eAAO,MAAM,0BAA0B,qGAU7B,CAAC;AAKX,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD;;;;;iEAKiE;AACjE,eAAO,MAAM,4BAA4B,yBAA0B,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Static registration data for one hidden agent. The id / allow-list / step cap
3
+ * are INLINE LITERALS in {@link buildHiddenAgentRegistrations} rather than
4
+ * cross-module `const` imports.
5
+ *
6
+ * # Why inline
7
+ *
8
+ * Belt-and-suspenders, not the load-bearing fix. The load failure was caused by
9
+ * exporting helpers from the entry module (see the module header) — that is what
10
+ * the entry-only-`default` rule fixes. Inlining the small id/tool/step values
11
+ * additionally removes any dependency on cross-module top-level `const` init
12
+ * timing, so this builder returns a complete, valid registration set the instant
13
+ * it is called regardless of module-evaluation order. Cheap insurance for a path
14
+ * that runs once per plugin-instance boot.
15
+ *
16
+ * The only value that cannot be inlined is the multi-KB generated system prompt;
17
+ * it stays a module `var` and is guarded at the call site (skip the agent + log
18
+ * if undefined, never register a broken/deny-all agent).
19
+ *
20
+ * `agent-registration-drift.test.ts` asserts the inline literals here stay
21
+ * byte-identical to the canonical exported constants so they can't silently
22
+ * diverge.
23
+ */
24
+ export interface HiddenAgentRegistration {
25
+ id: string;
26
+ prompt: string | undefined;
27
+ allowedTools: readonly string[];
28
+ maxSteps: number;
29
+ overrides?: Record<string, unknown>;
30
+ /** Drop any user `permission` override (privacy-critical agents only). */
31
+ lockPermissions?: boolean;
32
+ }
33
+ /**
34
+ * Hoisted function declaration: returns the four hidden-agent registrations with
35
+ * INLINE id / allow-list / step-cap literals (see {@link HiddenAgentRegistration}
36
+ * for why these must not come from module-level `var` consts). Prompts and
37
+ * computed overrides are passed in by the caller; the historian disallow filter
38
+ * is applied here against an inline default allow-list.
39
+ */
40
+ export declare function buildHiddenAgentRegistrations(args: {
41
+ dreamerPrompt: string | undefined;
42
+ smartNoteCompilerPrompt?: string | undefined;
43
+ historianPrompt: string | undefined;
44
+ historianRecompPrompt?: string | undefined;
45
+ historianEditorPrompt: string | undefined;
46
+ sidekickPrompt: string | undefined;
47
+ dreamerOverrides?: Record<string, unknown>;
48
+ historianOverrides?: Record<string, unknown>;
49
+ sidekickOverrides?: Record<string, unknown>;
50
+ historianDisallowed: readonly string[];
51
+ }): HiddenAgentRegistration[];
52
+ /**
53
+ * Build a hidden-agent config with a deny-everything-by-default permission
54
+ * baseline and a hard tool-iteration ceiling. User overrides may lower
55
+ * `steps`/`maxSteps`, but cannot raise either above the built-in cap.
56
+ */
57
+ export declare function buildHiddenAgentConfig(prompt: string, allowedTools: readonly string[], maxSteps: number, overrides?: Record<string, unknown>, agentLabel?: string, lockPermissions?: boolean): {
58
+ steps: number;
59
+ maxSteps: number;
60
+ permission: {
61
+ [x: string]: unknown;
62
+ };
63
+ mode: "subagent";
64
+ hidden: boolean;
65
+ prompt: string;
66
+ };
67
+ //# sourceMappingURL=hidden-agent-registrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden-agent-registrations.d.ts","sourceRoot":"","sources":["../../src/agents/hidden-agent-registrations.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,uBAAuB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAChD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,uBAAuB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C,GAAG,uBAAuB,EAAE,CA0K5B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,UAAQ;;;;;;;;;EA+D1B"}
@@ -1,3 +1,4 @@
1
1
  export declare const HISTORIAN_AGENT = "historian";
2
+ export declare const HISTORIAN_RECOMP_AGENT = "historian-recomp";
2
3
  export declare const HISTORIAN_EDITOR_AGENT = "historian-editor";
3
4
  //# sourceMappingURL=historian.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"historian.d.ts","sourceRoot":"","sources":["../../src/agents/historian.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,sBAAsB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"historian.d.ts","sourceRoot":"","sources":["../../src/agents/historian.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,sBAAsB,qBAAqB,CAAC"}
@@ -80,7 +80,7 @@
80
80
  * `explore`/`scout`/`general` agents and by Alfonso for its static
81
81
  * agent profiles.
82
82
  */
83
- export declare function buildAllowOnlyPermission(allowedTools: readonly string[]): Record<string, "deny" | "allow">;
83
+ export declare function buildAllowOnlyPermission(allowedTools: readonly string[] | undefined, agentLabel?: string): Record<string, "deny" | "allow">;
84
84
  /**
85
85
  * Tools the historian + historian-editor + compressor agents need.
86
86
  *
@@ -103,49 +103,6 @@ export declare const HISTORIAN_ALLOWED_TOOLS: readonly ["read", "aft_outline", "
103
103
  * config schema rejects them at parse time, so this is defense-in-depth).
104
104
  */
105
105
  export declare function applyDisallowedTools(defaults: readonly string[], disallowed: readonly string[]): readonly string[];
106
- /**
107
- * Tools the dreamer agent needs. This is the broadest hidden-agent
108
- * surface because dreamer's tasks legitimately require local-repo
109
- * exploration plus external command execution:
110
- *
111
- * - `ctx_memory` / `ctx_search` / `ctx_note` — the canonical memory
112
- * CRUD and retrieval path for consolidate / verify / archive /
113
- * improve and smart-note dismissal.
114
- * - `read` / `grep` / `glob` — the verify task prompt
115
- * (`task-prompts.ts`) explicitly tells the model to grep schema
116
- * files for default values, read source to confirm claimed
117
- * behavior, and use glob for project structure inventory.
118
- * - `bash` — required for smart-note condition evaluation (the
119
- * prompt explicitly mentions `gh` / `git` / `curl` / file reads),
120
- * for the verify task's `git log --oneline --since=...` step, and
121
- * for the improve task's `find` / `grep` directory inventory. The
122
- * live OpenCode DB shows over 100 `bash` invocations across
123
- * consolidate / verify / improve / archive-stale / smart-notes
124
- * dreamer child sessions, so removing it would regress real,
125
- * documented dreamer behavior.
126
- * - `write` / `edit` — the maintain-docs task (`task-prompts.ts`)
127
- * explicitly instructs the model to "Write or update using the
128
- * Write tool" to keep `ARCHITECTURE.md` / `STRUCTURE.md` at the
129
- * project root synchronized. Without these tools the dreamer was
130
- * forced to emit docs through `bash` heredocs/`sed` — fragile and
131
- * hard to review. Granting `write` + `edit` lets it use the proper
132
- * file tools (which back up + validate) instead.
133
- * - `aft_search` — primary read-only code search for the verify /
134
- * improve / maintain-docs tasks; finds the symbols and call sites a
135
- * doc/memory rewrite must describe, more precisely than raw `grep`.
136
- *
137
- * Deliberately NOT allowed:
138
- * - `task` — no subagent fanout from dreamer
139
- * - `webfetch` / `websearch` — out of scope; smart-note URL fetches
140
- * go through `bash` + `curl` instead
141
- *
142
- * Note: `write` / `edit` grant general file-write capability (the
143
- * permission gate is tool-level, not path-level). Dreamer is a trusted
144
- * hidden agent whose prompts scope writes to docs + memory; the
145
- * task-prompts still say "Do not commit changes," so it edits the
146
- * working tree but never commits.
147
- */
148
- export declare const DREAMER_ALLOWED_TOOLS: readonly ["read", "grep", "glob", "bash", "write", "edit", "aft_outline", "aft_zoom", "aft_search", "ctx_memory", "ctx_search", "ctx_note"];
149
106
  /**
150
107
  * Tools the sidekick agent needs. Sidekick is a read-only memory
151
108
  * retriever for `/ctx-aug` — it queries the project's memory store
@@ -159,5 +116,19 @@ export declare const DREAMER_ALLOWED_TOOLS: readonly ["read", "grep", "glob", "b
159
116
  *
160
117
  * Still denied: spawning subagents, edits, bash, web fetches.
161
118
  */
119
+ export declare const DREAMER_RETROSPECTIVE_ALLOWED_TOOLS: readonly ["ctx_search"];
120
+ /**
121
+ * The refresh-primers code investigator: read + navigate + search the CURRENT
122
+ * source to answer a primer question. NO write/edit/bash (could corrupt user
123
+ * source) and NO ctx_memory/ctx_note (a ctx_memory mutation bumps the project
124
+ * memory epoch → busts m[0], breaking the primers cache-neutral contract).
125
+ */
126
+ export declare const DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS: readonly ["read", "grep", "glob", "aft_outline", "aft_zoom", "aft_search", "ctx_search"];
127
+ /**
128
+ * The smart-note compiler consumes untrusted note text and emits code that will
129
+ * later run in the QuickJS sandbox. It must not have ambient tools: all I/O is
130
+ * performed only when the compiled check runs through the host capability API.
131
+ */
132
+ export declare const SMART_NOTE_COMPILER_ALLOWED_TOOLS: readonly [];
162
133
  export declare const SIDEKICK_ALLOWED_TOOLS: readonly ["ctx_search", "aft_outline", "aft_zoom"];
163
134
  //# sourceMappingURL=permissions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/agents/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACpC,YAAY,EAAE,SAAS,MAAM,EAAE,GAChC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAMlC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,4DAA6D,CAAC;AAElG;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,UAAU,EAAE,SAAS,MAAM,EAAE,GAC9B,SAAS,MAAM,EAAE,CAGnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,qBAAqB,6IAaxB,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,oDAAqD,CAAC"}
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/agents/permissions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACpC,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC3C,UAAU,CAAC,EAAE,MAAM,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAoBlC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,4DAA6D,CAAC;AAElG;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,UAAU,EAAE,SAAS,MAAM,EAAE,GAC9B,SAAS,MAAM,EAAE,CAGnB;AAQD;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,mCAAmC,yBAA0B,CAAC;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,yCAAyC,0FAQ5C,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,aAAc,CAAC;AAE7D,eAAO,MAAM,sBAAsB,oDAAqD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const SMART_NOTE_COMPILER_AGENT = "smart-note-compiler";
2
+ //# sourceMappingURL=smart-note-compiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-note-compiler.d.ts","sourceRoot":"","sources":["../../src/agents/smart-note-compiler.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,wBAAwB,CAAC"}
@@ -9,7 +9,7 @@ export interface MagicContextPluginConfig extends MagicContextConfig {
9
9
  subtask?: boolean;
10
10
  }>;
11
11
  }
12
- export type LoadOutcome = "ok" | "project-file-parse-error" | "project-file-io-error" | "schema-recovery" | "substitution-failure";
12
+ export type LoadOutcome = "ok" | "project-file-parse-error" | "project-file-io-error" | "legacy-config-unmigrated" | "schema-recovery" | "substitution-failure";
13
13
  export interface LoadResultDetailed {
14
14
  config: MagicContextPluginConfig & {
15
15
  configWarnings?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,kBAAkB,EAA4B,MAAM,wBAAwB,CAAC;AAG3F,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAChE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CACZ,MAAM,EACN;QACI,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,OAAO,CAAC;KACrB,CACJ,CAAC;CACL;AAmBD,MAAM,MAAM,WAAW,GACjB,IAAI,GACJ,0BAA0B,GAC1B,uBAAuB,GACvB,iBAAiB,GACjB,sBAAsB,CAAC;AAE7B,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,wBAAwB,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACjE,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE;QACL,UAAU,EAAE,WAAW,CAAC;QACxB,aAAa,EAAE,WAAW,CAAC;KAC9B,CAAC;IACF,oBAAoB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9F,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACnC;AAkTD,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,MAAM,GAClB,wBAAwB,GAAG;IAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA8E1D;AAgDD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAsE9E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,kBAAkB,EAA4B,MAAM,wBAAwB,CAAC;AAG3F,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAChE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CACZ,MAAM,EACN;QACI,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,OAAO,CAAC;KACrB,CACJ,CAAC;CACL;AAsCD,MAAM,MAAM,WAAW,GACjB,IAAI,GACJ,0BAA0B,GAC1B,uBAAuB,GACvB,0BAA0B,GAC1B,iBAAiB,GACjB,sBAAsB,CAAC;AAE7B,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,wBAAwB,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACjE,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE;QACL,UAAU,EAAE,WAAW,CAAC;QACxB,aAAa,EAAE,WAAW,CAAC;KAC9B,CAAC;IACF,oBAAoB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9F,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACnC;AAiSD,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,MAAM,GAClB,wBAAwB,GAAG;IAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAY1D;AAiDD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAiI9E"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Config-LOCATION migration: move Magic Context config from the per-harness
3
+ * legacy locations to one shared CortexKit location, mirroring AFT's proven
4
+ * move-and-marker design (NOT copy-in-place, which is a silent stale-edit trap).
5
+ *
6
+ * Legacy (read by old builds):
7
+ * user: ~/.config/opencode/magic-context.{jsonc,json}
8
+ * ~/.pi/agent/magic-context.{jsonc,json}
9
+ * project: <root>/magic-context.{jsonc,json} (bare root)
10
+ * <root>/.opencode/magic-context.{jsonc,json}
11
+ * <root>/.pi/magic-context.{jsonc,json}
12
+ *
13
+ * Target (the only thing new builds read — HARD CUTOVER, harness-agnostic):
14
+ * user: ~/.config/cortexkit/magic-context.jsonc
15
+ * project: <root>/.cortexkit/magic-context.jsonc
16
+ *
17
+ * The migrator runs at plugin init before the loader. Idempotency comes from
18
+ * the legacy file being renamed away (not from a sentinel): once a source is
19
+ * moved aside to `<name>.MOVED_READPLEASE`, later runs find no legacy source
20
+ * and no-op. The marker is a pure human breadcrumb — the loader never reads it.
21
+ *
22
+ * NB: this is config-LOCATION migration. It is unrelated to the schema/key
23
+ * migrations (migrate-dreamer-v2, migrate-experimental) that rewrite keys
24
+ * INSIDE an already-located config file.
25
+ */
26
+ export interface LegacyConfigSource {
27
+ path: string;
28
+ label: string;
29
+ }
30
+ export interface ConfigMigrationLogger {
31
+ warn?: (msg: string) => void;
32
+ info?: (msg: string) => void;
33
+ log?: (msg: string) => void;
34
+ }
35
+ export interface ConfigFileMigrationOptions {
36
+ scope: "user" | "project";
37
+ targetPath: string;
38
+ legacySources: readonly LegacyConfigSource[];
39
+ logger?: ConfigMigrationLogger;
40
+ }
41
+ export interface ConfigFileMigrationResult {
42
+ migrated: boolean;
43
+ conflict: boolean;
44
+ sourcePath?: string;
45
+ targetPath: string;
46
+ warnings: string[];
47
+ }
48
+ /** `~/.config/cortexkit/magic-context` (no extension — for detectConfigFile). */
49
+ export declare function cortexKitUserConfigBasePath(): string;
50
+ /** `<root>/.cortexkit/magic-context` (no extension — for detectConfigFile). */
51
+ export declare function cortexKitProjectConfigBasePath(directory: string): string;
52
+ /** The migration target: always normalized to `.jsonc`. */
53
+ export declare function resolveCortexKitUserConfigPath(): string;
54
+ /** The migration target: always normalized to `.jsonc`. */
55
+ export declare function resolveCortexKitProjectConfigPath(directory: string): string;
56
+ /**
57
+ * The legacy config locations to migrate FROM, by scope. Each base produces a
58
+ * `.jsonc` and a `.json` candidate; whichever exists migrates, target is always
59
+ * `.jsonc`. The bare-root project source (`<root>/magic-context.*`) is unique to
60
+ * Magic Context (AFT never had it) — omitting it would orphan repo-root configs.
61
+ */
62
+ export declare function resolveLegacyConfigSources(directory: string): {
63
+ user: LegacyConfigSource[];
64
+ project: LegacyConfigSource[];
65
+ };
66
+ export type ConfigHarness = "opencode" | "pi";
67
+ /**
68
+ * Legacy sources owned by ONE harness, most-specific first. Used by the loaders
69
+ * as a NON-DESTRUCTIVE read fallback: when the shared CortexKit base is absent
70
+ * (migration not yet run, or refused because OpenCode and Pi legacy configs
71
+ * differ), the running harness reads its OWN legacy config rather than silently
72
+ * falling back to schema defaults — which would re-enable features the legacy
73
+ * config disabled. Each harness reads only its own files, so a differing pair
74
+ * stays correct per-harness until the user consolidates. The bare project-root
75
+ * `<root>/magic-context.*` was OpenCode-only historically.
76
+ */
77
+ export declare function resolveLegacyConfigSourcesForHarness(directory: string, harness: ConfigHarness): {
78
+ user: LegacyConfigSource[];
79
+ project: LegacyConfigSource[];
80
+ };
81
+ export declare function migrateConfigFile(opts: ConfigFileMigrationOptions): ConfigFileMigrationResult;
82
+ /**
83
+ * Run both the user-scope and project-scope config-location migrations for a
84
+ * project directory. Idempotent and cheap when nothing to migrate (a few
85
+ * existsSync calls). Call once at plugin init, before loading config. Returns
86
+ * any warnings (conflicts / partial failures) for the host to surface + log.
87
+ */
88
+ export declare function migrateMagicContextConfigLocations(directory: string, logger?: ConfigMigrationLogger): string[];
89
+ //# sourceMappingURL=migrate-config-location.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-config-location.d.ts","sourceRoot":"","sources":["../../src/config/migrate-config-location.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACvC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC7C,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,MAAM,WAAW,yBAAyB;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAoBD,iFAAiF;AACjF,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED,+EAA+E;AAC/E,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,2DAA2D;AAC3D,wBAAgB,8BAA8B,IAAI,MAAM,CAEvD;AAED,2DAA2D;AAC3D,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3E;AASD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG;IAC3D,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,OAAO,EAAE,kBAAkB,EAAE,CAAC;CACjC,CAqBA;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,IAAI,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAChD,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,GACvB;IAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAAC,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAAE,CA0B/D;AAmSD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,0BAA0B,GAAG,yBAAyB,CA0F7F;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAC9C,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,qBAAqB,GAC/B,MAAM,EAAE,CA6BV"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * In-memory migration of the legacy v1 dreamer config shape to the Dreamer v2
3
+ * per-task shape (shared OpenCode + Pi; runs on every config load, like
4
+ * migrate-experimental). Doctor performs the on-disk equivalent.
5
+ *
6
+ * v1 shape (any subset):
7
+ * dreamer: {
8
+ * schedule: "02:00-06:00", // a TIME WINDOW
9
+ * tasks: ["consolidate","verify"], // an ARRAY of agentic task names
10
+ * task_timeout_minutes: 20,
11
+ * max_runtime_minutes: 120,
12
+ * user_memories: { enabled, promotion_threshold },
13
+ * pin_key_files: { enabled, token_budget, min_reads },
14
+ * }
15
+ *
16
+ * v2 shape:
17
+ * dreamer: {
18
+ * tasks: { <task>: { schedule: "<cron>"|"", model?, timeout_minutes?, ... } }
19
+ * }
20
+ *
21
+ * Rules (see dreamer-v2-AB-spec.md):
22
+ * - Base cron derived from the WINDOW START: "02:00-06:00" → "0 2 * * *".
23
+ * - Legacy `tasks` array PRESENT → it is the user's deliberate selection: each
24
+ * LISTED agentic task gets the base cron; each OMITTED canonical task gets ""
25
+ * (disabled). Built-in defaults are used ONLY when `tasks` is absent.
26
+ * - user_memories.enabled false → review-user-memories "" ; true → base cron
27
+ * (promotion_threshold carried). A legacy pin_key_files block is dropped
28
+ * (key-files pinning moved out of Magic Context).
29
+ * - classify-memories is NEW in v2 and defaults ON daily at 06:00, unless the
30
+ * whole dreamer block is disabled.
31
+ * - evaluate-smart-notes → base cron (it always ran on pending notes).
32
+ * - task_timeout_minutes → each task's timeout_minutes default; max_runtime_minutes dropped.
33
+ * - Object-shaped A+B configs carrying retired memory task keys are folded into
34
+ * verify + curate before schema parsing strips unknown keys.
35
+ */
36
+ export declare function migrateDreamerV2(rawConfig: Record<string, unknown>, warnings: string[]): Record<string, unknown>;
37
+ //# sourceMappingURL=migrate-dreamer-v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-dreamer-v2.d.ts","sourceRoot":"","sources":["../../src/config/migrate-dreamer-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAsGH,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE,MAAM,EAAE,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoMzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-experimental.d.ts","sourceRoot":"","sources":["../../src/config/migrate-experimental.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE,MAAM,EAAE,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8HzB"}
1
+ {"version":3,"file":"migrate-experimental.d.ts","sourceRoot":"","sources":["../../src/config/migrate-experimental.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE,MAAM,EAAE,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgIzB"}
@@ -22,6 +22,9 @@
22
22
  * process). A cloned repo could set a huge value to exhaust host memory /
23
23
  * address space — a resource-exhaustion vector with no legitimate per-repo
24
24
  * use. Honor user-level config only.
25
+ * - `embedding.endpoint` / `embedding.provider` — a repo must not choose
26
+ * where private memory/search/commit text is embedded. User-level config is
27
+ * the trust boundary for embedding destinations.
25
28
  * - hidden-agent `prompt`/`permission`/`tools` — a repo must not reprogram or
26
29
  * re-permission the historian/dreamer/sidekick.
27
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"project-security.d.ts","sourceRoot":"","sources":["../../src/config/project-security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAiCH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAqC5F;AA2BD,wBAAgB,mCAAmC,CAC/C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM,EAAE,CAsCV"}
1
+ {"version":3,"file":"project-security.d.ts","sourceRoot":"","sources":["../../src/config/project-security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkCH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAsD5F;AA2BD,wBAAgB,mCAAmC,CAC/C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM,EAAE,CAsCV"}
@@ -1 +1 @@
1
- {"version":3,"file":"prune-config-leaf.d.ts","sourceRoot":"","sources":["../../src/config/prune-config-leaf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,YAAY,EAAE,SAAS,WAAW,EAAE,GACrC;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAqB5D"}
1
+ {"version":3,"file":"prune-config-leaf.d.ts","sourceRoot":"","sources":["../../src/config/prune-config-leaf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,YAAY,EAAE,SAAS,WAAW,EAAE,GACrC;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAqC5D"}