Skip to content

feat(tui): configure Pi agent model presets by subscription #4397

Description

@j0k3r-dev-rgl

Pre-flight Checklist

  • I have searched existing issues and this is not a duplicate
  • I understand that PRs will be rejected if the linked issue does not have status:approved

🔍 Affected Area

TUI (terminal UI)

💡 Problem Statement

Gentle AI supports Pi as an AI coding agent target, and its TUI provides a Model Configuration screen (ScreenModelConfig) with quick configuration options for Claude, OpenCode, Kiro, and Codex.

However, configuring model routing for Pi is currently missing from this menu. Pi users who have gentle-pi installed and authenticated through Codex (native Pi login) or Claude (via extension) must manually configure more than 17 subagents (SDD phases, Judgment Day judges, reviewers) one by one in Pi's interactive /gentle:models prompt (~34 individual selections).

Existing issue #3522 proposed a per-agent manual editor relying on an external CLI (gentle-pi-models from gentle-pi #381) that is currently stalled. It does not provide subscription-based presets (e.g., Claude, Codex, Kiro, Budget) with economic, balanced, and premium tiers that automatically map the best model and reasoning effort to all 17+ subagents according to their capability tier.

📦 Proposed Solution

Add a "Configure Pi models" entry to the Model Configuration menu (internal/tui/screens/model_config.go).

When selected, open a single-screen tiered preset picker (ScreenPiModelPicker) grouped by provider:

  • Claude (Anthropic):
    • Claude — Balanced (Recommended): Sonnet for reasoning & code, Haiku for light work.
    • Claude — Premium (Max Quality / Opus): Opus for architecture & verification, Sonnet for code.
    • Claude — Economy (Token Saver / Haiku): Sonnet for architecture, Haiku for code & maintenance.
  • Codex (OpenAI):
    • Codex — Balanced (Recommended): Sol for reasoning, Terra for code, Luna for light work.
    • Codex — Premium (Max Quality / Sol): Sol with high effort across architecture & code.
    • Codex — Economy (Token Saver / Luna): Terra for code, Luna for light tasks with minimal effort.
  • Kiro (Frontier):
    • Kiro — Balanced (Recommended): Claude 4.8 for reasoning, Sonnet 4.6 for code, Haiku 4.5 for light work.
    • Kiro — Premium (Max Quality / 4.8): Claude 4.8 across all critical architecture and coding phases.
    • Kiro — Economy (Token Saver / 4.5): Sonnet 4.6 for architecture, Haiku 4.5 for code & maintenance.
  • Budget / Open Source:
    • Budget — Open Source (DeepSeek Reasoner & Chat): High quality at minimal token cost.

Configuration Preview:
As the user navigates the options, a live preview box displays the concrete model IDs and thinking levels assigned to Reasoning, Execution, and Light work tiers before confirming.

Execution & Sync Flow:
When confirmed:

  • Selection is staged in PendingSyncOverrides and applied during sync.
  • During sync, Gentle AI writes the canonical configuration to ~/.pi/gentle-ai/models.json and updates ~/.pi/agent/subagents.json (model_profiles).
  • When Pi starts, gentle-pi automatically consumes ~/.pi/gentle-ai/models.json on session_start and updates agent frontmatters.

Acceptance Criteria:

  • "Configure Pi models" appears in the Model Configuration screen (ScreenModelConfig).
  • Selecting it opens ScreenPiModelPicker displaying the tiered presets in a single view with live configuration preview.
  • Selecting a preset stages the full 17+ agent routing matrix into PendingSyncOverrides.
  • Running sync persists the routing to ~/.pi/gentle-ai/models.json and mirrors it to ~/.pi/agent/subagents.json (model_profiles).
  • Existing non-model properties in subagents.json are preserved without loss.
  • Comprehensive unit tests cover presets generation, file serialization, and TUI navigation.

🔄 Alternatives Considered

📎 Additional Context

Gentle Pi already consumes ~/.pi/gentle-ai/models.json on session startup via applySavedModelConfig(ctx) in extensions/gentle-ai.ts. This allows Gentle AI to directly configure Pi without requiring external CLI binary dependencies.

Implementation Status — Ready for PR Submission:
The implementation is already completed, tested, and verified locally (100% test pass rate). To respect the repository's strict <400 LOC review limit, the code is prepared as a clean, sequential 4-PR chain (<270 LOC each):

  1. PR 1 — Core Models & Presets: internal/model/pi_model.go and tests (~220 LOC).
  2. PR 2 — File Persistence: internal/agents/pi/model_config.go and tests (~217 LOC).
  3. PR 3 — Sync Engine & State: internal/model/selection.go, internal/state/state.go, internal/app/app.go, internal/cli/sync.go and integration tests (~237 LOC).
  4. PR 4 — TUI Integration: internal/tui/screens/model_config.go, internal/tui/screens/pi_model_picker.go, internal/tui/model.go, internal/tui/router.go and tests (~270 LOC).

Awaiting maintainer triage and status:approved to dispatch the PR chain.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststatus:approvedApproved for implementation — PRs can now be openedtype:featureNew feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions