Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
Avoid claiming universal binary-file support; unsupported proprietary formats need extraction or
dedicated parsers.
- Keep optional audio summaries separate from core ingestion/query behavior. The
`mimir-audio-summary` skill must prefer `kb audio` / `@jcode.labs/mimir-tts`, support offline
model loading, and keep generated audio under ignored local Mimir state.
`mimir-audio-summary` skill must prefer `kb audio` / `@jcode.labs/mimir-tts`, use the Edge MP3
path for global Voice Forge quality when online TTS is explicitly acceptable, support the
Transformers.js WAV path for offline/confidential rendering, and keep generated audio under
ignored local Mimir state.
- Keep the repository as a simple pnpm workspace monorepo. Add Turbo only if multiple packages or
apps start needing task caching/orchestration beyond `pnpm --filter`.
- Keep Mimir core free of Ollama. `embeddingProvider: "local-hash"` supports ingestion, search, MCP,
Expand Down Expand Up @@ -77,7 +79,8 @@ General principles (KISS, DRY, YAGNI, SOLID) as applied in this codebase. Match
- `packages/mimir/src/query.ts` performs vector search and returns cited retrieval context; LLM synthesis belongs
outside Mimir core.
- `packages/mimir/src/mcp.ts` exposes Mimir as an MCP stdio server for agents.
- `packages/mimir-tts` is the standalone JS/ONNX TTS package used by `kb audio`.
- `packages/mimir-tts` is the standalone TTS package used by `kb audio`; it uses `edge-tts` for
high-quality MP3 when available and Transformers.js for offline WAV rendering.
- `packages/mimir/src/gitignore.ts` owns target-repository `.gitignore` entries for local generated Mimir
state.
- `packages/mimir/src/security.ts`, `packages/mimir/src/redaction.ts`, and
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.4.1 - 2026-06-29

- Add an Edge-compatible Mimir TTS engine so `kb audio` can match the global Voice Forge quality
path with `edge-tts`, `fr-FR-DeniseNeural`, and MP3 output.
- Keep Transformers.js WAV rendering as the explicit offline/confidential path.
- Remove duplicated governance documents from package directories; root project docs are the single
source of truth.

## 0.4.0 - 2026-06-28

- Reposition Mimir as sovereign local RAG for confidential datasets and AI agents.
Expand Down
5 changes: 3 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ The ingest pipeline (`packages/mimir/src/ingest.ts`) chains single-responsibilit
`embeddings.ts` (vectorize) → `store.ts` (LanceDB). `query.ts` embeds the query and runs vector
search; `ask` returns cited passages only (no LLM synthesis in core).

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

Key behaviors to keep in mind before editing:

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ agents.

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

## Development

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

## Threat Model

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

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

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

## Zero Network Posture

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

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

Confidentiality defaults:

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

Generated audio can still contain sensitive information. Treat it like a derived confidential
document.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jcode-mimir",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"description": "Monorepo for the Mimir open-source local RAG packages.",
"type": "module",
Expand Down
21 changes: 0 additions & 21 deletions packages/mimir-tts/LICENSE

This file was deleted.

37 changes: 29 additions & 8 deletions packages/mimir-tts/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
# Mimir TTS

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

`@jcode.labs/mimir-tts` renders narration text to WAV with Transformers.js. It does not require
Python, ffmpeg, Piper, XTTS, or a local server. The first render can download a public ONNX model
from Hugging Face into `.mimir/models/tts`; the source text is processed locally.
`@jcode.labs/mimir-tts` has two explicit paths:

- Edge MP3 for the same quality path as the global Voice Forge skill. It uses the external
`edge-tts` CLI, `fr-FR-DeniseNeural`, and `+0%` rate by default.
- Transformers.js WAV for confidential or air-gapped use. It does not require Python, ffmpeg,
Piper, XTTS, or a local server.

The Edge path sends the narration text to the online Edge TTS service. Use the Transformers.js path
for private content.

## Install

```bash
pnpm add -D @jcode.labs/mimir-tts
```

Install Edge TTS only when you want the highest-quality online MP3 renderer:

```bash
pipx install edge-tts
```

## Render

High-quality MP3:

```bash
pnpm exec mimir-tts render /tmp/MIMIR-SUMMARY-tax.txt --out .mimir/audio/tax-summary.wav
pnpm exec mimir-tts render /tmp/MIMIR-SUMMARY-tax.txt \
--engine edge \
--out .mimir/audio/tax-summary.mp3
```

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

```bash
pnpm exec mimir-tts render summary.txt --offline --model-path .mimir/models/tts
pnpm exec mimir-tts render summary.txt \
--engine transformers \
--offline \
--model-path .mimir/models/tts \
--out .mimir/audio/summary.wav
```

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

The default model is `Xenova/mms-tts-fra`. Override it with `--model` or `MIMIR_TTS_MODEL`.
The default Transformers.js model is `Xenova/mms-tts-fra`. Override it with `--model` or
`MIMIR_TTS_MODEL`.
38 changes: 36 additions & 2 deletions packages/mimir-tts/dist/cli.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading