feat: support pi-subagents-style JSON agent overrides - #171
Open
ESSO0428 wants to merge 2 commits into
Open
Conversation
Read subagents.agentOverrides and subagents.defaultModel from Nico's settings.json (~/.pi/agent/settings.json + .pi/settings.json) and apply them as the highest-priority layer after the built-in .md chain has resolved. - New file: src/nico-overrides.ts — reader + applier for Nico-style overrides - Modified: src/agent-types.ts — registerAgents() now reads and applies Nico overrides automatically (zero-touch for all call sites) Priority: 1. Local .pi/settings.json subagents.agentOverrides ← highest 2. Global ~/.pi/agent/settings.json subagents.agentOverrides 3. Local .pi/agents/*.md 4. Global ~/.pi/agent/agents/*.md 5. Built-in DEFAULT_AGENTS Closes #...
- applyNicoOverrides now auto-creates AgentConfig entries for override names that don't exist in the registry yet (no .md file needed) - Add resolveNicoSkills() to convert Nico string[] -> tintinweb's true | string[] | false format - Move override application out of registerAgents() into a separate exported function applyNicoOverrides(), called from reloadCustomAgents() in index.ts, so unit tests are not affected by real filesystem state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for configuring existing agents and registering new agents through Pi's
settings.jsonfiles using the samesubagents.agentOverridesformat asnpm:pi-subagents.JSON overrides make agent configuration easier to adjust temporarily on a global or per-project basis. Users can quickly switch an agent's model or thinking level according to the current task, available provider quota, or cost constraints without editing or duplicating its complete
.mddefinition.Fields such as
model,thinking,systemPrompt,tools, andskillscan be configured under:Local project settings can override only the fields that need to change while inheriting the remaining configuration from global settings or existing agent definitions.
When an overridden agent name does not already exist as a built-in or
.mddefinition, it is automatically registered from the JSON configuration..Configuration Priority
The resulting priority order is:
.pi/settings.json→subagents.agentOverrides~/.pi/agent/settings.json→subagents.agentOverrides.pi/agents/*.md~/.pi/agent/agents/*.mdgeneral-purpose,Explore, andPlanLocal project overrides merge on top of global overrides on a per-field basis.
For example, a project configuration can replace only an agent's
modelandthinkingvalues while retaining its globally configuredtoolsandsystemPrompt.Usage
Global defaults
~/.pi/agent/settings.json{ "subagents": { "defaultModel": "opencode/deepseek-v4-flash-free", "agentOverrides": { "Explore": { "model": "github-copilot/gpt-5-mini", "thinking": "off" }, "reviewer": { "model": "opencode/deepseek-v4-flash-free", "thinking": "max", "tools": ["read", "grep", "find", "ls", "bash"] } } } }Project-specific overrides
.pi/settings.jsonOnly the fields that differ from the global configuration need to be specified:
{ "subagents": { "agentOverrides": { "reviewer": { "model": "openai-codex/gpt-5.4", "thinking": "high" }, "fixer": { "model": "openai-codex/gpt-5.4", "tools": ["read", "grep", "find", "ls", "bash", "edit", "write"], "systemPrompt": "You are Fixer — a fast, focused implementation specialist. NO external research, NO delegation, NO planning." } } } }In this example,
reviewerinherits its remaining fields from the global configuration.The
fixeragent does not need to exist as a built-in or.mddefinition. It is automatically registered from this JSON configuration.Implementation
src/nico-overrides.tsto read, merge, normalize, and apply JSON overridesapplyNicoOverrides()fromsrc/agent-types.tsreloadCustomAgents()skillsrepresentation, into the format expected by@tintinweb/pi-subagentsThis compatibility layer reads
agentOverridesfrom Pi's global and projectsettings.jsonfiles. It does not add the same option to this extension's ownsubagents.jsonconfiguration format.Thanks to @nicobailon for creating the original
pi-subagentsconfiguration format that this compatibility layer builds upon.