<!-- source: https://deepwiki.com/openclaw/openclaw/3.5.2-status-and-directives -->

# Status & Directives

- docs/plugins/hooks.md
- src/agents/agent-command.live-model-switch.test.ts
- src/agents/agent-command.ts
- src/agents/agent-scope.test.ts
- src/agents/agent-scope.ts
- src/agents/cli-runner.runtime.ts
- src/agents/openclaw-tools.sessions.test.ts
- src/agents/tools/agent-step.test.ts
- src/agents/tools/agent-step.ts
- src/agents/tools/sessions-send-tool.ts
- src/agents/tools/sessions.test.ts
- src/auto-reply/get-reply-options.types.ts
- src/auto-reply/reply/agent-runner-cli-dispatch.test.ts
- src/auto-reply/reply/agent-runner-cli-dispatch.ts
- src/auto-reply/reply/agent-runner-execution.test.ts
- src/auto-reply/reply/agent-runner-execution.ts
- src/auto-reply/reply/context-text.ts
- src/auto-reply/reply/current-turn-images.ts
- src/auto-reply/reply/dispatch-acp-command-bypass.test.ts
- src/auto-reply/reply/dispatch-acp-command-bypass.ts
- src/auto-reply/reply/dispatch-acp-delivery.test.ts
- src/auto-reply/reply/dispatch-acp-delivery.ts
- src/auto-reply/reply/dispatch-acp.ts
- src/auto-reply/reply/dispatch-from-config.test.ts
- src/auto-reply/reply/dispatch-from-config.ts
- src/auto-reply/reply/effective-reply-route.test.ts
- src/auto-reply/reply/effective-reply-route.ts
- src/auto-reply/reply/followup-runner.test.ts
- src/auto-reply/reply/followup-runner.ts
- src/auto-reply/reply/get-reply-directives.ts
- src/auto-reply/reply/get-reply-run.media-only.test.ts
- src/auto-reply/reply/get-reply-run.ts
- src/auto-reply/reply/get-reply.ts
- src/auto-reply/reply/model-selection.test.ts
- src/auto-reply/reply/model-selection.ts
- src/auto-reply/reply/queue/types.ts
- src/channels/plugins/setup-helpers.test.ts
- src/commands/agent.test.ts
- src/cron/isolated-agent/run.cron-model-override-forwarding.test.ts
- src/plugin-sdk/acp-runtime-backend.ts
- src/plugin-sdk/acp-runtime.test.ts
- src/plugins/contracts/run-context-lifecycle.contract.test.ts
- src/plugins/hook-types.ts
- src/plugins/runtime/runtime-tasks.test.ts
- src/plugins/status.registry-snapshot.test.ts
- src/plugins/web-provider-runtime-shared.test.ts

## Purpose and Scope

This page documents the **status message system** and **inline directives** in OpenClaw. Status messages provide runtime information about the current session, model configuration, token usage, and related parameters. Inline directives such as `/think`, `/verbose`, `/reasoning`, and `/fast` allow users to modify agent behavior dynamically within a chat message. This section covers the implementation of directive persistence, authorization, and the construction of status responses.

## Status Messages

Status messages present detailed runtime information for the current session. The system identifies the active runtime-such as the built-in Pi Agent Core or external harnesses-to tailor the status output.

### Status Construction Pipeline

The construction of status information gathers data from the active `SessionEntry` [src/config/sessions.js55](https://github.com/openclaw/openclaw/blob/fbdf5937/src/config/sessions.js#L55-L55) configuration defaults, and live provider usage. Key metadata includes versions, model configurations, fallback states, token usage, and current queue/activation states.

**Status Construction Flow**

```

```

The system resolves the model authentication mode (e.g., API key, OAuth) to display in status reports. This ensures the user knows which credential profile is active during the current run via `resolveRunAuthProfile` [src/auto-reply/reply/agent-runner-execution.ts88](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L88-L88)

Sources: [src/config/sessions.js55](https://github.com/openclaw/openclaw/blob/fbdf5937/src/config/sessions.js#L55-L55) [src/auto-reply/reply/agent-runner-execution.ts88](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L88-L88) [src/auto-reply/reply/dispatch-from-config.ts107-112](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/dispatch-from-config.ts#L107-L112)

## Directives Overview

**Directives** are inline annotations embedded within chat messages to control agent behavior. They are processed by the Gateway and stripped before the model sees the message [src/auto-reply/reply/get-reply-run.ts66](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/get-reply-run.ts#L66-L66)

### Directive Persistence vs Ephemeral Use

The system distinguishes between messages containing **only directives** and those with mixed content:

1. Directive-Only : If a message consists solely of directives (e.g., /think high ), the settings are persisted to the session store via updateSessionStore src/auto-reply/reply/agent-runner-execution.ts 56
2. Inline/Mixed : If a message contains directives and text (e.g., /think high explain this code ), the directives are treated as "inline hints" and do not persist session settings; they apply only to the current turn.

**Directive Parsing Decision Tree**

```

```

Sources: [src/auto-reply/reply/agent-runner-execution.ts56](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L56-L56) [src/auto-reply/reply/agent-runner-execution.ts85-86](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L85-L86) [src/auto-reply/reply/get-reply-run.ts66](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/get-reply-run.ts#L66-L66)

## Directive Types and Effects

Below are the primary inline directives and their corresponding effects on the session state.

### Thinking Level Resolution

Thinking levels are resolved in a specific hierarchy:

1. Inline directive on the current message (highest priority).
2. Session override (set by directive-only message).
3. Per-agent default via resolveDefaultModelForAgent src/agents/agent-command.ts 113
4. Global default .
5. Fallback : Provider-declared default via resolveThinkingDefault src/agents/agent-command.ts 114

Sources: [src/auto-reply/reply/get-reply-run.ts50-59](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/get-reply-run.ts#L50-L59) [src/agents/agent-command.ts96](https://github.com/openclaw/openclaw/blob/fbdf5937/src/agents/agent-command.ts#L96-L96) [src/agents/agent-command.ts113-114](https://github.com/openclaw/openclaw/blob/fbdf5937/src/agents/agent-command.ts#L113-L114)

## Implementation Details

### Authorization & Security

Directives are only applied for **authorized senders**. Authorization is checked during message dispatch and before updating the session store via `updateSessionStore` [src/auto-reply/reply/agent-runner-execution.ts56](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L56-L56)

### Persistence Logic

When a directive-only message is processed, the system updates the session state using `updateSessionStore`. This persistence ensures that subsequent messages in the same session inherit the chosen behavior (like `/fast on`) until explicitly reset.

### Response Sanitization

Before a reply is delivered, the system performs sanitization:

- Directive Stripping : Using stripLeadingSilentToken to remove tokens like SILENT_REPLY_TOKEN from the user-facing transcript src/auto-reply/reply/agent-runner-execution.ts 85
- Transcript Updates : Assistant messages are appended to the session transcript via appendAssistantMessageToSessionTranscript src/auto-reply/reply/dispatch-from-config.ts 46
- Context Management : Handling context overflow by building recovery text if limits are exceeded src/auto-reply/reply/agent-runner-execution.ts 15

Sources: [src/auto-reply/reply/agent-runner-execution.ts56](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L56-L56) [src/auto-reply/reply/agent-runner-execution.ts85](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L85-L85) [src/auto-reply/reply/dispatch-from-config.ts46](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/dispatch-from-config.ts#L46-L46) [src/auto-reply/reply/agent-runner-execution.ts15](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L15-L15)

## Diagrams Bridging Natural Language & Code Entities

### 1. Directive Processing & Persistence Map

```

```

Sources: [src/auto-reply/reply/agent-runner-execution.ts56](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L56-L56) [src/auto-reply/reply/agent-runner-execution.ts85](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L85-L85) [src/config/sessions.js56](https://github.com/openclaw/openclaw/blob/fbdf5937/src/config/sessions.js#L56-L56)

### 2. Status Information Resolution Pipeline

```

```

Sources: [src/auto-reply/reply/agent-runner-execution.ts88](https://github.com/openclaw/openclaw/blob/fbdf5937/src/auto-reply/reply/agent-runner-execution.ts#L88-L88) [src/agents/agent-command.ts113-114](https://github.com/openclaw/openclaw/blob/fbdf5937/src/agents/agent-command.ts#L113-L114)
