@cteno/sdk-linux-x64 0.0.0-stage → 2.10.14

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 (116) hide show
  1. package/LICENSE.daemon +31 -0
  2. package/README.md +4 -2
  3. package/agents/flow-analyzer/AGENT.md +71 -0
  4. package/bin/cteno-host-cli +4 -0
  5. package/bin/cteno-wiki +0 -0
  6. package/bin/rg +0 -0
  7. package/bin/secret-exec +0 -0
  8. package/manifest.json +12 -0
  9. package/package.json +33 -4
  10. package/plugins/agent-secrets/.cteno-plugin/plugin.json +133 -0
  11. package/plugins/agent-secrets/bin/linux-x64/fnox +4 -0
  12. package/plugins/agent-secrets/bin/linux-x64/secret-exec +0 -0
  13. package/plugins/agent-secrets/skills/secret/SKILL.md +201 -0
  14. package/plugins/cteno.browser/.cteno-plugin/plugin.json +65 -0
  15. package/plugins/cteno.browser/skills/browser/SKILL.md +28 -0
  16. package/plugins/cteno.inbox/.cteno-plugin/plugin.json +132 -0
  17. package/plugins/cteno.inbox/bin/all/cteno-connector-credential +31 -0
  18. package/plugins/cteno.inbox/bin/all/cteno-telegram-connector +33 -0
  19. package/plugins/cteno.inbox/bin/linux-x64/cteno-inbox +0 -0
  20. package/plugins/cteno.inbox/skills/cteno-inbox/SKILL.md +374 -0
  21. package/plugins/cteno.inbox/tools/inbox_focus/TOOL.md +44 -0
  22. package/plugins/cteno.memory/.cteno-plugin/plugin.json +176 -0
  23. package/plugins/cteno.memory/agents/llm-wiki/AGENT.md +96 -0
  24. package/plugins/cteno.memory/bin/linux-x64/cteno-wiki +0 -0
  25. package/plugins/cteno.memory/skills/codebase-wiki/SKILL.md +52 -0
  26. package/plugins/cteno.memory/skills/cteno.memory.native/SKILL.md +110 -0
  27. package/plugins/cteno.memory/tools/memory/TOOL.md +492 -0
  28. package/plugins/cteno.memory/ui/index.html +822 -0
  29. package/plugins/cteno.models/.cteno-plugin/plugin.json +191 -0
  30. package/plugins/cteno.websearch/.cteno-plugin/plugin.json +45 -0
  31. package/plugins/jev/.cteno-plugin/plugin.json +309 -0
  32. package/plugins/jev/skills/jev-browser/SKILL.md +66 -0
  33. package/plugins/jev/skills/jev-browser/jev_browser.py +335 -0
  34. package/skills/agent-create/SKILL.md +86 -0
  35. package/skills/cteno-host-cli/SKILL.md +256 -0
  36. package/skills/docx/LICENSE +23 -0
  37. package/skills/docx/NOTICE.md +8 -0
  38. package/skills/docx/SKILL.md +69 -0
  39. package/skills/docx/references/cjk_typography.md +357 -0
  40. package/skills/docx/references/design_principles.md +819 -0
  41. package/skills/docx/references/revisions-and-comments.md +88 -0
  42. package/skills/docx/references/track_changes_guide.md +200 -0
  43. package/skills/docx/references/typography_guide.md +294 -0
  44. package/skills/docx/scripts/cjk_fonts.py +244 -0
  45. package/skills/docx/scripts/docx_comments.py +289 -0
  46. package/skills/docx/scripts/docx_common.py +92 -0
  47. package/skills/docx/scripts/docx_create.py +259 -0
  48. package/skills/docx/scripts/docx_edit.py +250 -0
  49. package/skills/docx/scripts/docx_read.py +149 -0
  50. package/skills/docx/scripts/docx_revisions.py +146 -0
  51. package/skills/docx/scripts/docx_template.py +70 -0
  52. package/skills/docx/scripts/docx_validate.py +156 -0
  53. package/skills/docx/scripts/render.py +250 -0
  54. package/skills/docx/tests/test_docx_skill.py +525 -0
  55. package/skills/home-devices/SKILL.md +121 -0
  56. package/skills/mcp/SKILL.md +72 -0
  57. package/skills/mcp/scripts/mcp_setup.py +439 -0
  58. package/skills/pdf/LICENSE +23 -0
  59. package/skills/pdf/NOTICE.md +8 -0
  60. package/skills/pdf/SKILL.md +63 -0
  61. package/skills/pdf/references/design-tokens.md +381 -0
  62. package/skills/pdf/references/forms.md +99 -0
  63. package/skills/pdf/references/nano-pdf-editing.md +40 -0
  64. package/skills/pdf/references/ocr-extraction.md +165 -0
  65. package/skills/pdf/scripts/_raster.py +76 -0
  66. package/skills/pdf/scripts/extract_marker.py +88 -0
  67. package/skills/pdf/scripts/extract_pymupdf.py +101 -0
  68. package/skills/pdf/scripts/pdf_create.py +191 -0
  69. package/skills/pdf/scripts/pdf_fill_form.py +97 -0
  70. package/skills/pdf/scripts/pdf_form_layout.py +168 -0
  71. package/skills/pdf/scripts/pdf_make_form.py +145 -0
  72. package/skills/pdf/scripts/pdf_merge.py +50 -0
  73. package/skills/pdf/scripts/pdf_meta.py +115 -0
  74. package/skills/pdf/scripts/pdf_page_image.py +99 -0
  75. package/skills/pdf/scripts/pdf_read.py +153 -0
  76. package/skills/pdf/scripts/pdf_secure.py +71 -0
  77. package/skills/pdf/scripts/pdf_split.py +84 -0
  78. package/skills/pdf/scripts/pdf_stamp.py +143 -0
  79. package/skills/pdf/scripts/pdf_watermark.py +51 -0
  80. package/skills/pdf/scripts/render.py +250 -0
  81. package/skills/pdf/tests/test_pdf_skill.py +415 -0
  82. package/skills/pptx/LICENSE +23 -0
  83. package/skills/pptx/NOTICE.md +8 -0
  84. package/skills/pptx/SKILL.md +62 -0
  85. package/skills/pptx/references/design-system.md +392 -0
  86. package/skills/pptx/references/pptxgenjs.md +420 -0
  87. package/skills/pptx/references/slide-types.md +413 -0
  88. package/skills/pptx/scripts/cjk_fonts.py +244 -0
  89. package/skills/pptx/scripts/pptx_create.py +240 -0
  90. package/skills/pptx/scripts/pptx_edit.py +436 -0
  91. package/skills/pptx/scripts/pptx_from_template.py +88 -0
  92. package/skills/pptx/scripts/pptx_read.py +131 -0
  93. package/skills/pptx/scripts/pptx_render.py +96 -0
  94. package/skills/pptx/scripts/render.py +250 -0
  95. package/skills/pptx/tests/test_powerpoint_skill.py +477 -0
  96. package/skills/skill-create/SKILL.md +114 -0
  97. package/skills/video-generation/SKILL.md +27 -0
  98. package/skills/xlsx/LICENSE +23 -0
  99. package/skills/xlsx/NOTICE.md +8 -0
  100. package/skills/xlsx/SKILL.md +63 -0
  101. package/skills/xlsx/references/format.md +71 -0
  102. package/skills/xlsx/references/restructuring.md +71 -0
  103. package/skills/xlsx/scripts/csv_to_xlsx.py +110 -0
  104. package/skills/xlsx/scripts/formula_check.py +428 -0
  105. package/skills/xlsx/scripts/render.py +250 -0
  106. package/skills/xlsx/scripts/xlsx_create.py +265 -0
  107. package/skills/xlsx/scripts/xlsx_edit.py +269 -0
  108. package/skills/xlsx/scripts/xlsx_read.py +166 -0
  109. package/skills/xlsx/scripts/xlsx_recalc.py +119 -0
  110. package/skills/xlsx/scripts/xlsx_restructure.py +343 -0
  111. package/skills/xlsx/scripts/xlsx_to_csv.py +75 -0
  112. package/skills/xlsx/tests/test_xlsx_skill.py +544 -0
  113. package/tools/create_goal/TOOL.md +36 -0
  114. package/tools/image_generation/TOOL.md +81 -0
  115. package/tools/skill/TOOL.md +117 -0
  116. package/tools/update_profile_notes/TOOL.md +39 -0
@@ -0,0 +1,492 @@
1
+ ---
2
+ id: "memory"
3
+ name: "Persistent Memory"
4
+ description: "Save, recall, and consolidate persistent knowledge across sessions. Supports fast daily logs and slow LLM dreaming into durable topic memories."
5
+ category: "system"
6
+ version: "3.1.0"
7
+ supports_background: false
8
+ # Fully externalized plugin tool: BOTH the declaration (this file) and the
9
+ # execution body (the bundled `cteno-wiki` CLI) ship inside the cteno.memory
10
+ # plugin. The host only spawns the declared command and pipes tool input JSON
11
+ # on stdin — it holds no memory business logic at all.
12
+ # Contract: exit code decides success; stdout carries the agent-facing result.
13
+ # See docs/architecture/cteno-wiki-memory-plugin.md.
14
+ handler:
15
+ type: command
16
+ command: cteno-wiki
17
+ args: ["tool"]
18
+ timeout_secs: 180
19
+ input_schema:
20
+ type: object
21
+ description: "Persistent memory operations. Choose an action and provide the required fields for that action."
22
+ oneOf:
23
+ - type: object
24
+ properties:
25
+ action:
26
+ type: string
27
+ const: "save"
28
+ description: "Save a durable fact into an OKF topic page and upsert its index.md entry. Repeated exact saves are de-duplicated."
29
+ file_path:
30
+ type: string
31
+ description: "Scope-relative OKF topic path, e.g. 'USER.md', 'knowledge/rust.md', or 'incidents/build.md'. Legacy MEMORY.md callers are redirected to knowledge/general.md."
32
+ content:
33
+ type: string
34
+ description: "Durable Markdown fact or section to merge into the topic page. Do not include daily/transient logs."
35
+ type:
36
+ type: string
37
+ enum: ["user", "feedback", "project", "reference", "incident", "workflow"]
38
+ description: "记忆类型标签。user=用户偏好/习惯, feedback=经验教训/规则, project=项目架构/约定, reference=领域知识/参考, incident=事故/复盘, workflow=工作流/协作规则"
39
+ scope:
40
+ type: string
41
+ enum: ["private", "global"]
42
+ description: "Memory scope. 'private' (default) saves to your persona's private space. 'global' saves to shared workspace visible to all personas."
43
+ required: ["action", "content", "type"]
44
+ additionalProperties: false
45
+ - type: object
46
+ properties:
47
+ action:
48
+ type: string
49
+ const: "overwrite"
50
+ description: "Replace a memory page with newly authored OKF content, unioning its sources[] provenance with the existing page (read-modify-write). The merge primitive for wiki consolidation."
51
+ file_path:
52
+ type: string
53
+ description: "Workspace-relative page path, e.g. 'knowledge/rust.md'."
54
+ content:
55
+ type: string
56
+ description: "Full OKF page content (YAML frontmatter + markdown body)."
57
+ sources:
58
+ type: array
59
+ items:
60
+ type: string
61
+ description: "Provenance strings to record (e.g. 'log: logs/2026/06/2026-06-20.md'); unioned with the page's existing sources[]."
62
+ scope:
63
+ type: string
64
+ enum: ["private", "global"]
65
+ required: ["action", "file_path", "content"]
66
+ additionalProperties: false
67
+ - type: object
68
+ properties:
69
+ action:
70
+ type: string
71
+ const: "recall"
72
+ description: "Wiki recall across BOTH private and global memory: index-first whole pages under a Unicode-character budget (not keyword chunks). Oversized bodies are represented by path for existing grep + ranged read. Only a total miss returns the topic index map."
73
+ query:
74
+ type: string
75
+ description: "Topic query — matched against the topic-organized index (topic, title, path, description)."
76
+ type:
77
+ type: string
78
+ enum: ["user", "feedback", "project", "reference", "incident", "workflow"]
79
+ description: "可选类型过滤。设置后只返回匹配类型的记忆。"
80
+ limit:
81
+ type: integer
82
+ description: "Maximum pages to return (default 10)."
83
+ max_chars:
84
+ type: integer
85
+ minimum: 1
86
+ description: "Maximum total Unicode characters of whole-page bodies to include (default 32000). Oversized pages are returned as path descriptors for grep + ranged read; no page is silently cut."
87
+ project:
88
+ type: string
89
+ description: "Optional absolute path of ANOTHER project root to drill into READ-ONLY (its <project>/.cteno/memory only; no global). Use it from the main conversation to look into a project listed in <project_directory>. Only recall/read/list read through it; log appends a forwarded entry to its daily log; save/overwrite/delete/dream reject it."
90
+ required: ["action", "query"]
91
+ additionalProperties: false
92
+ - type: object
93
+ properties:
94
+ action:
95
+ type: string
96
+ const: "sync_docs"
97
+ description: "Reconcile the active project's docs/**/*.md(x) files byte-for-byte into managed raw/docs/** OKF pages. Creates, updates, and removes pages by source fingerprint."
98
+ scope:
99
+ type: string
100
+ const: "private"
101
+ description: "Project docs always sync into the active project's private memory scope."
102
+ required: ["action"]
103
+ additionalProperties: false
104
+ - type: object
105
+ properties:
106
+ action:
107
+ type: string
108
+ const: "log"
109
+ description: "Append a timestamped fast-memory entry to today's daily log. With `project`, forward it append-only to that project's daily log as well."
110
+ content:
111
+ type: string
112
+ description: "Concise event/fact to append. This is append-only source material, not polished long-term memory."
113
+ source:
114
+ type: string
115
+ description: "Optional source label, e.g. session, slack, figma, gate, traffic."
116
+ scope:
117
+ type: string
118
+ enum: ["private", "global"]
119
+ description: "Where to store the daily log. 'private' (default) uses the current project/persona memory; 'global' uses shared memory."
120
+ project:
121
+ type: string
122
+ description: "Optional absolute root of a known project (listed in <project_directory>). Forwards this entry APPEND-ONLY into <project>/.cteno/memory/logs/<today>.md with an origin note (which Jelly/session, when), and keeps a marked copy in your own log. The project's own dream consolidates it. Use it from a main conversation for project decisions; never writes project pages."
123
+ origin_entry:
124
+ type: string
125
+ description: "Dream routing only (with project): the source log entry being forwarded, as '<log path> <HH:MM:SS>', e.g. 'logs/2026/10/2026-10-27.md 18:35:06'. Makes the forward idempotent; no copy is written to your own log."
126
+ required: ["action", "content"]
127
+ additionalProperties: false
128
+ - type: object
129
+ properties:
130
+ action:
131
+ type: string
132
+ const: "dream"
133
+ description: "Run slow-memory LLM consolidation: read daily logs and the topic index, then merge durable facts into OKF wiki pages (index.md entries are maintained automatically)."
134
+ context:
135
+ type: string
136
+ description: "Optional extra consolidation instruction, e.g. focus on coordination lessons from today."
137
+ scope:
138
+ type: string
139
+ enum: ["private", "global"]
140
+ description: "Which memory scope to consolidate. Defaults to private project/persona memory."
141
+ required: ["action"]
142
+ additionalProperties: false
143
+ - type: object
144
+ properties:
145
+ action:
146
+ type: string
147
+ const: "dream_report"
148
+ description: "Dream sessions only: record this consolidation pass's outcome on the Memory page. Call once as the LAST step — status ok with the pages you changed, or failed with the reason. A failure is shown to the user and never retried automatically."
149
+ status:
150
+ type: string
151
+ enum: ["ok", "failed"]
152
+ summary:
153
+ type: string
154
+ description: "One or two sentences on what was consolidated (or attempted)."
155
+ pages:
156
+ type: array
157
+ items:
158
+ type: string
159
+ description: "Scope-relative paths of pages written or deleted in this pass."
160
+ ideas:
161
+ type: array
162
+ description: "Daemon-authorized dream only: grounded candidate ideas; empty means no change. No run, owner or token fields are accepted."
163
+ items:
164
+ type: object
165
+ additionalProperties: false
166
+ required: [topic, title, rationale, minimalAction]
167
+ properties:
168
+ topic:
169
+ type: string
170
+ title:
171
+ type: string
172
+ rationale:
173
+ type: string
174
+ minimalAction:
175
+ type: string
176
+ proposals:
177
+ type: array
178
+ description: "Proposals of this pass (digest-it-yourself table). Most you already acted on (needs_user=false); only schedule, or a conflict about money/external commitments/direction with equal evidence, sets needs_user=true."
179
+ items:
180
+ type: object
181
+ properties:
182
+ kind:
183
+ type: string
184
+ enum: ["clarify", "conflict", "promote", "guard", "followup", "stale", "expire", "privacy", "schedule", "skillify"]
185
+ evidence:
186
+ type: string
187
+ description: "Where the signal came from (log/page lines). Never copy a secret here."
188
+ action:
189
+ type: string
190
+ description: "One sentence: what you did, or what should be done."
191
+ confidence:
192
+ type: number
193
+ needs_user:
194
+ type: boolean
195
+ pages:
196
+ type: array
197
+ items:
198
+ type: string
199
+ description: "Scope-relative pages changed for this proposal."
200
+ required: ["kind", "evidence", "action"]
201
+ error:
202
+ type: string
203
+ description: "Required when status=failed: what went wrong."
204
+ scope:
205
+ type: string
206
+ enum: ["private", "global"]
207
+ required: ["action", "status"]
208
+ additionalProperties: false
209
+ - type: object
210
+ properties:
211
+ action:
212
+ type: string
213
+ const: "migrate"
214
+ description: "One-shot, idempotent migration of the current memory scope to OKF: rewrite legacy type+date frontmatter, generate index.md, seed log.md."
215
+ scope:
216
+ type: string
217
+ enum: ["private", "global"]
218
+ required: ["action"]
219
+ additionalProperties: false
220
+ - type: object
221
+ properties:
222
+ action:
223
+ type: string
224
+ const: "manifest"
225
+ description: "Return JSON metadata for memory files, useful before recall or dream."
226
+ scope:
227
+ type: string
228
+ enum: ["private", "global"]
229
+ description: "Which memory scope to inspect. Defaults to private + global."
230
+ required: ["action"]
231
+ additionalProperties: false
232
+ - type: object
233
+ properties:
234
+ action:
235
+ type: string
236
+ const: "dream_prompt"
237
+ description: "Build the structured slow-memory consolidation prompt without calling the LLM. Useful for debugging."
238
+ context:
239
+ type: string
240
+ description: "Optional extra consolidation instruction."
241
+ scope:
242
+ type: string
243
+ enum: ["private", "global"]
244
+ required: ["action"]
245
+ additionalProperties: false
246
+ - type: object
247
+ properties:
248
+ action:
249
+ type: string
250
+ const: "read"
251
+ description: "Read a specific memory file."
252
+ file_path:
253
+ type: string
254
+ description: "Workspace-relative path to read, e.g. 'MEMORY.md' or 'knowledge/rust.md'."
255
+ scope:
256
+ type: string
257
+ enum: ["private", "global"]
258
+ description: "Which space to read from. 'private' (default) checks your persona's space first, falls back to global. 'global' reads from shared workspace only."
259
+ project:
260
+ type: string
261
+ description: "Optional absolute path of ANOTHER project root to drill into READ-ONLY (its <project>/.cteno/memory only; no global). Use it from the main conversation to look into a project listed in <project_directory>. Only recall/read/list read through it; log appends a forwarded entry to its daily log; save/overwrite/delete/dream reject it."
262
+ required: ["action", "file_path"]
263
+ additionalProperties: false
264
+ - type: object
265
+ properties:
266
+ action:
267
+ type: string
268
+ const: "delete"
269
+ description: "Delete a memory page and remove its index.md entry."
270
+ file_path:
271
+ type: string
272
+ description: "Workspace-relative path to delete, e.g. 'knowledge/stale-topic.md'."
273
+ scope:
274
+ type: string
275
+ enum: ["private", "global"]
276
+ description: "Which space to delete from. 'private' (default) targets the persona/project space; 'global' the shared workspace."
277
+ required: ["action", "file_path"]
278
+ additionalProperties: false
279
+ - type: object
280
+ properties:
281
+ action:
282
+ type: string
283
+ const: "list"
284
+ description: "List all memory files."
285
+ scope:
286
+ type: string
287
+ enum: ["private", "global"]
288
+ description: "Which files to list. 'private' (default) shows both private and global files with labels. 'global' shows only shared workspace files."
289
+ project:
290
+ type: string
291
+ description: "Optional absolute path of ANOTHER project root to drill into READ-ONLY (its <project>/.cteno/memory only; no global). Use it from the main conversation to look into a project listed in <project_directory>. Only recall/read/list read through it; log appends a forwarded entry to its daily log; save/overwrite/delete/dream reject it."
292
+ required: ["action"]
293
+ additionalProperties: false
294
+ is_read_only: false
295
+ is_concurrency_safe: false
296
+ ---
297
+
298
+ # Persistent Memory Tool
299
+
300
+ Save and recall persistent knowledge that survives across sessions.
301
+
302
+ ## Persona 记忆空间
303
+
304
+ 每个 Persona 拥有**私有记忆空间** + 可读写**全局记忆**。
305
+
306
+ ### 空间隔离
307
+
308
+ - **私有空间** (`scope: "private"`,默认): 仅该 Persona 及其 Worker 可见
309
+ - **全局空间** (`scope: "global"`): 所有 Persona 和 Agent 共享
310
+ - **recall 搜索**同时覆盖私有 + 全局记忆(无需指定 scope)
311
+ - Worker Session 继承 Persona 的私有记忆空间
312
+
313
+ ### MEMORY.md 兼容入口
314
+
315
+ 旧 `MEMORY.md` 仍可读取并注入,但不再作为 durable save 目标。新的 `save`
316
+ 必须写入独立 OKF 主题页;历史调用若仍传 `MEMORY.md`,运行时会安全重定向到
317
+ `knowledge/general.md` 并维护索引。
318
+
319
+ ### 文件路径
320
+
321
+ - 私有空间路径相对于 `{persona_workdir}/.cteno/`(Persona 的工作目录下)
322
+ - 全局空间路径相对于 `workspace/`
323
+ - 路径不能包含 `..` 或绝对路径
324
+
325
+ ## 记忆类型
326
+
327
+ 保存记忆时可指定类型标签,便于后续精准召回:
328
+ - **user**: 用户偏好、习惯、角色(如"用户偏好暗色主题")
329
+ - **feedback**: 经验教训、工作规则(如"测试不要 mock 数据库")
330
+ - **project**: 项目架构、约定、技术决策(如"API 用 REST 不用 GraphQL")
331
+ - **reference**: 领域知识、外部资源指针(如"Bug 跟踪在 Linear INGEST 项目")
332
+ - **incident**: 事故、冲突、复盘和恢复方式
333
+ - **workflow**: 跨 session / 多 agent 协作流程、门控和交通管制规则
334
+
335
+ 召回时可按类型过滤,只获取特定类型的记忆。未标记类型的旧记忆在无过滤时正常返回。
336
+
337
+ ## Policy (proactive usage)
338
+
339
+ This tool exists so you do not rely on fragile in-chat memory.
340
+
341
+ ### Recall Gate (before answering)
342
+
343
+ If the user's request could depend on prior context, you should **recall first** (do not guess). Triggers include:
344
+ - The user references prior work: "上次/之前/继续/还记得/我们刚才/前面说过"
345
+ - The user asks about preferences, decisions, rules, or ongoing project state
346
+ - The user mentions a person/project/file path that could have prior notes
347
+
348
+ Call:
349
+ `memory({ action: "recall", query: "<3-8 keywords>" })`
350
+
351
+ Recall is topic navigation, not a body-text grep. It searches the OKF index across
352
+ private + global scopes and may omit an oversized page body under `max_chars`
353
+ without cutting the page.
354
+
355
+ When you need an exact string, identifier, error code, config key, regex, or a
356
+ small range from a large page, **reuse the existing `grep` and `read` tools** —
357
+ do not invent another memory action and do not keep rewriting the recall query:
358
+
359
+ 1. Call `memory(recall)` first so project docs are synchronized and candidate
360
+ Wiki pages are identified.
361
+ 2. Grep private OKF under `{current_workdir}/.cteno/memory/` (normally the
362
+ relative path `.cteno/memory/`) or global OKF under `~/.cteno/memory/`.
363
+ 3. Prefer `knowledge/`, `project/`, `workflow/`, `incidents/`, or `raw/docs/`;
364
+ do not scan `logs/` by default because daily capture is noisy source material.
365
+ 4. Use grep's returned line numbers with generic `read(offset, limit)` for the
366
+ needed range. Use `memory(read)` only when the complete page is required.
367
+
368
+ If a result looks relevant, reasonably sized, but incomplete, follow up with:
369
+ `memory({ action: "read", file_path: "<path>" })`
370
+
371
+ ### Write Gate (before final reply)
372
+
373
+ If this turn produces **durable, reusable** information, you should **save it before you finalize**.
374
+
375
+ Call `memory({ action: "save", file_path: "knowledge/<topic>.md", type: "<type>", content: "<durable fact>" })`.
376
+
377
+ Durable means:
378
+ - User preferences: style, language, tooling, do/don't rules
379
+ - Project conventions/decisions: architecture choices, key commands, important paths, "always/never" rules
380
+ - Stable environment facts that will matter later: ports, service URLs, repository layout, non-secret config choices
381
+ - Lessons learned / postmortems
382
+
383
+ Not durable:
384
+ - One-off transient chat details ("I'm going to get coffee")
385
+ - Large dumps or long logs (summarize instead)
386
+
387
+ If unsure whether something should be remembered long-term, ask: "Should I remember that for you?"
388
+
389
+ ### 不要保存(关键!)
390
+
391
+ - 一次性任务的分析过程或中间推理(这些是临时的,不是知识)
392
+ - 具体的代码片段或完整文件内容(记住文件路径和关键发现即可)
393
+ - 任务执行日志或调试输出
394
+ - 已经存在于代码仓库或文档中的信息(不要重复存储)
395
+ - 当前任务的上下文(任务描述、参数、执行步骤等)
396
+
397
+ ### Safety (what NOT to store)
398
+
399
+ Never store secrets or sensitive data:
400
+ - passwords, API keys, tokens, private keys, 2FA/OTP codes
401
+ - personal data that the user didn't ask you to keep
402
+
403
+ ## Actions
404
+
405
+ - **save**: Merge a durable fact into a valid OKF topic page and upsert `index.md`. Requires `content`, `type`, and a topic `file_path`. Optional `scope`.
406
+ - **overwrite**: Replace a page with newly authored OKF content, unioning `sources[]` provenance with the existing page (read-modify-write). The merge primitive used by wiki consolidation. Requires `file_path` and `content`.
407
+ - **recall**: Wiki recall across private + global: index-first whole pages under a Unicode-character budget (`max_chars`, default 32000). Oversized bodies are represented by their OKF path rather than cut; use existing `grep` + ranged `read`. When nothing matches, the topic `index.md` comes back as a navigation map. Requires `query`.
408
+ - **sync_docs**: Reconcile `docs/**/*.md(x)` byte-for-byte into managed `raw/docs/**` OKF pages using source fingerprints. Project scope only; runtime injects the project path.
409
+ - **read**: Read a specific memory file. Requires `file_path`. Optional `scope`.
410
+ - **delete**: Delete a memory page and remove its `index.md` entry. Requires `file_path`. Optional `scope`.
411
+ - **list**: List all memory files in the workspace. Optional `scope`.
412
+ - **log**: Append fast memory to `logs/YYYY/MM/YYYY-MM-DD.md`. Use for fresh signals, gate decisions, external events, and handoff facts that are not ready to become durable topic memory.
413
+ - **dream**: Run slow-memory consolidation. Spawns the `llm-wiki` librarian subagent in the background, which reads daily logs + the topic index and merges durable facts into OKF wiki pages via `overwrite` (index entries maintained automatically).
414
+ - **migrate**: One-shot, idempotent migration of the current scope to OKF (rewrite legacy `type`+`date` frontmatter, generate `index.md`, seed `log.md`).
415
+ - **manifest**: Return JSON metadata for memory files.
416
+ - **dream_prompt**: Build the slow-memory prompt without running the LLM.
417
+ - **dream_report**: (dream sessions) Record the pass outcome — `status` ok/failed, `summary`, `pages[]`, `error`, `proposals[]` ({kind, evidence, action, confidence, needs_user, pages}). Shown on the Memory page; failures are never auto-retried. Every page a session writes/deletes is journaled and undoable (`cteno-host-cli memory dream-undo <session_id>`).
418
+
419
+ ## Drilling into another project (read-only)
420
+
421
+ `recall`, `read` and `list` accept an optional `project` — the absolute path of
422
+ another project root. The call then reads only `<project>/.cteno/memory`
423
+ (no global, no docs sync, nothing written). A directory without memory returns
424
+ an empty result. `save`/`overwrite`/`delete`/`dream` reject `project`.
425
+
426
+ ```javascript
427
+ memory({ action: "recall", query: "deploy checklist", project: "/Users/me/ProjectA" })
428
+ ```
429
+
430
+ ## Forwarding project decisions from the main conversation (append-only)
431
+
432
+ The main conversation (Jelly or chat) keeps its own memory, but a decision that
433
+ belongs to one project must also reach that project's threads. Use `log` with
434
+ `project`:
435
+
436
+ ```javascript
437
+ memory({ action: "log", project: "/Users/me/ProjectA",
438
+ content: "2026-10-27 决定:v2.11 起发布走 rc 通道,先在 slave 跑门禁再合 main(用户拍板)。" })
439
+ ```
440
+
441
+ - It only **appends** to `<project>/.cteno/memory/logs/<today>.md` with an origin
442
+ note (which Jelly/session, when); a marked copy stays in your own log. The
443
+ project's own dream turns it into pages with `sources[]` provenance.
444
+ - Only known projects are accepted (listed in `<project_directory>`, or a git
445
+ repository with `.cteno/memory`); a worktree path is redirected to its main
446
+ checkout. Project pages can never be written or deleted this way.
447
+ - Write the decision self-contained (date, what, why). Cross-project facts (user
448
+ preferences, machines/LAN, brand wording) stay in your own/global memory.
449
+ - A main-conversation dream also routes project entries you did not forward
450
+ explicitly; it is idempotent, so forwarding never duplicates.
451
+
452
+ ## When to Use
453
+
454
+ - Save key facts, user preferences, or domain knowledge discovered during conversation
455
+ - Recall relevant context before starting complex tasks
456
+ - Only save truly important, reusable information (not transient task details)
457
+ - Use `log` for fast append-only situation facts during托管/主动服务/交通管制
458
+ - Use `dream` sparingly after several sessions or when the user returns from delegated work
459
+
460
+ ## File Organization
461
+
462
+ Use file paths to organize by domain:
463
+ - `knowledge/general.md` - Backward-compatible landing page for legacy `MEMORY.md` saves
464
+ - `USER.md` - High-value user preferences and stable constraints
465
+ - `knowledge/<topic>.md` - Domain knowledge / reusable notes
466
+ - `logs/YYYY/MM/YYYY-MM-DD.md` - Fast daily logs / timeline notes
467
+ - `knowledge/<topic>.md`, `workflow/<topic>.md`, `incidents/<topic>.md` - Slow dreamed memories
468
+
469
+ ## Examples
470
+
471
+ ```javascript
472
+ // Save to private space (default for Persona)
473
+ memory({ action: "save", file_path: "MEMORY.md", content: "- 用户偏好 Python 写脚本。\n" })
474
+
475
+ // Save to global shared space
476
+ memory({ action: "save", file_path: "USER.md", content: "- Prefers dark mode.\n", scope: "global" })
477
+
478
+ // Search both private and global memories
479
+ memory({ action: "recall", query: "Python scripting preferences" })
480
+
481
+ // Read a specific file (private first, fallback to global)
482
+ memory({ action: "read", file_path: "knowledge/rust.md" })
483
+
484
+ // List all memory files (private + global with labels)
485
+ memory({ action: "list" })
486
+
487
+ // Fast memory: append a situation event
488
+ memory({ action: "log", source: "traffic", content: "Codex session A and Claude session B are both editing auth files; traffic layer paused B until A finishes." })
489
+
490
+ // Slow memory: consolidate daily logs into durable topic memories
491
+ memory({ action: "dream", context: "Focus on cross-session coordination lessons." })
492
+ ```