Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ members = [
"src/cortex-skills",
"src/cortex-prompt-harness",

# CLI - Features (Phase 3 - Codex-inspired)
# CLI - Features (Phase 3)
"src/cortex-collab",
"src/cortex-network-proxy",
"src/cortex-shell-snapshot",
Expand Down Expand Up @@ -228,7 +228,7 @@ cortex-ollama = { path = "src/cortex-ollama" }
cortex-skills = { path = "src/cortex-skills" }
cortex-prompt-harness = { path = "src/cortex-prompt-harness" }

# Phase 3 - Codex-inspired crates
# Phase 3 crates
cortex-collab = { path = "src/cortex-collab" }
cortex-network-proxy = { path = "src/cortex-network-proxy" }
cortex-shell-snapshot = { path = "src/cortex-shell-snapshot" }
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-agents/src/control.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Agent control for multi-agent operations.
//!
//! Provides a control-plane interface for managing agent threads,
//! inspired by OpenAI Codex's AgentControl system.
//! handling spawning, lifecycle, and inter-agent communication.

use crate::AgentInfo;
use std::collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-cli/src/run_cmd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Run command for non-interactive Cortex CLI execution.
//!
//! Provides a comprehensive run command similar to OpenCode's run functionality:
//! Provides a comprehensive run command for batch execution:
//! - `cortex run [message..]` - Execute with a message prompt
//! - `--command` - Execute a predefined command
//! - `--continue/-c` - Continue the last session
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-collab/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Multi-agent collaboration system for Cortex CLI.
//!
//! This crate implements multi-agent collaboration features inspired by OpenAI Codex:
//! This crate implements multi-agent collaboration features:
//! - Agent spawning and lifecycle management
//! - Inter-agent communication
//! - Wait/sync mechanisms with timeout
Expand Down
5 changes: 0 additions & 5 deletions src/cortex-common/src/model_presets/aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ pub const MODEL_ALIASES: &[ModelAlias] = &[
alias: "o3",
model: "openai/o3",
},
ModelAlias {
alias: "codex",
model: "openai/gpt-5.2-codex",
},
// Google models
ModelAlias {
alias: "gemini",
Expand Down Expand Up @@ -103,7 +99,6 @@ mod tests {
assert_eq!(resolve_model_alias("opus"), "anthropic/claude-opus-4.5");
assert_eq!(resolve_model_alias("gpt4"), "openai/gpt-4o");
assert_eq!(resolve_model_alias("haiku"), "anthropic/claude-haiku-4.5");
assert_eq!(resolve_model_alias("codex"), "openai/gpt-5.2-codex");
assert_eq!(resolve_model_alias("r1"), "deepseek/deepseek-r1");
}

Expand Down
9 changes: 0 additions & 9 deletions src/cortex-common/src/model_presets/presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,15 +633,6 @@ pub const MODEL_PRESETS: &[ModelPreset] = &[
supports_tools: true,
supports_reasoning: false,
},
ModelPreset {
id: "openai/gpt-5.2-codex",
name: "GPT-5.2 Codex (via Cortex) - DEFAULT",
provider: "cortex",
context_window: 256_000,
supports_vision: true,
supports_tools: true,
supports_reasoning: true,
},
// Other Cortex models
ModelPreset {
id: "openai/gpt-4o",
Expand Down
6 changes: 3 additions & 3 deletions src/cortex-core/src/widgets/brain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! Uses sine wave radial expansion from center:
//! - Wave expands outward from brain center
//! - 2-second cycle (slow, hypnotic)
//! - Green gradient (#00FFA3 Codex accent)
//! - Green gradient (#00FFA3)
//!
//! # Example
//! ```
Expand Down Expand Up @@ -62,7 +62,7 @@ const WAVE_SPEED: f32 = std::f32::consts::PI * 2.0;
/// Wave scale: controls the "wavelength" of radial rings
const WAVE_SCALE: f32 = 6.0;

/// Codex accent green color
/// Accent green color
const ACCENT_GREEN: (u8, u8, u8) = (0x00, 0xFF, 0xA3);

/// Dark green base color
Expand Down Expand Up @@ -194,7 +194,7 @@ impl Brain {

/// Gets the style for a character based on wave intensity.
///
/// Creates a gradient from dark green to bright Codex green (#00FFA3).
/// Creates a gradient from dark green to bright green (#00FFA3).
fn get_wave_style(&self, base_density: f32, wave: f32) -> Style {
// Combine base density with wave for final brightness
let brightness = base_density * (0.4 + wave * 0.6 * self.intensity);
Expand Down
6 changes: 3 additions & 3 deletions src/cortex-engine/src/agent/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl Orchestrator {

// If no tool calls, check if we need to request a summary
if tool_calls.is_empty() {
// OpenCode pattern: If the model finished with no text after doing tool work,
// If the model finished with no text after doing tool work,
// add a synthetic message asking for a summary and call the model one more time.
// This ensures we get a meaningful response instead of empty output.
let has_no_text = text.as_ref().map(|t| t.trim().is_empty()).unwrap_or(true);
Expand All @@ -277,7 +277,7 @@ impl Orchestrator {
// Mark that we've requested a summary to avoid infinite loop
ctx.summary_requested = true;

// Add synthetic user message asking for summary (OpenCode pattern)
// Add synthetic user message asking for summary
let _ = self
.context
.add_message(Message::user(
Expand Down Expand Up @@ -310,7 +310,7 @@ impl Orchestrator {
}

// Use the last text segment as the primary response for subagents
// This follows OpenCode's pattern of using findLast() for text parts
// Uses findLast() logic for text parts to get the final segment
// If there's meaningful last_text_segment, prefer it; otherwise use full response
let effective_response = if !last_text_segment.trim().is_empty() {
// The last segment has content - use it as the response
Expand Down
4 changes: 2 additions & 2 deletions src/cortex-engine/src/config/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Supports multiple configuration formats:
//! - TOML (`.toml`) - Primary format
//! - JSON with comments (`.json`, `.jsonc`) - OpenCode-compatible format
//! - JSON with comments (`.json`, `.jsonc`) - JSONC format

use std::path::{Path, PathBuf};

Expand Down Expand Up @@ -694,7 +694,7 @@ model = "sync-model"
#[test]
fn test_parse_json_config() {
let json_content = r#"{
// OpenCode-style config with comments
// JSON with comments (JSONC) config
"model": "claude-3-opus",
"model_provider": "anthropic"
}"#;
Expand Down
4 changes: 2 additions & 2 deletions src/cortex-engine/src/config/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::custom_command::CustomCommandConfig;
use crate::plugin::{PluginConfigEntry, PluginSettings};

/// Permission level for granular permission control.
/// Follows OpenCode-style permission configuration.
/// Supports three-tier allow/ask/deny permission model.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PermissionLevel {
Expand All @@ -34,7 +34,7 @@ impl std::fmt::Display for PermissionLevel {
}

/// Permission configuration structure.
/// Supports OpenCode-style granular permission control.
/// Supports granular permission control per operation type.
#[derive(Debug, Clone, Default, PartialEq, Deserialize)]
pub struct PermissionConfig {
/// Default permission level for edit operations.
Expand Down
1 change: 0 additions & 1 deletion src/cortex-engine/src/git_snapshot.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Git-based snapshot for fast undo/redo tracking.
//!
//! Uses git's plumbing commands (write-tree, read-tree) for instant snapshots.
//! Inspired by OpenCode's snapshot implementation.

use std::path::{Path, PathBuf};
use std::process::Command;
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-engine/src/mcp/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use tracing::{debug, info, warn};
use crate::error::{CortexError, Result};
use cortex_common::create_default_client;

/// OAuth callback port - matches OpenCode's port for consistency.
/// OAuth callback port for local redirect URI.
pub const OAUTH_CALLBACK_PORT: u16 = 19876;

/// OAuth callback path.
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-engine/src/sandbox/landlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Uses the cortex-linux-sandbox wrapper binary to apply:
//! - Landlock filesystem restrictions
//! - Seccomp network filtering
//! - Mount namespace for read-only .git/.codex protection
//! - Mount namespace for read-only .git/.cortex protection

use std::path::PathBuf;

Expand Down
9 changes: 4 additions & 5 deletions src/cortex-engine/src/sandbox/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
pub struct WritableRoot {
/// The writable root path.
pub root: PathBuf,
/// Subpaths that should remain read-only (e.g., .git, .codex).
/// Subpaths that should remain read-only (e.g., .git, .cortex).
pub read_only_subpaths: Vec<PathBuf>,
}

Expand All @@ -24,9 +24,9 @@ impl WritableRoot {
}
}

/// Create a writable root with standard protected subpaths (.git, .codex, .cortex).
/// Create a writable root with standard protected subpaths (.git, .cortex).
pub fn with_standard_protections(root: PathBuf) -> Self {
let read_only_subpaths = vec![root.join(".git"), root.join(".codex"), root.join(".cortex")];
let read_only_subpaths = vec![root.join(".git"), root.join(".cortex")];
Self {
root,
read_only_subpaths,
Expand Down Expand Up @@ -212,7 +212,6 @@ impl ProtectedPaths {
Self {
read_only: vec![
workspace.join(".git"),
workspace.join(".codex"),
workspace.join(".cortex"),
],
denied: vec![
Expand Down Expand Up @@ -253,7 +252,7 @@ mod tests {

assert!(root.is_path_writable(Path::new("/workspace/src/main.rs")));
assert!(!root.is_path_writable(Path::new("/workspace/.git/config")));
assert!(!root.is_path_writable(Path::new("/workspace/.codex/state")));
assert!(!root.is_path_writable(Path::new("/workspace/.cortex/state")));
assert!(!root.is_path_writable(Path::new("/other/file.txt")));
}

Expand Down
2 changes: 1 addition & 1 deletion src/cortex-engine/src/sandbox/seatbelt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Uses sandbox-exec with dynamically generated SBPL policies to provide:
//! - Filesystem isolation with writable workspace
//! - .git/.codex protection via require-not clauses
//! - .git/.cortex protection via require-not clauses
//! - Optional network blocking

use std::path::PathBuf;
Expand Down
6 changes: 3 additions & 3 deletions src/cortex-engine/src/tools/handlers/edit_strategies/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Edit replacement strategies for robust code editing.
//!
//! This module implements 8 cascading replacement strategies inspired by OpenCode's
//! edit tool implementation. Each strategy tries progressively more flexible matching
//! approaches to find and replace text in source code.
//! This module implements 8 cascading replacement strategies for flexible text matching.
//! Each strategy tries progressively more flexible matching approaches to find and
//! replace text in source code.
//!
//! Strategies (in cascade order):
//! 1. SimpleReplacer - Exact string match
Expand Down
10 changes: 5 additions & 5 deletions src/cortex-engine/src/tools/handlers/subagent/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl SubagentExecutor {
};

// Build system prompt - use base prompt WITHOUT task details
// Task details will be sent as user message (OpenCode pattern)
// Task details will be sent as user message
let system_prompt = if let Some(ref agent) = custom_agent {
// Use the custom agent's base system prompt
agent.system_prompt.clone()
Expand All @@ -257,7 +257,7 @@ impl SubagentExecutor {
};

// Build user message containing the task
// This follows OpenCode's pattern where the task is a conversation, not system config
// Tasks are conversational - sent as user messages rather than system config
let user_task_message = if let Some(ref _agent) = custom_agent {
// For custom agents, format task with context
let mut message = format!(
Expand Down Expand Up @@ -425,7 +425,7 @@ impl SubagentExecutor {
config.working_dir.clone(),
);

// Execute with optional timeout (like OpenCode, no timeout by default)
// Execute with optional timeout (no timeout by default)
let mut turn_result = if let Some(timeout_duration) = config.effective_timeout() {
// With timeout
match timeout(timeout_duration, orchestrator.process_turn(&mut turn_ctx)).await {
Expand All @@ -437,7 +437,7 @@ impl SubagentExecutor {
}
}
} else {
// No timeout - run until completion (like OpenCode)
// No timeout - run until completion
orchestrator.process_turn(&mut turn_ctx).await
};

Expand Down Expand Up @@ -708,7 +708,7 @@ pub struct SubagentTypeInfo {

/// Extract file path from tool output.
/// Prompt used to request an explicit summary from a subagent when none was provided.
/// This follows the Codex pattern of ensuring structured output from agents.
/// Ensures structured output from agents for orchestrator consumption.
const SUMMARY_REQUEST_PROMPT: &str = r#"You have completed your work but did not provide a summary. Please provide a final summary NOW using EXACTLY this format:

## Summary for Orchestrator
Expand Down
6 changes: 3 additions & 3 deletions src/cortex-engine/src/tools/handlers/subagent/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl SubagentType {

/// Get the base system prompt for this subagent type (without task details).
/// The task details should be sent as a user message, not in the system prompt.
/// This follows OpenCode's pattern where the task is a conversation, not configuration.
/// Tasks are conversational - passed as user messages rather than system configuration.
pub fn base_system_prompt(&self) -> String {
// Common planning instructions that all subagents must follow
let planning_instructions = r#"
Expand Down Expand Up @@ -393,7 +393,7 @@ impl SubagentConfig {
}

/// Get effective timeout.
/// Returns None if no timeout is set (subagent runs until completion, like OpenCode).
/// Returns None if no timeout is set (subagent runs until completion).
pub fn effective_timeout(&self) -> Option<Duration> {
self.timeout
}
Expand All @@ -420,7 +420,7 @@ impl SubagentConfig {
}

/// Build the user message containing the task.
/// This follows OpenCode's pattern of sending tasks as user messages.
/// Tasks are sent as user messages for conversational interaction.
pub fn build_user_message(&self) -> String {
let mut message = format!(
"## Task\n{}\n\n## Instructions\n{}",
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-engine/src/tools/unified_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ impl BatchToolExecutor for UnifiedBatchExecutor {
) -> Result<ToolResult> {
// Prevent recursive batch calls (already handled by BatchToolHandler validation)
// Also prevent Task from being called in batch for safety
// (Task is allowed in OpenCode but we're being more conservative here)
// (being conservative to avoid complex nesting scenarios)

self.registry
.execute_with_context(name, arguments, context.clone())
Expand Down
4 changes: 2 additions & 2 deletions src/cortex-gui/src/components/SearchEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ export function useSearchEditor() {
setIsOpen(true);
};

const openCodeSearchFile = (filePath: string) => {
const openSearchFile = (filePath: string) => {
setInitialQuery("");
setInitialResults([]);
setCodeSearchFilePath(filePath);
Expand Down Expand Up @@ -1832,7 +1832,7 @@ export function useSearchEditor() {
initialResults,
codeSearchFilePath,
openSearchEditor,
openCodeSearchFile,
openSearchFile,
closeSearchEditor,
SearchEditorComponent: () => (
<SearchEditor
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-gui/src/components/ai/SubagentsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* SubagentsDialog - Manage and spawn AI sub-agents
* Inspired by OpenCode's subagent system
* Subagent management dialog for viewing and controlling active subagents
*/

import {
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-linux-sandbox/src/mounts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Mount namespace operations.
//!
//! Provides bind-mount operations to make paths read-only within a new
//! mount namespace. This is used to protect .git and .codex directories
//! mount namespace. This is used to protect .git and .cortex directories
//! from modification even within writable roots.

use std::ffi::CString;
Expand Down
1 change: 0 additions & 1 deletion src/cortex-linux-sandbox/src/run_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ pub fn run_main() -> ! {
root: args.sandbox_policy_cwd.clone(),
read_only_subpaths: vec![
args.sandbox_policy_cwd.join(".git"),
args.sandbox_policy_cwd.join(".codex"),
args.sandbox_policy_cwd.join(".cortex"),
],
}]
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-network-proxy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Network proxy with domain filtering and SSRF protection for Cortex CLI.
//!
//! This crate implements a network proxy inspired by OpenAI Codex:
//! This crate implements a network proxy with:
//! - Domain allowlist/denylist with wildcard patterns
//! - SSRF protection (blocks private/local IPs)
//! - Network mode control (Full/Limited/Disabled)
Expand Down
2 changes: 1 addition & 1 deletion src/cortex-protocol/src/protocol/message_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::tokens::TokenUsage;
// ============================================================

/// Rich message part types supporting various content kinds.
/// Based on OpenCode's message part system for comprehensive message representation.
/// Provides comprehensive message representation for structured content.
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum MessagePart {
Expand Down
Loading
Loading