Documentation
¶
Overview ¶
Package agentplugin manages the lich companion plugin inside the provider CLIs that can run it: whether it is installed, whether a newer release exists, and installing or updating it. Every provider of the registry runs the same plugin from the same repository; what differs per provider — the subcommands, where the installed version is read from, and whether there is a CLI at all — lives in claude.go, codex.go, antigravity.go, opencode.go, omp.go and crush.go.
Three shapes, decided by the harness rather than by lich:
- Claude Code, Cursor CLI, opencode and oh-my-pi load lich's own copy of the plugin per session (bundle.go), so nothing in their config decides whether a lich session has it. Their install unpacks that copy and takes out what a lich of the past installed there; opencode and oh-my-pi still get the theme skill, and oh-my-pi and Cursor lich's MCP server, in their own directories.
- Codex is driven through its own plugin CLI, the supported interface, and lich turns the plugin back on before each spawn (reenable.go).
- Antigravity, Crush and Kiro CLI have lich write the files the release published: a customization directory under Antigravity's global `config/plugins/`, hook scripts plus a delimited block of `hook add` lines into Crush's crushrc, and an agent of lich's own for Kiro. Each carries the version it installed, a marker line or a field in a manifest lich owns outright, the only record of what is installed where the harness keeps none. Antigravity does have a plugin CLI; antigravity.go says why it is not the install.
Index ¶
- Constants
- func BundleDir() (dir, version string, ok bool)
- func ClaudeAsksSubagentHook(profileDir string) bool
- func ClaudeInstalledIn(string) bool
- func ClaudeNestsSubagentCards(profileDir string) bool
- func ClaudeRunsSubagentCards(profileDir string) bool
- func Compatible(version string) bool
- func MCPServers(provider, cwd, profileDir string) []string
- func Reenable(kind, profileDir, bin string) (bool, error)
- type BinResolver
- type Problem
- type Service
- func (s *Service) ClaudeProfileStatus(slug string) (Status, error)
- func (s *Service) Ensure()
- func (s *Service) EnsureFor(kind string)
- func (s *Service) HasTools(provider string) bool
- func (s *Service) InstallInClaudeProfile(slug string) error
- func (s *Service) InstallInCodexProfile(slug string) error
- func (s *Service) Installed(provider string) bool
- func (s *Service) Problem(_ context.Context, _ api.None) (Problem, error)
- func (s *Service) RepairRegistrations()
- func (s *Service) Retry(_ context.Context, _ api.None) (api.None, error)
- func (s *Service) SetEmit(emit func(name string, data any))
- func (s *Service) SetInUse(fn func() []string)
- func (s *Service) Status(_ context.Context, _ api.None) ([]Status, error)
- func (s *Service) Watch()
- type Status
Constants ¶
const ( // PluginVersionFloor is the oldest plugin release this lich supports: the // first to name itself in the X-Lich-Plugin header, so every supported // install says which release a report comes from. PluginVersionFloor = "0.13.0" // PluginVersionCeiling is the first release past the newest contract this // lich implements (0.23, whose done report says the turn left background // work running, docs/hooks/session-state.md), and the first one it cannot // vouch for. PluginVersionCeiling = "0.24.0" )
The plugin releases this lich speaks the hook contract with (docs/hooks/README.md, Versioning). The plugin bumps its minor for a contract change (its major, from 1.0) and its patch for anything else, so every release below the ceiling sends only what this lich accepts.
const EditNoteRelease = "0.22.0"
EditNoteRelease is the first lich-plugin release whose touched report names the paths it wrote and hands lich's edit-overlap note to the model (docs/hooks/session-touched.md).
const ExtensionSkillRelease = "0.21.1"
ExtensionSkillRelease is the first plugin release that ships extensionSkill.
const NestedSubagentCardsRelease = "0.19.0"
NestedSubagentCardsRelease is the first lich-plugin release whose mod tells a worker by LICH_SUBAGENT_DEPTH rather than by LICH_SUBAGENT_CARDS=off (hooks/worker-answer.js), so a worker can open cards of its own and still answer its errand. An older one reads a worker without that variable as a session that answers nothing.
const ( // OMPExtension is the extension's path inside the plugin, and ompFile the // name a lich of the past gave it in omp's extensions directory. OMPExtension = "omp/lich.js" )
const ( // OpencodeModule is the module's path inside the plugin, and opencodeFile // the name a lich of the past gave it in opencode's plugin directory. OpencodeModule = "opencode/lich.js" )
const PluginKey = pluginKey
PluginKey is how Claude Code names the lich plugin, the key a port of a profile's plugins leaves to InstallInClaudeProfile.
const SubagentCardsRelease = "0.15.0"
SubagentCardsRelease is the first lich-plugin release whose Claude Code mod runs a general-purpose subagent as a lich session (hooks/agent-cards.js).
const SubagentHookRelease = "0.22.0"
SubagentHookRelease is the first lich-plugin release whose pre-tool hook asks /subagent (docs/hooks/subagent-cards.md) and whose mod no longer converts subagents itself, so LICH_SUBAGENT_CARDS no longer means anything to it.
Variables ¶
This section is empty.
Functions ¶
func BundleDir ¶
BundleDir is the plugin release lich hands its sessions: the newest compatible one unpacked, or ok false when none is.
func ClaudeAsksSubagentHook ¶
ClaudeAsksSubagentHook reports whether the release Claude Code sessions load, in any profile, is one whose hook asks lich. It reads the disk on each call.
func ClaudeInstalledIn ¶
ClaudeInstalledIn reports whether a Claude Code session started in the config directory dir loads the plugin, which it does whenever lich has one.
func ClaudeNestsSubagentCards ¶
ClaudeNestsSubagentCards reports whether the release Claude Code sessions load, in any profile, is one a worker can open cards from. It reads the disk on each call.
func ClaudeRunsSubagentCards ¶
ClaudeRunsSubagentCards reports whether the release Claude Code sessions load, in any profile (profileDir, "" for Personal), is one whose mod turns subagents into lich sessions. It reads the disk on each call.
func Compatible ¶
Compatible reports whether a plugin release speaks the contract this lich implements. An unreadable version sorts as 0.0.0 and is not compatible.
func MCPServers ¶
MCPServers names the MCP servers whose tools a session of this provider, started in cwd, can call — sorted, with lich's own always among them, since lich is registered wherever it spawns a session. profileDir is the profile the session runs in, "" for Personal.
Types ¶
type BinResolver ¶
type BinResolver interface {
ProviderBin(providerID, projectID string) string
ProviderEnabled(providerID string) (bool, error)
}
BinResolver supplies the binary to shell out to for a provider, and whether the person turned it on. The store implements it; the empty project id asks for the global value, and an empty return means "the provider's default name on PATH".
type Problem ¶
type Problem = api.PluginProblem
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service reports and manages the lich plugin's install state per provider.
func (*Service) ClaudeProfileStatus ¶
ClaudeProfileStatus is Status's Claude Code row for one profile, which runs the same release Personal does.
func (*Service) EnsureFor ¶
EnsureFor runs a pass in the background when kind's session is about to start without the plugin, or the last pass failed; "" leaves the provider out of the question. A pass already running is not started again.
func (*Service) HasTools ¶
HasTools reports whether a provider's sessions can call lich's own operations — whether a relayed message may name a tool rather than the command line.
True for the three lich registers at spawn, and for the ones that get them with the plugin, once the installed one is new enough.
func (*Service) InstallInClaudeProfile ¶
InstallInClaudeProfile readies the plugin for one Claude Code profile, which is the release every session loads, and takes the install of the past out of the profile's own plugin set.
func (*Service) InstallInCodexProfile ¶
InstallInCodexProfile installs the plugin into one Codex profile, run as that profile: a profile has a plugin set and downloads of its own, so the pinned reinstall there never touches Personal's. It is the install and the update both, as Install is for Personal.
func (*Service) Installed ¶
Installed reports whether the lich plugin is installed for a provider — that its sessions report what they are doing (docs/hooks/). The relay asks before reading a session's silence as an answer: a provider that never reports is silent whatever happens in it.
It reads the provider's own plugin state — a file for Claude Code, opencode and oh-my-pi, a CLI call for Codex and Crush — so it is not for a hot path. The relay asks it once per errand, and HasTools once more before that; neither question is cached, so each one pays for itself.
A Crush block written for a Crush without the lifecycle events reports no state, so it reads as not installed here (crushReportsState).
func (*Service) RepairRegistrations ¶
func (s *Service) RepairRegistrations()
RepairRegistrations rewrites every lich MCP registration that names a binary other than this one. It runs once at startup, off the prompt: Crush's config directory and two of the rewrites are CLI calls.
func (*Service) Retry ¶
Retry runs a pass now, after one already running, and answers once it ran, its outcome on api.PluginProblemEvent as every pass's is.
func (*Service) SetEmit ¶
SetEmit wires where a pass reports what it could not do (api.PluginProblemEvent). Startup wiring.
func (*Service) SetInUse ¶
SetInUse wires what names the release directories live sessions were spawned with (terminal.Service.PluginReleasesInUse). Startup wiring.
type Status ¶
type Status = api.PluginStatus