feat(cortex-cli): implement complete headless exec mode#191
Merged
Conversation
bec24d6 to
177fffa
Compare
This implements a complete headless execution mode similar to Droid's exec mode from Factory. The new exec command is designed for CI/CD pipelines, shell scripts, and batch processing. Key features: - Autonomy levels (--auto): read-only, low, medium, high - read-only: No file/tool permissions - low: Requires approval for writes - medium: Auto-approve safe operations - high: Full auto-approve - Skip permissions (--skip-permissions-unsafe): Bypass sandboxing - Output formats (--format): - text: Human-readable streaming output (default) - json: Structured JSON final result - stream-json: NDJSON event stream - stream-jsonrpc: JSON-RPC 2.0 protocol for multi-turn - Input formats (--input-format): - text: Single prompt input - stream-jsonrpc: Multi-turn JSON-RPC input via stdin - Tool controls: - --enabled-tools: Whitelist specific tools - --disabled-tools: Blacklist specific tools - Session continuation: --session-id for resuming sessions - Execution limits: - --timeout: Maximum execution time - --max-turns: Maximum conversation turns - Fail-fast behavior: Aborts on permission policy violations - Image attachments: --image flag for visual inputs JSON-RPC 2.0 support for multi-turn conversations: - Submit user messages via stdin - Receive events via stdout - Supports cancel, status, and heartbeat operations - Configurable heartbeat interval This replaces the simple ExecCommand with ExecCli providing enterprise-grade automation capabilities.
177fffa to
88b02ff
Compare
echobt
pushed a commit
that referenced
this pull request
Jan 27, 2026
This commit implements the following features from open PRs: PR #191: Complete headless exec mode - Autonomy levels (--auto read-only|low|medium|high) - Skip permissions mode (--skip-permissions-unsafe) - Output formats (text, json, stream-json, stream-jsonrpc) - Multi-turn conversations via stream-jsonrpc input format - Tool controls (--enabled-tools, --disabled-tools) - Session continuation (--session-id) - Fail-fast behavior on permission violations - Timeout and max-turns controls - Image attachments support - Verbose mode for debugging PR #113: Expose context window configuration options - Added model_context_window option documentation - Added model_auto_compact_token_limit option documentation - Both options now visible in default config template Changes include: - exec_cmd.rs: New comprehensive exec module with autonomy levels - lib.rs: Export exec_cmd module - main.rs: Use ExecCli, add context window config options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a comprehensive headless execution mode for cortex-cli, similar to Droid's exec mode from Factory. The new exec command is designed for CI/CD pipelines, shell scripts, and batch processing.
Features
Autonomy Levels (
--auto)Skip Permissions (
--skip-permissions-unsafe)Bypass all sandboxing for trusted environments (use with caution)
Output Formats (
--format)Input Formats (
--input-format)Tool Controls
--enabled-tools: Whitelist specific tools (comma-separated)--disabled-tools: Blacklist specific tools (comma-separated)Session Management
--session-id: Continue an existing sessionExecution Limits
--timeout: Maximum execution time in seconds--max-turns: Maximum conversation turnsOther Features
--imageflag for visual inputsJSON-RPC 2.0 Protocol
For multi-turn conversations:
--heartbeat)Example Usage
Migration Notes
This PR replaces the simple
ExecCommandwith the comprehensiveExecClifrom the newexec_cmdmodule. The basic usage remains compatible, but additional flags are now available for fine-grained control.Testing
Related Issues