Skip to content

Latest commit

 

History

History
88 lines (62 loc) · 43.5 KB

IMPROVEMENTS.md

File metadata and controls

88 lines (62 loc) · 43.5 KB

Hydra self-improvement log

What real use of Hydra shows, and what to change because of it. The evidence comes from the local telemetry (~/.hydra/ledger.jsonl, read with hydra improve) and from what an agent noticed while working. Add an entry after any session that used Hydra; close an entry when its fix lands.

Each entry: date, what was seen, the evidence, and its status (open, fixed, by design). Token figures are estimates (characters / 4). Run hydra improve --since <date> for the numbers since a given day.

Do not use failures from the sealed evals/git1 set to decide changes here; that rule in AGENTS.md still holds.

Open

  • 2026-11-27. Agents do not reach hydra recall or the git head on their own. hydra improve --since 2026-11-20T12:00Z: 11 Claude Code sessions, 9 Hydra calls, all test runs (~46k raw -> under 1k returned); 0 git, 0 recall, 0 meaning-search calls. The hook checked 394 Bash calls (p50 15 ms), turned back none and let 19 through as already cut short (| tail -n N). These sessions were mostly Kaggle training work, so few git questions came up, but TRACKER.md was still read whole rather than through hydra recall. Recall is not in SKILL.md or the MCP server yet (TRACKER.md step 15, next item 2), which explains it. Open until recall is reachable by agents and hydra improve shows it used.

  • 2026-10-17. Hydra in other coding tools is registered but not yet seen working in a live session. hydra agents install put the MCP server in Codex, OpenCode, Gemini CLI and Antigravity and hooks in Codex, OpenCode and Gemini CLI on this Mac. Checked without a model call: codex mcp list shows hydra; opencode mcp list connects to it. Not yet checked: that each tool's model actually calls hydra_git/hydra_run, that Codex shows the deny reason to its model (and runs the hook once trusted via /hooks), that OpenCode passes the plugin's thrown message to its model, and anything in Gemini CLI (not on PATH here) or Antigravity. hydra improve now lists calls and denials per agent and how many came through MCP; read it after a few sessions in each tool. Antigravity checked 2026-10-17 (next entry): its registration lands in the wrong place. No tool has made a single call through MCP yet (hydra improve: 0 through MCP for every agent). Rechecked 2026-10-19: every ledger row since 10-17 is from Claude Code; Codex, OpenCode, Gemini CLI and Antigravity have still recorded nothing. Rechecked 2026-10-23 (--since 2026-10-21): still nothing; the 6 rows hydra improve shows as agent: "" through MCP are test fixtures (see Fixed, 2026-10-23). 2026-11-20: OpenCode works. One OpenCode session on 2026-10-24 (09:10 to 10:54 UTC, product-research workspaces @pr/api/@pr/web) made 19 hydra_run calls through MCP, ~18.2k raw -> ~2.9k returned tok. The plugin turned back two runs at 09:38:55 (npm test -w @pr/api -- refresh-listing 2>&1 | tail -60 and the @pr/web twin); 8 s later the same two commands came through hydra_run. So OpenCode does pass the plugin's thrown message to its model, and its model does call hydra_run. Still nothing from Codex, Gemini CLI or Antigravity; still no T3 Code row (app: "t3code": 0). 2026-11-27: Antigravity IDE works too: one hydra_os call through MCP on 2026-11-26 (entry in Fixed). Still nothing from Codex (it cannot reach a model on this Mac, see the sandbox entry) or Gemini CLI.

  • 2026-10-17. Agents route around the test hook with HYDRA_RAW=1 and their own grep. (Mostly fixed: 16 of the 18 bypasses were runs already cut short, which now pass; see Fixed.) A Claude Code session in web-search, 09:42 to 10:19 UTC: 17 raw bypasses against 11 denials, nearly every one shaped like HYDRA_RAW=1 npx vitest run <file> 2>&1 | grep -E "×|Tests |Error|expected" | head or pnpm build 2>&1 | tail -1. The agent wanted specific lines (a Transform failed block with context, a one-line build result) and filtered for them itself; a digest it cannot steer was the wrong shape. Options to weigh: let the hook pass commands whose output is already cut to a few lines (| tail -n N, | head, | grep -c), and give hydra run a way to ask for lines around a pattern. Measure bypass and deny counts before and after. (One more bypass at 14:27 was this maintenance session's own test run.) After the fix (10-17 15:00 to 10-19, hydra improve): 2 runs turned back, both followed by a Hydra run within 5 minutes, and 8 already-cut runs let through. One of the two was again the agent filtering for itself: pnpm build:worker 2>&1 | grep -E "error|Error|✓ Compiled|Worker saved" (web-search, 10-17 15:33). The trimmed rule passes | grep -c but not | grep -E <pattern>; since 2026-10-20 the denial says | grep ... | head -40 passes (see Fixed). The other was a heredoc writing a Python script into /tmp; the ledger keeps only the first 300 characters of a command, so whether a test run followed it cannot be told from telemetry. 2026-11-20 (--since 2026-10-21, all Claude Code): 7,814 Bash calls checked, 83 turned back (68 followed by a Hydra run within 5 minutes), 313 already-cut runs let through, 41 HYDRA_RAW=1 bypasses. The bypasses checked by hand were all in product-research and all the same shape: a throwaway debug test (test/zz-debug.test.ts, zz-probe, e2e/specs/probe.spec.ts) run with | grep -v ... | head -400 or | sed, often next to a sed -i edit, i.e. the agent reading its own probe output. None looked like a false match. Playwright is new among them (11-14, 6 runs); a head -400 is far above what the trimmed rule lets through, which is fine for a probe.

  • 2026-10-17. Against what the agent would really have run, the test hook roughly breaks even in Claude Code. Claude Code telemetry from 6 sessions (10-17 05:02 to 14:47 UTC): 77 test runs through Hydra, ~248.5k raw -> ~12.6k returned tok. That 95% assumes the agent would have read every line, but the agent trims on its own: 5 of the 6 commands the hook turned back already ended in | tail -8, | tail -15 or | tail -25. Against a ~15-line tail (~175 tok), the 52 passing runs (Hydra median 57 tok, 3,095 in all) save about 6k tok. The 25 failing runs return ~9.5k tok, about what a tail -30 would; their value is that the summary was enough (only 1 of 25 was followed by a raw rerun within 3 minutes). Against that: the 6 denials cost ~4.7k tok (the command resent plus the denial text; one blocked cat > test/email-area.test.ts <<'EOF' ... && npx vitest run made the agent resend a ~3.7k tok file), and each node "<path>/hydra.mjs" run -- ... call adds ~20 tok of command text. The net is small either way. None of the 6 denials was a false match; each held a real test or build run (re-checked with the current testRun). The full raw output is the right baseline only when the agent does not trim. (1) is fixed (see Fixed: the hook lets already-cut runs through); all 6 denied commands ended in | tail -N, heredoc ones included, so no separate heredoc rule was needed. Still open: (2) compare whole-session tokens on similar work with the hook on and off. 2026-11-20 (--since 2026-10-21): 594 test runs, ~3.99M tok "saved" (98%), but 82% of that is five runs: npm run check three times (1,154,306 / 1,154,306 / 514,346 raw -> ~4.4k each, product-research), npm run lint (248k) and npx prettier --check . (204k). No agent would have read a million-token output; it would have cut it, so those five say only that Hydra kept a runaway output out of context. Without them: ~730k of ~810k raw (90%); median saving 348 tok per run. 38 runs cost a few tokens more (npm run lint 148 -> 154, npm run typecheck 51 -> 58, npx tsc --noEmit 0 -> 3).

  • 2026-10-17. Every MCP tool schema costs context in every turn. Three small tools were chosen for that reason; their token cost per turn in each tool is not measured.

  • 2026-10-17. Small git answers cost a little more than raw. do I have any stashes? 3 -> 7 and which branches exist? 56 -> 67 tok (2026-10-20, hydra improve); 37 such rows on 10-17. Since 2026-10-20 the footer is gone from these (it was never in the ledger figure), so what remains is the $ git ... line naming the command. Dropping that line would make them even, but it is the agent's only sign of which read-only command produced the lines; leave it unless an agent shows it does not need it. If it changes, score the git development set before and after and leave evals/git1 untouched.

  • 2026-10-17. Failing runs with short tracebacks save little. 670 -> 390 and 315 -> 265 tok: the error itself is the evidence, so most of it has to come back. Correctness comes first, so this is mostly by design. Whether import errors repeated per test module can be grouped is still to be checked. Real use, 2026-10-17, a Claude Code session in another project (web-search): the agent ran pnpm vitest run test/lifecycle-emails.test.ts through Hydra five times without being turned back; the two passes came back 460 -> 61 and 461 -> 62 tok (87%), the three failures 652 -> 281, 719 -> 323 and 824 -> 447 (about 50%), 3,116 -> 1,174 tok in all. The same session made no raw git log/diff/show/blame reads, so no git question was missed; its 104 Bash commands were mostly sed -n, grep and python3 over source, which Hydra leaves alone by design. The hook checked 67 of its commands at about 15 ms each.

  • 2026-10-17. Speed is not measured against the raw command. The ledger now records commandSeconds (the command alone) beside seconds (command plus digest), so Hydra's own overhead can be read per call. A raw-versus-Hydra wall-clock comparison has not been run.

  • 2026-10-17. Token figures are estimates. Everything is characters / 4. A real tokenizer count of a sample of ledger rows would show how far off the estimate is.

  • 2026-10-21. T3 Code sessions were not told apart from terminal ones. T3 Code (Beta, com.t3tools.t3code, installed 10-19) is a front end that starts Claude Code, Codex and Antigravity with their own config. Its Claude session 28c1fed2 (10-19) and two more on 10-20 loaded Hydra's skill and SessionStart hook and ran tests through Hydra, but the ledger recorded them as plain claude-code (102 rows for 28c1fed2); they were found only in ~/.t3/userdata/logs/provider. Since 2026-10-21 caller() adds app: "t3code" when the bundle id is T3 Code's or T3CODE_HOME is set, and hydra improve prints "N from t3code" per agent. Not yet seen in a live T3 session: that __CFBundleIdentifier reaches the agent's commands. Codex in T3 lists the hydra skill; no T3 Codex session yet. Antigravity in T3 runs with GEMINI_HOME set to a private profile (~/.t3/userdata/providers/antigravity/<hash>) that links config/skills back to ~/.gemini/config/skills, so the Hydra skill loads, but T3 keeps MCP servers and hooks isolated by design: Hydra reaches it only through the skill. Its harness sets AI_AGENT and ANTIGRAVITY_CONVERSATION_ID on commands (from the binary's strings, not yet seen in the ledger).

  • 2026-10-17. The git head was not used in a long working session. No history questions came up, so this says nothing either way about adoption. hydra improve now reports how many recorded sessions used Hydra at all; read it after a week of normal work.

  • 2026-10-23. The git head still saves nothing in real use. hydra improve --since 2026-10-21: 5 calls, all 5 returned a few tokens more than raw (23 -> 38, 577 -> 584 twice, 125 -> 128, 73 -> 76; -35 tok in all), all from maintenance sessions in this repo asking for whole listings (commit subjects in a range, the last few commits), where the full output is the answer. Too few calls to narrow SKILL.md yet (TRACKER.md, next step 6a); recheck after a week. 2026-11-20, a month in: still only 8 git calls against 594 test runs, all 8 over raw (-69 tok in all), all from Claude Code. Three since that read: the line-16 question (70 -> 79), a diff summary (307 -> 315, 11-13), and the one in the next entry. The head is barely used and saves nothing when it is; the question now is less "narrow SKILL.md" than whether to keep steering agents to it at all.

  • 2026-11-20. Line and range questions have a development set but no held-out one. evals/git_dev/lines (HYDRA_GIT_DEV_SET=lines, seeds 6600..6619, 20 worlds, 100 tasks, new phrasings) covers "line N of ", ":N", "lines N-M", A..B logs (6 of them branch..origin/branch in worlds behind their remote, the rest trunk..branch~1) and A...B diffs. First run 94/100; its failures were read and fixed (next entry, Fixed), then 100/100. So 100 is a development score. A held-out set on other seeds and phrasings, scored once without reading its failures, would show whether the fixes generalise. 2026-11-27: held-out set built and scored once. evals/git_holdout_lines (HYDRA_GIT_DEV_SET=holdout_lines, seeds 9400..9439, 40 worlds, 200 tasks, 40 GLM-5.3 wordings that no other set's wording is near): Hydra Nano v2 solved 194/200 (97.0%; plan 100%, evidence 97%, recall 98.3%, the model's own probe choice 75.9% before code corrections). Overall only; failures not read. The fixes mostly carry over to new wordings; the 3% left is evidence, not probe choice. Still open from the 58-commit question: a summary across many commits ("main themes, any new migrations") is beyond the menu; the range's log is the best evidence it can give, and file names per commit need show per commit.

  • 2026-11-20. Whether each client runs MCP servers inside its sandbox is still unverified (audit 5a); the docs settle part of it. Read the current official docs (Codex on learn.chatgpt.com, geminicli.com, opencode.ai, cursor.com, antigravity.google). No client documents that its sandbox covers stdio MCP servers; Gemini CLI's and Antigravity's sandbox pages speak only of shell commands. Approval by default: Cursor asks ("Cursor asks for approval before using MCP tools by default"), Antigravity asks ("Unconfigured MCP tool calls prompt for approval"), Gemini CLI asks unless the server has trust: true (Hydra never sets it), OpenCode allows (its base policy is allow; its own shell is allowed too, so no boundary is crossed there), Codex has a per-server default_tools_approval_mode with no documented default. Environment: Gemini CLI redacts secret-looking variables before starting a server; OpenCode passes its whole environment; the others do not say. Roots: Cursor documents support; OpenCode implies it; Codex, Gemini CLI and Antigravity do not say. Starting folder: OpenCode starts servers in the workspace; the others do not say. Left for a live check with dummies (plan in ~/security-audit-skill/hydra/run-1/NEEDS-VALIDATION.md): Codex in workspace-write, whether a hydra_run of a script that writes outside the workspace succeeds and whether it prompts. If it runs unprompted outside the sandbox, make hydra_run opt-in for Codex and stop its hook pointing at it. 2026-11-22, live attempt with codex exec -s workspace-write (Codex CLI 0.163.0) in a throwaway repo whose npm test writes a marker in the home folder: Codex never reached a model. ~/.codex/config.toml sets model = "gpt-6-sol", and OpenAI answered model_not_found: not supported when using Codex with a ChatGPT account; -m gpt-5-codex and -m gpt-5 got the same answer. So Codex cannot run at all on this Mac as configured, which likely explains why it never called Hydra in a month. The sandbox question stays open until the user picks a working model in Codex (/model). Also seen: codex exec waits on stdin unless given < /dev/null.

Fixed

  • 2026-10-17. Hydra is installed into the wrong Antigravity. This Mac runs Antigravity IDE (com.google.antigravity-ide; data in ~/.gemini/antigravity-ide, 5,159 files changed since 10-10). The old Antigravity app (~/.gemini/antigravity, ~/Library/Application Support/Antigravity) has not run since April, but hydra agents install writes the MCP entry to its ~/.gemini/antigravity/mcp_config.json, and install.mjs detects Antigravity by that folder. The IDE's bundle names ~/.gemini/config/mcp_config.json; that file exists and is empty (0 bytes), so the IDE has no Hydra MCP server. Skills: the skills CLI put the current skill in ~/.agents/skills/hydra (10-17), but the IDE loads ~/.gemini/config/skills/hydra (59 skills there), a stale 10-10 copy that still expects Ollama. Evidence: IDE session b23c0208 (10-17, project web-search), asked "Do you have access to hydra-nano?", read that stale SKILL.md, ran its hydra doctor (exit 2, hydra-nano:git missing), failed ollama pull hydra-nano:git and wrote the user a bug report for the maintainer. IDE session aa7647ae (web-search, 2.7 MB transcript) made no Hydra calls. Fixed in code and on this Mac (see Fixed). Seen working 2026-11-27: hydra improve --since 2026-11-20T12:00Z lists agent antigravity-client with 1 call through MCP (2026-11-26 18:09 UTC, hydra_os "Are there any python, kaggle, mlx, or training processes running right now?", 141 -> 148 tok, the whole output passed through with its command line). The old Antigravity app has not run since April, so this is the IDE reading the corrected config.

  • 2026-11-25. On Windows, reinstalling took Hydra's own MCP entries for someone else's (issue #10). A Windows reinstall (C:\Users\rahus, 2026-11-23) printed "already has a mcp.hydra entry that Hydra did not write; add this by hand" for OpenCode (opencode.jsonc) and Antigravity (.gemini\antigravity\mcp_config.json), the two tools whose entry an earlier install had written; Antigravity IDE, which had none, was registered. mentionsOurs in lib/integrations.mjs matched its path pattern against the entry's JSON text, where every backslash is doubled, so C:\\Users\\rahus\\.hydra\\scripts\\mcp.mjs never matched. The same check drives status and remove, so on Windows hydra agents status showed those MCP entries as missing and hydra agents remove left them. Hooks, the Claude Code hooks and Codex's TOML block test plain strings and were not affected. Now each string in the entry is tested on its own. New test in test/integrations.test.mjs with Windows paths (failed before the fix: status false); someone else's hydra entry is still left alone. Users on Windows rerun the installer, or hydra agents install, after updating.

  • 2026-11-22. Git and OS missed wordings they had not seen (holdout3: Git 94.2%, OS 98.0%). Found 2026-11-20 on the third holdout (evals/git_holdout3, evals/suite/quality/holdout3; 2,000 per head, built before scoring, scored once on a Kaggle T4, aggregates only, receipt evals/results/suite/holdout3/holdout3-summary.json): Files 1,962 (98.1%), Read 1,951 (97.6%), Test 1,950 (97.5%), OS 1,960 (98.0%), Git 1,883 (94.2%); 9,706/10,000 (97.1%), zero errors. Git and OS wordings there were written by Cloudflare GLM, and OS also mixes Windows and Linux output. Worked on without reading holdout3: new GLM-worded development sets, filtered so no wording is near a holdout3 one (Git evals/git_dev/glm, 800 tasks on seeds 9200..9239; OS evals/suite/quality/dev3, 400 tasks on seeds 125000+, Windows and Linux output). They reproduced the drop (Git 94%, OS 99%). Git: nearly every miss was the staging scope; scope() now reads "aren't staged yet", "excluding staged changes", "before staging anything" and "since the staged version" as unstaged, "including staged ones", "staged included" and "whether staged or not" as both, "what did I stage" and "marked for the next commit" as staged; "working-tree changes" (hyphenated) are edits, not the worktree list; "commits mentioning X" searches messages; a file named in the question is no longer a message filter. OS: "Is anything bound to TCP port N, and if so which process?" added an unnamed process list; a question about one port now keeps only the listener line, which already names the process. After: Git glm 800/800, OS dev3 400/400; every other Git and OS development set unchanged at 100%. Holdout3 rescored once afterwards on Kaggle (kernel v2, plan 6509ec46, aggregates only, 2026-11-22): Git 1,944/2,000 (97.2%, was 94.2%), OS 1,980/2,000 (99.0%, was 98.0%); Files, Read and Test unchanged; 9,787/10,000 (97.9%) overall, zero errors. Tests in test/git_options.test.mjs and test/hydra.test.mjs.

  • 2026-11-22. What Hydra changed on a machine could not be shown in one place. The user's second MiroFish run (14 simulated developer, security, manager and community agents on a seed of launch facts; report in /private/tmp/mirofish/hydra-sim-report-claude-v2.md; prediction, not user evidence, and its objections echo the seed) put retention on one lever: Hydra's safeguards are real but a reviewer has to discover them. hydra audit (--json) now lists, read-only and offline, every config file Hydra registered itself in with its mode and .before-hydra backup, which tools have ever called Hydra, the model server's address (flagged if not this machine), every network address Hydra contacts and when (install: github.com, huggingface.co, nodejs.org, npm; self-update: npm; everything else: the local model server, checked against the code), the ledger's place and mode, and what the MCP server can run. It warns when Codex's config is wider than its 0600 original. Three tests in test/audit.test.mjs, one proving the audit writes nothing.

  • 2026-11-20. A home-folder hydra-nano 0.2.0 reinstalled itself over newer versions (open since 2026-10-21). It happened again on 2026-11-20 at 16:06 local, three minutes after 0.3.5 was released: ~/.claude/skills/hydra, ~/.agents/skills/hydra and ~/.gemini/config/skills/hydra got exactly v0.2.0's SKILL.md, and Claude Code's settings, the Gemini, Antigravity and OpenCode configs, ~/.hydra/scripts and the server were all rewritten in the same minute. ~/.agents/.skill-lock.json named the source: /Users/rivansh/node_modules/hydra-nano/skills/hydra. On 10-17 npm install hydra-nano was run in the home folder, leaving ~/package.json (hydra-nano ^0.2.0) and ~/node_modules/hydra-nano 0.2.0; npx hydra-nano run anywhere under the home folder that is not its own npm project runs that local copy, not the latest release. That is also the likely cause of the 10-20 reinstall (earlier guess: a GitHub-release installer). Now: hydra self-update runs npx from a temporary folder; hydra doctor warns about any older node_modules/hydra-nano above the current folder or home, with the command to remove it; the README says npx hydra-nano@latest. The 0.2.0 copy itself is still on this Mac until the user removes it. Test in test/self_update.test.mjs. (Original entry: 2026-10-21. An install on 10-20 put 0.2.0 back after 0.3.0 was published. At 2026-10-20 23:05 local time, ~/.claude/skills/hydra, ~/.agents/skills/hydra and ~/.hydra/scripts were rewritten with exactly the v0.2.0 skill (checked with git archive v0.2.0; ~/.hydra/config.json was rewritten at the same minute). The Antigravity IDE copy was untouched. Likely cause: an installer took the latest GitHub release, which was v0.2.0 until the v0.3.0 release was created on 10-21; not confirmed. So telemetry from 10-20 23:05 to 10-21 ~17:00 UTC comes from 0.2.0 (old skill text, no trimmed-run rule, footer on every reply). Fixed on this Mac on 10-21 by copying the repo skill into all four places. To check: after a fresh npx hydra-nano and a skills.sh install, confirm both bring 0.3.0.)

  • 2026-11-20. "Registered" could not be told from "used". An outside review (the user ran MiroFish, a multi-agent simulation, over Hydra's own docs via GitHub Copilot; reports in /private/tmp/mirofish/hydra-sim-report*.md, built only from README/TRACKER/IMPROVEMENTS, so not user evidence) put its strongest point on installs that look complete but never take part: tool configs are written, yet nothing showed whether the tool ever called Hydra. hydra agents status now adds, per tool, the last call and call count from the local ledger (MCP client names and hook names matched per tool) and any folders refused under the roots limit. On this Mac it shows Codex, Gemini CLI, Antigravity and Antigravity IDE as "never called", OpenCode last called 2026-10-24 (19 calls). The review also caught two stale lines in docs/how-it-works.md: a "1.2 GB" model (the old Ollama qwen3.5 size; the GGUF is ~812 MB) and "only Windows verified" (macOS arm64 runs daily, Linux x64 CUDA ran on Kaggle); both corrected. Test in test/ledger.test.mjs.

  • 2026-11-20. One repeated error filled the test digest's whole budget; short runs cost a few tokens more than raw. A month of real use (hydra improve --since 2026-10-21): 602 test runs returned ~101k tok, and six of them returned ~4,380 tok each, the digest's ceiling (four npm run check, two npx prettier --check ., product-research, 10-28 to 11-13), a quarter of the month's total. The Claude Code transcripts show why: prettier reported "Error occurred when checking code style in 435 files" because agent worktrees under .claude/worktrees/ held copies of one HTML fixture, and the digest returned the same SyntaxError and code frame once per copy. That project has since ignored .claude. Now collapseRepeats shortens a failure block to its first line (which names its path) when the block repeats an earlier one word for word with paths set aside; line numbers stay in the comparison, and a note says how many blocks were shortened. Separately, 38 short runs cost 209 tok in all: 18 empty passes returned (no output) (kept: it says the run printed nothing rather than claiming a passing suite) and 20 short failures carried $ <command> (exit N); they now carry (exit N) only, since through MCP the exit code is the one failure signal and the agent knows its command. Test development sets unchanged (200/200, 1,380/1,380, 572/572, same sizes); benchmark 20/20, 50.6% fewer tokens. Tests in test/test_logs_evidence.test.mjs.

  • 2026-11-20. The Read head's outlines and symbol slices disagreed with the language parsers. Found by checking Hydra against the Read gold builder's own parsers (stdlib ast, pinned tree-sitter, installed into ~/.hydra/quality-parsers as the builder's header says) on every development-split source file, never a held-out one (the inventory marks each file's split). Before: Go outlines matched exactly in 369 of 585 files (63%): JavaScript's var x = pattern caught Go var blocks, and generic funcs (func Map[T any](), non-struct types (type Mode int), aliases and grouped type (…) specs were missed. Symbol slices were about 99%: lookups were case-blind (Go insert found Insert), JavaScript's let x = matched Rust locals (let len = self.len()), Python one-line defs ran on, trailing comments extended blocks, a def inside a triple-quoted string won, a 'file://' string hid a brace from the counter, Rust trait signatures beat their default fn bodies, and a multi-line bodyless Go func ran into the next one; JavaScript generators and Rust unsafe trait were missing from outlines. read.mjs now uses per-language definition rules, exact-case matches first, string-aware scanning for Go raw strings and Python triple quotes, and parser-shaped block ends. After: 884/884 development files' outlines and 7,070/7,070 development symbols match the parser. Read development 200/200 (was 199). Read held-out, scored once afterwards: 982/1,000 (98.2%, was 961). Five tests in test/read-quality.test.mjs, each failing on the old code.

  • 2026-11-20. A short cargo failure came back larger than the raw log. The 20-task test-log benchmark's one miss (cargo_test_panic, 849 chars, just over the 800 pass-through): the diff-line header rule [-+]\s matched the + in cargo's Finished \test` profile [unoptimized + debuginfo], so the build preamble and every ... okline rode in as failure context, plus theRUST_BACKTRACEhint. Cargo status lines, passing-test lines and that hint are now never failure evidence. Benchmark 20/20 (was 19/20), 49.8% fewer tokens (was 47%), the cargo case 213 -> 93 tok. Test development sets unchanged in solved (200/200, 1,380/1,380, 572/572) and 0.2% to 2.1% smaller. Test intest/test_logs_evidence.test.mjs`.

  • 2026-11-20. hydra_git and the other MCP tools accepted any absolute cwd (audit 5b). A client that sandboxes its shell but not MCP servers could reach every repository the user owns through hydra_git, and run another project's tests through hydra_run. Now cwd must sit inside the client's MCP roots (asked for with roots/list after initialized and on roots/list_changed), else inside the folder the server started in, or HYDRA_MCP_ROOTS when set. Checked after symlinks resolve. A refusal tells the agent which folders are allowed, and is recorded as a ledger error with the client's name (hydra_git in <path>), so hydra improve shows it. Watch those errors for Codex, Gemini CLI and Antigravity: their docs state neither roots support nor the folder they start servers in, so a client that starts Hydra somewhere unrelated would have every call refused. Four tests in test/mcp.test.mjs.

  • 2026-11-20. Range questions picked show HEAD and invented message filters. From the first lines development run (94/100): "What paths does main...fix/cors-header touch?" got git show HEAD plus the range's log (4 of 20 range_diff tasks), and "Summarise the commits in trunk..x~1: what themes stand out?" got --grep=themes (2 of 20 range_log). With a written-out range, show without a rev is dropped; when the plan has no log or diff, a three-dot range or a question about files/paths/patch/touch gets the range's diff, anything else its log; and a message filter is kept only if the question asks about messages or says the word is mentioned. Two tests in test/git_options.test.mjs. lines set 100/100 after.

  • 2026-11-20. redact() was not idempotent and could leak past a ;. Re-applying it masked more (p=***; s=*** lost its ;, a=***' if (x)… swallowed code), found while masking old rows. Writing the test showed a first-pass leak too: in TOKEN=abc;KEY='two words' the value ran through the ;, so KEY='two was masked as part of TOKEN's value and words' stayed in clear. A value now ends at whitespace or ;, &, |, and a value that is already *** is left alone; a real value that only starts with *** is still masked. Test in test/ledger.test.mjs (redact(redact(x)) === redact(x) on heredoc and mixed samples).

  • 2026-11-20. The git head answered a line question with the file's log. (Open since 2026-10-23.) "Which commit last changed line 16 of test/mcp.test.mjs and when" ran git log -n15 -- test/mcp.test.mjs, whose top row (15e7a08) never touched the line. The prompt says "a file's last edit uses log", and blame could not take a line range anyway. Now blame takes -L N,M, built by code from "line N", "lines N-M"/"N to M" or file:N in the question (at most 100 lines; the model never supplies it), and a line question with a file in it drops the model's log/show/diff of that file for the line's blame. A line-sliced blame is returned whole with no answer-step call. Prompt unchanged. Live: the same question now runs git blame -L 16,16 -- test/mcp.test.mjs and names d3a6a60, which git log -L16,16:test/mcp.test.mjs confirms. Four tests in test/git_options.test.mjs.

  • 2026-11-20. A git question about 58 commits came back with 3 tokens of raw output. 2026-10-24, Claude Code in product-research: "Summarise the 58 commits in master..origin/master: …". Reproduced on a scratch repo 58 behind its remote: the plan ran git log -n50 master..HEAD, which is empty because HEAD is master; the log probe could only say base..HEAD. Now a range written in the question (A..B or A...B) is used as written for log and diff once git resolves both ends to commits, replacing any base, and a log is added if the plan has none. When the 50-record cap cuts such a range, a last line says so: (50 of 58 commits in master..origin/master shown; …). Four tests in test/git_options.test.mjs; unresolvable ends leave the plan alone.

  • 2026-10-23. The MCP test wrote a fixture smell call into the user's ledger on every npm test. test/mcp.test.mjs set HYDRA_TELEMETRY=0 only on the server it spawns, but its "smell, refactor and design" test calls callTool in-process, and that runs the real CLI with the test runner's env. Evidence: 6 refactor rows on 10-21 (agent: "", agentDetail: mcp-client, via: mcp, smell /private/var/folders/.../hydra-files-*/app.js, 18 -> 35 tok), reproduced on 10-23 with a scratch HYDRA_HOME. The test file now sets HYDRA_TELEMETRY=0 for its own process; npm test with a scratch HYDRA_HOME passes 174/175 (1 skipped) and writes no row besides the outer hydra run. Older fixture rows stay in the ledger.

  • 2026-10-21. Security audit (cloudflare security-audit skill, quick profile, run in ~/security-audit-skill/hydra/run-1). 6 confirmed findings, 3 needing validation, each reproduced by a hunter and independently by a fresh verifier in a no-network Docker sandbox. Fixed here, each with a regression test:

    • High: hydra_run ran arbitrary code. The gate matched only the runner prefix, so node --test /any/file.mjs, --import, make --eval, cargo --config and go -vettool all passed. runArgv in mcp.mjs now refuses paths that leave cwd (after ../ and symlinks) and code-loading flags per runner; the project's own npm test still runs.
    • Medium: hydra_smell/refactor/design read any host file and echoed fragments (a dummy DATABASE_URL password came back). They now take only source files inside cwd, no dotfiles.
    • Low: the ledger kept inline credentials from commands at the default mode. record() masks NAME=value, URL passwords and secret-named flags in command, run and test questions, and writes the ledger 0600 in a 0700 home.
    • Low: config rewrites widened 0600 files to 0644 (~/.codex/config.toml on this Mac went 0600 to 0644; its .before-hydra backup is still 0600). replaceFile() keeps the original mode.
    • Low: any local process on 127.0.0.1:11435 was trusted as Hydra's server. ownServer() now requires server.pid to name a live process of this user running config.server.
    • Low: the maintainer dashboard listened on 0.0.0.0 and started evals for any origin. It now binds 127.0.0.1, checks Host, requires a same-origin JSON POST, and drops Access-Control-Allow-Origin: * (a bad Host header no longer crashes it).
    • Needs validation, hardened anyway: the hydra_os env probe now withholds names like DATABASE_URL/*_DSN/GH_PAT/MYSQL_PWD and any value with a URL password or connection-string key (SKILL.md had promised names only); llama-server starts with --no-slots --no-webui --cors-origins localhost (checked on b11563); MCP tools carry readOnlyHint annotations so clients can gate hydra_run. Whether a client sandboxes its shell but not MCP servers stays an owner check per client.
    • The final coverage critic found hydra smell --diff running plain git diff; a repo diff.external driver ran (test reproduced it). It now uses the git head's guards via git.diffText(), and blame adds --no-textconv. Still deferred, not reviewed: hydra_git accepts any absolute cwd.
  • 2026-10-21. A branch name in a range question became a message filter. list the commit subjects between v0.2.0 and main ran git log -n50 -i --fixed-strings --grep=main v0.2.0..HEAD and returned 1 commit; the range held 22. The range was right, but "subjects" counted as asking about messages, so the model's grep: main was kept and the answer was silently incomplete. The agent noticed only because it expected more. Fix in clean() (lib/git.mjs): a grep word that git resolves as a commit (a branch or tag) is dropped unless the question searches messages for it ("messages that mention main", "with main in their subjects"). New test covers both. The same question now returns the whole range. Git development sets, local llama.cpp, before and after: original 200/200, extended 800/800, paraphrase 800/800, zero errors, identical probes; evals/git1 untouched.

  • 2026-10-20. The skill recommended Hydra for code search and file slicing. skills/hydra/SKILL.md now triggers on the three measured uses only: test and build runs, git history/diff/blame, and machine inspections. It tells agents to read and search source with their own tools (the strict trial measured +72% tokens for forced source extraction, and 0/12 sessions chose it unprompted), and mentions search, read, smell, refactor and design only as commands for when the user asks. This matches the MCP server's instructions and the SessionStart hook. Measure adoption against hydra improve before and after.

  • 2026-10-20. hydra design was counted as costing more than raw. A pattern lookup replaces no command output, so it is now recorded with raw: 0, returned: 0 and its size in replyTokens: neither a saving nor a cost, and no footer. Rows before this date keep the old figures. New test in test/refactor.test.mjs.

  • 2026-10-20. The footer made outputs passed through whole cost more than raw. withFooter in hydra.mjs prints [hydra <head> · read ... returned ...] only when the reply is smaller than what was read. Short test runs, failing ones included, now come back as the output alone (the exit line stays on failures), and small git answers as the command line plus its output: do I have any stashes? is now $ git stash list / (no output). The command line stays, because it names the read-only command the lines came from. The ledger still records every call. Every head goes through the helper, and the MCP server passes it on unchanged. New test in test/hydra.test.mjs; Node suite 164 tests, 163 pass, 1 Windows-only skip. The digests themselves are unchanged, so the test-log benchmark and the git sets are unaffected.

  • 2026-10-20. A pattern grep on a test run is still turned back, but the denial now says how to pass. A bare | grep -E <pattern> can return the whole log, so it stays a denial (one seen since 10-17). The denial text now says | grep ... | head -40 passes, which the trimmed rule already allowed. Watch hydra improve for denials of this shape followed by a raw retry.

  • 2026-10-17. The test hook turned back runs the agent had already cut short. testRun in lib/claude_hooks.mjs now looks at each run's own pipeline: a later tail/head keeping at most 40 lines (10 when not given), grep -c or wc lets it through, recorded as hook decision trimmed (counted by hydra improve). tail -f, tail -n +N, a plain grep and a second run without a cut are still turned back. The deny message says so, so the agent can trim instead of reaching for HYDRA_RAW=1. Replayed against the ledger: of the 11 denials and 18 raw bypasses recorded on 10-17, 23 would now pass as already cut, 2 are still turned back (a bare node --test, and pnpm test | grep -E ...), and 5 could not be replayed because the ledger keeps only the first 300 characters (their full commands in the transcripts all end in | tail -N). Tests in test/claude_hooks.test.mjs; installed here (Claude Code skill, ~/.agents, ~/.hydra/scripts, the Antigravity IDE skill).

  • 2026-10-17. Antigravity IDE gets Hydra where it looks. New tool antigravity-ide in lib/integrations.mjs, detected by ~/.gemini/antigravity-ide: the MCP entry goes to ~/.gemini/config/mcp_config.json, and the skill folder (SKILL.md plus the scripts it names) to ~/.gemini/config/skills/hydra, replacing an older hydra skill there and leaving any other folder alone. installSharedScripts now keeps SKILL.md beside ~/.hydra/scripts for that copy. The old antigravity target stays for the older app. Regression cases in test/integrations.test.mjs (empty config file, stale skill replaced, other skills untouched, clean removal). Applied here with hydra agents install antigravity-ide: the empty config is backed up as mcp_config.json.before-hydra; the IDE's skill copy now runs hydra doctor with exit 0 (it failed with hydra-nano:git missing before) and answers a git question.

  • 2026-10-17. Antigravity's calls were recorded as shell. caller() knew only HYDRA_AGENT, AI_AGENT and CLAUDECODE, which Antigravity does not set, so the 28 shell rows of 10-17 (10:51 to 11:18 UTC, inside IDE session f2a3fb13 in this repo) were its calls. macOS passes the launching app's bundle id to child processes (this Claude Code session sees __CFBundleIdentifier=com.microsoft.VSCode), so com.google.antigravity-ide or com.google.antigravity now records agent: antigravity with the bundle id as agentDetail; Claude Code inside Antigravity's terminal stays claude-code. Test in test/ledger.test.mjs. That Antigravity's own processes carry this bundle id is inferred, not yet seen in a live IDE session. Older rows stay shell.

  • 2026-10-17. The refactor tests wrote fixture calls into the user's ledger. test/refactor.test.mjs ran the real CLI (smell, refactor, design on a temporary file) without HYDRA_TELEMETRY=0, the same mistake as test/runtime.test.mjs below: 12 of the refactor head's 25 rows are its /var/folders/.../hydra-refactor-* fixtures. Its CLI calls now set HYDRA_TELEMETRY=0; 8/8 tests pass and a run adds no ledger rows. Older fixture rows stay in the ledger.

  • 2026-10-17. Tiny test outputs cost more through Hydra than raw. A short passing run came back larger than it went in because the reply repeated the command line, often a long absolute path (29 -> 53 tok). A short pass now returns the output alone, and every other reply names the program without its directory (/home/u/.venv/bin/python -m pytest -> python -m pytest). The same command now returns 29 -> 29. Test-log benchmark unchanged: 19/20 solved, same task per task; returned 2,615 -> 2,613 tok (its commands are already short).

  • 2026-10-17. Hook rows and CLI rows named the agent differently (AI_AGENT is ..._harness in hooks, ..._agent in the shell). agent now keeps the family (claude-code) and agentDetail the full value.

  • 2026-10-17. Hook latency was not recorded. Every hook decision now carries hookMs (the hook process lifetime); passing commands are recorded without their text. First reading: p50 10 ms. hydra improve reports it.

  • 2026-10-17. The test hook read heredoc bodies as commands. A line inside <<'EOF' data that began with a venv python -m pytest path was taken for a test run and stopped the command. simpleCommands now skips heredoc bodies; regression cases in test/claude_hooks.test.mjs.

  • 2026-10-17. The test hook stopped a grep whose quoted pattern contained pytest. testRun split shell lines on | even inside quotes, so grep -n "\"test\|pytest\|unittest" package.json looked like a pytest run and cost a turn. It now splits only outside quotes (simpleCommands), with regression cases in test/claude_hooks.test.mjs.

  • 2026-10-17. The test suite wrote fixture calls into the user's ledger. test/runtime.test.mjs ran the real CLI (ask --head git 'show modified files', a bad backend, an unreachable server) without isolating telemetry. 31 of the git head's 68 "saved nothing" rows are that fixture question, and two errors in hydra improve came from the same test; where the other 37 came from (other tests, evaluations or real use) is not recorded. The test now sets HYDRA_TELEMETRY=0; the hook tests use a temporary HYDRA_HOME. Rows written before this fix are still in the ledger; use --since 2026-10-17T05:00Z for clean numbers (a time without Z is local time).

  • 2026-10-17. Too little telemetry to learn from. Calls recorded only head, question, tokens and seconds; hook decisions and failures were not recorded. Telemetry v2 adds the caller (agent, session), exit code, command time, model calls and model time, hook denials and HYDRA_RAW=1 bypasses, session starts, and errors, all local. hydra improve reads them.

By design

  • Hydra does not save tokens on reading source files; Read and Grep stay the default there (forced delegation measured +72% tokens, TRACKER.md step 12).