MCPcopy
hub / github.com/codeaashu/claude-code / buildSystemPromptBlocks

Function buildSystemPromptBlocks

src/services/api/claude.ts:3213–3237  ·  view source on GitHub ↗
(
  systemPrompt: SystemPrompt,
  enablePromptCaching: boolean,
  options?: {
    skipGlobalCacheForSystemPrompt?: boolean
    querySource?: QuerySource
  },
)

Source from the content-addressed store, hash-verified

3211}
3212
3213export function buildSystemPromptBlocks(
3214 systemPrompt: SystemPrompt,
3215 enablePromptCaching: boolean,
3216 options?: {
3217 skipGlobalCacheForSystemPrompt?: boolean
3218 querySource?: QuerySource
3219 },
3220): TextBlockParam[] {
3221 // IMPORTANT: Do not add any more blocks for caching or you will get a 400
3222 return splitSysPromptPrefix(systemPrompt, {
3223 skipGlobalCacheForSystemPrompt: options?.skipGlobalCacheForSystemPrompt,
3224 }).map(block => {
3225 return {
3226 type: 'text' as const,
3227 text: block.text,
3228 ...(enablePromptCaching &&
3229 block.cacheScope !== null && {
3230 cache_control: getCacheControl({
3231 scope: block.cacheScope,
3232 querySource: options?.querySource,
3233 }),
3234 }),
3235 }
3236 })
3237}
3238
3239type HaikuOptions = Omit<Options, 'model' | 'getToolPermissionContext'>
3240

Callers 1

queryModelFunction · 0.85

Calls 2

splitSysPromptPrefixFunction · 0.85
getCacheControlFunction · 0.85

Tested by

no test coverage detected