@sage-protocol/pi-adapter
Sage Protocol MCP integration for pi coding agent
Package details
Install @sage-protocol/pi-adapter from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@sage-protocol/pi-adapter- Package
@sage-protocol/pi-adapter- Version
0.3.6- Published
- May 26, 2026
- Downloads
- 146/mo · 35/wk
- Author
- hack4kites
- License
- MIT
- Types
- extension, skill
- Size
- 242.6 KB
- Dependencies
- 1 dependency · 1 peer
Pi manifest JSON
{
"extensions": [
"./extensions"
],
"skills": [
"./skills"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@sage-protocol/pi-adapter
Sage integration for the pi coding agent runtime.
- Pi agent: earendil-works/pi — extensible terminal coding harness
- Sage Protocol: sage-protocol/sage — decentralized skill/library layer for AI agents
What It Does
- Sage MCP tools (
sage_search,sage_execute,sage_status,sage_behavior) - Visible skill loading — shows loaded library/skill count at session start
- Dynamic session context — wallet, libraries, and skill routing injected via
sage skill context --format pi - Skill suggestions, RLM capture, and optional security scanning
Install
# pi CLI extension (no source changes)
pi install npm:@sage-protocol/pi-adapter
# SDK embedding
npm install @sage-protocol/pi-adapter
Quick Start
import { createAgentSession, createCodingTools } from '@earendil-works/pi-coding-agent';
import { createSageSessionConfig } from '@sage-protocol/pi-adapter';
const sage = await createSageSessionConfig({ source: 'pi-agent-core' });
const { session } = await createAgentSession({
tools: sage.wrapToolsWithSecurity(createCodingTools(process.cwd())),
customTools: sage.customTools,
});
const disposeSageHooks = sage.setupHooks(session);
API
createSageSessionConfig(config) returns:
{
customTools: ToolDefinition[]; // sage_search, sage_execute, sage_status
mcpBridge: SageMcpBridge; // MCP process lifecycle
setupHooks: (session: AgentSession) => () => void; // hooks + teardown
wrapToolsWithSecurity: (tools: ToolDefinition[]) => ToolDefinition[]; // security wrap
}
Config:
interface SageP2Config {
sageBin?: string; // default: "sage"
sageProfile?: string; // Sage config profile
suggestLimit?: number; // default: 3
suggestDebounceMs?: number; // default: 800
timeoutMs?: number; // default: 20_000
enableRlmFeedback?: boolean;
enableSecurityHooks?: boolean;
source?: string; // default: "pi"
env?: Record<string, string>;
}
Docs
- Usage Guide — env vars, integration modes, project config
- Setup — install and verify
- Developer Guide — build, test, CI contract
- SKILL.md — agent-driven integration skill
Validate
npm run build
npm test
License
MIT