@jcode.labs/ragmir 2.0.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/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/access-log.d.ts +11 -0
- package/dist/access-log.d.ts.map +1 -0
- package/dist/access-log.js +145 -0
- package/dist/access-log.js.map +1 -0
- package/dist/chunking.d.ts +3 -0
- package/dist/chunking.d.ts.map +1 -0
- package/dist/chunking.js +58 -0
- package/dist/chunking.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +944 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +224 -0
- package/dist/config.js.map +1 -0
- package/dist/defaults.d.ts +17 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +59 -0
- package/dist/defaults.js.map +1 -0
- package/dist/destroy.d.ts +3 -0
- package/dist/destroy.d.ts.map +1 -0
- package/dist/destroy.js +16 -0
- package/dist/destroy.js.map +1 -0
- package/dist/doctor.d.ts +3 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +117 -0
- package/dist/doctor.js.map +1 -0
- package/dist/embeddings.d.ts +9 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +110 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/evaluate.d.ts +3 -0
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +97 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/files.d.ts +16 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +388 -0
- package/dist/files.js.map +1 -0
- package/dist/gitignore.d.ts +3 -0
- package/dist/gitignore.d.ts.map +1 -0
- package/dist/gitignore.js +27 -0
- package/dist/gitignore.js.map +1 -0
- package/dist/guards.d.ts +2 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +4 -0
- package/dist/guards.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest.d.ts +4 -0
- package/dist/ingest.d.ts.map +1 -0
- package/dist/ingest.js +268 -0
- package/dist/ingest.js.map +1 -0
- package/dist/init.d.ts +2 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +33 -0
- package/dist/init.js.map +1 -0
- package/dist/mcp.d.ts +8 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +189 -0
- package/dist/mcp.js.map +1 -0
- package/dist/package-manager.d.ts +11 -0
- package/dist/package-manager.d.ts.map +1 -0
- package/dist/package-manager.js +93 -0
- package/dist/package-manager.js.map +1 -0
- package/dist/parsing.d.ts +12 -0
- package/dist/parsing.d.ts.map +1 -0
- package/dist/parsing.js +307 -0
- package/dist/parsing.js.map +1 -0
- package/dist/query.d.ts +5 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +180 -0
- package/dist/query.js.map +1 -0
- package/dist/redaction.d.ts +7 -0
- package/dist/redaction.d.ts.map +1 -0
- package/dist/redaction.js +93 -0
- package/dist/redaction.js.map +1 -0
- package/dist/research.d.ts +9 -0
- package/dist/research.d.ts.map +1 -0
- package/dist/research.js +335 -0
- package/dist/research.js.map +1 -0
- package/dist/security.d.ts +3 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +106 -0
- package/dist/security.js.map +1 -0
- package/dist/semantic-config.d.ts +9 -0
- package/dist/semantic-config.d.ts.map +1 -0
- package/dist/semantic-config.js +35 -0
- package/dist/semantic-config.js.map +1 -0
- package/dist/setup.d.ts +32 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +74 -0
- package/dist/setup.js.map +1 -0
- package/dist/skill.d.ts +66 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +652 -0
- package/dist/skill.js.map +1 -0
- package/dist/sources.d.ts +16 -0
- package/dist/sources.d.ts.map +1 -0
- package/dist/sources.js +71 -0
- package/dist/sources.js.map +1 -0
- package/dist/store.d.ts +13 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +94 -0
- package/dist/store.js.map +1 -0
- package/dist/text.d.ts +3 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +10 -0
- package/dist/text.js.map +1 -0
- package/dist/types.d.ts +322 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/examples/library-api-demo/README.md +42 -0
- package/examples/library-api-demo/run.mjs +61 -0
- package/examples/sovereign-rag-demo/.ragmir/config.json +22 -0
- package/examples/sovereign-rag-demo/.ragmir/sources.txt +2 -0
- package/examples/sovereign-rag-demo/README.md +95 -0
- package/examples/sovereign-rag-demo/golden-queries.json +29 -0
- package/examples/sovereign-rag-demo/raw/dataset-inventory.csv +5 -0
- package/examples/sovereign-rag-demo/raw/facility-scan.heic +3 -0
- package/examples/sovereign-rag-demo/raw/incident-timeline.jsonl +4 -0
- package/examples/sovereign-rag-demo/raw/operations-brief.md +16 -0
- package/examples/sovereign-rag-demo/raw/review-notes.evidence +11 -0
- package/examples/sovereign-rag-demo/raw/security-policy.yaml +14 -0
- package/package.json +87 -0
- package/skills/ragmir/SKILL.md +366 -0
- package/skills/ragmir-audio-summary/SKILL.md +150 -0
- package/skills/ragmir-audio-summary/forge-voice.sh +150 -0
- package/skills/ragmir-audio-summary/split-lines.py +13 -0
- package/skills/ragmir-audio-summary/xtts-voice.py +46 -0
- package/skills/ragmir-legal-dossier/SKILL.md +143 -0
- package/skills/ragmir-markdown-report/SKILL.md +110 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Render a text file to WAV with Coqui XTTS-v2.
|
|
3
|
+
|
|
4
|
+
Run with the dedicated venv interpreter:
|
|
5
|
+
~/.local/share/voice-forge/xtts/bin/python xtts-voice.py <text.txt> <out.wav> [speaker]
|
|
6
|
+
|
|
7
|
+
Env: XTTS_SPEAKER (preset name), XTTS_LANG (default "fr").
|
|
8
|
+
"""
|
|
9
|
+
import os
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
os.environ.setdefault("COQUI_TOS_AGREED", "1")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main() -> None:
|
|
16
|
+
if len(sys.argv) < 3:
|
|
17
|
+
sys.exit("usage: xtts-voice.py <text.txt> <out.wav> [speaker]")
|
|
18
|
+
text_file, out_wav = sys.argv[1], sys.argv[2]
|
|
19
|
+
speaker = sys.argv[3] if len(sys.argv) > 3 else os.environ.get("XTTS_SPEAKER", "Ana Florence")
|
|
20
|
+
language = os.environ.get("XTTS_LANG", "fr")
|
|
21
|
+
|
|
22
|
+
with open(text_file, encoding="utf-8") as handle:
|
|
23
|
+
text = handle.read().strip()
|
|
24
|
+
if not text:
|
|
25
|
+
sys.exit("error: empty text file")
|
|
26
|
+
|
|
27
|
+
from TTS.api import TTS
|
|
28
|
+
|
|
29
|
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")
|
|
30
|
+
speakers = list(getattr(tts, "speakers", None) or [])
|
|
31
|
+
if speakers and speaker not in speakers:
|
|
32
|
+
sys.stderr.write(f"speaker '{speaker}' not found; falling back to '{speakers[0]}'\n")
|
|
33
|
+
speaker = speakers[0]
|
|
34
|
+
|
|
35
|
+
tts.tts_to_file(
|
|
36
|
+
text=text,
|
|
37
|
+
speaker=speaker,
|
|
38
|
+
language=language,
|
|
39
|
+
file_path=out_wav,
|
|
40
|
+
split_sentences=True,
|
|
41
|
+
)
|
|
42
|
+
print(out_wav)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
main()
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ragmir-legal-dossier
|
|
3
|
+
description: >-
|
|
4
|
+
Prepare cited legal-dossier work products from a local Ragmir knowledge base. Use when the user asks
|
|
5
|
+
for a legal chronology, clause search, dossier summary, evidence table, redaction review, or
|
|
6
|
+
professional-review handoff grounded in confidential local documents.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Ragmir Legal Dossier
|
|
10
|
+
|
|
11
|
+
Use this skill for legal or quasi-legal dossiers where confidentiality, evidence separation, and
|
|
12
|
+
professional review matter. This skill does not provide final legal advice. It prepares structured,
|
|
13
|
+
cited work products for review by the user or a qualified professional.
|
|
14
|
+
|
|
15
|
+
## Safety Rules
|
|
16
|
+
|
|
17
|
+
- Treat source documents, retrieved passages, party names, dates, amounts, identifiers, and draft
|
|
18
|
+
outputs as confidential.
|
|
19
|
+
- Keep generated work under `.ragmir/reports/` unless the user explicitly asks for a sanitized
|
|
20
|
+
tracked artifact.
|
|
21
|
+
- Do not upload documents, snippets, queries, vector stores, or generated drafts to hosted services.
|
|
22
|
+
- Do not present conclusions as legal advice. Separate evidence, inference, uncertainty, and review
|
|
23
|
+
items.
|
|
24
|
+
- Prefer short cited summaries over long raw extracts.
|
|
25
|
+
- Flag missing documents, unsupported files, stale indexes, and ambiguous source passages.
|
|
26
|
+
|
|
27
|
+
## Recommended Redaction Patterns
|
|
28
|
+
|
|
29
|
+
If a legal dossier includes professional secrecy, case identifiers, or French personal identifiers,
|
|
30
|
+
add project-local redaction patterns in `.ragmir/config.json` before indexing. Keep patterns scoped to the
|
|
31
|
+
dossier and test them on non-sensitive samples first.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"redaction": {
|
|
36
|
+
"enabled": true,
|
|
37
|
+
"builtIn": true,
|
|
38
|
+
"patterns": [
|
|
39
|
+
{
|
|
40
|
+
"name": "case_reference",
|
|
41
|
+
"pattern": "\\b(?:RG|N°\\s*RG|No\\s*RG)\\s*[:\\-]?\\s*[0-9A-Z/\\-]{4,}\\b",
|
|
42
|
+
"replacement": "[CASE_REFERENCE]"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "french_nir",
|
|
46
|
+
"pattern": "\\b[12]\\s?\\d{2}\\s?\\d{2}\\s?\\d{2}\\s?\\d{3}\\s?\\d{3}\\s?\\d{2}\\b",
|
|
47
|
+
"replacement": "[FRENCH_NIR]"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "iban",
|
|
51
|
+
"pattern": "\\b[A-Z]{2}\\d{2}(?:\\s?[A-Z0-9]){11,30}\\b",
|
|
52
|
+
"replacement": "[IBAN]"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
After changing redaction rules, rebuild the index:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pnpm exec ragmir ingest --rebuild
|
|
63
|
+
pnpm exec ragmir security-audit --strict
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Retrieval Workflow
|
|
67
|
+
|
|
68
|
+
Start from readiness checks:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pnpm exec ragmir doctor
|
|
72
|
+
pnpm exec ragmir audit
|
|
73
|
+
pnpm exec ragmir audit --unsupported
|
|
74
|
+
pnpm exec ragmir security-audit --strict
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then run targeted retrieval passes:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pnpm exec ragmir search "parties obligations dates amounts" --top-k 8
|
|
81
|
+
pnpm exec ragmir search "termination clause liability indemnity notice" --top-k 8
|
|
82
|
+
pnpm exec ragmir search "timeline meeting decision approval refusal" --top-k 8
|
|
83
|
+
pnpm exec ragmir ask "Which documents support the chronology of events?" --top-k 8
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
When MCP is available, prefer `ragmir_status`, `ragmir_search`, `ragmir_ask`, `ragmir_audit`, and
|
|
87
|
+
`ragmir_security_audit` so the agent can keep retrieval bounded and cited.
|
|
88
|
+
|
|
89
|
+
## Output Formats
|
|
90
|
+
|
|
91
|
+
### Dossier Summary
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
# Legal Dossier Summary
|
|
95
|
+
|
|
96
|
+
## Scope
|
|
97
|
+
|
|
98
|
+
## Evidence Inventory
|
|
99
|
+
|
|
100
|
+
## Key Facts
|
|
101
|
+
|
|
102
|
+
## Main Legal Or Contractual Questions
|
|
103
|
+
|
|
104
|
+
## Risks And Unknowns
|
|
105
|
+
|
|
106
|
+
## Professional Review Items
|
|
107
|
+
|
|
108
|
+
## Sources
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Chronology
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
| Date | Event | Evidence | Confidence | Review item |
|
|
115
|
+
| --- | --- | --- | --- | --- |
|
|
116
|
+
| YYYY-MM-DD | | source.md chunk=0 | High/Medium/Low | |
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Clause Review
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
| Clause topic | Source | Extract summary | Risk | Follow-up |
|
|
123
|
+
| --- | --- | --- | --- | --- |
|
|
124
|
+
| Termination | contract.docx chunk=3 | | | |
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Evidence Gap List
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
| Missing or weak evidence | Why it matters | Suggested next document |
|
|
131
|
+
| --- | --- | --- |
|
|
132
|
+
| | | |
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Final Response Checklist
|
|
136
|
+
|
|
137
|
+
Before handing back the work:
|
|
138
|
+
|
|
139
|
+
- state where the report was saved;
|
|
140
|
+
- list source paths used, not private full passages;
|
|
141
|
+
- mention unsupported, stale, or missing files;
|
|
142
|
+
- include a professional-review section;
|
|
143
|
+
- state whether the artifact is safe to commit or must remain local.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ragmir-markdown-report
|
|
3
|
+
description: >-
|
|
4
|
+
Create a cited Markdown report from a Ragmir local knowledge base. Use when the user asks for a
|
|
5
|
+
report, dossier, audit memo, planning note, evidence summary, or Markdown deliverable grounded in
|
|
6
|
+
private repository documents indexed by Ragmir.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Ragmir Markdown Report
|
|
10
|
+
|
|
11
|
+
Use this skill to write a Markdown report from local Ragmir evidence without leaking raw documents.
|
|
12
|
+
Generated reports are derived artifacts and should stay local unless the user explicitly decides a
|
|
13
|
+
sanitized report is safe to commit or share.
|
|
14
|
+
|
|
15
|
+
## Confidentiality Rules
|
|
16
|
+
|
|
17
|
+
- Treat source documents, retrieved passages, notes, drafts, and generated reports as sensitive.
|
|
18
|
+
- Prefer writing reports under `.ragmir/reports/`, which is ignored by Git when Ragmir is installed.
|
|
19
|
+
- Do not commit generated reports by default.
|
|
20
|
+
- Do not paste long raw passages into the report. Use summaries, short cited extracts when needed,
|
|
21
|
+
and source references.
|
|
22
|
+
- Separate proven facts, inference, uncertainty, and missing evidence.
|
|
23
|
+
- For legal, tax, medical, immigration, financial, or compliance reports, include a professional
|
|
24
|
+
review section instead of presenting the report as final advice.
|
|
25
|
+
|
|
26
|
+
## 1. Verify The Knowledge Base
|
|
27
|
+
|
|
28
|
+
From the repository root:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm exec ragmir doctor
|
|
32
|
+
pnpm exec ragmir audit
|
|
33
|
+
pnpm exec ragmir security-audit
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If files are missing, stale, or setup is incomplete:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm exec ragmir doctor --fix
|
|
40
|
+
pnpm exec ragmir audit --unsupported
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Do not write a final report from stale evidence unless the user explicitly accepts that limitation.
|
|
44
|
+
|
|
45
|
+
## 2. Build An Evidence Plan
|
|
46
|
+
|
|
47
|
+
For a broad report, use multiple targeted retrieval passes instead of one generic query:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm exec ragmir search "<main report topic>" --top-k 8
|
|
51
|
+
pnpm exec ragmir search "<people, dates, amounts, obligations, risks, decisions>" --top-k 8
|
|
52
|
+
pnpm exec ragmir ask "<specific synthesis question>" --top-k 8
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
When MCP is available, prefer `ragmir_search`, `ragmir_ask`, `ragmir_audit`, and
|
|
56
|
+
`ragmir_security_audit` over shell commands.
|
|
57
|
+
|
|
58
|
+
Keep a working note of source paths and chunk numbers for each claim you plan to include.
|
|
59
|
+
|
|
60
|
+
## 3. Write The Report
|
|
61
|
+
|
|
62
|
+
Default report structure:
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
# <Report Title>
|
|
66
|
+
|
|
67
|
+
## Scope
|
|
68
|
+
|
|
69
|
+
## Executive Summary
|
|
70
|
+
|
|
71
|
+
## Evidence Inventory
|
|
72
|
+
|
|
73
|
+
## Findings
|
|
74
|
+
|
|
75
|
+
## Risks And Open Questions
|
|
76
|
+
|
|
77
|
+
## Recommended Next Actions
|
|
78
|
+
|
|
79
|
+
## Sources
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Use tables only when they make comparisons easier. Keep each finding tied to one or more source
|
|
83
|
+
paths and chunk numbers when possible.
|
|
84
|
+
|
|
85
|
+
## 4. Save Locally
|
|
86
|
+
|
|
87
|
+
Create the report directory:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
mkdir -p .ragmir/reports
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Write the report to:
|
|
94
|
+
|
|
95
|
+
```plain text
|
|
96
|
+
.ragmir/reports/<subject-kebab>.md
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If the user explicitly wants a tracked report, create a sanitized file outside `.ragmir/` and state
|
|
100
|
+
which private details were excluded.
|
|
101
|
+
|
|
102
|
+
## 5. Report The Result
|
|
103
|
+
|
|
104
|
+
After writing the report, tell the user:
|
|
105
|
+
|
|
106
|
+
- the report path;
|
|
107
|
+
- whether the index was ready;
|
|
108
|
+
- how many source paths were used;
|
|
109
|
+
- any unsupported, stale, or missing files that weaken the report;
|
|
110
|
+
- whether the report is safe to commit or should remain local.
|