Documentation
¶
Overview ¶
Package pi integrates pi (pi-coding-agent) with MemSpace.
pi has no shell hooks: it loads TypeScript extensions from <agent dir>/extensions/*.ts and MCP servers from <agent dir>/mcp.json. `memspace agent install pi` therefore generates a small extension that forwards pi's lifecycle, prompt and tool events to `memspace hook pi` (the same payload shape Claude Code sends) and registers the stdio MCP bridge next to it.
Index ¶
- Constants
- func ExtensionSource(argv []string) ([]byte, error)
- type Adapter
- func (a *Adapter) Capabilities() []string
- func (a *Adapter) Detect(ctx context.Context) adapter.Detection
- func (a *Adapter) Doctor(ctx context.Context, opts adapter.InstallOptions) []adapter.Check
- func (a *Adapter) ExtensionPath() string
- func (a *Adapter) Install(ctx context.Context, opts adapter.InstallOptions) error
- func (a *Adapter) MCPCheck(ctx context.Context) adapter.Check
- func (a *Adapter) MCPConfigPath() string
- func (a *Adapter) Name() string
- func (a *Adapter) Normalize(raw []byte, now time.Time) ([]spool.Record, error)
- func (a *Adapter) RegisterMCP(ctx context.Context, opts adapter.MCPOptions) error
- func (a *Adapter) Uninstall(ctx context.Context, out io.Writer) error
- func (a *Adapter) UnregisterMCP(ctx context.Context) error
Constants ¶
const AgentType = "pi"
AgentType is the agent_type stored on sessions.
Variables ¶
This section is empty.
Functions ¶
func ExtensionSource ¶
ExtensionSource renders the extension with the pinned hook argv embedded.
Types ¶
type Adapter ¶
type Adapter struct {
// AgentDir overrides pi's agent directory (default $PI_CODING_AGENT_DIR
// or ~/.pi/agent).
AgentDir string
}
Adapter implements adapter.Adapter for pi.
func (*Adapter) Capabilities ¶
func (*Adapter) ExtensionPath ¶
ExtensionPath is the extension file that forwards pi's events to MemSpace.
func (*Adapter) Install ¶
Install writes the capture extension. The MCP server is registered separately through RegisterMCP so `--no-mcp` still leaves capture working.
func (*Adapter) MCPConfigPath ¶
MCPConfigPath is pi's user-level MCP config file.
func (*Adapter) Normalize ¶
Normalize accepts the same payload shape the generated extension sends. pi reports the files a multi-file tool applied in the tool result, so the normalizer trusts such a result for any tool: pi has no dispatch layer that could hide a nested result, and its read-only tools never name files. pi's file tools take relative paths, which are completed with the session cwd so changed files match across devices.
func (*Adapter) RegisterMCP ¶
RegisterMCP writes MemSpace's stdio bridge into pi's user-level MCP config (<agent dir>/mcp.json), preserving every other server and every other key in the file. The entry is what `pi mcp add` itself writes: a command and its arguments, no `type` (pi selects stdio from `command`). It writes no token: the bridge reads this device's credentials itself.