Documentation
¶
Overview ¶
Package agentsetup reports what an agent loads when it starts in a directory: instruction files, skills, commands, subagents, MCP servers and plugins, from the user's configuration and the project. It only reads; conch never edits agent configuration. Server commands and environment variables of MCP servers are not reported, since they often hold secrets.
The locations follow each agent's documented behaviour and are a best effort: agents change where they look between releases.
Index ¶
- Constants
- Variables
- func CanSync(name string) bool
- func CheckLibrary(lib Library) error
- func Inspect(e Env, agent, dir string) (setup proto.AgentSetup, ok bool)
- func LibraryStatus(e Env) (Library, []LibCell, error)
- func LibraryUndos() []string
- func LibraryVars(lib Library) []string
- func MarkMissing(here *proto.AgentSetup, main proto.AgentSetup)
- func Names() []string
- func RepoRoot(dir string) string
- func SaveLibrary(lib Library) error
- func SkillsDir() string
- func SyncNames() []string
- func SyncUndos(dir string) []string
- func UserSyncUndos() []string
- type BundledSkill
- type Env
- type FetchError
- type FetchedSkill
- type ImportResult
- type LibCell
- type LibServer
- type LibSkill
- type Library
- type SkillChange
- func InstallSkill(e Env, agents []string, remove, apply bool) ([]SkillChange, error)
- func InstallSkills(e Env, agents []string, remove, apply bool) ([]SkillChange, error)
- func InstallSkillsNamed(e Env, names, agents []string, remove, apply bool) ([]SkillChange, error)
- func SkillTargets(e Env, agents []string) ([]SkillChange, error)
- type SkillSource
- type SyncChange
- type SyncResult
- func ApplyLibrary(e Env, apply bool) (SyncResult, error)
- func Sync(dir, from string, to []string, apply bool) (SyncResult, error)
- func SyncUser(e Env, from string, to []string, apply bool) (SyncResult, error)
- func UndoLibrary(e Env, stamp string) (SyncResult, error)
- func UndoSync(dir, stamp string) (SyncResult, error)
- func UndoUserSync(stamp string) (SyncResult, error)
Constants ¶
const ( GroupConch = "Added by conch" GroupInstructions = "Instructions" GroupSkills = "Skills" GroupCommands = "Commands" GroupSubagents = "Subagents" GroupMCP = "MCP servers" GroupPlugins = "Plugins" )
Group titles, in display order.
const ( ScopeUser = "user" ScopeProject = "project" ScopeLocal = "local" // personal to this checkout ScopePlugin = "plugin" ScopeExtension = "extension" ScopeSystem = "system" ScopeManaged = "managed" ScopeConch = "conch" )
Scopes.
const ( CellOn = "on" // wanted, and there CellPending = "pending" // wanted, and applying writes it CellRemove = "remove" // not wanted, and applying takes conch's copy out CellOff = "off" // not wanted, and not there CellTheirs = "theirs" // not wanted here, but declared by hand: left alone CellDiffers = "differs" // wanted, but declared by hand differently: left alone CellCannot = "cannot" // wanted, and conch cannot write it for this agent )
Cell states: where one server or skill stands with one agent.
const ( SyncInstructions = "instructions" SyncSkill = "skill" SyncMCP = "mcp server" )
Kinds of setup a sync carries.
const ( ActionCreate = "create" ActionUpdate = "update" ActionLink = "link" ActionSame = "same" ActionSkip = "skip" )
What a change does. Create, Update and Link write; Same and Skip do not.
const ActionRemove = "remove"
ActionRemove takes out what conch put there before.
const ConchName = "conch"
ConchName is what conch's own MCP server is called in the library and in every agent's configuration.
Variables ¶
var ErrNothingToSync = errors.New("nothing to sync")
ErrNothingToSync means the agent a sync would copy from has nothing in this checkout: no instructions, no skills, no servers.
var Skill = Skills[0].Body
Skill is conch's own skill, the one the others build on.
var Skills = loadSkills()
Skills are conch's skills, conch's own first, then by name.
Functions ¶
func CheckLibrary ¶ added in v0.1.6
CheckLibrary says what is wrong with a library, before it is saved: names an agent could not use, a server with nothing to run, a secret written out, an agent conch does not know.
func Inspect ¶
func Inspect(e Env, agent, dir string) (setup proto.AgentSetup, ok bool)
Inspect reports what agent loads in dir. ok is false for an unknown agent.
func LibraryStatus ¶ added in v0.1.6
LibraryStatus says where each server and skill stands with each agent, without writing anything.
func LibraryUndos ¶ added in v0.1.6
func LibraryUndos() []string
LibraryUndos lists the applies that can be put back, newest first.
func LibraryVars ¶ added in v0.2.0
LibraryVars are the variables the library's servers refer to, each once, in the order first met: what an agent's environment has to hold for them to work.
func MarkMissing ¶
func MarkMissing(here *proto.AgentSetup, main proto.AgentSetup)
MarkMissing adds to here, marked Missing, the items of main (the same agent inspected in the main checkout) that here lacks. Items are matched by group, scope and name, so a skill committed in both checkouts matches while a local MCP server registered only for the main checkout does not.
func SaveLibrary ¶ added in v0.1.6
SaveLibrary checks the library and writes it. It writes nothing to any agent: applying does that, after the plan has been seen.
func SkillsDir ¶ added in v0.2.0
func SkillsDir() string
SkillsDir is where fetched skills are kept.
func SyncNames ¶ added in v0.1.5
func SyncNames() []string
SyncNames lists the agents a sync can read from and write for.
func SyncUndos ¶ added in v0.1.5
SyncUndos lists the syncs of a checkout that can be undone, newest first.
func UserSyncUndos ¶ added in v0.1.6
func UserSyncUndos() []string
UserSyncUndos lists the user-scope syncs that can be undone, newest first, and UndoUserSync puts one back. They are kept in conch's own folder, since your home has no root to put a .conch in.
Types ¶
type BundledSkill ¶ added in v0.1.10
BundledSkill is one of conch's skills: its name, which is also its folder's, and its SKILL.md.
func BundledSkillNamed ¶ added in v0.1.10
func BundledSkillNamed(name string) (BundledSkill, bool)
BundledSkillNamed is the skill called name, and whether conch has one.
type FetchError ¶ added in v0.2.0
FetchError is a repository that holds several skills, none named: the person picks one of Found.
func (*FetchError) Error ¶ added in v0.2.0
func (e *FetchError) Error() string
type FetchedSkill ¶ added in v0.2.0
type FetchedSkill struct {
Name string
Path string // its folder in conch's library, on this machine
Source string // owner/repo[/path][@ref], to fetch it again
}
FetchedSkill is a skill brought into the library from GitHub.
func FetchSkill ¶ added in v0.2.0
func FetchSkill(ctx context.Context, source, name string) (FetchedSkill, error)
FetchSkill downloads the skill at source into the library, named name (or its folder's name). A skill already there by that name is replaced, so fetching again updates it. Nothing in the download is run, and only regular files and folders are copied: a link could point anywhere.
type ImportResult ¶ added in v0.1.6
ImportResult says what an import took into the library, and what it left out.
func ImportLibrary ¶ added in v0.1.6
func ImportLibrary(e Env, from string) (ImportResult, error)
ImportLibrary takes the servers and skills an agent has in your home into the library, turned on for that agent — which already has them — and for any other that already has the same. Nothing is written to any agent. A server already in the library gains the agent instead.
type LibCell ¶ added in v0.1.6
type LibCell = proto.LibraryCell
LibCell is where a server or skill stands with one agent.
type LibServer ¶ added in v0.1.6
type LibServer = proto.LibraryServer
The library's own types are the protocol's: what the server keeps is what a client edits.
func ConchServer ¶ added in v0.1.7
ConchServer is conch's own tools as a library entry, so installing them is one action rather than one per agent's format: `conch mcp` on stdio, which reaches the server over the socket the CLI uses and is scoped to the pane the agent runs in.
The command is the bare name rather than this binary's path: an agent is started by conch, which puts ~/.local/bin first, and a path would pin a build that an update moves. Nothing is passed in the environment — `conch mcp` finds its socket the way every other command does.
type LibSkill ¶ added in v0.1.6
type LibSkill = proto.LibrarySkill
The library's own types are the protocol's: what the server keeps is what a client edits.
type Library ¶ added in v0.1.6
The library's own types are the protocol's: what the server keeps is what a client edits.
func LoadLibrary ¶ added in v0.1.6
LoadLibrary reads the library; a missing one is empty.
type SkillChange ¶ added in v0.1.6
type SkillChange struct {
Skill string // which of conch's skills
Path string
Agents []string
Action string // create, update, same, remove or skip
Detail string
Error string
}
SkillChange is what installing or removing the skill does to one file. Agents are the ones that read it: Codex, Gemini and OpenCode share ~/.agents/skills; Claude and Devin have their own.
func InstallSkill ¶ added in v0.1.6
func InstallSkill(e Env, agents []string, remove, apply bool) ([]SkillChange, error)
InstallSkill puts conch's own skill where agents read it, or with remove takes conch's own copy away. Without apply it only says what it would do. A SKILL.md there that conch didn't write is skipped, never replaced.
func InstallSkills ¶ added in v0.1.10
func InstallSkills(e Env, agents []string, remove, apply bool) ([]SkillChange, error)
InstallSkills is InstallSkill for every one of conch's skills: a change per skill per folder, grouped by folder so a folder's skills sit together, in the order SkillTargets gives the folders.
func InstallSkillsNamed ¶ added in v0.2.0
func InstallSkillsNamed(e Env, names, agents []string, remove, apply bool) ([]SkillChange, error)
InstallSkillsNamed is InstallSkills for the skills named — some of conch's own rather than all of them; every one when names is empty. A name conch has no skill by is refused, rather than quietly doing less.
func SkillTargets ¶ added in v0.1.6
func SkillTargets(e Env, agents []string) ([]SkillChange, error)
SkillTargets is where each agent in agents reads user skills from: one SKILL.md per folder, with the agents that read it. An empty agents means every agent conch knows the skills folder of.
type SkillSource ¶ added in v0.2.0
type SkillSource struct {
Owner, Repo, Ref, Path string
}
SkillSource is where on GitHub a skill is: a repository, a ref in it, and the folder holding its SKILL.md ("" for the repository's own, or for whichever single one it has).
func ParseSkillSource ¶ added in v0.2.0
func ParseSkillSource(s string) (SkillSource, bool)
ParseSkillSource reads a skill's place on GitHub: owner/repo, with a folder after it and @ref at the end, or the same as a github.com URL — a repository's, or a folder's (…/tree/REF/PATH). A path on this machine (~/…, /…, ./…) is not one; ok is false for it and for anything else.
func (SkillSource) String ¶ added in v0.2.0
func (s SkillSource) String() string
String is the source as conch writes it: owner/repo[/path][@ref].
type SyncChange ¶ added in v0.1.5
type SyncChange struct {
Agent string `json:"agent"`
Kind string `json:"kind"`
Name string `json:"name"`
Path string `json:"path"` // relative to the checkout
Action string `json:"action"` // create, update, link, same, skip
Detail string `json:"detail,omitempty"`
Done bool `json:"done,omitempty"` // written, when applying
Error string `json:"error,omitempty"` // why it was not
// contains filtered or unexported fields
}
SyncChange is one thing a sync would do, or did.
func (SyncChange) Writes ¶ added in v0.1.5
func (c SyncChange) Writes() bool
Writes reports whether the change would change anything.
type SyncResult ¶ added in v0.1.5
type SyncResult struct {
Dir string `json:"dir"`
From string `json:"from"`
To []string `json:"to"`
Changes []SyncChange `json:"changes,omitempty"`
Notes []string `json:"notes,omitempty"`
// Undo names the record this apply left behind, for Undo.
Undo string `json:"undo,omitempty"`
}
SyncResult is a plan, or what came of applying one.
func ApplyLibrary ¶ added in v0.1.6
func ApplyLibrary(e Env, apply bool) (SyncResult, error)
ApplyLibrary gives each agent what the library says it should have. With apply false nothing is written and the changes are what it would do.
func Sync ¶ added in v0.1.5
func Sync(dir, from string, to []string, apply bool) (SyncResult, error)
Sync gives every agent in to the setup from has in the checkout at dir. With apply false nothing is written and the changes are what it would do. to may be empty, meaning every other agent it knows.
func SyncUser ¶ added in v0.1.6
SyncUser gives the agents in to the setup from has in your home, rather than in a checkout: the instructions, skills and MCP servers that follow you from project to project. Nothing is written with apply false.
It is the riskier half and says so: there is no git status to show what changed, so the plan and the record are all there is, and a file that is a link into a dotfiles repository is left alone rather than written through.
func UndoLibrary ¶ added in v0.1.6
func UndoLibrary(e Env, stamp string) (SyncResult, error)
UndoLibrary puts back an apply of the library; stamp "" is the last.
func UndoSync ¶ added in v0.1.5
func UndoSync(dir, stamp string) (SyncResult, error)
UndoSync puts back what a sync changed. stamp "" is the last one.
func UndoUserSync ¶ added in v0.1.6
func UndoUserSync(stamp string) (SyncResult, error)
func (SyncResult) Writes ¶ added in v0.1.5
func (r SyncResult) Writes() int
Writes counts the changes that would write, or wrote.