Skip to content

Commit 156f707

Browse files
Add pi conversation support
1 parent c6b4dad commit 156f707

10 files changed

Lines changed: 689 additions & 9 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The embedding server starts automatically when needed and stays running as a dae
100100

101101
## Conversation Search
102102

103-
Search across conversations from Claude Code, Codex CLI, Cursor, and OpenCode.
103+
Search across conversations from Claude Code, Codex CLI, Cursor, OpenCode, and Pi.
104104

105105
```bash
106106
# Index conversations (auto-starts embedding server)
@@ -111,13 +111,15 @@ sgrep conv index --source claude
111111
sgrep conv index --source codex
112112
sgrep conv index --source cursor
113113
sgrep conv index --source opencode
114+
sgrep conv index --source pi
114115

115116
# Watch mode (auto-index new conversations)
116117
sgrep conv index --watch
117118

118119
# Search conversations
119120
sgrep conv "authentication"
120121
sgrep conv search "authentication" --agent codex --limit 5
122+
sgrep conv search "session compaction" --agent pi --limit 5
121123
sgrep conv "JWT token" --hybrid
122124
sgrep conv "database migration" --agent claude --since 7d
123125

‎internal/cli/conv.go‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ func init() {
6767
parser.RegisterCodex()
6868
parser.RegisterCursor()
6969
parser.RegisterOpenCode()
70+
parser.RegisterPiMono()
7071
}
7172

7273
var convCmd = &cobra.Command{
7374
Use: "conv [search] <query>",
7475
Short: "Search and manage coding agent conversations",
75-
Long: `Search across conversations from Claude Code, Codex CLI, Cursor, and OpenCode.
76+
Long: `Search across conversations from Claude Code, Codex CLI, Cursor, OpenCode, and Pi.
7677
7778
Examples:
7879
# Basic semantic search
@@ -94,7 +95,8 @@ Examples:
9495
# Index conversations
9596
sgrep conv index
9697
sgrep conv index --source claude
97-
sgrep conv index --source opencode`,
98+
sgrep conv index --source opencode
99+
sgrep conv index --source pi`,
98100
Args: cobra.MaximumNArgs(1),
99101
RunE: runConvSearch,
100102
}
@@ -197,7 +199,7 @@ func init() {
197199
convCopyCmd.Flags().BoolVar(&convCopyFull, "full", false, "Copy full conversation")
198200

199201
// Index flags
200-
convIndexCmd.Flags().StringVar(&convIndexSource, "source", "", "Index specific source: claude, codex, aider, cursor, opencode")
202+
convIndexCmd.Flags().StringVar(&convIndexSource, "source", "", "Index specific source: claude, codex, cursor, opencode, pi")
201203
convIndexCmd.Flags().BoolVar(&convIndexForce, "force", false, "Re-index all (ignore cache)")
202204
convIndexCmd.Flags().BoolVar(&convIndexWatch, "watch", false, "Watch for new conversations")
203205
}
@@ -210,7 +212,7 @@ func addConvSearchFlags(cmd *cobra.Command) {
210212
cmd.Flags().BoolVar(&convExact, "exact", false, "Exact keyword match only (no semantic)")
211213

212214
// Filter flags
213-
cmd.Flags().StringVarP(&convAgent, "agent", "a", "all", "Filter by agent: claude, codex, cursor, opencode, all")
215+
cmd.Flags().StringVarP(&convAgent, "agent", "a", "all", "Filter by agent: claude, codex, cursor, opencode, pi, all")
214216
cmd.Flags().StringVarP(&convProject, "project", "p", "", "Filter by project name or path")
215217
cmd.Flags().StringVar(&convSince, "since", "", "Conversations since: 1h, 7d, 2w, 1m, 1y")
216218
cmd.Flags().StringVar(&convAfter, "after", "", "Conversations after date (YYYY-MM-DD)")

‎pkg/conv/actions.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ func (a *Actions) Resume(ctx context.Context, sessionID string, opts ResumeOptio
9696
result.Command = "opencode"
9797
result.Args = []string{"--session", sessionID}
9898

99+
case AgentPiMono:
100+
result.Command = "pi"
101+
result.Args = []string{"--session", sessionID}
102+
99103
default:
100104
return nil, fmt.Errorf("unsupported agent for resume: %s", session.Agent)
101105
}
@@ -276,6 +280,8 @@ func GenerateResumeCommand(session *Session) string {
276280
return fmt.Sprintf("# Open Cursor: %s", session.ProjectPath)
277281
case AgentOpenCode:
278282
return fmt.Sprintf("opencode --session %s", session.ID)
283+
case AgentPiMono:
284+
return fmt.Sprintf("pi --session %s", session.ID)
279285
default:
280286
return ""
281287
}

‎pkg/conv/actions_test.go‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package conv
2+
3+
import "testing"
4+
5+
func TestGenerateResumeCommand_PiMono(t *testing.T) {
6+
session := &Session{
7+
ID: "018f-session",
8+
Agent: AgentPiMono,
9+
}
10+
11+
command := GenerateResumeCommand(session)
12+
if command != "pi --session 018f-session" {
13+
t.Fatalf("unexpected resume command %q", command)
14+
}
15+
}

0 commit comments

Comments
 (0)