AgentLogs extension for Pi - automatically captures and uploads AI coding session transcripts
npm install @agentlogs/piAgentLogs extension for pi - automatically captures and uploads AI coding session transcripts.
``bash`
npm install -g @agentlogs/pior
bun add -g @agentlogs/pi
Add the extension to your pi configuration:
Option 1: Global settings (~/.pi/agent/settings.json)
`json`
{
"extensions": ["@agentlogs/pi"]
}
Option 2: Project settings (.pi/settings.json)
`json`
{
"extensions": ["@agentlogs/pi"]
}
Option 3: Package.json
`json`
{
"pi": {
"extensions": ["@agentlogs/pi"]
}
}
When you end a pi session (Ctrl+D), your conversation transcript is automatically uploaded to AgentLogs.
When the AI makes git commits, the extension:
1. Adds a link to the transcript in the commit message footer
2. Tracks which commits are associated with which transcripts
3. Makes it easy to find the AI conversation that led to any commit
Pi supports conversation branching via /tree. The extension handles this by:
- Generating unique transcript IDs for each branch
- Only uploading the current branch (from leaf to root)
- Preserving links to older branches when you navigate away
- AGENTLOGS_CLI_PATH - Custom path to the agentlogs CLI (defaults to npx -y agentlogs@latest)
By default, transcripts are only uploaded for repositories you've explicitly allowed:
`bashAllow the current repo
agentlogs allow
Development Setup
For local development, use the setup script:
`bash
From the repo root
./packages/pi/scripts/dev-setup.shThis creates a symlink and shows the CLI path to export:
export AGENTLOGS_CLI_PATH="bun /path/to/agentlogs/packages/cli/src/index.ts"Now run pi - the extension loads automatically
pi
`To remove the dev setup:
`bash
./packages/pi/scripts/dev-teardown.sh
unset AGENTLOGS_CLI_PATH
`Debug Logging
Debug logs are written to
/tmp/agentlogs-pi.log when not in production mode.`bash
Watch logs in real-time
tail -f /tmp/agentlogs-pi.log
`CLI Commands
The extension uses the
agentlogs CLI under the hood:`bash
List recent sessions
agentlogs pi uploadUpload a specific session
agentlogs pi upload
agentlogs pi upload /path/to/session.jsonlCheck login status
agentlogs statusLogin to AgentLogs
agentlogs login
`How It Works
1. The extension registers handlers for pi's lifecycle events
2. On
session_shutdown, it shells out to agentlogs pi hook` with session dataMIT