ruvnet-kb-first 5.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 +674 -0
- package/SKILL.md +740 -0
- package/bin/kb-first.js +123 -0
- package/install/init-project.sh +435 -0
- package/install/install-global.sh +257 -0
- package/install/kb-first-autodetect.sh +108 -0
- package/install/kb-first-command.md +80 -0
- package/install/kb-first-skill.md +262 -0
- package/package.json +87 -0
- package/phases/00-assessment.md +529 -0
- package/phases/01-storage.md +194 -0
- package/phases/01.5-hooks-setup.md +521 -0
- package/phases/02-kb-creation.md +413 -0
- package/phases/03-persistence.md +125 -0
- package/phases/04-visualization.md +170 -0
- package/phases/05-integration.md +114 -0
- package/phases/06-scaffold.md +130 -0
- package/phases/07-build.md +493 -0
- package/phases/08-verification.md +597 -0
- package/phases/09-security.md +512 -0
- package/phases/10-documentation.md +613 -0
- package/phases/11-deployment.md +670 -0
- package/phases/testing.md +713 -0
- package/scripts/1.5-hooks-verify.sh +252 -0
- package/scripts/8.1-code-scan.sh +58 -0
- package/scripts/8.2-import-check.sh +42 -0
- package/scripts/8.3-source-returns.sh +52 -0
- package/scripts/8.4-startup-verify.sh +65 -0
- package/scripts/8.5-fallback-check.sh +63 -0
- package/scripts/8.6-attribution.sh +56 -0
- package/scripts/8.7-confidence.sh +56 -0
- package/scripts/8.8-gap-logging.sh +70 -0
- package/scripts/9-security-audit.sh +202 -0
- package/scripts/init-project.sh +395 -0
- package/scripts/verify-enforcement.sh +167 -0
- package/src/commands/hooks.js +361 -0
- package/src/commands/init.js +315 -0
- package/src/commands/phase.js +372 -0
- package/src/commands/score.js +380 -0
- package/src/commands/status.js +193 -0
- package/src/commands/verify.js +286 -0
- package/src/index.js +56 -0
- package/src/mcp-server.js +412 -0
- package/templates/attention-router.ts +534 -0
- package/templates/code-analysis.ts +683 -0
- package/templates/federated-kb-learner.ts +649 -0
- package/templates/gnn-engine.ts +1091 -0
- package/templates/intentions.md +277 -0
- package/templates/kb-client.ts +905 -0
- package/templates/schema.sql +303 -0
- package/templates/sona-config.ts +312 -0
package/README.md
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
Updated: 2026-01-02 09:45:00 EST | Version 5.0.0
|
|
2
|
+
Created: 2026-01-01 15:28:53 EST
|
|
3
|
+
|
|
4
|
+
# RuvNet KB-First Application Builder v5.0
|
|
5
|
+
|
|
6
|
+
## Build Intelligent Applications on Expert Knowledge
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/ruvnet-kb-first)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<img src="assets/kb-first-architecture.svg" alt="KB-First Architecture" width="800">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary>π Text Version (for AI/accessibility)</summary>
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
20
|
+
β KB-FIRST INTELLIGENCE ARCHITECTURE β
|
|
21
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
22
|
+
β β
|
|
23
|
+
β βββββββββββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββββββ β
|
|
24
|
+
β β GNN β β ATTENTION β β SONA β β
|
|
25
|
+
β β Graph Neural Nets β β 39 Mechanisms β β Self-Optimizing β β
|
|
26
|
+
β βββββββββββββββββββββββ€ βββββββββββββββββββββββ€ βββββββββββββββββββββββ€ β
|
|
27
|
+
β β β’ Decision cascades β β β’ MoE expert routingβ β β’ Pattern memory β β
|
|
28
|
+
β β β’ Relationship β β β’ Cross-attention β β β’ Outcome learning β β
|
|
29
|
+
β β modeling β β compare β β β’ Anti-forgetting β β
|
|
30
|
+
β β β’ "What if" β β β’ Flash for speed β β (EWC++) β β
|
|
31
|
+
β β simulation β β β β β β
|
|
32
|
+
β ββββββββββββ¬βββββββββββ ββββββββββββ¬βββββββββββ ββββββββββββ¬βββββββββββ β
|
|
33
|
+
β β Decision Web β Routing β Learning β
|
|
34
|
+
β ββββββββββββββββββββββββββΌβββββββββββββββββββββββββ β
|
|
35
|
+
β βΌ β
|
|
36
|
+
β βββββββββββββββββββββββββββββββββββ β
|
|
37
|
+
β β VECTOR SEARCH β β
|
|
38
|
+
β β Foundation Layer β β
|
|
39
|
+
β βββββββββββββββββββββββββββββββββββ€ β
|
|
40
|
+
β β PostgreSQL + ruvector/pgvector β β
|
|
41
|
+
β β Semantic retrieval β’ Hybrid β β
|
|
42
|
+
β βββββββββββββββββββ¬ββββββββββββββββ β
|
|
43
|
+
β βΌ β
|
|
44
|
+
β βββββββββββββββββββββββββββββββββββ β
|
|
45
|
+
β β KNOWLEDGE BASE β β
|
|
46
|
+
β βββββββββββββββββββββββββββββββββββ€ β
|
|
47
|
+
β β Expert-attributed content β β
|
|
48
|
+
β β Confidence scores β’ Gap detect β β
|
|
49
|
+
β βββββββββββββββββββββββββββββββββββ β
|
|
50
|
+
β β
|
|
51
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
</details>
|
|
55
|
+
|
|
56
|
+
**KB-First** is a methodology and skill for building applications where **curated expert knowledge drives intelligent decision-making**. Every response is grounded in verified sources. Every decision can be traced. Every gap is detected and logged.
|
|
57
|
+
|
|
58
|
+
This is **not just RAG** (Retrieval-Augmented Generation). RAG retrieves context to supplement responses. KB-First applications treat the knowledge base as the **authoritative source** β if it's not in the KB, the system says so.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## π Quick Start
|
|
63
|
+
|
|
64
|
+
### Option 1: NPX (Recommended)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Initialize KB-First in any project
|
|
68
|
+
npx ruvnet-kb-first init
|
|
69
|
+
|
|
70
|
+
# Check project status
|
|
71
|
+
npx ruvnet-kb-first status
|
|
72
|
+
|
|
73
|
+
# Run compliance score
|
|
74
|
+
npx ruvnet-kb-first score --detailed
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Option 2: Global Install
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install -g ruvnet-kb-first
|
|
81
|
+
|
|
82
|
+
ruvnet-kb-first init
|
|
83
|
+
ruvnet-kb-first status
|
|
84
|
+
ruvnet-kb-first score
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Option 3: Claude Code Slash Command
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
/kb-first # Start interactive builder
|
|
91
|
+
/kb-first init # Initialize in current project
|
|
92
|
+
/kb-first score # Score KB compliance
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Option 4: MCP Server (Deep Integration)
|
|
96
|
+
|
|
97
|
+
Add to your Claude Code `settings.json`:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"ruvnet-kb-first": {
|
|
103
|
+
"command": "npx",
|
|
104
|
+
"args": ["ruvnet-kb-first", "mcp"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## π¦ CLI Commands
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
|---------|-------------|
|
|
116
|
+
| `ruvnet-kb-first init` | Initialize KB-First structure in project |
|
|
117
|
+
| `ruvnet-kb-first status` | Show project status and phase progress |
|
|
118
|
+
| `ruvnet-kb-first score` | Calculate compliance score (0-100) |
|
|
119
|
+
| `ruvnet-kb-first verify` | Run verification checks |
|
|
120
|
+
| `ruvnet-kb-first phase <n>` | Run or view specific phase (0-11) |
|
|
121
|
+
| `ruvnet-kb-first hooks` | Manage KB-First enforcement hooks |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## π― What This Solves
|
|
126
|
+
|
|
127
|
+
| Problem | KB-First Solution |
|
|
128
|
+
|---------|-------------------|
|
|
129
|
+
| AI hallucinations | Every response cites KB sources or acknowledges gaps |
|
|
130
|
+
| Untraceable advice | Every answer includes expert attribution |
|
|
131
|
+
| Generic responses | Domain-specific knowledge from top experts |
|
|
132
|
+
| Static systems | SONA learning improves with usage |
|
|
133
|
+
| Simple search | GNN models decision cascades, Attention routes to experts |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## π§ The Intelligence Stack
|
|
138
|
+
|
|
139
|
+
KB-First leverages the full **RuVector** stack for intelligent applications:
|
|
140
|
+
|
|
141
|
+
<p align="center">
|
|
142
|
+
<img src="assets/intelligence-stack.svg" alt="The Intelligence Stack" width="800">
|
|
143
|
+
</p>
|
|
144
|
+
|
|
145
|
+
<details>
|
|
146
|
+
<summary>π Text Version (for AI/accessibility)</summary>
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
150
|
+
β THE INTELLIGENCE STACK β
|
|
151
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
152
|
+
β β
|
|
153
|
+
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
|
|
154
|
+
β β GNN β β ATTENTION β β SONA β β
|
|
155
|
+
β β (Reasoning) β β (Routing) β β (Learning) β β
|
|
156
|
+
β β β β β β β β
|
|
157
|
+
β β Sees how things β β Knows which β β Remembers what β β
|
|
158
|
+
β β connect and β β expert/approach β β worked and β β
|
|
159
|
+
β β cascade β β fits this query β β patterns that β β
|
|
160
|
+
β β β β β β succeed β β
|
|
161
|
+
β ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ β
|
|
162
|
+
β β β β β
|
|
163
|
+
β ββββββββββββββββββββββΌβββββββββββββββββββββ β
|
|
164
|
+
β β β
|
|
165
|
+
β βββββββββββββΌββββββββββββ β
|
|
166
|
+
β β VECTOR SEARCH β β
|
|
167
|
+
β β (Foundation) β β
|
|
168
|
+
β β β β
|
|
169
|
+
β β Semantic retrieval β β
|
|
170
|
+
β β from knowledge base β β
|
|
171
|
+
β βββββββββββββββββββββββββ β
|
|
172
|
+
β β
|
|
173
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
</details>
|
|
177
|
+
|
|
178
|
+
### When to Use Each Technology
|
|
179
|
+
|
|
180
|
+
| Technology | Primary Use | Example Application |
|
|
181
|
+
|------------|-------------|---------------------|
|
|
182
|
+
| **GNN** | Decisions affect other decisions | Retirement planning, medical diagnosis |
|
|
183
|
+
| **Attention (MoE)** | Route queries to expert domains | Travel optimizer, customer support |
|
|
184
|
+
| **SONA** | Learn from outcomes | Business simulator, strategy advisor |
|
|
185
|
+
| **Vector Search** | Find relevant content | All applications (foundation) |
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## ποΈ The 12-Phase Build Process
|
|
190
|
+
|
|
191
|
+
KB-First applications are built through a rigorous 12-phase process with **57 sub-phases** and **hard gates**:
|
|
192
|
+
|
|
193
|
+
<p align="center">
|
|
194
|
+
<img src="https://raw.githubusercontent.com/stuinfla/Ruvnet-KB-App_Creator/main/assets/build-process.svg?v=2" alt="The 8-Phase Build Process" width="800">
|
|
195
|
+
</p>
|
|
196
|
+
|
|
197
|
+
<details>
|
|
198
|
+
<summary>π Text Version (for AI/accessibility)</summary>
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
202
|
+
β THE 8-PHASE BUILD PROCESS β
|
|
203
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
204
|
+
β β
|
|
205
|
+
β Phase 1 Phase 2 Phase 3 Phase 4 β
|
|
206
|
+
β βββββββββ βββββββββ βββββββββ βββββββββ β
|
|
207
|
+
β βSTORAGEβ βββββΊ β KB β βββββΊ βPERSISTβ βββββΊ β VIZ β β
|
|
208
|
+
β β SETUP β β BUILD β β β β β β
|
|
209
|
+
β βββββββββ βββββ¬ββββ βββββββββ βββββ¬ββββ β
|
|
210
|
+
β β β β
|
|
211
|
+
β β Sub-phases: β β
|
|
212
|
+
β β ββ 2.1 Domain Scoping β β
|
|
213
|
+
β β ββ 2.2 Perspective Expansion β β
|
|
214
|
+
β β ββ 2.3 Expert Discovery β β
|
|
215
|
+
β β ββ 2.4 Completeness Audit β β
|
|
216
|
+
β β ββ 2.5 Gap Filling β β
|
|
217
|
+
β β ββ 2.6 Structure (β€9 nodes) β β
|
|
218
|
+
β β ββ 2.7 Recursive Depth β β
|
|
219
|
+
β β ββ 2.8 Quality Loop (β₯98) ββββββββββββ β
|
|
220
|
+
β β β β
|
|
221
|
+
β β βΌ β
|
|
222
|
+
β Phase 8 Phase 7 Phase 6 Phase 5 β
|
|
223
|
+
β βββββββββ βββββββββ βββββββββ βββββββββ β
|
|
224
|
+
β βVERIFY β βββββ β BUILD β βββββ βSCAFF- β βββββ β SDK β β
|
|
225
|
+
β β β β (ENF) β β OLD β β LAYER β β
|
|
226
|
+
β βββββββββ βββββ¬ββββ βββββββββ βββββββββ β
|
|
227
|
+
β β β
|
|
228
|
+
β βββΊ ENFORCEMENT RULES: β
|
|
229
|
+
β β’ NO SHORTCUTS β
|
|
230
|
+
β β’ NO HARDCODED VALUES β
|
|
231
|
+
β β’ ALL SOURCES TRACED β
|
|
232
|
+
β β
|
|
233
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
</details>
|
|
237
|
+
|
|
238
|
+
### Phase Summary
|
|
239
|
+
|
|
240
|
+
| Phase | Name | Sub-Phases | Purpose | Quality Gate |
|
|
241
|
+
|-------|------|------------|---------|--------------|
|
|
242
|
+
| 0 | Assessment | 6 | Score existing KB/app (brownfield) | β User types "PROCEED" |
|
|
243
|
+
| 1 | Storage Setup | 6 | Start PostgreSQL + ruvector | Connection verified |
|
|
244
|
+
| 1.5 | Hooks Setup | 4 | RuVector hooks for KB enforcement | Hook verify passes |
|
|
245
|
+
| 2 | KB Creation | 8 | Build world-class knowledge base | Score β₯98/100 |
|
|
246
|
+
| 3 | Persistence | - | Store with embeddings | Semantic search works |
|
|
247
|
+
| 4 | Visualization | - | Interactive 3D tree | Navigation works |
|
|
248
|
+
| 5 | Integration Layer | - | TypeScript SDK | All functions compile |
|
|
249
|
+
| 6 | Scaffold | - | Project structure | KB enforcement in place |
|
|
250
|
+
| 7 | Build | 7 | Implement with KB enforcement | No hardcoded values |
|
|
251
|
+
| 8 | Verification | 8 | Final check | All 8 checks pass |
|
|
252
|
+
| 9 | Security | 6 | Security audit & hardening | 0 critical/high issues |
|
|
253
|
+
| 10 | Documentation | 6 | Complete docs & versioning | All docs complete |
|
|
254
|
+
| 11 | Deployment | 6 | Production with public access | Go-live verified |
|
|
255
|
+
|
|
256
|
+
**Total: 12 phases, 57 sub-phases, hard gates at every boundary.**
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## π Four Intelligence Patterns
|
|
261
|
+
|
|
262
|
+
Every KB-First application fits one of four patterns. The pattern determines your primary technology:
|
|
263
|
+
|
|
264
|
+
### Pattern 1: Decision Web (GNN-First)
|
|
265
|
+
**Use when:** Changing one variable affects many others
|
|
266
|
+
|
|
267
|
+
*Examples: Retirement planning, medical treatment, portfolio construction*
|
|
268
|
+
|
|
269
|
+
<p align="center">
|
|
270
|
+
<img src="assets/decision-web-gnn.svg" alt="GNN Decision Web Pattern" width="800">
|
|
271
|
+
</p>
|
|
272
|
+
|
|
273
|
+
<details>
|
|
274
|
+
<summary>π Text Version (for AI/accessibility)</summary>
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
278
|
+
β USER QUERY: "What if I take Social Security at 70?" β
|
|
279
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
280
|
+
β β β
|
|
281
|
+
β βΌ β
|
|
282
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
283
|
+
β β GNN DECISION GRAPH β β
|
|
284
|
+
β β β β
|
|
285
|
+
β β βββββββββββββ β β
|
|
286
|
+
β β β SS Age β β β
|
|
287
|
+
β β β (70) β β β
|
|
288
|
+
β β βββββββ¬ββββββ β β
|
|
289
|
+
β β affects β affects β β
|
|
290
|
+
β β βββββββββββββββββ΄ββββββββββββββββ β β
|
|
291
|
+
β β βΌ βΌ β β
|
|
292
|
+
β β βββββββββββββββ βββββββββββββββββββ β β
|
|
293
|
+
β β β Tax Bracket β β Roth Conversion β β β
|
|
294
|
+
β β ββββββββ¬βββββββ β Space β β β
|
|
295
|
+
β β β affects ββββββββββ¬βββββββββ β β
|
|
296
|
+
β β ββββββββββββ affects β β β
|
|
297
|
+
β β βΌ βββββββββββββββββββ β β
|
|
298
|
+
β β ββββββββββββββββ β β
|
|
299
|
+
β β β Medicare β β β
|
|
300
|
+
β β β Premium β β β
|
|
301
|
+
β β ββββββββββββββββ β β
|
|
302
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
303
|
+
β β β
|
|
304
|
+
β βΌ β
|
|
305
|
+
β OUTPUT: Cascade effects, similar patterns, scenario comparison β
|
|
306
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
</details>
|
|
310
|
+
|
|
311
|
+
### Pattern 2: Combinatorial Routing (Attention-First)
|
|
312
|
+
**Use when:** Queries need to go to different expert domains
|
|
313
|
+
|
|
314
|
+
*Examples: Travel optimizer, customer support, resource allocation*
|
|
315
|
+
|
|
316
|
+
<p align="center">
|
|
317
|
+
<img src="https://raw.githubusercontent.com/stuinfla/Ruvnet-KB-App_Creator/main/assets/combinatorial-routing.svg?v=2" alt="MoE Expert Routing Pattern" width="800">
|
|
318
|
+
</p>
|
|
319
|
+
|
|
320
|
+
<details>
|
|
321
|
+
<summary>π Text Version (for AI/accessibility)</summary>
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
325
|
+
β USER QUERY: "Find me cheap business class to Tokyo using points" β
|
|
326
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
327
|
+
β β β
|
|
328
|
+
β βΌ β
|
|
329
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
330
|
+
β β MoE EXPERT ROUTING β β
|
|
331
|
+
β β β β
|
|
332
|
+
β β Query ββββββ¬ββββββββββββββββββ¬ββββββββββββββββββ β β
|
|
333
|
+
β β β β β β β
|
|
334
|
+
β β βΌ βΌ βΌ β β
|
|
335
|
+
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β β
|
|
336
|
+
β β β Award Travel β β Cash Fares β β Positioning β β β
|
|
337
|
+
β β β Expert β β Expert β β Expert β β β
|
|
338
|
+
β β β β β β β β β β
|
|
339
|
+
β β β Score: 0.85 β β Score: 0.45 β β Score: 0.72 β β β
|
|
340
|
+
β β β ββββββββββββββ β β ββββββββββββββ β β ββββββββββββββ β β β
|
|
341
|
+
β β β [SELECTED] β β [SKIP] β β [SELECTED] β β β
|
|
342
|
+
β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β β
|
|
343
|
+
β β β β
|
|
344
|
+
β β Route to: Award Travel + Positioning β β
|
|
345
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
346
|
+
β β β
|
|
347
|
+
β βΌ β
|
|
348
|
+
β OUTPUT: Multi-expert synthesis, optimal combinations β
|
|
349
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
</details>
|
|
353
|
+
|
|
354
|
+
### Pattern 3: Scenario Learning (SONA-First)
|
|
355
|
+
**Use when:** "What worked for people like me?" is the core value
|
|
356
|
+
|
|
357
|
+
*Examples: Business simulator, strategy advisor, personalized coaching*
|
|
358
|
+
|
|
359
|
+
<p align="center">
|
|
360
|
+
<img src="assets/scenario-learning-sona.svg" alt="SONA Pattern Recall" width="800">
|
|
361
|
+
</p>
|
|
362
|
+
|
|
363
|
+
<details>
|
|
364
|
+
<summary>π Text Version (for AI/accessibility)</summary>
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
368
|
+
β USER QUERY: "What pricing strategy should I use for my SaaS?" β
|
|
369
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
370
|
+
β β β
|
|
371
|
+
β βΌ β
|
|
372
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
373
|
+
β β SONA PATTERN RECALL β β
|
|
374
|
+
β β β β
|
|
375
|
+
β β βββββββββββββββββββ βββββββββββββββββββ β β
|
|
376
|
+
β β β Your Profile β β Similar β β β
|
|
377
|
+
β β β β βββββββΊ β Businesses β β β
|
|
378
|
+
β β β β’ B2B SaaS β pattern β β β β
|
|
379
|
+
β β β β’ Seed stage β match β 847 matches β β β
|
|
380
|
+
β β β β’ $50K MRR β β 94% confidence β β β
|
|
381
|
+
β β βββββββββββββββββββ ββββββββββ¬βββββββββ β β
|
|
382
|
+
β β β β β
|
|
383
|
+
β β βΌ β β
|
|
384
|
+
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
|
|
385
|
+
β β β "Companies like yours that used freemium saw 23% better β β β
|
|
386
|
+
β β β conversion than those starting with paid-only models..." β β β
|
|
387
|
+
β β β β β β
|
|
388
|
+
β β β Source: 312 similar outcomes analyzed β β β
|
|
389
|
+
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
|
|
390
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
391
|
+
β β β
|
|
392
|
+
β βΌ β
|
|
393
|
+
β OUTPUT: Learned patterns, outcome data, confidence score β
|
|
394
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
</details>
|
|
398
|
+
|
|
399
|
+
### Pattern 4: Continuous Optimization (Attention + SONA Loop)
|
|
400
|
+
**Use when:** You need ongoing monitoring and adaptation
|
|
401
|
+
|
|
402
|
+
*Examples: SEO optimizer, trading system, adaptive marketing*
|
|
403
|
+
|
|
404
|
+
<p align="center">
|
|
405
|
+
<img src="assets/continuous-optimization.svg" alt="Continuous Optimization Loop" width="800">
|
|
406
|
+
</p>
|
|
407
|
+
|
|
408
|
+
<details>
|
|
409
|
+
<summary>π Text Version (for AI/accessibility)</summary>
|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
413
|
+
β CONTINUOUS OPTIMIZATION LOOP β
|
|
414
|
+
β (Weekly Cycle) β
|
|
415
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
416
|
+
β β
|
|
417
|
+
β βββββββββββββββββββ β
|
|
418
|
+
β β Flash Attention β β
|
|
419
|
+
β ββββββββββΊβ ββββββββββ β
|
|
420
|
+
β β β Scan content & β β β
|
|
421
|
+
β β β competitors β β β
|
|
422
|
+
β β βββββββββββββββββββ β β
|
|
423
|
+
β β βΌ β
|
|
424
|
+
β βββββββββββββββββββ βββββββββββββββββββ β
|
|
425
|
+
β β SONA Learning β β Cross Attention β β
|
|
426
|
+
β β β β β β
|
|
427
|
+
β β Remember what β β Identify gaps β β
|
|
428
|
+
β β worked β β β β
|
|
429
|
+
β βββββββββββββββββββ βββββββββββββββββββ β
|
|
430
|
+
β β² β β
|
|
431
|
+
β β βΌ β
|
|
432
|
+
β β βββββββββββββββββββ β β
|
|
433
|
+
β β β Track Results β β β
|
|
434
|
+
β βββββββββββ ββββββββββ β
|
|
435
|
+
β β Measure impact β β
|
|
436
|
+
β ββββββββββ¬βββββββββ β
|
|
437
|
+
β β β
|
|
438
|
+
β βΌ β
|
|
439
|
+
β βββββββββββββββββββ β
|
|
440
|
+
β β Deploy Changes β β
|
|
441
|
+
β β β β
|
|
442
|
+
β β Push updates β β
|
|
443
|
+
β βββββββββββββββββββ β
|
|
444
|
+
β β
|
|
445
|
+
β Each iteration improves: KB quality, content coverage, search rankings β
|
|
446
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
</details>
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## π Quick Start
|
|
454
|
+
|
|
455
|
+
### Prerequisites
|
|
456
|
+
- Docker
|
|
457
|
+
- Node.js 18+
|
|
458
|
+
- Python 3 (for hooks)
|
|
459
|
+
- Claude Code
|
|
460
|
+
|
|
461
|
+
### Option 1: Global Installation (Recommended)
|
|
462
|
+
|
|
463
|
+
Install KB-First as a skill available in ALL your projects:
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
# Clone the repository
|
|
467
|
+
git clone https://github.com/stuinfla/Ruvnet-KB-App_Creator.git
|
|
468
|
+
cd Ruvnet-KB-App_Creator
|
|
469
|
+
|
|
470
|
+
# Install globally
|
|
471
|
+
./install/install-global.sh
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
This installs:
|
|
475
|
+
- `/kb-first` command in Claude Code
|
|
476
|
+
- Hook scripts for automatic KB enforcement
|
|
477
|
+
- Skill documentation in `~/.claude/skills/`
|
|
478
|
+
|
|
479
|
+
Then in any project, just type:
|
|
480
|
+
```
|
|
481
|
+
/kb-first
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Option 2: Project-Level Installation
|
|
485
|
+
|
|
486
|
+
Initialize KB-First in a specific project:
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
# In your project directory
|
|
490
|
+
curl -sSL https://raw.githubusercontent.com/stuinfla/Ruvnet-KB-App_Creator/main/install/init-project.sh | bash
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Or manually:
|
|
494
|
+
```bash
|
|
495
|
+
git clone https://github.com/stuinfla/Ruvnet-KB-App_Creator.git
|
|
496
|
+
./Ruvnet-KB-App_Creator/install/init-project.sh
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Option 3: Manual Setup
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
# Clone the repository
|
|
503
|
+
git clone https://github.com/stuinfla/Ruvnet-KB-App_Creator.git
|
|
504
|
+
cd Ruvnet-KB-App_Creator
|
|
505
|
+
|
|
506
|
+
# Start the database
|
|
507
|
+
docker run -d --name kb-postgres \
|
|
508
|
+
-e POSTGRES_PASSWORD=secret \
|
|
509
|
+
-p 5432:5432 \
|
|
510
|
+
ruvnet/ruvector-postgres:latest
|
|
511
|
+
|
|
512
|
+
# Set environment
|
|
513
|
+
export DATABASE_URL="postgres://postgres:secret@localhost:5432/postgres"
|
|
514
|
+
|
|
515
|
+
# Initialize schema
|
|
516
|
+
psql $DATABASE_URL -f templates/schema.sql
|
|
517
|
+
|
|
518
|
+
# Install hooks (Phase 1.5)
|
|
519
|
+
npx @ruvector/cli hooks init
|
|
520
|
+
npx @ruvector/cli hooks install
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### Usage
|
|
524
|
+
|
|
525
|
+
```bash
|
|
526
|
+
/kb-first # Start interactive builder
|
|
527
|
+
/kb-first init # Initialize in current project
|
|
528
|
+
/kb-first score # Score existing KB and app
|
|
529
|
+
/kb-first verify # Run verification checks
|
|
530
|
+
/kb-first hooks # Configure hooks
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
## π Repository Structure
|
|
536
|
+
|
|
537
|
+
```
|
|
538
|
+
kb-first-v43/
|
|
539
|
+
βββ README.md # This file
|
|
540
|
+
βββ SKILL.md # Main skill documentation (v4.3)
|
|
541
|
+
βββ .github/
|
|
542
|
+
β βββ workflows/
|
|
543
|
+
β βββ kb-first-ci.yml # CI/CD quality gates
|
|
544
|
+
βββ install/ # Installation scripts
|
|
545
|
+
β βββ install-global.sh # Global skill installation
|
|
546
|
+
β βββ init-project.sh # Project-level initialization
|
|
547
|
+
β βββ kb-first-skill.md # Skill file for ~/.claude/skills/
|
|
548
|
+
β βββ kb-first-command.md # Command file for ~/.claude/commands/
|
|
549
|
+
βββ phases/ # Phase-by-phase instructions
|
|
550
|
+
β βββ 00-assessment.md # Greenfield + Brownfield assessment
|
|
551
|
+
β βββ 01-storage.md # PostgreSQL + ruvector setup
|
|
552
|
+
β βββ 01.5-hooks-setup.md # RuVector hooks configuration
|
|
553
|
+
β βββ 02-kb-creation.md
|
|
554
|
+
β βββ 03-persistence.md
|
|
555
|
+
β βββ 04-visualization.md
|
|
556
|
+
β βββ 05-integration.md
|
|
557
|
+
β βββ 06-scaffold.md
|
|
558
|
+
β βββ 07-build.md
|
|
559
|
+
β βββ 08-verification.md # 8 numbered sub-phases (8.1-8.8)
|
|
560
|
+
β βββ 09-security.md # Security audit & hardening
|
|
561
|
+
β βββ 10-documentation.md # Docs & versioning
|
|
562
|
+
β βββ 11-deployment.md # Production deployment
|
|
563
|
+
β βββ testing.md # Comprehensive testing strategy
|
|
564
|
+
βββ patterns/ # Intelligence pattern guides
|
|
565
|
+
β βββ decision-web.md # GNN-first pattern
|
|
566
|
+
β βββ combinatorial-routing.md # Attention-first pattern
|
|
567
|
+
β βββ scenario-learning.md # SONA-first pattern
|
|
568
|
+
β βββ continuous-optimization.md
|
|
569
|
+
βββ templates/ # Code templates
|
|
570
|
+
β βββ intentions.md # Greenfield project intentions
|
|
571
|
+
β βββ schema.sql # PostgreSQL schema
|
|
572
|
+
β βββ kb-client.ts # TypeScript KB client
|
|
573
|
+
β βββ gnn-engine.ts # GNN implementation
|
|
574
|
+
β βββ attention-router.ts # Attention routing
|
|
575
|
+
β βββ sona-config.ts # SONA configuration
|
|
576
|
+
β βββ code-analysis.ts # Code analysis engine
|
|
577
|
+
β βββ federated-kb-learner.ts # Federated KB learning
|
|
578
|
+
βββ prompts/ # AI prompts for KB creation
|
|
579
|
+
β βββ expert-discovery.md
|
|
580
|
+
β βββ completeness-audit.md
|
|
581
|
+
β βββ quality-critique.md
|
|
582
|
+
βββ scripts/ # Verification scripts
|
|
583
|
+
β βββ 1.5-hooks-verify.sh # Hook verification suite
|
|
584
|
+
β βββ 8.1-code-scan.sh # No hardcoded values
|
|
585
|
+
β βββ 8.2-import-check.sh # KB imports required
|
|
586
|
+
β βββ 8.3-source-returns.sh # kbSources in returns
|
|
587
|
+
β βββ 8.4-startup-verify.sh # KB connection at startup
|
|
588
|
+
β βββ 8.5-fallback-check.sh # No fallback patterns
|
|
589
|
+
β βββ 8.6-attribution.sh # Expert attribution
|
|
590
|
+
β βββ 8.7-confidence.sh # Confidence scores
|
|
591
|
+
β βββ 8.8-gap-logging.sh # Gap detection
|
|
592
|
+
β βββ 9-security-audit.sh # Security verification suite
|
|
593
|
+
β βββ init-project.sh # Project initialization
|
|
594
|
+
β βββ verify-enforcement.sh # Full enforcement check
|
|
595
|
+
βββ references/ # Technical references
|
|
596
|
+
β βββ ruvector-functions.md
|
|
597
|
+
β βββ attention-mechanisms.md
|
|
598
|
+
β βββ sona-config.md
|
|
599
|
+
β βββ hooks-integration.md
|
|
600
|
+
β βββ hard-gates.md # Gate enforcement rules
|
|
601
|
+
β βββ swarm-config.md # Parallel execution config
|
|
602
|
+
β βββ error-recovery.md # Rollback procedures
|
|
603
|
+
β βββ troubleshooting.md # Quick diagnosis guide
|
|
604
|
+
βββ examples/ # Working examples
|
|
605
|
+
β βββ retirement-advisor/
|
|
606
|
+
β βββ travel-optimizer/
|
|
607
|
+
β βββ business-simulator/
|
|
608
|
+
β βββ seo-engine/
|
|
609
|
+
βββ assets/ # Images and diagrams
|
|
610
|
+
βββ kb-first-architecture.svg
|
|
611
|
+
βββ intelligence-stack.svg
|
|
612
|
+
βββ build-process.svg
|
|
613
|
+
βββ decision-web-gnn.svg
|
|
614
|
+
βββ combinatorial-routing.svg
|
|
615
|
+
βββ scenario-learning-sona.svg
|
|
616
|
+
βββ continuous-optimization.svg
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## π Documentation
|
|
622
|
+
|
|
623
|
+
| Document | Purpose |
|
|
624
|
+
|----------|---------|
|
|
625
|
+
| [SKILL.md](SKILL.md) | Complete skill documentation for Claude |
|
|
626
|
+
| [phases/](phases/) | Detailed phase-by-phase instructions |
|
|
627
|
+
| [patterns/](patterns/) | Intelligence pattern implementation guides |
|
|
628
|
+
| [references/](references/) | Technical API and function references |
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
## π§ The Five Enforcement Rules
|
|
633
|
+
|
|
634
|
+
Every KB-First application follows these rules:
|
|
635
|
+
|
|
636
|
+
### Rule 1: KB-First Mandate
|
|
637
|
+
> Every response must cite KB sources or explicitly acknowledge a gap.
|
|
638
|
+
|
|
639
|
+
### Rule 2: Confidence Scoring
|
|
640
|
+
> Every KB result includes a confidence score (0.0-1.0).
|
|
641
|
+
|
|
642
|
+
### Rule 3: Gap Detection
|
|
643
|
+
> Log every query that cannot be answered from the KB.
|
|
644
|
+
|
|
645
|
+
### Rule 4: Expert Attribution
|
|
646
|
+
> Every KB node must trace to a named expert source.
|
|
647
|
+
|
|
648
|
+
### Rule 5: No Shortcuts
|
|
649
|
+
> No hardcoded domain logic. No fallback values. KB is the source of truth.
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
653
|
+
## π€ Contributing
|
|
654
|
+
|
|
655
|
+
Contributions are welcome! Please read the [Contributing Guide](CONTRIBUTING.md) first.
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
## π License
|
|
660
|
+
|
|
661
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
665
|
+
## π Acknowledgments
|
|
666
|
+
|
|
667
|
+
- [RuVector](https://github.com/ruvnet/ruvector) - The intelligence stack
|
|
668
|
+
- [Anthropic](https://www.anthropic.com) - Claude AI
|
|
669
|
+
|
|
670
|
+
---
|
|
671
|
+
|
|
672
|
+
<p align="center">
|
|
673
|
+
<strong>Build intelligence, not just retrieval.</strong>
|
|
674
|
+
</p>
|