feat: Show command hint for agents with non-default system prompts (#1314)

This commit is contained in:
Devansh Jain
2026-03-09 18:31:15 -07:00
committed by GitHub
parent 963274bb75
commit bdadd14410
3 changed files with 77 additions and 1 deletions

View File

@@ -59,7 +59,10 @@ import {
getModelShortName,
type ModelReasoningEffort,
} from "../agent/model";
import { INTERRUPT_RECOVERY_ALERT } from "../agent/promptAssets";
import {
INTERRUPT_RECOVERY_ALERT,
shouldRecommendDefaultPrompt,
} from "../agent/promptAssets";
import { recordSessionEnd } from "../agent/sessionHistory";
import { SessionStats } from "../agent/stats";
import {
@@ -1022,6 +1025,15 @@ export default function App({
setAgentState((prev) => (prev ? { ...prev, name } : prev));
}, []);
// Check if the current agent would benefit from switching to the default prompt
const shouldShowDefaultPromptTip = useCallback(() => {
if (!agentState?.id || !agentState.system) return false;
const memMode = settingsManager.isMemfsEnabled(agentState.id)
? "memfs"
: ("standard" as const);
return shouldRecommendDefaultPrompt(agentState.system, memMode);
}, [agentState]);
const projectDirectory = process.cwd();
// Track current conversation (always created fresh on startup)
@@ -3093,6 +3105,8 @@ export default function App({
? `Resuming conversation with **${agentName}**`
: `Starting new conversation with **${agentName}**`;
const showPromptTip = shouldShowDefaultPromptTip();
// Command hints - vary based on agent state:
// - Resuming: show /new (they may want a fresh conversation)
// - New session + unpinned: show /pin (they should save their agent)
@@ -3104,6 +3118,9 @@ export default function App({
"→ **/new** start a new conversation",
"→ **/init** initialize your agent's memory",
"→ **/remember** teach your agent",
...(showPromptTip
? ["→ **/system** upgrade to the latest default prompt"]
: []),
]
: isPinned
? [
@@ -3112,6 +3129,9 @@ export default function App({
"→ **/memory** view your agent's memory",
"→ **/init** initialize your agent's memory",
"→ **/remember** teach your agent",
...(showPromptTip
? ["→ **/system** upgrade to the latest default prompt"]
: []),
]
: [
"→ **/agents** list all agents",
@@ -3119,6 +3139,9 @@ export default function App({
"→ **/pin** save + name your agent",
"→ **/init** initialize your agent's memory",
"→ **/remember** teach your agent",
...(showPromptTip
? ["→ **/system** upgrade to the latest default prompt"]
: []),
];
// Build status lines with optional release notes above header
@@ -3154,6 +3177,7 @@ export default function App({
agentProvenance,
resumedExistingConversation,
releaseNotes,
shouldShowDefaultPromptTip,
]);
// Fetch llmConfig when agent is ready
@@ -12840,6 +12864,9 @@ If using apply_patch, use this exact relative patch path: ${applyPatchRelativePa
? `Starting new conversation with **${agentName}**`
: "Creating a new agent";
// Only show prompt tip for existing agents, not brand new ones
const showPromptTip = continueSession && shouldShowDefaultPromptTip();
// Command hints - for pinned agents show /memory, for unpinned show /pin
const commandHints = isPinned
? [
@@ -12848,6 +12875,9 @@ If using apply_patch, use this exact relative patch path: ${applyPatchRelativePa
"→ **/memory** view your agent's memory",
"→ **/init** initialize your agent's memory",
"→ **/remember** teach your agent",
...(showPromptTip
? ["→ **/system** upgrade to the latest default prompt"]
: []),
]
: [
"→ **/agents** list all agents",
@@ -12855,6 +12885,9 @@ If using apply_patch, use this exact relative patch path: ${applyPatchRelativePa
"→ **/pin** save + name your agent",
"→ **/init** initialize your agent's memory",
"→ **/remember** teach your agent",
...(showPromptTip
? ["→ **/system** upgrade to the latest default prompt"]
: []),
];
// Build status lines with optional release notes above header
@@ -12889,6 +12922,7 @@ If using apply_patch, use this exact relative patch path: ${applyPatchRelativePa
agentState,
refreshDerived,
releaseNotes,
shouldShowDefaultPromptTip,
]);
const liveTrajectorySnapshot =