Skip to main content

Module session

Module session 

Source
Expand description

Session continuation and permission preset application.

apply_session is the single flag->QueryCommand mapper: it translates an crate::engine::Config (session continuity, model/effort/agent, the permission posture, caps, MCP, …) into the matching builder calls. It is clap-free – the CLI’s run_ask builds a Config from its resolved AskArgs (build_config) and the side-effect-free engine::run takes one directly, so both share this one mapper with no second copy to drift.

Enums§

Resolution
Outcome of resolving a user-supplied -c <value> against the known session ids of a project. See resolve_session_prefix.

Constants§

BUILTIN_AGENT_NOTICE
The built-in advisory roba injects into the agent’s system prompt by default. It states roba’s execution truth: the spawned agent is a single, non-interactive claude -p turn, not a persistent harness, so there are no cross-turn background-completion notifications. On by default; suppressed with --no-agent-notice, replaced with --agent-notice / the agent_notice config key. See issue #302.

Functions§

apply_permissions
Apply permission policy.
apply_session
Apply session-related flags (-c / -c=ID, –fork), the model override (–model), the subagent override (–agent), and then permission-related flags. Returns the configured QueryCommand.
compose_append_system_prompt
Compose the final --append-system-prompt value: the user’s own append text (if any) combined with the built-in agent notice (if enabled).
continue_defeated_by_anon_worktree
True when a continue/resume request will be silently defeated by an anonymous (unnamed) worktree: the worktree mints a fresh dir every run, so -c finds no prior session there. A NAMED worktree is stable and composes fine, so it is excluded; a --session-id (a new session with a chosen id, i.e. Session::WithId) is not a continue/resume, so it is excluded too.
derive_session_name
Derive a display name from the resolved prompt for claude --name. Shows up in the claude --resume picker, the terminal title, and the prompt box. Without it, sessions roba creates are effectively invisible to the picker.
resolve_session_prefix
Resolve input as a git-style session-id prefix against the project’s known available_ids.