terraphim / terraphim/terraphim-ai
Epic: Evaluate Pi (badlogic/pi-mono) architectural patterns for terraphim-ai
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 62
- Forks
- 5
- Ø Merge
- 2 Std. 27 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
Overview
Evaluate architectural patterns from Pi coding agent (badlogic/pi-mono, 24.5k stars, MIT) for adoption in terraphim-ai. Pi is a layered, extensible TypeScript coding agent toolkit with patterns that address known gaps in our current architecture.
Knowledge base article: cto-executive-system/knowledge/external/context-engineering/pi-coding-agent-architecture.md
Comparison article: cto-executive-system/knowledge/claude-code-architecture-deep-dive.md
Evaluation Items
- Tree-structured session storage for terraphim_persistence #683
- Layered crate architecture: extract standalone LLM interaction crate #684
- Cross-provider context serialisation for ADF multi-model routing #685
- Typed beforeToolCall/afterToolCall hook pattern for terraphim-skills #686
- Steering and follow-up message queues for ADF agent interaction #687
Context
Pi takes a fundamentally different approach from Claude Code: minimal core (4 built-in tools) with a TypeScript extension system that can replace any component. While we are not adopting Pi itself (our stack is Rust + Claude Code), several of its architectural patterns address real gaps:
- Session branching: Our current linear JSONL sessions lose history on compaction. Pi's tree structure (id/parentId) preserves all branches in a single file.
- Layered architecture: Pi cleanly separates LLM API, agent loop, and UI into independent packages. Our LLM interaction code is scattered across terraphim_orchestrator, terraphim_multi_agent, and ad-hoc scripts.
- Cross-provider handoffs: Pi serialises context for mid-session model switching. ADF routes different agents to different models but cannot hand off context between them.
- Tool hooks: Pi's typed
beforeToolCall/afterToolCallat the agent-core level is simpler than Claude Code's JSON-based shell hooks. Pattern applicable to terraphim-skills. - Message queues: Pi's steering (interrupt) vs follow-up (after completion) queues are missing from ADF agent interaction.
Architecture Decision
Each evaluation item is independent. Successful evaluations may lead to implementation issues. Items that do not justify adoption should be closed with rationale.
What NOT to Adopt
- Pi itself (TypeScript, not Rust)
- Anti-MCP philosophy (MCP is integral to our workflow)
- Anti-sub-agents philosophy (agent teams are core to our approach)
- TypeScript extension system (our skills are Markdown + shell)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Read cto-executive-system/knowledge/external/context-engineering/pi-coding-agent-architecture.md and cto-executive-system/knowledge/claude-code-architecture-deep-dive.md, then review evaluation items #683-#687. Compare each Pi pattern with the stated terraphim-ai gaps and record an adoption or rejection rationale for every item; completion is a decision on all five items.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust, typescript
- Bereich
- ai, backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100