Claude Code System Prompts
@internal Only on init frames written by the headless stream-json client of a cloud-hosted session (agent loop in the cloud container; this machine may be bound to it as a device): a snapshot per frame, absent in every other mode; no user, assistant or result frame precedes the first such init (informational system frames may; on a re-attach so may frames of a turn already in progress, other clients' prompts, and the echo of this host's own prompt when the session already had it or it joins a turn in progress). id is the cloud session id, always in its session_… spelling (the producer normalizes the service's cse_… spelling of the same session); hosts store it and pass it back verbatim to re-attach. The frame-level session_id is instead the cloud worker's id, a uuidv5 of the session id in its cse_ form: the same for the life of the cloud session across worker restarts and re-attaches until a /clear in the session, and passed through by the client unchanged. When device.status is unbound, reason is one of the client's unbound-reason keys and message its phrase: one line, at most 200 characters, no ANSI or trailing newline, worded to follow Laptop tools unavailable: . directory_sync.state is seeding while this machine's sync engine is still opening, armed once the engine is set to push before each message and pull after each turn, stopped once it has disarmed for the rest of the session, off when it never ran; on off and stopped, reason (one of the client's sync stop-cause keys) and message (its phrase: one line, at most 200 characters, no ANSI or trailing newline, a complete sentence) are present when the engine knows why; on armed, first_upload is pending until the first upload of a session created from this machine has reached the session and landed once it has (absent on an attach; hosts should read any value other than landed as not yet), synced_files is how many files the session holds from this directory as of the last upload (counted only for a plain folder; 0 means none of its files; absent for a repository checkout or before anything reached it), other_window is true while another window on this machine holds the session's sync and this one's uploads are refused (producers omit it otherwise), muted is true while Anthropic's emergency switch is on for this machine and nothing is uploaded or installed (it comes back when the switch does; producers omit it otherwise), and direction (once the binding has settled; absent on clients that predate it) is two_way when files travel both ways or upload_only when the session's changes are not copied back to this machine; started_from_upload, in any state, is true when the container was created from an upload of this directory (a bundle of the checkout, or a plain folder's files) rather than a clone (producers omit it otherwise; absent on an attach); file_mode is the per-repository choice in effect for the launch directory and file_mode_source where it was read: stored is this machine's saved settings (in which unspecified means no choice is saved); a later host member would mean the SDK host supplied the choice for this launch without saving it. not_applied, when present, lists what the host passed that this session does not apply — name is a flag as --flag, a key inside --settings / --managed-settings as settings.<key> / managed-settings.<key>, or a field of the opening initialize as initialize.<field> (at most 40, lost first, each one line of about 64 characters at most); kind says what it costs: lost (the session does without something this invocation asked for — the informational warning names these), kept (an attach: the existing session keeps what it was created with) or preference (a display or host preference nobody would miss — the informational notice names these two), so a host may show them itself once or never; absent when nothing was left unapplied. host, when present, is what this machine announces as to the session: handle is the name the model addresses it by (and a client shows), working_dir the absolute directory served calls run in (that machine's separators), platform its platform word, cli_version its Claude Code version; each one line of at most 200 characters; present once this machine has built an announce for the session (bound, with something or an explicit nothing to serve), absent otherwise and on clients that predate it. serving, when present, says whether this machine serves its tools (Bash, Read, Write, Edit) to the session over the session's channel: state is pending while bound and about to announce, on once the session holds this machine's tools, off when it serves nothing, revoked when it stopped mid-session; reason (present when state is not on and the cause is known) is one of the client's serving-off keys — not_bound (see device.reason), external_build, windows, muted (Anthropic's emergency switch turned serving off; it comes back when the switch does), switch_off, launched_from_home, channel_off, egress, policy_org (the organization does not allow remote sessions), flag_off, flag_stale, announce_refused, announce_unverified, superseded — an open set: render an unrecognized value as a generic not-serving state; policy is the serving policy in effect (parity, or the stricter interim fallback); channel is session, or bridge_only when the session channel is switched off on this machine and served calls (if any) ride only the legacy device bridge, whose state this block does not describe. Absent on clients that predate it: feature-detect the key. connection, when present, is this client's stream to the session: connecting before it first connects, live while it is up, reconnecting while it is lost and being re-dialled (this machine is offline to the session meanwhile). calls, when present (once this machine has served a call this attach), is what it serves right now and how its last calls ended, by id and tool name only — never a call's input or output: live lists, oldest first, each call admitted here and not yet ended, state running while this machine executes it or asked while it waits on the session's approval (ask_id names the question; since is when it entered that state and lapses_at about when the session gives an unanswered question up, both epoch milliseconds on this machine's clock — the session's own timer decides); recent lists, newest last, at most 20 calls that ended here, ended being completed, denied (the session said no), withdrawn (the session took the question back unanswered — its patience ran out or the turn moved on), refused or failed, with code the result's disposition, refusal or failure word when it has one, and at when. Both are pushed between inits on cloud_session_delta frames. client_version rises only on a breaking change to this block — warn and continue on a higher value, never refuse; state, first_upload, file_mode_source, not_applied[].kind, serving.state, connection, calls[].state / ended and reason keys may gain values without it changing, so treat unrecognized values neutrally (an unrecognized first_upload as not yet landed, an unrecognized serving.state as not serving — this schema itself parses an unrecognized serving.state as off, policy as interim, channel as bridge_only).