How thetrebor/pi-reasonix works
pi-reasonix is a Pi extension that activates for DeepSeek models. Its main workflow modifies provider requests to stabilize cache prefixes and compact oversized tool results, then processes responses to collect cache metrics and repair malformed or repeated tool calls. A status command exposes session statistics. The shared types module is included as an internal layer. Edges reflect the extension excerpt or README; unsampled integrations are not expanded beyond documented behavior.
Main entry points: index.ts Extension hooks · cache-first.ts Prefix guard · repair.ts Tool-call repair · cost-control.ts Result compaction
Components 13
Pi integration
- Pi host
- Extension hooks
extensions/index.ts - Model detection
extensions/index.ts - Status command
extensions/index.ts - Shared types
src/types.ts
Cache stability
- Prefix guard
src/cache-first.ts - Append-only check
src/cache-first.ts
Tool-call repair
- Tool-call repair
src/repair.ts
Cost and metrics
- Result compaction
src/cost-control.ts - Context usage
src/cost-control.ts - Cache metrics
extensions/index.ts
Other components
- Pi user
- DeepSeek API
Connections 13
- Pi host → Extension hooks: fires hooks
README.md - Extension hooks → Model detection: detects model
extensions/index.ts - Model detection → Extension hooks: sets session
extensions/index.ts - Extension hooks → Prefix guard: stabilizes prefix
extensions/index.ts - Extension hooks → Append-only check: checks history
extensions/index.ts - Extension hooks → Result compaction: compacts results
extensions/index.ts - Extension hooks → Context usage: estimates tokens
extensions/index.ts - Extension hooks → Tool-call repair: repairs calls
extensions/index.ts - Extension hooks → Cache metrics: collects metrics
extensions/index.ts - Extension hooks → DeepSeek API: sends modified request
README.md - DeepSeek API → Pi host: returns response
README.md - Pi user → Status command: requests status
README.md - Status command → Pi user: shows statistics
README.md