Skip to content

feat: Deep Research agents, spend guard, citations (0.4.0) - #11

Merged
Booyaka101 merged 4 commits into
mainfrom
feat/deep-research-agents
Aug 8, 2026
Merged

feat: Deep Research agents, spend guard, citations (0.4.0)#11
Booyaka101 merged 4 commits into
mainfrom
feat/deep-research-agents

Conversation

@Booyaka101

Copy link
Copy Markdown
Owner

Ships gemcatch 0.4.0. Includes the better-sqlite3 13.x bump from #10 (this branch is stacked on it, so #10 closes as merged with this).

Added

  • Research agents. -a, --agent <id> on research and batch. interactions.create is sent agent instead of model (mutually exclusive; passing both is a clean error and writes nothing). Aliases resolve through ONE table: deep-research -> deep-research-preview-04-2026, deep-research-max -> deep-research-max-preview-04-2026; any other value passes through unchanged, so a future agent id needs no release. Agents mandate background=true, which gemcatch has always set, and the free tier drops interactions after 1 day -- which is exactly the race the daemon exists to win.
  • Spend guard. Deep Research is documented at $1.00-$3.00/task and Max at $3.00-$7.00, quoted with the docs' own hedge about preview-rate estimates being subject to change. Every agent submission prints its band; batch prints N x band as a total; an interactive y/N is required, --yes when stdin is not a TTY, and --dry-run previews the full projected spend and submits nothing. Declining or refusing leaves the store untouched.
  • Citations persisted (new column), printed under the report as Sources:, and carried in --json.
  • Result extraction now takes the final answer-bearing step (docs: steps[-1].content[0].text) with a collect-everything fallback -- one rule for agent and model runs, no string-matching on the agent id.
  • Additive migration: agent + citations. A pre-0.4.0 tasks.db upgrades in place, keeps every row, reports agent as NULL.

Changed

  • Default model gemini-3.1-flash-lite -> gemini-3.5-flash-lite (GA 2026-07-21).

Verification

npm test: 64 green -- all 49 pre-existing cases plus 15 new (agent response shapes, every spend-guard path, --model+--agent rejection, unknown-agent 4xx surfaced unretried, incomplete budget-pause retiring cleanly, agent 404-after-retention, v0.3.0 migration). No key, no network. Also driven end-to-end from a packed tarball installed into a clean directory against a standalone mock.

Not verified: a live-API agent run, which costs $1-$3 per task.

Booyaka101 and others added 4 commits August 7, 2026 00:16
Re-opens what #9 closed, with a corrected reading of why #9 failed.

#9 was closed on the claim that 13.0.0-13.0.2 ship no prebuilt binaries. That
was wrong: it was read off the GitHub *release* assets, which are empty for
13.x, not off the npm tarball, which is what npm actually installs. Registry
metadata is unambiguous:

  13.0.0 / 13.0.1  scripts.install = "node-gyp rebuild"   gypfile = true
  13.0.2 / 13.0.3  scripts.install = absent                gypfile = false

and the 13.0.2 and 13.0.3 tarballs both carry all 8 prebuilds, win32-x64
included. So 13.0.2 is already the fixed shape — the compile-from-source window
was 13.0.0-13.0.1 only.

What that does not yet explain is why #9's CI ran `node-gyp rebuild` for
13.0.2 and died on VS 2026 detection under node 22. I could not reproduce it:
`npm ci` against #9's exact package.json + lockfile on Windows, node 22, under
npm 10.9.3, 10.9.8 and 11 installs 44 packages in ~2s with no compile. Five
clean attempts, no repro. This PR is the experiment that settles it — same
bump, but with a lockfile regenerated by a real `npm install` rather than
Dependabot's metadata-only rewrite, which is the one input I could not
reproduce locally. If CI is green, that difference was the cause.

Fallout of the move, all consistent with the install script being gone:
allowScripts drops better-sqlite3 entirely, script-lens.json records zero
packages with install-time behavior, and the lockfile loses 413 lines as the
prebuild-install subtree goes with it.

Offline tests pass. Cooldown: 13.0.3 clears the 72h window tomorrow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…3.5-flash-lite (0.4.0)

- research/batch grow -a/--agent: interactions.create is sent `agent` INSTEAD
  of `model` (mutually exclusive; passing both is a clean error). Aliases
  resolve through one table (deep-research, deep-research-max -> the full
  preview ids); unknown ids pass through so future agents need no release.
- Spend guard: agent submissions print the documented per-task band
  ($1-$3 / $3-$7, quoted with the docs own hedge), batch prints N x band,
  and require y/N confirmation -- --yes when stdin is not a TTY, --dry-run
  to preview. Declining or refusing writes zero rows.
- Result extraction takes the final answer-bearing step (docs:
  steps[-1].content[0].text) with a collect-everything fallback; citations
  are persisted, printed as Sources:, and carried in --json.
- Additive migration: agent + citations columns; pre-0.4.0 stores upgrade
  in place, agent NULL. list grows an AGENT column when relevant; stats
  tallies agent runs.
- Default model: gemini-3.1-flash-lite -> gemini-3.5-flash-lite (GA 2026-07-21).
- 15 new offline tests (agent shapes, guard paths, budget-pause incomplete,
  agent 404 retirement, v0.3.0 migration); all 49 pre-existing tests intact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
better-sqlite3 13.x dropped its `install` script and ships N-API prebuilds
in the tarball, so nothing in the tree needs building. Without
--ignore-scripts npm sees its binding.gyp, falls back to `node-gyp rebuild`,
and node 22 / windows-latest fails: the runner image now carries Visual
Studio 18, which node-gyp 11.5.0 (bundled with Node 22) reports as an
unknown version. Node 24 ships a newer node-gyp and passed, which is why
only one matrix cell was red.

Verified on Windows + Node 22 (the failing combination): npm ci
--ignore-scripts leaves no build/Release, loads prebuilds/win32-x64.node,
and the full suite passes. The package job still does a real, un-ignored
global install from the packed tarball, so the user install path stays
covered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Booyaka101
Booyaka101 merged commit 5a6d4a4 into main Aug 8, 2026
8 checks passed
@Booyaka101
Booyaka101 deleted the feat/deep-research-agents branch August 8, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant