Skip to content

Conversation

@gbasin
Copy link
Owner

@gbasin gbasin commented Feb 3, 2026

Summary

Adds support for the Pi coding agent alongside existing Claude and Codex support.

Changes

Backend

  • Log discovery (logDiscovery.ts): Scan ~/.pi/agent/sessions/ for Pi JSONL logs, with PI_HOME env override support
  • Session detection (logMatcher.ts): Extract user messages from Pi TUI using ANSI background color detection (RGB 52,53,65 from tokyo-night theme)
  • Agent detection (agentDetection.ts): Recognize pi command
  • Database migration (db.ts): Add pi to agent_type CHECK constraint with safe table recreation

Frontend

  • Pi icon (AgentIcon.tsx): New π symbol icon for Pi sessions
  • Settings preset (settingsStore.ts): Add built-in "Pi" command preset with migration for existing users
  • Types (types.ts): Add pi to AgentType union

Tests

  • Updated all test fixtures to include PI_HOME environment variable
  • Added tests for Pi TUI user message extraction
  • All 435 tests pass

Notes

  • Pi user message detection relies on the tokyo-night theme's specific background color (RGB 52,53,65). If Pi changes this color or users select a different theme, detection will gracefully fail (empty array returned).
  • Session ID extraction uses entry.type === "session" with entry.id field per Pi's JSONL format.

Checklist

  • Lint passes
  • Typecheck passes
  • All tests pass
  • Database migration is safe (transactional table recreation)
  • Settings migration handles existing users

Introduce support for a new 'pi' agent across client and server. Client: add Pi icon, include a built-in Pi command preset, extend settings validation/types, bump settings storage version and add migration to ensure built-in presets are present. Server: accept 'pi' in agent_type CHECKs, add migratePiAgentType to recreate agent_sessions with updated constraint, update agent detection and log discovery to recognize Pi paths and session IDs. Tests: update multiple tests to set up PI_HOME and expect the new built-in preset. Overall changes add end-to-end recognition and persistence for the Pi agent type.
Detect and extract user messages from Pi's TUI which uses an RGB background color for user input. Adds extractPiUserMessagesFromAnsi to parse ANSI scrollback for the 48;2;52;53;65 background pattern, and getTerminalScrollbackWithAnsi to capture tmux content with ANSI escape codes preserved. The main matching flow now falls back to Pi detection when no Claude/Codex messages are found. Unit tests for Pi extraction were added, and an integration test timeout was increased to 10s to reduce flakiness.
@gbasin gbasin merged commit 0e11f25 into master Feb 3, 2026
2 checks passed
@gbasin gbasin deleted the pi branch February 3, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant