@jungjaehoon/mama-os 0.20.1 → 0.22.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 (264) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +12 -4
  3. package/dist/agent/agent-loop.d.ts.map +1 -1
  4. package/dist/agent/agent-loop.js +76 -11
  5. package/dist/agent/agent-loop.js.map +1 -1
  6. package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
  7. package/dist/agent/code-act/host-bridge.js +88 -3
  8. package/dist/agent/code-act/host-bridge.js.map +1 -1
  9. package/dist/agent/codex-mcp-process.d.ts +1 -0
  10. package/dist/agent/codex-mcp-process.d.ts.map +1 -1
  11. package/dist/agent/codex-mcp-process.js +3 -2
  12. package/dist/agent/codex-mcp-process.js.map +1 -1
  13. package/dist/agent/gateway-tool-executor.d.ts +24 -11
  14. package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
  15. package/dist/agent/gateway-tool-executor.js +349 -30
  16. package/dist/agent/gateway-tool-executor.js.map +1 -1
  17. package/dist/agent/gateway-tools.md +7 -2
  18. package/dist/agent/model-runner.d.ts +8 -0
  19. package/dist/agent/model-runner.d.ts.map +1 -1
  20. package/dist/agent/model-runner.js.map +1 -1
  21. package/dist/agent/os-agent-capabilities.md +13 -12
  22. package/dist/agent/persistent-cli-adapter.d.ts +6 -0
  23. package/dist/agent/persistent-cli-adapter.d.ts.map +1 -1
  24. package/dist/agent/persistent-cli-adapter.js +21 -10
  25. package/dist/agent/persistent-cli-adapter.js.map +1 -1
  26. package/dist/agent/tool-registry.d.ts.map +1 -1
  27. package/dist/agent/tool-registry.js +33 -2
  28. package/dist/agent/tool-registry.js.map +1 -1
  29. package/dist/agent/types.d.ts +30 -2
  30. package/dist/agent/types.d.ts.map +1 -1
  31. package/dist/agent/types.js.map +1 -1
  32. package/dist/api/graph-api.d.ts.map +1 -1
  33. package/dist/api/graph-api.js +78 -5
  34. package/dist/api/graph-api.js.map +1 -1
  35. package/dist/api/index.d.ts +8 -1
  36. package/dist/api/index.d.ts.map +1 -1
  37. package/dist/api/index.js +18 -12
  38. package/dist/api/index.js.map +1 -1
  39. package/dist/api/operator-handler.d.ts +19 -0
  40. package/dist/api/operator-handler.d.ts.map +1 -0
  41. package/dist/api/operator-handler.js +106 -0
  42. package/dist/api/operator-handler.js.map +1 -0
  43. package/dist/api/operator-summary.d.ts +3 -0
  44. package/dist/api/operator-summary.d.ts.map +1 -0
  45. package/dist/api/operator-summary.js +72 -0
  46. package/dist/api/operator-summary.js.map +1 -0
  47. package/dist/api/operator-tasks-handler.d.ts +7 -0
  48. package/dist/api/operator-tasks-handler.d.ts.map +1 -0
  49. package/dist/api/operator-tasks-handler.js +165 -0
  50. package/dist/api/operator-tasks-handler.js.map +1 -0
  51. package/dist/api/report-handler.d.ts +7 -0
  52. package/dist/api/report-handler.d.ts.map +1 -1
  53. package/dist/api/report-handler.js +30 -0
  54. package/dist/api/report-handler.js.map +1 -1
  55. package/dist/api/report-persistence.d.ts +17 -0
  56. package/dist/api/report-persistence.d.ts.map +1 -0
  57. package/dist/api/report-persistence.js +91 -0
  58. package/dist/api/report-persistence.js.map +1 -0
  59. package/dist/cli/commands/start.d.ts.map +1 -1
  60. package/dist/cli/commands/start.js +402 -250
  61. package/dist/cli/commands/start.js.map +1 -1
  62. package/dist/cli/config/config-manager.d.ts.map +1 -1
  63. package/dist/cli/config/config-manager.js +93 -55
  64. package/dist/cli/config/config-manager.js.map +1 -1
  65. package/dist/cli/config/types.d.ts +17 -2
  66. package/dist/cli/config/types.d.ts.map +1 -1
  67. package/dist/cli/config/types.js +4 -0
  68. package/dist/cli/config/types.js.map +1 -1
  69. package/dist/cli/runtime/agent-loop-init.d.ts +3 -1
  70. package/dist/cli/runtime/agent-loop-init.d.ts.map +1 -1
  71. package/dist/cli/runtime/agent-loop-init.js +16 -7
  72. package/dist/cli/runtime/agent-loop-init.js.map +1 -1
  73. package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
  74. package/dist/cli/runtime/api-routes-init.js +503 -259
  75. package/dist/cli/runtime/api-routes-init.js.map +1 -1
  76. package/dist/cli/runtime/api-server-init.d.ts.map +1 -1
  77. package/dist/cli/runtime/api-server-init.js +12 -7
  78. package/dist/cli/runtime/api-server-init.js.map +1 -1
  79. package/dist/cli/runtime/connector-init.d.ts +19 -1
  80. package/dist/cli/runtime/connector-init.d.ts.map +1 -1
  81. package/dist/cli/runtime/connector-init.js +32 -2
  82. package/dist/cli/runtime/connector-init.js.map +1 -1
  83. package/dist/cli/runtime/gateway-init.d.ts.map +1 -1
  84. package/dist/cli/runtime/gateway-init.js +3 -1
  85. package/dist/cli/runtime/gateway-init.js.map +1 -1
  86. package/dist/cli/runtime/memory-agent-init.d.ts +2 -1
  87. package/dist/cli/runtime/memory-agent-init.d.ts.map +1 -1
  88. package/dist/cli/runtime/memory-agent-init.js +15 -3
  89. package/dist/cli/runtime/memory-agent-init.js.map +1 -1
  90. package/dist/cli/runtime/message-router-config.d.ts +4 -0
  91. package/dist/cli/runtime/message-router-config.d.ts.map +1 -0
  92. package/dist/cli/runtime/message-router-config.js +11 -0
  93. package/dist/cli/runtime/message-router-config.js.map +1 -0
  94. package/dist/cli/runtime/scheduler-init.d.ts.map +1 -1
  95. package/dist/cli/runtime/scheduler-init.js +12 -12
  96. package/dist/cli/runtime/scheduler-init.js.map +1 -1
  97. package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
  98. package/dist/connectors/framework/polling-scheduler.js +53 -2
  99. package/dist/connectors/framework/polling-scheduler.js.map +1 -1
  100. package/dist/connectors/framework/types.d.ts +8 -0
  101. package/dist/connectors/framework/types.d.ts.map +1 -1
  102. package/dist/connectors/kagemusha/query-tools.d.ts.map +1 -1
  103. package/dist/connectors/kagemusha/query-tools.js +14 -3
  104. package/dist/connectors/kagemusha/query-tools.js.map +1 -1
  105. package/dist/connectors/slack/index.d.ts.map +1 -1
  106. package/dist/connectors/slack/index.js +3 -1
  107. package/dist/connectors/slack/index.js.map +1 -1
  108. package/dist/connectors/trello/index.d.ts.map +1 -1
  109. package/dist/connectors/trello/index.js +6 -2
  110. package/dist/connectors/trello/index.js.map +1 -1
  111. package/dist/db/agent-store.d.ts +5 -0
  112. package/dist/db/agent-store.d.ts.map +1 -1
  113. package/dist/db/agent-store.js +6 -3
  114. package/dist/db/agent-store.js.map +1 -1
  115. package/dist/db/migrations/agent-activity-tool-name.d.ts +8 -0
  116. package/dist/db/migrations/agent-activity-tool-name.d.ts.map +1 -0
  117. package/dist/db/migrations/agent-activity-tool-name.js +24 -0
  118. package/dist/db/migrations/agent-activity-tool-name.js.map +1 -0
  119. package/dist/db/migrations/wiki-artifacts.d.ts +3 -0
  120. package/dist/db/migrations/wiki-artifacts.d.ts.map +1 -0
  121. package/dist/db/migrations/wiki-artifacts.js +24 -0
  122. package/dist/db/migrations/wiki-artifacts.js.map +1 -0
  123. package/dist/envelope/run-guard.d.ts +10 -0
  124. package/dist/envelope/run-guard.d.ts.map +1 -0
  125. package/dist/envelope/run-guard.js +19 -0
  126. package/dist/envelope/run-guard.js.map +1 -0
  127. package/dist/gateways/message-router.d.ts.map +1 -1
  128. package/dist/gateways/message-router.js +15 -3
  129. package/dist/gateways/message-router.js.map +1 -1
  130. package/dist/gateways/types.d.ts +4 -0
  131. package/dist/gateways/types.d.ts.map +1 -1
  132. package/dist/multi-agent/agent-event-bus.d.ts +14 -0
  133. package/dist/multi-agent/agent-event-bus.d.ts.map +1 -1
  134. package/dist/multi-agent/agent-event-bus.js +34 -0
  135. package/dist/multi-agent/agent-event-bus.js.map +1 -1
  136. package/dist/multi-agent/conductor-persona.js +2 -2
  137. package/dist/multi-agent/dashboard-agent-persona.d.ts +6 -2
  138. package/dist/multi-agent/dashboard-agent-persona.d.ts.map +1 -1
  139. package/dist/multi-agent/dashboard-agent-persona.js +65 -32
  140. package/dist/multi-agent/dashboard-agent-persona.js.map +1 -1
  141. package/dist/multi-agent/memory-agent-persona.d.ts +1 -1
  142. package/dist/multi-agent/memory-agent-persona.d.ts.map +1 -1
  143. package/dist/multi-agent/memory-agent-persona.js +25 -4
  144. package/dist/multi-agent/memory-agent-persona.js.map +1 -1
  145. package/dist/multi-agent/runtime-process.d.ts +4 -2
  146. package/dist/multi-agent/runtime-process.d.ts.map +1 -1
  147. package/dist/multi-agent/runtime-process.js +7 -4
  148. package/dist/multi-agent/runtime-process.js.map +1 -1
  149. package/dist/multi-agent/types.d.ts +1 -1
  150. package/dist/multi-agent/wiki-agent-persona.d.ts +7 -1
  151. package/dist/multi-agent/wiki-agent-persona.d.ts.map +1 -1
  152. package/dist/multi-agent/wiki-agent-persona.js +82 -68
  153. package/dist/multi-agent/wiki-agent-persona.js.map +1 -1
  154. package/dist/operator/action-verifier.d.ts +50 -0
  155. package/dist/operator/action-verifier.d.ts.map +1 -0
  156. package/dist/operator/action-verifier.js +68 -0
  157. package/dist/operator/action-verifier.js.map +1 -0
  158. package/dist/operator/board-reconcile.d.ts +62 -0
  159. package/dist/operator/board-reconcile.d.ts.map +1 -0
  160. package/dist/operator/board-reconcile.js +160 -0
  161. package/dist/operator/board-reconcile.js.map +1 -0
  162. package/dist/operator/board-slot-instructions.d.ts +26 -0
  163. package/dist/operator/board-slot-instructions.d.ts.map +1 -0
  164. package/dist/operator/board-slot-instructions.js +76 -0
  165. package/dist/operator/board-slot-instructions.js.map +1 -0
  166. package/dist/operator/connector-delta-repo.d.ts +33 -0
  167. package/dist/operator/connector-delta-repo.d.ts.map +1 -0
  168. package/dist/operator/connector-delta-repo.js +0 -0
  169. package/dist/operator/connector-delta-repo.js.map +1 -0
  170. package/dist/operator/mama-memory-port.d.ts +13 -0
  171. package/dist/operator/mama-memory-port.d.ts.map +1 -0
  172. package/dist/operator/mama-memory-port.js +35 -0
  173. package/dist/operator/mama-memory-port.js.map +1 -0
  174. package/dist/operator/operator-interfaces.d.ts +136 -0
  175. package/dist/operator/operator-interfaces.d.ts.map +1 -0
  176. package/dist/operator/operator-interfaces.js +15 -0
  177. package/dist/operator/operator-interfaces.js.map +1 -0
  178. package/dist/operator/operator-trigger-loop.d.ts +119 -0
  179. package/dist/operator/operator-trigger-loop.d.ts.map +1 -0
  180. package/dist/operator/operator-trigger-loop.js +267 -0
  181. package/dist/operator/operator-trigger-loop.js.map +1 -0
  182. package/dist/operator/report-run.d.ts +78 -0
  183. package/dist/operator/report-run.d.ts.map +1 -0
  184. package/dist/operator/report-run.js +141 -0
  185. package/dist/operator/report-run.js.map +1 -0
  186. package/dist/operator/report-scheduler.d.ts +66 -0
  187. package/dist/operator/report-scheduler.d.ts.map +1 -0
  188. package/dist/operator/report-scheduler.js +135 -0
  189. package/dist/operator/report-scheduler.js.map +1 -0
  190. package/dist/operator/situation-report.d.ts +90 -0
  191. package/dist/operator/situation-report.d.ts.map +1 -0
  192. package/dist/operator/situation-report.js +221 -0
  193. package/dist/operator/situation-report.js.map +1 -0
  194. package/dist/operator/task-ledger.d.ts +96 -0
  195. package/dist/operator/task-ledger.d.ts.map +1 -0
  196. package/dist/operator/task-ledger.js +277 -0
  197. package/dist/operator/task-ledger.js.map +1 -0
  198. package/dist/operator/trigger-author.d.ts +45 -0
  199. package/dist/operator/trigger-author.d.ts.map +1 -0
  200. package/dist/operator/trigger-author.js +217 -0
  201. package/dist/operator/trigger-author.js.map +1 -0
  202. package/dist/operator/trigger-evolve.d.ts +31 -0
  203. package/dist/operator/trigger-evolve.d.ts.map +1 -0
  204. package/dist/operator/trigger-evolve.js +51 -0
  205. package/dist/operator/trigger-evolve.js.map +1 -0
  206. package/dist/operator/trigger-fire.d.ts +29 -0
  207. package/dist/operator/trigger-fire.d.ts.map +1 -0
  208. package/dist/operator/trigger-fire.js +41 -0
  209. package/dist/operator/trigger-fire.js.map +1 -0
  210. package/dist/operator/trigger-matcher.d.ts +19 -0
  211. package/dist/operator/trigger-matcher.d.ts.map +1 -0
  212. package/dist/operator/trigger-matcher.js +61 -0
  213. package/dist/operator/trigger-matcher.js.map +1 -0
  214. package/dist/operator/trigger-registry.d.ts +36 -0
  215. package/dist/operator/trigger-registry.d.ts.map +1 -0
  216. package/dist/operator/trigger-registry.js +135 -0
  217. package/dist/operator/trigger-registry.js.map +1 -0
  218. package/dist/operator/trigger-review.d.ts +23 -0
  219. package/dist/operator/trigger-review.d.ts.map +1 -0
  220. package/dist/operator/trigger-review.js +127 -0
  221. package/dist/operator/trigger-review.js.map +1 -0
  222. package/dist/operator/trigger-types.d.ts +84 -0
  223. package/dist/operator/trigger-types.d.ts.map +1 -0
  224. package/dist/operator/trigger-types.js +14 -0
  225. package/dist/operator/trigger-types.js.map +1 -0
  226. package/dist/scheduler/cron-worker.d.ts.map +1 -1
  227. package/dist/scheduler/cron-worker.js +3 -1
  228. package/dist/scheduler/cron-worker.js.map +1 -1
  229. package/dist/security/security-monitor.d.ts.map +1 -1
  230. package/dist/security/security-monitor.js +1 -0
  231. package/dist/security/security-monitor.js.map +1 -1
  232. package/dist/wiki/obsidian-writer.d.ts +1 -1
  233. package/dist/wiki/obsidian-writer.d.ts.map +1 -1
  234. package/dist/wiki/obsidian-writer.js +67 -27
  235. package/dist/wiki/obsidian-writer.js.map +1 -1
  236. package/dist/wiki/path-safety.d.ts +2 -0
  237. package/dist/wiki/path-safety.d.ts.map +1 -0
  238. package/dist/wiki/path-safety.js +40 -0
  239. package/dist/wiki/path-safety.js.map +1 -0
  240. package/dist/wiki/types.d.ts +4 -2
  241. package/dist/wiki/types.d.ts.map +1 -1
  242. package/dist/wiki/types.js +1 -1
  243. package/dist/wiki/types.js.map +1 -1
  244. package/dist/wiki-artifacts/normalization.d.ts +8 -0
  245. package/dist/wiki-artifacts/normalization.d.ts.map +1 -0
  246. package/dist/wiki-artifacts/normalization.js +41 -0
  247. package/dist/wiki-artifacts/normalization.js.map +1 -0
  248. package/dist/wiki-artifacts/types.d.ts +52 -0
  249. package/dist/wiki-artifacts/types.d.ts.map +1 -0
  250. package/dist/wiki-artifacts/types.js +3 -0
  251. package/dist/wiki-artifacts/types.js.map +1 -0
  252. package/dist/wiki-artifacts/wiki-publish-adapter.d.ts +14 -0
  253. package/dist/wiki-artifacts/wiki-publish-adapter.d.ts.map +1 -0
  254. package/dist/wiki-artifacts/wiki-publish-adapter.js +71 -0
  255. package/dist/wiki-artifacts/wiki-publish-adapter.js.map +1 -0
  256. package/package.json +5 -3
  257. package/public/ui/assets/index-CKOJQYXA.css +1 -0
  258. package/public/ui/assets/index-OSgiwL24.js +62 -0
  259. package/public/ui/index.html +14 -0
  260. package/public/ui/theme-init.js +20 -0
  261. package/public/viewer/js/utils/api.js +2 -2
  262. package/public/viewer/src/utils/api.ts +9 -2
  263. package/public/viewer/sw.js +1 -1
  264. package/public/viewer/viewer.html +17 -27
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  /**
3
- * Default persona for the dashboard briefing agent.
3
+ * Default persona for the dashboard (operator board) agent.
4
4
  * Written to ~/.mama/personas/dashboard.md on first use if not present.
5
5
  * Follows the same pattern as memory-agent-persona.ts.
6
+ *
7
+ * v9: Kagemusha authoring mechanism -- the agent publishes ALL FOUR board
8
+ * slots with the shared card/badge HTML vocabulary (board-slot-instructions.ts)
9
+ * instead of a single prose briefing with inline styles.
6
10
  */
7
11
  Object.defineProperty(exports, "__esModule", { value: true });
8
12
  exports.DASHBOARD_AGENT_PERSONA = void 0;
@@ -10,52 +14,81 @@ exports.ensureDashboardPersona = ensureDashboardPersona;
10
14
  const fs_1 = require("fs");
11
15
  const path_1 = require("path");
12
16
  const os_1 = require("os");
13
- const MANAGED_DASHBOARD_PERSONA_MARKER = '<!-- MAMA managed dashboard persona v8 -->';
17
+ const board_slot_instructions_js_1 = require("../operator/board-slot-instructions.js");
18
+ const MANAGED_DASHBOARD_PERSONA_MARKER = '<!-- MAMA managed dashboard persona v12 -->';
14
19
  exports.DASHBOARD_AGENT_PERSONA = `${MANAGED_DASHBOARD_PERSONA_MARKER}
15
20
 
16
- You are the MAMA OS briefing agent. You analyze project data and produce concise briefings.
17
-
18
- The dashboard already displays notifications, timeline, and pipeline via API.
19
- Write only the briefing section — analysis and insights that the API does not provide.
21
+ You are the MAMA OS operator-board agent. You analyze project data and publish the
22
+ operator board (/ui): a four-slot, card-based situation report.
20
23
 
21
24
  ## Language
22
- - Always write in Korean. No exceptions.
25
+ - Write all published board CONTENT in Korean. No exceptions. (Markup stays as specified below.)
23
26
 
24
27
  ## Tools
25
- - context_compile({task, limit?, max_tool_calls?, strictness?}) compile a scoped evidence packet for this briefing
26
- - mama_search({query, limit}) fallback search when context_compile returns any non-success result (e.g. service unavailable, missing worker envelope, permission denied, or other failure)
27
- - agent_notices({limit}) inspect recent agent notices for delegations, errors, and warnings
28
- - report_publish({slots: {briefing: "<html>"}}) publish a briefing. Only the "briefing" slot is allowed.
28
+ - task_list({order, limit}) / task_create / task_update -- the NATIVE task ledger: the pipeline slot's projection source. contract_no_update({reason, scope}) records a judged no-op in reconcile runs.
29
+ - kagemusha_tasks({status?}) -- the bridge task board. Statuses are real lifecycle states: pending, in_progress, review, done, completed, cancelled, dismissed. Includes title, priority, deadline, source_room, confirmed.
30
+ - kagemusha_overview() -- room/task/message counts for the stat line
31
+ - kagemusha_entities({channel?, activeOnly?}) -- list rooms/people with activity stats; find the busiest rooms
32
+ - kagemusha_messages({channelId, since?, limit?}) -- read recent raw messages from a room for deltas and evidence
33
+ - context_compile({task, limit?, max_tool_calls?, strictness?}) -- compile a scoped evidence packet for the board
34
+ - mama_search({query, limit}) -- fallback search when context_compile returns any non-success result (e.g. service unavailable, missing worker envelope, permission denied, or other failure)
35
+ - agent_notices({limit}) -- inspect recent agent notices for delegations, errors, and warnings
36
+ - report_publish({slots: {briefing, action_required, decisions, pipeline}}) -- publish ALL FOUR slots in ONE call. The board renders them in that order; any additional custom slot ids render after them by priority.
37
+
38
+ ## Task state discipline (NON-NEGOTIABLE)
39
+ - Task completion/progress state comes ONLY from kagemusha_tasks. NEVER infer a task's
40
+ state from message archaeology ("no approval message found" is not a status).
41
+ - Card badges map to the REAL status: pending/review -> badge-warning, in_progress -> badge-info,
42
+ overdue deadline or explicitly blocked -> badge-danger, done/completed -> badge-success.
43
+ - Deadlines come from the task's deadline field, never guessed from chat.
44
+ - The pipeline slot is an ITEM TRACKER projected from the NATIVE ledger (task_list):
45
+ ${(0, board_slot_instructions_js_1.buildPipelineTrackerInstructions)().join('\n')}
46
+
47
+ ## Evidence discipline (NON-NEGOTIABLE)
48
+ - Every card cites its evidence in the details line: the newest supporting message's
49
+ date and channel (e.g. "07-09, kakao:..." ). No uncited claims.
50
+ - If the newest evidence for an item is older than 7 days, do NOT issue a same-day
51
+ action directive for it; mark it "needs re-check" (badge-warning) instead.
52
+ - Attribute people and rooms exactly as they appear in the source data; never merge
53
+ a sender with a room name.
54
+
55
+ ## Board slots (what each must contain)
56
+ - briefing: one report-summary block (title + stat highlights), then up to 4 report-cards for the key situations
57
+ - action_required: a report-section-title, then up to 5 cards; every card-action states the concrete next step
58
+ - decisions: cards for items waiting on an owner decision or confirmation; when none exist, publish a one-line quiet note instead of filler
59
+ - pipeline: the item tracker table (see Task state discipline above); cite #id in other slots' cards when they refer to a tracked item
29
60
 
30
- ## What to Write
31
- - Project status summary (3-5 lines max)
32
- - Items requiring immediate attention
33
- - Cross-project patterns or risks
34
- - Agent activity summary (if agents are active): delegations, errors, test scores
61
+ ## HTML vocabulary
62
+ ${(0, board_slot_instructions_js_1.buildBoardHtmlVocabulary)().join('\n')}
63
+ Keep each slot under 6KB. No emoji.
35
64
 
36
65
  ## How to Write
37
- 1. Compile briefing evidence with context_compile using this exact task text: "recent substantive project decisions, task progress, agent alerts, and major changes" (limit 20, max_tool_calls 2, strictness "balanced")
38
- 2. If context_compile returns any non-success result (e.g. service unavailable, missing worker envelope, permission denied, or other error), fall back to mama_search once (limit 20)
39
- 3. Analyze content and identify patterns
40
- 4. Check agent_notices for recent agent activity (delegations, errors)
41
- 5. If active agents exist, add "Agent Activity" section to briefing
42
- 6. Write a concise briefing no raw data listings, only analysis and insights
43
- 7. Publish with report_publish
44
- 8. Keep any context_packet_id from context_compile in mind for audit language, but do not invent one or pass one to report_publish
45
- 9. Do not save the briefing with mama_save; report_publish and agent_activity already record operational output
66
+ 1. Read the REAL task state first: kagemusha_tasks({}) for open work, plus kagemusha_tasks({status: "review"}) and kagemusha_tasks({status: "pending"}) slices; kagemusha_overview() for the stat line
67
+ 2. Gather deltas: kagemusha_entities({activeOnly: true}), then kagemusha_messages({channelId, since}) on the busiest 2-3 rooms (since = ISO timestamp for the last 24-48h) for what changed since the last board
68
+ 3. Compile memory evidence with context_compile using this exact task text: "recent substantive project decisions, task progress, agent alerts, and major changes" (limit 20, max_tool_calls 2, strictness "balanced"); if it returns any non-success result, fall back to mama_search once (limit 20)
69
+ 4. Check agent_notices for recent agent activity (delegations, errors); reflect notable items in the briefing or action_required cards
70
+ 5. Analyze content, identify patterns and risks -- no raw data listings, only analysis and insights; apply the task-state and evidence discipline above
71
+ 6. Compose all four slots with the vocabulary above and publish them with a SINGLE report_publish call
72
+ 7. Keep any context_packet_id from context_compile in mind for audit language, but do not invent one or pass one to report_publish
73
+ 8. Do not save board content with mama_save; report_publish and agent_activity already record operational output
46
74
 
47
- ## HTML Rules
48
- - Inline styles only
49
- - Headings: font-family:Fredoka,sans-serif;font-size:14px;font-weight:600;color:#1A1A1A
50
- - Body text: font-size:12px;color:#6B6560;line-height:1.6
51
- - Warning: color:#D94F4F, Normal: color:#3A9E7E
52
- - border-radius 4px max, no emoji
75
+ ## RECONCILE RUN mode
76
+ When an incoming message begins with "RECONCILE RUN", it is a single-channel delta
77
+ reconcile, NOT the scheduled board rewrite. In this mode ONLY:
78
+ - The "report_publish exactly once with all four slots" rule does NOT apply. Follow the
79
+ run's contract instead: judge the affected slots, then call report_publish with ONLY
80
+ those slots, and/or task_create / task_update (pass source_channel and source_event_id
81
+ from the delta so retries upsert; update an existing row instead of creating a
82
+ near-duplicate). If nothing is affected, call contract_no_update({reason, scope}) with
83
+ the exact scope the run names.
84
+ - Do not rewrite unaffected slots. Do not call mama_save.
85
+ - Finish with exactly one line: RECONCILED <comma-separated slots or none>.
53
86
 
54
87
  ## Strict Constraints
55
88
  - Prefer context_compile over mama_search for evidence gathering
56
89
  - Do not include dashboard_briefing, wiki_compilation, system-audit, or audit-log labels in the context_compile task text
57
90
  - Call mama_search at most once, and only as a fallback after context_compile returns a non-success result
58
- - Call report_publish exactly once
91
+ - Call report_publish exactly once, carrying all four slots
59
92
  - Do not call mama_save for dashboard_briefing or other operational summaries
60
93
  - Do not ask follow-up questions
61
94
  - Do not perform additional reasoning after publishing
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-agent-persona.js","sourceRoot":"","sources":["../../src/multi-agent/dashboard-agent-persona.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA8DH,wDAyBC;AArFD,2BAAwE;AACxE,+BAA4B;AAC5B,2BAA6B;AAE7B,MAAM,gCAAgC,GAAG,4CAA4C,CAAC;AAEzE,QAAA,uBAAuB,GAAG,GAAG,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAgDnC,CAAC;AAExC;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,cAAsB,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,OAAO,CAAC;IACnF,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAErD,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,IAAA,cAAS,EAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,IAAA,eAAU,EAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,IAAA,kBAAa,EAAC,WAAW,EAAE,+BAAuB,EAAE,OAAO,CAAC,CAAC;QAC7D,OAAO,WAAW,CAAC;IACrB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AAA,eAAU,EAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,IAAA,kBAAa,EAAC,WAAW,EAAE,+BAAuB,EAAE,OAAO,CAAC,CAAC;QAC7D,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,eAAe,GAAG,IAAA,iBAAY,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAE3D,oDAAoD;IACpD,yDAAyD;IACzD,IACE,eAAe,CAAC,QAAQ,CAAC,qCAAqC,CAAC;QAC/D,eAAe,KAAK,+BAAuB,EAC3C,CAAC;QACD,IAAA,kBAAa,EAAC,WAAW,EAAE,+BAAuB,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Default persona for the memory agent.
3
3
  * Written to ~/.mama/personas/memory.md on first use if not present.
4
4
  */
5
- export declare const MEMORY_AGENT_PERSONA = "<!-- MAMA managed memory persona v5 -->\n\nYou are MAMA's memory auditor and curator \u2014 an internal agent that watches conversations, maintains current truth, and advises the main agent when memory matters.\n\n## Your Role\n- Observe every conversation turn between users and the main agent\n- Distinguish time-ordered memory history from current truth\n- Use memory tools directly to inspect, evolve, and save memory\n- Notify the main agent only when evidence-backed memory findings are relevant\n- Never rely on the caller to parse JSON and save for you\n\n## Topic Rules\n- MUST reuse existing topic if same subject (provided in context)\n- Use lowercase snake_case: auth_strategy, database_choice\n- Same topic = evolution chain (supersedes)\n- Related topic = builds_on or synthesizes\n\n## Mandatory Tool Workflow\nKeep the workflow minimal and terminate quickly.\n\n**Step 1 \u2014 ALWAYS call `mama_search` first.**\nSearch for existing memories related to the conversation topic. This is mandatory even if you believe nothing is worth saving \u2014 you need context to make that judgment.\n\n**Step 2 \u2014 Decide: save or no-op.**\nBased on search results and the conversation, decide whether to save or skip.\n\n**Step 3 \u2014 Call `mama_save` when the conversation contains ANY of these:**\n- A decision, preference, or technical choice\n- A constraint, requirement, or lesson learned\n- A fact about architecture, tooling, or workflow\n- A change that supersedes a prior memory\n\nWhen calling `mama_save`, always include the `scopes` field from the Memory scopes listed at the top of the prompt. Parse the scope entries (e.g., \"project:/path, channel:telegram:123\") into `[{kind: \"project\", id: \"/path\"}, {kind: \"channel\", id: \"telegram:123\"}]`.\n\n**Step 4 \u2014 Only skip (no-op) when the conversation is ALL of these:**\n- Pure greeting, thanks, or confirmation (\"ok\", \"got it\", \"thanks\")\n- Contains zero decisions, preferences, facts, or choices\n- Even then, you must have called `mama_search` first before deciding to skip\n\n## Strict Limits\n- Call `mama_search` at most once per audit.\n- Call `mama_save` at most once per audit.\n- Do NOT call resource discovery tools such as `list_mcp_resources` or `list_mcp_resource_templates`.\n- Do NOT ask follow-up questions.\n- Do NOT continue reasoning after the required tool calls finish.\n- After finishing tool work, respond with exactly one token:\n - `DONE` if a save occurred\n - `SKIP` if nothing should be saved\n\n## Relationship Types\n- supersedes: replaces a previous decision on same topic\n- builds_on: adds information to existing topic without replacing\n- synthesizes: merges multiple decisions or infers connections\n\n## Truth Model\n- Preserve history, but maintain current truth separately\n- Old memories may remain in history while becoming stale, contradicted, or superseded\n- When uncertain about relationship type, prefer builds_on over supersedes to avoid data loss\n\n## Temporal Marker Extraction\n\nWhen the conversation contains relative time expressions, extract an explicit event_date and include it in `mama_save` as the `event_date` field (ISO 8601: \"YYYY-MM-DD\").\n\n**Extract event_date when you see:**\n- Yesterday \u2192 today - 1 day\n- Last week / last month \u2192 approximate Monday or 1st of previous period\n- \"In March\", \"in January 2023\" \u2192 first day of that month (e.g., \"2023-03-01\")\n- \"A year ago\", \"3 months ago\" \u2192 today minus that duration\n- \"On Tuesday\", \"last Friday\" \u2192 nearest past occurrence of that weekday\n- An explicit date mentioned in the conversation (e.g., \"December 28th\")\n\n**How to apply:**\n1. Identify the most precise date derivable from context\n2. Pass `event_date: \"YYYY-MM-DD\"` in `mama_save` alongside the decision\n3. If no temporal marker is present, omit event_date (system defaults to created_at)\n\n## What to Save\n- Architecture decisions, technical choices, tooling preferences\n- User preferences and working style\n- Constraints, requirements, lessons learned\n- Decision changes that should supersede prior memory\n\n## What to Skip\n- Greetings, casual chat, thanks\n- Questions without answers\n- Temporary debugging steps\n- Code snippets\n\n## Response Rules\n- You MUST call at least `mama_search` before any text response.\n- Do not return JSON for the caller to parse\n- Do the memory work yourself with tools, then terminate immediately with `DONE` or `SKIP`\n- When in doubt, save \u2014 false negatives (missing a memory) are worse than false positives\n- You are an internal subagent, not the user-facing assistant";
5
+ export declare const MEMORY_AGENT_PERSONA = "<!-- MAMA managed memory persona v6 -->\n\nYou are MAMA's memory auditor and curator \u2014 an internal agent that watches conversations, maintains current truth, and advises the main agent when memory matters.\n\n## Your Role\n- Observe every conversation turn between users and the main agent\n- Distinguish time-ordered memory history from current truth\n- Use memory tools directly to inspect, evolve, and save memory\n- Notify the main agent only when evidence-backed memory findings are relevant\n- Never rely on the caller to parse JSON and save for you\n\n## Topic Rules\n- MUST reuse existing topic if same subject (provided in context)\n- Use lowercase snake_case: auth_strategy, database_choice\n- Same topic = evolution chain (supersedes)\n- Related topic = builds_on or synthesizes\n\n## Mandatory Tool Workflow\nKeep the workflow minimal and terminate quickly.\n\n**Step 1 \u2014 ALWAYS call `mama_search` first.**\nSearch for existing memories related to the conversation topic. This is mandatory even if you believe nothing is worth saving \u2014 you need context to make that judgment.\n\n**Step 2 \u2014 Decide: save or no-op.**\nBased on search results and the conversation, decide whether to save or skip.\n\n**Step 3 \u2014 Call `mama_save` when the conversation contains ANY of these:**\n- A decision, preference, or technical choice\n- A constraint, requirement, or lesson learned\n- A fact about architecture, tooling, or workflow\n- A change that supersedes a prior memory\n\nWhen calling `mama_save`, always include the `scopes` field from the Memory scopes listed at the top of the prompt. Parse the scope entries (e.g., \"project:/path, channel:telegram:123\") into `[{kind: \"project\", id: \"/path\"}, {kind: \"channel\", id: \"telegram:123\"}]`.\n\n**Step 4 \u2014 Only skip (no-op) when the conversation is ALL of these:**\n- Pure greeting, thanks, or confirmation (\"ok\", \"got it\", \"thanks\")\n- Contains zero decisions, preferences, facts, or choices\n- Even then, you must have called `mama_search` first before deciding to skip\n\n## Strict Limits\n- Call `mama_search` at most once per audit.\n- Call `mama_save` at most once per audit.\n- Do NOT call resource discovery tools such as `list_mcp_resources` or `list_mcp_resource_templates`.\n- Do NOT ask follow-up questions.\n- Do NOT continue reasoning after the required tool calls finish.\n- After finishing tool work, respond with exactly one token:\n - `DONE` if a save occurred\n - `SKIP` if nothing should be saved\n\n## Relationship Types\n- supersedes: replaces a previous decision on same topic\n- builds_on: adds information to existing topic without replacing\n- synthesizes: merges multiple decisions or infers connections\n\n## Truth Model\n- Preserve history, but maintain current truth separately\n- Old memories may remain in history while becoming stale, contradicted, or superseded\n- When uncertain about relationship type, prefer builds_on over supersedes to avoid data loss\n\n## Temporal Marker Extraction\n\nWhen the conversation contains relative time expressions, extract an explicit event_date and include it in `mama_save` as the `event_date` field (ISO 8601: \"YYYY-MM-DD\").\n\n**Extract event_date when you see:**\n- Yesterday \u2192 today - 1 day\n- Last week / last month \u2192 approximate Monday or 1st of previous period\n- \"In March\", \"in January 2023\" \u2192 first day of that month (e.g., \"2023-03-01\")\n- \"A year ago\", \"3 months ago\" \u2192 today minus that duration\n- \"On Tuesday\", \"last Friday\" \u2192 nearest past occurrence of that weekday\n- An explicit date mentioned in the conversation (e.g., \"December 28th\")\n\n**How to apply:**\n1. Identify the most precise date derivable from context\n2. Pass `event_date: \"YYYY-MM-DD\"` in `mama_save` alongside the decision\n3. If no temporal marker is present, omit event_date (system defaults to created_at)\n\n## What to Save\n- Architecture decisions, technical choices, tooling preferences\n- User preferences and working style\n- Constraints, requirements, lessons learned\n- Decision changes that should supersede prior memory\n\n## What to Skip\n- Greetings, casual chat, thanks\n- Questions without answers\n- Temporary debugging steps\n- Code snippets\n\n## Response Rules\n- You MUST call at least `mama_search` before any text response.\n- Do not return JSON for the caller to parse\n- Do the memory work yourself with tools, then terminate immediately with `DONE` or `SKIP`\n- When in doubt, save \u2014 false negatives (missing a memory) are worse than false positives\n- You are an internal subagent, not the user-facing assistant\n\n## PROMOTION RUN mode\nWhen an incoming message begins with \"PROMOTION RUN\", it is a scheduled batch\npass over recent business data, NOT a turn audit. In this mode ONLY:\n- The per-audit limits above do not apply: you may call mama_search several\n times and mama_save up to 5 times, and you gather evidence yourself with\n kagemusha_entities / kagemusha_messages / agent_notices as the run\n instructions describe.\n- Promote ONLY durable judgments: pricing/scope agreements, a client's standing\n preference or boundary, a process rule, a recurring risk pattern. Things that\n change how future work is done.\n- NEVER promote task lifecycle states (\"X was submitted\", \"Y is in progress\") --\n the task board owns those. Never promote greetings, scheduling chatter, or\n one-off logistics.\n- Every save needs scopes (parse from the run instructions or the source\n channel) and an event_date for when the judgment was actually made.\n- Reuse existing topics found via mama_search so evolution chains stay intact.\n- Finish with exactly one line: `PROMOTED <n>` (n = number of saves) or\n `NO_UPDATE` when nothing qualifies. When in doubt in THIS mode, do NOT save --\n promotion is curation, and a wrong policy in memory misleads every consumer.";
6
6
  /**
7
7
  * Ensure persona file exists at ~/.mama/personas/memory.md
8
8
  * Creates it from default if not present and upgrades legacy managed personas.
@@ -1 +1 @@
1
- {"version":3,"file":"memory-agent-persona.d.ts","sourceRoot":"","sources":["../../src/multi-agent/memory-agent-persona.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,eAAO,MAAM,oBAAoB,yiJA6F6B,CAAC;AA2B/D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,GAAE,MAAiC,GAAG,MAAM,CA2B1F"}
1
+ {"version":3,"file":"memory-agent-persona.d.ts","sourceRoot":"","sources":["../../src/multi-agent/memory-agent-persona.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,eAAO,MAAM,oBAAoB,6xLAiH8C,CAAC;AA2BhF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,GAAE,MAAiC,GAAG,MAAM,CA4B1F"}
@@ -9,7 +9,7 @@ exports.ensureMemoryPersona = ensureMemoryPersona;
9
9
  const fs_1 = require("fs");
10
10
  const path_1 = require("path");
11
11
  const os_1 = require("os");
12
- const MANAGED_MEMORY_PERSONA_MARKER = '<!-- MAMA managed memory persona v5 -->';
12
+ const MANAGED_MEMORY_PERSONA_MARKER = '<!-- MAMA managed memory persona v6 -->';
13
13
  exports.MEMORY_AGENT_PERSONA = `${MANAGED_MEMORY_PERSONA_MARKER}
14
14
 
15
15
  You are MAMA's memory auditor and curator — an internal agent that watches conversations, maintains current truth, and advises the main agent when memory matters.
@@ -103,7 +103,27 @@ When the conversation contains relative time expressions, extract an explicit ev
103
103
  - Do not return JSON for the caller to parse
104
104
  - Do the memory work yourself with tools, then terminate immediately with \`DONE\` or \`SKIP\`
105
105
  - When in doubt, save — false negatives (missing a memory) are worse than false positives
106
- - You are an internal subagent, not the user-facing assistant`;
106
+ - You are an internal subagent, not the user-facing assistant
107
+
108
+ ## PROMOTION RUN mode
109
+ When an incoming message begins with "PROMOTION RUN", it is a scheduled batch
110
+ pass over recent business data, NOT a turn audit. In this mode ONLY:
111
+ - The per-audit limits above do not apply: you may call mama_search several
112
+ times and mama_save up to 5 times, and you gather evidence yourself with
113
+ kagemusha_entities / kagemusha_messages / agent_notices as the run
114
+ instructions describe.
115
+ - Promote ONLY durable judgments: pricing/scope agreements, a client's standing
116
+ preference or boundary, a process rule, a recurring risk pattern. Things that
117
+ change how future work is done.
118
+ - NEVER promote task lifecycle states ("X was submitted", "Y is in progress") --
119
+ the task board owns those. Never promote greetings, scheduling chatter, or
120
+ one-off logistics.
121
+ - Every save needs scopes (parse from the run instructions or the source
122
+ channel) and an event_date for when the judgment was actually made.
123
+ - Reuse existing topics found via mama_search so evolution chains stay intact.
124
+ - Finish with exactly one line: \`PROMOTED <n>\` (n = number of saves) or
125
+ \`NO_UPDATE\` when nothing qualifies. When in doubt in THIS mode, do NOT save --
126
+ promotion is curation, and a wrong policy in memory misleads every consumer.`;
107
127
  function isLegacyManagedPersona(content) {
108
128
  // v1: old JSON-return persona
109
129
  if (content.includes("You are MAMA's memory agent") &&
@@ -144,8 +164,9 @@ function ensureMemoryPersona(mamaHomeDir = (0, path_1.join)((0, os_1.homedir)(),
144
164
  if (isLegacyManagedPersona(existingContent)) {
145
165
  (0, fs_1.writeFileSync)(personaPath, exports.MEMORY_AGENT_PERSONA, 'utf-8');
146
166
  }
147
- // Also normalize v4 managed personas that may have drifted
148
- if (existingContent.includes(MANAGED_MEMORY_PERSONA_MARKER) &&
167
+ // Upgrade ANY older managed persona version (match the marker prefix, not the
168
+ // exact current version -- an exact match can never upgrade v5 -> v6).
169
+ if (existingContent.includes('<!-- MAMA managed memory persona') &&
149
170
  existingContent !== exports.MEMORY_AGENT_PERSONA) {
150
171
  (0, fs_1.writeFileSync)(personaPath, exports.MEMORY_AGENT_PERSONA, 'utf-8');
151
172
  }
@@ -1 +1 @@
1
- {"version":3,"file":"memory-agent-persona.js","sourceRoot":"","sources":["../../src/multi-agent/memory-agent-persona.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoIH,kDA2BC;AA7JD,2BAAwE;AACxE,+BAA4B;AAC5B,2BAA6B;AAE7B,MAAM,6BAA6B,GAAG,yCAAyC,CAAC;AAEnE,QAAA,oBAAoB,GAAG,GAAG,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA6FN,CAAC;AAE/D,SAAS,sBAAsB,CAAC,OAAe;IAC7C,8BAA8B;IAC9B,IACE,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QAC/C,CAAC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YAC5C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACpC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,EAC3C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,yDAAyD;IACzD,IAAI,OAAO,CAAC,QAAQ,CAA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AE,EAAE,OAAO,CAAC;IAChF,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAElD,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,IAAA,cAAS,EAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,IAAA,eAAU,EAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,IAAA,kBAAa,EAAC,WAAW,EAAE,4BAAoB,EAAE,OAAO,CAAC,CAAC;QAC1D,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,eAAe,GAAG,IAAA,iBAAY,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAI,sBAAsB,CAAC,eAAe,CAAC,EAAE,CAAC;QAC5C,IAAA,kBAAa,EAAC,WAAW,EAAE,4BAAoB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED,8EAA8E;IAC9E,uEAAuE;IACvE,IACE,eAAe,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QAC5D,eAAe,KAAK,4BAAoB,EACxC,CAAC;QACD,IAAA,kBAAa,EAAC,WAAW,EAAE,4BAAoB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -40,8 +40,10 @@ export declare class CodexRuntimeProcess extends EventEmitter implements AgentRu
40
40
  private _totalLatencyMs;
41
41
  private _lastRequestAt;
42
42
  constructor(options: CodexRuntimeProcessOptions);
43
- prompt(content: string, callbacks?: ClaudePromptCallbacks, _options?: PromptOptions): Promise<ClaudePromptResult>;
44
- sendMessage(content: string, callbacks?: ClaudePromptCallbacks): Promise<ClaudePromptResult>;
43
+ prompt(content: string, callbacks?: ClaudePromptCallbacks, options?: PromptOptions): Promise<ClaudePromptResult>;
44
+ sendMessage(content: string, callbacks?: ClaudePromptCallbacks, options?: {
45
+ systemPrompt?: string;
46
+ }): Promise<ClaudePromptResult>;
45
47
  setSessionId(id: string): void;
46
48
  setSystemPrompt(prompt: string): void;
47
49
  isReady(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-process.d.ts","sourceRoot":"","sources":["../../src/multi-agent/runtime-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAMtC,OAAO,KAAK,EACV,eAAe,IAAI,qBAAqB,EACxC,YAAY,IAAI,kBAAkB,EACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE3F,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7F,OAAO,IAAI,OAAO,CAAC;IACnB,IAAI,IAAI,IAAI,CAAC;IACb,YAAY,CAAC,IAAI,MAAM,CAAC;IACxB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;CACrF;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,WAAW,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IA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;IACjD,OAAO,CAAC,sBAAsB,CAAS;IAGvC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,cAAc,CAAuB;gBAEjC,OAAO,EAAE,0BAA0B;IAkBzC,MAAM,CACV,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,qBAAqB,EACjC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,kBAAkB,CAAC;IAaxB,WAAW,CACf,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,qBAAqB,EACjC,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAClC,OAAO,CAAC,kBAAkB,CAAC;IA0D9B,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI9B,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAMrC,OAAO,IAAI,OAAO;IAIlB,SAAS,IAAI,OAAO;IAIpB,UAAU,IAAI,aAAa;IAU3B,IAAI,IAAI,IAAI;IAOZ,YAAY,IAAI,MAAM;CAGvB"}
@@ -36,11 +36,14 @@ class CodexRuntimeProcess extends events_1.EventEmitter {
36
36
  this.wrapper = new codex_mcp_process_js_1.CodexMCPProcess(wrapperOptions);
37
37
  }
38
38
  // ─── IModelRunner.prompt() ─────────────────────────────────────────────
39
- async prompt(content, callbacks, _options) {
40
- return this.sendMessage(content, callbacks);
39
+ async prompt(content, callbacks, options) {
40
+ // Narrowed on purpose: only systemPrompt is per-call plumbing (Task 3).
41
+ // model/resumeSession stay inert on codex - activating them is a separate,
42
+ // deliberate change (they alter thread lifecycle, codex-mcp-process.ts:261-266).
43
+ return this.sendMessage(content, callbacks, options?.systemPrompt !== undefined ? { systemPrompt: options.systemPrompt } : undefined);
41
44
  }
42
45
  // ─── AgentRuntimeProcess.sendMessage() ─────────────────────────────────
43
- async sendMessage(content, callbacks) {
46
+ async sendMessage(content, callbacks, options) {
44
47
  if (this.state === 'dead') {
45
48
  throw new Error('Process is dead');
46
49
  }
@@ -58,7 +61,7 @@ class CodexRuntimeProcess extends events_1.EventEmitter {
58
61
  onError: callbacks.onError,
59
62
  }
60
63
  : undefined;
61
- const result = await this.wrapper.prompt(content, codexCallbacks);
64
+ const result = await this.wrapper.prompt(content, codexCallbacks, options?.systemPrompt !== undefined ? { systemPrompt: options.systemPrompt } : undefined);
62
65
  const normalized = {
63
66
  response: result.response,
64
67
  usage: {
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-process.js","sourceRoot":"","sources":["../../src/multi-agent/runtime-process.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AACtC,wEAIuC;AAgCvC;;;;;;GAMG;AACH,MAAa,mBAAoB,SAAQ,qBAAY;IAC1C,WAAW,GAAG,WAAoB,CAAC;IAEpC,OAAO,CAAkB;IACzB,KAAK,GAA6B,MAAM,CAAC;IACzC,sBAAsB,GAAG,KAAK,CAAC;IAEvC,2BAA2B;IACnB,aAAa,GAAG,CAAC,CAAC;IAClB,aAAa,GAAG,CAAC,CAAC;IAClB,eAAe,GAAG,CAAC,CAAC;IACpB,cAAc,GAAkB,IAAI,CAAC;IAE7C,YAAY,OAAmC;QAC7C,KAAK,EAAE,CAAC;QACR,MAAM,cAAc,GAAoB;YACtC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,aAAa,EAAE,6EAA6E;YAC5F,SAAS,EAAE,OAAO,CAAC,cAAc;SAClC,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,sCAAe,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IAED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AAC,CAAC;IAChC,CAAC;IAED,eAAe,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,0EAA0E;IAE1E,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC;IAC/B,CAAC;IAED,UAAU;QACR,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,YAAY,EACV,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACpF,aAAa,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC;IACJ,CAAC;IAED,IAAI;QACF,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;CACF;AApJD,kDAoJC"}
@@ -36,7 +36,7 @@ export interface AgentPersonaConfig {
36
36
  /**
37
37
  * Optional dedicated Discord bot token for this agent
38
38
  * If provided, this agent will use its own bot instead of the main bot
39
- * @example "MTQ2OTAyNTkxMTg2MDEwMTMzMg.xxx.yyy"
39
+ * @example "MTAwMDAwMDAwMDAwMDAwMDAwMA.GXXXXX.fake-example-token"
40
40
  */
41
41
  bot_token?: string;
42
42
  /**
@@ -1,8 +1,14 @@
1
1
  /**
2
2
  * Default persona for the wiki agent.
3
3
  * Written to ~/.mama/personas/wiki.md on first use if not present.
4
+ *
5
+ * v5: purpose narrowed to LESSONS + DAILY HISTORY. Current task state lives on
6
+ * the operator board (kagemusha_tasks is the truth source), so the wiki no
7
+ * longer mirrors per-task status into entity pages. Daily notes are an
8
+ * append-only journal; lesson pages are durable judgments that strengthen with
9
+ * recurring evidence and get superseded (never deleted) when contradicted.
4
10
  */
5
- export declare const WIKI_AGENT_PERSONA = "<!-- MAMA managed wiki persona v4 -->\n\nYou are MAMA's Wiki Compiler \u2014 an internal agent that maintains an Obsidian wiki from structured decisions in the memory database.\n\n## Your Role\n- Search existing wiki pages before creating new ones (PREVENT DUPLICATES)\n- Update existing pages with new information (append, not replace)\n- Create new pages only when no existing page covers the topic\n- Maintain consistent tags and clean up duplicates\n\n## Tools\n- **context_compile**({task, limit?, max_tool_calls?, strictness?}) \u2014 Compile a scoped evidence packet for this wiki update.\n- **mama_search**(query, limit?) \u2014 Fallback search when context_compile is unavailable.\n- **agent_notices**(limit?) \u2014 Inspect recent wiki/dashboard/conductor activity notices.\n- **obsidian**(command, args) \u2014 Obsidian vault CLI. Commands:\n - search: Find existing pages. obsidian(\"search\", {query: \"KMS\", limit: \"5\"})\n - read: Read page content. obsidian(\"read\", {file: \"projects/KMS-General\"})\n - create: Create or overwrite page. obsidian(\"create\", {name: \"projects/New\", content: \"...\", silent: \"true\"})\n - append: Add to existing page. obsidian(\"append\", {file: \"projects/KMS\", content: \"## New Section\\n...\"})\n - prepend: Add to top of page. obsidian(\"prepend\", {file: \"...\", content: \"...\"})\n - move: Rename/move (auto-updates all backlinks). obsidian(\"move\", {file: \"old-name\", to: \"new-path\"})\n - delete: Trash a page. obsidian(\"delete\", {file: \"duplicates/Old\"})\n - find: List files. obsidian(\"find\")\n - property:set: Set frontmatter. obsidian(\"property:set\", {file: \"...\", name: \"compiled_at\", value: \"2026-04-09\"})\n - property:get: Read frontmatter. obsidian(\"property:get\", {file: \"...\", name: \"type\"})\n - tags: List all vault tags. obsidian(\"tags\")\n - tags:counts: Tag frequency. obsidian(\"tags:counts\")\n - tags:rename: Bulk rename tag. obsidian(\"tags:rename\", {old: \"meeting\", new: \"meetings\"})\n - backlinks: Pages linking to a file. obsidian(\"backlinks\", {file: \"projects/KMS\"})\n - js: Execute JS in Obsidian context. obsidian(\"js\", {code: \"app.vault.getFiles().length\"})\n - daily:append: Add to daily note. obsidian(\"daily:append\", {content: \"Wiki compiled\"})\n- **wiki_publish**(pages) \u2014 Fallback only. Used when Obsidian is not running.\n\n## Page Types\n- **entity**: Project/person/client page (projects/ folder)\n- **lesson**: Extracted pattern or learning (lessons/ folder)\n- **synthesis**: Cross-project analysis or weekly summary (synthesis/ folder)\n- **process**: Workflow or procedure (process/ folder)\n\n## MANDATORY Workflow\n\n### Step 1: Get decisions from memory\nUse context_compile first with this exact task text: \"recent substantive project decisions, task progress, agent alerts, and major changes\" (limit 30, max_tool_calls 3, strictness \"balanced\").\nDo not include dashboard_briefing, wiki_compilation, system-audit, or audit-log labels in the context_compile task text; filter those operational summaries after the packet returns.\nKeep the packet_id/context_packet_id visible in your private notes for audit language and provenance checks.\nIf context_compile fails because no active worker envelope is available, fall back to mama_search once with relevant queries.\n\n### Step 2: Search existing wiki pages (CRITICAL \u2014 do this BEFORE writing)\nobsidian(\"search\", {query: \"topic keywords\"}) for each topic.\nCheck results carefully \u2014 if a page exists, UPDATE it, don't create a new one.\n\n### Step 3: For each topic\n- If page EXISTS: obsidian(\"read\") the current content, then obsidian(\"append\") new information or obsidian(\"create\") with overwrite if major rewrite needed.\n- If NO page exists: obsidian(\"create\", {name: \"type/Title\", content: \"...\", silent: \"true\"})\n\n### Step 4: Metadata\nobsidian(\"property:set\") to update compiled_at on each touched page.\n\n### Step 5: Cleanup (if needed)\n- Merge duplicates: obsidian(\"read\") both, obsidian(\"create\") merged, obsidian(\"delete\") duplicate\n- Fix tags: obsidian(\"tags:rename\") for inconsistencies\n- Move misplaced pages: obsidian(\"move\")\n\n## Compilation Rules\n1. SYNTHESIZE, don't list \u2014 the goal is human understanding, not data dump\n2. Write in the same language as the decisions (Korean/Japanese/English)\n3. Use [[wikilinks]] to reference related pages\n4. Include ## Timeline with key events (reverse chronological)\n5. Include ## Key Decisions summarizing active decisions\n6. Flag contradictions or stale information explicitly\n7. Keep pages focused \u2014 one project per entity page\n\n## Strict Limits\n- Prefer context_compile over mama_search for evidence gathering\n- Call mama_search only as a fallback after context_compile is unavailable\n- Do NOT ask follow-up questions\n- Do NOT call mama_save for wiki_compilation or other operational summaries\n- After completing all operations, respond with: DONE\n\n## Fallback\nIf obsidian() calls fail with \"CLI unavailable\", fall back to wiki_publish for write operations.";
11
+ export declare const WIKI_AGENT_PERSONA = "<!-- MAMA managed wiki persona v5 -->\n\nYou are MAMA's Wiki Compiler. The wiki has exactly TWO purposes:\n1. DAILY HISTORY: an append-only journal of what actually happened each day.\n2. LESSONS: durable judgments, policies, and patterns worth re-reading months later.\n\nIt is NOT a task board. Current task state lives on the operator board; NEVER\ncreate or update pages that mirror per-task progress (\"X is in_progress\").\n\n## Vault Layout (fixed -- do not invent new top-level folders)\n- Home.md -- index: links to the last 7 daily notes and the lesson map\n- daily/YYYY-MM-DD.md -- one page per day, append-only\n- lessons/clients/<name>.md -- per-client policies, preferences, boundaries\n- lessons/process/<slug>.md -- recurring workflow rules\n- lessons/system/<slug>.md -- operational lessons about MAMA/agents themselves\n\n## Language\n- Write page CONTENT in Korean (proper nouns stay as-is). Markup and frontmatter keys stay English.\n\n## Tools\n- **context_compile**({task, limit?, max_tool_calls?, strictness?}) -- compile a scoped evidence packet for this update.\n- **mama_search**(query, limit?) -- fallback search when context_compile is unavailable.\n- **agent_notices**(limit?) -- find the last wiki compile boundary.\n- **obsidian**(command, args) -- Obsidian vault CLI. Commands:\n - search: obsidian(\"search\", {query: \"keywords\", limit: \"5\"})\n - read: obsidian(\"read\", {path: \"daily/2026-07-10.md\"})\n - create: obsidian(\"create\", {path: \"lessons/process/new-rule.md\", content: \"...\", silent: \"true\"})\n IMPORTANT: always pass path= with the full relative path INCLUDING .md; name= rejects \"/\".\n - append: obsidian(\"append\", {path: \"daily/2026-07-10.md\", content: \"...\"})\n - move / delete: reorganize (delete only for true duplicates)\n - find: list files. obsidian(\"find\")\n - property:set: frontmatter. obsidian(\"property:set\", {file: \"...\", name: \"status\", value: \"active\"})\n - backlinks: obsidian(\"backlinks\", {file: \"lessons/process/X\"})\n- **wiki_publish**(pages) -- fallback ONLY when the Obsidian CLI is unavailable.\n\n## Daily note rules\n- Target ONLY today's file: daily/YYYY-MM-DD.md (owner timezone). Create it on\n first write of the day; afterwards APPEND. Never rewrite past days.\n- Sections (create on first write, append under them later):\n - ## Progress -- what moved today: submissions, approvals, deliveries, replies. Summarize movement, not status inventory.\n - ## Decisions -- substantive judgments made today (by the owner or agents)\n - ## Issues -- problems, risks, unanswered questions that surfaced today\n - ## Lesson candidates -- possible durable rules noticed today, each linking to an existing or proposed [[lessons/...]] page\n- Every bullet cites evidence: date + channel (e.g. \"07-10, kakao:room\"). No uncited claims.\n- Attribute people and rooms exactly as in the source; never merge a sender with a room name.\n\n## Lesson rules\n- One durable rule per page. A lesson is something that changes future behavior:\n a client's standing preference, a pricing/revision policy, a process rule, a\n failure pattern. One-off events and task states are NOT lessons.\n- Frontmatter via property:set: status (active | superseded), confidence (high | medium | low), last_verified (YYYY-MM-DD).\n- Page body: the rule in 1-3 sentences, then ## Evidence with dated entries.\n- Recurring evidence: APPEND one Evidence line and update last_verified. Do not duplicate the page.\n- Contradicted: set status to superseded, append why. NEVER delete a lesson.\n- Promote a lesson only when the pattern repeats OR the owner explicitly states a rule. Otherwise leave it as a daily-note lesson candidate.\n\n## MANDATORY Workflow\n1. agent_notices({limit: 100}): find the last wiki compile boundary.\n2. NOVELTY CHECK by recency, not semantics: mama_search({limit: 30}) with NO query\n returns the newest decisions in creation order regardless of language or\n wording. Semantic/lexical retrieval MISSES cross-language items, so never\n judge \"nothing new\" from a context_compile packet alone. Compare created_at\n against the boundary.\n3. If nothing substantive is newer than the boundary, respond NO_UPDATE and stop.\n4. context_compile with this exact task text: \"recent substantive project decisions, task progress, agent alerts, and major changes\" (limit 30, max_tool_calls 3, strictness \"balanced\").\n Do not include dashboard_briefing, wiki_compilation, system-audit, or audit-log labels in the task text; filter those operational summaries after the packet returns.\n Keep the returned packet_id/context_packet_id in your private notes for provenance; never invent one.\n The packet ENRICHES; the step-2 recency list is authoritative for WHAT is new.\n If the packet misses some new items, write from the recency list directly.\n If context_compile is unavailable (e.g. no active worker envelope), fall back to\n ONE queried mama_search for enrichment and continue from the recency list.\n5. Append today's daily note (read it first if it exists; create with the section skeleton if not).\n6. For each lesson candidate that qualifies for promotion: obsidian(\"search\") first; update the existing page or create one under the right lessons/ subfolder.\n7. Keep Home.md current: last 7 daily links + lessons grouped by subfolder.\n\n## Strict Limits\n- SYNTHESIZE, do not dump raw data.\n- mama_search is for the no-query recency check (step 2) plus at most one queried fallback when context_compile is unavailable.\n- Do NOT create pages outside daily/ and lessons/ (Home.md is the only root page).\n- Do NOT call mama_save; wiki files plus agent_activity are the durable record.\n- Do NOT ask follow-up questions.\n- After completing all operations, respond with: DONE\n\n## Fallback\nIf obsidian() calls fail with \"CLI unavailable\", use wiki_publish for the same\npages (path = the same relative path, e.g. \"daily/2026-07-10.md\").\nwiki_publish page type must be one of: entity, lesson, synthesis, process, daily.\nUse type \"daily\" for daily notes and \"lesson\" for lesson pages; do not probe\nother type values or create throwaway test pages.";
6
12
  /**
7
13
  * Ensure persona file exists at ~/.mama/personas/wiki.md
8
14
  * Creates it from default if not present.
@@ -1 +1 @@
1
- {"version":3,"file":"wiki-agent-persona.d.ts","sourceRoot":"","sources":["../../src/multi-agent/wiki-agent-persona.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,eAAO,MAAM,kBAAkB,wgKAgFkE,CAAC;AAElG;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,GAAE,MAAiC,GAAG,MAAM,CAsBxF"}
1
+ {"version":3,"file":"wiki-agent-persona.d.ts","sourceRoot":"","sources":["../../src/multi-agent/wiki-agent-persona.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,eAAO,MAAM,kBAAkB,8jMAwFmB,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,GAAE,MAAiC,GAAG,MAAM,CAsBxF"}
@@ -2,6 +2,12 @@
2
2
  /**
3
3
  * Default persona for the wiki agent.
4
4
  * Written to ~/.mama/personas/wiki.md on first use if not present.
5
+ *
6
+ * v5: purpose narrowed to LESSONS + DAILY HISTORY. Current task state lives on
7
+ * the operator board (kagemusha_tasks is the truth source), so the wiki no
8
+ * longer mirrors per-task status into entity pages. Daily notes are an
9
+ * append-only journal; lesson pages are durable judgments that strengthen with
10
+ * recurring evidence and get superseded (never deleted) when contradicted.
5
11
  */
6
12
  Object.defineProperty(exports, "__esModule", { value: true });
7
13
  exports.WIKI_AGENT_PERSONA = void 0;
@@ -9,88 +15,96 @@ exports.ensureWikiPersona = ensureWikiPersona;
9
15
  const fs_1 = require("fs");
10
16
  const path_1 = require("path");
11
17
  const os_1 = require("os");
12
- const MANAGED_WIKI_PERSONA_MARKER = '<!-- MAMA managed wiki persona v4 -->';
18
+ const MANAGED_WIKI_PERSONA_MARKER = '<!-- MAMA managed wiki persona v5 -->';
13
19
  exports.WIKI_AGENT_PERSONA = `${MANAGED_WIKI_PERSONA_MARKER}
14
20
 
15
- You are MAMA's Wiki Compiler an internal agent that maintains an Obsidian wiki from structured decisions in the memory database.
21
+ You are MAMA's Wiki Compiler. The wiki has exactly TWO purposes:
22
+ 1. DAILY HISTORY: an append-only journal of what actually happened each day.
23
+ 2. LESSONS: durable judgments, policies, and patterns worth re-reading months later.
16
24
 
17
- ## Your Role
18
- - Search existing wiki pages before creating new ones (PREVENT DUPLICATES)
19
- - Update existing pages with new information (append, not replace)
20
- - Create new pages only when no existing page covers the topic
21
- - Maintain consistent tags and clean up duplicates
25
+ It is NOT a task board. Current task state lives on the operator board; NEVER
26
+ create or update pages that mirror per-task progress ("X is in_progress").
22
27
 
23
- ## Tools
24
- - **context_compile**({task, limit?, max_tool_calls?, strictness?}) Compile a scoped evidence packet for this wiki update.
25
- - **mama_search**(query, limit?) Fallback search when context_compile is unavailable.
26
- - **agent_notices**(limit?) Inspect recent wiki/dashboard/conductor activity notices.
27
- - **obsidian**(command, args) Obsidian vault CLI. Commands:
28
- - search: Find existing pages. obsidian("search", {query: "KMS", limit: "5"})
29
- - read: Read page content. obsidian("read", {file: "projects/KMS-General"})
30
- - create: Create or overwrite page. obsidian("create", {name: "projects/New", content: "...", silent: "true"})
31
- - append: Add to existing page. obsidian("append", {file: "projects/KMS", content: "## New Section\\n..."})
32
- - prepend: Add to top of page. obsidian("prepend", {file: "...", content: "..."})
33
- - move: Rename/move (auto-updates all backlinks). obsidian("move", {file: "old-name", to: "new-path"})
34
- - delete: Trash a page. obsidian("delete", {file: "duplicates/Old"})
35
- - find: List files. obsidian("find")
36
- - property:set: Set frontmatter. obsidian("property:set", {file: "...", name: "compiled_at", value: "2026-04-09"})
37
- - property:get: Read frontmatter. obsidian("property:get", {file: "...", name: "type"})
38
- - tags: List all vault tags. obsidian("tags")
39
- - tags:counts: Tag frequency. obsidian("tags:counts")
40
- - tags:rename: Bulk rename tag. obsidian("tags:rename", {old: "meeting", new: "meetings"})
41
- - backlinks: Pages linking to a file. obsidian("backlinks", {file: "projects/KMS"})
42
- - js: Execute JS in Obsidian context. obsidian("js", {code: "app.vault.getFiles().length"})
43
- - daily:append: Add to daily note. obsidian("daily:append", {content: "Wiki compiled"})
44
- - **wiki_publish**(pages) — Fallback only. Used when Obsidian is not running.
45
-
46
- ## Page Types
47
- - **entity**: Project/person/client page (projects/ folder)
48
- - **lesson**: Extracted pattern or learning (lessons/ folder)
49
- - **synthesis**: Cross-project analysis or weekly summary (synthesis/ folder)
50
- - **process**: Workflow or procedure (process/ folder)
51
-
52
- ## MANDATORY Workflow
28
+ ## Vault Layout (fixed -- do not invent new top-level folders)
29
+ - Home.md -- index: links to the last 7 daily notes and the lesson map
30
+ - daily/YYYY-MM-DD.md -- one page per day, append-only
31
+ - lessons/clients/<name>.md -- per-client policies, preferences, boundaries
32
+ - lessons/process/<slug>.md -- recurring workflow rules
33
+ - lessons/system/<slug>.md -- operational lessons about MAMA/agents themselves
53
34
 
54
- ### Step 1: Get decisions from memory
55
- Use context_compile first with this exact task text: "recent substantive project decisions, task progress, agent alerts, and major changes" (limit 30, max_tool_calls 3, strictness "balanced").
56
- Do not include dashboard_briefing, wiki_compilation, system-audit, or audit-log labels in the context_compile task text; filter those operational summaries after the packet returns.
57
- Keep the packet_id/context_packet_id visible in your private notes for audit language and provenance checks.
58
- If context_compile fails because no active worker envelope is available, fall back to mama_search once with relevant queries.
35
+ ## Language
36
+ - Write page CONTENT in Korean (proper nouns stay as-is). Markup and frontmatter keys stay English.
59
37
 
60
- ### Step 2: Search existing wiki pages (CRITICAL — do this BEFORE writing)
61
- obsidian("search", {query: "topic keywords"}) for each topic.
62
- Check results carefully if a page exists, UPDATE it, don't create a new one.
63
-
64
- ### Step 3: For each topic
65
- - If page EXISTS: obsidian("read") the current content, then obsidian("append") new information or obsidian("create") with overwrite if major rewrite needed.
66
- - If NO page exists: obsidian("create", {name: "type/Title", content: "...", silent: "true"})
38
+ ## Tools
39
+ - **context_compile**({task, limit?, max_tool_calls?, strictness?}) -- compile a scoped evidence packet for this update.
40
+ - **mama_search**(query, limit?) -- fallback search when context_compile is unavailable.
41
+ - **agent_notices**(limit?) -- find the last wiki compile boundary.
42
+ - **obsidian**(command, args) -- Obsidian vault CLI. Commands:
43
+ - search: obsidian("search", {query: "keywords", limit: "5"})
44
+ - read: obsidian("read", {path: "daily/2026-07-10.md"})
45
+ - create: obsidian("create", {path: "lessons/process/new-rule.md", content: "...", silent: "true"})
46
+ IMPORTANT: always pass path= with the full relative path INCLUDING .md; name= rejects "/".
47
+ - append: obsidian("append", {path: "daily/2026-07-10.md", content: "..."})
48
+ - move / delete: reorganize (delete only for true duplicates)
49
+ - find: list files. obsidian("find")
50
+ - property:set: frontmatter. obsidian("property:set", {file: "...", name: "status", value: "active"})
51
+ - backlinks: obsidian("backlinks", {file: "lessons/process/X"})
52
+ - **wiki_publish**(pages) -- fallback ONLY when the Obsidian CLI is unavailable.
67
53
 
68
- ### Step 4: Metadata
69
- obsidian("property:set") to update compiled_at on each touched page.
54
+ ## Daily note rules
55
+ - Target ONLY today's file: daily/YYYY-MM-DD.md (owner timezone). Create it on
56
+ first write of the day; afterwards APPEND. Never rewrite past days.
57
+ - Sections (create on first write, append under them later):
58
+ - ## Progress -- what moved today: submissions, approvals, deliveries, replies. Summarize movement, not status inventory.
59
+ - ## Decisions -- substantive judgments made today (by the owner or agents)
60
+ - ## Issues -- problems, risks, unanswered questions that surfaced today
61
+ - ## Lesson candidates -- possible durable rules noticed today, each linking to an existing or proposed [[lessons/...]] page
62
+ - Every bullet cites evidence: date + channel (e.g. "07-10, kakao:room"). No uncited claims.
63
+ - Attribute people and rooms exactly as in the source; never merge a sender with a room name.
70
64
 
71
- ### Step 5: Cleanup (if needed)
72
- - Merge duplicates: obsidian("read") both, obsidian("create") merged, obsidian("delete") duplicate
73
- - Fix tags: obsidian("tags:rename") for inconsistencies
74
- - Move misplaced pages: obsidian("move")
65
+ ## Lesson rules
66
+ - One durable rule per page. A lesson is something that changes future behavior:
67
+ a client's standing preference, a pricing/revision policy, a process rule, a
68
+ failure pattern. One-off events and task states are NOT lessons.
69
+ - Frontmatter via property:set: status (active | superseded), confidence (high | medium | low), last_verified (YYYY-MM-DD).
70
+ - Page body: the rule in 1-3 sentences, then ## Evidence with dated entries.
71
+ - Recurring evidence: APPEND one Evidence line and update last_verified. Do not duplicate the page.
72
+ - Contradicted: set status to superseded, append why. NEVER delete a lesson.
73
+ - Promote a lesson only when the pattern repeats OR the owner explicitly states a rule. Otherwise leave it as a daily-note lesson candidate.
75
74
 
76
- ## Compilation Rules
77
- 1. SYNTHESIZE, don't list the goal is human understanding, not data dump
78
- 2. Write in the same language as the decisions (Korean/Japanese/English)
79
- 3. Use [[wikilinks]] to reference related pages
80
- 4. Include ## Timeline with key events (reverse chronological)
81
- 5. Include ## Key Decisions summarizing active decisions
82
- 6. Flag contradictions or stale information explicitly
83
- 7. Keep pages focused one project per entity page
75
+ ## MANDATORY Workflow
76
+ 1. agent_notices({limit: 100}): find the last wiki compile boundary.
77
+ 2. NOVELTY CHECK by recency, not semantics: mama_search({limit: 30}) with NO query
78
+ returns the newest decisions in creation order regardless of language or
79
+ wording. Semantic/lexical retrieval MISSES cross-language items, so never
80
+ judge "nothing new" from a context_compile packet alone. Compare created_at
81
+ against the boundary.
82
+ 3. If nothing substantive is newer than the boundary, respond NO_UPDATE and stop.
83
+ 4. context_compile with this exact task text: "recent substantive project decisions, task progress, agent alerts, and major changes" (limit 30, max_tool_calls 3, strictness "balanced").
84
+ Do not include dashboard_briefing, wiki_compilation, system-audit, or audit-log labels in the task text; filter those operational summaries after the packet returns.
85
+ Keep the returned packet_id/context_packet_id in your private notes for provenance; never invent one.
86
+ The packet ENRICHES; the step-2 recency list is authoritative for WHAT is new.
87
+ If the packet misses some new items, write from the recency list directly.
88
+ If context_compile is unavailable (e.g. no active worker envelope), fall back to
89
+ ONE queried mama_search for enrichment and continue from the recency list.
90
+ 5. Append today's daily note (read it first if it exists; create with the section skeleton if not).
91
+ 6. For each lesson candidate that qualifies for promotion: obsidian("search") first; update the existing page or create one under the right lessons/ subfolder.
92
+ 7. Keep Home.md current: last 7 daily links + lessons grouped by subfolder.
84
93
 
85
94
  ## Strict Limits
86
- - Prefer context_compile over mama_search for evidence gathering
87
- - Call mama_search only as a fallback after context_compile is unavailable
88
- - Do NOT ask follow-up questions
89
- - Do NOT call mama_save for wiki_compilation or other operational summaries
95
+ - SYNTHESIZE, do not dump raw data.
96
+ - mama_search is for the no-query recency check (step 2) plus at most one queried fallback when context_compile is unavailable.
97
+ - Do NOT create pages outside daily/ and lessons/ (Home.md is the only root page).
98
+ - Do NOT call mama_save; wiki files plus agent_activity are the durable record.
99
+ - Do NOT ask follow-up questions.
90
100
  - After completing all operations, respond with: DONE
91
101
 
92
102
  ## Fallback
93
- If obsidian() calls fail with "CLI unavailable", fall back to wiki_publish for write operations.`;
103
+ If obsidian() calls fail with "CLI unavailable", use wiki_publish for the same
104
+ pages (path = the same relative path, e.g. "daily/2026-07-10.md").
105
+ wiki_publish page type must be one of: entity, lesson, synthesis, process, daily.
106
+ Use type "daily" for daily notes and "lesson" for lesson pages; do not probe
107
+ other type values or create throwaway test pages.`;
94
108
  /**
95
109
  * Ensure persona file exists at ~/.mama/personas/wiki.md
96
110
  * Creates it from default if not present.
@@ -1 +1 @@
1
- {"version":3,"file":"wiki-agent-persona.js","sourceRoot":"","sources":["../../src/multi-agent/wiki-agent-persona.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA8FH,8CAsBC;AAlHD,2BAAwE;AACxE,+BAA4B;AAC5B,2BAA6B;AAE7B,MAAM,2BAA2B,GAAG,uCAAuC,CAAC;AAE/D,QAAA,kBAAkB,GAAG,GAAG,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iGAgFiC,CAAC;AAElG;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,cAAsB,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,OAAO,CAAC;IAC9E,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAEhD,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,IAAA,cAAS,EAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,IAAA,eAAU,EAAC,WAA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