georgelubaretsi/piebird-kagi-search
v0.1.0MIT
Kagi web search for coding agents, with your own Kagi account
Changelog
All notable changes to this plugin are documented in this file.
The format is based on Keep a Changelog, and this plugin adheres to Semantic Versioning.
[Unreleased]
Added
- Kagi search for agents, with the person's own Kagi account (no API key, no credits): the tools
kagi_search,kagi_batch_searchandkagi_quick(in front of the model from the first prompt),kagi_news_search,kagi_news,kagi_news_categories,kagi_news_chaos,kagi_news_filter_presets,kagi_smallwebandkagi_auth_status. They run inside omp (src/) and inside Claude Code, as a mod's own tools (com.anthropic.claudecode/), and as an MCP server in the plugin's program for Codex and the desktop apps (program/); one core (core/) holds them, the "search" setting and every word the model reads (core/model.ftl). native/piebird-kagi-search settingsopens the "Search with Kagi" choice in your browser and saves it for every agent, for Codex and the desktop apps, which have no settings screen for it.- The vault,
native/kagi-vault: a small Go program that keeps the Kagi session and talks to Kagi, which the tools ask by operation name. It answers with Kagi's results, never the session, and nothing is downloaded at run time. On its own command line it signs in (sign-in,sign-in --link '<Session Link>'), signs out, says whether the session works (status) and performs an operation (call <operation>, the input as JSON on stdin). The README says who can read the session where it is kept, and linksdocs/security.md. - Raw mode, for what the tools don't cover: every tool takes
format: jsonfor its data as JSON;kagi_raw_readsends a GET to any page of kagi.com (signed in) or news.kagi.com and returns the response as it came, andkagi_raw_writesends any other request, which may change the account. A response is never followed off Kagi, never carries the session token (as written or URL-encoded) nor a cookie Kagi sets; a request can't setCookieorHost, and a read never reaches the sign-out page. A body over 32 KB is saved to a file in the person's cache folder for a day, with its size and how it starts. - Signing in from the browser: the first search without a session opens a page on this computer
that sends the person to Kagi's Session Link and takes it when they paste it; the search
answers once they have, or says where the page is. The session is kept in the system's secret
store (the macOS Keychain, Windows Credential Manager, the Secret Service on Linux, else a file
only the person can read);
KAGI_SESSION_TOKENoverrides it. - Requests carry the installed Chrome's User-Agent and client hints, as a browser's would.
- Skill
kagi: the tools, raw mode, signing in, and the vault's command as the fallback. - Setting "Search with Kagi": how much the agent relies on Kagi.
first(the default): it searches with Kagi, and its own web search stays out of the way until Kagi fails in the session (out of reach, a sign-in needed, a vault that doesn't answer; not a call the agent got wrong);only: Kagi alone, its own web search refused;offered: Kagi is one more way to search. The agent gets instructions to match. Choose it for every agent in~/.agents/piebird/settings.json, for a project in its.agents/piebird/settings.json, or for one agent in its own settings (omp:omp plugin config set; Claude Code:/plugin configure), which wins there. - In omp, the built-in
web_searchis hidden to match the setting. - In Claude Code (2.1.287 or later), the mod does the same for the built-in
WebSearch: it waits behind tool search and a call to it is refused with a pointer tokagi_search; withfirst, it runs while the plugin has no vault built. - For Codex, a hook (
com.openai/, run by the plugin's program) that refusesweb.runsearches to match the setting. Codex doesn't run the hooks of plugins in this format yet, so the build leaves it out of the Codex manifest for now. - What the model sees: every text the model gets from the plugin, in omp, Claude Code and Codex, from the vault's replies to pages captured from Kagi.
- README, with a demo video: omp, Claude Code and Codex each answer a question about this week's software with Kagi search.
Changed
- A tool that fails in the plugin's own code, or gets arguments its schema doesn't take, tells
the model so in the plugin's words (
error-crashed,error-argumentsincore/model.ftl). - In omp, a project's
.omp/plugin-overrides.jsonno longer overrides your own choice of "Search with Kagi": it ranks with the project's settings file, below yours. - The program no longer takes
-agent search=<choice>: it reads the settings files. kagi_newsnames its common categories (World, Technology, Science, Business, Sports), so an agent asks for one without listing them first.- Renamed from
kagitopiebird-kagi-search, one name for the folder,plugin.json,package.jsonand the catalog: install it aspiebird-kagi-search@piebird. omp and Claude Code name its tools after the plugin, so their names change with it. - The README installs it with the piebird installer, which brings its vault:
omp plugin installandclaude plugin installget the plugin without one, since a marketplace carries only the repository's files.
Fixed
- The sign-in page ends as soon as you're done; it could keep the vault waiting 5 more seconds when the browser had opened a connection ahead of time.
- When Kagi refuses the session in
KAGI_SESSION_TOKEN, a search no longer opens the sign-in page and waits for you: the variable comes before a kept session, so signing in couldn't fix it. The tools andnative/kagi-vault statussay to put a current token in it or remove it. - A new omp session applies its own project's setting: web_search comes back where Kagi is only offered after a session that hid it, and a Kagi failure in one session no longer keeps web_search out in front in the next. web_search you turned off yourself stays off.
- In Claude Code,
/clear,/resumeand/branchstart the next conversation over: it no longer inherits the last one's Kagi failure or the setting read in another project.