@plumpslabs/kuma 2.3.33 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md 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,101 +43,80 @@ 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
+ | `security` | Scan for leaked secrets/tokens | 🟡 Linear |
105
93
  | `gc` | Garbage collect stale data | đŸŸĸ Skip |
106
- | `doctor` | Full health check | 🟡 Linear |
107
- | `policy` | Policy-as-Code engine | 🟡 Linear |
108
94
  | `ast` / `validate` | AST-based code validation | 🟡 Linear |
109
95
  | `checkpoint` | Atomic snapshot before refactors | 🟡 Linear |
110
96
  | `rollback_label` | Restore from checkpoint | 🟡 Linear |
111
- | `contract` | Pre/post-condition checks | 🟡 Linear |
112
97
 
113
98
  ---
114
99
 
115
- ## V3 Changes: What's New
100
+ ## Architecture
116
101
 
117
- Kuma V3 is a major evolution focusing on **simplicity, safety, and agent-native workflows**.
102
+ Kuma exposes exactly **3 coarse-grained tools** — the agent picks an *action*, Kuma runs the internal workflow:
118
103
 
119
- ### Dropped Tools (Now Handled by Agents)
104
+ | Tool | Core Actions | Purpose |
105
+ |------|--------------|---------|
106
+ | `kuma_context` | `init`, `research`, `history` | Load project context, understand unfamiliar code |
107
+ | `kuma_memory` | `gotcha`, `decision`, `arch_flow`, `research_save` | Persistent knowledge that saves future sessions |
108
+ | `kuma_safety` | `guard`, `verify` | Pre-risk check, post-edit verification |
120
109
 
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 |
110
+ Everything else is an internal action for power users. The agent uses its **own native tools** for editing, searching, and execution — Kuma is memory & safety, not a code manager.
129
111
 
130
- ### New Features in V3
112
+ ### What Kuma Provides
131
113
 
132
- | Feature | Description |
133
- |---------|-------------|
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 |
114
+ - **Knowledge Graph** — SQLite + FTS5 full-text search (derived cache)
115
+ - **Session Memory** — track tool calls, recordings, and efficiency per session
116
+ - **Guard System** — real-time monitoring with blocking warnings for anti-patterns
117
+ - **Shadow Injection** — gotchas injected before edits via hooks (zero token waste when clean)
118
+ - **Kuma Studio** — visual dashboard with graph, gotchas, and injection metrics
119
+ - **Checkpoint/Rollback** — atomic snapshots before major refactors
144
120
 
145
121
  ---
146
122
 
@@ -151,12 +127,10 @@ Kuma Studio is a **web-based dashboard** for visualizing and managing your knowl
151
127
  ### Features
152
128
 
153
129
  - **📊 Knowledge Graph** — Interactive node-edge visualization with physics simulation
154
- - **⭐ Features** — High-level module tracking with owns edges to files
155
130
  - **âš ī¸ Gotchas** — Known bugs and quirks with severity levels
156
- - **💚 Health** — Project health scores over time
157
131
  - **⚡ Efficiency** — Session metrics, time saved, verification pass rates
132
+ - **đŸĒ„ Injections** — Shadow-memory metrics: injection count + time saved (24h)
158
133
  - **📈 Staleness** — Detection of stale nodes with missing file references
159
- - **🤖 Activity** — Agent usage intensity, success rates, and session history
160
134
 
161
135
  ### Usage
162
136
 
@@ -195,47 +169,20 @@ Kuma builds a comprehensive knowledge graph with these node types:
195
169
  | `test` | Test file |
196
170
  | `research` | Research cache entry |
197
171
 
198
- Edge types include: `calls`, `imports`, `defines`, `tests`, `routes`, `implements`, `extends`, `depends_on`, `owns`, `modified_by`, `contains`, `composes`, `flows_through`, `triggers`, `syncs_with`, `affects`.
172
+ Edge types include: `contains`, `flows_through`, `owns`, `explains`.
199
173
 
200
174
  ---
201
175
 
202
176
  ## Safety Layer
203
177
 
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
178
  ### Audit Trail
222
179
 
223
180
  Every safety check is logged to the audit trail:
224
181
  - Tool name and parameters
225
182
  - Risk level (low/medium/high/critical)
226
- - Policy violations
227
183
  - Allowed/blocked decision
228
184
  - Duration and metadata
229
185
 
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
186
  ---
240
187
 
241
188
  ## Workflow
@@ -272,15 +219,20 @@ Kuma stores all context locally in `.kuma/`:
272
219
 
273
220
  ```
274
221
  .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
222
+ ├── kuma.db # SQLite knowledge graph (WASM) — nodes, edges, research cache, changes
223
+ ├── init.md # Project behavioral rules (generated by `kuma init`)
224
+ ├── memory.json # Session state + metrics (auto)
225
+ ├── auto-gotcha.json # Self-learning loop state (auto)
226
+ ├── policy.yml # OPTIONAL safety policy — only read if you create it
227
+ ├── memories/ # Memory layer markdown (decisions.md, arch_flow.md, ...)
228
+ ├── checkpoints/ # Atomic snapshots (label/ with kuma.db + files/)
229
+ └── scratch/ # Temp debug artifacts (auto, ephemeral)
282
230
  ```
283
231
 
232
+ > Hooks are registered in `.claude/settings.json` (PreToolUse) — not stored under `.kuma/`.
233
+
234
+ > Research cache is **not** a folder — it lives in the `research_cache` table inside `kuma.db`.
235
+
284
236
  **Key principle:** Context is per-project, per-agent. No shared state between projects.
285
237
 
286
238
  ---
@@ -292,10 +244,10 @@ Kuma stores all context locally in `.kuma/`:
292
244
  | **Context** | Agent forgets project-specific patterns | Knowledge graph persists across sessions |
293
245
  | **Safety** | Agent may break critical code | Policy engine blocks risky operations |
294
246
  | **Impact** | Agent doesn't know what's affected | Impact analysis traces dependencies |
295
- | **Coordination** | Multiple agents conflict | Multi-agent lock prevents collisions |
247
+ | **Coordination** | Multiple agents conflict | Per-agent session state + audit trail avoid collisions |
296
248
  | **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 |
249
+ | **Reversibility** | Hard to undo changes | Checkpoint snapshots + selective undo |
250
+ | **Staleness** | Knowledge becomes outdated | Drift detection + gotcha staleness checks flag stale data |
299
251
 
300
252
  ---
301
253