@plumpslabs/kuma 2.3.32 → 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 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
- [![npm](https://img.shields.io/npm/v/@plumpslabs/kuma.svg?logo=npm&color=red)](https://www.npmjs.com/package/@plumpslabs/kuma)
10
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
11
- [![Node.js](https://img.shields.io/badge/node-18+-339933?logo=nodedotjs)](https://nodejs.org/)
8
+ **Safety-first context & orchestration engine for AI coding agents.**
12
9
 
13
- Works with **any MCP-compatible agent** — Claude Code, Cursor, Windsurf, Cline, Aider, OpenCode, Codex CLI, Qwen Code, Kiro, and more.
10
+ [![npm](https://img.shields.io/npm/v/@plumpslabs/kuma?color=amber)](https://npm.im/@plumpslabs/kuma)
11
+ [![license: MIT](https://img.shields.io/badge/license-MIT-amber.svg)](LICENSE)
12
+ [![node: >=18](https://img.shields.io/badge/node->=18-amber.svg)](https://nodejs.org)
14
13
 
15
- </div>
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 **MCP server** that sits alongside your AI coding agent and enforces a simple rule: *understand before you touch.*
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
- Kuma is **not** an editor, search tool, linter, or terminal. Those are things your AI agent already does natively. Kuma is the **safety layer** that makes sure those actions are informed, tracked, and reversible.
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
- **Think of it this way:** Your AI agent is the surgeon. Kuma is the pre-op checklist, the patient history, the X-ray, and the post-op report — all in one.
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
- ## Zero Setup?
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
- That's it. The MCP server starts. Your AI agent connects. Kuma auto-generates `.kuma/init.md` (behavioral rules), detects your AI agent, and creates its native skill file — automatically.
41
+ # Or install globally
42
+ npm install -g @plumpslabs/kuma
43
+ kuma
44
+ ```
40
45
 
41
- The "setup" part is optional: `npx @plumpslabs/kuma init` generates config files for 13 AI agents, but that's just convenience. Kuma works with any MCP client out of the box.
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 Features
54
+ ## Core Architecture: 3 Pipeline-Driven Tools
46
55
 
47
- ### 🧠 Knowledge Graph (SQLite)
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
- Every project gets its own SQLite database (pure WASM, no native build). Kuma builds a graph of **nodes** (files, functions, classes, tests, API routes) and **edges** (calls, imports, defines, tests). This graph is what powers all research, impact analysis, and flow navigation.
58
+ ### 🧠 `kuma_context` — Context & Research
50
59
 
51
- - FTS5 full-text search with graceful fallback
52
- - Auto-built, auto-healed, queryable
53
- - Per-project — your context stays with your codebase
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
- ### 🔬 Mandatory Research Pipeline
93
+ ### 🛡️ `kuma_safety` — Safety & Policy
56
94
 
57
- Before an agent edits unfamiliar code, Kuma enforces a 5-step research pipeline:
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
- | Step | What happens |
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
- All in one MCP call: `kuma_context({ action: "research", scope: "auth" })`. No chaining. No guesswork.
115
+ ## V3 Changes: What's New
68
116
 
69
- ### 🛡️ Safety Layer
117
+ Kuma V3 is a major evolution focusing on **simplicity, safety, and agent-native workflows**.
70
118
 
71
- | Feature | What it does |
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
- | **Safety Guard** | Anti-pattern detection, drift (edits without tests), tool-loop prevention, unresolved failure checks |
74
- | **Safety Policy** | YAML policy file (`.kuma/policy.yml`) — `never_touch`, `require_review`, `block_commands` |
75
- | **Safety Audit** | Every tool call recorded in SQLite. Queryable trail. Override logging with reasons. |
76
- | **Multi-Agent Lock** | File-level locks prevent multiple AI agents from editing the same file simultaneously |
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
- ### 📝 Decision Memory
147
+ ## Kuma Studio
79
148
 
80
- When Kuma detects a significant change, it can suggest recording an **ADR-style decision**:
149
+ Kuma Studio is a **web-based dashboard** for visualizing and managing your knowledge graph.
81
150
 
82
- ```
83
- Context: "We need stateless tokens that expire in 15min"
84
- Options: "JWT vs opaque tokens vs session store"
85
- Rationale: "JWT is mobile-compatible, no server-side store needed"
86
- Outcome: "Implemented JwtPasswordResetService"
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
- Saved to the knowledge graph + `.kuma/memories/decisions.md`. Survives across sessions. Readable by both humans and future AI agents.
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
- ### 🔄 Self-Healing
180
+ ## Knowledge Graph Schema
92
181
 
93
- The knowledge graph automatically detects stale nodes, repairs via git history (tracks renames), and reduces stale edge weights — all without manual intervention.
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
- ### ↩️ Selective Undo
202
+ ## Safety Layer
96
203
 
97
- Kuma tracks **symbol-level changes** per session. Instead of file-level rollback, you can see exactly what changed and revert specific modifications without affecting unrelated work:
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
- kuma_context({ action: "changes" }) → "Session 3 modified routes.ts:42-67 and db.ts"
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
- ## 3 Tools
241
+ ## Workflow
106
242
 
107
- Kuma consolidates everything into **3 coarse-grained tools**. Each action triggers a complete workflow internally — one MCP call, not a chain of micro-tools.
243
+ A typical Kuma-powered session follows this flow:
108
244
 
109
- ### 🧠 `kuma_context` — Context & Research
245
+ ```
246
+ 1. INIT → kuma_context({ action: 'init' })
247
+ Load project brief, restore session context
110
248
 
111
- | Action | Pipeline | Use case |
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
- ### 🛡️ `kuma_safety` — Safety & Policy
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
- | Action | Use case |
151
- |--------|----------|
152
- | `guard` | Anti-pattern, drift, tool-loop, and failure checks. |
153
- | `verify` | **SAFETY-GUARDED** on-demand test verification — only runs via explicit tool call. Auto-detects runner (pnpm/npm/yarn/pytest/cargo/go), scopes to session changes, rate-limited (30s handler + 60s verifier cooldown), concurrency-locked (intra-process + cross-process file lock), cached (< 5 min returns stale result), runaway-protected (> 3 calls in 5 min auto-blocks), hard timeout (30s + SIGKILL). ⚠️ NEVER auto-triggered — only via explicit `kuma_safety({ action: "verify" })`. |
154
- | `check` | Pre-execution safety: policy, path, lock, risk level. |
155
- | `audit` | Query audit trail + stats + override log. |
156
- | `lock` | Multi-agent file locking. |
157
- | `health` | Safety score 0-100 with dimension breakdown. |
158
- | `override` | Logged safety bypass with reason. |
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
- ## 🔥 Power Curve — What Matters Most
269
+ ## Per-Project Context Model
171
270
 
172
- Not all recordings are equal. Kuma categorizes actions by their long-term impact:
271
+ Kuma stores all context locally in `.kuma/`:
173
272
 
174
- | Tier | Actions | Impact | Why |
175
- |------|---------|--------|-----|
176
- | 🔥 **Exponential** | `arch_flow` + `gotcha` | **High signal architecture & bug shield** | Complete architecture flows (max 5 core files) save massive file-reading next session. Gotchas prevent bug re-discovery. |
177
- | 🟡 **Linear** | `decision` + `research_save` | **Useful but not multiplicative** | Decisions preserve rationale context. Research saves create searchable cache. |
178
- | 🟢 **SKIP** | Function/class/component nodes | **Not worth MCP call — grep is faster** | Use `grep funcName(`, `grep class ClassName`, `glob **/*Component*` instead |
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
- **Rule of thumb:**
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
- ## VPS / Collective — What Is It?
288
+ ## Why Kuma?
189
289
 
190
- Kuma has an optional feature called **Kolektif** — collective intelligence. It lets multiple Kuma instances across different projects share anonymized patterns to your own VPS.
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
- **This is entirely optional.** You never need to set it up. Kuma works perfectly fine with zero infrastructure — just local SQLite.
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
- What it does:
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
- When not configured, Kuma is 100% local. No data leaves your machine.
317
+ - Node.js >= 18.0.0
318
+ - No native dependencies (uses WASM for SQLite)
200
319
 
201
320
  ---
202
321
 
203
- ## Context Model: Per-Project
322
+ ## CLI Commands
204
323
 
205
- Kuma stores context **per project** in a `.kuma/` directory at your project root:
324
+ ```bash
325
+ # Start MCP server (default)
326
+ kuma
206
327
 
207
- ```
208
- your-project/
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
- This means **every project has its own context**. The auth flow in Project A is different from Project B. The knowledge graph, decisions, and research are all project-specific — never mixed.
331
+ # Initialize a project
332
+ kuma init
221
333
 
222
- The VPS collective (optional) is the only cross-project feature, and it only shares anonymized patterns — never code or project-specific context.
334
+ # Show version
335
+ kuma --version
336
+
337
+ # Show help
338
+ kuma --help
339
+ ```
223
340
 
224
341
  ---
225
342
 
226
- ## Workflow
343
+ ## Configuration
344
+
345
+ ### MCP Client Configuration
227
346
 
228
- A typical Kuma-powered session:
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
- # 2. Research before touching code (WAJIB)
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
- # 3. Agent edits using native tools (Claude Code / Cursor / etc.)
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
- # 4. Save what you learned
241
- kuma_memory({ action: "research_save", scope: "auth", confidence: 0.85 })
368
+ ---
242
369
 
243
- # 5. Record significant decisions
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
- # 6. Verify nothing broke
254
- kuma_safety({ action: "guard", guardGoal: "add password reset" })
372
+ ```bash
373
+ # Clone the repo
374
+ git clone https://github.com/plumpslabs/kuma.git
375
+ cd kuma
255
376
 
256
- # 7. Check changes for selective undo awareness
257
- kuma_context({ action: "changes" })
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
- ## Why Kuma?
392
+ ## Power Curve: What to Record
263
393
 
264
- | Need | Problem | Kuma's Answer |
265
- |------|---------|---------------|
266
- | Context | AI agent forgets what happened last session | Knowledge graph + session memory survive across sessions |
267
- | Safety | AI agent edits the wrong file | Policy enforcement + path validation + audit trail |
268
- | Impact | "If I change this, what breaks?" | Graph-based impact analysis — references, tests, API routes |
269
- | Coordination | Two agents editing the same file | Multi-agent file lock |
270
- | Memory | "Why was this decision made?" | ADR-style decision recording, trigger-based |
271
- | Reversibility | "Undo this change, but not that one" | Selective undo via change log |
272
- | Staleness | Graph data is months old | Self-healing with content hash + git-aware repair |
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
- <div align="center">
411
+ ---
281
412
 
282
- **Made with 🐻 for AI agents everywhere**
413
+ ## Community
283
414
 
284
- [Report Bug](https://github.com/plumpslabs/kuma/issues) · [Request Feature](https://github.com/plumpslabs/kuma/issues)
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
- </div>
421
+ <p align="center">
422
+ <sub>Built with 🧠 by the Kuma community</sub>
423
+ </p>