Skip to content

Commit 1bc9986

Browse files
authored
feat(tts): add edge-quality audio path
Add Edge/MP3 rendering aligned with the global Voice Forge defaults, keep Transformers.js WAV for offline/confidential use, and remove duplicated package governance docs.
1 parent 6d6c3fa commit 1bc9986

34 files changed

Lines changed: 683 additions & 483 deletions

AGENTS.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
Avoid claiming universal binary-file support; unsupported proprietary formats need extraction or
2323
dedicated parsers.
2424
- Keep optional audio summaries separate from core ingestion/query behavior. The
25-
`mimir-audio-summary` skill must prefer `kb audio` / `@jcode.labs/mimir-tts`, support offline
26-
model loading, and keep generated audio under ignored local Mimir state.
25+
`mimir-audio-summary` skill must prefer `kb audio` / `@jcode.labs/mimir-tts`, use the Edge MP3
26+
path for global Voice Forge quality when online TTS is explicitly acceptable, support the
27+
Transformers.js WAV path for offline/confidential rendering, and keep generated audio under
28+
ignored local Mimir state.
2729
- Keep the repository as a simple pnpm workspace monorepo. Add Turbo only if multiple packages or
2830
apps start needing task caching/orchestration beyond `pnpm --filter`.
2931
- Keep Mimir core free of Ollama. `embeddingProvider: "local-hash"` supports ingestion, search, MCP,
@@ -77,7 +79,8 @@ General principles (KISS, DRY, YAGNI, SOLID) as applied in this codebase. Match
7779
- `packages/mimir/src/query.ts` performs vector search and returns cited retrieval context; LLM synthesis belongs
7880
outside Mimir core.
7981
- `packages/mimir/src/mcp.ts` exposes Mimir as an MCP stdio server for agents.
80-
- `packages/mimir-tts` is the standalone JS/ONNX TTS package used by `kb audio`.
82+
- `packages/mimir-tts` is the standalone TTS package used by `kb audio`; it uses `edge-tts` for
83+
high-quality MP3 when available and Transformers.js for offline WAV rendering.
8184
- `packages/mimir/src/gitignore.ts` owns target-repository `.gitignore` entries for local generated Mimir
8285
state.
8386
- `packages/mimir/src/security.ts`, `packages/mimir/src/redaction.ts`, and

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.4.1 - 2026-06-29
4+
5+
- Add an Edge-compatible Mimir TTS engine so `kb audio` can match the global Voice Forge quality
6+
path with `edge-tts`, `fr-FR-DeniseNeural`, and MP3 output.
7+
- Keep Transformers.js WAV rendering as the explicit offline/confidential path.
8+
- Remove duplicated governance documents from package directories; root project docs are the single
9+
source of truth.
10+
311
## 0.4.0 - 2026-06-28
412

513
- Reposition Mimir as sovereign local RAG for confidential datasets and AI agents.

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ The ingest pipeline (`packages/mimir/src/ingest.ts`) chains single-responsibilit
6363
`embeddings.ts` (vectorize) → `store.ts` (LanceDB). `query.ts` embeds the query and runs vector
6464
search; `ask` returns cited passages only (no LLM synthesis in core).
6565

66-
`packages/mimir-tts` is a separate ESM package that uses Transformers.js text-to-speech to render
67-
WAV files without Python or ffmpeg. Core `kb audio` imports it dynamically.
66+
`packages/mimir-tts` is a separate ESM package. It uses `edge-tts` for high-quality MP3 when the
67+
external CLI is installed, and Transformers.js for offline WAV rendering without Python or ffmpeg.
68+
Core `kb audio` imports it dynamically.
6869

6970
Key behaviors to keep in mind before editing:
7071

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ agents.
77

88
- [`@jcode.labs/mimir`](./packages/mimir): core CLI, library, MCP server, bundled agent skills, and
99
synthetic examples.
10-
- [`@jcode.labs/mimir-tts`](./packages/mimir-tts): plug-and-play JS/ONNX text-to-speech renderer
11-
used by `kb audio`.
10+
- [`@jcode.labs/mimir-tts`](./packages/mimir-tts): plug-and-play Edge-quality MP3 and offline
11+
Transformers.js WAV renderer used by `kb audio`.
1212

1313
## Development
1414

SECURITY-HARDENING.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ built to minimize data movement, but it is not a certified high-assurance system
1919
default.
2020
- MCP is read-focused: destructive tools are not exposed over MCP, and MCP retrieval is capped by
2121
`mcpMaxTopK`.
22-
- Optional audio summaries use `kb audio` / `@jcode.labs/mimir-tts` for local WAV rendering with
23-
Transformers.js. They do not require Python, ffmpeg, Piper, XTTS, or a local TTS server.
22+
- Optional audio summaries use `kb audio` / `@jcode.labs/mimir-tts`. Edge MP3 gives the highest
23+
quality when online TTS is acceptable. Transformers.js WAV is the offline/confidential path and
24+
does not require Python, ffmpeg, Piper, XTTS, or a local TTS server.
2425
- npm releases are published with provenance from the protected GitHub Actions workflow.
2526
- Release artifacts include a package tarball, SHA256 checksums, SBOM, and manifest.
2627

2728
## Threat Model
2829

2930
Mimir protects against accidental repository leaks, accidental built-in LLM usage, accidental online
30-
TTS usage for generated summaries, accidental secret indexing, and weak release traceability.
31+
TTS usage when the offline path is requested, accidental secret indexing, and weak release
32+
traceability.
3133

3234
Mimir does not protect against a compromised local machine, malicious dependencies already present
3335
in the runtime, a user with filesystem access to the same checkout, or forensic recovery from an
@@ -65,7 +67,8 @@ pnpm exec kb ingest
6567

6668
For semantic embeddings, preload the Transformers.js-compatible embedding model files inside the
6769
offline environment under the configured `embeddingModelPath`. For audio, preload the TTS model
68-
files under `.mimir/models/tts` and render with `pnpm exec kb audio <text-file> --offline`.
70+
files under `.mimir/models/tts` and render with
71+
`pnpm exec kb audio <text-file> --engine transformers --offline`.
6972

7073
## Zero Network Posture
7174

@@ -130,17 +133,20 @@ Redaction changes the indexed text, not the raw files under `private/`.
130133

131134
`kb install-skill` installs an optional `mimir-audio-summary` skill. It is designed for listenable
132135
briefings from a local Mimir index. The default renderer is `kb audio`, backed by
133-
`@jcode.labs/mimir-tts` and Transformers.js.
136+
`@jcode.labs/mimir-tts`.
134137

135138
Confidentiality defaults:
136139

137140
- narration text is written to a temp file outside the repository;
138-
- generated WAV audio should be written under `.mimir/audio/`;
141+
- generated MP3 or WAV audio should be written under `.mimir/audio/`;
139142
- `.mimir/` is ignored by Git;
140-
- Python, ffmpeg, Piper, XTTS, and local TTS servers are not required for the default path;
141-
- the first online-enabled render may download public model weights into `.mimir/models/tts`, but
142-
the narration text is processed locally;
143-
- `--offline` disables remote model loading and requires preloaded model files.
143+
- Edge MP3 uses the online Edge TTS service through the external `edge-tts` CLI and should be used
144+
only when sending the narration text to that service is acceptable;
145+
- Transformers.js WAV does not require Python, ffmpeg, Piper, XTTS, or a local TTS server;
146+
- the first online-enabled Transformers render may download public model weights into
147+
`.mimir/models/tts`, but the narration text is processed locally;
148+
- `--engine transformers --offline` disables remote model loading and requires preloaded model
149+
files.
144150

145151
Generated audio can still contain sensitive information. Treat it like a derived confidential
146152
document.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jcode-mimir",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"private": true,
55
"description": "Monorepo for the Mimir open-source local RAG packages.",
66
"type": "module",

packages/mimir-tts/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/mimir-tts/README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,47 @@
11
# Mimir TTS
22

3-
Plug-and-play local text-to-speech for Mimir audio summaries.
3+
Plug-and-play text-to-speech for Mimir audio summaries.
44

5-
`@jcode.labs/mimir-tts` renders narration text to WAV with Transformers.js. It does not require
6-
Python, ffmpeg, Piper, XTTS, or a local server. The first render can download a public ONNX model
7-
from Hugging Face into `.mimir/models/tts`; the source text is processed locally.
5+
`@jcode.labs/mimir-tts` has two explicit paths:
6+
7+
- Edge MP3 for the same quality path as the global Voice Forge skill. It uses the external
8+
`edge-tts` CLI, `fr-FR-DeniseNeural`, and `+0%` rate by default.
9+
- Transformers.js WAV for confidential or air-gapped use. It does not require Python, ffmpeg,
10+
Piper, XTTS, or a local server.
11+
12+
The Edge path sends the narration text to the online Edge TTS service. Use the Transformers.js path
13+
for private content.
814

915
## Install
1016

1117
```bash
1218
pnpm add -D @jcode.labs/mimir-tts
1319
```
1420

21+
Install Edge TTS only when you want the highest-quality online MP3 renderer:
22+
23+
```bash
24+
pipx install edge-tts
25+
```
26+
1527
## Render
1628

29+
High-quality MP3:
30+
1731
```bash
18-
pnpm exec mimir-tts render /tmp/MIMIR-SUMMARY-tax.txt --out .mimir/audio/tax-summary.wav
32+
pnpm exec mimir-tts render /tmp/MIMIR-SUMMARY-tax.txt \
33+
--engine edge \
34+
--out .mimir/audio/tax-summary.mp3
1935
```
2036

21-
For offline or air-gapped use, preload the model files and run:
37+
Offline/confidential WAV:
2238

2339
```bash
24-
pnpm exec mimir-tts render summary.txt --offline --model-path .mimir/models/tts
40+
pnpm exec mimir-tts render summary.txt \
41+
--engine transformers \
42+
--offline \
43+
--model-path .mimir/models/tts \
44+
--out .mimir/audio/summary.wav
2545
```
2646

2747
## Doctor
@@ -30,4 +50,5 @@ pnpm exec mimir-tts render summary.txt --offline --model-path .mimir/models/tts
3050
pnpm exec mimir-tts doctor --json
3151
```
3252

33-
The default model is `Xenova/mms-tts-fra`. Override it with `--model` or `MIMIR_TTS_MODEL`.
53+
The default Transformers.js model is `Xenova/mms-tts-fra`. Override it with `--model` or
54+
`MIMIR_TTS_MODEL`.

packages/mimir-tts/dist/cli.js

Lines changed: 36 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)