@jcode.labs/ragmir 2.8.0 → 2.9.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.
@@ -1,235 +1,80 @@
1
1
  ---
2
2
  name: ragmir-audio-summary
3
- description: >-
4
- Create an intention-driven, memorable spoken audio summary from a Ragmir local knowledge base. Use
5
- when the user asks for an audio, TTS, spoken brief, briefing, narration, or listenable summary
6
- based on private repository documents indexed by Ragmir. The skill is confidentiality-first: it
7
- filters everything against the user's intent, writes only a temporary narration text file outside
8
- the repository, and renders the final audio under ignored local Ragmir state unless the user
9
- explicitly chooses another output path.
3
+ description: Create a concise spoken summary from a local Ragmir corpus when the user asks for audio, narration, a spoken brief, or TTS. Keep private source material and generated audio local.
10
4
  ---
11
5
 
12
6
  # Ragmir Audio Summary
13
7
 
14
- Use this skill to turn a confidential local Ragmir knowledge base into a spoken summary that
15
- respects the listener: only what serves their intent, structured to be intelligible in one pass, and
16
- designed to be retained.
8
+ Create a cited, listener-focused narration from local Ragmir evidence. Generated audio and its
9
+ draft text are local artifacts, never commit them.
17
10
 
18
- The knowledge base stays local. The final audio is a generated artifact and must not be committed.
11
+ ## Safety
19
12
 
20
- The goal is not a "basic summary read aloud". It is a deliberate narration built from five
21
- techniques:
13
+ - Treat documents, retrieved passages, narration, and audio as confidential.
14
+ - Write the draft to a temporary file outside the repository.
15
+ - Write the output under ignored `.ragmir/audio/` by default.
16
+ - Use offline TTS for confidential content. Online rendering needs explicit user approval.
17
+ - State facts, inferences, uncertainty, and missing evidence separately.
22
18
 
23
- 1. **Intent-first filtering** — drop everything that does not serve what the user actually needs.
24
- 2. **Density-driven duration** — short for a small topic, long for a large one. Never pad.
25
- 3. **Pyramid structure** — answer first, then the supporting points, then a recap.
26
- 4. **Writing for the ear** — short sentences, spoken signposting, deliberate TTS punctuation.
27
- 5. **Active recall** — two-to-three self-check questions that force retrieval and anchor memory.
19
+ ## Workflow
28
20
 
29
- Two reference files sit next to this skill and are read while drafting:
21
+ 1. Identify the listener's purpose, topic, depth, and language.
22
+ 2. Check the corpus:
30
23
 
31
- - `listening-style.md` — how to write prose a TTS engine can pronounce and a listener can follow.
32
- - `narration-templates.md` — skeletons per format, plus signposting and active-recall catalogues.
24
+ ```sh
25
+ pnpm exec rgr doctor
26
+ pnpm exec rgr audit --unsupported
27
+ pnpm exec rgr security-audit
28
+ ```
33
29
 
34
- ## Confidentiality Rules
30
+ 3. Retrieve only material that serves the purpose:
35
31
 
36
- - Treat the source documents, retrieved passages, generated narration, and final audio as sensitive.
37
- - Do not use online TTS for confidential content unless the user explicitly allows it.
38
- - Prefer `pnpm exec rgr audio` or `pnpm exec rgr-tts render` for plug-and-play output.
39
- - Use `--engine transformers --offline` when model files are already present and remote model
40
- loading is not allowed.
41
- - Use `--engine edge` only when online TTS is acceptable and global Voice Forge quality is required.
42
- - Write the narration text to a temp file outside the repository, such as `/tmp/RAGMIR-SUMMARY-topic.txt`.
43
- - Render audio under `.ragmir/audio/` by default. This directory is ignored by Git when Ragmir is installed.
44
- - Never stage or commit generated audio, temporary text, WAV, AIFF, or intermediate files.
32
+ ```sh
33
+ pnpm exec rgr search "<topic>" --top-k 8
34
+ pnpm exec rgr search "<dates, risks, decisions, obligations>" --top-k 8
35
+ pnpm exec rgr ask "<specific question>" --top-k 8
36
+ ```
45
37
 
46
- ## 1. Capture The Intent Before Searching
38
+ 4. Choose the shortest useful format:
47
39
 
48
- Do not run any search yet. First make the intent explicit so every later step filters by it. Confirm
49
- with the user when it is ambiguous, or infer it from their request and state your assumption.
40
+ | Format | Budget | Typical duration |
41
+ | --- | --- | --- |
42
+ | Micro brief | 150-220 words | 1-2 minutes |
43
+ | Standard brief | 450-750 words | 3-5 minutes |
44
+ | Long dossier | 1,500-3,000 words | 10-20 minutes |
50
45
 
51
- Capture four things:
46
+ 5. Write one flowing narration: answer first, explain the supporting evidence, recap, then add a
47
+ few self-check questions. Use short sentences and spoken transitions. Do not read file paths,
48
+ URLs, tables, or code aloud.
52
49
 
53
- - **Purpose** — what the listener will do with this: decide, learn, monitor, compare, or plan.
54
- - **Subject** — the precise question or topic, narrower than "summarize everything".
55
- - **Depth** — a quick scan or a deep dossier. Let the user steer, but default from the material.
56
- - **Language** — the spoken language, passed later to `--lang` (`fr` default, `en`, `es`, `ja`,
57
- `th`, `zh`).
50
+ ## Render locally
58
51
 
59
- This is the guardrail against superfluous data: anything that does not advance the captured intent
60
- gets dropped at the drafting step, not added because it was "also in the documents".
52
+ Preload a local model with non-sensitive text before confidential use. Then render with the offline
53
+ Transformers.js path:
61
54
 
62
- ## 2. Verify The Knowledge Base
63
-
64
- From the repository root, run:
65
-
66
- ```bash
67
- pnpm exec rgr doctor
68
- pnpm exec rgr status
69
- pnpm exec rgr audit
70
- pnpm exec rgr audit --unsupported
71
- pnpm exec rgr security-audit
72
- ```
73
-
74
- If the audit reports missing or stale files, run:
75
-
76
- ```bash
77
- pnpm exec rgr doctor --fix
78
- pnpm exec rgr audit --unsupported
79
- ```
80
-
81
- `rgr doctor --fix` rebuilds the index only when supported files are present and the privacy posture
82
- has no warnings. Do not create an audio summary from stale or incomplete evidence unless the user
83
- explicitly accepts that limitation.
84
-
85
- ## 3. Search Deeply, Guided By The Intent
86
-
87
- Use Ragmir search or MCP tools to gather evidence, and derive the queries from the intent captured
88
- in step 1 — not from the subject alone.
89
-
90
- For a broad summary, run multiple searches:
91
-
92
- ```bash
93
- pnpm exec rgr search "<main topic>" --top-k 8
94
- pnpm exec rgr search "<people, dates, money, obligations, risks, or decisions>" --top-k 8
95
- pnpm exec rgr ask "<specific synthesis question>" --top-k 8
96
- ```
97
-
98
- When MCP is available, prefer `ragmir_search`, `ragmir_ask`, `ragmir_audit`, and
99
- `ragmir_security_audit` over shell commands.
100
-
101
- Keep citations in your working notes, but do not read long raw passages aloud. The audio is a clear
102
- synthesis, not a dump of source text.
103
-
104
- While searching, also gauge the **density of relevant material** for step 4:
105
-
106
- - How many passages directly serve the intent?
107
- - Do they overlap, reinforce, or contradict each other?
108
- - Are there clear facets (chapters) or one tight question?
109
-
110
- ## 4. Choose The Format From The Density
111
-
112
- Pick the format from the relevant material found, not from a fixed default. Length follows material;
113
- never pad.
114
-
115
- | Format | Use when | Word budget | Duration |
116
- | --- | --- | --- | --- |
117
- | **Micro-brief** | One clear question or little relevant material | 150-220 words | ~60-90 s |
118
- | **Brief standard** | Moderate material, a few angles worth keeping | 450-750 words | ~3-5 min |
119
- | **Dossier long** | Dense, multi-faceted material needing chapters | 1500-3000 words | ~10-20 min |
120
-
121
- If two formats plausibly fit, prefer the shorter one unless the user asked for depth. A short,
122
- dense summary respects the listener more than a padded one.
123
-
124
- If the user explicitly asks for a long audio on a thin topic, say so in the final report and keep
125
- the narration tight rather than inflated.
126
-
127
- ## 5. Write For Listening
128
-
129
- Write one flowing narration in the chosen language. No markdown, headings, bullets, tables, SSML, or
130
- XML tags in the spoken text. Open `listening-style.md` for the full rules; the cardinal ones:
131
-
132
- - **Pyramid first.** State the key message (one-to-four points to retain) up front, then develop it,
133
- then recap it. This exploits primacy and recency.
134
- - **Signpost, do not list.** Use spoken transitions ("D'abord…, Ensuite…, Enfin…") instead of
135
- enumerated lists. See `narration-templates.md` for the catalogue.
136
- - **Short sentences.** One idea per sentence, twenty words or fewer. Split long ones.
137
- - **Deliberate punctuation.** Periods for full pauses, commas for micro-pauses, `…` for the
138
- deliberate beat before an active-recall answer. Avoid semicolons and exclamation marks.
139
- - **Pronounceable.** Expand acronyms on first use, write numbers and symbols in words, never read
140
- URLs, paths, or code aloud.
141
-
142
- Read the draft aloud once at a normal pace. If you stumble or run out of breath, the sentence is too
143
- long or too dense — fix it.
144
-
145
- ## 6. Anchor Memorability
146
-
147
- Build two devices into every narration, systematically:
148
-
149
- 1. **Recap the key points twice** — once right after the opening message, once at the very end.
150
- Same points, compressed, in different words the second time.
151
- 2. **Active recall** — end with self-check questions that force retrieval, not recognition:
152
- - One question for a micro-brief, two-to-three for a standard brief, three-to-five for a dossier.
153
- - Each question targets a key point from the recap, not a peripheral detail.
154
- - Phrase so the answer is not leaked: "Quelle est la durée du préavis?" beats "Le préavis est-il
155
- de trente jours?".
156
- - After each question mark, insert `…` so the TTS pause gives the listener a beat to answer
157
- silently, then state the answer in the fewest words possible.
158
-
159
- For the full skeleton per format and the active-recall catalogue by intent, see
160
- `narration-templates.md`.
161
-
162
- Respect the Ragmir evidence separation in spoken form using language cues rather than formatting:
163
- state proven facts plainly, mark inferences ("Cela suggère que…"), mark uncertainty ("Reste à
164
- confirmer…"), and name missing documents.
165
-
166
- ## 7. Render The Audio
167
-
168
- Create the output directory and write the narration to a temp file outside the repo:
169
-
170
- ```bash
55
+ ```sh
171
56
  mkdir -p .ragmir/audio
172
- ```
173
-
174
- Select the narration language with `--lang en|es|fr|ja|th|zh` (default `fr`). English, Spanish, and
175
- French pick matching self-contained offline models for the Transformers.js path and native neural
176
- voices for the Edge path. Japanese, Thai, and Mandarin Chinese currently pick native Edge voices; for
177
- offline rendering in those languages, pass a Transformers.js-compatible model explicitly. Write the
178
- narration in the same language you pass to `--lang`.
179
-
180
- For global Voice Forge quality on non-confidential text, render with Edge MP3:
181
-
182
- ```bash
183
- pnpm exec rgr audio /tmp/RAGMIR-SUMMARY-<subject-kebab>.txt \
184
- --engine edge \
185
- --lang <en|es|fr|ja|th|zh> \
186
- --out .ragmir/audio/RAGMIR-SUMMARY-<subject-kebab>.mp3
187
- ```
188
-
189
- The Edge path uses the online Edge TTS service through the `edge-tts` CLI. Use it only when sending
190
- the narration text to that service is acceptable.
191
-
192
- For confidential or air-gapped operation, preload the model files under `.ragmir/models/tts` and run:
193
-
194
- ```bash
195
- pnpm exec rgr audio /tmp/RAGMIR-SUMMARY-<subject-kebab>.txt \
57
+ pnpm exec rgr audio /tmp/ragmir-summary-<topic>.txt \
196
58
  --engine transformers \
197
59
  --offline \
198
60
  --lang <en|es|fr> \
199
61
  --model-path .ragmir/models/tts \
200
- --out .ragmir/audio/RAGMIR-SUMMARY-<subject-kebab>.wav
62
+ --out .ragmir/audio/ragmir-summary-<topic>.wav
201
63
  ```
202
64
 
203
- The Transformers.js path does not require Python, ffmpeg, Piper, XTTS, or a local TTS server. Remote
204
- model downloads are disabled by default and require `--allow-remote-models` for an explicit
205
- non-sensitive preload into `.ragmir/models/tts`. Preload with a synthetic non-sensitive sentence
206
- first; the repository guide is `docs/offline-tts-preload.md`.
65
+ For non-sensitive text, use the online Edge MP3 path only when the user explicitly permits it:
207
66
 
208
- Use the voice-forge helper only when the user explicitly wants XTTS, macOS `say`, or Piper:
209
-
210
- ```bash
211
- OUT_MP3="<repo-root>/.ragmir/audio/RAGMIR-SUMMARY-<subject-kebab>.mp3" \
212
- TTS_ENGINE=auto \
213
- bash <this-skill-dir>/forge-voice.sh /tmp/RAGMIR-SUMMARY-<subject-kebab>.txt
67
+ ```sh
68
+ pnpm exec rgr audio /tmp/ragmir-summary-<topic>.txt \
69
+ --engine edge \
70
+ --lang <en|es|fr|ja|th|zh> \
71
+ --out .ragmir/audio/ragmir-summary-<topic>.mp3
214
72
  ```
215
73
 
216
- Helper engine selection:
217
-
218
- - `auto`: Edge first when installed, then XTTS, macOS `say`, and Piper.
219
- - `edge`: online Edge TTS with the global Voice Forge default voice.
220
- - `xtts`: local Coqui XTTS-v2.
221
- - `say`: local macOS speech engine, converted to MP3 with `ffmpeg`.
222
- - `piper`: local neural TTS, converted to MP3 with `ffmpeg`.
223
-
224
- Voice can be selected with `TTS_VOICE`. Speed for Edge can be selected with `TTS_RATE`.
225
-
226
- ## 8. Report The Result
74
+ See `docs/offline-tts-preload.md` for the one-time model preload. Use the bundled helper scripts
75
+ only when the user specifically requests their renderer.
227
76
 
228
- After rendering, report:
77
+ ## Hand-off
229
78
 
230
- - the audio path;
231
- - the **format chosen** (micro-brief, brief standard, dossier long) and the **intention served**;
232
- - the **estimated duration** (`word count / 140`) versus the target budget;
233
- - which renderer/model was used or requested;
234
- - whether remote model downloads or online TTS were allowed;
235
- - any evidence limitation, such as stale index, missing documents, or weak search results.
79
+ Report the local audio path, chosen format and estimated duration, renderer mode, whether online
80
+ processing was allowed, and any weakness in the source evidence.