In a multi-iteration tool loop, buildResumePrompt anchored on the last user message and walked forward through preceding tool results. The only user message stays at index 0, so each iteration re-sent the entire transcript over stdin to the resumed CLI session, duplicating the original query plus a growing stack of tool results into the on-disk session every turn. The agent saw its own context bloating and called it "compaction." Anchor on the last assistant message and slice forward instead — the genuine delta since the last turn already on disk. Same bug+fix in droid-cli (copy of pi-claude-cli). Quick chat also created a fresh pi/Claude CLI session per user message and faked continuity by stuffing the last 50 chat_messages into the prompt as "## Previous Conversation". Replace that with real session continuity: chat_sessions gains a cliSessionFile column (migration 56); ChatManager opens the existing pi SessionManager file when present and creates a fresh one (persisting its path) on the first turn. The prompt now carries only the new user content. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fusion/droid-cli
First-party Fusion pi extension package that routes pi provider requests through the droid CLI subprocess using stream-json NDJSON.
Provider
- Provider ID:
droid-cli - Binary:
droid(must be installed and authenticated on PATH) - Registration: package extension entrypoint in
index.ts
Capabilities
- Subprocess streaming bridge for text/thinking/tool events
- Model auto-discovery from Droid CLI at provider startup with in-process caching
- Session resume support (
--resume/--session-id) to avoid replaying prior turns - MCP schema bridge for exposing pi custom tools as schema-only definitions
- Tool mapping and break-early control so pi remains the tool executor
- Thinking effort mapping from pi reasoning options to Droid CLI flags
Development
pnpm --filter @fusion/droid-cli test
pnpm --filter @fusion/droid-cli exec tsc --noEmit