@plumpslabs/kuma 2.3.26 → 2.3.28
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 +2 -2
- package/dist/index.js +49 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,12 +173,12 @@ Not all recordings are equal. Kuma categorizes actions by their long-term impact
|
|
|
173
173
|
|
|
174
174
|
| Tier | Actions | Impact | Why |
|
|
175
175
|
|------|---------|--------|-----|
|
|
176
|
-
| 🔥 **Exponential** | `arch_flow` + `gotcha` | **
|
|
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
177
|
| 🟡 **Linear** | `decision` + `research_save` | **Useful but not multiplicative** | Decisions preserve rationale context. Research saves create searchable cache. |
|
|
178
178
|
| 🟢 **SKIP** | Function/class/component nodes | **Not worth MCP call — grep is faster** | Use `grep funcName(`, `grep class ClassName`, `glob **/*Component*` instead |
|
|
179
179
|
|
|
180
180
|
**Rule of thumb:**
|
|
181
|
-
- **
|
|
181
|
+
- **Record `arch_flow`** after tracing a complete flow (max 5 core files) & **`gotcha`** inline when bugs are found
|
|
182
182
|
- **Record** `decision` + `research_save` when relevant
|
|
183
183
|
- **NEVER record** function/class/component nodes via MCP — native grep is faster
|
|
184
184
|
- Let the auto-scanner handle structural nodes during research step 3
|
package/dist/index.js
CHANGED
|
@@ -2438,6 +2438,22 @@ async function upsertNode(node) {
|
|
|
2438
2438
|
db.run(`INSERT INTO nodes_fts (rowid, name, metadata) VALUES (last_insert_rowid(), ?, ?)`, [node.name, metadata]);
|
|
2439
2439
|
} catch {
|
|
2440
2440
|
}
|
|
2441
|
+
if (node.filePath && node.type !== "file") {
|
|
2442
|
+
const fileNodeId = nodeId("file", node.filePath);
|
|
2443
|
+
try {
|
|
2444
|
+
db.run(`
|
|
2445
|
+
INSERT INTO nodes (id, type, name, file_path, metadata, updated_at)
|
|
2446
|
+
VALUES (?, 'file', ?, ?, '{}', strftime('%s','now'))
|
|
2447
|
+
ON CONFLICT(id) DO NOTHING
|
|
2448
|
+
`, [fileNodeId, node.filePath, node.filePath]);
|
|
2449
|
+
db.run(`
|
|
2450
|
+
INSERT INTO edges (source_id, target_id, type, weight, metadata, created_at)
|
|
2451
|
+
VALUES (?, ?, 'contains', 1.0, '{}', strftime('%s','now'))
|
|
2452
|
+
ON CONFLICT DO NOTHING
|
|
2453
|
+
`, [fileNodeId, id]);
|
|
2454
|
+
} catch {
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2441
2457
|
saveDb(db);
|
|
2442
2458
|
try {
|
|
2443
2459
|
const countResult = db.exec("SELECT COUNT(*) FROM nodes");
|
|
@@ -6307,6 +6323,21 @@ async function addGotcha(entry) {
|
|
|
6307
6323
|
[entry.filePath, entry.description, severity, entry.workaround || null]
|
|
6308
6324
|
);
|
|
6309
6325
|
const mdResult = appendToLayer("gotcha", formatted);
|
|
6326
|
+
try {
|
|
6327
|
+
const { upsertNode: upsertNode2, addEdge: addEdge2, nodeId: nodeId2 } = await Promise.resolve().then(() => (init_kumaGraph(), kumaGraph_exports));
|
|
6328
|
+
const fileNodeId = nodeId2("file", entry.filePath);
|
|
6329
|
+
const gotchaNodeId = `gotcha::${entry.filePath}::${entry.description.substring(0, 30)}`;
|
|
6330
|
+
await upsertNode2({ id: fileNodeId, type: "file", name: entry.filePath });
|
|
6331
|
+
await upsertNode2({
|
|
6332
|
+
id: gotchaNodeId,
|
|
6333
|
+
type: "gotcha",
|
|
6334
|
+
name: `gotcha:${entry.description.substring(0, 40)}`,
|
|
6335
|
+
filePath: entry.filePath,
|
|
6336
|
+
metadata: { severity, workaround: entry.workaround }
|
|
6337
|
+
});
|
|
6338
|
+
await addEdge2({ sourceId: fileNodeId, targetId: gotchaNodeId, type: "depends_on" });
|
|
6339
|
+
} catch {
|
|
6340
|
+
}
|
|
6310
6341
|
saveDb();
|
|
6311
6342
|
sessionMemory.recordToolCall("kuma_gotcha_add", {
|
|
6312
6343
|
filePath: entry.filePath,
|
|
@@ -7940,7 +7971,7 @@ function opencodeAgentsMdTemplate() {
|
|
|
7940
7971
|
' 9. `kuma_kuma_safety({ action: "verify", ... })` \u2014 Run tests / confirm nothing broken',
|
|
7941
7972
|
' 10. `kuma_kuma_context({ action: "changes" })` \u2014 Review session activity',
|
|
7942
7973
|
"",
|
|
7943
|
-
"\u{1F525} **Power Curve:** `arch_flow` + `gotcha` are EXPONENTIAL \u2014
|
|
7974
|
+
"\u{1F525} **Power Curve:** `arch_flow` + `gotcha` are EXPONENTIAL \u2014 arch_flow records complete flow (max 5 core files), gotcha records bugs inline.",
|
|
7944
7975
|
" The more you record, the more overpowered the agent becomes. These are the highest-value actions.",
|
|
7945
7976
|
"\u{1F7E2} **SKIP** recording function/class/component nodes \u2014 grep/glob is faster.",
|
|
7946
7977
|
"\u{1F9E0} Knowledge graph is persistent \u2014 nodes/edges accumulate across sessions, getting richer over time.",
|
|
@@ -8051,12 +8082,12 @@ function antigravitySkillTemplate() {
|
|
|
8051
8082
|
" 4. *(edit/read using native tools)*",
|
|
8052
8083
|
' 5. `kuma_kuma_memory({ action: "research_save", ... })` \u2014 After exploring area (creates search cache)',
|
|
8053
8084
|
' 6. `kuma_kuma_memory({ action: "gotcha" })` \u2014 \u{1F525} IMMEDIATELY when bug found (exponential value)',
|
|
8054
|
-
' 7. `kuma_kuma_memory({ action: "arch_flow" })` \u2014
|
|
8085
|
+
' 7. `kuma_kuma_memory({ action: "arch_flow" })` \u2014 After tracing COMPLETE flow, max 5 core files',
|
|
8055
8086
|
' 8. `kuma_kuma_memory({ action: "decision" })` \u2014 When choosing between options (preserves rationale)',
|
|
8056
8087
|
' 9. `kuma_kuma_safety({ action: "verify", ... })` \u2014 Run tests / confirm nothing broken',
|
|
8057
8088
|
' 10. `kuma_kuma_context({ action: "changes" })` \u2014 Review session activity',
|
|
8058
8089
|
"",
|
|
8059
|
-
"\u{1F525} **Power Curve:** `arch_flow` + `gotcha` are EXPONENTIAL \u2014
|
|
8090
|
+
"\u{1F525} **Power Curve:** `arch_flow` + `gotcha` are EXPONENTIAL \u2014 arch_flow records complete flow (max 5 core files), gotcha records bugs inline.",
|
|
8060
8091
|
" The more you record, the more overpowered the agent becomes. These are the highest-value actions.",
|
|
8061
8092
|
"\u{1F7E2} **SKIP** recording function/class/component nodes \u2014 grep/glob is faster.",
|
|
8062
8093
|
"\u{1F9E0} Knowledge graph is persistent \u2014 nodes/edges accumulate across sessions, getting richer over time.",
|
|
@@ -8146,6 +8177,11 @@ function generateInitMdContent() {
|
|
|
8146
8177
|
"> \u2022 Inline Recording = primary method. You (the agent) record findings as you read/grep/edit.",
|
|
8147
8178
|
"> \u2022 Non-TS/JS projects (Go, Ruby, Python, Rust, PHP) rely ENTIRELY on inline recording.",
|
|
8148
8179
|
"",
|
|
8180
|
+
"> \u{1F6E1}\uFE0F **Node Idempotency & Relational Integrity (Anti-Duplication & No Orphans):**",
|
|
8181
|
+
"> \u2022 **Zero Duplicate Risk:** `research_save` and `add_node` are fully idempotent. Re-saving an existing scope/file updates metadata and timestamp without duplicating nodes.",
|
|
8182
|
+
"> \u2022 **Zero Orphan Guarantee:** Every node created with a `filePath` or `scope` is automatically linked via a `contains` or `depends_on` edge to its parent file node.",
|
|
8183
|
+
"> \u2022 **Always Connected:** Avoid recording standalone orphan entities; link findings to a core business domain or file path.",
|
|
8184
|
+
"",
|
|
8149
8185
|
"**AUTO-RECORDED (cold start scanner \u2014 TS/JS only):**",
|
|
8150
8186
|
"- Files, Functions, Classes \u2192 scanned during research step 3",
|
|
8151
8187
|
"- Imports, Calls, Extends \u2192 scanned edges",
|
|
@@ -8395,7 +8431,7 @@ function generateInitMdContent() {
|
|
|
8395
8431
|
" --- EDIT/READ (use native tools) ---",
|
|
8396
8432
|
" 5. kuma_memory \u2192 research_save \u2014 After exploring area (creates search cache)",
|
|
8397
8433
|
" 6. kuma_memory \u2192 gotcha \u2014 \u{1F525} IMMEDIATELY when bug found (exponential)",
|
|
8398
|
-
" 7. kuma_memory \u2192 arch_flow \u2014
|
|
8434
|
+
" 7. kuma_memory \u2192 arch_flow \u2014 After tracing COMPLETE flow (max 5 core files)",
|
|
8399
8435
|
" 8. kuma_memory \u2192 decision \u2014 When choosing (preserves rationale)",
|
|
8400
8436
|
" 9. kuma_safety \u2192 verify \u2014 Run tests / confirm nothing broken",
|
|
8401
8437
|
" 10. kuma_context \u2192 changes \u2014 Review session activity",
|
|
@@ -8532,7 +8568,7 @@ function handleOpencodeSecondary(root, results) {
|
|
|
8532
8568
|
" 4. *(edit/read using native tools)*",
|
|
8533
8569
|
' 5. `kuma_kuma_memory({ action: "research_save", ... })` \u2014 After exploring area (creates search cache)',
|
|
8534
8570
|
' 6. `kuma_kuma_memory({ action: "gotcha" })` \u2014 \u{1F525} IMMEDIATELY when bug found (exponential)',
|
|
8535
|
-
' 7. `kuma_kuma_memory({ action: "arch_flow" })` \u2014
|
|
8571
|
+
' 7. `kuma_kuma_memory({ action: "arch_flow" })` \u2014 After tracing COMPLETE flow, max 5 core files',
|
|
8536
8572
|
' 8. `kuma_kuma_memory({ action: "decision" })` \u2014 When choosing (preserves rationale)',
|
|
8537
8573
|
' 9. `kuma_kuma_safety({ action: "verify", ... })` \u2014 Run tests / confirm nothing broken',
|
|
8538
8574
|
' 10. `kuma_kuma_context({ action: "changes" })` \u2014 Review session activity',
|
|
@@ -8663,7 +8699,7 @@ function getCombinedAgentsMd(selectedTypes) {
|
|
|
8663
8699
|
" 4. *(edit/read using native tools)*",
|
|
8664
8700
|
' 5. `[kuma_]memory({ action: "research_save", ... })` \u2014 After exploring area (creates search cache)',
|
|
8665
8701
|
' 6. `[kuma_]memory({ action: "gotcha" })` \u2014 \u{1F525} IMMEDIATELY when bug found (exponential)',
|
|
8666
|
-
' 7. `[kuma_]memory({ action: "arch_flow" })` \u2014
|
|
8702
|
+
' 7. `[kuma_]memory({ action: "arch_flow" })` \u2014 After tracing COMPLETE flow (max 5 core files)',
|
|
8667
8703
|
' 8. `[kuma_]memory({ action: "decision" })` \u2014 When choosing (preserves rationale)',
|
|
8668
8704
|
' 9. `[kuma_]safety({ action: "verify", ... })` \u2014 Run tests / confirm nothing broken',
|
|
8669
8705
|
' 10. `[kuma_]context({ action: "changes" })` \u2014 Review session activity',
|
|
@@ -9308,7 +9344,7 @@ var init_init = __esm({
|
|
|
9308
9344
|
' 9. `kuma_safety({ action: "verify", ... })` \u2014 Run tests / confirm nothing broken',
|
|
9309
9345
|
' 10. `kuma_context({ action: "changes" })` \u2014 Review session activity',
|
|
9310
9346
|
"",
|
|
9311
|
-
"\u{1F525} **Power Curve:** `arch_flow` + `gotcha` are EXPONENTIAL \u2014
|
|
9347
|
+
"\u{1F525} **Power Curve:** `arch_flow` + `gotcha` are EXPONENTIAL \u2014 arch_flow records complete flow (max 5 core files), gotcha records bugs inline.",
|
|
9312
9348
|
" The more you record, the more overpowered the agent becomes. These are the highest-value actions.",
|
|
9313
9349
|
"\u{1F7E2} **SKIP** recording function/class/component nodes \u2014 grep/glob is faster.",
|
|
9314
9350
|
"\u{1F9E0} Knowledge graph is persistent \u2014 nodes/edges accumulate across sessions, getting richer over time.",
|
|
@@ -10595,6 +10631,11 @@ async function handleResearchSave(params) {
|
|
|
10595
10631
|
metadata = json_patch(COALESCE(nodes.metadata, '{}'), excluded.metadata),
|
|
10596
10632
|
updated_at = excluded.updated_at
|
|
10597
10633
|
`, [researchId, `research:${scope}`, JSON.stringify({ confidence: params.confidence || 0.8, last_findings: params.content || "" }), now]);
|
|
10634
|
+
db.run(`
|
|
10635
|
+
INSERT INTO edges (source_id, target_id, type, weight, metadata, created_at)
|
|
10636
|
+
VALUES (?, ?, 'contains', 1.0, '{}', ?)
|
|
10637
|
+
ON CONFLICT DO NOTHING
|
|
10638
|
+
`, [fileId, researchId, now]);
|
|
10598
10639
|
flushDb2(db);
|
|
10599
10640
|
} catch {
|
|
10600
10641
|
}
|
|
@@ -12424,7 +12465,7 @@ function registerAllTools(server) {
|
|
|
12424
12465
|
);
|
|
12425
12466
|
server.tool(
|
|
12426
12467
|
"kuma_memory",
|
|
12427
|
-
"**Call after research/editing** (including research-only). Record what matters, skip what doesn't.\n\n\u{1F534} MUST RECORD \u2014 High Impact (saves agent time next session):\n\u2022 STEP 5: `research_save` \u2014 after exploring area (creates search cache).\n\u2022 STEP 6: `gotcha` \u2014 IMMEDIATELY when you discover bugs/quirks. No re-research.\n\u2022 STEP 7: `arch_flow` \u2014
|
|
12468
|
+
"**Call after research/editing** (including research-only). Record what matters, skip what doesn't.\n\n\u{1F534} MUST RECORD \u2014 High Impact (saves agent time next session):\n\u2022 STEP 5: `research_save` \u2014 after exploring area (creates search cache).\n\u2022 STEP 6: `gotcha` \u2014 IMMEDIATELY when you discover bugs/quirks. No re-research.\n\u2022 STEP 7: `arch_flow` \u2014 AFTER tracing COMPLETE flow (max 5 core files).\n\u2022 STEP 8: `decision` \u2014 IMMEDIATELY when choosing between options. Preserves rationale.\n\n\u{1F7E2} SKIP using MCP (agent native tools are faster):\n\u2022 Function/class nodes \u2192 grep\n\u2022 Component/route nodes \u2192 glob or check directly\n\u2022 Import edges \u2192 read imports directly\n\u2022 Visual graph \u2192 for humans, not AI agents\n\nOther actions: session, heal, search, changes, benchmark, layers.",
|
|
12428
12469
|
{
|
|
12429
12470
|
action: z.enum(["decision", "mine", "research_save", "session", "heal", "search", "changes", "todo", "context", "benchmark", "decision_log", "domain_rules", "arch_flow", "gotcha", "layers", "add_node", "delete_node", "clear", "feature"]).describe("Memory action: decision=ADR, mine=mine git log & comments, research_save=save (creates file + graph node), session=summary, heal=repair, search=search (now with task retrieval + impact analysis), changes=log, todo=manage todos, context=inject notes, benchmark=capture/diff, decision_log=manage decisions, domain_rules=Layer 1 business rules, arch_flow=Layer 2 architecture flow (now auto-creates affects edges), gotcha=Layer 3 known gotchas, layers=all 3 layers summary, add_node=manually create function/class/component structural nodes, delete_node=delete a specific node/gotcha/todo/decision by ID or scope+target, clear=wipe all nodes/edges/gotchas, feature=record high-level feature with owns edges to files"),
|
|
12430
12471
|
scope: z.string().optional().describe("Scope for research_save/search/todo/context/mine"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumpslabs/kuma",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.28",
|
|
4
4
|
"description": "Safety-first context & orchestration engine for AI coding agents. MCP server with mandatory research pipeline, knowledge graph, impact analysis, decision memory, and safety guard — works with any MCP client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|