Roo Code is a core reference system because it exposes strong signals around runtime state, permissions, tool orchestration, and user-visible task progression.
- Strong evidence for explicit state modeling.
- Strong evidence for permission and approval boundaries.
- Useful for studying the coupling between runtime state and UI state.
- Roo exposes an explicit agent state model in its CLI layer.
AgentLoopStateincludesno_task,running,streaming,waiting_for_input,idle, andresumable, andAgentStateInfoattaches arequiredActionfield rather than forcing the UI to infer control state from raw messages. - Roo treats completion as a first-class tool and not just an assistant utterance.
AttemptCompletionToolowns completion flow, partial completion streaming, user confirmation, telemetry, and task-completed event emission. - Completion is guarded. Roo blocks
attempt_completionwhen a tool failed in the current turn and can also block completion when open todos remain ifpreventCompletionWithOpenTodosis enabled. - Permission handling is explicit. Auto-approval logic distinguishes between approve, deny, and ask, and the CLI settings surface
requireApprovaland one-shot task completion behavior. - Context management is a runtime concern.
Task.attemptApiRequest()checks whether context management is likely to run before the next request, and the context-management layer estimates token use and condenses state when thresholds are crossed.
- Explicit state machine:
apps/cli/src/agent/agent-state.tsdefinesAgentLoopState,RequiredAction, anddetectAgentState(). - State exposed to product shell:
apps/cli/src/agent/extension-client.tsexposesgetAgentState(),getCurrentState(), and helpers likeisWaitingForInput(). - Completion as first-class tool:
src/core/tools/AttemptCompletionTool.tsandsrc/core/prompts/tools/native-tools/attempt_completion.ts. - Completion guardrails:
src/core/tools/AttemptCompletionTool.tsandsrc/core/tools/__tests__/attemptCompletionTool.spec.ts. - Permission model:
src/core/auto-approval/index.tsandapps/cli/src/types/types.ts. - Context management:
src/core/task/Task.tsandsrc/core/context-management/index.ts.
- Runtime-state exposure to product shell.
- Guarded completion.
- Structured permission boundaries.
- Required-action modeling separate from transcript text.
- Compaction as a first-class runtime behavior.
- Roo-specific command surfaces.
- UI wording or mode branding.
- Roo-specific event names and settings layout.
high-confidence convergence for explicit state, guarded completion, and permission boundaries.
- https://github.com/roocodeinc/roo-code/blob/main/apps/cli/src/agent/agent-state.ts
- https://github.com/roocodeinc/roo-code/blob/main/apps/cli/src/agent/extension-client.ts
- https://github.com/roocodeinc/roo-code/blob/main/src/core/tools/AttemptCompletionTool.ts
- https://github.com/roocodeinc/roo-code/blob/main/src/core/tools/__tests__/attemptCompletionTool.spec.ts
- https://github.com/roocodeinc/roo-code/blob/main/src/core/auto-approval/index.ts
- https://github.com/roocodeinc/roo-code/blob/main/src/core/task/Task.ts
- https://github.com/roocodeinc/roo-code/blob/main/src/core/context-management/index.ts