symcc

Research: can symcc tell when the session is in plan mode? #

Task T-120. Checked against Claude Code 2.1.319: the plugin API types in .claude-plugin/types/claude-code/index.d.ts (in the main project folder; it is gitignored, so worktrees don't have it) and the installed package at ~/.local/lib/node_modules/@anthropic-ai/claude-code. The package ships only a compiled binary and README.md, so the types file is the main source. Line numbers are approximate.

Short answer #

1. Reading the current permission mode #

The mode values are 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk' | 'auto' (type PermissionMode, about line 7901).

Where a plugin can see it:

WhereFieldNotes
classic.* events (classic.UserPromptSubmit, classic.Stop, classic.SessionStart, classic.PostToolUse, classic.Notification, classic.SubagentStart, ...)e.permission_mode?: stringComes from BaseHookInput (about line 853). These events fire even when no settings hook is set up (ClassicEventName docs, about line 1268). The value is the mode at the moment the event fires. Not on classic.PreToolUse: its e is only the tool call envelope.
agent.spawn hooke.permissionMode?: string"The parent's permission mode (default, acceptEdits, plan, ...), which the subagent inherits." (AgentSpawnInput, about line 323). Only seen when an agent is about to start.
prompt.attachment hook, e.type of plan_mode, plan_mode_reentry, plan_mode_exite.detail (PlanModeDetail etc., about lines 7968-8015 and 8549)plan_mode is the reminder sent with each model request while plan mode is on; plan_mode_exit is a one-time note sent when plan mode has ended. These are signals that plan mode is on or has ended, not the mode name. Fires only when a model request is built.

What does not exist:

Does it update mid-session? Yes, each new event carries the mode as it is at that moment. But nothing tells the plugin right away: if the user switches mode while the lead is idle, symcc only finds out at the next classic.UserPromptSubmit (the user sends a prompt), the next model request (prompt.attachment), or the next classic.Stop (end of a turn). For symcc that is good enough, since the lead only acts inside a turn.

2. Do plugin tools run in plan mode? #

Yes, and that matches what we saw.

So if symcc wants plan mode to count, it has to check the mode itself in its tool.call hook.

3. Does plan mode reach background agents? #

Keep one value, "the lead's mode", and refresh it from events:

  1. on('classic.UserPromptSubmit'), on('classic.Stop'), on('classic.SessionStart'): read e.permission_mode when e.agent_id is absent (the main session, not a worker), store it, and call next(e).
  2. on('prompt.attachment', { type: 'plan_mode' }) → plan mode on; { type: 'plan_mode_exit' } → plan mode ends. Always return next(e) so the text is unchanged. This catches a switch made between two prompts sooner than the next classic.Stop.

While the mode is plan:

When the mode changes from plan to something else (seen at the next event):

If the stored mode is unknown (no event seen yet), treat it as not plan, so nothing changes from today's behaviour.