Skip to content

Interface: SyncPolicy

Defined in: packages/core/src/state-sync/types.ts:55

A single policy rule matched by glob pattern.

Policies control two behaviors:

  1. Description decoration — Append [Cache-Control: X] to tool descriptions
  2. Causal invalidation — After successful mutations, signal which domains are stale

Example

typescript
// Read tools: mark as volatile
{ match: 'sprints.get', cacheControl: 'no-store' }

// Write tools: mark volatile + declare causal invalidations
{ match: 'sprints.update', invalidates: ['sprints.*'] }

// Reference data: safe to cache forever
{ match: 'countries.*', cacheControl: 'immutable' }

Properties

cacheControl?

ts
readonly optional cacheControl: CacheDirective;

Defined in: packages/core/src/state-sync/types.ts:68

Cache directive to apply to matching tools' descriptions.


invalidates?

ts
readonly optional invalidates: readonly string[];

Defined in: packages/core/src/state-sync/types.ts:78

Glob patterns of tools whose cached data is invalidated on success.

Only triggers when the tool call succeeds (isError !== true). The LLM receives: [System: Cache invalidated for X — caused by Y]

Example

ts
`['sprints.*', 'tasks.*']`

match

ts
readonly match: string;

Defined in: packages/core/src/state-sync/types.ts:65

Glob pattern to match tool names.

Uses dot-separated segments with wildcard support:

  • * matches exactly one segment
  • ** matches zero or more segments

Example

ts
`'sprints.*'`, `'tasks.update'`, `'**'`