Documentation
¶
Overview ¶
Package setup handles agent plugin installation.
- OpenCode: copies embedded plugin file to ~/.config/opencode/plugins/ (patching ENGRAM_BIN to bake in the absolute binary path as a final fallback) and injects MCP registration in opencode.json using the resolved absolute binary path so child processes never require PATH resolution in headless/systemd environments.
- Claude Code: runs `claude plugin marketplace add` + `claude plugin install`, then writes a durable MCP config to ~/.claude/mcp/engram.json using the absolute binary path so the subprocess never needs PATH resolution.
- Gemini CLI: injects MCP registration in ~/.gemini/settings.json
- Codex: injects MCP registration in ~/.codex/config.toml
- Pi: installs gentle-engram/pi-mcp-adapter packages and writes Pi MCP config
Index ¶
Constants ¶
const ( ProtocolModeSlim = "slim" ProtocolModeFull = "full" )
Protocol mode values persisted per setup slug. A slug's mode controls how verbose the version-pinned Claude Code hook scripts render the ACTIVE PROTOCOL prose at session start / post-compaction — see openspec/changes/setup-protocol-flag/proposal.md.
Variables ¶
This section is empty.
Functions ¶
func AddClaudeCodeAllowlist ¶
func AddClaudeCodeAllowlist() error
AddClaudeCodeAllowlist adds engram MCP tool names to ~/.claude/settings.json permissions.allow so Claude Code doesn't prompt for confirmation on each call. Idempotent: skips tools already present in the list.
func PostInstallSteps ¶ added in v1.17.0
PostInstallSteps returns the human-facing "next steps" lines for an agent, or nil when the agent's post-install messaging is handled specially by the CLI (opencode's conditional TUI note, claude-code's interactive allowlist prompt).
func ReadProtocolMode ¶ added in v1.19.0
ReadProtocolMode returns the persisted protocol mode for slug inside dataDir. It defaults to ProtocolModeFull whenever the mode cannot be resolved with certainty: missing file, unreadable file, malformed JSON, or no entry for slug. This keeps every failure mode safe (never silently suppresses the protocol prose).
func WriteProtocolMode ¶ added in v1.19.0
WriteProtocolMode upserts slug's mode into dataDir's mode file, preserving entries for other slugs. Unknown or empty mode values normalize to ProtocolModeFull rather than failing — persistence itself never fails `engram setup` (callers may still surface a warning for unknown input).
A missing file starts fresh. A file that exists but fails to parse (corrupted) is NOT silently treated as "start fresh" — that would overwrite whatever other slugs' modes it might still contain with a single-entry file, compounding the data loss. Instead the write is refused and an error is returned so the caller can warn and leave the file for manual inspection/recovery (the read path still degrades to ProtocolModeFull for any unparseable file, as before).
Types ¶
type Agent ¶
type Agent struct {
Name string
Description string
InstallDir string // resolved at runtime (display only for claude-code)
}
Agent represents a supported AI coding agent.
func SupportedAgents ¶
func SupportedAgents() []Agent
SupportedAgents returns the list of agents that have plugins available. The list is derived from the registry (agentAdapters) so adding an agent there surfaces it here and in `engram setup --help` automatically.