explainmyrepo 0.1.1
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/README.md +165 -0
- package/assets/design-system/design-system.css +833 -0
- package/assets/design-system/theme-example.css +83 -0
- package/bin/explainmyrepo.mjs +115 -0
- package/kb/ask-kb.mjs +1487 -0
- package/kb/build-kb.mjs +353 -0
- package/kb/corpus-rules.mjs +341 -0
- package/kb/dep-graph.mjs +184 -0
- package/kb/entrypoints.mjs +207 -0
- package/kb/extract-symbols.mjs +322 -0
- package/kb/index-primer.mjs +255 -0
- package/kb/kb-mcp-server.mjs +186 -0
- package/kb/kb.config.mjs +1362 -0
- package/kb/make-dropin.mjs +224 -0
- package/kb/resolve-deps.mjs +126 -0
- package/package.json +52 -0
- package/src/brain.mjs +298 -0
- package/src/build-context.mjs +66 -0
- package/src/claude.mjs +97 -0
- package/src/env.mjs +77 -0
- package/src/orchestrator.mjs +419 -0
- package/src/run-tool.mjs +49 -0
- package/tools/CONTRACT.md +301 -0
- package/tools/assemble-page.mjs +631 -0
- package/tools/build-kb.mjs +159 -0
- package/tools/clone-repo.mjs +161 -0
- package/tools/deploy.mjs +160 -0
- package/tools/generate-image.mjs +280 -0
- package/tools/make-diagrams.mjs +835 -0
- package/tools/make-favicon.mjs +145 -0
- package/tools/make-pack.mjs +295 -0
- package/tools/make-social-card.mjs +198 -0
- package/tools/notify.mjs +327 -0
- package/tools/publish-repo.mjs +156 -0
- package/tools/quality-grade.mjs +746 -0
- package/tools/readme-enhance.mjs +310 -0
- package/tools/repo-seo.mjs +143 -0
package/kb/kb.config.mjs
ADDED
|
@@ -0,0 +1,1362 @@
|
|
|
1
|
+
// kb.config.mjs — Config registry for the generic, config-driven KB pipeline.
|
|
2
|
+
// P0 scaffold: the `agent-harness-generator` ("MetaHarness") target entry only.
|
|
3
|
+
// Binding: build-plan-metaharness.md §2a [D10, A]. ONE target until ≥98 + sign-off [L].
|
|
4
|
+
//
|
|
5
|
+
// Mechanics are preserved from the proven Cognitum prototype; repo-shape becomes DATA here.
|
|
6
|
+
// All on-page commands + KB `mustContain` facts use `metaharness` as PRIMARY,
|
|
7
|
+
// note `create-agent-harness` as the ALIAS (same tool; reconciliation note in the plan §0).
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* componentWord synonym group — first-class config knob injected into every intent regex
|
|
11
|
+
* in ask-kb.mjs. AHG is npm-package-based (`packages/<name>`), NOT crate-based, so the
|
|
12
|
+
* hard-coded "crate" token in the prototype must be widened or Stage-3/4 retrieval under-fires.
|
|
13
|
+
* (Top risk #1 in the plan.)
|
|
14
|
+
*/
|
|
15
|
+
const componentWord = ['crate', 'package', 'module', 'component'];
|
|
16
|
+
|
|
17
|
+
/** @type {Record<string, object>} keyed by target slug. */
|
|
18
|
+
export const targets = {
|
|
19
|
+
"chalk": {
|
|
20
|
+
"slug": "chalk",
|
|
21
|
+
"metaName": "chalk",
|
|
22
|
+
"embed": {
|
|
23
|
+
"model": "Xenova/bge-small-en-v1.5",
|
|
24
|
+
"dim": 384,
|
|
25
|
+
"pooling": "mean",
|
|
26
|
+
"queryPrefix": "Represent this sentence for searching relevant passages: ",
|
|
27
|
+
"rankScale": 0.6,
|
|
28
|
+
"rvfSuffix": ".rvf"
|
|
29
|
+
},
|
|
30
|
+
"productNames": [
|
|
31
|
+
"chalk"
|
|
32
|
+
],
|
|
33
|
+
"repoDir": "/Users/stuartkerr/Code/Ruv-Explainer/explainer-builds/chalk/repo",
|
|
34
|
+
"scopeExclude": [
|
|
35
|
+
"node_modules",
|
|
36
|
+
"dist",
|
|
37
|
+
"target",
|
|
38
|
+
".git",
|
|
39
|
+
"coverage",
|
|
40
|
+
"pkg",
|
|
41
|
+
".next"
|
|
42
|
+
],
|
|
43
|
+
"codeExt": [
|
|
44
|
+
".js",
|
|
45
|
+
".ts",
|
|
46
|
+
".mjs",
|
|
47
|
+
".cjs"
|
|
48
|
+
],
|
|
49
|
+
"fullTextExt": [
|
|
50
|
+
".md",
|
|
51
|
+
".mdx",
|
|
52
|
+
".txt"
|
|
53
|
+
],
|
|
54
|
+
"templateExt": [],
|
|
55
|
+
"componentRoots": [
|
|
56
|
+
"source",
|
|
57
|
+
"src",
|
|
58
|
+
"."
|
|
59
|
+
],
|
|
60
|
+
"componentWord": [
|
|
61
|
+
"crate",
|
|
62
|
+
"package",
|
|
63
|
+
"module",
|
|
64
|
+
"component"
|
|
65
|
+
],
|
|
66
|
+
"include": [
|
|
67
|
+
{
|
|
68
|
+
"rule": "mdSweepFullText",
|
|
69
|
+
"roots": [
|
|
70
|
+
"."
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"rule": "literalFiles",
|
|
75
|
+
"files": [
|
|
76
|
+
"README.md",
|
|
77
|
+
"package.json",
|
|
78
|
+
"license",
|
|
79
|
+
"index.js",
|
|
80
|
+
"index.d.ts"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"rule": "sourceBodies",
|
|
85
|
+
"roots": [
|
|
86
|
+
"source",
|
|
87
|
+
"src",
|
|
88
|
+
"."
|
|
89
|
+
],
|
|
90
|
+
"ext": [
|
|
91
|
+
".js",
|
|
92
|
+
".ts",
|
|
93
|
+
".mjs",
|
|
94
|
+
".cjs"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"helix": {
|
|
100
|
+
"slug": "helix",
|
|
101
|
+
"metaName": "helix (ruvnet)",
|
|
102
|
+
"embed": {
|
|
103
|
+
"model": "Xenova/bge-small-en-v1.5",
|
|
104
|
+
"dim": 384,
|
|
105
|
+
"pooling": "mean",
|
|
106
|
+
"queryPrefix": "Represent this sentence for searching relevant passages: ",
|
|
107
|
+
"rankScale": 0.6,
|
|
108
|
+
"rvfSuffix": ".rvf"
|
|
109
|
+
},
|
|
110
|
+
"productNames": [
|
|
111
|
+
"helix"
|
|
112
|
+
],
|
|
113
|
+
"repoDir": "/Users/stuartkerr/Code/Ruv-Explainer/explainer-builds/helix/repo",
|
|
114
|
+
"scopeExclude": [
|
|
115
|
+
"node_modules",
|
|
116
|
+
"dist",
|
|
117
|
+
"target",
|
|
118
|
+
".git",
|
|
119
|
+
"coverage",
|
|
120
|
+
"pkg",
|
|
121
|
+
".next",
|
|
122
|
+
"__pycache__",
|
|
123
|
+
".cargo"
|
|
124
|
+
],
|
|
125
|
+
"codeExt": [
|
|
126
|
+
".rs",
|
|
127
|
+
".ts",
|
|
128
|
+
".js",
|
|
129
|
+
".mjs",
|
|
130
|
+
".py",
|
|
131
|
+
".sh",
|
|
132
|
+
".toml",
|
|
133
|
+
".yaml",
|
|
134
|
+
".yml",
|
|
135
|
+
".json"
|
|
136
|
+
],
|
|
137
|
+
"fullTextExt": [
|
|
138
|
+
".md",
|
|
139
|
+
".mdx",
|
|
140
|
+
".txt",
|
|
141
|
+
".rst"
|
|
142
|
+
],
|
|
143
|
+
"templateExt": [],
|
|
144
|
+
"componentRoots": [
|
|
145
|
+
"src",
|
|
146
|
+
"lib",
|
|
147
|
+
"bin",
|
|
148
|
+
"examples",
|
|
149
|
+
"crates",
|
|
150
|
+
"packages",
|
|
151
|
+
"scripts",
|
|
152
|
+
"config"
|
|
153
|
+
],
|
|
154
|
+
"componentWord": [
|
|
155
|
+
"crate",
|
|
156
|
+
"package",
|
|
157
|
+
"module",
|
|
158
|
+
"component"
|
|
159
|
+
],
|
|
160
|
+
"include": [
|
|
161
|
+
{
|
|
162
|
+
"rule": "mdSweepFullText",
|
|
163
|
+
"roots": [
|
|
164
|
+
"."
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"rule": "literalFiles",
|
|
169
|
+
"files": [
|
|
170
|
+
"README.md",
|
|
171
|
+
"Cargo.toml",
|
|
172
|
+
"package.json",
|
|
173
|
+
"pyproject.toml",
|
|
174
|
+
"setup.py"
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"rule": "sourceBodies",
|
|
179
|
+
"roots": [
|
|
180
|
+
"src",
|
|
181
|
+
"lib",
|
|
182
|
+
"bin",
|
|
183
|
+
"crates",
|
|
184
|
+
"packages",
|
|
185
|
+
"examples",
|
|
186
|
+
"scripts"
|
|
187
|
+
],
|
|
188
|
+
"ext": [
|
|
189
|
+
".rs",
|
|
190
|
+
".ts",
|
|
191
|
+
".js",
|
|
192
|
+
".mjs",
|
|
193
|
+
".py",
|
|
194
|
+
".sh",
|
|
195
|
+
".toml",
|
|
196
|
+
".yaml",
|
|
197
|
+
".yml"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
203
|
+
// agenticow — "Git for Agent Memory": copy-on-write vector branching. Node ESM
|
|
204
|
+
// single-package npm (agenticow@0.2.x on @ruvector/rvf-node). Components are the
|
|
205
|
+
// public API in src/index.js (open/openBase/branch/fork/checkpoint/rollback/diff/
|
|
206
|
+
// promote/query), the CLI in bin/agenticow.js, and the runnable use-case scripts
|
|
207
|
+
// in examples/. repoDir points at the live build-dir clone. Registered for the
|
|
208
|
+
// explainmyrepo recipe acceptance run (2026-06-28).
|
|
209
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
210
|
+
agenticow: {
|
|
211
|
+
slug: 'agenticow',
|
|
212
|
+
metaName: 'agenticow',
|
|
213
|
+
embed: {
|
|
214
|
+
model: 'Xenova/bge-small-en-v1.5',
|
|
215
|
+
dim: 384,
|
|
216
|
+
pooling: 'mean',
|
|
217
|
+
queryPrefix: 'Represent this sentence for searching relevant passages: ',
|
|
218
|
+
rankScale: 0.6,
|
|
219
|
+
rvfSuffix: '.rvf',
|
|
220
|
+
},
|
|
221
|
+
productNames: [
|
|
222
|
+
'agenticow', 'AgenticMemory', 'open', 'openBase', 'branch', 'fork',
|
|
223
|
+
'checkpoint', 'rollback', 'diff', 'promote', 'query', 'ingest', 'lineage',
|
|
224
|
+
],
|
|
225
|
+
primerSlugs: {
|
|
226
|
+
whatis: 'PRIMER#1-what-is-agenticow',
|
|
227
|
+
capabilities: 'PRIMER#2-what-can-agenticow-do-for-you',
|
|
228
|
+
crates: 'PRIMER#3-what-is-agenticow-made-of',
|
|
229
|
+
composer: 'PRIMER#4-how-copy-on-write-branching-works',
|
|
230
|
+
maturity: 'PRIMER#5-is-it-production-ready-scope-and-honest-limits',
|
|
231
|
+
docs: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
232
|
+
adr: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
233
|
+
playbook: 'PRIMER#7-how-do-i-install-and-use-it-end-to-end',
|
|
234
|
+
extensibility: 'PRIMER#8-how-do-i-extend-agenticow',
|
|
235
|
+
gotchas: 'PRIMER#9-cost-latency-and-gotchas',
|
|
236
|
+
},
|
|
237
|
+
extensionFiles: {
|
|
238
|
+
'verb': ['src/index.js', 'src/index.d.ts'],
|
|
239
|
+
'branch': ['src/index.js', 'examples/git-workflow.mjs'],
|
|
240
|
+
'cli': ['bin/agenticow.js'],
|
|
241
|
+
'command':['bin/agenticow.js'],
|
|
242
|
+
'example':['examples/red-team-sandbox.mjs', 'examples/parallel-agents.mjs'],
|
|
243
|
+
},
|
|
244
|
+
docFiles: {
|
|
245
|
+
cli: ['README.md', 'bin/agenticow.js'],
|
|
246
|
+
usage: ['README.md', 'examples/README.md'],
|
|
247
|
+
},
|
|
248
|
+
typeAliases: {
|
|
249
|
+
'memory': 'AgenticMemory',
|
|
250
|
+
'open': 'open',
|
|
251
|
+
'fork': 'fork',
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
// ── Source scope (force-walk; clone has no .gitmodules) ──
|
|
255
|
+
repoDir: '../.targets/agenticow',
|
|
256
|
+
scopeExclude: ['node_modules', 'dist', 'target', '.git', 'coverage', 'pkg', '.next', 'docs'],
|
|
257
|
+
|
|
258
|
+
codeExt: ['.ts', '.tsx', '.js', '.mjs', '.cjs'],
|
|
259
|
+
fullTextExt: ['.md', '.mdx', '.txt'],
|
|
260
|
+
templateExt: [],
|
|
261
|
+
|
|
262
|
+
componentRoots: ['src', 'bin', 'examples'],
|
|
263
|
+
componentWord: ['verb', 'method', 'api', 'module', 'component', 'example'],
|
|
264
|
+
|
|
265
|
+
// ── Corpus include rules ──
|
|
266
|
+
include: [
|
|
267
|
+
{ rule: 'mdSweepFullText', roots: ['.'] }, // README + examples/README verbatim
|
|
268
|
+
{ rule: 'literalFiles', files: ['README.md', 'examples/README.md', 'package.json', 'src/index.js', 'src/index.d.ts', 'bin/agenticow.js', 'LICENSE'] },
|
|
269
|
+
{ rule: 'sourceBodies', roots: ['src', 'bin'], ext: ['.ts', '.js', '.mjs'] }, // the public API + CLI bodies
|
|
270
|
+
{ rule: 'testsAndExamples', roots: ['examples', 'test', 'bench'], ext: ['.ts', '.js', '.mjs'] }, // runnable usage = best docs
|
|
271
|
+
{ rule: 'docCommentSweep', roots: ['src', 'bin', 'examples'] },
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
'agent-harness-generator': {
|
|
276
|
+
// ── Identity ────────────────────────────────────────────────────────────
|
|
277
|
+
slug: 'agent-harness-generator',
|
|
278
|
+
metaName: 'MetaHarness',
|
|
279
|
+
// ── Embedder (ADR-0001 v1.3.1: SINGLE 384-dim desktop variant) ────────────
|
|
280
|
+
// bge-small-en-v1.5 (cls-pooled, normalized, asymmetric query prefix) — the SAME embedder
|
|
281
|
+
// proven on ruqu/ruvn. build-kb.mjs writes the canonical un-suffixed
|
|
282
|
+
// stores/agent-harness-generator/agent-harness-generator-kb.rvf + a .embed.json sidecar that
|
|
283
|
+
// ask-kb + index-primer read (so query + primer use the SAME model). Model is cached offline at
|
|
284
|
+
// kb/models-cache/Xenova/bge-small-en-v1.5 (HF_HUB_OFFLINE=1) for fast deterministic builds.
|
|
285
|
+
embed: {
|
|
286
|
+
model: 'Xenova/bge-small-en-v1.5',
|
|
287
|
+
dim: 384,
|
|
288
|
+
pooling: 'cls',
|
|
289
|
+
queryPrefix: 'Represent this sentence for searching relevant passages: ',
|
|
290
|
+
rankScale: 1,
|
|
291
|
+
rvfSuffix: '.rvf',
|
|
292
|
+
},
|
|
293
|
+
// Canonical CLI is `npx metaharness`; `create-agent-harness` is the internal-package alias.
|
|
294
|
+
productNames: [
|
|
295
|
+
'metaharness', // canonical CLI (README header)
|
|
296
|
+
'MetaHarness', // product / brand name
|
|
297
|
+
'create-agent-harness', // alias CLI (internal package packages/create-agent-harness)
|
|
298
|
+
'agent-harness-generator', // repo slug
|
|
299
|
+
'@ruvnet/agent-harness-generator',// published library name
|
|
300
|
+
'@metaharness/kernel', // kernel package
|
|
301
|
+
'@metaharness/router', // model router package
|
|
302
|
+
'@metaharness/darwin', // Darwin Mode package
|
|
303
|
+
],
|
|
304
|
+
// primer slug(s): EXPLICIT archetype -> PRIMER#<slug> map. Discovered from the live sidecar
|
|
305
|
+
// (slugify of each ## section title). Explicit beats 'auto' because two arc titles
|
|
306
|
+
// ("where do I read about the architecture", "how do I start the fastest") do not match the
|
|
307
|
+
// generic AUTO_SLUG_CUES regexes, so auto-discovery would miss the docs/playbook routes.
|
|
308
|
+
// ask-kb resolvePrimerSlug() consumes target.primerSlugs as an object first.
|
|
309
|
+
primerSlugs: {
|
|
310
|
+
whatis: 'PRIMER#1-what-is-metaharness',
|
|
311
|
+
capabilities: 'PRIMER#2-what-can-the-tool-do-to-a-repo',
|
|
312
|
+
crates: 'PRIMER#3-what-packages-make-up-metaharness',
|
|
313
|
+
composer: 'PRIMER#4-how-does-the-composer-scaffold-a-harness',
|
|
314
|
+
maturity: 'PRIMER#5-is-this-production-ready-maturity-and-honest-limits',
|
|
315
|
+
docs: 'PRIMER#6-where-do-i-read-about-the-architecture',
|
|
316
|
+
adr: 'PRIMER#6-where-do-i-read-about-the-architecture',
|
|
317
|
+
playbook: 'PRIMER#7-how-do-i-start-the-fastest-end-to-end',
|
|
318
|
+
// §8/§9 added for the AI-comprehension gate (extensibility + gotchas dimensions).
|
|
319
|
+
extensibility: 'PRIMER#8-how-do-i-extend-metaharness-safely-the-extension-points',
|
|
320
|
+
gotchas: 'PRIMER#9-performance-and-gotchas-running-the-generator',
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
// extensionFiles — concept word -> the real extension-point file(s) it touches. Consumed by the
|
|
324
|
+
// AI-comprehension grader (and a useful map for any AI): "add a host" -> the kernel HostAdapter
|
|
325
|
+
// contract + a reference adapter, etc. Every file below IS indexed (in passages.jsonl); PRIMER#8
|
|
326
|
+
// names them in prose. Paths verified against .targets/agent-harness-generator 2026-06-19.
|
|
327
|
+
extensionFiles: {
|
|
328
|
+
'host': ['packages/kernel-js/src/types.ts', 'packages/host-claude-code/src/index.ts', 'docs/adrs/ADR-004-host-integration-model.md'],
|
|
329
|
+
'adapter': ['packages/host-claude-code/src/index.ts', 'packages/kernel-js/src/types.ts', 'docs/adrs/ADR-004-host-integration-model.md'],
|
|
330
|
+
'vertical': ['packages/vertical-base/src/index.ts', 'packages/create-agent-harness/src/registry.ts', 'docs/adrs/ADR-013-vertical-packs-publishing.md'],
|
|
331
|
+
'template': ['packages/create-agent-harness/src/walker.ts', 'packages/create-agent-harness/src/renderer.ts', 'docs/adrs/ADR-003-generator-architecture.md'],
|
|
332
|
+
'composer': ['packages/create-agent-harness/src/index.ts', 'packages/create-agent-harness/src/wizard.ts', 'docs/adrs/ADR-003-generator-architecture.md'],
|
|
333
|
+
'scaffold': ['packages/create-agent-harness/src/index.ts', 'packages/create-agent-harness/src/walker.ts'],
|
|
334
|
+
'generator': ['packages/create-agent-harness/src/index.ts', 'docs/adrs/ADR-003-generator-architecture.md'],
|
|
335
|
+
'wizard': ['packages/create-agent-harness/src/wizard.ts'],
|
|
336
|
+
'render': ['packages/create-agent-harness/src/renderer.ts', 'packages/create-agent-harness/src/walker.ts'],
|
|
337
|
+
'rename': ['packages/create-agent-harness/src/rename.ts'],
|
|
338
|
+
'plugin': ['packages/create-agent-harness/src/plugin-init-cmd.ts', 'packages/create-agent-harness/src/registry.ts', 'docs/adrs/ADR-005-marketplace-plugin-design.md'],
|
|
339
|
+
'marketplace':['docs/adrs/ADR-005-marketplace-plugin-design.md', 'packages/create-agent-harness/src/registry.ts'],
|
|
340
|
+
'kernel': ['packages/kernel-js/src/index.ts', 'packages/kernel-js/src/types.ts', 'docs/adrs/ADR-002-kernel-boundary.md'],
|
|
341
|
+
'router': ['packages/router/src/index.ts'],
|
|
342
|
+
'agent': ['packages/sdk/src/index.ts'],
|
|
343
|
+
'skill': ['packages/sdk/src/index.ts'],
|
|
344
|
+
'tool': ['packages/sdk/src/index.ts'],
|
|
345
|
+
'sdk': ['packages/sdk/src/index.ts'],
|
|
346
|
+
'subcommand': ['packages/create-agent-harness/src/subcommands.ts', 'packages/create-agent-harness/src/index.ts'],
|
|
347
|
+
'command': ['packages/create-agent-harness/src/subcommands.ts', 'packages/create-agent-harness/src/index.ts'],
|
|
348
|
+
'manifest': ['packages/create-agent-harness/src/manifest.ts', 'docs/adrs/ADR-003-generator-architecture.md'],
|
|
349
|
+
'upgrade': ['packages/create-agent-harness/src/upgrade.ts', 'docs/adrs/ADR-008-drift-detection.md'],
|
|
350
|
+
'drift': ['packages/create-agent-harness/src/upgrade.ts', 'docs/adrs/ADR-008-drift-detection.md'],
|
|
351
|
+
},
|
|
352
|
+
// docFiles — per-dimension authoritative docs the grader injects (the AI reads these for the
|
|
353
|
+
// dimension). CLI per-command table lives in docs/USAGE.md; usage examples in the package READMEs.
|
|
354
|
+
docFiles: {
|
|
355
|
+
cli: ['docs/USAGE.md', 'packages/create-agent-harness/src/index.ts', 'packages/create-agent-harness/src/subcommands.ts'],
|
|
356
|
+
// usage: the SDK builders + Router API + the shared kernel TYPE definitions (types.ts holds the
|
|
357
|
+
// full HostAdapter / HarnessSpec / HookSpec / McpServerSpec interface bodies — TS interface
|
|
358
|
+
// MEMBERS aren't captured as method symbols, so the grader needs the file body to show the
|
|
359
|
+
// generateConfig(spec: HarnessSpec) signature) + a reference host adapter implementation.
|
|
360
|
+
usage: ['packages/sdk/src/index.ts', 'packages/router/src/index.ts', 'packages/kernel-js/src/types.ts', 'packages/host-claude-code/src/index.ts', 'docs/USAGE.md'],
|
|
361
|
+
},
|
|
362
|
+
// typeAliases — concept word in a question -> the public TS type/class whose definition + members
|
|
363
|
+
// answer it (the AI reads symbols.json + the file body). Names verified to exist in symbols.json.
|
|
364
|
+
typeAliases: {
|
|
365
|
+
'host': 'HostAdapter',
|
|
366
|
+
'adapter': 'HostAdapter',
|
|
367
|
+
'harness spec':'HarnessSpec',
|
|
368
|
+
'spec': 'HarnessSpec',
|
|
369
|
+
'router': 'Router',
|
|
370
|
+
'route': 'RouteResult',
|
|
371
|
+
'vertical': 'VerticalPack',
|
|
372
|
+
'manifest': 'HarnessManifest',
|
|
373
|
+
'agent': 'AgentDef',
|
|
374
|
+
'skill': 'SkillDef',
|
|
375
|
+
'tool': 'ToolDef',
|
|
376
|
+
'genome': 'HarnessPlan',
|
|
377
|
+
'plan': 'HarnessPlan',
|
|
378
|
+
'settings': 'ClaudeCodeSettings',
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
// ── Source scope (force-walk; NO .gitmodules in this repo → walk no-op) ──
|
|
382
|
+
repoDir: '../.targets/agent-harness-generator',
|
|
383
|
+
// Constraint A: clone ONLY the target's own tree; never index a vendor tree.
|
|
384
|
+
// Names match any dir in the walk. Beyond build artifacts we also exclude tree(s) that are NOT
|
|
385
|
+
// the MetaHarness *product* an AI needs to understand+use it: `apps/` is the separate client-side
|
|
386
|
+
// Studio web-UI (ADR-020..024, its own GitHub-Pages app), `scripts/` is repo CI tooling, and
|
|
387
|
+
// `bench`/`experiments` are darwin-mode research benchmark scripts (not the harness API surface).
|
|
388
|
+
// The product = the generator CLI + kernel + hosts + SDK + verticals (all under packages/ + crates/).
|
|
389
|
+
scopeExclude: [
|
|
390
|
+
'node_modules',
|
|
391
|
+
'target',
|
|
392
|
+
'dist',
|
|
393
|
+
'build',
|
|
394
|
+
'.git',
|
|
395
|
+
'pkg',
|
|
396
|
+
'.next',
|
|
397
|
+
'coverage',
|
|
398
|
+
'.vite',
|
|
399
|
+
'apps', // client-side Studio web-UI (separate product surface)
|
|
400
|
+
'scripts', // repo build/CI tooling, not harness API
|
|
401
|
+
'bench', // darwin-mode benchmark scripts (research, not API)
|
|
402
|
+
'benches', // Rust crate benchmark harnesses (infra, not API)
|
|
403
|
+
'experiments', // darwin-mode ablation experiments (research, not API)
|
|
404
|
+
'bin', // here ONLY examples-packages/*/bin/scaffold.mjs — identical `npx metaharness
|
|
405
|
+
// <name> --template vertical:X --host Y` demo shims; the command they wrap is
|
|
406
|
+
// already indexed (docs/USAGE.md + example READMEs). No product package uses bin/.
|
|
407
|
+
],
|
|
408
|
+
|
|
409
|
+
// ── Extension classes (what each file is, by suffix) ─────────────────────
|
|
410
|
+
// code: bodies swept via sourceBodies / docCommentSweep rule types.
|
|
411
|
+
codeExt: ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.rs'],
|
|
412
|
+
// fullText: prose swept verbatim (untruncated) via mdSweepFullText.
|
|
413
|
+
fullTextExt: ['.md', '.mdx', '.txt'],
|
|
414
|
+
// template: the .tmpl/.hbs harness scaffolding (294 files) — first-N-lines + path,
|
|
415
|
+
// kind:'template'. Stage-4/7 "what does a generated harness contain" depends on these.
|
|
416
|
+
templateExt: ['.tmpl', '.hbs', '.handlebars'],
|
|
417
|
+
|
|
418
|
+
// ── Component model ──────────────────────────────────────────────────────
|
|
419
|
+
// componentRoots per plan §2a. NOTE: repo ALSO has crates/, apps/, examples-packages/;
|
|
420
|
+
// plan specifies ["packages"] only for P0 — see deviation note in the P0 report.
|
|
421
|
+
componentRoots: ['packages'],
|
|
422
|
+
componentWord, // ['crate','package','module','component'] synonym group
|
|
423
|
+
|
|
424
|
+
// ── Disambiguation / off-topic magnets (filled during gate-A tuning, P6a) ──
|
|
425
|
+
disambiguation: [],
|
|
426
|
+
offtopicMagnets: [],
|
|
427
|
+
|
|
428
|
+
// ── Corpus include rules (consumed by build-kb.mjs / corpus-rules.mjs in P1) ──
|
|
429
|
+
// P0 lays the intent; rule-type implementations land in P1 (corpus-rules.mjs).
|
|
430
|
+
include: [
|
|
431
|
+
{ rule: 'mdSweepFullText', roots: ['docs', 'docs/adrs', '.'] }, // README + docs + ADRs, verbatim
|
|
432
|
+
{ rule: 'componentManifests', roots: ['packages', 'examples-packages'] }, // package.json per component
|
|
433
|
+
{ rule: 'componentLead', roots: ['packages', 'examples-packages'] }, // each package README / lead doc
|
|
434
|
+
// full source bodies: the npm packages (the product) + the Rust kernel crates + the runnable
|
|
435
|
+
// example-package scaffold scripts (examples-packages/*/bin) + the docs/ example tour.
|
|
436
|
+
{ rule: 'sourceBodies', roots: ['packages', 'crates', 'examples-packages', 'examples'], ext: ['.ts', '.tsx', '.js', '.mjs', '.rs'] },
|
|
437
|
+
// tests + examples are the BEST usage docs (real call sites + expected results). Ingested
|
|
438
|
+
// deliberately (sourceBodies excludes test-named files); tagged source_type test|example by build-kb.
|
|
439
|
+
// Covers per-package tests, the repo-level __tests__/ suite, and the examples/ tour scripts.
|
|
440
|
+
{ rule: 'testsAndExamples', roots: ['packages', '__tests__', 'examples', 'examples-packages'], ext: ['.ts', '.tsx', '.js', '.mjs', '.rs'] },
|
|
441
|
+
{ rule: 'docCommentSweep', roots: ['packages', 'crates'] }, // doc comments only
|
|
442
|
+
{ rule: 'literalFiles', files: ['README.md', 'docs/OVERVIEW.md', 'docs/ARCHITECTURE.md', 'docs/USAGE.md', 'docs/USERGUIDE.md'] },
|
|
443
|
+
{ rule: 'templates', roots: ['packages'], ext: ['.tmpl', '.hbs', '.handlebars'], headLines: 40 },
|
|
444
|
+
],
|
|
445
|
+
|
|
446
|
+
// ── Verification queries: ONE per arc stage (7 total) ─────────────────────
|
|
447
|
+
// Arc: why-built → what-problem/capabilities → inventory → how-each-works(composer)
|
|
448
|
+
// → maturity → docs-where → end-to-end-usage. Facts verified against source 2026-06-19.
|
|
449
|
+
verificationQueries: [
|
|
450
|
+
{
|
|
451
|
+
stage: 1,
|
|
452
|
+
arc: 'what-is-it',
|
|
453
|
+
query: 'What is metaharness?',
|
|
454
|
+
wantPaths: ['README.md', 'docs/OVERVIEW.md'],
|
|
455
|
+
mustContain: ['factory for agent frameworks', 'harness is the product', 'npx metaharness'],
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
stage: 2,
|
|
459
|
+
arc: 'capabilities',
|
|
460
|
+
query: 'What can the tool do to a repo?',
|
|
461
|
+
wantPaths: ['README.md', 'docs/USAGE.md'],
|
|
462
|
+
mustContain: ['score', 'genome', 'mcp-scan', 'threat-model', 'router', 'Darwin'],
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
stage: 3,
|
|
466
|
+
arc: 'inventory-components',
|
|
467
|
+
query: 'What packages make up metaharness?',
|
|
468
|
+
wantPaths: ['packages', 'docs/ARCHITECTURE.md'],
|
|
469
|
+
mustContain: ['kernel', 'host-claude-code', 'router', 'darwin', 'three-layer'],
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
stage: 4,
|
|
473
|
+
arc: 'how-each-works-composer',
|
|
474
|
+
query: 'How does the composer scaffold a harness?',
|
|
475
|
+
wantPaths: ['docs/adrs/ADR-003-generator-architecture.md', 'docs/ARCHITECTURE.md'],
|
|
476
|
+
// Composer 7 stages, verified ADR-003 lines 104–110.
|
|
477
|
+
mustContain: ['Identity', 'Hosts', 'Primitives', 'Agents', 'Skills', 'Plugins', 'Features', 'mcp'],
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
stage: 5,
|
|
481
|
+
arc: 'maturity',
|
|
482
|
+
query: 'Is this production-ready?',
|
|
483
|
+
wantPaths: ['README.md', 'docs/USERGUIDE.md'],
|
|
484
|
+
mustContain: ['v0.1.x beta', '568', 'never'],
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
stage: 6,
|
|
488
|
+
arc: 'docs-where-things-live',
|
|
489
|
+
query: 'Where do I read about the architecture?',
|
|
490
|
+
wantPaths: ['docs/ARCHITECTURE.md', 'docs/adrs'],
|
|
491
|
+
mustContain: ['ARCHITECTURE.md', 'OVERVIEW.md', 'USERGUIDE.md', 'INDEX.md'],
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
stage: 7,
|
|
495
|
+
arc: 'end-to-end-usage',
|
|
496
|
+
query: 'How do I start the fastest?',
|
|
497
|
+
wantPaths: ['README.md', 'docs/USAGE.md'],
|
|
498
|
+
mustContain: ['npx metaharness --wizard', '--template', '--host', 'npm install'],
|
|
499
|
+
},
|
|
500
|
+
],
|
|
501
|
+
|
|
502
|
+
// ── Bundle metadata (consumed by make-bundles.mjs in P1/P7) ───────────────
|
|
503
|
+
bundle: {
|
|
504
|
+
blurb:
|
|
505
|
+
'MetaHarness drop-in knowledge base — mint a custom AI agent harness from any repo. ' +
|
|
506
|
+
'Two halves: for-ai/ (RVF + retrieval brain + MCP server) and for-humans/ (the primer). ' +
|
|
507
|
+
'Canonical CLI `npx metaharness` (alias `create-agent-harness`).',
|
|
508
|
+
questions: [
|
|
509
|
+
'What is metaharness and what does it produce?',
|
|
510
|
+
'What can the tool do to a repo before I build?',
|
|
511
|
+
'How does the composer scaffold a harness end-to-end?',
|
|
512
|
+
'Is this production-ready and what are its honest limits?',
|
|
513
|
+
'How do I start the fastest?',
|
|
514
|
+
],
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
|
|
518
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
519
|
+
// ruvn — AI research harness: turns a question into a graded, cited dossier.
|
|
520
|
+
// Node/TypeScript single-package npm harness (@ruvnet/ruvn), generated by
|
|
521
|
+
// metaharness (vertical:research). NOT crate-based: its "components" are the
|
|
522
|
+
// six pipeline AGENTS in src/agents/ (scout → web-searcher → source-grader →
|
|
523
|
+
// synthesizer → fact-checker → citer). No .gitmodules → force-walk own tree.
|
|
524
|
+
// Facts verified against .targets/ruvn 2026-06-19 (README/CLAUDE.md/package.json
|
|
525
|
+
// /src/agents/*/bin/cli.js/scripts/openrouter-validate.mjs/.harness/manifest.json).
|
|
526
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
527
|
+
ruvn: {
|
|
528
|
+
slug: 'ruvn',
|
|
529
|
+
metaName: 'ruvn',
|
|
530
|
+
// ── Embedder (ADR-0001 v1.3.1: SINGLE 384-dim desktop variant) ────────────
|
|
531
|
+
// bge-small-en-v1.5 — a strong retrieval model (beats all-MiniLM); mean-pooled,
|
|
532
|
+
// normalized, with the BGE asymmetric query prefix. build-kb.mjs writes the
|
|
533
|
+
// canonical un-suffixed stores/ruvn/ruvn-kb.rvf + a .embed.json sidecar that
|
|
534
|
+
// ask-kb.mjs + index-primer.mjs read (so query + primer use the SAME model).
|
|
535
|
+
embed: {
|
|
536
|
+
model: 'Xenova/bge-small-en-v1.5',
|
|
537
|
+
dim: 384,
|
|
538
|
+
pooling: 'mean',
|
|
539
|
+
queryPrefix: 'Represent this sentence for searching relevant passages: ',
|
|
540
|
+
rankScale: 0.6,
|
|
541
|
+
rvfSuffix: '.rvf',
|
|
542
|
+
},
|
|
543
|
+
// Product / brand names + the agent role names (so "what is the source-grader"
|
|
544
|
+
// and "@ruvnet/ruvn" both match the product-name matcher in ask-kb).
|
|
545
|
+
productNames: [
|
|
546
|
+
'ruvn',
|
|
547
|
+
'@ruvnet/ruvn',
|
|
548
|
+
'scout',
|
|
549
|
+
'web-searcher',
|
|
550
|
+
'source-grader',
|
|
551
|
+
'synthesizer',
|
|
552
|
+
'fact-checker',
|
|
553
|
+
'citer',
|
|
554
|
+
],
|
|
555
|
+
// EXPLICIT archetype → PRIMER#<slug> map (slugify of each ## section title in
|
|
556
|
+
// ruvn-primer.md). Explicit beats 'auto' so every orientation question force-routes
|
|
557
|
+
// to the synthesized section instead of a raw README fragment.
|
|
558
|
+
primerSlugs: {
|
|
559
|
+
whatis: 'PRIMER#1-what-is-ruvn',
|
|
560
|
+
capabilities: 'PRIMER#2-what-can-ruvn-do-for-you',
|
|
561
|
+
crates: 'PRIMER#3-what-is-ruvn-made-of-the-six-agents-and-nine-hosts',
|
|
562
|
+
composer: 'PRIMER#4-how-the-pipeline-works-step-by-step',
|
|
563
|
+
maturity: 'PRIMER#5-is-it-production-ready-scope-and-honest-limits',
|
|
564
|
+
docs: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
565
|
+
adr: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
566
|
+
playbook: 'PRIMER#7-how-do-i-install-and-use-it-end-to-end',
|
|
567
|
+
// §8/§9 added for the AI-comprehension gate (extensibility + gotchas dimensions).
|
|
568
|
+
extensibility: 'PRIMER#8-how-do-i-extend-ruvn-safely-the-extension-points',
|
|
569
|
+
gotchas: 'PRIMER#9-cost-latency-and-gotchas-running-the-pipeline',
|
|
570
|
+
},
|
|
571
|
+
// extensionFiles — concept word -> the real extension-point file(s) it touches. Consumed by the
|
|
572
|
+
// AI-comprehension grader (and a useful map for any AI): "add a new agent" -> src/agents/*.ts +
|
|
573
|
+
// the validate script that discovers agents, "add a CLI command" -> bin/cli.js, "add a host" ->
|
|
574
|
+
// package.json. These files ARE indexed (in passages.jsonl); PRIMER#8 names them in prose.
|
|
575
|
+
extensionFiles: {
|
|
576
|
+
'agent': ['src/agents/scout.ts', 'src/agents/synthesizer.ts', 'scripts/openrouter-validate.mjs'],
|
|
577
|
+
'prompt': ['src/agents/scout.ts', 'src/agents/source-grader.ts'],
|
|
578
|
+
'system_prompt': ['src/agents/scout.ts', 'src/agents/synthesizer.ts'],
|
|
579
|
+
'pipeline': ['src/agents/scout.ts', 'src/agents/citer.ts', 'CLAUDE.md'],
|
|
580
|
+
'grade': ['src/agents/source-grader.ts', 'src/agents/synthesizer.ts'],
|
|
581
|
+
'grading': ['src/agents/source-grader.ts'],
|
|
582
|
+
'rubric': ['src/agents/source-grader.ts', 'CLAUDE.md'],
|
|
583
|
+
'tier': ['src/agents/web-searcher.ts', 'scripts/openrouter-validate.mjs'],
|
|
584
|
+
'model': ['scripts/openrouter-validate.mjs', 'src/agents/web-searcher.ts'],
|
|
585
|
+
'cli': ['bin/cli.js'],
|
|
586
|
+
'command': ['bin/cli.js'],
|
|
587
|
+
'subcommand': ['bin/cli.js'],
|
|
588
|
+
'host': ['package.json', 'README.md', 'install.md'],
|
|
589
|
+
'adapter': ['package.json', 'bin/cli.js'],
|
|
590
|
+
'validate': ['scripts/openrouter-validate.mjs', '__tests__/openrouter.integration.test.ts'],
|
|
591
|
+
'test': ['__tests__/smoke.test.ts', '__tests__/openrouter.integration.test.ts'],
|
|
592
|
+
},
|
|
593
|
+
// docFiles — per-dimension authoritative docs the grader injects (the AI reads these for the
|
|
594
|
+
// dimension). ruvn has no cli/README.md: the CLI is bin/cli.js + the README "Install & use"
|
|
595
|
+
// section; usage examples live in the README + the agent prompt files + the validate script.
|
|
596
|
+
docFiles: {
|
|
597
|
+
cli: ['README.md', 'bin/cli.js'],
|
|
598
|
+
usage: ['README.md', 'CLAUDE.md'],
|
|
599
|
+
},
|
|
600
|
+
// typeAliases — concept word in a question -> the public symbol whose signature answers it.
|
|
601
|
+
// ruvn's "API" is the agent prompt modules (each exports SYSTEM_PROMPT/NAME/TIER) + the CLI
|
|
602
|
+
// `run(argv)` dispatcher. The grader's usage-injector matches struct/enum names; ruvn has none,
|
|
603
|
+
// so this map mainly documents intent (the agent modules + run are surfaced by name match).
|
|
604
|
+
typeAliases: {
|
|
605
|
+
'dispatch': 'run',
|
|
606
|
+
'cli': 'run',
|
|
607
|
+
},
|
|
608
|
+
|
|
609
|
+
// ── Source scope (force-walk; NO .gitmodules in this repo → walk no-op) ──
|
|
610
|
+
repoDir: '../.targets/ruvn',
|
|
611
|
+
scopeExclude: [
|
|
612
|
+
'node_modules',
|
|
613
|
+
'dist',
|
|
614
|
+
'target',
|
|
615
|
+
'.git',
|
|
616
|
+
'coverage',
|
|
617
|
+
'pkg',
|
|
618
|
+
'.next',
|
|
619
|
+
],
|
|
620
|
+
|
|
621
|
+
// ── Extension classes ────────────────────────────────────────────────────
|
|
622
|
+
codeExt: ['.ts', '.tsx', '.js', '.mjs', '.cjs'],
|
|
623
|
+
fullTextExt: ['.md', '.mdx', '.txt'],
|
|
624
|
+
templateExt: [],
|
|
625
|
+
|
|
626
|
+
// ── Component model: the six agents live under src/agents/ ────────────────
|
|
627
|
+
// componentWord widened with 'agent' so the inventory archetype fires for
|
|
628
|
+
// "what agents make up ruvn" / "which agents are in the pipeline".
|
|
629
|
+
componentRoots: ['src/agents'],
|
|
630
|
+
componentWord: ['agent', 'host', 'crate', 'package', 'module', 'component'],
|
|
631
|
+
|
|
632
|
+
// ── Disambiguation / off-topic magnets (filled during gate-A tuning) ──────
|
|
633
|
+
// ruvn is a SMALL corpus (16 source chunks + 7 primer sections). A few one-/two-line
|
|
634
|
+
// host stub files (AGENTS.md, SYSTEM.md, install.md) and the single-prompt agent .ts
|
|
635
|
+
// files are vector-close to orientation queries and out-rank the rich PRIMER/README.
|
|
636
|
+
// These rules route each comprehension archetype to its synthesized PRIMER section (or
|
|
637
|
+
// the canonical README/CLAUDE) and demote the thin stubs. `when` matches the query;
|
|
638
|
+
// `good`/`bad` match the result PATH.
|
|
639
|
+
disambiguation: [
|
|
640
|
+
// capabilities: "what can ruvn do / give me / value / final dossier / synthesizer allowed /
|
|
641
|
+
// live-model validation" -> PRIMER#2 + README, not the maturity/scope section, the inventory
|
|
642
|
+
// section, a single agent .ts, or a host stub. (Widened during gate-A re-tune on bge-small.)
|
|
643
|
+
{ whenSource: '\\b(what can|what does ruvn do|do for me|give me|value of ruvn|value|capabilit|in the (final )?dossier|what is in the|synthesizer (allowed|use)|allowed to use|live model|end-?to-?end|validate ruvn|run ruvn end)\\b',
|
|
644
|
+
goodSource: 'PRIMER#2-what-can-ruvn-do-for-you|README\\.md',
|
|
645
|
+
badSource: 'PRIMER#5|PRIMER#3|PRIMER#7|src/agents/|AGENTS\\.md|SYSTEM\\.md', goodBoost: 0.34, badPenalty: 0.32 },
|
|
646
|
+
// pipeline / how-it-works -> PRIMER#4 + CLAUDE + README, not a single agent .ts or a host stub.
|
|
647
|
+
// Widened for held-out phrasings: "what does the scout produce first", "what does the citer
|
|
648
|
+
// add/refuse to ship", "grade A versus grade C", "how does the grader rank ... vs ...",
|
|
649
|
+
// "after installing how do I run a research pipeline", "order of operations".
|
|
650
|
+
{ whenSource: '\\b(pipeline work|step by step|order of operations|order of|each agent only|a/?b/?c/?d grading|abcd|which grades reach|grades reach the synth|fact-?check|adversarial|synthesiz|scout (produce|first)|what does the (scout|citer|grader)|citer (add|refuse)|grade a (vs|versus)|grader rank|disprove|disproven)\\b',
|
|
651
|
+
goodSource: 'PRIMER#4-how-the-pipeline-works|CLAUDE\\.md|README\\.md',
|
|
652
|
+
badSource: 'src/agents/|src/init|AGENTS\\.md|SYSTEM\\.md|install\\.md|PRIMER#7|PRIMER#1|PRIMER#6', goodBoost: 0.30, badPenalty: 0.32 },
|
|
653
|
+
// docs map -> PRIMER#6 + README, not the source-grader.ts / AGENTS.md noise.
|
|
654
|
+
{ whenSource: '\\b(where (do|can|is|are)|read more|docs|documentation|which doc|start with|read about)\\b',
|
|
655
|
+
goodSource: 'PRIMER#6-where-do-i-read-more|README\\.md',
|
|
656
|
+
badSource: 'src/agents/|AGENTS\\.md|SYSTEM\\.md|PRIMER#1|PRIMER#4|PRIMER#2', goodBoost: 0.32, badPenalty: 0.30 },
|
|
657
|
+
// "which FILE has the pipeline diagram and rubric" / "operating contract for the model" ->
|
|
658
|
+
// CLAUDE.md is the literal answer (the pipeline diagram + A/B/C/D rubric live in CLAUDE.md).
|
|
659
|
+
// Triggers ONLY on file-location phrasing ("which file has", "operating contract") so it does
|
|
660
|
+
// not collide with the pipeline-mechanics rule above; boost CLAUDE strongly over the PRIMERs.
|
|
661
|
+
{ whenSource: '\\b(which file (has|holds|contains)|operating contract|model running the harness|contract for the model|file has the pipeline)\\b',
|
|
662
|
+
goodSource: 'CLAUDE\\.md',
|
|
663
|
+
badSource: 'src/|AGENTS\\.md|SYSTEM\\.md|PRIMER#1|PRIMER#4|PRIMER#2|PRIMER#3|PRIMER#9', goodBoost: 0.45, badPenalty: 0.40 },
|
|
664
|
+
// install / end-to-end usage / validate -> PRIMER#7 + README, not install.md (a 2-line Copilot
|
|
665
|
+
// stub), not PRIMER#1, and NOT the raw scripts/openrouter-validate.mjs body (the HOW-to lives
|
|
666
|
+
// in #7/README; the script file out-ranks since it is now indexed in full). "validate ruvn
|
|
667
|
+
// against a real model / OpenRouter / npm run validate" all route here.
|
|
668
|
+
{ whenSource: '\\b(install|use it|usage|get ?started|init|doctor|one-?liner|no.?install|build (it )?before|run (a )?(the )?research|validate ruvn|validate.{0,18}(real )?model|against a real model|openrouter|npm run validate|how do i run.{0,12}(research )?pipeline|after installing.{0,20}run)\\b',
|
|
669
|
+
goodSource: 'PRIMER#7-how-do-i-install-and-use|PRIMER#4-how-the-pipeline-works|README\\.md',
|
|
670
|
+
badSource: 'install\\.md|AGENTS\\.md|SYSTEM\\.md|PRIMER#1|scripts/openrouter-validate\\.mjs', goodBoost: 0.30, badPenalty: 0.32 },
|
|
671
|
+
// inventory of agents/hosts -> PRIMER#3 + README + CLAUDE, not a single agent .ts file.
|
|
672
|
+
{ whenSource: '\\b(agents (and|are)|nine hosts|9 hosts|made of|monorepo|kernel|which agents|list the agents|each ruvn agent)\\b',
|
|
673
|
+
goodSource: 'PRIMER#3-what-is-ruvn-made-of|README\\.md|CLAUDE\\.md',
|
|
674
|
+
badSource: 'AGENTS\\.md|SYSTEM\\.md', goodBoost: 0.24, badPenalty: 0.26 },
|
|
675
|
+
// maturity / limits / "where does its intelligence come from" / "what does it depend on" /
|
|
676
|
+
// "is validation required" -> PRIMER#5 + README, not the inventory/install sections or a stub.
|
|
677
|
+
{ whenSource: '\\b(production-?ready|mature|version|limit|medical advice|node version|what is ruvn not|opt-?in|final answer|intelligence (actually )?come|come from|depend on|required to use|validation required|is the openrouter validation required|on its own or inside|run on its own)\\b',
|
|
678
|
+
goodSource: 'PRIMER#5-is-it-production-ready|README\\.md',
|
|
679
|
+
badSource: 'AGENTS\\.md|SYSTEM\\.md|src/agents/|scripts/openrouter-validate\\.mjs|PRIMER#3|PRIMER#7|PRIMER#2|PRIMER#1|PRIMER#9', goodBoost: 0.30, badPenalty: 0.30 },
|
|
680
|
+
// extensibility -> PRIMER#8 (carries the agent/prompt/tier/rubric/CLI/host extension points +
|
|
681
|
+
// the stable-contract rule). Fires on "add/extend/change/implement/where do I" + a ruvn noun,
|
|
682
|
+
// or "safely modify/change without breaking the pipeline". Allow the named source .ts/.js
|
|
683
|
+
// through (a real extension question wants the agent/cli file), so don't demote src/ here.
|
|
684
|
+
// EXTENSIBILITY needs an ACTION verb (add/change/edit/implement/extend/contribute/where-do-I-
|
|
685
|
+
// put) so it does NOT steal the architecture/inventory question "which model tier does EACH
|
|
686
|
+
// agent run on" (no action verb -> PRIMER#3 owns it) or the docs question "which FILE has the
|
|
687
|
+
// grading rubric" (-> CLAUDE/#6). Bare "model tier"/"grading rubric" are intentionally NOT here.
|
|
688
|
+
{ whenSource: '\\b((add|create|write) (a |an |my )?(new )?(agent|stage|prompt|cli|command|subcommand|host|adapter|test)|(change|edit|modify|tune|update) (the |an |its |my )?(agent|prompt|rubric|grading|model tier|tier|model)|change which (model|tier)|implement (a|the|my) (new )?(agent|stage|command|host)|new (agent|stage|command|subcommand|host)|safely (add|modify|change|extend|edit)|without breaking|extend ruvn|extensib|contribute|where (do|should) i (add|put|implement)|stable (api|contract)|extension point|add (support for )?(another|a new) host)\\b',
|
|
689
|
+
goodSource: 'PRIMER#8-how-do-i-extend-ruvn|src/agents/[a-z-]+\\.ts|bin/cli\\.js|scripts/openrouter-validate\\.mjs',
|
|
690
|
+
badSource: 'PRIMER#(1|2|5|6|7)|AGENTS\\.md|SYSTEM\\.md|install\\.md', goodBoost: 0.42, badPenalty: 0.34 },
|
|
691
|
+
// gotchas / cost / latency / "why empty/thin / why slow / does ruvn search itself" -> PRIMER#9
|
|
692
|
+
// (carries six-pass cost, sonnet/haiku tiers, no ruvn-research-command, host-owns-web-search,
|
|
693
|
+
// grade-A/B caps coverage, starting-dossier-not-verdict). Fires on cost/perf/empty phrasings.
|
|
694
|
+
// Deliberately does NOT match "grading rubric" or a bare "run a research pipeline" (those are
|
|
695
|
+
// the docs / install+pipeline questions Gate A owns); it owns cost/latency/empty-result/gotcha.
|
|
696
|
+
{ whenSource: '\\b(cost|how much|expensive|token|slow|latency|how (many|long).{0,20}(model|call|pass|run)|six (model )?passes|why is.{0,12}(it|ruvn|my run).{0,8}slow|(dossier|it|results?) (come|comes|came) back (empty|thin)|(empty|thin) (dossier|result)|dossier (be|is|come).{0,12}(empty|thin)|gotcha|footgun|pitfall|does ruvn (do|run|have).{0,14}(its own )?(web )?search|(own|bundle).{0,8}(web )?search|no (ruvn )?(research|dossier) command|is there a (research|dossier) command|prompts? not (an )?engine|engine or prompts|build step|need to build before)\\b',
|
|
697
|
+
goodSource: 'PRIMER#9-cost-latency-and-gotchas|README\\.md',
|
|
698
|
+
badSource: 'PRIMER#(1|2|3|5|6|7)|AGENTS\\.md|SYSTEM\\.md', goodBoost: 0.46, badPenalty: 0.36 },
|
|
699
|
+
],
|
|
700
|
+
// Thin host-stub files (1-2 lines) carry almost no answer substance; demote them on ANY
|
|
701
|
+
// query unless the query explicitly names that file/host config surface.
|
|
702
|
+
offtopicMagnets: [
|
|
703
|
+
{ reSource: '(^|/)AGENTS\\.md$', pen: 0.30, allowSource: '\\bAGENTS\\.md\\b|behavioral rules|defer destructive' },
|
|
704
|
+
{ reSource: '(^|/)SYSTEM\\.md$', pen: 0.30, allowSource: '\\bSYSTEM\\.md\\b|system identity' },
|
|
705
|
+
{ reSource: '(^|/)install\\.md$', pen: 0.20, allowSource: '\\binstall\\.md\\b|per-host install|copilot' },
|
|
706
|
+
// Per-host config artifacts (now indexed to enrich coverage) are tiny stubs that are vector-
|
|
707
|
+
// close to orientation/inventory queries but carry no orientation prose — demote them unless
|
|
708
|
+
// the query explicitly names that host/config surface (e.g. "what ships for Codex").
|
|
709
|
+
{ reSource: '(^|/)(cli-config\\.yaml|trust\\.json|capability-table\\.json|rvm\\.manifest\\.toml)$', pen: 0.30, allowSource: 'cli-config|trust\\.json|capability-table|rvm\\.manifest|hermes|rvm\\b' },
|
|
710
|
+
{ reSource: '(^|/)(\\.harness|optional-mcps|\\.claude|\\.claude-plugin|\\.codex|\\.vscode|\\.opencode|\\.openclaw)/', pen: 0.28, allowSource: 'manifest|mcp|codex|copilot|opencode|openclaw|plugin|\\.vscode|host config|what ships|drops? into|config for' },
|
|
711
|
+
{ reSource: '(^|/)\\.github/copilot-instructions\\.md$', pen: 0.24, allowSource: 'copilot|github|what ships|host config' },
|
|
712
|
+
],
|
|
713
|
+
|
|
714
|
+
// ── Corpus include rules ──────────────────────────────────────────────────
|
|
715
|
+
// ruvn is small: README + CLAUDE/SYSTEM/AGENTS/install (full text), the six
|
|
716
|
+
// agent prompt files + cli + init + validate script (full bodies — the agent
|
|
717
|
+
// SYSTEM_PROMPTs ARE the substance), and the per-host config manifests.
|
|
718
|
+
include: [
|
|
719
|
+
{ rule: 'mdSweepFullText', roots: ['.'] }, // README + CLAUDE/SYSTEM/AGENTS/install verbatim
|
|
720
|
+
// literalFiles guarantees the package manifest AND the two non-src/ source files
|
|
721
|
+
// (bin/cli.js, scripts/openrouter-validate.mjs) are indexed in FULL — sourceBodies only
|
|
722
|
+
// ingests files under a src/ dir (or index/main/lib/mod leads), so the CLI entry + the live-
|
|
723
|
+
// model validate script would otherwise be missed. These are core to onboarding/extensibility.
|
|
724
|
+
{ rule: 'literalFiles', files: ['README.md', 'CLAUDE.md', 'SYSTEM.md', 'AGENTS.md', 'install.md', 'package.json', 'bin/cli.js', 'scripts/openrouter-validate.mjs'] },
|
|
725
|
+
// Per-host config artifacts ruvn ships (the concrete answer to "what does ruvn drop into
|
|
726
|
+
// host X"): the harness manifest + each host's config file. Tagged source_type config/doc by
|
|
727
|
+
// path — they are NOT source files, so they enrich coverage without inflating the source set.
|
|
728
|
+
{ rule: 'literalFiles', files: [
|
|
729
|
+
'.harness/manifest.json', 'capability-table.json', 'trust.json', 'cli-config.yaml',
|
|
730
|
+
'rvm.manifest.toml', 'optional-mcps/ruvn.json',
|
|
731
|
+
'.claude/settings.json', '.claude-plugin/plugin.json', '.codex/config.toml',
|
|
732
|
+
'.vscode/mcp.json', '.github/copilot-instructions.md', '.opencode/opencode.json',
|
|
733
|
+
'.openclaw/openclaw.json',
|
|
734
|
+
] },
|
|
735
|
+
{ rule: 'sourceBodies', roots: ['src', 'bin', 'scripts'], ext: ['.ts', '.js', '.mjs'] }, // agent prompts, init
|
|
736
|
+
// tests are the BEST usage docs (real call sites: run(['doctor']), the OpenRouter agent
|
|
737
|
+
// exercise). Ingested deliberately (sourceBodies excludes tests); tagged source_type test
|
|
738
|
+
// by build-kb so the AI can ask for tests as usage and the deep-dive can pick them.
|
|
739
|
+
{ rule: 'testsAndExamples', roots: ['__tests__', 'scripts'], ext: ['.ts', '.js', '.mjs'] },
|
|
740
|
+
{ rule: 'docCommentSweep', roots: ['src', 'bin', 'scripts', '__tests__'] }, // leading doc comments across tree
|
|
741
|
+
],
|
|
742
|
+
|
|
743
|
+
// ── Verification queries: ONE per arc stage (7 total). Facts verified 2026-06-19.
|
|
744
|
+
verificationQueries: [
|
|
745
|
+
{
|
|
746
|
+
stage: 1,
|
|
747
|
+
arc: 'what-is-it',
|
|
748
|
+
query: 'What is ruvn?',
|
|
749
|
+
wantPaths: ['PRIMER#1-what-is-ruvn', 'README.md', 'CLAUDE.md'],
|
|
750
|
+
mustContain: ['graded, cited evidence dossier', 'research', 'every claim is cited'],
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
stage: 2,
|
|
754
|
+
arc: 'capabilities',
|
|
755
|
+
query: 'What can ruvn do for me?',
|
|
756
|
+
wantPaths: ['PRIMER#2-what-can-ruvn-do-for-you', 'README.md'],
|
|
757
|
+
mustContain: ['grades every source', 'adversarially fact-checks', 'bibliography'],
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
stage: 3,
|
|
761
|
+
arc: 'inventory-components',
|
|
762
|
+
query: 'What agents and hosts make up ruvn?',
|
|
763
|
+
wantPaths: ['PRIMER#3-what-is-ruvn-made-of-the-six-agents-and-nine-hosts', 'README.md', 'CLAUDE.md'],
|
|
764
|
+
mustContain: ['scout', 'web-searcher', 'source-grader', 'synthesizer', 'fact-checker', 'citer', '9 hosts'],
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
stage: 4,
|
|
768
|
+
arc: 'how-it-works-pipeline',
|
|
769
|
+
query: 'How does the ruvn pipeline work step by step?',
|
|
770
|
+
wantPaths: ['PRIMER#4-how-the-pipeline-works-step-by-step', 'CLAUDE.md', 'README.md'],
|
|
771
|
+
mustContain: ['each agent only sees', 'A/B/C/D', 'grade A and B', 'six agents in a line'],
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
stage: 5,
|
|
775
|
+
arc: 'maturity',
|
|
776
|
+
query: 'Is ruvn production-ready and what are its limits?',
|
|
777
|
+
wantPaths: ['PRIMER#5-is-it-production-ready-scope-and-honest-limits', 'README.md'],
|
|
778
|
+
mustContain: ['v0.1.1', 'research tool', 'does not give medical advice', 'starting dossier'],
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
stage: 6,
|
|
782
|
+
arc: 'docs-where-things-live',
|
|
783
|
+
query: 'Where do I read more about ruvn?',
|
|
784
|
+
wantPaths: ['PRIMER#6-where-do-i-read-more-the-docs-map', 'README.md', 'install.md'],
|
|
785
|
+
mustContain: ['README.md', 'CLAUDE.md', 'install.md'],
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
stage: 7,
|
|
789
|
+
arc: 'end-to-end-usage',
|
|
790
|
+
query: 'How do I install and use ruvn?',
|
|
791
|
+
wantPaths: ['PRIMER#7-how-do-i-install-and-use-it-end-to-end', 'README.md'],
|
|
792
|
+
mustContain: ['npm i -g @ruvnet/ruvn', 'ruvn init', 'ruvn doctor', 'validate:openrouter'],
|
|
793
|
+
},
|
|
794
|
+
],
|
|
795
|
+
|
|
796
|
+
bundle: {
|
|
797
|
+
blurb:
|
|
798
|
+
'ruvn drop-in knowledge base — an AI research harness that turns a question into a graded, ' +
|
|
799
|
+
'cited evidence dossier. Six agents in a line (scout → web-searcher → source-grader → ' +
|
|
800
|
+
'synthesizer → fact-checker → citer), A/B/C/D source grading, every claim cited. ' +
|
|
801
|
+
'Ships adapters for 9 hosts; OpenRouter-validated. Install: npm i -g @ruvnet/ruvn.',
|
|
802
|
+
questions: [
|
|
803
|
+
'What is ruvn and what does it give me back?',
|
|
804
|
+
'What does a graded, cited evidence dossier mean here?',
|
|
805
|
+
'What are the six agents and the nine hosts?',
|
|
806
|
+
'How does the grading + fact-checking pipeline work?',
|
|
807
|
+
'How do I install ruvn and validate it against a real model?',
|
|
808
|
+
],
|
|
809
|
+
},
|
|
810
|
+
},
|
|
811
|
+
|
|
812
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
813
|
+
// photonlayer — a deterministic optical-AI FRONT END in pure Rust. A learned
|
|
814
|
+
// phase mask ("smart glass") shapes incoming light so a tiny sensor captures a
|
|
815
|
+
// compressed task-useful MEASUREMENT (a few numbers) instead of a full image;
|
|
816
|
+
// a small digital decoder reads the answer; every run emits a BLAKE3 receipt.
|
|
817
|
+
// Rust workspace of 4 crates (core / bench / wasm / cli). No .gitmodules →
|
|
818
|
+
// force-walk own tree. Single 768-dim bge variant (recipe v1.3.0).
|
|
819
|
+
// Facts verified against .targets/photonlayer @ fe86c9f, 2026-06-19
|
|
820
|
+
// (README.md / crates/*/src/*.rs / crates/*/README.md / docs/README.md /
|
|
821
|
+
// examples/README.md / crates/photonlayer-core/src/lib.rs).
|
|
822
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
823
|
+
photonlayer: {
|
|
824
|
+
slug: 'photonlayer',
|
|
825
|
+
metaName: 'PhotonLayer',
|
|
826
|
+
// ── Embedder (ADR-0001 v1.3.1: SINGLE 384-dim desktop variant) ────────────
|
|
827
|
+
// bge-small-en-v1.5 (cls-pooled, normalized, asymmetric query prefix). build-kb.mjs writes the
|
|
828
|
+
// canonical un-suffixed stores/photonlayer/photonlayer-kb.rvf + a .embed.json sidecar that
|
|
829
|
+
// ask-kb + index-primer read (so query + primer use the SAME model). Gate-A tuned at
|
|
830
|
+
// rankScale 0.6 (trust bge's raw order gently). Matches the existing .embed.json sidecar.
|
|
831
|
+
// Model cached offline at kb/models-cache/Xenova/bge-small-en-v1.5 for fast builds.
|
|
832
|
+
embed: {
|
|
833
|
+
model: 'Xenova/bge-small-en-v1.5',
|
|
834
|
+
dim: 384,
|
|
835
|
+
pooling: 'cls',
|
|
836
|
+
queryPrefix: 'Represent this sentence for searching relevant passages: ',
|
|
837
|
+
rankScale: 0.6,
|
|
838
|
+
rvfSuffix: '.rvf',
|
|
839
|
+
},
|
|
840
|
+
// Brand/product names + the crate names + the core optical nouns so
|
|
841
|
+
// "what is the phase mask" / "what does photonlayer-core do" both match.
|
|
842
|
+
productNames: [
|
|
843
|
+
'PhotonLayer',
|
|
844
|
+
'photonlayer',
|
|
845
|
+
'photonlayer-core',
|
|
846
|
+
'photonlayer-bench',
|
|
847
|
+
'photonlayer-wasm',
|
|
848
|
+
'photonlayer-cli',
|
|
849
|
+
'phase mask',
|
|
850
|
+
'PhaseMask',
|
|
851
|
+
'ScalarSimulator',
|
|
852
|
+
],
|
|
853
|
+
// EXPLICIT archetype → PRIMER#<slug> map (slugify of each ## section title in
|
|
854
|
+
// photonlayer-primer.md). Explicit beats 'auto' so every orientation question
|
|
855
|
+
// force-routes to the synthesized primer section, not a raw README fragment.
|
|
856
|
+
primerSlugs: {
|
|
857
|
+
whatis: 'PRIMER#1-what-is-photonlayer',
|
|
858
|
+
capabilities: 'PRIMER#2-what-can-photonlayer-do',
|
|
859
|
+
crates: 'PRIMER#3-what-is-photonlayer-made-of-the-four-crates',
|
|
860
|
+
composer: 'PRIMER#4-how-the-optical-pipeline-works-step-by-step',
|
|
861
|
+
maturity: 'PRIMER#5-is-it-production-ready-scope-and-honest-limits',
|
|
862
|
+
docs: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
863
|
+
adr: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
864
|
+
playbook: 'PRIMER#7-how-do-i-install-and-run-it-end-to-end',
|
|
865
|
+
// §8/§9 added for the AI-comprehension gate (extensibility + gotchas dimensions).
|
|
866
|
+
extensibility: 'PRIMER#8-how-do-i-extend-photonlayer-safely-the-extension-points',
|
|
867
|
+
gotchas: 'PRIMER#9-performance-determinism-and-gotchas',
|
|
868
|
+
},
|
|
869
|
+
// extensionFiles — concept word -> the real extension-point file(s) it touches. Consumed by the
|
|
870
|
+
// AI-comprehension grader (and a useful map for any AI). Files verified present in source +
|
|
871
|
+
// indexed in passages.jsonl; PRIMER#8 names them in prose. (Facts checked against source.)
|
|
872
|
+
extensionFiles: {
|
|
873
|
+
'propagation': ['crates/photonlayer-core/src/propagate.rs', 'crates/photonlayer-core/src/config.rs'],
|
|
874
|
+
'diffraction': ['crates/photonlayer-core/src/propagate.rs', 'crates/photonlayer-core/src/config.rs'],
|
|
875
|
+
'propagation mode': ['crates/photonlayer-core/src/config.rs', 'crates/photonlayer-core/src/propagate.rs'],
|
|
876
|
+
'adjoint': ['crates/photonlayer-core/src/propagate.rs', 'crates/photonlayer-core/tests/gradient_check.rs'],
|
|
877
|
+
'mask': ['crates/photonlayer-core/src/mask.rs'],
|
|
878
|
+
'phase mask': ['crates/photonlayer-core/src/mask.rs'],
|
|
879
|
+
'detector': ['crates/photonlayer-core/src/detector.rs', 'crates/photonlayer-core/src/config.rs'],
|
|
880
|
+
'sensor': ['crates/photonlayer-core/src/detector.rs', 'crates/photonlayer-core/src/config.rs'],
|
|
881
|
+
'differential': ['crates/photonlayer-bench/src/diffdetect.rs', 'crates/photonlayer-core/src/detector.rs'],
|
|
882
|
+
'decoder': ['crates/photonlayer-bench/src/decoder.rs'],
|
|
883
|
+
'training': ['crates/photonlayer-bench/src/grad_train.rs', 'crates/photonlayer-bench/src/learn.rs'],
|
|
884
|
+
'train': ['crates/photonlayer-bench/src/grad_train.rs', 'crates/photonlayer-bench/src/learn.rs'],
|
|
885
|
+
'gradient': ['crates/photonlayer-bench/src/grad_train.rs', 'crates/photonlayer-core/src/propagate.rs'],
|
|
886
|
+
'optimizer': ['crates/photonlayer-bench/src/grad_adam.rs', 'crates/photonlayer-bench/src/grad_train.rs'],
|
|
887
|
+
'cascade': ['crates/photonlayer-bench/src/grad_cascade.rs'],
|
|
888
|
+
'multiplane': ['crates/photonlayer-bench/src/grad_cascade.rs'],
|
|
889
|
+
'cli': ['crates/photonlayer-cli/src/main.rs'],
|
|
890
|
+
'subcommand': ['crates/photonlayer-cli/src/main.rs'],
|
|
891
|
+
'command': ['crates/photonlayer-cli/src/main.rs'],
|
|
892
|
+
'wasm': ['crates/photonlayer-wasm/src/lib.rs'],
|
|
893
|
+
'binding': ['crates/photonlayer-wasm/src/lib.rs'],
|
|
894
|
+
'javascript': ['crates/photonlayer-wasm/src/lib.rs'],
|
|
895
|
+
'receipt': ['crates/photonlayer-core/src/receipt.rs'],
|
|
896
|
+
'simulator': ['crates/photonlayer-core/src/simulator.rs'],
|
|
897
|
+
'metric': ['crates/photonlayer-core/src/metrics.rs'],
|
|
898
|
+
},
|
|
899
|
+
// docFiles — per-dimension authoritative docs the grader injects. CLI usage lives in the CLI
|
|
900
|
+
// README + main.rs; runnable usage examples live in the crate READMEs + examples/.
|
|
901
|
+
docFiles: {
|
|
902
|
+
cli: ['crates/photonlayer-cli/src/main.rs', 'README.md'],
|
|
903
|
+
usage: ['crates/photonlayer-core/README.md', 'README.md'],
|
|
904
|
+
},
|
|
905
|
+
// typeAliases — concept word in a question -> the public type whose method signatures answer it.
|
|
906
|
+
// Lets "run the optical simulator" surface ScalarSimulator's simulate/trace from symbols.json.
|
|
907
|
+
// All type names verified against crates/photonlayer-core/src/*.rs.
|
|
908
|
+
typeAliases: {
|
|
909
|
+
'simulator': 'ScalarSimulator',
|
|
910
|
+
'simulation': 'ScalarSimulator',
|
|
911
|
+
'mask': 'PhaseMask',
|
|
912
|
+
'config': 'OpticalConfig',
|
|
913
|
+
'field': 'OpticalField',
|
|
914
|
+
'image': 'InputImage',
|
|
915
|
+
'frame': 'OpticalFrame',
|
|
916
|
+
'propagator': 'Propagator',
|
|
917
|
+
'propagation': 'PropagationMode',
|
|
918
|
+
'complex': 'Complex',
|
|
919
|
+
'detector': 'DetectorConfig',
|
|
920
|
+
'receipt': 'ExperimentReceipt',
|
|
921
|
+
},
|
|
922
|
+
|
|
923
|
+
// ── Source scope (force-walk; NO .gitmodules in this repo → walk own tree) ──
|
|
924
|
+
repoDir: '../.targets/photonlayer',
|
|
925
|
+
scopeExclude: [
|
|
926
|
+
'node_modules',
|
|
927
|
+
'target',
|
|
928
|
+
'dist',
|
|
929
|
+
'build',
|
|
930
|
+
'.git',
|
|
931
|
+
'pkg', // docs/pkg = committed wasm-bindgen output (generated, not authored)
|
|
932
|
+
'.next',
|
|
933
|
+
'coverage',
|
|
934
|
+
'data', // crates/photonlayer-bench/data (MNIST cache, not authored)
|
|
935
|
+
],
|
|
936
|
+
|
|
937
|
+
// ── Extension classes ────────────────────────────────────────────────────
|
|
938
|
+
codeExt: ['.rs'],
|
|
939
|
+
fullTextExt: ['.md', '.mdx', '.txt'],
|
|
940
|
+
templateExt: [],
|
|
941
|
+
|
|
942
|
+
// ── Component model: the four crates live under crates/ ────────────────────
|
|
943
|
+
componentRoots: ['crates'],
|
|
944
|
+
componentWord: ['crate', 'module', 'component', 'package'],
|
|
945
|
+
|
|
946
|
+
// ── Disambiguation / off-topic magnets (gate-A tuned + AI-comprehension §8/§9) ──
|
|
947
|
+
// photonlayer's Rust source is heavily doc-commented and vector-close to orientation queries,
|
|
948
|
+
// so raw .rs files out-rank the synthesized PRIMER sections for architecture/extensibility/
|
|
949
|
+
// gotchas archetypes. These rules route each comprehension archetype to its PRIMER section +
|
|
950
|
+
// canonical README. `whenSource` matches the QUERY; `good/bad` match the result PATH.
|
|
951
|
+
disambiguation: [
|
|
952
|
+
// what-is-it / orientation -> PRIMER#1. Guard: don't fire on extensibility/gotchas/pipeline-output
|
|
953
|
+
// phrasings ("what does it OUTPUT/produce/measurement" is §2/§4, not §1). Catches the held-out
|
|
954
|
+
// "why is PhotonLayer described as a front end", "in one line what does it turn light into" which
|
|
955
|
+
// are vector-close to the §8 extension section ("front end" boundary talk).
|
|
956
|
+
{ whenSource: '^(?!.*\\b(extend|add a|implement|new (propagation|mask|detector|decoder)|gotcha|memory|determinis|output|produce|measurement|cascade|accuracy|receipt)\\b).*\\b(what is photonlayer|why is photonlayer|why.{0,20}front ?end|described as a (front ?end|optical)|turn light into|in one line|smart glass|what does it capture|how is.{0,20}different from a (normal )?camera|what does a (learned )?phase mask do)\\b',
|
|
957
|
+
goodSource: 'PRIMER#1-what-is-photonlayer|(^|/)README\\.md$',
|
|
958
|
+
badSource: 'PRIMER#(3|5|6|7|8|9)|\\.rs$|Cargo\\.toml$', goodBoost: 0.50, badPenalty: 0.42 },
|
|
959
|
+
// architecture / inventory: "which crate owns/holds X", "what does each module do", "how do the
|
|
960
|
+
// crates depend", "what types does the prelude export" -> PRIMER#3 (the four-crate list +
|
|
961
|
+
// per-module breakdown + the prelude export list). Demote raw .rs / Cargo.toml AND the §8
|
|
962
|
+
// extension section (which also names the prelude types but for a different purpose).
|
|
963
|
+
{ whenSource: '\\b(which crate|what crate|crates? (make up|holds?|has|is|owns?)|made of|four crates|how (do|are) the crates|depend on each other|owns? the (optical )?simulator|each (module|crate) (do|does)|foundation crate|architecture|components|blast.?radius|affected if i change|what does (each )?(module|core) do|module breakdown|command.?line driver|prelude export|types? does the (core )?prelude|core prelude (export|re-?export)|what (types|modules) (does|are)|module(s)? in core)\\b',
|
|
964
|
+
goodSource: 'PRIMER#3-what-is-photonlayer-made-of|(^|/)README\\.md$|crates/photonlayer-core/src/lib\\.rs',
|
|
965
|
+
badSource: 'Cargo\\.toml$|crates/[^/]+/src/(?!lib)[a-z_]+\\.rs$|PRIMER#(1|2|4|5|6|7|8|9)', goodBoost: 0.56, badPenalty: 0.44 },
|
|
966
|
+
// extensibility -> PRIMER#8 (propagation/mask/detector/decoder/training/cascade/cli/wasm/
|
|
967
|
+
// receipt extension points). Trigger ONLY on real ADD/EXTEND/IMPLEMENT intent (NOT bare
|
|
968
|
+
// "prelude"/"stable api"/"types export", which are inventory phrasings handled by §3 above).
|
|
969
|
+
// Guard: don't fire on plain "what is / why is" orientation.
|
|
970
|
+
{ whenSource: '^(?!.*\\b(what is photonlayer|why is photonlayer|front ?end|what types|prelude export)\\b).*\\b(extend|extensib|add (a |an |my )?(new )?(propagation|diffraction|mode|mask|detector|sensor|decoder|training|trainer|optimizer|cascade|plane|command|subcommand|binding|metric|stage)|implement (a|the|my)|new (propagation|mask|detector|decoder|cli|wasm|subcommand|mode)|safely (add|modify|change|extend)|without breaking|contribute|where (do|should) i (add|put|implement)|trait (do|to) i implement|extension point|hook in|plug ?in a|adjoint (must|match|contract))\\b',
|
|
971
|
+
goodSource: 'PRIMER#8-how-do-i-extend-photonlayer|crates/photonlayer-core/src/(propagate|mask|detector|simulator|config|receipt)\\.rs|crates/photonlayer-bench/src/(grad_train|grad_cascade|decoder|learn|grad_adam)\\.rs|crates/photonlayer-cli/src/main\\.rs|crates/photonlayer-wasm/src/lib\\.rs',
|
|
972
|
+
badSource: 'PRIMER#(1|2|3|5|6|7|9)|Cargo\\.toml$', goodBoost: 0.56, badPenalty: 0.40 },
|
|
973
|
+
// gotchas / performance / memory / determinism -> PRIMER#9 (power-of-two FFT, MAX_GRID_DIM,
|
|
974
|
+
// 2^? memory scaling, libm cross-platform determinism caveat, training ceilings/init-sensitivity,
|
|
975
|
+
// error types). Fires on memory/performance/determinism/limit phrasings (NOT the maturity
|
|
976
|
+
// "is it production-ready", which §5 owns).
|
|
977
|
+
{ whenSource: '\\b(gotcha|footgun|pitfall|performance|how (fast|slow)|too slow|speed ?up|memory (limit|budget|usage|scal|grow)|out of memory|oom|grid size|power of two|power-?of-?2|fft cost|determinis|bit.?identical|reproducib|cross.?platform|libm|transcendental|why is.{0,12}slow|run a (large|big)|max grid|4096|seed(ed)? rng|noise(-free)?|training (ceiling|plateau|gotcha)|init.?sensit|hill.?climb plateau|adjoint (correct|valid|check))\\b',
|
|
978
|
+
goodSource: 'PRIMER#9-performance-determinism-and-gotchas|crates/photonlayer-core/src/(propagate|fft|config|complex|error|rng)\\.rs|crates/photonlayer-core/README\\.md',
|
|
979
|
+
badSource: 'PRIMER#(1|2|3|6|7)|Cargo\\.toml$', goodBoost: 0.50, badPenalty: 0.38 },
|
|
980
|
+
],
|
|
981
|
+
// Raw Rust source bodies + manifests are dense and vector-close to orientation queries but carry
|
|
982
|
+
// implementation detail, not plain orientation facts. Demote on ANY query UNLESS the query
|
|
983
|
+
// explicitly names that file/symbol surface (allowSource).
|
|
984
|
+
offtopicMagnets: [
|
|
985
|
+
{ reSource: '\\.rs$', pen: 0.20, allowSource: '\\.rs\\b|source code|implementation|struct |impl |fn |trait |how is .* implemented|show me the code|extend|add a new|propagat|mask|detector|decoder|gradient|cascade|adjoint|wasm|receipt' },
|
|
986
|
+
{ reSource: '(^|/)Cargo\\.toml$', pen: 0.26, allowSource: 'Cargo\\.toml|dependencies|manifest|crate version|workspace' },
|
|
987
|
+
],
|
|
988
|
+
|
|
989
|
+
// ── Corpus include rules ──────────────────────────────────────────────────
|
|
990
|
+
// photonlayer is small + heavily doc-commented: README + crate READMEs + docs
|
|
991
|
+
// (full text), each crate's Cargo manifest, the full Rust source bodies of every
|
|
992
|
+
// crate (the //! module docs + impls ARE the substance), doc-comments across the
|
|
993
|
+
// tree, and the example + test sources (the best usage docs — real call sites).
|
|
994
|
+
include: [
|
|
995
|
+
{ rule: 'mdSweepFullText', roots: ['.', 'docs', 'examples'] }, // README + crate READMEs + docs verbatim
|
|
996
|
+
{ rule: 'literalFiles', files: ['README.md', 'docs/README.md', 'examples/README.md', 'crates/photonlayer-core/README.md'] },
|
|
997
|
+
{ rule: 'componentManifests', roots: ['crates'] }, // Cargo.toml per crate
|
|
998
|
+
{ rule: 'componentLead', roots: ['crates'] }, // each crate README / lib.rs lead doc
|
|
999
|
+
{ rule: 'sourceBodies', roots: ['crates'], ext: ['.rs'] }, // full Rust bodies (src/)
|
|
1000
|
+
// tests + examples are the BEST usage docs (real call sites + expected results). Ingested
|
|
1001
|
+
// deliberately (sourceBodies excludes them); tagged source_type test|example by build-kb.
|
|
1002
|
+
{ rule: 'testsAndExamples', roots: ['crates'], ext: ['.rs'] },
|
|
1003
|
+
{ rule: 'docCommentSweep', roots: ['crates'] }, // leading doc comments across tree
|
|
1004
|
+
],
|
|
1005
|
+
|
|
1006
|
+
// ── Verification queries: ONE per arc stage (7 total). Facts verified 2026-06-19.
|
|
1007
|
+
verificationQueries: [
|
|
1008
|
+
{
|
|
1009
|
+
stage: 1,
|
|
1010
|
+
arc: 'what-is-it',
|
|
1011
|
+
query: 'What is PhotonLayer?',
|
|
1012
|
+
wantPaths: ['PRIMER#1-what-is-photonlayer', 'README.md', 'crates/photonlayer-core/src/lib.rs'],
|
|
1013
|
+
mustContain: ['phase mask', 'sensor', 'deterministic'],
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
stage: 2,
|
|
1017
|
+
arc: 'capabilities',
|
|
1018
|
+
query: 'What can PhotonLayer do?',
|
|
1019
|
+
wantPaths: ['PRIMER#2-what-can-photonlayer-do', 'README.md'],
|
|
1020
|
+
mustContain: ['compress', 'sensor pixels', 'receipt'],
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
stage: 3,
|
|
1024
|
+
arc: 'inventory-components',
|
|
1025
|
+
query: 'What crates make up PhotonLayer?',
|
|
1026
|
+
wantPaths: ['PRIMER#3-what-is-photonlayer-made-of-the-four-crates', 'README.md'],
|
|
1027
|
+
mustContain: ['photonlayer-core', 'photonlayer-bench', 'photonlayer-wasm', 'photonlayer-cli'],
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
stage: 4,
|
|
1031
|
+
arc: 'how-it-works-pipeline',
|
|
1032
|
+
query: 'How does the optical pipeline work step by step?',
|
|
1033
|
+
wantPaths: ['PRIMER#4-how-the-optical-pipeline-works-step-by-step', 'crates/photonlayer-core/src/lib.rs', 'README.md'],
|
|
1034
|
+
mustContain: ['phase mask', 'propagat', 'sensor', 'decoder'],
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
stage: 5,
|
|
1038
|
+
arc: 'maturity',
|
|
1039
|
+
query: 'Is PhotonLayer production-ready and what are its limits?',
|
|
1040
|
+
wantPaths: ['PRIMER#5-is-it-production-ready-scope-and-honest-limits', 'README.md'],
|
|
1041
|
+
mustContain: ['simulator', 'No privacy', 'single', 'not'],
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
stage: 6,
|
|
1045
|
+
arc: 'docs-where-things-live',
|
|
1046
|
+
query: 'Where do I read more about PhotonLayer?',
|
|
1047
|
+
wantPaths: ['PRIMER#6-where-do-i-read-more-the-docs-map', 'README.md', 'examples/README.md'],
|
|
1048
|
+
mustContain: ['README', 'examples', 'crates'],
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
stage: 7,
|
|
1052
|
+
arc: 'end-to-end-usage',
|
|
1053
|
+
query: 'How do I install and run PhotonLayer?',
|
|
1054
|
+
wantPaths: ['PRIMER#7-how-do-i-install-and-run-it-end-to-end', 'README.md'],
|
|
1055
|
+
mustContain: ['cargo add photonlayer-core', 'cargo run', 'hello_optics'],
|
|
1056
|
+
},
|
|
1057
|
+
],
|
|
1058
|
+
|
|
1059
|
+
bundle: {
|
|
1060
|
+
blurb:
|
|
1061
|
+
'PhotonLayer drop-in knowledge base — a deterministic optical-AI front end in pure Rust. ' +
|
|
1062
|
+
'A learned phase mask shapes incoming light so a tiny sensor captures a compressed, ' +
|
|
1063
|
+
'task-useful measurement (a few numbers) instead of a full image; a small decoder reads ' +
|
|
1064
|
+
'the answer; every run emits a BLAKE3 receipt. Four crates (core / bench / wasm / cli). ' +
|
|
1065
|
+
'Live demo runs in-browser via WASM. Today a Rust simulator; hardware is on the roadmap.',
|
|
1066
|
+
questions: [
|
|
1067
|
+
'What is PhotonLayer and what does it actually capture?',
|
|
1068
|
+
'What does a learned phase mask do, and how is it different from a normal camera + model?',
|
|
1069
|
+
'What are the four crates and what does each one do?',
|
|
1070
|
+
'How does the optical pipeline work end to end (image → mask → sensor → decoder → receipt)?',
|
|
1071
|
+
'How do I install photonlayer-core and run the first example?',
|
|
1072
|
+
],
|
|
1073
|
+
},
|
|
1074
|
+
},
|
|
1075
|
+
|
|
1076
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1077
|
+
// ruqu — quantum computing simulator in pure Rust + WebAssembly. A state-vector
|
|
1078
|
+
// quantum CIRCUIT simulator (SIMD + noise models + multi-threading), production
|
|
1079
|
+
// quantum ALGORITHMS (VQE, Grover, QAOA, surface-code QEC), a real-time COHERENCE
|
|
1080
|
+
// engine, and WASM bindings that run ~25-qubit circuits in the browser. Crate-based:
|
|
1081
|
+
// its "components" are the five crates under crates/ (ruqu-core, ruqu-algorithms,
|
|
1082
|
+
// ruqu-exotic, ruqu-wasm, ruQu coherence engine) plus the npx CLI (cli/).
|
|
1083
|
+
// Single 768-dim bge variant (recipe v1.3.0). Facts verified against
|
|
1084
|
+
// .targets/ruqu @026d63ef 2026-06-19 (README + each crate README + lib.rs
|
|
1085
|
+
// doc-comments + cli/README + cli/package.json).
|
|
1086
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
1087
|
+
ruqu: {
|
|
1088
|
+
slug: 'ruqu',
|
|
1089
|
+
metaName: 'ruqu',
|
|
1090
|
+
// ── Embedder (ADR-0001 v1.3.1: SINGLE 384-dim desktop variant) ────────────
|
|
1091
|
+
// bge-small-en-v1.5 (cls-pooled, normalized, asymmetric query prefix). build-kb.mjs writes the
|
|
1092
|
+
// canonical un-suffixed stores/ruqu/ruqu-kb.rvf + a .embed.json sidecar that ask-kb +
|
|
1093
|
+
// index-primer read (so query + primer use the SAME model). The 1035-chunk ruqu corpus cleared
|
|
1094
|
+
// Gate A at 384 — no step-up to 768 needed (memory: embedding-final-768-plus-chunking).
|
|
1095
|
+
embed: {
|
|
1096
|
+
model: 'Xenova/bge-small-en-v1.5',
|
|
1097
|
+
dim: 384,
|
|
1098
|
+
pooling: 'cls',
|
|
1099
|
+
queryPrefix: 'Represent this sentence for searching relevant passages: ',
|
|
1100
|
+
rankScale: 1,
|
|
1101
|
+
rvfSuffix: '.rvf',
|
|
1102
|
+
},
|
|
1103
|
+
productNames: [
|
|
1104
|
+
'ruqu',
|
|
1105
|
+
'ruqu-core',
|
|
1106
|
+
'ruqu-algorithms',
|
|
1107
|
+
'ruqu-exotic',
|
|
1108
|
+
'ruqu-wasm',
|
|
1109
|
+
'ruQu',
|
|
1110
|
+
'@ruvector/ruqu',
|
|
1111
|
+
'@ruvector/ruqu-wasm',
|
|
1112
|
+
],
|
|
1113
|
+
primerSlugs: {
|
|
1114
|
+
whatis: 'PRIMER#1-what-is-ruqu',
|
|
1115
|
+
capabilities: 'PRIMER#2-what-can-ruqu-do-for-you',
|
|
1116
|
+
crates: 'PRIMER#3-what-is-ruqu-made-of-the-five-crates',
|
|
1117
|
+
composer: 'PRIMER#4-how-a-circuit-runs-the-simulation-pipeline',
|
|
1118
|
+
maturity: 'PRIMER#5-is-it-production-ready-scope-and-honest-limits',
|
|
1119
|
+
docs: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
1120
|
+
adr: 'PRIMER#6-where-do-i-read-more-the-docs-map',
|
|
1121
|
+
playbook: 'PRIMER#7-how-do-i-install-and-run-it-end-to-end',
|
|
1122
|
+
// §8/§9 added for the AI-comprehension gate (extensibility + gotchas dimensions).
|
|
1123
|
+
extensibility: 'PRIMER#8-how-do-i-extend-ruqu-safely-the-extension-points',
|
|
1124
|
+
gotchas: 'PRIMER#9-performance-memory-and-gotchas-running-large-circuits',
|
|
1125
|
+
},
|
|
1126
|
+
// extensionFiles — concept word -> the real extension-point file(s) it touches. Consumed by the
|
|
1127
|
+
// AI-comprehension grader (and a useful map for any AI): "add a CLI subcommand" -> cli/bin/cli.js,
|
|
1128
|
+
// etc. These files ARE indexed (in passages.jsonl); PRIMER#8 names them in prose.
|
|
1129
|
+
extensionFiles: {
|
|
1130
|
+
'gate': ['crates/ruqu-core/src/gate.rs', 'crates/ruqu-core/src/clifford_t.rs'],
|
|
1131
|
+
'backend': ['crates/ruqu-core/src/backend.rs', 'crates/ruqu-core/src/simulator.rs'],
|
|
1132
|
+
'decoder': ['crates/ruqu-core/src/decoder.rs'],
|
|
1133
|
+
'provider': ['crates/ruqu-core/src/hardware.rs'],
|
|
1134
|
+
'hardware': ['crates/ruqu-core/src/hardware.rs'],
|
|
1135
|
+
'algorithm': ['crates/ruqu-algorithms/src/lib.rs', 'crates/ruqu-algorithms/src/grover.rs'],
|
|
1136
|
+
'cli': ['cli/bin/cli.js'],
|
|
1137
|
+
'subcommand': ['cli/bin/cli.js'],
|
|
1138
|
+
'command': ['cli/bin/cli.js'],
|
|
1139
|
+
'wasm': ['crates/ruqu-wasm/src/lib.rs'],
|
|
1140
|
+
'binding': ['crates/ruqu-wasm/src/lib.rs'],
|
|
1141
|
+
'javascript': ['crates/ruqu-wasm/src/lib.rs'],
|
|
1142
|
+
'coherence': ['crates/ruQu/src/lib.rs'],
|
|
1143
|
+
},
|
|
1144
|
+
// docFiles — per-dimension authoritative docs the grader injects (the AI reads these for the
|
|
1145
|
+
// dimension). CLI per-command table lives in cli/README.md; usage gate examples in the crate READMEs.
|
|
1146
|
+
docFiles: {
|
|
1147
|
+
cli: ['cli/README.md', 'cli/bin/cli.js'],
|
|
1148
|
+
usage: ['crates/ruqu-core/README.md', 'crates/ruqu-algorithms/README.md'],
|
|
1149
|
+
},
|
|
1150
|
+
// typeAliases — concept word in a question -> the public type whose method signatures answer it.
|
|
1151
|
+
// Lets "build and run a circuit" surface QuantumCircuit's gate methods (h/cnot/…) from symbols.json.
|
|
1152
|
+
typeAliases: {
|
|
1153
|
+
'circuit': 'QuantumCircuit',
|
|
1154
|
+
'simulator': 'Simulator',
|
|
1155
|
+
'simulation': 'Simulator',
|
|
1156
|
+
'grover': 'GroverConfig',
|
|
1157
|
+
'backend': 'BackendType',
|
|
1158
|
+
'analyze': 'CircuitAnalysis',
|
|
1159
|
+
},
|
|
1160
|
+
|
|
1161
|
+
repoDir: '../.targets/ruqu',
|
|
1162
|
+
scopeExclude: [
|
|
1163
|
+
'node_modules',
|
|
1164
|
+
'target',
|
|
1165
|
+
'dist',
|
|
1166
|
+
'build',
|
|
1167
|
+
'.git',
|
|
1168
|
+
'pkg',
|
|
1169
|
+
'coverage',
|
|
1170
|
+
'.next',
|
|
1171
|
+
],
|
|
1172
|
+
|
|
1173
|
+
codeExt: ['.rs', '.ts', '.tsx', '.js', '.mjs', '.cjs'],
|
|
1174
|
+
fullTextExt: ['.md', '.mdx', '.txt'],
|
|
1175
|
+
templateExt: [],
|
|
1176
|
+
|
|
1177
|
+
// Five crates live under crates/ (+ the npx CLI in cli/). componentWord widened
|
|
1178
|
+
// with 'engine' so "the coherence engine" matches the product/inventory matchers.
|
|
1179
|
+
componentRoots: ['crates'],
|
|
1180
|
+
componentWord: ['crate', 'engine', 'package', 'module', 'component'],
|
|
1181
|
+
|
|
1182
|
+
// ── Disambiguation (gate-A tuning, 384 bge-small) ─────────────────────────
|
|
1183
|
+
// ruqu is a DENSE corpus (1035 chunks): every crate's full Rust source + ADRs + DDDs
|
|
1184
|
+
// are indexed, and many low-level files (noise.rs, backend.rs, simulator.rs, Cargo.toml,
|
|
1185
|
+
// ADR/DDD design docs) are vector-close to orientation queries but DON'T carry the plain
|
|
1186
|
+
// orientation facts the arc needs — they out-rank the synthesized PRIMER/README. Each rule
|
|
1187
|
+
// routes a comprehension archetype to its PRIMER section + canonical README, and demotes raw
|
|
1188
|
+
// source / design-doc magnets. `whenSource` matches the QUERY; `good/bad` match the result PATH.
|
|
1189
|
+
disambiguation: [
|
|
1190
|
+
// what-is-it: orientation -> PRIMER#1 + top-level README, never a single .rs / Cargo.toml.
|
|
1191
|
+
// Guard: don't fire on inventory phrasings ("...backends", "besides", "which crate") even when
|
|
1192
|
+
// they contain "state-vector" — those belong to the inventory rule (PRIMER#3).
|
|
1193
|
+
{ whenSource: '^(?!.*\\bbackends?\\b)(?!.*\\bbesides\\b)(?!.*\\bwhich crate\\b)(?!.*\\b(vqe|grover|qaoa|surface.?code|algorithm)\\b).*\\b(what is ruqu|what does ruqu (do|actually)|state-?vector|run.{0,12}quantum|pretend quantum|no quantum hardware|without (owning|a quantum)|own(ing)? a quantum|need (a server|an account)|no server|exact instead|why are ruqu|answers exact|in (a|the) browser|in one line|what hardware|pure rust|wasm|webassembly)\\b',
|
|
1194
|
+
goodSource: 'PRIMER#1-what-is-ruqu|crates/ruqu-wasm/README\\.md|(^|/)README\\.md$',
|
|
1195
|
+
badSource: '\\.rs$|Cargo\\.toml$|(^|/)docs/(adr|ddd)/|SIMULATION-INTEGRATION|crates/(ruqu-core|ruqu-algorithms|ruqu-exotic|ruQu)/(README|readme)\\.md|PRIMER#(2|3|4|5)', goodBoost: 0.56, badPenalty: 0.46 },
|
|
1196
|
+
// capabilities / algorithms -> PRIMER#2 (carries VQE/Grover/QAOA/surface-code/distance-3/
|
|
1197
|
+
// OpenQASM/molecular-Hamiltonians/gate-set facts). Demote raw source AND cross-section PRIMER#1
|
|
1198
|
+
// + crate/top READMEs (which lack the synthesized set) so PRIMER#2 wins every capability query.
|
|
1199
|
+
{ whenSource: '\\b(what can ruqu|capabilit|algorithm|vqe|grover|qaoa|surface.?code|error correction|chemistry|optimi|gate set|openqasm|noise model|depolariz|syndrome|distance.?3|molecular|hamiltonian|ground.?state|come built in|built[- ]in|speedup|quadratic|unstructured search|what does (qaoa|grover|vqe).{0,8}(solve|give|do)|what (are|is) (vqe|grover|qaoa)|maxcut|export.{0,12}(circuit|format|qasm)|standard format|ruqu-exotic (used|for)|what does ruqu do for)\\b',
|
|
1200
|
+
goodSource: 'PRIMER#2-what-can-ruqu-do-for-you',
|
|
1201
|
+
badSource: '\\.rs$|Cargo\\.toml$|/docs/|SECURITY-REVIEW|RESEARCH_DISCOVERIES|PRIMER#(1|3|4|5|6|7)', goodBoost: 0.78, badPenalty: 0.58 },
|
|
1202
|
+
// inventory of crates -> PRIMER#3 (carries the five-crate list + 'five simulation backends').
|
|
1203
|
+
// Demote raw source, ADR/DDD AND cross-section PRIMER#4 so PRIMER#3 leads inventory questions.
|
|
1204
|
+
{ whenSource: '^(?!.*\\b(what|which) version\\b)(?!.*\\bwhat license\\b).*\\b(crates|made of|five crates|what.{0,12}(make|made) up|inventory|components|ruqu-core|ruqu-algorithms|ruqu-exotic|ruqu-wasm|coherence engine|coherence (engine )?(do|work)|dynamic min.?cut|min.?cut|(five|simulation|other).{0,14}backends?|backends? (exist|are|in ruqu)|list the crates|which crate (holds|has|is)|simulator engine|besides.{0,20}state-?vector)\\b',
|
|
1205
|
+
goodSource: 'PRIMER#3-what-is-ruqu-made-of',
|
|
1206
|
+
badSource: '\\.rs$|Cargo\\.toml$|/docs/|SECURITY-REVIEW|RESEARCH_DISCOVERIES|crates/ruQu/(README|readme)\\.md|PRIMER#(1|2|4|5|6|7)', goodBoost: 0.70, badPenalty: 0.50 },
|
|
1207
|
+
// how-a-circuit-runs / pipeline -> PRIMER#4 (carries QuantumCircuit→Simulator→backend→measureAll
|
|
1208
|
+
// run-flow + cost-model planner + SIMD + noise+correct flow + the in-browser run). Demote
|
|
1209
|
+
// cross-section PRIMER#1/#7 so the pipeline section leads every how-it-works question.
|
|
1210
|
+
// NOTE: "backend(s)" alone is ambiguous (inventory's "five simulation backends" vs pipeline's
|
|
1211
|
+
// "which backend"), so don't demote PRIMER#3 here — let the inventory rule own backend-listing
|
|
1212
|
+
// questions. Pipeline owns the run-flow / speed / planner / noise questions.
|
|
1213
|
+
{ whenSource: '\\b(how.{0,14}(circuit|run|work)|run a circuit|pipeline|planner|cost.?model|which backend|pick.{0,10}backend|choose.{0,10}backend|statevector|state vector|auto.?select|noise|stabilizer|tensor|simd|multi.?thread|gate application|makes? .{0,16}fast|speed ?up|faster)\\b',
|
|
1214
|
+
goodSource: 'PRIMER#4-how-a-circuit-runs|crates/ruqu-core/README\\.md|crates/ruqu-wasm/README\\.md',
|
|
1215
|
+
badSource: '\\.rs$|Cargo\\.toml$|(^|/)docs/(adr|ddd)/|SIMULATION-INTEGRATION|PRIMER#(1|7)', goodBoost: 0.50, badPenalty: 0.42 },
|
|
1216
|
+
// maturity / limits -> PRIMER#5 (carries 'classical simulator', 'no quantum hardware', MIT,
|
|
1217
|
+
// qubit ceilings, exotic=experimental). Demote raw source, ADR/DDD, crate readmes AND the
|
|
1218
|
+
// cross-section PRIMER#2 so PRIMER#5 wins every maturity / 'real quantum computer?' question.
|
|
1219
|
+
{ whenSource: '\\b(production-?ready|mature|maturity|limit|classical simulator|honest limit|honest|roadmap|how mature|is it (ready|production)|real quantum (computer|hardware|machine)|connect to a real|how many qubits|32 qubits|25 qubits|ruqu-exotic|experimental|quantum-?inspired|what version|which version|what license|licens(e|ed)|mit\\b|crates and the cli)\\b',
|
|
1220
|
+
goodSource: 'PRIMER#5-is-it-production-ready',
|
|
1221
|
+
badSource: '\\.rs$|Cargo\\.toml$|(^|/)docs/(adr|ddd)/|crates/[^/]+/(README|readme)\\.md|(^|/)README\\.md$|cli/README\\.md|PRIMER#(2|3)', goodBoost: 0.66, badPenalty: 0.48 },
|
|
1222
|
+
// docs map -> PRIMER#6 + README.
|
|
1223
|
+
{ whenSource: '\\b(where (do|can|is|are)|read more|docs|documentation|which (file|doc)|docs map|learn more)\\b',
|
|
1224
|
+
goodSource: 'PRIMER#6-where-do-i-read-more|(^|/)README\\.md$',
|
|
1225
|
+
badSource: '\\.rs$|Cargo\\.toml$', goodBoost: 0.30, badPenalty: 0.26 },
|
|
1226
|
+
// install / end-to-end usage -> PRIMER#7 + README + cli README, not a source file. NOTE:
|
|
1227
|
+
// "how do I run a circuit" is a how-it-works question (handled by the pipeline rule), so the
|
|
1228
|
+
// install trigger is install-CONTEXTUAL (install/get-started/cargo/npx/wasm-pack/terminal),
|
|
1229
|
+
// NOT a bare "how do I run" — otherwise it steals the pipeline's browser/circuit-run questions.
|
|
1230
|
+
{ whenSource: '\\b(install|usage|get ?started|cargo add|npx|wasm-pack|how do i (start|install|build the (web)?assembly|build the wasm)|from (my|the) terminal|no.?install|end.?to.?end|quickstart|first command|fastest way|fastest to see|see ruqu run|what do i add to cargo|add to cargo|build the (web)?assembly bundle)\\b',
|
|
1231
|
+
goodSource: 'PRIMER#7-how-do-i-install-and-run|(^|/)README\\.md$|cli/README\\.md',
|
|
1232
|
+
badSource: '\\.rs$|Cargo\\.toml$|(^|/)docs/(adr|ddd)/|PRIMER#4', goodBoost: 0.32, badPenalty: 0.30 },
|
|
1233
|
+
// extensibility -> PRIMER#8 (carries the gate/backend/algorithm/decoder/CLI/wasm extension
|
|
1234
|
+
// points + the stable-API rule). Fires on "add/extend/implement/contribute/where do I" + a
|
|
1235
|
+
// ruqu noun, or "safely modify/change without breaking". Demote cross-section PRIMERs so the
|
|
1236
|
+
// extension section leads. Allow .rs through (an extension question legitimately wants the
|
|
1237
|
+
// trait/struct source) — so DON'T demote .rs here; the magnets already gate raw source.
|
|
1238
|
+
{ whenSource: '\\b(extend|extensib|add (a |an |my )?(new )?(gate|backend|algorithm|decoder|provider|command|subcommand|binding|feature)|implement (a|the|my)|new (gate|backend|algorithm|decoder|cli|wasm|subcommand)|safely (add|modify|change|extend)|without breaking|contribute|where (do|should) i (add|put|implement)|trait (do|to) i implement|stable api|extension point|hook in|plug ?in a)\\b',
|
|
1239
|
+
goodSource: 'PRIMER#8-how-do-i-extend-ruqu|crates/ruqu-core/src/(gate|backend|decoder|hardware)\\.rs|crates/ruqu-algorithms/src/|crates/ruqu-wasm/src/lib\\.rs|cli/bin/cli\\.js',
|
|
1240
|
+
badSource: 'PRIMER#(1|2|5|6|7)|Cargo\\.toml$|(^|/)docs/(adr|ddd)/', goodBoost: 0.58, badPenalty: 0.40 },
|
|
1241
|
+
// gotchas / performance / memory limits -> PRIMER#9 (carries 2^n memory, qubit ceilings, OOM,
|
|
1242
|
+
// stabilizer escape hatch, TILE_MEMORY_BUDGET, SIMD speed, exotic caution). Fires on memory/
|
|
1243
|
+
// performance/limit phrasings (NOT the maturity "is it production-ready", which §5 owns).
|
|
1244
|
+
{ whenSource: '\\b(out of memory|run out of memory|oom|memory (limit|budget|usage|grow)|how (much|many).{0,18}(memory|qubits before)|large circuit|why is.{0,12}(it|my run|ruqu) slow|performance|speed (up|tip)|too slow|tile memory|tilememoryexceeded|syndrome buffer|2\\^n|exponential memory|gotcha|footgun|pitfall|run a (large|big) circuit|memory per qubit|simd|multi.?thread|stabilizer (backend|for))\\b',
|
|
1245
|
+
goodSource: 'PRIMER#9-performance-memory-and-gotchas|crates/ruqu-core/README\\.md|crates/ruQu/src/(lib|error)\\.rs',
|
|
1246
|
+
badSource: 'PRIMER#(1|2|3|6|7)|Cargo\\.toml$|(^|/)docs/(adr|ddd)/', goodBoost: 0.50, badPenalty: 0.38 },
|
|
1247
|
+
],
|
|
1248
|
+
// Raw Rust source bodies + design docs + manifests are dense and vector-close to orientation
|
|
1249
|
+
// queries but carry implementation detail, not plain orientation facts. Demote them on ANY
|
|
1250
|
+
// query UNLESS the query explicitly names that file/symbol surface (allowSource).
|
|
1251
|
+
offtopicMagnets: [
|
|
1252
|
+
{ reSource: '\\.rs$', pen: 0.22, allowSource: '\\.rs\\b|source code|implementation|struct |impl |fn |how is .* implemented|show me the code' },
|
|
1253
|
+
{ reSource: '(^|/)Cargo\\.toml$', pen: 0.26, allowSource: 'Cargo\\.toml|dependencies|manifest|crate version' },
|
|
1254
|
+
{ reSource: '(^|/)docs/adr/', pen: 0.22, allowSource: '\\badr\\b|architecture decision|design rationale|why was .* decided' },
|
|
1255
|
+
{ reSource: '(^|/)docs/ddd/', pen: 0.24, allowSource: '\\bddd\\b|domain model|bounded context|aggregate' },
|
|
1256
|
+
{ reSource: 'SIMULATION-INTEGRATION', pen: 0.20, allowSource: 'integration|wiring|how .* integrat' },
|
|
1257
|
+
{ reSource: '(SECURITY-REVIEW|RESEARCH_DISCOVERIES|ROADMAP|CHANGELOG)', pen: 0.26, allowSource: 'security|threat|research|roadmap|changelog' },
|
|
1258
|
+
],
|
|
1259
|
+
|
|
1260
|
+
include: [
|
|
1261
|
+
{ rule: 'mdSweepFullText', roots: ['.'] },
|
|
1262
|
+
{ rule: 'componentManifests', roots: ['crates'] },
|
|
1263
|
+
{ rule: 'componentLead', roots: ['crates'] },
|
|
1264
|
+
{ rule: 'sourceBodies', roots: ['crates', 'cli'], ext: ['.rs', '.ts', '.js', '.mjs'] },
|
|
1265
|
+
// tests + examples are the BEST usage docs (real call sites + expected results). Ingested
|
|
1266
|
+
// deliberately (sourceBodies excludes them); tagged source_type test|example by build-kb.
|
|
1267
|
+
{ rule: 'testsAndExamples', roots: ['crates', 'cli'], ext: ['.rs', '.ts', '.js', '.mjs'] },
|
|
1268
|
+
{ rule: 'docCommentSweep', roots: ['crates', 'cli'] },
|
|
1269
|
+
{ rule: 'literalFiles', files: ['README.md', 'cli/README.md', 'cli/package.json', 'cli/bin/cli.js', 'crates/ruqu-core/README.md', 'crates/ruqu-algorithms/README.md', 'crates/ruqu-wasm/README.md', 'crates/ruqu-exotic/README.md', 'crates/ruQu/README.md'] },
|
|
1270
|
+
],
|
|
1271
|
+
|
|
1272
|
+
verificationQueries: [
|
|
1273
|
+
{
|
|
1274
|
+
stage: 1,
|
|
1275
|
+
arc: 'what-is-it',
|
|
1276
|
+
query: 'What is ruqu?',
|
|
1277
|
+
wantPaths: ['PRIMER#1-what-is-ruqu', 'README.md'],
|
|
1278
|
+
mustContain: ['quantum', 'pure Rust', 'state-vector', 'WebAssembly'],
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
stage: 2,
|
|
1282
|
+
arc: 'capabilities',
|
|
1283
|
+
query: 'What can ruqu do for me?',
|
|
1284
|
+
wantPaths: ['PRIMER#2-what-can-ruqu-do-for-you', 'README.md', 'crates/ruqu-algorithms/README.md'],
|
|
1285
|
+
mustContain: ['VQE', 'Grover', 'QAOA', 'Surface Code'],
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
stage: 3,
|
|
1289
|
+
arc: 'inventory-components',
|
|
1290
|
+
query: 'What crates make up ruqu?',
|
|
1291
|
+
wantPaths: ['PRIMER#3-what-is-ruqu-made-of-the-five-crates', 'README.md'],
|
|
1292
|
+
mustContain: ['ruqu-core', 'ruqu-algorithms', 'ruqu-exotic', 'ruqu-wasm', 'coherence'],
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
stage: 4,
|
|
1296
|
+
arc: 'how-it-works-pipeline',
|
|
1297
|
+
query: 'How does a quantum circuit run on the simulator?',
|
|
1298
|
+
wantPaths: ['PRIMER#4-how-a-circuit-runs-the-simulation-pipeline', 'crates/ruqu-core/README.md'],
|
|
1299
|
+
mustContain: ['StateVector', 'planner', 'backend', 'noise'],
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
stage: 5,
|
|
1303
|
+
arc: 'maturity',
|
|
1304
|
+
query: 'Is ruqu production-ready and what are its limits?',
|
|
1305
|
+
wantPaths: ['PRIMER#5-is-it-production-ready-scope-and-honest-limits', 'README.md'],
|
|
1306
|
+
mustContain: ['25', 'simulator', 'MIT'],
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
stage: 6,
|
|
1310
|
+
arc: 'docs-where-things-live',
|
|
1311
|
+
query: 'Where do I read more about ruqu?',
|
|
1312
|
+
wantPaths: ['PRIMER#6-where-do-i-read-more-the-docs-map', 'README.md'],
|
|
1313
|
+
mustContain: ['ruqu-core', 'ruqu-algorithms', 'README'],
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
stage: 7,
|
|
1317
|
+
arc: 'end-to-end-usage',
|
|
1318
|
+
query: 'How do I install and run ruqu?',
|
|
1319
|
+
wantPaths: ['PRIMER#7-how-do-i-install-and-run-it-end-to-end', 'README.md', 'cli/README.md'],
|
|
1320
|
+
mustContain: ['cargo add ruqu-core', 'npx @ruvector/ruqu', 'wasm-pack', 'simulate'],
|
|
1321
|
+
},
|
|
1322
|
+
],
|
|
1323
|
+
|
|
1324
|
+
bundle: {
|
|
1325
|
+
blurb:
|
|
1326
|
+
'ruqu drop-in knowledge base — a quantum computing simulator in pure Rust + WebAssembly. ' +
|
|
1327
|
+
'A state-vector quantum circuit simulator (SIMD, noise models, multi-threading), production ' +
|
|
1328
|
+
'quantum algorithms (VQE, Grover, QAOA, surface-code error correction), and ~25-qubit ' +
|
|
1329
|
+
'in-browser WASM. Run circuits with no quantum hardware, even in a browser tab. ' +
|
|
1330
|
+
'Install: cargo add ruqu-core ruqu-algorithms · or npx @ruvector/ruqu simulate.',
|
|
1331
|
+
questions: [
|
|
1332
|
+
'What is ruqu and what does it let me do without quantum hardware?',
|
|
1333
|
+
'What is a state-vector simulator and what are VQE / Grover / QAOA?',
|
|
1334
|
+
'What are the five crates that make up ruqu?',
|
|
1335
|
+
'How does a circuit run — backends, noise, the cost-model planner?',
|
|
1336
|
+
'How do I install ruqu or run it from the terminal with npx?',
|
|
1337
|
+
],
|
|
1338
|
+
},
|
|
1339
|
+
},
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
/** Default target for CLI scripts that omit --target while only one repo is in scope [L]. */
|
|
1343
|
+
export const defaultTarget = 'agent-harness-generator';
|
|
1344
|
+
|
|
1345
|
+
/** Lookup helper used by build-kb / ask-kb / guard-check / grade-kb / gate. */
|
|
1346
|
+
export function getTarget(slug = defaultTarget) {
|
|
1347
|
+
const t = targets[slug];
|
|
1348
|
+
if (!t) {
|
|
1349
|
+
throw new Error(
|
|
1350
|
+
`kb.config.mjs: unknown target "${slug}". Known: ${Object.keys(targets).join(', ')}`,
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
// KB_REPO_DIR — set by tools/build-kb.mjs from build.json's repo.clonePath so that every
|
|
1354
|
+
// kb/ engine script indexes the correct build-dir clone, not the config's default repoDir.
|
|
1355
|
+
// Without this, a fresh run on a new build dir silently reads the wrong repo (Blocker-1 fix).
|
|
1356
|
+
// Direct / legacy invocations (no env var) fall back to target.repoDir as before.
|
|
1357
|
+
const repoDirOverride = process.env.KB_REPO_DIR;
|
|
1358
|
+
if (repoDirOverride) return { ...t, repoDir: repoDirOverride };
|
|
1359
|
+
return t;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
export default { targets, defaultTarget, getTarget };
|