Skip to content

Releases: DFKHelper/token-goat

v2.2.4

29 Jun 07:21

Choose a tag to compare

Correctness and compression release.

Session recall now survives the hook process boundary

token-goat's hooks run as a fresh process per tool call, but the entire session-recall layer lived in process-local memory that died with each process, so re-read dedup and bash-output / web-output recall never fired across calls in the shipped binary. Three on-disk layers under ~/.token-goat (per-session state plus content-addressed bash/web blobs) restore the behavior, with merge-on-save, atomic writes, and age/count pruning. WebFetch responses are now actually cached for cross-process recall.

Bash-output compression, wired and filling in

The pre-bash command-rewrite mechanism is reconnected end to end, so build and test commands are compressed automatically (opt out with TOKEN_GOAT_BASH_COMPRESS=0). The first structured per-tool filters land: Jest/Vitest (a shared Node test-runner family) and pytest / go test (bespoke runners). The remaining per-tool filters port in follow-up batches.

Other fixes

  • token-goat config-get returns the value from the requested section, not the first match
  • truncateLine no longer overshoots maxLineLength
  • the reindex queue deduplicates paths case-insensitively on Windows/macOS
  • flat section ranges never end before they start
  • index --walk indexes a non-git folder
  • task-output recall hints name a working --file command
  • trimToBudget no longer slices mid-ANSI-escape
  • skill compact cache filenames are colon-free and consistent across store/get/list

Full details: CHANGELOG.md

v2.2.3

28 Jun 19:16

Choose a tag to compare

2.2.3 — the surgical-read pipeline, reconnected

This is a significant correctness release. The migration off the original Python implementation to TypeScript left several core components unwired in the shipped binary while the unit test suite stayed green:

  • The background indexer wrote nothing. The worker drained its dirty queue into a stub, so the symbols table was never populated and the real parser was tree-shaken out of the bundle — every surgical read (symbol, read, skeleton, outline, semantic) returned an empty index.
  • refs returned [] and its command was never registered on the CLI.
  • semantic always reported "no matches" because its FTS query aliased the virtual table (no such column: f, silently swallowed by a catch).
  • token-goat index . produced an unqueryable index — it stored relative path keys no reader could match.
  • exports, imports, find, grep, and web-output were implemented but never wired into the CLI (exports/imports were also non-functional as written).
  • config-get ignored its file argument and read token-goat's own config instead.

All of these are fixed, and every surgical-read and index-backed command is now reconnected end to end.

To stop this class of failure from recurring, two structural guards were added, both driven off a single command registry so new commands are covered automatically:

  • a data-driven CLI registration guard that runs in a fast (~2s, no-I/O) pre-commit tier, so an implemented-but-unregistered or unfunctional command fails before the commit lands; and
  • a built-bundle command matrix that indexes a fixture and runs every registered command against the shipped dist/token-goat.mjs at pre-push and in CI — a command broken or unreachable in the shipped artifact now fails the build.

Also in this release: serve_diff_on_reread now covers source, style, and data files (not just docs); YAML/TOML kebab-case keys are indexed; read resolves 3+ part dotted symbols to the leaf; and the architecture reference was rewritten for the TypeScript codebase.

Full details: CHANGELOG.md

v2.2.2

27 Jun 20:06

Choose a tag to compare

[2.2.2] - 2026-06-27

Added

  • PowerShell system-query recall. Get-CimInstance, Get-Process, Get-Counter, Get-Service, Get-PSDrive, and Get-WmiObject commands run via powershell.exe/pwsh are now registered as monitoring commands. Output is cached after the first run and a token-goat bash-output <id> --tail 50 recall hint is emitted on repeats.
  • token-goat section/outline/symbol repeat recall. Running the same token-goat section "FILE::Heading", outline FILE, or symbol NAME command a second time in a session now emits a bash-output recall hint instead of re-executing.

v2.2.1

27 Jun 19:52

Choose a tag to compare

2.2.1

v2.2.0

27 Jun 18:47

Choose a tag to compare

See CHANGELOG.md for full details.

Highlights

  • Count-based hard-deny for repeated source file reads — 3rd+ read of the same source file is hard-blocked; use token-goat read, skeleton, or outline instead
  • Identifier grep on a single file → token-goat symbol hint via extractRgSymbolSearch
  • Section heading normalization — em/en-dashes, trailing parens, numeric prefixes all handled; full heading list shown on miss
  • Markdown heading grep → token-goat outline hint via extractMarkdownHeadingGrep
  • Session artifact re-read deduptasks/*.output and tool-results/*.txt diff-or-deny
  • Python heredoc reads now caught by extractPythonFileRead
  • SQL cat hooks, curl GET cache, curl -o dedup, cat JSON|jq, node require(), CSS/SCSS/LESS cat, find → fd, eza --tree/tree/ls -R → map, grep|grep chain, doc-file diff-on-reread, .md re-read denial, git diff compression
  • Security hardening, Windows mkdirSync race fix, multiple CLI and embedding fixes
  • 180+ filter & interception rules (was 160+)

v2.1.0

27 Jun 01:04

Choose a tag to compare

See CHANGELOG.md for details.

v2.0.3

26 Jun 21:29

Choose a tag to compare

[2.0.3] - 2026-06-26

Fixed

  • stats recording restored end-to-end. The TypeScript rewrite had ported only the read/display side of stat recording; the write side was silently missing since 2026-06-25. recordStat() is now implemented in stats.ts and wired into all four hook handlers (hooks_read.ts, hooks_bash.ts, hooks_fetch.ts, hooks_skill.ts). Recorded rows now also carry real bytes_saved / tokens_saved values (file size and bytes/4) instead of defaulting to zero.

  • git_history.ts hunk line counts overcounted. The @@ -L,N +L,N @@ header N values (which include context lines) were used directly as linesAdded/linesRemoved. The parser now counts actual +/- prefixed body lines, giving accurate per-symbol change counts.

  • git_history.ts hunk loop broke early on diff content starting with +++/---. A bare hunkLine.startsWith('+++') guard would prematurely exit the hunk body when a file contained lines whose content began with ++ or --. Guard now matches exact git file-header prefixes (+++ b/, +++ /dev/null, --- a/, --- /dev/null).

  • parser.ts symbol line ranges used the parent declaration node instead of the child declarator. Multi-declarator const x = 1, y = 2 statements reported each variable's range as the whole declaration span instead of the individual variable_declarator child node's span.

  • parser.ts JSON property extraction missed top-level keys whose values opened a nested object on the same line. The braceDepth check captured depth after processing the line, so a key like "nested": { was recorded at depth 1 (inside the nested object) rather than depth 0 (top-level).

  • embeddings.ts left \r in chunks on Windows CRLF content. raw.split('\n') produced chunks with trailing carriage returns. Changed to raw.split(/\r?\n/).

  • hooks_cli.ts suppressed non-Error thrown values in catch blocks. The instanceof Error check silently swallowed string errors, rejected Promises, and other thrown values.

  • read_commands.ts skeleton() reported the wrong final line number when --min-lines was active. The function used the unfiltered symbol array's last element for the total line count even after --min-lines had reduced the set, producing a count larger than the visible output.

  • Event listener leaks on stdin and parentPort. readStdin() in hooks_cli.ts and the stdin mode of cmdWriteFile() in cli.ts registered data/end/error listeners without ever removing them, leaking listeners across invocations. Named handler refs and a cleanup() call in all exit paths now prevent the leak. worker.ts parentPort message listener is removed when the 'stop' message is received.

v2.0.2

26 Jun 05:30

Choose a tag to compare

[2.0.2] - 2026-06-26

Added

  • git diff and npm run monitoring recall patterns. git diff HEAD, git diff, and git diff --cached now trigger bash-output recall hints when prior output is cached (full diffs can be many KB; git diff --stat is excluded as it produces small output). npm run test, npm run build, npm run lint, npm run typecheck, npm run check, and npm run spec are now covered by monitoring recall � these invoke vitest/eslint/tsc under the hood but weren't matched by the direct-invocation patterns.

  • codex and glm.sh monitoring recall patterns. codex exec and ~/.claude/bin/glm.sh invocations are now tracked as monitoring commands; when prior output is cached and exceeds 2 KB, a recall pointer is injected.

  • cat source-file recall hint. Repeated cat <file> calls on source files now emit a token-goat read 'file::Symbol' suggestion rather than a generic shell recall hint.

Fixed

  • post_tool_use Bash hook was missing. getBashOutputId always returned null in production because the Bash post-hook was never registered, silently disabling all monitoring and build recall hints. The hook is now wired up and bash output caching works end-to-end.

v2.0.1

26 Jun 04:18

Choose a tag to compare

[2.0.1] - 2026-06-25

Added

  • Language-agnostic read-suppression and build-tool recall pattern table. src/hints/lang_patterns.ts adds a data-driven table covering 13 lock-file types (pre-read deny + section offer), 16 manifest/config types (section/config-get nudge on re-read), generated build-output directories (read suppression), and 12 build-tool stdout patterns (bash-output recall). The table is the single source of truth consumed by the pre-read and pre-bash hooks.

  • npm-specific hook improvements. package-lock.json triggers a pre-read deny with a token-goat section offer; node_modules/ reads are suppressed; package.json re-reads emit a section/config-get nudge; npm install, npm test, npm run, npm ci, and npm audit stdout is cached and recalled via bash-output --grep.

  • TypeScript and JavaScript hook patterns. tsconfig.json section hint on re-read; .d.ts files in dist/ suppressed; tsc/tsc --watch and Vite/esbuild/webpack build output cached; vitest/jest output cached with --grep FAIL; dist/, out/, .next/, .nuxt/, build/ directories suppressed; *.min.js and *.bundle.js files suppressed.

  • Process-monitoring command recall hints. Pre-bash intercept for repeated monitoring commands: gh run watch/view, gh run view --log, gh pr checks, next dev/build, vite, nuxt dev, vitest/jest watch, pytest, cargo test, go test, docker logs, nodemon, air, cargo watch, watchexec, eslint, prettier, ruff, clippy. When a prior run is cached and its output exceeds 2 KB, a recall pointer is injected instead of re-running the command.

  • Large markdown file interception with heading-tree hints. Markdown files ≥ 8 KB with three or more headings are intercepted on pre-read (block: true). The hook extracts ATX H1–H3 headings (capped at 40), formats a heading tree with #2/#3 disambiguation suffixes, and injects it with token-goat section shortcuts. Well-known files (README.md, CHANGELOG.md, CONTRIBUTING.md, CLAUDE.md, CLAUDE.arch.md) receive pre-populated section shortcuts. Post-edit on markdown files injects a token-goat section re-read suggestion.

  • Universal large-file interception for PDF, HTML, TXT, Office, and CSV files. src/hints/file_type_handler.ts dispatches on extension. PDF and Office binaries (.docx/.xlsx/.pptx/.odt/.ods) are fully blocked with pandoc/docx2txt extraction suggestions. HTML ≥ 50 KB is intercepted with title + heading index; minified HTML is flagged. TXT/log files ≥ 20 KB show line count plus first/last five lines with head/tail/grep offers. CSV/TSV ≥ 10 KB shows column headers, row count, and three sample rows with a DuckDB suggestion. Any file ≥ 100 KB hits a generic catch-all with byte/line count.

Fixed

  • (921ffab) parseInt radix, YAML frontmatter close regex, ANSI strip scope. parseInt(env, 10) in ask.ts prevents octal interpretation on leading-zero values. memory_prune.ts tightens the frontmatter closing delimiter from bare indexOf('\n---') to /\n---(?:\n|$)/ so \n---extra lines no longer terminate frontmatter early. overflow_guard.ts replaces the SGR-only local stripAnsi with the full-coverage stripAnsiCodes from bash_compress.ts, which handles OSC, DCS, and cursor sequences.

  • (a4caffe) Falsy-zero timeout, missing maxHints guard, and hint suppressor logic. ask.ts parseTimeoutSecs() replaces parseInt(env) || DEFAULT so a timeout of "0" is honoured rather than treated as falsy. hints.ts adds an early-return guard for maxHints <= 0. buildIndexOnlyFileHint, buildStructuredFileHint, and buildPackageManifestHint change hasOffset && hasLimit to hasOffset || hasLimit so a read with only offset (or only limit) also suppresses the hint. Ten regression tests added.

v2.0.0 — TypeScript rewrite

25 Jun 23:46

Choose a tag to compare

Complete Python→TypeScript migration. All modules ported to TypeScript; Python source removed; package promoted from packages/token-goat-ts/ to project root. Now published to npm instead of PyPI.

Install: npm install -g token-goat

See CHANGELOG.md for the full change history.