Skip to content

Commit 1bc7a8b

Browse files
authored
Merge pull request #37 from jcode-works/feature/config-sources
feat(config): index extra source paths from config.json (+ pending core/TTS work)
2 parents 3be93b1 + 993c265 commit 1bc7a8b

109 files changed

Lines changed: 1151 additions & 441 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
- Keep first-run UX centered on `mimir setup` for full onboarding and `mimir doctor --fix` for safe
3333
repairs. `mimir init`, `mimir install-skill`, and `mimir ingest` remain available as explicit
3434
lower-level commands.
35-
- Keep monorepo source onboarding simple: `.mimir/sources.txt` accepts paths, glob patterns, and
36-
`!` exclusions, and `mimir sources add/list` is the CLI surface for updating it without manual
37-
editing.
35+
- Keep monorepo source onboarding simple: the `sources` array in `.mimir/config.json` accepts paths,
36+
glob patterns, and `!` exclusions. The legacy `.mimir/sources.txt` file (managed by `mimir sources
37+
add/list`) is still read and merged when present, but `mimir init` no longer creates it.
3838
- Keep product documentation canonical in the root `README.md`. Package README files under
3939
`packages/*/README.md` are intentionally minimal npm entrypoints and must link clearly to the
4040
GitHub root README because npm displays package README files separately.
@@ -53,6 +53,11 @@
5353
under real Mimir domains, private documents, generated `.pid` files, committed secrets, internal
5454
GTM/pricing ledgers, or wording that presents tracked MIT source as proprietary or closed source.
5555
`pnpm public:smoke` enforces the cheap checks.
56+
- The public-surface secret scanner (`scripts/public-surface-smoke.mjs`) runs over every tracked
57+
file, tests included. Never write literal secret-shaped strings in source — PEM `PRIVATE KEY`
58+
headers, `ghp_`/`github_pat_`/`sk_live_`/`sk_test_` tokens, or real checkout URLs. When a test
59+
needs one to exercise redaction or skipping, build it at runtime from parts (e.g. interpolate the
60+
`PRIVATE KEY` label from a variable) so no scannable literal is committed.
5661
- Root `llms.txt` (the [llms.txt](https://llmstxt.org/) convention) and `context7.json` are the
5762
LLM/Context7-facing doc index for this repository. Update `llms.txt` when adding or removing a
5863
top-level `docs/*.md` file worth surfacing to agents, and keep `context7.json`'s

README.md

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,7 @@ index rebuild when supported files are present and the privacy posture has no wa
353353
Manual initialization is still available:
354354

355355
```plain text
356-
.mimir/config.json # local config
357-
.mimir/sources.txt # optional extra source paths
356+
.mimir/config.json # local config (add extra paths to the "sources" array)
358357
.mimir/raw/ # raw documents to ingest
359358
.gitignore # ignores .mimir/
360359
```
@@ -368,22 +367,28 @@ Put supported files under `.mimir/raw/`:
368367
requirements.docx
369368
```
370369

371-
For monorepos or downloaded local folders, list extra paths or glob patterns in `.mimir/sources.txt`.
372-
Relative entries resolve from the Mimir project root, and `!` excludes matched files:
370+
For monorepos or downloaded local folders, add extra paths or glob patterns to the `sources` array in
371+
`.mimir/config.json`. Relative entries resolve from the Mimir project root, and `!` excludes matched files:
372+
373+
```json
374+
{
375+
"sources": [
376+
"../apps/*/README.md",
377+
"../apps/*/docs/**/*.{md,mdx}",
378+
"../packages/*/architecture/**/*.md",
379+
"!../apps/**/node_modules/**"
380+
]
381+
}
382+
```
383+
384+
The legacy `.mimir/sources.txt` file (one entry per line) is still read when present and can be managed
385+
from the CLI:
373386

374387
```bash
375388
npx mimir sources add "../apps/*/README.md" "../apps/*/docs/**/*.{md,mdx}"
376-
npx mimir sources add "!../apps/**/node_modules/**"
377389
npx mimir sources list
378390
```
379391

380-
```plain text
381-
../apps/*/README.md
382-
../apps/*/docs/**/*.{md,mdx}
383-
../packages/*/architecture/**/*.md
384-
!../apps/**/node_modules/**
385-
```
386-
387392
### Team Workflow With A Shared Private Corpus
388393

389394
For a team of 10 developers, keep Git as the reproducible setup layer and keep the corpus in an
@@ -632,6 +637,7 @@ preload Transformers.js-compatible model files with non-sensitive text, then ren
632637
npx mimir audio /tmp/MIMIR-SUMMARY-project.txt \
633638
--engine transformers \
634639
--offline \
640+
--lang fr \
635641
--model-path .mimir/models/tts \
636642
--out .mimir/audio/project-summary.wav
637643
```
@@ -645,8 +651,10 @@ npx mimir-tts render /tmp/MIMIR-SUMMARY-project.txt \
645651
--out .mimir/audio/project-summary.mp3
646652
```
647653

648-
The default standalone engine is `transformers`. The default Transformers.js model is
649-
`Xenova/mms-tts-fra`. Override it with `--model` or `MIMIR_TTS_MODEL`.
654+
The default standalone engine is `transformers` and the default language is `fr`. Pass
655+
`--lang en|es|fr` (or `MIMIR_TTS_LANG`) to switch language: it selects the matching self-contained
656+
offline model (`Xenova/mms-tts-eng`, `Xenova/mms-tts-spa`, or `Xenova/mms-tts-fra`) and, on the Edge
657+
path, a native neural voice. Override the model directly with `--model` or `MIMIR_TTS_MODEL`.
650658

651659
See [`docs/offline-tts-preload.md`](./docs/offline-tts-preload.md) for the exact preload and
652660
offline-check workflow.
@@ -787,6 +795,7 @@ Default `.mimir/config.json` for a fresh project:
787795
"rawDir": ".mimir/raw",
788796
"storageDir": ".mimir/storage",
789797
"sourcesFile": ".mimir/sources.txt",
798+
"sources": [],
790799
"accessLogPath": ".mimir/access.log",
791800
"embeddingModelPath": ".mimir/models",
792801
"tableName": "chunks",
@@ -816,6 +825,63 @@ Default `.mimir/config.json` for a fresh project:
816825
}
817826
```
818827

828+
Every field, its default, and what it controls:
829+
830+
| Field | Default | Purpose |
831+
| --- | --- | --- |
832+
| `rawDir` | `.mimir/raw` | Local corpus folder, indexed recursively. The primary place to drop documents. |
833+
| `sources` | `[]` | Extra file, directory, and glob paths (plus `!` exclusions) to index, resolved from the project root. See below. |
834+
| `sourcesFile` | `.mimir/sources.txt` | Legacy one-path-per-line file; still read and merged with `sources` when present. |
835+
| `storageDir` | `.mimir/storage` | LanceDB vector store location. |
836+
| `accessLogPath` | `.mimir/access.log` | Query access log (stores hashes/metadata only). |
837+
| `embeddingModelPath` | `.mimir/models` | Local cache for the Transformers.js embedding model. |
838+
| `tableName` | `chunks` | LanceDB table name. |
839+
| `embeddingProvider` | `local-hash` | `local-hash` (offline lexical, not semantic) or `transformers` (semantic). Switching requires `mimir ingest --rebuild`. |
840+
| `embeddingModel` | `mixedbread-ai/mxbai-embed-xsmall-v1` | Model used when `embeddingProvider` is `transformers`. |
841+
| `transformersAllowRemoteModels` | `false` | Allow downloading the embedding model at runtime. |
842+
| `redaction.enabled` | `true` | Strip secrets/PII before anything is embedded. |
843+
| `redaction.builtIn` | `true` | Apply the built-in secret/PII patterns. |
844+
| `redaction.patterns` | `[]` | Extra `{ name, pattern, flags?, replacement? }` redaction rules. |
845+
| `accessLog` | `true` | Record query metadata to `accessLogPath`. |
846+
| `mcpMaxTopK` | `10` | Hard cap on results any MCP tool may return. |
847+
| `topK` | `8` | Default number of passages returned by `search`/`ask`. |
848+
| `chunkSize` | `1200` | Characters per chunk. |
849+
| `chunkOverlap` | `200` | Overlapping characters between chunks (must be `< chunkSize`). |
850+
| `maxFileBytes` | `50000000` | Skip files larger than this. |
851+
| `ingestConcurrency` | `4` | Files processed in parallel during ingest. |
852+
| `embeddingBatchSize` | `32` | Chunks embedded per batch. |
853+
| `includeExtensions` | `[]` | Extra file extensions to treat as indexable text. |
854+
| `pdfOcrCommand`, `imageOcrCommand`, `legacyWordCommand` | `[]` | Opt-in external extractors (see below). |
855+
| `pdfOcrTimeoutMs`, `imageOcrTimeoutMs`, `legacyWordTimeoutMs` | `120000` | Timeouts for the external extractors. |
856+
857+
### Extra source paths (`sources`)
858+
859+
Mimir always indexes everything under `rawDir` (`.mimir/raw/`). To pull in files that live elsewhere —
860+
sibling packages in a monorepo, a shared docs folder, a downloaded directory — add them straight to the
861+
`sources` array in `.mimir/config.json`. No separate file is needed:
862+
863+
```json
864+
{
865+
"sources": [
866+
"../packages/*/README.md",
867+
"../docs",
868+
"./NOTES.md",
869+
"!../packages/**/node_modules/**"
870+
]
871+
}
872+
```
873+
874+
Each entry is one of:
875+
876+
- a **file** or **directory** path — relative paths resolve from the project root; directories are indexed recursively;
877+
- a **glob** pattern — any entry containing `*`, `?`, `[`, or `{`;
878+
- an **exclusion** — starts with `!` and filters the glob matches.
879+
880+
> **Legacy `sources.txt`.** Paths listed one per line in `.mimir/sources.txt` are still read when the
881+
> file exists, and `mimir sources add` / `mimir sources list` continue to manage it. Entries from both
882+
> the `sources` array and `sources.txt` are merged, so existing projects keep working unchanged. New
883+
> projects should prefer the `sources` array — `mimir init` no longer creates a `sources.txt`.
884+
819885
Environment overrides:
820886

821887
- `MIMIR_RAW_DIR`

docs/cli-reference.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Mimir ships two CLIs:
1111
| --- | --- |
1212
| `mimir setup` | Initialize Mimir, install the agent kit, run doctor, and ingest when safe. |
1313
| `mimir setup --semantic` | Run first setup and explicitly download the configured Transformers.js embedding model for higher-quality semantic retrieval. |
14-
| `mimir init` | Create `.mimir/config.json`, `.mimir/sources.txt`, `.mimir/raw/`, and Git ignore rules. |
14+
| `mimir init` | Create `.mimir/config.json` (with a `sources` array), `.mimir/raw/`, and Git ignore rules. |
1515
| `mimir doctor` | Diagnose setup, index freshness, security warnings, and the next command to run. |
1616
| `mimir doctor --fix` | Create missing scaffolding, install skills/MCP config, and update stale indexes when safe. |
1717
| `mimir models pull` | Download the configured Transformers.js embedding model into `embeddingModelPath`. |
@@ -78,6 +78,7 @@ Mimir ships two CLIs:
7878
| `--offline` | `audio`, `mimir-tts render` | Disable remote model downloads and force the local Transformers.js path. |
7979
| `--allow-remote-models` | `audio`, `mimir-tts render` | Explicitly allow model downloads for Transformers.js. |
8080
| `--engine edge` | `audio`, `mimir-tts render` | Use online Edge TTS for MP3 output. |
81+
| `--lang <en\|es\|fr>` | `audio`, `mimir-tts render` | Select the TTS language; picks the offline model and Edge voice. Default `fr`. |
8182

8283
See [`offline-tts-preload.md`](./offline-tts-preload.md) before using `--offline` on a fully
8384
air-gapped machine.

packages/mimir-core/dist/cli.js

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

packages/mimir-core/dist/cli.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/mimir-core/dist/config.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/mimir-core/dist/config.js

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

0 commit comments

Comments
 (0)