feat: add S hotkey to apply agent prompt as system override mid-session#812
feat: add S hotkey to apply agent prompt as system override mid-session#812lenam2001 wants to merge 1 commit intocan1357:mainfrom
Conversation
|
📎 Related discussion thread opened at #813 for broader feedback on multi-agent persona switching workflows. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0e4b16374
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| * Updates the agent's system prompt and appends a custom message entry. | ||
| */ | ||
| applyAgentSystemPrompt(agentName: string, prompt: string): void { | ||
| this.agent.setSystemPrompt(prompt); |
There was a problem hiding this comment.
Persist applied prompt as the session base prompt
Updating only agent.setSystemPrompt(prompt) here makes the S hotkey ineffective for sessions that have an extension runner: before each user prompt, emitBeforeAgentStart falls back to this.#baseSystemPrompt and overwrites the applied prompt (agent-session.ts around lines 2757-2760). In that environment, users will see “Applied ... agent prompt” but the next turn runs with the old base prompt, so the feature silently fails unless #baseSystemPrompt is updated too.
Useful? React with 👍 / 👎.
Feature: Apply Agent System Prompt Mid-Session (
Shotkey)Problem
The
/agentsdashboard in oh-my-pi currently only supports:Space)Enter)N)There is no way to apply an agent's system prompt into the current session to switch persona mid-session (e.g.,
librarian → coordinator → tutor).Solution
Add hotkey
Sin the Agent Dashboard to apply the selected agent's system prompt into the current active session.Files Modified
packages/coding-agent/src/modes/components/agent-dashboard.tsonApplySystemPromptcallback,#applySelectedAgentPrompt(),Shotkey handler, footer hintpackages/coding-agent/src/modes/controllers/selector-controller.tsonApplySystemPrompt→session.applyAgentSystemPrompt()packages/coding-agent/src/session/agent-session.tsapplyAgentSystemPrompt(agentName, prompt)— updatesagent.setSystemPrompt()+ persistscustom_messageentryDesign Decisions
AgentDashboard(UI) andAgentSession(logic) to preserve separation of concernscustom_messageentry withdisplay: falseto avoid cluttering the TUIEnterif model switch is also needed)Verification
bun tsc --noEmit): passbun run check): pass (962 files, no errors)pi_natives) on Windowsompsession: pendingAgent Workflow Context
This feature enables the multi-agent orchestration pattern used in OpenCode-style configurations where agents transition through roles mid-session:
1st_librarian— discovers context2nd_coordinator— plans and delegates3rd_tutor— teaches and explainsWith the
Shotkey, users can now fluidly switch between these personas without restarting the session.Next Steps
ompsession:/agents→ select agent → pressS→ confirm system prompt switch