Keep excluding custom prompt/Agent Skills for Apple On-Device once tools ship (step 5)
Fifth piece of the Apple Intelligence tool-calling work (see /Users/rune/.claude/plans/apple-intelligence-tool-calling-plan.md). Once capabilities.tools flips to true for Apple On-Device (step 7, not done yet), effectiveSystemPrompt's modelSupportsTools gate would re-include the user's custom prompt and Agent Skills content — the same two contributors that blew Phase 1's 4K context budget before that gate existed (16,377/4,096 tokens on a trivial first message). Measured the actual tool-usage guidance block instead of assuming it also needed shortening: ~400 tokens, small enough to keep as-is, so no separate condensed variant was needed — just keep excluding the two genuinely large pieces specifically for Apple. Dormant until step 7: modelSupportsTools is still false for Apple today, so this has zero behavior change yet. No new tests — effectiveSystemPrompt has no existing coverage (instance state, not pure logic) and this change doesn't reduce what's already there.
This commit is contained in:
@@ -255,8 +255,17 @@ Don't narrate future actions ("Let me...") - just use the tools.
|
||||
// limit) — skip all three for tool-incapable models.
|
||||
let modelSupportsTools = selectedModel?.capabilities.tools ?? true
|
||||
|
||||
// Apple On-Device keeps a 4K context window even with tool calling enabled (unlike every
|
||||
// other tools:true provider, which has a 100K+-token window). Phase 1 measured a trivial
|
||||
// first message hitting 16,377/4,096 tokens before the exclusion below existed — dominated
|
||||
// by the user's own custom prompt and Agent Skills content, not by tool-usage guidance
|
||||
// itself (~400 tokens, measured — small enough to keep as-is). Keep excluding the two actual
|
||||
// big contributors specifically for Apple, even now that modelSupportsTools is true for it.
|
||||
let excludeVerboseCustomization = currentProvider == .appleOnDevice
|
||||
|
||||
// Check if user wants to replace the default prompt entirely (BYOP mode)
|
||||
if modelSupportsTools,
|
||||
!excludeVerboseCustomization,
|
||||
settings.customPromptMode == .replace,
|
||||
let customPrompt = settings.systemPrompt,
|
||||
!customPrompt.isEmpty {
|
||||
@@ -282,6 +291,7 @@ Don't narrate future actions ("Let me...") - just use the tools.
|
||||
|
||||
// Append custom prompt if in append mode and custom prompt exists
|
||||
if modelSupportsTools,
|
||||
!excludeVerboseCustomization,
|
||||
settings.customPromptMode == .append,
|
||||
let customPrompt = settings.systemPrompt,
|
||||
!customPrompt.isEmpty {
|
||||
@@ -289,7 +299,7 @@ Don't narrate future actions ("Let me...") - just use the tools.
|
||||
}
|
||||
|
||||
// Append active agent skills (SKILL.md-style behavioral instructions)
|
||||
if modelSupportsTools {
|
||||
if modelSupportsTools && !excludeVerboseCustomization {
|
||||
let activeSkills = settings.agentSkills.filter { $0.isActive }
|
||||
if !activeSkills.isEmpty {
|
||||
prompt += "\n\n---\n\n## Installed Skills\n\nThe following skills are active. Apply them when relevant:\n\n"
|
||||
|
||||
Reference in New Issue
Block a user