# ctx.modes `ModesService` — provided by `@deepseek-ai/dsh-mode`. `ctx.modes`: the session-mode service. Owns the `mode/set` vocabulary, the pending-intent flush, the boundary narration, the `mode:policy` section, and the exit tool's visibility rule. UIs read mode flips off `session/event`; there is no live mirror. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L216) ### ctx.modes.resolved ```ts website-api readonly resolved: ResolvedModes ``` Validated definitions (built-in `plan` merged unless overridden). [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L220) ### ctx.modes.list() ```ts website-api list(): string[] ``` The selectable mode vocabulary: DEFAULT_MODE first, then the configured definitions — the list a mode picker advertises. **Returns** Mode names, `default` first. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L380) ### ctx.modes.get(agent) ```ts website-api get(agent: Agent): { current: string; pending?: string } ``` The agent's mode state: the folded mode in force (a folded name the config no longer defines reads as DEFAULT_MODE) plus the pending user-selected intent awaiting its boundary flush, when one exists. - `agent` — The agent to read. **Returns** The current (effective) mode and the pending intent, if any. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L392) ### ctx.modes.set(agent, mode) ```ts website-api set(agent: Agent, mode: string): void ``` Select the agent's mode. Validates the name against list (loud on unknown; `default` is always a valid target), drops a no-op (target equals the pending intent, else the current fold), and otherwise records a pending intent flushed as a `mode/set` at the next turn boundary. - `agent` — The agent to switch. - `mode` — The target mode name. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L407)