sverklo 0.17.1 → 0.17.3

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,13 +2,18 @@
2
2
  <img src="./docs/logo.svg" alt="sverklo" width="280" height="79"/>
3
3
  </p>
4
4
 
5
- > **Stop your AI from making things up about your codebase.**
5
+ > **The only code-intel MCP with a published benchmark and reproducible eval harness.**
6
6
  > Local-first MCP server that gives Claude Code, Cursor, Windsurf, and Zed a real symbol graph, a blast-radius lens, and a git-pinned memory — so the agent stops guessing. MIT. Zero config. Your code never leaves the machine.
7
+ >
8
+ > [Paper (Zenodo, CC BY 4.0)](https://doi.org/10.5281/zenodo.19802051) · [bench:primitives](./benchmark/) — sverklo cuts agent context by **65 % vs grep** (255 vs 731 tokens per task, n=60) · [bench:swe](https://sverklo.com/blog/bench-swe-first-results/) — 38/65 perfect recall on 5 OSS repos, including the runs we lose.
7
9
 
8
10
  [![npm version](https://img.shields.io/npm/v/sverklo.svg?color=E85A2A)](https://www.npmjs.com/package/sverklo)
9
11
  [![npm downloads](https://img.shields.io/npm/dw/sverklo.svg?color=E85A2A)](https://www.npmjs.com/package/sverklo)
10
12
  [![License: MIT](https://img.shields.io/badge/license-MIT-E85A2A.svg)](LICENSE)
11
13
  [![Audited repos](https://img.shields.io/badge/audited_repos-47-E85A2A)](https://sverklo.com/report)
14
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19802051.svg)](https://doi.org/10.5281/zenodo.19802051)
15
+
16
+ ![Sverklo cuts agent context by 65 % vs grep — bench:primitives, 60 retrieval tasks, peer-reviewable](./docs/hero-token-comparison.png)
12
17
 
13
18
  ![Sverklo demo — audit and badge](./docs/demo.gif)
14
19
 
@@ -39,6 +44,18 @@ That's it. `sverklo init` auto-detects your installed AI coding agent (Claude Co
39
44
 
40
45
  ---
41
46
 
47
+ ## What's new in 0.17
48
+
49
+ - **`npm run bench:swe`** — third-party-reproducible cross-repo eval. Clones 5 OSS repos (express, nestjs, vite, prisma, fastapi), runs 65 grounded questions, prints aggregated recall. PRs that add questions are welcome.
50
+ - **Tree-sitter parser opt-in.** `sverklo grammars install` (~3.5 MB across 6 languages) + `SVERKLO_PARSER=tree-sitter` and the indexer routes through real ASTs for TypeScript/TSX/JavaScript/Python/Go/Rust. Silent regex fallback when grammars aren't installed. v0.18 plan to flip the default lives in [docs/parser-parity.md](./docs/parser-parity.md).
51
+ - **Workspace shared memory.** `sverklo workspace memory <name> add/list/search` plus `sverklo_remember scope:"workspace"` from the agent — write a decision once, query it from every other repo in the workspace. `sverklo_recall` blends workspace results under project ones with a `[ws]` badge.
52
+ - **`sverklo memory export`** — markdown / Notion / JSON. Migrate your team's decision log to wherever it actually lives.
53
+ - **PR-bot inline review.** `sverklo review --format github-review-json` + the action's new `inline-comments: true` default posts per-line review comments via `pulls.createReview`, alongside the existing sticky summary.
54
+ - **VS Code extension scaffold** at [`extensions/vscode/`](./extensions/vscode/) with a pre-built `sverklo-vscode-0.1.0.vsix`. Inline caller-count decorations on every function header (`⟵ 47 callers`). Marketplace publish workflow ships dormant; install with `code --install-extension extensions/vscode/sverklo-vscode-0.1.0.vsix` today.
55
+ - **`sverklo digest [--since 7d]`** — 5-line summary of audit-grade trend, new vs stale memories, and high-PageRank files touched. Wire into a shell-hook on `cd` for a daily sverklo check-in.
56
+
57
+ ---
58
+
42
59
  ## Grep vs Sverklo — the same question, side by side
43
60
 
44
61
  Every one of these is a query a real engineer asked a real AI assistant last week. Grep gives you lines. Sverklo gives you a ranked answer.
@@ -349,6 +366,26 @@ The open-core line: **Pro adds new things, never gates current things.** Anythin
349
366
  - [Issues](https://github.com/sverklo/sverklo/issues)
350
367
  - [First Run Guide](FIRST_RUN.md)
351
368
  - [Benchmarks](BENCHMARKS.md)
369
+ - [Paper (Zenodo, CC BY 4.0)](https://doi.org/10.5281/zenodo.19802051)
370
+
371
+ ## Citing Sverklo
372
+
373
+ If you use Sverklo or its benchmarks (`bench:primitives`, `bench:swe`) in research, please cite:
374
+
375
+ > Groshin, N. (2026). *Sverklo: A Local-First Code Intelligence MCP Server and a Cross-Repository Software Engineering Benchmark*. Zenodo. https://doi.org/10.5281/zenodo.19802051
376
+
377
+ BibTeX:
378
+
379
+ ```bibtex
380
+ @misc{groshin2026sverklo,
381
+ author = {Groshin, Nikita},
382
+ title = {{Sverklo}: A Local-First Code Intelligence {MCP} Server and a Cross-Repository Software Engineering Benchmark},
383
+ year = {2026},
384
+ publisher = {Zenodo},
385
+ doi = {10.5281/zenodo.19802051},
386
+ url = {https://doi.org/10.5281/zenodo.19802051}
387
+ }
388
+ ```
352
389
 
353
390
  ## License
354
391
 
@@ -51,7 +51,7 @@ if (command && command !== "--help" && command !== "-h") {
51
51
  dashboard: "Alias for `sverklo ui`.",
52
52
  wakeup: "Print compressed project context (for system-prompt injection in non-MCP clients).",
53
53
  digest: "5-line summary of what changed in this project. Flags: --since 7d, --format markdown|plain.",
54
- memory: "Manage the memory store. Subcommands: export.",
54
+ memory: "Manage the memory store. Subcommands: show, edit, export.",
55
55
  grammars: "Manage tree-sitter grammars for the SVERKLO_PARSER=tree-sitter opt-in path. Subcommands: install.",
56
56
  "audit-prompt": "Print a ready-to-paste codebase-audit prompt (hybrid agent workflow).",
57
57
  "review-prompt": "Print a ready-to-paste PR/MR-review prompt (hybrid agent workflow).",
@@ -66,7 +66,7 @@ if (command && command !== "--help" && command !== "-h") {
66
66
  prune: "", // prune already prints its own --help inside the block
67
67
  };
68
68
  // Pass-throughs: subcommands that handle --help themselves.
69
- const SELF_HANDLES_HELP = new Set(["prune"]);
69
+ const SELF_HANDLES_HELP = new Set(["prune", "memory"]);
70
70
  if (!SELF_HANDLES_HELP.has(command)) {
71
71
  const blurb = HELP_BLURBS[command];
72
72
  if (blurb) {
@@ -1396,20 +1396,184 @@ if (command === "grammars") {
1396
1396
  process.exit(errors.length > 0 ? 1 : 0);
1397
1397
  }
1398
1398
  if (command === "memory") {
1399
- // `sverklo memory export` — push the memory store out to markdown,
1400
- // Notion, or raw JSON. Closes the "memory is a private journal"
1401
- // gap from the v0.16 product teardown.
1399
+ // `sverklo memory` subcommands:
1400
+ // export — push memory rows to markdown/Notion/JSON files
1401
+ // show — print memory rows as markdown to stdout
1402
+ // edit — open memory rows in $EDITOR; round-trip content edits back
1403
+ // to SQLite. Never deletes by omission.
1402
1404
  const sub = args[1];
1403
- if (sub !== "export") {
1404
- console.log(`\nsverklo memory — export the memory store to other tools\n\n` +
1405
- `Usage:\n sverklo memory export --format markdown|notion|json --to PATH [flags]\n\n` +
1406
- `Flags:\n` +
1407
- ` --format markdown|notion|json output format (required)\n` +
1408
- ` --to PATH directory (markdown) or file (json/notion)\n` +
1409
- ` --kind episodic|semantic|procedural filter by cognitive axis (default: all)\n` +
1410
- ` --include-invalidated include superseded rows for the bi-temporal timeline\n` +
1411
- ` --notion-database ID target database id (required for --format notion)\n` +
1412
- ` -h, --help show this help\n`);
1405
+ if (sub !== "export" && sub !== "show" && sub !== "edit") {
1406
+ console.log(`\nsverklo memory — read, edit, and export the memory store\n\n` +
1407
+ `Subcommands:\n` +
1408
+ ` show print all memories as markdown to stdout\n` +
1409
+ ` edit open memories in $EDITOR; round-trip text edits back\n` +
1410
+ ` export write per-category .md files / JSON / push to Notion\n\n` +
1411
+ `Usage:\n` +
1412
+ ` sverklo memory show [--include-invalidated]\n` +
1413
+ ` sverklo memory edit [--editor PATH]\n` +
1414
+ ` sverklo memory export --format markdown|notion|json --to PATH [flags]\n\n` +
1415
+ `Run \`sverklo memory <subcommand> --help\` for the full flag list.\n`);
1416
+ process.exit(0);
1417
+ }
1418
+ if (sub === "show") {
1419
+ // Render every active memory as markdown to stdout. AI Edge's
1420
+ // "open Memory.md and read it" workflow, but driven by SQLite —
1421
+ // bi-temporal history, git provenance, no manual upkeep.
1422
+ const flags = args.slice(2);
1423
+ if (flags.includes("--help") || flags.includes("-h")) {
1424
+ console.log(`\nsverklo memory show — print memories as markdown to stdout\n\n` +
1425
+ `Flags:\n` +
1426
+ ` --include-invalidated include superseded rows (full bi-temporal timeline)\n` +
1427
+ ` --kind episodic|semantic|procedural filter by cognitive axis\n`);
1428
+ process.exit(0);
1429
+ }
1430
+ const includeInvalidated = flags.includes("--include-invalidated");
1431
+ const kindFlag = (() => {
1432
+ const idx = flags.indexOf("--kind");
1433
+ if (idx !== -1 && flags[idx + 1])
1434
+ return flags[idx + 1];
1435
+ const prefixed = flags.find((f) => f.startsWith("--kind="));
1436
+ return prefixed ? prefixed.slice("--kind=".length) : undefined;
1437
+ })();
1438
+ if (kindFlag && !["episodic", "semantic", "procedural"].includes(kindFlag)) {
1439
+ console.error(`✗ --kind must be episodic|semantic|procedural, got "${kindFlag}"`);
1440
+ process.exit(2);
1441
+ }
1442
+ const valueFlags = new Set(["--kind"]);
1443
+ const cleanFlags = [];
1444
+ for (let i = 0; i < flags.length; i++) {
1445
+ if (valueFlags.has(flags[i])) {
1446
+ i++;
1447
+ continue;
1448
+ }
1449
+ if (Array.from(valueFlags).some((f) => flags[i].startsWith(`${f}=`)))
1450
+ continue;
1451
+ cleanFlags.push(flags[i]);
1452
+ }
1453
+ const projectPath = await resolveProjectPath(cleanFlags);
1454
+ const { getProjectConfig } = await import("../src/utils/config.js");
1455
+ const { Indexer } = await import("../src/indexer/indexer.js");
1456
+ const { renderMarkdownCombined } = await import("../src/memory/export.js");
1457
+ const config = getProjectConfig(projectPath);
1458
+ const indexer = new Indexer(config);
1459
+ await indexer.index();
1460
+ const rows = includeInvalidated
1461
+ ? indexer.memoryStore.getTimeline(10_000)
1462
+ : indexer.memoryStore.getAll(10_000);
1463
+ const filtered = kindFlag ? rows.filter((m) => m.kind === kindFlag) : rows;
1464
+ process.stdout.write(renderMarkdownCombined(filtered));
1465
+ indexer.close();
1466
+ process.exit(0);
1467
+ }
1468
+ if (sub === "edit") {
1469
+ // Render memories to a temp markdown file, open in $EDITOR, parse
1470
+ // changed content back into SQLite. Strict safety policy: omission
1471
+ // never deletes (use `sverklo memory demote` for that); a parse
1472
+ // error aborts without writing.
1473
+ const flags = args.slice(2);
1474
+ if (flags.includes("--help") || flags.includes("-h")) {
1475
+ console.log(`\nsverklo memory edit — open memories in $EDITOR; round-trip text edits\n\n` +
1476
+ `Flags:\n` +
1477
+ ` --editor PATH editor to invoke (default: $EDITOR or vi)\n\n` +
1478
+ `Safety:\n` +
1479
+ ` - Removing a memory's heading from the file does NOT delete it.\n` +
1480
+ ` Use \`sverklo memory demote <id>\` (planned) or \`sverklo_demote\`\n` +
1481
+ ` from MCP for explicit deletion.\n` +
1482
+ ` - Adding a new memory by hand is not supported here. Use\n` +
1483
+ ` \`sverklo_remember\` from MCP or call the API directly.\n` +
1484
+ ` - If the parser can't make sense of your edits, the change\n` +
1485
+ ` is rejected and your SQLite store is left untouched.\n`);
1486
+ process.exit(0);
1487
+ }
1488
+ const editorOverride = (() => {
1489
+ const idx = flags.indexOf("--editor");
1490
+ if (idx !== -1 && flags[idx + 1])
1491
+ return flags[idx + 1];
1492
+ const prefixed = flags.find((f) => f.startsWith("--editor="));
1493
+ return prefixed ? prefixed.slice("--editor=".length) : undefined;
1494
+ })();
1495
+ const editor = editorOverride ?? process.env.EDITOR ?? "vi";
1496
+ const valueFlags = new Set(["--editor"]);
1497
+ const cleanFlags = [];
1498
+ for (let i = 0; i < flags.length; i++) {
1499
+ if (valueFlags.has(flags[i])) {
1500
+ i++;
1501
+ continue;
1502
+ }
1503
+ if (Array.from(valueFlags).some((f) => flags[i].startsWith(`${f}=`)))
1504
+ continue;
1505
+ cleanFlags.push(flags[i]);
1506
+ }
1507
+ const projectPath = await resolveProjectPath(cleanFlags);
1508
+ const { getProjectConfig } = await import("../src/utils/config.js");
1509
+ const { Indexer } = await import("../src/indexer/indexer.js");
1510
+ const { renderMarkdownCombined, parseMarkdownEdits } = await import("../src/memory/export.js");
1511
+ const { writeFileSync, readFileSync, mkdtempSync } = await import("node:fs");
1512
+ const { tmpdir } = await import("node:os");
1513
+ const { join: joinPath } = await import("node:path");
1514
+ const { spawnSync: spawn } = await import("node:child_process");
1515
+ const config = getProjectConfig(projectPath);
1516
+ const indexer = new Indexer(config);
1517
+ await indexer.index();
1518
+ const rows = indexer.memoryStore.getAll(10_000);
1519
+ if (rows.length === 0) {
1520
+ console.log("(no memories to edit)");
1521
+ indexer.close();
1522
+ process.exit(0);
1523
+ }
1524
+ const dir = mkdtempSync(joinPath(tmpdir(), "sverklo-memory-edit-"));
1525
+ const filePath = joinPath(dir, "memory.md");
1526
+ const original = renderMarkdownCombined(rows);
1527
+ writeFileSync(filePath, original, "utf-8");
1528
+ console.log(`Opening ${filePath} in ${editor}...`);
1529
+ const result = spawn(editor, [filePath], { stdio: "inherit" });
1530
+ if (result.status !== 0) {
1531
+ console.error(`✗ editor exited with status ${result.status}; no changes applied`);
1532
+ indexer.close();
1533
+ process.exit(1);
1534
+ }
1535
+ const after = readFileSync(filePath, "utf-8");
1536
+ if (after === original) {
1537
+ console.log("(no edits — exiting)");
1538
+ indexer.close();
1539
+ process.exit(0);
1540
+ }
1541
+ const parsed = parseMarkdownEdits(after);
1542
+ if (parsed === null) {
1543
+ console.error("✗ couldn't parse the edited file (heading structure broken). No changes applied.");
1544
+ console.error(` Your edits are preserved at ${filePath} in case you want to recover them.`);
1545
+ indexer.close();
1546
+ process.exit(1);
1547
+ }
1548
+ // Compute the diff: ids whose content changed.
1549
+ const byId = new Map(rows.map((r) => [r.id, r]));
1550
+ const updates = [];
1551
+ for (const edit of parsed) {
1552
+ const original = byId.get(edit.id);
1553
+ if (!original)
1554
+ continue; // edit references an unknown id — skip silently
1555
+ if (original.content === edit.content)
1556
+ continue;
1557
+ updates.push({ id: edit.id, content: edit.content, before: original.content });
1558
+ }
1559
+ if (updates.length === 0) {
1560
+ console.log("(content unchanged — only metadata or formatting edits, ignoring)");
1561
+ indexer.close();
1562
+ process.exit(0);
1563
+ }
1564
+ for (const u of updates) {
1565
+ indexer.memoryStore.update(u.id, u.content);
1566
+ }
1567
+ console.log(`✓ updated ${updates.length} memor${updates.length === 1 ? "y" : "ies"}:`);
1568
+ for (const u of updates) {
1569
+ const beforeSnip = u.before.slice(0, 60).replace(/\n/g, " ");
1570
+ const afterSnip = u.content.slice(0, 60).replace(/\n/g, " ");
1571
+ console.log(` #${u.id}: "${beforeSnip}${u.before.length > 60 ? "..." : ""}"`);
1572
+ console.log(` → "${afterSnip}${u.content.length > 60 ? "..." : ""}"`);
1573
+ }
1574
+ console.log(`\nNote: omitted memories are preserved. Use \`sverklo_demote <id>\` from MCP\n` +
1575
+ `to explicitly archive a memory.`);
1576
+ indexer.close();
1413
1577
  process.exit(0);
1414
1578
  }
1415
1579
  const flags = args.slice(2);