A Rust implementation of the Codex CLI, TUI, and Native macOS Desktop App (tao + wry + muda + ratatui).
English | 简体中文
Scope & Status: Mini Codex is an independent Rust re-implementation of the Codex CLI and macOS desktop workspace. Cloud sync, sharing, multi-user collaboration, and cloud execution are out of scope. Full pixel-level UI parity, live paid API permissions, and real voice hardware verification are not claimed; see docs/NATIVE_LOCAL.md, docs/PARITY.md, and design-qa.md for verified coverage and open gaps.
- Unified Workspace (
Chat,Work,Codex): Shares a native macOS window and an in-process Rust JSON-RPC backend (app-server). Each mode keeps independent session lists and drafts;Chatdoes not expose local execution tools. - Sessions: Search, pin, rename, projects, tags, fork/branch, archive/restore, and delete. Official Codex sessions can be imported read-only (continuing work creates a local copy). Deleting a local session clears its Goal and pauses attached heartbeats while retaining schedule definitions and run history.
- Work Pages: Local rich-text pages with side canvas, sub-pages and page trees,
Prompt/Task/Agent Instructions/Highlightblocks,Pages/Chatsreferences, isolated interactive visualizations, tables, attachments, math, find & replace, local comments, and revision history. Autosave uses optimistic version CAS while preserving original Markdown. Selection AI, drafts, and visualizations require explicit user review before applying; Markdown, JSON, and Word export plus clean system PDF printing are supported (see docs/DOCUMENTS.md). - Codex & Local Environments: File browser, Git status/diff, branch management, archivable/restorable managed worktrees (
includeLocalChanges,.worktreeincludeignored files, and ignoredAGENTS.override.md),.codex/environments/*.tomlsetup/cleanup/actions with revision conflict protection, real PTY interactive terminal (xtermwith ANSI, CJK input, zoom,Ctrl+C, multi-tab, reload recovery), reasoning summaries, tool approvals, MCP tools, and plugins (see docs/PARITY.md). - Chat Forks & Handoff: Fork threads in the current directory/worktree or into a new detached worktree, preserving history, project mapping, and origin metadata while keeping the original Goal, follow-ups, and drafts intact. Handoff moves changes and threads to a worktree, back to the main checkout, or into an existing worktree.
- Scheduled Tasks & Goals: Real local triggers supporting RRULE, IANA timezones and DST, cron (isolated session) and heartbeat (original session), multi-project runs, dedicated Git worktrees,
Run now, pause/resume, cancellation, and notification policies (requires the machine to stay awake and the App orapp-serverrunning). Goals attach to threads for auto-continuation with provider token usage tracking, optional budgets, human priority queues, and repeated-blocker stopping. - Auto-Approval (Guardian) & Exec Policy: Dedicated reviewer calls with read-only checks, single-action allow/deny/abort, and denial recovery (
thread/approveGuardianDeniedAction). Persistent "allow similar commands" rules save argument prefixes via the vendored Codex Starlark rule engine (rules/default.rules). Managed sandboxing uses macOS Seatbelt (read-only,workspace-write,danger-full-access); see design-qa.md. - Models & Responses API: Supports API key or ChatGPT OAuth (
mcodex login). Model picker, reasoning effort levels (includingultra), andStandard/Fastservice tiers align with the local Codex App catalog, with separate local overrides (see docs/MODELS.md). - Web Search, Files, Images & Voice: Hosted Responses
web_search(auto,cached,live,required,disabled) with activity tracking, clickable citations, and full consulted sources (docs/SEARCH.md); persistent file library with PDF/Office/text parsing and PNG/JPEG/WebP input; Images API generation, editing, and masking requiring an Images-enabled API key (docs/IMAGES.md); WebRTC bidirectional voice, transcription, and dictation via standalone API key path. - CLI, Headless Agent & SSH Remote: Includes
ratatuiTUI, non-interactiveexec, and JSONLapp-server. Build without GUI dependencies using--no-default-featuresfor remote Linux/macOS targets (docs/HEADLESS_AGENT.md). SSH mode supports host profiles, SHA-256 host-key inspection/trust (MCODEX_HOME/remote-known-hosts), remote execution, approval forwarding, and reconnect recovery (docs/REMOTE.md). - Mini, Popout & Global Shortcuts: Floating always-on-top Mini window, Popout windows, global shortcuts (default: Mini
⌥Space, dictation⌃⌥Space, screenshot⌥⇧Space), native file picker, and confirmed draft/attachment handoff between windows.
Product references: Pages, Scheduled tasks, Long-running work. Current implementation screenshots (not pixel-parity claims): Scheduled, Goal Editor.
cargo run # Interactive terminal UI (ratatui)
cargo run -- app # Native macOS desktop window (tao + wry + muda)
cargo run -- preview # Loopback web preview + Rust backend at http://127.0.0.1:5173
mcodex login # Sign in with ChatGPT browser OAuth (or set OPENAI_API_KEY)
mcodex exec "Explain src/main.rs"
mcodex sessions
mcodex mcp list
mcodex plugin list# Required once for Universal 2 builds (Apple Silicon + Intel)
rustup target add aarch64-apple-darwin x86_64-apple-darwin
# Local testing builds (ad-hoc signed, produces -unnotarized / debug dist/Mini ChatGPT.app)
./scripts/package-macos.sh --debug --app-only
./scripts/package-macos.sh --signing ad-hoc --arch arm64
# Official notarized Universal 2 release (macOS 12+; requires Developer ID & notarytool setup)
./scripts/package-macos.sh
# Headless Rust agent + portable source archive (no tao/wry/muda GUI deps)
./scripts/package-agent.sh --debug --offline- Release macOS packages target Universal 2 (
arm64+x86_64) withMACOSX_DEPLOYMENT_TARGET=12.0(dist/Mini ChatGPT.app,.dmg, and.pkg). Release signing defaults to Developer ID + notarization; see docs/MACOS_DISTRIBUTION.md for signing identities andnotarytoolsetup. - The macOS App HTTP client honors system proxy settings while keeping TLS certificate verification enabled.
- Browser
previewbinds strictly to loopback, checks request origin, and drives the same local tools as the native window.
Application settings, projects, documents, sessions, Goals, and schedules are stored under MCODEX_HOME (default: ~/.mcodex). Mini Codex never modifies official Codex rollout or config files. For isolated development without importing Codex sessions or credentials:
MCODEX_HOME=/tmp/mini-codex-dev MCODEX_NO_CODEX_IMPORT=1 cargo run -- previewcargo test
cargo build
node --check src/gui_desktop.js
node --check src/gui_scheduled.js
node scripts/test-desktop-state.mjs
node scripts/test-rendering.mjs
node scripts/test-markdown.mjs
node scripts/test-connection-workspaces.mjs
node scripts/test-files-ui.mjs
node scripts/test-voice-ui.mjs
node scripts/test-scheduled-ui.mjs
node scripts/test-models-ui.mjs
node scripts/test-images-ui.mjs
node scripts/test-popovers.mjs
node scripts/test-remote-ui.mjs
node scripts/test-search-ui.mjs
node scripts/test-execution-context.mjs
node scripts/test-embedded-ui.mjs
node scripts/test-native-windows.mjs
node scripts/test-codex-forks.mjs
node scripts/test-codex-handoff.mjs
node scripts/test-codex-permissions.mjs
node scripts/test-codex-environments.mjs
node scripts/test-codex-terminal.mjs
python3 scripts/smoke-desktop.py
python3 scripts/smoke-turns.py
python3 scripts/smoke-automations.py
python3 scripts/smoke-workspaces.py
python3 scripts/smoke-forks.py
python3 scripts/smoke-fork-states.py
python3 scripts/smoke-handoff.py
python3 scripts/smoke-handoff-failures.py
python3 scripts/smoke-guardian.py
python3 scripts/smoke-environments.py
python3 scripts/smoke-terminal.py
python3 scripts/smoke-account.py
python3 scripts/smoke-files.py
python3 scripts/smoke-voice.py
python3 scripts/smoke-models.py
python3 scripts/smoke-images.py
python3 scripts/smoke-remote.py
python3 scripts/smoke-documents.py
python3 scripts/smoke-document-ai.py
python3 scripts/smoke-search.py- Test counts, coverage scopes, RPC totals, and real-screen notes are tracked in docs/PARITY.md and design-qa.md. Helper tests marked
ignoredare invoked by cross-process tests and are not counted as standalone feature passes. - Document tool tests (
scripts/test-document-persistence.mjs,scripts/test-document-tools.mjs) require pinned JSDOM dev dependencies pointed to byEDITOR_TEST_NODE_MODULES; see docs/DOCUMENTS.md for temporary install/run/cleanup commands without keepingnode_modulesin the repository. - Smoke scripts run against temporary data directories and loopback Responses mocks without calling external paid models or live user accounts.