@plumpslabs/kuma 2.3.31 → 2.3.33
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 +321 -184
- package/dist/index.js +1469 -521
- package/package.json +1 -1
- package/packages/ide/studio/dist/index.js +298 -101
- package/packages/ide/studio/public/index.html +486 -74
package/README.md
CHANGED
|
@@ -1,286 +1,423 @@
|
|
|
1
|
+
|
|
1
2
|
<div align="center">
|
|
2
3
|
|
|
3
4
|
<img src="https://raw.githubusercontent.com/plumpslabs/kuma/main/public/kuma.png" alt="Kuma Logo" width="180" />
|
|
4
5
|
|
|
5
6
|
# Kuma
|
|
6
7
|
|
|
7
|
-
**Safety-first context & orchestration engine for AI coding agents
|
|
8
|
-
|
|
9
|
-
[](https://www.npmjs.com/package/@plumpslabs/kuma)
|
|
10
|
-
[](LICENSE)
|
|
11
|
-
[](https://nodejs.org/)
|
|
8
|
+
**Safety-first context & orchestration engine for AI coding agents.**
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
[](https://npm.im/@plumpslabs/kuma)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://nodejs.org)
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
> Works with any MCP-compatible agent: Claude Code, Cursor, Windsurf, Zed, and more.
|
|
16
15
|
|
|
17
16
|
---
|
|
18
17
|
|
|
19
18
|
## What is Kuma?
|
|
20
19
|
|
|
21
|
-
Kuma is an
|
|
22
|
-
|
|
23
|
-
When an agent wants to modify code, Kuma won't let it work blind. It runs a deterministic pipeline: load the research cache, query the knowledge graph, analyze impact across the entire codebase, look up past decisions, and check safety policies — all in one MCP call. Only then does the agent have the context it needs to edit safely.
|
|
20
|
+
Kuma is an MCP (Model Context Protocol) server that acts as a **pre-modification safety layer** for AI coding agents. Before an agent touches your code, Kuma enforces a research and safety pipeline — like a pre-flight checklist for code changes.
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
**The Problem:** AI agents often modify code without understanding the full context — missing dependencies, breaking related features, or repeating past mistakes.
|
|
26
23
|
|
|
27
|
-
**
|
|
24
|
+
**The Solution:** Kuma ensures every modification is informed by:
|
|
25
|
+
- 🧠 **Project-specific knowledge graph** — SQLite-based graph of nodes, edges, gotchas, and decisions
|
|
26
|
+
- 🔍 **Mandatory research pipeline** — 5-step context gathering before any edit
|
|
27
|
+
- 🛡️ **Safety policies** — Configurable rules that block risky operations
|
|
28
|
+
- 📝 **Decision memory** — ADR-style decision tracking across sessions
|
|
29
|
+
- 🔄 **Self-healing** — Automatic detection and repair of stale knowledge
|
|
30
|
+
- ↩️ **Selective undo** — Symbol-level change tracking for precise reverts
|
|
31
|
+
- 📊 **Kuma Studio** — Visual dashboard for knowledge graph, efficiency metrics, and activity tracking
|
|
28
32
|
|
|
29
33
|
---
|
|
30
34
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
**Yes — to run Kuma, you need exactly zero configuration:**
|
|
35
|
+
## Quick Start
|
|
34
36
|
|
|
35
37
|
```bash
|
|
38
|
+
# Run with npx (zero setup)
|
|
36
39
|
npx -y @plumpslabs/kuma
|
|
37
|
-
```
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
# Or install globally
|
|
42
|
+
npm install -g @plumpslabs/kuma
|
|
43
|
+
kuma
|
|
44
|
+
```
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
Kuma auto-generates:
|
|
47
|
+
- `.kuma/init.md` — Project-specific behavioral rules
|
|
48
|
+
- `.kuma/kuma.db` — SQLite knowledge graph (WASM, zero native build)
|
|
49
|
+
- `.kuma/policy.yml` — Customizable safety policies
|
|
50
|
+
- `.skills/` — Skill files for common patterns
|
|
42
51
|
|
|
43
52
|
---
|
|
44
53
|
|
|
45
|
-
## Core
|
|
54
|
+
## Core Architecture: 3 Pipeline-Driven Tools
|
|
46
55
|
|
|
47
|
-
|
|
56
|
+
Kuma V3 consolidates 46+ micro-tools into **3 coarse-grained tools**. Each action triggers an internal multi-step workflow — the agent doesn't chain individual calls.
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
### 🧠 `kuma_context` — Context & Research
|
|
50
59
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
| Action | Purpose | Impact |
|
|
61
|
+
|--------|---------|--------|
|
|
62
|
+
| `init` | Load project brief, restore session | 🔴 Required first |
|
|
63
|
+
| `research` | 5-step pipeline: cache → graph → impact → decision → safety | 🔴 Required before edits |
|
|
64
|
+
| `impact` | Analyze change effects on related code | 🔴 High |
|
|
65
|
+
| `navigate` | Trace code flow across files | 🟡 Linear |
|
|
66
|
+
| `changes` | View change log for current session | 🟡 Linear |
|
|
67
|
+
| `health` | Project health score (0-100) | 🟡 Linear |
|
|
68
|
+
| `rollback` | Undo a specific change by ID | 🟡 Linear |
|
|
69
|
+
| `sync` | Unified batch state query | 🟢 Skip (agent native) |
|
|
70
|
+
| `digest` | Ultra-compact <500 token project briefing | 🟡 Linear |
|
|
71
|
+
| `drift` | Detect memory staleness & code drift | 🟡 Linear |
|
|
72
|
+
| `progressive` | Progressive context loading | 🟡 Linear |
|
|
73
|
+
|
|
74
|
+
### 💾 `kuma_memory` — Decision & Knowledge
|
|
75
|
+
|
|
76
|
+
| Action | Purpose | Impact |
|
|
77
|
+
|--------|---------|--------|
|
|
78
|
+
| `research_save` | Save research findings to cache | 🔴 Exponential |
|
|
79
|
+
| `gotcha` | Record bugs/quirks IMMEDIATELY | 🔴 Exponential |
|
|
80
|
+
| `arch_flow` | Record architecture flow (max 5 core files) | 🔴 Exponential |
|
|
81
|
+
| `decision` | Record ADR-style decision with rationale | 🔴 Exponential |
|
|
82
|
+
| `feature` | Record high-level feature with owns edges | 🔴 Exponential |
|
|
83
|
+
| `mine` | Mine git history for hidden decisions | 🟡 Linear |
|
|
84
|
+
| `session` | View session summary | 🟢 Skip |
|
|
85
|
+
| `heal` | Repair stale graph entries | 🟡 Linear |
|
|
86
|
+
| `search` | Search knowledge graph | 🟡 Linear |
|
|
87
|
+
| `todo` | Manage persistent todos | 🟡 Linear |
|
|
88
|
+
| `context` | Inject notes into context | 🟡 Linear |
|
|
89
|
+
| `benchmark` | Capture/diff performance metrics | 🟡 Linear |
|
|
90
|
+
| `domain_rules` | Layer 1: Business rules | 🟡 Linear |
|
|
91
|
+
| `layers` | View all 3 memory layers | 🟢 Skip |
|
|
54
92
|
|
|
55
|
-
###
|
|
93
|
+
### 🛡️ `kuma_safety` — Safety & Policy
|
|
56
94
|
|
|
57
|
-
|
|
95
|
+
| Action | Purpose | Impact |
|
|
96
|
+
|--------|---------|--------|
|
|
97
|
+
| `guard` | Detect anti-patterns, drift, runaway loops | 🔴 Required |
|
|
98
|
+
| `verify` | Auto-run scoped tests + AST validation | 🔴 High |
|
|
99
|
+
| `check` | Pre-execution safety check | 🟡 Linear |
|
|
100
|
+
| `audit` | Query safety audit trail | 🟡 Linear |
|
|
101
|
+
| `lock` | Multi-agent coordination lock | 🟡 Linear |
|
|
102
|
+
| `health` | Safety health score | 🟡 Linear |
|
|
103
|
+
| `override` | Bypass safety (recorded in audit) | 🟡 Linear |
|
|
104
|
+
| `security` | Scan for leaked secrets | 🟡 Linear |
|
|
105
|
+
| `gc` | Garbage collect stale data | 🟢 Skip |
|
|
106
|
+
| `doctor` | Full health check | 🟡 Linear |
|
|
107
|
+
| `policy` | Policy-as-Code engine | 🟡 Linear |
|
|
108
|
+
| `ast` / `validate` | AST-based code validation | 🟡 Linear |
|
|
109
|
+
| `checkpoint` | Atomic snapshot before refactors | 🟡 Linear |
|
|
110
|
+
| `rollback_label` | Restore from checkpoint | 🟡 Linear |
|
|
111
|
+
| `contract` | Pre/post-condition checks | 🟡 Linear |
|
|
58
112
|
|
|
59
|
-
|
|
60
|
-
|------|-------------|
|
|
61
|
-
| **1. Load Cache** | Check `.kuma/research/<scope>.json` — fresh or stale? |
|
|
62
|
-
| **2. Graph Query** | Find all related nodes and edges in the knowledge graph |
|
|
63
|
-
| **3. Impact Analysis** | "If I change X, what breaks?" — references, files, tests, API routes |
|
|
64
|
-
| **4. Decision Lookup** | Check past ADR-style decisions and known issues |
|
|
65
|
-
| **5. Safety Check** | Policy compliance, active locks, risk level |
|
|
113
|
+
---
|
|
66
114
|
|
|
67
|
-
|
|
115
|
+
## V3 Changes: What's New
|
|
68
116
|
|
|
69
|
-
|
|
117
|
+
Kuma V3 is a major evolution focusing on **simplicity, safety, and agent-native workflows**.
|
|
70
118
|
|
|
71
|
-
|
|
119
|
+
### Dropped Tools (Now Handled by Agents)
|
|
120
|
+
|
|
121
|
+
| Dropped Tool | Why Dropped |
|
|
122
|
+
|--------------|-------------|
|
|
123
|
+
| `precise_diff_editor` | Agent has native edit tools |
|
|
124
|
+
| `safe_terminal_exec` | Agent executes commands natively |
|
|
125
|
+
| `smart_grep` | Agent searches natively (ripgrep, semantic) |
|
|
126
|
+
| `batch_file_writer` | Agent creates files natively |
|
|
127
|
+
| `ast_validator` (standalone) | Merged into `kuma_safety` as `ast`/`validate` action |
|
|
128
|
+
| `git_diff_analyzer` | Merged into `kuma_context` as `impact` action |
|
|
129
|
+
|
|
130
|
+
### New Features in V3
|
|
131
|
+
|
|
132
|
+
| Feature | Description |
|
|
72
133
|
|---------|-------------|
|
|
73
|
-
| **
|
|
74
|
-
| **
|
|
75
|
-
| **
|
|
76
|
-
| **
|
|
134
|
+
| **3 Coarse-Grained Tools** | Simplified API: `kuma_context`, `kuma_memory`, `kuma_safety` |
|
|
135
|
+
| **Pipeline-Driven Actions** | Each action triggers internal multi-step workflows |
|
|
136
|
+
| **Knowledge Graph** | SQLite + FTS5 full-text search with WASM engine |
|
|
137
|
+
| **Feature Recording** | Auto-detect and record high-level features with `owns` edges |
|
|
138
|
+
| **Session Memory** | Track tool calls, recordings, and efficiency per session |
|
|
139
|
+
| **Guard System** | Real-time monitoring with blocking warnings for anti-patterns |
|
|
140
|
+
| **Self-Healing** | Automatic detection and repair of stale nodes |
|
|
141
|
+
| **Kuma Studio** | Visual dashboard with graph, efficiency, and activity tracking |
|
|
142
|
+
| **Policy-as-Code** | Configurable safety rules in `.kuma/policy.yml` |
|
|
143
|
+
| **Checkpoint/Rollback** | Atomic snapshots before major refactors |
|
|
144
|
+
|
|
145
|
+
---
|
|
77
146
|
|
|
78
|
-
|
|
147
|
+
## Kuma Studio
|
|
79
148
|
|
|
80
|
-
|
|
149
|
+
Kuma Studio is a **web-based dashboard** for visualizing and managing your knowledge graph.
|
|
81
150
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
151
|
+
### Features
|
|
152
|
+
|
|
153
|
+
- **📊 Knowledge Graph** — Interactive node-edge visualization with physics simulation
|
|
154
|
+
- **⭐ Features** — High-level module tracking with owns edges to files
|
|
155
|
+
- **⚠️ Gotchas** — Known bugs and quirks with severity levels
|
|
156
|
+
- **💚 Health** — Project health scores over time
|
|
157
|
+
- **⚡ Efficiency** — Session metrics, time saved, verification pass rates
|
|
158
|
+
- **📈 Staleness** — Detection of stale nodes with missing file references
|
|
159
|
+
- **🤖 Activity** — Agent usage intensity, success rates, and session history
|
|
160
|
+
|
|
161
|
+
### Usage
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Start Kuma Studio
|
|
165
|
+
kuma studio
|
|
166
|
+
|
|
167
|
+
# Or via npx
|
|
168
|
+
npx -y @plumpslabs/kuma studio
|
|
87
169
|
```
|
|
88
170
|
|
|
89
|
-
|
|
171
|
+
Studio runs at `http://localhost:3322` and provides:
|
|
172
|
+
- Real-time graph visualization
|
|
173
|
+
- Copy report functionality for activity analysis
|
|
174
|
+
- Node detail modals with relations and gotchas
|
|
175
|
+
- Search and filter capabilities
|
|
176
|
+
- Physics-based graph layout with depth controls
|
|
177
|
+
|
|
178
|
+
---
|
|
90
179
|
|
|
91
|
-
|
|
180
|
+
## Knowledge Graph Schema
|
|
92
181
|
|
|
93
|
-
|
|
182
|
+
Kuma builds a comprehensive knowledge graph with these node types:
|
|
183
|
+
|
|
184
|
+
| Node Type | Description |
|
|
185
|
+
|-----------|-------------|
|
|
186
|
+
| `feature` | High-level module (e.g., Auth, Billing) |
|
|
187
|
+
| `arch_flow` | Architecture flow between files |
|
|
188
|
+
| `gotcha` | Known bug or quirk |
|
|
189
|
+
| `decision` | ADR-style decision with rationale |
|
|
190
|
+
| `function` | Function or method |
|
|
191
|
+
| `class` | Class definition |
|
|
192
|
+
| `component` | UI component |
|
|
193
|
+
| `file` | Source file |
|
|
194
|
+
| `api_route` | API endpoint |
|
|
195
|
+
| `test` | Test file |
|
|
196
|
+
| `research` | Research cache entry |
|
|
197
|
+
|
|
198
|
+
Edge types include: `calls`, `imports`, `defines`, `tests`, `routes`, `implements`, `extends`, `depends_on`, `owns`, `modified_by`, `contains`, `composes`, `flows_through`, `triggers`, `syncs_with`, `affects`.
|
|
199
|
+
|
|
200
|
+
---
|
|
94
201
|
|
|
95
|
-
|
|
202
|
+
## Safety Layer
|
|
96
203
|
|
|
97
|
-
|
|
204
|
+
### Policy Engine
|
|
98
205
|
|
|
206
|
+
Configure safety rules in `.kuma/policy.yml`:
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
rules:
|
|
210
|
+
- name: "No production databases"
|
|
211
|
+
pattern: "DROP TABLE|DELETE FROM.*WHERE 1"
|
|
212
|
+
action: block
|
|
213
|
+
message: "Production database modifications blocked"
|
|
214
|
+
|
|
215
|
+
- name: "Require tests before deploy"
|
|
216
|
+
pattern: "git push"
|
|
217
|
+
require: "kuma_safety({ action: 'verify' })"
|
|
218
|
+
message: "Run tests before pushing"
|
|
99
219
|
```
|
|
100
|
-
|
|
220
|
+
|
|
221
|
+
### Audit Trail
|
|
222
|
+
|
|
223
|
+
Every safety check is logged to the audit trail:
|
|
224
|
+
- Tool name and parameters
|
|
225
|
+
- Risk level (low/medium/high/critical)
|
|
226
|
+
- Policy violations
|
|
227
|
+
- Allowed/blocked decision
|
|
228
|
+
- Duration and metadata
|
|
229
|
+
|
|
230
|
+
### Multi-Agent Lock
|
|
231
|
+
|
|
232
|
+
Prevent conflicts when multiple agents work on the same project:
|
|
233
|
+
```bash
|
|
234
|
+
kuma_safety({ action: 'lock', acquire: true })
|
|
235
|
+
# ... work ...
|
|
236
|
+
kuma_safety({ action: 'lock', release: true })
|
|
101
237
|
```
|
|
102
238
|
|
|
103
239
|
---
|
|
104
240
|
|
|
105
|
-
##
|
|
241
|
+
## Workflow
|
|
106
242
|
|
|
107
|
-
|
|
243
|
+
A typical Kuma-powered session follows this flow:
|
|
108
244
|
|
|
109
|
-
|
|
245
|
+
```
|
|
246
|
+
1. INIT → kuma_context({ action: 'init' })
|
|
247
|
+
Load project brief, restore session context
|
|
110
248
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
| `init` | Project brief | **Call first every session.** Load graph, detect stack, show structure. |
|
|
114
|
-
| `research` | 5-step pipeline | **WAJIB before editing.** Cache → staleness → graph → impact → decisions. |
|
|
115
|
-
| `impact` | Graph traversal | "Change validateToken → 42 refs, 15 files, 3 tests, 2 API routes." |
|
|
116
|
-
| `navigate` | BFS traversal | "How does login work?" — full call chain from route to database. |
|
|
117
|
-
| `changes` | Change log query | "What changed this session?" — selective undo support. |
|
|
118
|
-
| `health` | Aggregate scoring | Project health dashboard 0-100 across 9 dimensions. |
|
|
119
|
-
| `rollback` | File restore | Rollback a specific change by ID from the change log. |
|
|
120
|
-
| `researches` | Cache list | List all cached research scopes with confidence & age. |
|
|
121
|
-
| `sync` | Unified batch | Combines init + health + memory state in single roundtrip (~60-70% token savings). |
|
|
122
|
-
| `visualize` | Mermaid diagram | Generate interactive knowledge graph diagrams (flowchart, dependency, mindmap). |
|
|
123
|
-
| `digest` | Ultra-compact brief | <500 token project briefing — fastest way to bootstrap context (Issue #18). |
|
|
124
|
-
| `drift` | Staleness detection | Detect memory staleness & code drift between graph and actual filesystem (Issue #20). |
|
|
125
|
-
|
|
126
|
-
### 📝 `kuma_memory` — Decision & Knowledge
|
|
127
|
-
|
|
128
|
-
| Action | Use case |
|
|
129
|
-
|--------|----------|
|
|
130
|
-
| `decision` | ADR-style recording: template, suggest, or record. |
|
|
131
|
-
| `mine` | Mine historical decisions from git log & inline code comments. |
|
|
132
|
-
| `research_save` | Persist research to graph + `.kuma/research/<scope>.json`. |
|
|
133
|
-
| `session` | "What happened this session?" — files, failures, progress. |
|
|
134
|
-
| `heal` | Self-heal knowledge graph — stale detection, git repair. |
|
|
135
|
-
| `search` | Search across memories + knowledge graph (with TF-IDF hybrid semantic search). |
|
|
136
|
-
| `changes` | Change log for selective undo. |
|
|
137
|
-
| `todo` | Persistent todo CRUD — add, list, update status with scope & success criteria. |
|
|
138
|
-
| `context` | Inject context notes from external sources (Slack, Jira, meetings). |
|
|
139
|
-
| `benchmark` | Before/after metric capture & diff (e.g., type errors, test count). |
|
|
140
|
-
| `decision_log` | Living decision document with status tracking (active/superseded/deprecated). |
|
|
141
|
-
| `domain_rules` | Layer 1 — Business/domain rules knowledge (Issue #17). |
|
|
142
|
-
| `arch_flow` | Layer 2 — Architecture flow mapping (Issue #17). |
|
|
143
|
-
| `gotcha` | Layer 3 — Known gotchas & anti-regression shield (Issue #17/#21). |
|
|
144
|
-
| `layers` | Show all 3 memory layers summary. |
|
|
145
|
-
| `delete_node` | Delete specific node or record from disk & RAM immediately. |
|
|
146
|
-
| `graph_health` | Monitor knowledge graph health, orphan nodes, and duplicate groups. |
|
|
249
|
+
2. RESEARCH → kuma_context({ action: 'research', scope: '<area>' })
|
|
250
|
+
5-step pipeline: cache → graph → impact → decision → safety
|
|
147
251
|
|
|
148
|
-
|
|
252
|
+
3. GUARD → kuma_safety({ action: 'guard' })
|
|
253
|
+
Check for anti-patterns, drift, runaway loops
|
|
254
|
+
|
|
255
|
+
4. EDIT → Agent modifies code (native tools)
|
|
149
256
|
|
|
150
|
-
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
| `security` | Security leak scanner — regex-based credential/token detection. |
|
|
160
|
-
| `gc` | Kuma garbage collection — orphan cleanup, VACUUM, index maintenance. |
|
|
161
|
-
| `doctor` | Kuma health diagnostics — DB integrity, schema health, process status, verification history. |
|
|
162
|
-
| `portability` | Check path portability — no absolute paths in stored data. |
|
|
163
|
-
| `gitignore` | Auto-configure `.gitignore` to include `.kuma/`. |
|
|
164
|
-
| `clean` | Purge scratch directory + reset drift warnings. |
|
|
165
|
-
| `policy` | Policy-as-Code engine — evaluate commands against `.kuma/policy.yml` (Issue #24). |
|
|
166
|
-
| `ast` / `validate` | AST-based code validation — validate JS/TS code structure & patterns (Issue #22). |
|
|
257
|
+
5. RECORD → kuma_memory({ action: 'gotcha' | 'arch_flow' | 'decision' })
|
|
258
|
+
Record what was learned for future sessions
|
|
259
|
+
|
|
260
|
+
6. VERIFY → kuma_safety({ action: 'verify' })
|
|
261
|
+
Auto-run scoped tests + AST validation
|
|
262
|
+
|
|
263
|
+
7. REVIEW → kuma_context({ action: 'changes' })
|
|
264
|
+
Review what was modified this session
|
|
265
|
+
```
|
|
167
266
|
|
|
168
267
|
---
|
|
169
268
|
|
|
170
|
-
##
|
|
269
|
+
## Per-Project Context Model
|
|
171
270
|
|
|
172
|
-
|
|
271
|
+
Kuma stores all context locally in `.kuma/`:
|
|
173
272
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
273
|
+
```
|
|
274
|
+
.kuma/
|
|
275
|
+
├── kuma.db # SQLite knowledge graph (WASM)
|
|
276
|
+
├── init.md # Project-specific behavioral rules
|
|
277
|
+
├── policy.yml # Safety policies
|
|
278
|
+
├── memory.json # Session metrics and recordings
|
|
279
|
+
├── research/ # Research cache files
|
|
280
|
+
├── memories/ # Memory layer files (domain_rules, arch_flow, gotcha)
|
|
281
|
+
└── checkpoints/ # Atomic snapshots for rollback
|
|
282
|
+
```
|
|
179
283
|
|
|
180
|
-
**
|
|
181
|
-
- **Record `arch_flow`** after tracing a complete flow (max 5 core files) & **`gotcha`** inline when bugs are found
|
|
182
|
-
- **Record** `decision` + `research_save` when relevant
|
|
183
|
-
- **NEVER record** function/class/component nodes via MCP — native grep is faster
|
|
184
|
-
- Let the auto-scanner handle structural nodes during research step 3
|
|
284
|
+
**Key principle:** Context is per-project, per-agent. No shared state between projects.
|
|
185
285
|
|
|
186
286
|
---
|
|
187
287
|
|
|
188
|
-
##
|
|
288
|
+
## Why Kuma?
|
|
189
289
|
|
|
190
|
-
|
|
290
|
+
| Problem | Without Kuma | With Kuma |
|
|
291
|
+
|---------|--------------|-----------|
|
|
292
|
+
| **Context** | Agent forgets project-specific patterns | Knowledge graph persists across sessions |
|
|
293
|
+
| **Safety** | Agent may break critical code | Policy engine blocks risky operations |
|
|
294
|
+
| **Impact** | Agent doesn't know what's affected | Impact analysis traces dependencies |
|
|
295
|
+
| **Coordination** | Multiple agents conflict | Multi-agent lock prevents collisions |
|
|
296
|
+
| **Memory** | Agent repeats past mistakes | Decision memory + gotchas prevent loops |
|
|
297
|
+
| **Reversibility** | Hard to undo changes | Selective undo at symbol level |
|
|
298
|
+
| **Staleness** | Knowledge becomes outdated | Self-healing detects and repairs stale data |
|
|
191
299
|
|
|
192
|
-
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Installation
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Global install
|
|
306
|
+
npm install -g @plumpslabs/kuma
|
|
307
|
+
|
|
308
|
+
# Or use npx (no install needed)
|
|
309
|
+
npx -y @plumpslabs/kuma
|
|
310
|
+
|
|
311
|
+
# With pnpm
|
|
312
|
+
pnpm add -g @plumpslabs/kuma
|
|
313
|
+
```
|
|
193
314
|
|
|
194
|
-
|
|
195
|
-
- Syncs **anonymized** patterns (error types, tool names, language — no source code, no file names, no git history)
|
|
196
|
-
- Helps Kuma learn patterns across projects ("this error pattern is common in Go projects")
|
|
197
|
-
- Data goes to **your own VPS**, not a public server
|
|
315
|
+
### Requirements
|
|
198
316
|
|
|
199
|
-
|
|
317
|
+
- Node.js >= 18.0.0
|
|
318
|
+
- No native dependencies (uses WASM for SQLite)
|
|
200
319
|
|
|
201
320
|
---
|
|
202
321
|
|
|
203
|
-
##
|
|
322
|
+
## CLI Commands
|
|
204
323
|
|
|
205
|
-
|
|
324
|
+
```bash
|
|
325
|
+
# Start MCP server (default)
|
|
326
|
+
kuma
|
|
206
327
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
├── src/
|
|
210
|
-
├── tests/
|
|
211
|
-
└── .kuma/ ← Auto-generated by Kuma
|
|
212
|
-
├── kuma.db ← Knowledge graph, research cache, audit trail, change log
|
|
213
|
-
├── init.md ← Behavioral rules for the AI agent
|
|
214
|
-
├── config.json ← Per-project settings
|
|
215
|
-
├── policy.yml ← Safety policy
|
|
216
|
-
├── research/ ← Research records (one JSON per scope)
|
|
217
|
-
└── memories/ ← Persistent decisions, conventions, glossary
|
|
218
|
-
```
|
|
328
|
+
# Start Kuma Studio dashboard
|
|
329
|
+
kuma studio
|
|
219
330
|
|
|
220
|
-
|
|
331
|
+
# Initialize a project
|
|
332
|
+
kuma init
|
|
221
333
|
|
|
222
|
-
|
|
334
|
+
# Show version
|
|
335
|
+
kuma --version
|
|
336
|
+
|
|
337
|
+
# Show help
|
|
338
|
+
kuma --help
|
|
339
|
+
```
|
|
223
340
|
|
|
224
341
|
---
|
|
225
342
|
|
|
226
|
-
##
|
|
343
|
+
## Configuration
|
|
344
|
+
|
|
345
|
+
### MCP Client Configuration
|
|
227
346
|
|
|
228
|
-
|
|
347
|
+
Add to your MCP client config (e.g., Claude Desktop):
|
|
229
348
|
|
|
349
|
+
```json
|
|
350
|
+
{
|
|
351
|
+
"mcpServers": {
|
|
352
|
+
"kuma": {
|
|
353
|
+
"command": "npx",
|
|
354
|
+
"args": ["-y", "@plumpslabs/kuma"]
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
230
358
|
```
|
|
231
|
-
# 1. Understand the project
|
|
232
|
-
kuma_context({ action: "init", goal: "add password reset" })
|
|
233
359
|
|
|
234
|
-
|
|
235
|
-
kuma_context({ action: "research", scope: "auth" })
|
|
236
|
-
→ Returns: entry points, flow, 42 refs in 15 files, 3 tests, 2 decisions
|
|
360
|
+
### Environment Variables
|
|
237
361
|
|
|
238
|
-
|
|
362
|
+
| Variable | Description | Default |
|
|
363
|
+
|----------|-------------|---------|
|
|
364
|
+
| `KUMA_DB_PATH` | Custom database path | `.kuma/kuma.db` |
|
|
365
|
+
| `KUMA_POLICY_PATH` | Custom policy file | `.kuma/policy.yml` |
|
|
366
|
+
| `KUMA_STUDIO_PORT` | Studio server port | `3322` |
|
|
239
367
|
|
|
240
|
-
|
|
241
|
-
kuma_memory({ action: "research_save", scope: "auth", confidence: 0.85 })
|
|
368
|
+
---
|
|
242
369
|
|
|
243
|
-
|
|
244
|
-
kuma_memory({
|
|
245
|
-
action: "decision",
|
|
246
|
-
decisionAction: "record",
|
|
247
|
-
title: "Use JWT for password reset tokens",
|
|
248
|
-
context: "Need stateless tokens that expire in 15min",
|
|
249
|
-
rationale: "No session store needed, mobile-compatible",
|
|
250
|
-
outcome: "Implemented JwtPasswordResetService"
|
|
251
|
-
})
|
|
370
|
+
## Development
|
|
252
371
|
|
|
253
|
-
|
|
254
|
-
|
|
372
|
+
```bash
|
|
373
|
+
# Clone the repo
|
|
374
|
+
git clone https://github.com/plumpslabs/kuma.git
|
|
375
|
+
cd kuma
|
|
255
376
|
|
|
256
|
-
#
|
|
257
|
-
|
|
377
|
+
# Install dependencies
|
|
378
|
+
pnpm install
|
|
379
|
+
|
|
380
|
+
# Build
|
|
381
|
+
pnpm run build:all
|
|
382
|
+
|
|
383
|
+
# Run tests
|
|
384
|
+
pnpm test
|
|
385
|
+
|
|
386
|
+
# Start studio in dev mode
|
|
387
|
+
pnpm run studio:dev
|
|
258
388
|
```
|
|
259
389
|
|
|
260
390
|
---
|
|
261
391
|
|
|
262
|
-
##
|
|
392
|
+
## Power Curve: What to Record
|
|
263
393
|
|
|
264
|
-
|
|
|
265
|
-
|
|
266
|
-
|
|
|
267
|
-
|
|
|
268
|
-
|
|
|
269
|
-
|
|
|
270
|
-
|
|
|
271
|
-
|
|
|
272
|
-
|
|
|
394
|
+
| What to Record | When | Why | Impact |
|
|
395
|
+
|----------------|------|-----|--------|
|
|
396
|
+
| `arch_flow` | After tracing a complete flow | Saves 5-10 files next session | 🔴 Exponential |
|
|
397
|
+
| `gotcha` | IMMEDIATELY when finding bugs | Prevents re-discovery | 🔴 Exponential |
|
|
398
|
+
| `decision` | When choosing between options | Preserves rationale | 🔴 Exponential |
|
|
399
|
+
| `feature` | When identifying a module | Creates owns edges to files | 🔴 Exponential |
|
|
400
|
+
| `research_save` | After exploring an area | Creates search cache | 🔴 Exponential |
|
|
401
|
+
| Function/class nodes | Skip | Agent can grep/glob | 🟢 Skip |
|
|
402
|
+
| Import edges | Skip | Agent can read imports | 🟢 Skip |
|
|
403
|
+
| Visual graph | Skip | For humans, not AI | 🟢 Skip |
|
|
273
404
|
|
|
274
405
|
---
|
|
275
406
|
|
|
276
407
|
## License
|
|
277
408
|
|
|
278
|
-
MIT
|
|
409
|
+
MIT — use freely in personal and commercial projects.
|
|
279
410
|
|
|
280
|
-
|
|
411
|
+
---
|
|
281
412
|
|
|
282
|
-
|
|
413
|
+
## Community
|
|
283
414
|
|
|
284
|
-
[
|
|
415
|
+
- **GitHub:** [github.com/plumpslabs/kuma](https://github.com/plumpslabs/kuma)
|
|
416
|
+
- **Issues:** [github.com/plumpslabs/kuma/issues](https://github.com/plumpslabs/kuma/issues)
|
|
417
|
+
- **npm:** [npm.im/@plumpslabs/kuma](https://npm.im/@plumpslabs/kuma)
|
|
418
|
+
|
|
419
|
+
---
|
|
285
420
|
|
|
286
|
-
|
|
421
|
+
<p align="center">
|
|
422
|
+
<sub>Built with 🧠 by the Kuma community</sub>
|
|
423
|
+
</p>
|