@plumpslabs/kuma 2.3.33 → 2.3.34

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
@@ -2,7 +2,7 @@
2
2
  <div align="center">
3
3
 
4
4
  <img src="https://raw.githubusercontent.com/plumpslabs/kuma/main/public/kuma.png" alt="Kuma Logo" width="180" />
5
-
5
+ </div>
6
6
  # Kuma
7
7
 
8
8
  **Safety-first context & orchestration engine for AI coding agents.**
@@ -21,14 +21,11 @@ Kuma is an MCP (Model Context Protocol) server that acts as a **pre-modification
21
21
 
22
22
  **The Problem:** AI agents often modify code without understanding the full context — missing dependencies, breaking related features, or repeating past mistakes.
23
23
 
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
24
+ **The Solution:** Kuma is a **shadow memory** that injects *"where is this file fragile and why is it written this way"* right before the agent touches it:
25
+ - đŸĒ„ **Auto-inject hooks** — gotchas/decisions/history injected before every edit, zero extra steps
26
+ - 🧠 **Knowledge graph** — SQLite-based derived cache (hash-verified, never stale)
28
27
  - 📝 **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
+ - 📊 **Kuma Studio** — Visual dashboard for gotchas, decisions, and shadow-memory metrics
32
29
 
33
30
  ---
34
31
 
@@ -46,69 +43,58 @@ kuma
46
43
  Kuma auto-generates:
47
44
  - `.kuma/init.md` — Project-specific behavioral rules
48
45
  - `.kuma/kuma.db` — SQLite knowledge graph (WASM, zero native build)
49
- - `.kuma/policy.yml` — Customizable safety policies
50
46
  - `.skills/` — Skill files for common patterns
51
47
 
52
48
  ---
53
49
 
54
50
  ## Core Architecture: 3 Pipeline-Driven Tools
55
51
 
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.
52
+ Kuma provides **3 coarse-grained tools** with impactful actions. Removed gimmick actions (add_node, feature, heal, harvest, session_mine, todo, context, benchmark, domain_rules, layers, noise_policy, lock, override, policy, contract, portability, doctor, gitignore, clean, progressive, sync, visualize, researches) are no longer documented.
57
53
 
58
54
  ### 🧠 `kuma_context` — Context & Research
59
55
 
60
56
  | Action | Purpose | Impact |
61
57
  |--------|---------|--------|
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 |
58
+ | `init` | Lean project brief + restore session | 🔴 Required first |
59
+ | `research` | 5-step pipeline: cache → graph → scan → impact → decision | 🔴 Required before edits |
60
+ | `history` | Why is this file written this way (cross-session trace) | 🔴 High |
61
+ | `flow` | Hash-verified derived flow cache (F13) | 🔴 High |
62
+ | `impact` | Analyze change effects on related code | 🟡 Linear |
65
63
  | `navigate` | Trace code flow across files | 🟡 Linear |
66
64
  | `changes` | View change log for current session | 🟡 Linear |
67
- | `health` | Project health score (0-100) | 🟡 Linear |
68
65
  | `rollback` | Undo a specific change by ID | 🟡 Linear |
69
- | `sync` | Unified batch state query | đŸŸĸ Skip (agent native) |
70
66
  | `digest` | Ultra-compact <500 token project briefing | 🟡 Linear |
71
67
  | `drift` | Detect memory staleness & code drift | 🟡 Linear |
72
- | `progressive` | Progressive context loading | 🟡 Linear |
68
+ | `resume` | Load previous session context | 🟡 Linear |
73
69
 
74
70
  ### 💾 `kuma_memory` — Decision & Knowledge
75
71
 
76
72
  | Action | Purpose | Impact |
77
73
  |--------|---------|--------|
78
- | `research_save` | Save research findings to cache | 🔴 Exponential |
79
74
  | `gotcha` | Record bugs/quirks IMMEDIATELY | 🔴 Exponential |
80
75
  | `arch_flow` | Record architecture flow (max 5 core files) | 🔴 Exponential |
81
76
  | `decision` | Record ADR-style decision with rationale | 🔴 Exponential |
82
- | `feature` | Record high-level feature with owns edges | 🔴 Exponential |
77
+ | `research_save` | Save research findings to cache | 🟡 Linear |
83
78
  | `mine` | Mine git history for hidden decisions | 🟡 Linear |
84
79
  | `session` | View session summary | đŸŸĸ Skip |
85
- | `heal` | Repair stale graph entries | 🟡 Linear |
86
80
  | `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 |
81
+ | `delete_node` | Remove node/gotcha from graph + table | 🟡 Linear |
82
+ | `goal_progress` | Track goal completion | đŸŸĸ Skip |
92
83
 
93
- ### đŸ›Ąī¸ `kuma_safety` — Safety & Policy
84
+ ### đŸ›Ąī¸ `kuma_safety` — Safety & Verification
94
85
 
95
86
  | Action | Purpose | Impact |
96
87
  |--------|---------|--------|
97
88
  | `guard` | Detect anti-patterns, drift, runaway loops | 🔴 Required |
98
- | `verify` | Auto-run scoped tests + AST validation | 🔴 High |
89
+ | `verify` | Auto-run scoped tests after edits | 🔴 High |
99
90
  | `check` | Pre-execution safety check | 🟡 Linear |
100
91
  | `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 |
92
+ | `health` | Project health score (optional/cosmetic) | đŸŸĸ Skip |
93
+ | `security` | Scan for leaked secrets/tokens | 🟡 Linear |
105
94
  | `gc` | Garbage collect stale data | đŸŸĸ Skip |
106
- | `doctor` | Full health check | 🟡 Linear |
107
- | `policy` | Policy-as-Code engine | 🟡 Linear |
108
95
  | `ast` / `validate` | AST-based code validation | 🟡 Linear |
109
96
  | `checkpoint` | Atomic snapshot before refactors | 🟡 Linear |
110
97
  | `rollback_label` | Restore from checkpoint | 🟡 Linear |
111
- | `contract` | Pre/post-condition checks | 🟡 Linear |
112
98
 
113
99
  ---
114
100
 
@@ -133,13 +119,10 @@ Kuma V3 is a major evolution focusing on **simplicity, safety, and agent-native
133
119
  |---------|-------------|
134
120
  | **3 Coarse-Grained Tools** | Simplified API: `kuma_context`, `kuma_memory`, `kuma_safety` |
135
121
  | **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 |
122
+ | **Knowledge Graph** | SQLite + FTS5 full-text search with WASM engine (derived cache) |
138
123
  | **Session Memory** | Track tool calls, recordings, and efficiency per session |
139
124
  | **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` |
125
+ | **Kuma Studio** | Visual dashboard with graph, gotchas, and injection metrics |
143
126
  | **Checkpoint/Rollback** | Atomic snapshots before major refactors |
144
127
 
145
128
  ---
@@ -151,12 +134,10 @@ Kuma Studio is a **web-based dashboard** for visualizing and managing your knowl
151
134
  ### Features
152
135
 
153
136
  - **📊 Knowledge Graph** — Interactive node-edge visualization with physics simulation
154
- - **⭐ Features** — High-level module tracking with owns edges to files
155
137
  - **âš ī¸ Gotchas** — Known bugs and quirks with severity levels
156
- - **💚 Health** — Project health scores over time
157
138
  - **⚡ Efficiency** — Session metrics, time saved, verification pass rates
139
+ - **đŸĒ„ Injections** — Shadow-memory metrics: injection count + time saved (24h)
158
140
  - **📈 Staleness** — Detection of stale nodes with missing file references
159
- - **🤖 Activity** — Agent usage intensity, success rates, and session history
160
141
 
161
142
  ### Usage
162
143
 
@@ -195,47 +176,20 @@ Kuma builds a comprehensive knowledge graph with these node types:
195
176
  | `test` | Test file |
196
177
  | `research` | Research cache entry |
197
178
 
198
- Edge types include: `calls`, `imports`, `defines`, `tests`, `routes`, `implements`, `extends`, `depends_on`, `owns`, `modified_by`, `contains`, `composes`, `flows_through`, `triggers`, `syncs_with`, `affects`.
179
+ Edge types include: `contains`, `flows_through`, `owns`, `explains`.
199
180
 
200
181
  ---
201
182
 
202
183
  ## Safety Layer
203
184
 
204
- ### Policy Engine
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"
219
- ```
220
-
221
185
  ### Audit Trail
222
186
 
223
187
  Every safety check is logged to the audit trail:
224
188
  - Tool name and parameters
225
189
  - Risk level (low/medium/high/critical)
226
- - Policy violations
227
190
  - Allowed/blocked decision
228
191
  - Duration and metadata
229
192
 
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 })
237
- ```
238
-
239
193
  ---
240
194
 
241
195
  ## Workflow
@@ -272,15 +226,20 @@ Kuma stores all context locally in `.kuma/`:
272
226
 
273
227
  ```
274
228
  .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
229
+ ├── kuma.db # SQLite knowledge graph (WASM) — nodes, edges, research cache, changes
230
+ ├── init.md # Project behavioral rules (generated by `kuma init`)
231
+ ├── memory.json # Session state + metrics (auto)
232
+ ├── auto-gotcha.json # Self-learning loop state (auto)
233
+ ├── policy.yml # OPTIONAL safety policy — only read if you create it
234
+ ├── memories/ # Memory layer markdown (decisions.md, arch_flow.md, ...)
235
+ ├── checkpoints/ # Atomic snapshots (label/ with kuma.db + files/)
236
+ └── scratch/ # Temp debug artifacts (auto, ephemeral)
282
237
  ```
283
238
 
239
+ > Hooks are registered in `.claude/settings.json` (PreToolUse) — not stored under `.kuma/`.
240
+
241
+ > Research cache is **not** a folder — it lives in the `research_cache` table inside `kuma.db`.
242
+
284
243
  **Key principle:** Context is per-project, per-agent. No shared state between projects.
285
244
 
286
245
  ---
@@ -292,10 +251,10 @@ Kuma stores all context locally in `.kuma/`:
292
251
  | **Context** | Agent forgets project-specific patterns | Knowledge graph persists across sessions |
293
252
  | **Safety** | Agent may break critical code | Policy engine blocks risky operations |
294
253
  | **Impact** | Agent doesn't know what's affected | Impact analysis traces dependencies |
295
- | **Coordination** | Multiple agents conflict | Multi-agent lock prevents collisions |
254
+ | **Coordination** | Multiple agents conflict | Per-agent session state + audit trail avoid collisions |
296
255
  | **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 |
256
+ | **Reversibility** | Hard to undo changes | Checkpoint snapshots + selective undo |
257
+ | **Staleness** | Knowledge becomes outdated | Drift detection + gotcha staleness checks flag stale data |
299
258
 
300
259
  ---
301
260