# createPlanModeFilter

**Kind:** Function

**Source:** [`atloria-monorepo/libs/agent-core/src/session/plan-mode-filter.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/agent-core/src/session/plan-mode-filter.ts#L55)

Create a ToolPreExecutionHook that blocks write/mutation tools during plan mode.

When plan mode is active, any tool not in the allowed set gets a clear error
message explaining that it's blocked and suggesting the agent continue with
investigation. The tool never executes — it's blocked before running.

Returns the hook and a `setPlanMode` function to toggle blocking on/off.

## Signature

```ts
function createPlanModeFilter(options: PlanModeFilterOptions): { hook: ToolPreExecutionHook; setPlanMode: (active: boolean) => void }
```

## Parameters

| Name | Type |
|---|---|
| `options` | `PlanModeFilterOptions` |

**Returns:** `{ hook: ToolPreExecutionHook; setPlanMode: (active: boolean) => void }`
