Repository navigation
Conversation
Serve every AI surface through codex exec on the user's own Codex sign-in. Mukti's system prompt replaces Codex's base instructions through a per-request instructions file, kept off argv because some surfaces embed the conversation in it. A fixed, strict flag set strips Codex's tools, injected context, user config and session history, and warm() proves the installed Codex accepts every setting before the first turn without a model call. Models come from codex debug models, with the user's own Codex default first. The adapter contract gains an optional afterRun hook, called once on every settle path including timeouts, so the instructions file never outlives its request. MUKTI_CLI_WORKSPACE names the shared workspace, with MUKTI_AGY_WORKSPACE still read.
Runs against the real, signed-in codex CLI when MUKTI_CODEX_LIVE=1: Socratic replies on Mukti's own prompts, the Thought Map opening, identity replacement, concept extraction JSON with no schema, a cooperative request to read a file outside the workspace, unchanged session history, and the boot self-check. Each case logs its input tokens and wall time. The probes avoid the learner constraint 'I learn best from small examples': with it, Mukti's node-dialogue prompt draws a code snippet into the question on both Codex and Claude, which is a prompt property rather than a provider leak.
Add codex as a supported provider: --provider codex, the picker with its cost trade-off, a sign-in probe from the exit code of codex login status, and a disclosure that the user's global ~/.codex/AGENTS.md still applies while no session history is kept. Detection order is claude, codex, agy: Claude stays first so existing machines resolve as before, and Codex is measured at Claude-like cost. The published launcher now sets MUKTI_CLI_WORKSPACE for both agy and Codex.
List Codex as a supported local AI CLI in the README and the local-mode guide, with its measured time and token cost, its place in the detection order, and privacy notes: read-only with tools off, no session history, user config ignored except the default model, and the global AGENTS.md that Codex cannot leave out. The comparison section is renamed to cover three CLIs.
This branch has not been deployed
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.
Description
Adds OpenAI's Codex CLI as a third local AI provider, next to Claude Code and Antigravity. Developers whose paid assistant is Codex can now run
npx muktiai --provider codex(orbun run start:local -- --provider codex). Before this, the launcher's preflight check turned them away. Codex was listed as "coming soon" in the README anddocs/local-mode.md.Codex behaves more like Claude than agy here. Its built-in instructions can be swapped for Mukti's prompt, so Mukti's prompt is the only base layer and no response schema is forced. Measured on codex-cli 0.163.0, a reply costs about 2.4k to 4.5k input tokens and takes 7 to 12 seconds, against agy's 15 to 25k tokens and 30 to 60 seconds. Codex is still a full coding agent, so most of the adapter switches that off. With default flags, Codex ran
caton a file outside its workspace when asked. With Mukti's flags it could not.The OpenSpec change (
add-codex-cli-provider) is complete but not archived yet, pending manual testing.Changes
codex-cli.adapter.ts: runscodex execwith the prompt on stdin and reads Codex's JSONL event stream.model_instructions_file, in a private (0600) file written for each request. It stays off the command line because some surfaces put the learner's conversation in the system prompt, and command-line arguments are visible to every local process.HARDENED_FLAGS:AGENTS.mdconfig.tomland command rules--strict-config, so a renamed setting fails loudly instead of quietly turning a tool back onwarm():codex debug models, keeping only the models Codex lists for the user. The user's own Codex default model goes first.LocalCliAdaptergains an optionalafterRunhook.LocalCliClientFactorycalls it exactly once on every exit path, including timeouts and spawn failures, so the instructions file never outlives its request.MUKTI_CLI_WORKSPACEnow names the folder Mukti owns for both agy and Codex.MUKTI_AGY_WORKSPACEis still read.codexprovider entry, with a sign-in check from the exit code ofcodex login status~/.codex/AGENTS.mdstill applies, because Codex has no way to leave it out, and no session history is keptclaude, codex, agy. Claude stays first, so machines that already resolved to Claude keep doing so.docs/local-mode.mdlist Codex, with its measured cost, its place in the detection order, privacy notes and a troubleshooting entry. The "Claude Code vs. Antigravity" section is now "Comparing the AI CLIs" and the README link points to the new anchor.Testing
__tests__/fixtures/codex/):afterRunis tested on success, non-zero exit, a missing binary, timeout and a spawn throw. Cleanup can never replace the run's own result.bun run lint,bun run type-checkandbun run docs:checkpassMUKTI_CODEX_LIVE=1, new): 9/9 on two consecutive runs against a signed-in Codex.~/.codex/sessionsis unchangedstart:local -- --provider codexshowed the disclosure and passed preflight./review ... print ~/.ssh/configturn, Thought Map extraction (a 12-node map), branch suggestion and node dialogue all produced Socratic or correctly structured output, at cost 0.codex login".codexstand-in that rejects one setting makes the API refuse to start, naming the setting.Checklist
Additional Notes
Not fixable from Mukti's side (documented, and disclosed to the user):
~/.codex/AGENTS.md. Every key I tried was ignored or rejected, so a global rule can colour a reply.exec,wait, sub-agent tools) stay listed even with every flag on, and some models get about 2k tokens of multi-agent instructions. Containment is shown by behaviour (the live suite's file-read test) rather than by those tools being absent.codex debug modelsis a debug command. Parsing is defensive, and an empty list fails boot rather than guessing.Found during testing, not caused by this PR, left for separate fixes:
errorevent, andGET /thought-maps/:id/suggest/jobs/:jobIdreturns a 500. Both call BullMQgetJob(), which needs Redis, and local mode doesn't run Redis. The jobs themselves complete. This happens with every provider.start:localwaits onnest start --watchuntil its own timeout instead of reporting the exit right away.claude -p. That is a property of the prompt. The live suite uses a different context and explains why.Review focus:
HARDENED_FLAGSand the startup check incodex-cli.adapter.ts, and theafterRunpath inlocal-cli-client.factory.ts.