Skip to content

v2.0.0

Choose a tag to compare

@SarfDime SarfDime released this 29 Oct 16:56
· 7 commits to main since this release

2.0.0 (2026-10-29)

  • Feat!/overall package improvements (#51) (a566a59)

BREAKING CHANGES

  • run_command_batch and run_package_scripts_batch return an object { ok, onError, summary, items, truncated }. Every item has status success, failure or skipped with a reason and a ran flag. Command batches default to onError continue, script batches to stop. Items may set okExitCodes.
  • validate the whole batch before running anything; timeouts keep partial output
  • add a policy engine: blacklist matching ignores global options before the subcommand; built-in rules for git, package managers, gh, rg and find; per-profile commandPolicy rules
  • add protected paths for apply_changes (.git, .env*, .npmrc by default; profile protectedPaths)
  • authenticate before reading the request body
  • share one process runner between commands and package scripts
  • migrate legacy npm.allowedScripts profiles with a warning
  • document the trust model: agent-dir is not a security boundary against a hostile agent
  • feat: configurable protected paths in CLI and setup, mutating-script warnings, per-call batch timeouts
  • add --protect and --unprotect to profiles and launch overrides; ask for extra protected paths in the setup wizard; show them in the startup banner
  • warn when allowed scripts look like formatters or fixers that bypass apply_changes
  • add timeoutMs (1000-600000 ms) to run_command_batch and run_package_scripts_batch
  • refresh the diagnostic telemetry wording in the setup wizard
  • close Phase 3 in the audit progress file
  • Phase 3

  • feat!: object search results, git-aware file list, scoped search with ripgrep or built-in backend

  • search_code, find_symbol, find_references and apply_changes return objects ({ items, returned, truncated, truncationReason, backend, ... } and { items, dryRun }) instead of arrays, so truncation is always reported and outputs are valid at protocol 2025-11-25.

  • file list: git ls-files in git work trees (honors .gitignore), bounded walk otherwise; no depth cap
  • search_code: paths, globs, context, caseSensitive, includeGenerated; docs and config files are searchable; lockfiles and minified files skipped by default
  • ripgrep backend when installed with a built-in fallback that returns the same shape and limits; built-in rejects nested-quantifier regexes
  • find_files matches bare names at any depth and reports exact truncation
  • find_symbol covers more languages and is case-sensitive; find_references handles $ identifiers
  • banner and project_context report the active search backend and the blacklist
  • tests for both backends (ripgrep parity tests skip when ripgrep is absent)
  • feat!: read_range with EOF info, multi-range reads and plain-text output; compact JSON text blocks
  • read_range now reads whole files up to 20 MB and returns eof, totalLines and nextStartLine; the text block is plain text with a header instead of JSON, the default budget is 16 KB, binary files are rejected, and ranges[] reads several ranges of one file. Tool result text blocks are compact JSON.
  • fix built-in search returning a phantom empty trailing line as context (found by the ripgrep parity test)
  • record search progress in docs/AUDIT-PROGRESS.md
  • transfer to other machine

  • feat!: safer apply_changes, rebuilt validate and per-script arguments

  • validate returns { level, ok, diagnostics, scripts, scriptsRequested, truncated, note } with script results in the batch item format; unknown levels are rejected and level scripts/full without scripts runs the default scripts or fails with the allowed names. A patch that matches several places is rejected unless count is set.

  • apply_changes: line numbers for ambiguous patches, closest-line hints for missing text, writes via temporary file keeping the file mode, byte-exact rollback including binary files, clean errors for missing files
  • diagnostics: ignore Markdown headings, accept JSON with comments in config files, skip binary and oversized files, use the git-aware file list
  • run_package_scripts_batch accepts { script, args } for scripts listed in scripts.argumentScripts
  • remove dead code; document reading, editing and validation behavior
  • close Phase 4 in the audit progress file
  • feat!: one payload per tool result, remove Serena and ast-grep

Emit each tool result once, as a compact JSON text block (plain text for
read_range). The duplicate structuredContent copy and the output schemas and
titles are gone, so tools/list drops from 29.2 KB to 11.85 KB with every
optional integration enabled, and a result is 1.01-1.13x its maxBytes instead
of 1.84-2.08x.

Remove the Serena and ast-grep integrations: together 4% and 0% of measured
tool calls, while Serena contributed about 8.6 KB to every tools/list.
Existing profiles are migrated in memory with a warning. fitAnalyticsResult
now budgets the whole response envelope, which previously overshot maxBytes
by up to 2.3x.

Phase 5: one capability model feeds initialize, server/discover, the
capabilities resource and project_context; guidance is a short decision table
without REQUIRED wording; arguments are validated against inputSchema before
dispatch and the message names the argument; unknown tools suggest the closest
names; search_code gains multiline. tools/list telemetry records toolCount and
toolSetHash so size changes are attributable.

  • structuredContent is no longer returned; read content[0].text.
    The serena_* and ast_grep_search tools are removed, and disabledSets
    serena/ast_grep plus their disabled tool names are stripped from profiles.

  • test: cover the protocol matrix and document the 2.0 breaking changes

Phase 6. Close the coverage gaps in the section 7 test plan:

  • call every advertised tool at both protocol versions and assert the result
    shape (single text payload, no structuredContent, complete resultType)
  • reject an unknown argument on every advertised tool and name the valid ones,
    plus the missing-required case
  • tolerate malformed and empty JSONL in telemetry reads and prove the read
    creates or modifies nothing

Argument validation now reports a misspelled argument before a missing one,
since that is the more actionable signal, and a missing root argument is named
without the "arguments." prefix. 195 tests pass.

Also record the Phase 6 outcome in the audit log and ship docs/MIGRATION.md,
which lists every breaking change in 2.0.

  • docs: align table separator rows with the padded columns

Formatting only: the separator rows in the 6.03 table and the MIGRATION tables
now match the column widths already used by their content rows. Rendering is
unchanged.

A formatter had also rewritten a template literal in src/mcp.ts into a style
Biome rejects, which failed npm run check; that file is back to the committed
content.

  • feat: instrument guidance variants and close the remaining audit items

Phase 7 plus the leftovers from earlier phases.

7.01 is now measurable instead of speculative: AGENT_DIR_GUIDANCE selects
between the decision table (default) and a terse paragraph, every
initialize/server/discover request records guidanceVariant, mode=summary counts
them under efficiency.guidanceVariants, and every tool call records argShape
(booleans for regex, paths, globs, context, multiline, ranges, dryRun, limit).

2.07 completed: skippedCount for batch tools, integration/integrationStatus for
integration-backed tools, argShape for every call. Fixes a real gap found while
doing it: toolCount and toolSetHash were being dropped by the telemetry privacy
allowlist and never persisted.

2.09 gained a distinct policy_denied category; guardrail and protected-path
rejections were being counted as authorization failures.

1.07 added a conformance suite driven by the official @modelcontextprotocol/sdk
client (dev dependency only): initialize, ping, tools/list, tools/call reading
the single text payload, and an isError result.

1.08 and 4.03 verified done. 7.02 declined (re-adding an AST parser contradicts
this release), 7.03 gated on the 6.03 behavioural window, 7.04 stays deferred by
D-02; 2.05, 2.09, 2.11 and 4.11 keep their reasons in the audit log. 197 tests.

  • refactor(telemetry): derive the privacy allowlist from the event types

The anonymous-event sanitizer was a hand-written allowlist, so a field added to an
event interface was silently dropped on the way to disk. That already happened once:
toolCount and toolSetHash were recorded but never persisted. SAFE_ERROR_CATEGORIES
had the same problem as a second hand-maintained set, which is why policy_denied was
missing from it.

  • Rule tables per event type, typed with a mapped type over the event interface, so
    a field without a rule and a new event type without a table both fail the build.
  • Error categories, tool outcomes and argument-shape keys are declared once as const
    tuples in types.ts and reused by the classifier and the sanitizer.
  • classifyTelemetryError, reasonCategory, the rejected-tool-call category and the
    event errorCategory fields now use TelemetryErrorCategory instead of string.
  • Two regression tests: one round-trips the fields that were previously dropped, one
    covers coercion of values that bypass the types.
  • docs: record the shell-search removal decision and its measurements

Measured from the local telemetry store: command-based search costs about 1.4x search_code per call (5,849 vs 4,066 B), the naive rg over ignored trees returns more bytes than the tool (1,644 vs 1,127 B for the same nine matches), and read_range is the expensive tool at 8,103 B per call.

The removal buys enforcement, bounded output and gitignore awareness, not tokens: run_command_batch stays in tools/list, so nothing shrinks. Four gaps recorded: ignored-tree discovery, the git grep bypass, one query per call, and the docs example that still recommends grep.

  • chore: stop the editor from re-padding Markdown tables

Biome 2.5.15 has no Markdown support (the configuration schema exposes javascript, json, css, graphql, grit, html, overrides and plugins only), so nothing in CI checks docs formatting. The editor's Markdown formatter re-pads every table cell to the widest column on save, which produced repeated unprompted diffs in docs/AUDIT-PROGRESS.md and docs/telemetry.md. Markdown format-on-save is now off for this workspace; code formatting stays with Biome.

  • chore(deps): upgrade Biome to 2.6.4 and scope it to code and JSON

@types/node also moves to 24.19.2; everything else in the tree is already current. Biome 2.6 adds Markdown and YAML formatting, which is enabled by default for included files, so .md and .serena/ are excluded: its Markdown formatter pads every table cell to the widest column, turning a one-cell edit into a whole-table diff in docs/AUDIT-PROGRESS.md, and it rewrites .serena/project.yml, which another tool owns. It also inserts a blank line after the --- in the SKILL.md frontmatter. Flip the exclusion to enable Markdown formatting later.

Workspace settings now pin two-space indentation and a final newline, so saving a JSON file no longer fights Biome's own JSON formatting.

  • docs: trim the audit tracker to open issues and add a cost audit

AUDIT-PROGRESS.md now lists only the open items (2.05, 2.09, 2.11, 4.11, 6.03, the four search-command gaps and the standing decisions). The completed per-phase tables were describing shipped work.

New docs/AUDIT-EFFICIENCY.md measures where an agent's cost goes now: 2,390 tool calls over 95 sessions, 12.05 MB of tool output, of which read_range is 58% and run_command_batch 22%. tools/list is down to 11,135 B and costs about one call per session, so it is no longer the lever. Search results spend 43% of their bytes on JSON scaffolding, 21% of searches return nothing with no explanation, and validate is 47% truncated at a 4.7 s median.

Code findings: mcp.ts is 2,806 lines; one test asserts the working tree is formatted by running the repo's own npm run check; coverage is 62.28% lines with nothing enforcing it. Type strictness is already strong and there is no dead code.

  • feat!: grep-style search results, self-explaining empties, path suggestions

E-01, E-02 and E-05 from the cost audit (docs/AUDIT-EFFICIENCY.md).

search_code now renders text by default: a summary line, then path:line:col text per match, context as ' | line', and note: lines. Measured 2,028 B -> 964 B and 8,643 B -> 3,962 B on two queries (-52%, -54%), because the JSON keys around each match were 43% of the payload. format='json' returns the previous object envelope plus a new scanned count, so existing parsers keep working.

Empty and truncated results now explain themselves instead of returning {"items":[],"returned":0}: the note states how many files were searched, which match mode applied, what was skipped, and what to try next. find_files does the same, including that '*' does not cross '/'. Notes are taken out of the same maxBytes budget as the items, which is why the reserve exists.

A change that targets a missing file now names the closest existing paths ('Did you mean ...'), which covers 39 of the 53 observed apply_changes failures.

  • search_code returns text rather than a JSON envelope unless format='json' is passed.

  • feat: measure read size and make validate localize its own truncation

E-03: every read_range call records readLines (total lines requested, summed over ranges) and mode=summary buckets them under efficiency.readSpans (1-40, 41-200, 201-800, 801+). read_range is 58% of tool-result bytes; without the span there is no way to tell a few huge reads from many small ones. Line counts contain no file content, so the field is safe at every privacy level.

E-06: validate always returns diagnostics.summary (error/warning/info counts and affected files) and diagnostics.byFile (the ten worst files with counts and first message). The flat issues list is included only when it fits the budget; otherwise a note says why it is absent. On a fixture with 30 broken files the whole result is 1,807 B and names every file, instead of a cut list that forced a second run. Verified through the server with maxBytes=2048.

Also repairs formatting drift that had been applied to src/mcp.ts, src/tools/code.ts and src/tools/files.ts by an external formatter.

  • docs: correct the repeated-call figure to same-session repeats

223 of 2,390 calls (9%) reuse an input fingerprint seen anywhere in the window, but 102 (4%) reuse one from the same session. The rest are different sessions asking the same question, which is not waste and should not be used to size E-04.

  • chore: drop the .serena workspace directory

Serena support was removed from Agent Dir; the workspace files were left behind. Also keeps the trailing newline an editor added to docs/telemetry.md.

  • feat: search several patterns in one call

E-07 from the cost audit, and the last gap of section 4c: multi-pattern work needed one round trip per pattern, or a run_command_batch of shell greps. search_code now accepts queries: string[] (up to 5), returns one labelled group per pattern and splits maxBytes between them. Two patterns measure 1,024 B in one call against 1,157 B in two calls, before counting the extra round trip.

query and queries are alternatives, expressed as anyOf in the advertised schema. That exposed an ordering bug in validateToolArguments: an anyOf branch's required check ran before the parent's unknown-argument check, so a misspelled argument was reported as a missing one. Unknown arguments are now reported against the parent schema first, which preserves the earlier fix for the same class of confusion.

argumentShape gains a queries flag so guidance experiments can see whether the new form is adopted.

  • feat!: stop repeating serverInfo in every tool result

E-08: every tool result carried _meta.serverInfo, 84 bytes that the client already received in initialize or server/discover. Measured: file_info 347 to 261 B (-25%), read_range 1,618 to 1,532 B, search_code 964 to 878 B, find_files 554 to 468 B. Across the 2,390 calls in the window that is about 200 KB of context. initialize, server/discover and the subscription stream keep the field.

  • tool results no longer include _meta; read serverInfo from initialize or server/discover.

  • feat: let browser agents in through an origin allowlist with CORS

Web-based agents were rejected with 403 Invalid Origin: the transport accepted only same-origin browser requests, and answered the preflight with 405. A profile can now list allowedOrigins (CLI --allow-origin), and listed origins get Access-Control-Allow-Origin, Vary: Origin and an OPTIONS preflight answered before authentication, since browsers never attach credentials to a preflight. Unlisted origins still get 403, now naming the origin and the flag that would allow it.

Authentication is unchanged and still required for the real request, so listing an origin does not grant access; the DNS-rebinding guard stays in place for everything not listed. Origins are validated as scheme://host[:port] with no path and no wildcard, so a typo cannot silently disable the check.

Verified over HTTP: allowed origin preflight 204 with the transport headers, POST 200 with Access-Control-Allow-Origin; unlisted origin 403 on both.

  • fix: accept browser-extension origins and name the invalid config field

The origin allowlist added in the previous commit only accepted http(s), so a Firefox extension origin (moz-extension://) failed profile validation and the whole config was rejected with 'Invalid configuration format'. Browser extensions are exactly the case the allowlist exists for.

Origins are now validated by one shared normalizer that accepts http, https and extension schemes (chrome-extension, moz-extension, safari-extension, safari-web-extension), ignores a trailing slash and a default port, and rejects '*' and 'null' so the check cannot be disabled by accident. It does not use URL.origin, which reports 'null' for non-special schemes and would make every extension share one key.

Validation now returns a reason instead of a boolean, so a bad profile reports profiles.: ... with the offending value and the expected shape, instead of 'Invalid configuration format'. JSON parse errors say the file is not valid JSON. Verified with a real config containing a moz-extension origin: it loads, and over HTTP the preflight returns 204 and the POST 200 with the origin echoed byte for byte.