Documentation
¶
Overview ¶
Package mode defines named operation profiles that constrain which tools the agent will dispatch. Each Mode owns an allow-list over the existing tools.Group taxonomy — modes do NOT introduce new tool metadata, they only filter the existing set.
The rationale is operator safety: an operator working a Recon job should not be able to fat-finger an RF transmit because the same Spec catalog the LLM is reasoning over also includes Sub-GHz TX primitives. Switching to ModeRecon refuses every group whose group is not on the allow-list, surfacing the refusal as a structured error the UI can display verbatim.
Mode is orthogonal to risk.Level. Recon happens to imply low-risk- only as a rule, but the implementation reads spec.Risk separately when relevant; Allows itself only inspects the group.
The default mode is ModeStandard and its allow-list is exactly the full set of registered groups, so unsetting --mode preserves the historic "everything goes" behaviour.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode string
Mode is a named operation profile. The string form (lower case) is what operators see on the CLI flag and in the REPL.
const ( // ModeStandard is the default, no-op profile — every group is // allowed. Behaviour identical to a build without modes. ModeStandard Mode = "standard" // ModeRecon is read-only reconnaissance. Allows Flipper system / // storage / IR-rx, Marauder scan, and host-side analysis tools. // Forbids any RF transmit, NFC/RFID write, BadUSB run, or // generation tool. Pairs naturally with risk.Low, but the rule is // expressed as a group allow-list — callers that need to layer // risk filtering can read spec.Risk separately. ModeRecon Mode = "recon" // ModeIntel is Recon plus host-side analysis (vision, RAG, // security/host tools). Same TX prohibition; adds the tools an // analyst needs to correlate captures. ModeIntel Mode = "intel" // ModeStealth is the minimal-RF profile. Disables every Marauder // group (SSID broadcasts, deauth, evil portal, scans), Sub-GHz // (TX and RX), NFC, RFID, and iButton. Allows Flipper system // (CLI introspection), storage, and IR — the IR group is // transmit-capable in name but the receive primitives live in // the same group, so this is a deliberate compromise: operators // in stealth mode use ir_decode_file but should not invoke // ir_send_universal. Future split of GroupFlipperIR into rx/tx // subgroups would tighten this naturally. ModeStealth Mode = "stealth" // ModeAssault permits everything ModeStandard permits. The // distinction is documentational — operators flipping into // Assault are stating an intent so audit/UI banners can flag the // session. The dispatch behaviour is identical to Standard. ModeAssault Mode = "assault" )
Operation modes. New modes MUST be added to allModes so /mode listing and ParseMode pick them up automatically.
func All ¶
func All() []Mode
All returns the canonical ordered list of supported modes. Returned slice is a fresh copy so callers may sort or filter without side effects on package state.
func ParseMode ¶
ParseMode resolves a user-supplied string into a Mode. Matching is case-insensitive and whitespace-tolerant. The empty string returns ModeStandard so unset CLI flags / config fields behave as the default. Unknown strings return an error listing every supported mode so misuse is self-correcting.
func (Mode) Allows ¶
Allows reports whether a tool whose Spec has the given Group can be dispatched in this mode. Standard and Assault always return true; the constrained modes consult modeAllowList. An unknown Mode also returns true so a future mode added to allModes but not to modeAllowList degrades open rather than refusing every tool.
func (Mode) Description ¶
Description returns a one-line operator summary of the mode's intent. Used in /mode listings and the startup banner.
func (Mode) DisplayName ¶
DisplayName returns a Title-Cased operator-facing label.
func (Mode) IsReadRestrictive ¶ added in v0.80.0
IsReadRestrictive reports whether the mode implies the ReadOnly safety rail (defence-in-depth overlay). Recon, Intel, and Stealth all forbid writes/transmits as part of their definition, so the cmd/promptzero setupMode + /mode runtime switch both engage the ReadOnly overlay when entering one of these modes.
Centralised here (rather than open-coded in setup.go) so a new constrained mode added to allModes stays in lockstep with the read-only coupling — a single edit covers both the startup banner and the runtime /mode handler.