Expand description
BP-3 (§2 module 8 plan_mode, catalog rows “Plan-mode enter/exit tools”
and “Plan mode (read-only research phase)”): the model-invocable
restriction mode.
Three parts, one state object:
EnterPlanModeTool/ExitPlanModeTool— the two tools the module is DEFINED by (design §2 module 8 “D1 plan enter/exit tools”). Both are ordinarycrate::tools::Tools registered bycrate::tools::ToolRegistry::from_configwhen the module is active, so they are advertised, permission-gated, and evidence-checkable exactly like every other tool.PlanModeState— the shared mode flag plus the accumulated plan text. Lives oncrate::tools::ToolContext(anArc, shared with every clone of the context), so the agent’s permission gate and the tools see one state.deny_rules— the module’s actual RESTRICTION.plan_mode’s §2.1 dependency edge isplan_mode → permissions.rules | permissions.sandbox(“a restriction mechanism”), and this is that edge honored literally: while the mode is active the agent folds these patterns into the permissions engine’s DENY tier, the same first-match deny→ask→allow evaluation every other rule gets. There is no second, parallel enforcement path.
Exit requires an approval, not a flag flip. exit_plan_mode carries
the plan into a crate::permissions::ApprovalRequest answered by
whatever crate::permissions::PermissionsApprovalHandler the embedder
installed — under an SDK-owned runtime that is the frontend request
broker (crate::server), i.e. the same door harness.v1.approvals.list
lists and harness.v1.runtimes.respond answers. No handler installed
means no human can answer, so the exit is refused and the mode stays on
(fail-closed, the same posture crate::permissions::resolve_ask takes).
Structs§
- Enter
Plan Mode Tool enter_plan_mode— start the read-only research phase.- Exit
Plan Mode Tool exit_plan_mode— present the plan for approval and, if approved, leave the read-only phase.- Plan
Mode State - The shared plan-mode state: whether the read-only research phase is active, and the plan accumulated so far.
Constants§
- ENTER_
PLAN_ MODE - Registered name of the enter tool (Claude Code’s
EnterPlanMode). - EXIT_
PLAN_ MODE - Registered name of the exit tool (Claude Code’s
ExitPlanMode).
Functions§
- deny_
rules - The permissions-engine DENY patterns that narrow the tool surface to a read-only research phase while plan mode is active — an EMPTY vector when it is not, so a session that never enters plan mode evaluates byte-identically to one built before this module existed.