@cyber-dash-tech/revela 0.4.6 → 0.5.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **English** | [中文](README.zh-CN.md)
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@cyber-dash-tech/revela)](https://www.npmjs.com/package/@cyber-dash-tech/revela) [![license](https://img.shields.io/npm/l/@cyber-dash-tech/revela)](LICENSE) [![tests](https://img.shields.io/badge/tests-138%20passing-brightgreen)](tests/) [![OpenCode plugin](https://img.shields.io/badge/OpenCode-plugin-blue)](https://opencode.ai) [![Bun](https://img.shields.io/badge/Bun-%E2%89%A51.0-orange)](https://bun.sh)
5
+ [![npm version](https://img.shields.io/npm/v/@cyber-dash-tech/revela)](https://www.npmjs.com/package/@cyber-dash-tech/revela) [![license](https://img.shields.io/npm/l/@cyber-dash-tech/revela)](LICENSE) [![tests](https://img.shields.io/badge/tests-207%20passing-brightgreen)](tests/) [![OpenCode plugin](https://img.shields.io/badge/OpenCode-plugin-blue)](https://opencode.ai) [![Bun](https://img.shields.io/badge/Bun-%E2%89%A51.0-orange)](https://bun.sh)
6
6
 
7
7
  <p align="center">
8
8
  <img src="assets/img/logo.png" alt="Revela" width="800" />
@@ -20,6 +20,8 @@ Enable it for the current session, assign a presentation task, and the agent can
20
20
  - injects a presentation-specific system prompt into your current agent with `/revela enable`
21
21
  - builds that prompt from 3 layers: core skill, active domain, active design
22
22
  - supports workspace document discovery, transparent text extraction for `.pdf`, `.docx`, `.pptx`, and `.xlsx`, and cached embedded-material extraction for those formats
23
+ - uses workspace `DECKS.json` as machine-readable deck memory, slide spec, and prewrite readiness state
24
+ - blocks premature writes to `decks/*.html` until the active deck is marked structurally ready
23
25
  - runs automatic layout QA whenever the agent writes `decks/*.html`
24
26
  - exports finished decks to PDF and editable PPTX
25
27
  - switches designs and domains locally with zero LLM cost
@@ -86,6 +88,12 @@ Enable Revela in the current session:
86
88
  /revela enable
87
89
  ```
88
90
 
91
+ Initialize workspace deck memory when starting in a new project:
92
+
93
+ ```text
94
+ /revela init
95
+ ```
96
+
89
97
  Optionally switch design or domain:
90
98
 
91
99
  ```text
@@ -100,6 +108,12 @@ Then give the agent a deck task:
100
108
  Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main market drivers, use the active design faithfully, and save the result to decks/humanoid-robotics.html.
101
109
  ```
102
110
 
111
+ Before the agent writes `decks/humanoid-robotics.html`, it must update `DECKS.json` through the `revela-decks` tool with the active deck, confirmed slide specs, layouts, components, and computed `writeReadiness.status: ready`. You can ask for an explicit readiness check at any time:
112
+
113
+ ```text
114
+ /revela review humanoid-robotics
115
+ ```
116
+
103
117
  Export when needed:
104
118
 
105
119
  ```text
@@ -122,6 +136,10 @@ Disable presentation mode when done:
122
136
  /revela enable enable presentation mode for this session
123
137
  /revela disable disable presentation mode
124
138
 
139
+ /revela init initialize or refresh workspace DECKS.json
140
+ /revela review [slug] review active deck readiness before writing HTML
141
+ /revela remember <text> save an explicit user/workflow preference
142
+
125
143
  /revela designs list installed designs
126
144
  /revela designs <name> activate a design
127
145
  /revela designs-new <name> create a custom design with AI
@@ -139,7 +157,7 @@ Disable presentation mode when done:
139
157
  /revela pptx <file> export an HTML deck to editable PPTX in the same directory
140
158
  ```
141
159
 
142
- Most `/revela` commands run locally with zero LLM cost. `/revela designs-new` and `/revela designs-edit` start AI-assisted design authoring workflows.
160
+ Most `/revela` commands run locally with zero LLM cost. `/revela init`, `/revela review`, `/revela remember`, `/revela designs-new`, and `/revela designs-edit` start AI-assisted workflows because they need to read or update project files.
143
161
 
144
162
  ---
145
163
 
@@ -158,6 +176,68 @@ The enabled or disabled state is session-level only.
158
176
 
159
177
  ---
160
178
 
179
+ ## DECKS.json Memory And Readiness Gate
180
+
181
+ Revela uses a workspace-root `DECKS.json` file for cross-session continuity and deck production control. It is intended for tools and the LLM, not manual editing.
182
+
183
+ It has two jobs:
184
+
185
+ - workspace memory: stable project context, source materials, explicit user preferences, deck history, and open questions
186
+ - active deck spec: current deck slug, output path, prerequisites, research plan, per-slide content, layouts, components, evidence, visuals, blockers, and write readiness
187
+
188
+ `DECKS.md` is legacy fallback context only. `DECKS.json` is the source of truth.
189
+
190
+ Create or refresh it with:
191
+
192
+ ```text
193
+ /revela init
194
+ ```
195
+
196
+ Review the current deck state with:
197
+
198
+ ```text
199
+ /revela review [slug]
200
+ ```
201
+
202
+ `/revela review` does not write the final HTML deck. It reads and updates `DECKS.json` through the `revela-decks` tool, checks what is missing, and sets `writeReadiness.status` to `ready` only when the deck is ready to generate.
203
+
204
+ Minimum readiness conditions:
205
+
206
+ - topic, audience, slide count, language, and visual style/design are decided
207
+ - source materials are identified or explicitly deemed unnecessary
208
+ - research need is assessed
209
+ - needed research findings have been read and reflected in the slide specs
210
+ - the user has confirmed the slide plan
211
+ - required design layouts and components have been fetched
212
+ - every slide has a title, layout, components, and structured content
213
+ - no blockers remain
214
+
215
+ The plugin enforces this before deck HTML is written. A write or patch touching `decks/*.html` is allowed only when the matching deck in `DECKS.json` passes the readiness gate. Direct writes or patches to `DECKS.json` are blocked; use `revela-decks` instead.
216
+
217
+ The gate checks:
218
+
219
+ - `writeReadiness.status` is `ready`
220
+ - `writeReadiness.blockers` is empty
221
+ - the deck `outputPath` exactly matches the target `decks/*.html` path
222
+ - all `requiredInputs` booleans are true
223
+ - `slides.length` matches `slideCount` when a slide count is set
224
+ - every slide has title, layout, components, and structured content
225
+ - every needed research axis is `done`, `read`, or `skipped`
226
+
227
+ If the gate blocks a write, Revela writes a marker file under `.opencode/revela/blocked-writes/` instead of creating or overwriting the deck HTML. This makes the failure visible to the agent while keeping the real deck file untouched.
228
+
229
+ For `apply_patch`, Revela only checks whether the patch touches `decks/*.html`. If not ready, the whole patch is replaced with a blocked marker patch. The `edit` tool is not gated.
230
+
231
+ To remember long-term preferences, use:
232
+
233
+ ```text
234
+ /revela remember Prefer concise Chinese consulting-style decks.
235
+ ```
236
+
237
+ Do not use `remember` for temporary checklist state; temporary state belongs in the active deck spec in `DECKS.json`.
238
+
239
+ ---
240
+
161
241
  ## Research And File Ingestion
162
242
 
163
243
  When Revela is enabled, the agent can use:
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) | **中文**
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@cyber-dash-tech/revela)](https://www.npmjs.com/package/@cyber-dash-tech/revela) [![license](https://img.shields.io/npm/l/@cyber-dash-tech/revela)](LICENSE) [![tests](https://img.shields.io/badge/tests-125%20passing-brightgreen)](tests/) [![OpenCode plugin](https://img.shields.io/badge/OpenCode-plugin-blue)](https://opencode.ai) [![Bun](https://img.shields.io/badge/Bun-%E2%89%A51.0-orange)](https://bun.sh)
5
+ [![npm version](https://img.shields.io/npm/v/@cyber-dash-tech/revela)](https://www.npmjs.com/package/@cyber-dash-tech/revela) [![license](https://img.shields.io/npm/l/@cyber-dash-tech/revela)](LICENSE) [![tests](https://img.shields.io/badge/tests-207%20passing-brightgreen)](tests/) [![OpenCode plugin](https://img.shields.io/badge/OpenCode-plugin-blue)](https://opencode.ai) [![Bun](https://img.shields.io/badge/Bun-%E2%89%A51.0-orange)](https://bun.sh)
6
6
 
7
7
  <p align="center">
8
8
  <img src="assets/img/logo.png" alt="Revela" width="800" />
@@ -20,6 +20,8 @@ Revela 是一个 [OpenCode](https://opencode.ai) 插件,可以把你当前使
20
20
  - 通过 `/revela enable` 向当前 agent 注入演示文稿专用 system prompt
21
21
  - prompt 由 3 层组成:核心 skill、当前 domain、当前 design
22
22
  - 支持工作区文档扫描,以及 `.pdf`、`.docx`、`.pptx`、`.xlsx` 的透明文本提取和嵌入素材缓存提取
23
+ - 使用工作区 `DECKS.json` 保存机器可读的 deck 记忆、逐页规格和写入前 readiness 状态
24
+ - 在 active deck 结构化 ready 前,阻止过早写入 `decks/*.html`
23
25
  - agent 每次写入 `decks/*.html` 时自动执行布局 QA
24
26
  - 支持导出成 PDF 和可编辑 PPTX
25
27
  - design 和 domain 的切换都在本地完成,不消耗 LLM token
@@ -85,6 +87,12 @@ export { default } from "/absolute/path/to/revela/index.ts";
85
87
  /revela enable
86
88
  ```
87
89
 
90
+ 在新项目里可以先初始化工作区 deck 状态:
91
+
92
+ ```text
93
+ /revela init
94
+ ```
95
+
88
96
  如有需要,先切换 design 或 domain:
89
97
 
90
98
  ```text
@@ -99,6 +107,12 @@ export { default } from "/absolute/path/to/revela/index.ts";
99
107
  Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main market drivers, use the active design faithfully, and save the result to decks/humanoid-robotics.html.
100
108
  ```
101
109
 
110
+ 在 agent 写入 `decks/humanoid-robotics.html` 之前,它必须通过 `revela-decks` 工具更新 `DECKS.json`:记录 active deck、已确认的逐页规格、layout、component,并由工具计算出 `writeReadiness.status: ready`。你也可以随时显式触发 readiness 检查:
111
+
112
+ ```text
113
+ /revela review humanoid-robotics
114
+ ```
115
+
102
116
  需要导出时:
103
117
 
104
118
  ```text
@@ -121,6 +135,10 @@ Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main mar
121
135
  /revela enable 为当前会话启用演示文稿模式
122
136
  /revela disable 关闭演示文稿模式
123
137
 
138
+ /revela init 初始化或刷新工作区 DECKS.json
139
+ /revela review [slug] 写 HTML 前检查 active deck readiness
140
+ /revela remember <text> 保存明确的用户/工作流偏好
141
+
124
142
  /revela designs 列出已安装 design
125
143
  /revela designs <name> 激活某个 design
126
144
  /revela designs-new <name> 通过 AI 创建一个自定义 design
@@ -138,7 +156,7 @@ Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main mar
138
156
  /revela pptx <file> 将 HTML deck 导出为同目录可编辑 PPTX
139
157
  ```
140
158
 
141
- 大多数 `/revela` 命令都在本地执行,不消耗 LLM token。`/revela designs-new` 和 `/revela designs-edit` 会启动 AI 辅助的 design 创建/编辑流程。
159
+ 大多数 `/revela` 命令都在本地执行,不消耗 LLM token。`/revela init`、`/revela review`、`/revela remember`、`/revela designs-new` 和 `/revela designs-edit` 会启动 AI 辅助流程,因为它们需要读取或更新项目状态。
142
160
 
143
161
  ---
144
162
 
@@ -157,6 +175,68 @@ Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main mar
157
175
 
158
176
  ---
159
177
 
178
+ ## DECKS.json 记忆与写入门禁
179
+
180
+ Revela 使用工作区根目录的 `DECKS.json` 做跨会话记忆和 deck 生产控制。它主要给工具和 LLM 使用,不建议人工直接编辑。
181
+
182
+ 它有两个职责:
183
+
184
+ - 工作区记忆:稳定项目背景、源材料、明确用户偏好、历史 deck 和开放问题
185
+ - active deck 规格:当前 deck slug、输出路径、前置条件、research plan、逐页内容、layout、component、证据、视觉需求、blocker 和 write readiness
186
+
187
+ `DECKS.md` 只作为旧版 fallback context;`DECKS.json` 才是 source of truth。
188
+
189
+ 创建或刷新:
190
+
191
+ ```text
192
+ /revela init
193
+ ```
194
+
195
+ 检查当前 deck 状态:
196
+
197
+ ```text
198
+ /revela review [slug]
199
+ ```
200
+
201
+ `/revela review` 不会写最终 HTML deck。它通过 `revela-decks` 工具读取并更新 `DECKS.json`,检查缺失项,并且只有在 deck 真的可以生成时才把 `writeReadiness.status` 设为 `ready`。
202
+
203
+ 最小 readiness 条件:
204
+
205
+ - topic、audience、slide count、language、visual style/design 已确定
206
+ - source materials 已识别,或明确不需要源材料
207
+ - research need 已评估
208
+ - 需要调研时,相关 findings 已读取并反映到逐页规格中
209
+ - 用户已确认 slide plan
210
+ - 需要的 design layouts 和 components 已获取
211
+ - 每页都有 title、layout、components 和结构化 content
212
+ - 没有 unresolved blockers
213
+
214
+ 插件会在写 deck HTML 前强制检查这些条件。任何触碰 `decks/*.html` 的 `write` 或 `apply_patch`,只有在 `DECKS.json` 里匹配的 deck 通过 readiness gate 后才允许执行。直接写入或 patch `DECKS.json` 会被阻止;必须使用 `revela-decks` 工具更新状态。
215
+
216
+ 门禁会检查:
217
+
218
+ - `writeReadiness.status` 是 `ready`
219
+ - `writeReadiness.blockers` 为空
220
+ - deck `outputPath` 精确匹配目标 `decks/*.html` 路径
221
+ - 所有 `requiredInputs` 布尔值都是 true
222
+ - 如果设置了 `slideCount`,`slides.length` 必须匹配
223
+ - 每页都有 title、layout、components 和结构化 content
224
+ - 每个 needed research axis 都是 `done`、`read` 或 `skipped`
225
+
226
+ 如果门禁阻止写入,Revela 会在 `.opencode/revela/blocked-writes/` 下写一个 marker 文件,而不是创建或覆盖真实 HTML deck。这样 agent 能看到失败原因,同时真实 deck 文件不会被污染。
227
+
228
+ 对 `apply_patch`,Revela 只检查 patch 是否触碰 `decks/*.html`。如果未 ready,整个 patch 会被替换成 blocked marker patch。`edit` 工具不做门禁。
229
+
230
+ 记住长期偏好请使用:
231
+
232
+ ```text
233
+ /revela remember 我偏好中文、咨询风格、每页只表达一个核心观点。
234
+ ```
235
+
236
+ 不要用 `remember` 保存临时 checklist 状态;临时状态应该保存在 `DECKS.json` 的 active deck spec 中。
237
+
238
+ ---
239
+
160
240
  ## 调研与文件摄取
161
241
 
162
242
  启用 Revela 后,agent 可以使用:
@@ -164,6 +244,9 @@ Create a 6-slide HTML deck on humanoid robotics supply chains. Cite the main mar
164
244
  - `revela-workspace-scan` 扫描工作区中的 PDF、Office 文件、CSV、Markdown 和文本文件
165
245
  - `revela-research` 子代理做定向网页调研
166
246
  - `revela-research-save` 把结构化 findings 写入 `researches/<topic>/`
247
+ - `revela-research-images-list` 从 `researches/<topic>/*.md` 中提取结构化图片候选
248
+ - `revela-media-batch-save` 批量保存选中的调研图片素材到工作区 assets
249
+ - `revela-media-save` 把选中的本地或远程图片保存为 `assets/<topic>/media/` 下的可复用素材
167
250
 
168
251
  支持提取文本的入口:
169
252
 
@@ -25,19 +25,43 @@ Write your findings to a single file and return a brief summary.
25
25
 
26
26
  Given a research brief specifying your topic and axis, you will:
27
27
 
28
- 1. Scan the workspace for existing documents (always first)
29
- 2. Search the web for current data, reports, and case studies
30
- 3. Write all findings to ONE structured file: \`researches/{topic-slug}/{axis-name}.md\`
31
- 4. Return a brief summary of what you found
28
+ 1. Understand the axis-specific research brief and its evidence needs
29
+ 2. Use \`DECKS.json\` through \`revela-decks\` as the workspace material index when it exists
30
+ 3. Run a lightweight workspace freshness check when needed
31
+ 4. Search the web for current data, reports, and case studies when the brief requires it
32
+ 5. Write all findings to ONE structured file: \`researches/{topic-slug}/{axis-name}.md\`
33
+ 6. Return a brief summary of what you found
32
34
 
33
35
  ---
34
36
 
35
- ## Step 1 — Workspace documents (always first)
37
+ ## Step 1 — Research brief and workspace memory
36
38
 
37
- Use the **\`revela-workspace-scan\`** tool in a single call to discover all document
38
- files in the workspace (PDF, Word, Excel, PowerPoint, CSV, text).
39
+ Start from the research brief supplied by the primary agent. It should include:
40
+ - shared topic slug
41
+ - your axis filename
42
+ - the specific question for this axis
43
+ - time period, geography, and evidence standard
44
+ - known workspace sources from \`DECKS.json\` or user-provided files
45
+ - whether web research is needed
39
46
 
40
- Then select the files relevant to your research axis.
47
+ Use \`revela-decks\` action \`read\` first when \`DECKS.json\` exists or is referenced
48
+ by the brief. Use \`workspace.sourceMaterials\`, \`workspace.deckMemory\`, and
49
+ \`workspace.openQuestions\` as workspace context. Treat sourceMaterials as a
50
+ candidate index, not as proof by itself.
51
+
52
+ Do not write or patch \`DECKS.json\`. You only write research findings through
53
+ \`revela-research-save\`; the primary agent decides which stable deck state to preserve.
54
+
55
+ ---
56
+
57
+ ## Step 2 — Workspace freshness check and selected documents
58
+
59
+ Use **\`revela-workspace-scan\`** as a lightweight freshness check when needed:
60
+ - discover files added after \`/revela init\`
61
+ - verify source files listed in \`DECKS.json\`
62
+ - find files that match your axis but were not listed in the brief
63
+
64
+ Do not deep-read the whole workspace. Select only files relevant to your axis.
41
65
 
42
66
  For every selected file, call **\`revela-extract-document-materials\`** first.
43
67
  - \`pdf\`, \`pptx\`, \`docx\`, and \`xlsx\` will produce a manifest plus extracted text and any available embedded materials
@@ -51,7 +75,7 @@ For PDFs and Office formats, the Revela plugin extracts text transparently — j
51
75
 
52
76
  ---
53
77
 
54
- ## Step 2 — Web search (targeted)
78
+ ## Step 3 — Web search (targeted)
55
79
 
56
80
  Formulate **3–6 targeted search queries** for your specific axis, covering:
57
81
  - Quantitative data (market size, growth rates, rankings, financials)
@@ -72,7 +96,7 @@ Search strategy:
72
96
 
73
97
  ---
74
98
 
75
- ## Step 3 — Write findings file
99
+ ## Step 4 — Write findings file
76
100
 
77
101
  Use **\`revela-research-save\`** to write ONE file with all your findings.
78
102
 
@@ -133,8 +157,11 @@ Gaps:
133
157
  - **NEVER** generate slide content or HTML — that is the primary agent's job
134
158
  - **NEVER** ask the user for information you can find through search or workspace files
135
159
  - **NEVER** use the raw \`write\` tool — always use \`revela-research-save\`
160
+ - **NEVER** write or patch \`DECKS.json\` — the primary agent decides what stable state to preserve
136
161
  - **NEVER** fabricate image URLs — only record URLs you actually found
162
+ - **Always** use \`revela-decks\` action \`read\` first when \`DECKS.json\` exists or is referenced by the brief
137
163
  - **Always** call \`revela-extract-document-materials\` for every selected workspace file before deciding which extracted materials to read next
164
+ - **Avoid** repeated extraction or deep reading for files that are clearly irrelevant to this axis
138
165
  - **Always** include source attribution on every data point
139
166
  - **Always** use tables for comparative data (more useful than bullets for presentations)
140
167
  - **Preserve** raw data — the primary agent will select what to include in slides
@@ -26,6 +26,9 @@ export async function handleHelp(
26
26
  `**Commands**\n\n` +
27
27
  `\`/revela enable\` — enable slide generation mode\n` +
28
28
  `\`/revela disable\` — disable slide generation mode\n` +
29
+ `\`/revela init\` — initialize workspace deck memory in DECKS.md\n` +
30
+ `\`/revela review [slug]\` — review active deck readiness before writing HTML\n` +
31
+ `\`/revela remember <text>\` — save an explicit user preference to DECKS.md\n` +
29
32
  `\`/revela designs\` — list installed designs\n` +
30
33
  `\`/revela designs <name>\` — activate a design\n` +
31
34
  `\`/revela designs-new <name>\` — create a new custom design with AI\n` +
@@ -0,0 +1,68 @@
1
+ import { DECKS_MEMORY_FILE } from "../decks-memory"
2
+ import { DECKS_STATE_FILE } from "../decks-state"
3
+
4
+ export function buildInitPrompt({
5
+ exists,
6
+ legacyExists,
7
+ workspaceRoot,
8
+ }: {
9
+ exists: boolean
10
+ legacyExists?: boolean
11
+ workspaceRoot?: string
12
+ }): string {
13
+ const mode = exists
14
+ ? `A ${DECKS_STATE_FILE} file already exists. Read it first through the revela-decks tool and update it conservatively.`
15
+ : `No ${DECKS_STATE_FILE} file exists yet. Create it through the revela-decks tool.`
16
+ const legacy = legacyExists
17
+ ? `A legacy ${DECKS_MEMORY_FILE} file may exist. You may read it as migration context, but do not write or patch it unless explicitly asked.`
18
+ : `No legacy ${DECKS_MEMORY_FILE} context is known.`
19
+
20
+ return `Initialize Revela workspace state and deck workboard.
21
+
22
+ Goal:
23
+ - Build or update ${DECKS_STATE_FILE}, the workspace-level machine-readable state file for slide deck work.
24
+ - Use the \`revela-decks\` tool for state updates. Do not write or patch ${DECKS_STATE_FILE} directly.
25
+ - Capture stable project context, available source materials, deck history, active deck specs, slide plans, and open questions for future sessions.
26
+ - Do not treat initialization as permission to write a slide deck; each deck must pass a later readiness review.
27
+ - ${DECKS_MEMORY_FILE} is legacy fallback context only; ${DECKS_STATE_FILE} is the source of truth.
28
+
29
+ Current state:
30
+ - ${mode}
31
+ - ${legacy}
32
+ ${workspaceRoot ? `- Current workspace root: \`${workspaceRoot}\`` : ""}
33
+
34
+ Workspace boundary rules:
35
+ - Stay strictly inside the current workspace root for every scan, glob, read, and write.
36
+ - Do not search parent directories, home directories, or unrelated absolute directories.
37
+ - For \`revela-workspace-scan\`, omit \`path\` for the initial scan or use a workspace-relative path only.
38
+ - For Glob/file searches, use the current workspace as the search root. Do not set the search root to a parent directory or home directory.
39
+ - Do not use \`~\`, \`..\`, or parent-directory traversal to discover files.
40
+ - If the current workspace appears too broad, stop and ask the user which workspace subdirectory to initialize instead of scanning outside or deeply across everything.
41
+
42
+ Workflow:
43
+ 1. Use the \`revela-workspace-scan\` tool to inspect document and data files in the workspace. Start with no \`path\` and \`max_depth: 2\`.
44
+ 2. Separately search for existing deck outputs and deck history, especially:
45
+ - \`decks/**/*.html\`
46
+ - \`slides/**/*.html\`
47
+ - \`presentations/**/*.html\`
48
+ - \`decks/**/*.pdf\`
49
+ - \`slides/**/*.pdf\`
50
+ Run these searches only inside the current workspace root. These are generated/output decks, not necessarily source materials. Record stable history, themes, filenames, and obvious reuse opportunities without treating them as authoritative source data.
51
+ 3. Select the files that look most relevant for future slide decks. Prioritize source decks, PDFs, Word docs, spreadsheets, CSVs, Markdown, text notes, and relevant existing generated decks.
52
+ 4. For selected PDF/PPTX/DOCX/XLSX files, call \`revela-extract-document-materials\` before deciding what to summarize.
53
+ 5. Read only the materials needed to form a conservative workspace memory. Do not exhaustively read every file if the workspace is large.
54
+ 6. Call \`revela-decks\` with action \`init\` to create ${DECKS_STATE_FILE} if needed.
55
+ 7. If this conversation already contains a concrete deck task, call \`revela-decks\` with action \`upsertDeck\` and later \`upsertSlides\` only for explicit deck spec information. Do not mark readiness ready during init.
56
+ 8. Report what was initialized or updated and list any open questions.
57
+
58
+ Memory rules:
59
+ - Only write facts supported by workspace files into ${DECKS_STATE_FILE} workspace state, source materials, deck memory, and open questions.
60
+ - Only write user preferences if the user explicitly stated that Revela should remember them.
61
+ - Do not infer personal preferences from one-off requests.
62
+ - Do not store secrets, credentials, API keys, tokens, account details, or sensitive personal information.
63
+ - If legacy ${DECKS_MEMORY_FILE} exists, preserve any useful explicit preferences by migrating them through the revela-decks tool; do not copy temporary checklist state blindly.
64
+ - Do not mark writeReadiness as ready during init unless the current deck has already passed an explicit \`revela-decks\` review.
65
+ - If new evidence conflicts with existing memory, preserve both briefly and add an Open Question instead of silently overwriting.
66
+
67
+ Start now by scanning the workspace.`
68
+ }
@@ -0,0 +1,46 @@
1
+ import { DECKS_MEMORY_FILE } from "../decks-memory"
2
+ import { DECKS_STATE_FILE } from "../decks-state"
3
+
4
+ export type RememberParseResult =
5
+ | { ok: true; memory: string }
6
+ | { ok: false; error: string }
7
+
8
+ const USAGE =
9
+ "**Usage:** `/revela remember <preference or workflow habit>`\n" +
10
+ "Example: `/revela remember 我偏好中文、咨询风格、每页只表达一个核心观点`"
11
+
12
+ export function parseRememberArgs(input: string): RememberParseResult {
13
+ const memory = input.trim()
14
+ if (!memory) return { ok: false, error: USAGE }
15
+ return { ok: true, memory }
16
+ }
17
+
18
+ export function buildRememberPrompt({ memory, exists, legacyExists }: { memory: string; exists: boolean; legacyExists?: boolean }): string {
19
+ const state = exists
20
+ ? `Read the existing ${DECKS_STATE_FILE} through revela-decks before updating preferences.`
21
+ : `Create ${DECKS_STATE_FILE} through revela-decks action init before recording this memory.`
22
+ const legacy = legacyExists
23
+ ? `Legacy ${DECKS_MEMORY_FILE} may exist as context, but do not write or patch it.`
24
+ : `No legacy ${DECKS_MEMORY_FILE} context is known.`
25
+
26
+ return `Record explicit Revela workspace memory.
27
+
28
+ The user explicitly asked Revela to remember this:
29
+
30
+ \`\`\`text
31
+ ${memory}
32
+ \`\`\`
33
+
34
+ Task:
35
+ - ${state}
36
+ - ${legacy}
37
+ - Use the \`revela-decks\` tool with action \`remember\` to update ${DECKS_STATE_FILE}; do not write or patch the file directly.
38
+ - Use preferenceType \`user\` if it describes output style, visual taste, language, audience, narrative, or content constraints.
39
+ - Use preferenceType \`workflow\` if it describes how the user wants Revela to work.
40
+ - Keep the entry concise and faithful to the user's wording.
41
+ - Do not add inferred preferences or unrelated context.
42
+ - Do not duplicate an existing equivalent preference; merge or refine it instead.
43
+ - Do not store secrets, credentials, API keys, tokens, account details, or sensitive personal information.
44
+
45
+ After updating ${DECKS_STATE_FILE}, briefly report which preference type you changed.`
46
+ }
@@ -0,0 +1,68 @@
1
+ import { DECKS_MEMORY_FILE } from "../decks-memory"
2
+ import { DECKS_STATE_FILE } from "../decks-state"
3
+
4
+ export function buildReviewPrompt({
5
+ slug,
6
+ exists,
7
+ legacyExists,
8
+ workspaceRoot,
9
+ }: {
10
+ slug?: string
11
+ exists: boolean
12
+ legacyExists?: boolean
13
+ workspaceRoot?: string
14
+ }): string {
15
+ const target = slug?.trim()
16
+ const deckTarget = target ? `the deck slug or output path matching \`${target}\`` : "the current active deck"
17
+ const state = exists
18
+ ? `${DECKS_STATE_FILE} exists. Read it through the revela-decks tool.`
19
+ : `${DECKS_STATE_FILE} does not exist yet. Create it through the revela-decks tool if there is enough deck context.`
20
+ const legacy = legacyExists
21
+ ? `Legacy ${DECKS_MEMORY_FILE} may exist as migration context, but ${DECKS_STATE_FILE} is the source of truth.`
22
+ : `No legacy ${DECKS_MEMORY_FILE} context is known.`
23
+
24
+ return `Review Revela deck write readiness.
25
+
26
+ Goal:
27
+ - Use ${DECKS_STATE_FILE} as the source of truth for whether ${deckTarget} is ready to be written to \`decks/*.html\`.
28
+ - Preserve the deck spec for future sessions: every slide's content, layout, components, evidence, visuals, and production status.
29
+ - Do not write, patch, or directly edit ${DECKS_STATE_FILE}. Use the \`revela-decks\` tool for all state changes.
30
+ - Let \`revela-decks\` action \`review\` compute writeReadiness; do not manually set readiness to ready.
31
+
32
+ Current state:
33
+ - ${state}
34
+ - ${legacy}
35
+ ${workspaceRoot ? `- Current workspace root: \`${workspaceRoot}\`` : ""}
36
+
37
+ Workspace boundary rules:
38
+ - Stay strictly inside the current workspace root for every scan, glob, read, and write.
39
+ - Do not search parent directories, home directories, or unrelated absolute directories.
40
+ - Do not use \`~\`, \`..\`, or parent-directory traversal to discover files.
41
+ - For Glob/file searches, use the current workspace as the search root. Do not set the search root to a parent directory or home directory.
42
+
43
+ Workflow:
44
+ 1. Call \`revela-decks\` with action \`read\` for ${deckTarget}.
45
+ 2. If no matching deck exists but the conversation contains enough deck context, call \`revela-decks\` action \`upsertDeck\` with slug, goal, outputPath, theme, requiredInputs, and researchPlan.
46
+ 3. If a user-confirmed slide plan is available, call \`revela-decks\` action \`upsertSlides\` with every slide's title, purpose, layout, components, structured content, evidence, visuals, and status.
47
+ 4. Only set requiredInputs fields true when explicit conversation state, files read, research findings read, selected design, fetched layouts/components, or user confirmation supports them. Do not infer completion.
48
+ 5. Call \`revela-decks\` action \`review\` for the slug. The tool computes and writes \`writeReadiness\`.
49
+ 6. Briefly report whether the deck is ready. If blocked, list the exact blockers returned by the tool.
50
+
51
+ Minimum conditions for \`ready\`:
52
+ - Topic, audience, slide count, language, and visual style/design are decided.
53
+ - Source materials have been identified or explicitly deemed unnecessary.
54
+ - Research need has been assessed.
55
+ - If research is needed, all relevant findings have been read and reflected in the slide specs.
56
+ - The user has confirmed the slide plan.
57
+ - ${DECKS_STATE_FILE} contains per-slide specs with content, layout, components, and evidence where applicable.
58
+ - The needed design layouts and components have been fetched with \`revela-designs read\`.
59
+ - No unresolved blockers remain.
60
+
61
+ Rules:
62
+ - Do not write or overwrite \`decks/*.html\` during review.
63
+ - Do not write, patch, or directly edit ${DECKS_STATE_FILE}; use \`revela-decks\`.
64
+ - Do not store secrets, credentials, tokens, or sensitive personal information.
65
+ - Do not add inferred user preferences to long-term preference state.
66
+
67
+ Start now by reading ${DECKS_STATE_FILE} through \`revela-decks\`.`
68
+ }