2026-03-25 22:38:55 -06:00
|
|
|
# Getting Started
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Minimal Extension
|
|
|
|
|
|
2026-04-15 14:58:21 +02:00
|
|
|
Create `~/.sf/agent/extensions/my-extension.ts`:
|
2026-03-25 22:38:55 -06:00
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
|
|
|
|
|
|
|
|
export default function (pi: ExtensionAPI) {
|
|
|
|
|
pi.on("session_start", async (_event, ctx) => {
|
|
|
|
|
ctx.ui.notify("Extension loaded!", "info");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Testing
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Quick test (doesn't need to be in extensions dir)
|
|
|
|
|
pi -e ./my-extension.ts
|
|
|
|
|
|
|
|
|
|
# Or just place it in the extensions dir and start pi
|
|
|
|
|
pi
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Hot Reload
|
|
|
|
|
|
2026-04-15 14:58:21 +02:00
|
|
|
Extensions in auto-discovered locations (`~/.sf/agent/extensions/` or `.sf/extensions/`) can be hot-reloaded:
|
2026-03-25 22:38:55 -06:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
/reload
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|