{"slug": "show-hn-zsh-codex-assistant-codex-session-attached-to-your-shell", "title": "Show HN: Zsh-codex-assistant: codex session attached to your shell", "summary": "Developer klntsky released zsh-codex-assistant, a zsh plugin that attaches a persistent Codex CLI session to a shell and is invoked by prefixing a prompt with '@', preserving shell context and command history between invocations. The plugin requires Zsh and an installed, signed-in Codex CLI, and can be loaded via a source line in ~/.zshrc or through zplug; it supports ZSH_CODEX_ASSISTANT_MODEL, ZSH_CODEX_ASSISTANT_PROFILE, and ZSH_CODEX_ASSISTANT_INITIAL_PROMPT environment settings. The author said existing tools were unsatisfactory because they lacked a persistent harness process, carried feature bloat for a root shell, and did not focus on Codex support.", "body_md": "An on-demand codex session attached to your zsh shell. You can bring it forward any time, shell context is preserved.\n\nUse `@ your prompt` to hop into Codex anytime.\n\n``` bash\n$ # run your commands normally in the shell\n$ cd ./zsh-codex-assistant\n$ # prefix your prompts with '@'. first invocation starts a background codex session for this shell\n$ @ explain this project\n<codex CLI opens, responds to your request and exits>\n$ # your shell returns to normal.\n$ ls\nsession-notify.zsh zsh-codex-assistant.plugin.zsh ...\n$ @ what was my last request?\n$ <codex session resumes, your shell command history since the last invocation is put into the context>\n```\n\nI decided to build this because none of the existing tools were quite satisfactory:\n\n- I need a persistent harness process, not just an agent in oneshot mode - to preserve shell context and skip the warmup delay\n- I do not want to trust a pile of overcomplicated slop for my root shell (there are plenty of other projects for AI in the shell that suffer from feature bloat)\n- I only need codex support\n\nIf you need LLM command generation in-place, check out [zsh-ai](https://github.com/matheusml/zsh-ai) - it's decent.\n\nRequires Zsh and an installed, signed-in Codex CLI. Make sure `codex` works first.\n\nClone this repository, then add this line to your `~/.zshrc`, using the path where you cloned it:\n\n```\nsource /path/to/zsh-codex-assistant/zsh-codex-assistant.plugin.zsh\n```\n\nOpen a new terminal to load the plugin.\n\nLoad it after plugins that customize the Enter key if you have any.\n\nAdd this alongside your other zplug declarations in `~/.zshrc`, after any\nplugins that customize the Enter key and before `zplug load`:\n\n```\nzplug \"klntsky/zsh-codex-assistant\", use:\"zsh-codex-assistant.plugin.zsh\"\n```\n\nOpen a new terminal, run `zplug install`, then open another new terminal to\nload the plugin. Your `~/.zshrc` should already call `zplug load` after the\ndeclarations.\n\nIf you already cloned this repository and want zplug to use that checkout, register its path instead:\n\n```\nzplug \"/path/to/zsh-codex-assistant\", from:local, use:\"zsh-codex-assistant.plugin.zsh\"\n```\n\nLocal checkouts do not need `zplug install`. Put the declaration before your\nexisting `zplug load` line, then open a new terminal.\n\nAdd any of these settings to `~/.zshrc`:\n\n```\nexport ZSH_CODEX_ASSISTANT_MODEL=\"your-model\"\nexport ZSH_CODEX_ASSISTANT_PROFILE=\"your-profile\"\nexport ZSH_CODEX_ASSISTANT_INITIAL_PROMPT=\"Act as a shell assistant\"\n```\n\n", "url": "https://wpnews.pro/news/show-hn-zsh-codex-assistant-codex-session-attached-to-your-shell", "canonical_source": "https://github.com/klntsky/zsh-codex-assistant", "published_at": "2026-10-01 19:23:21+00:00", "updated_at": "2026-10-01 21:33:27.604291+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-products"], "entities": ["zsh-codex-assistant", "klntsky", "Codex CLI", "zsh", "zplug", "zsh-ai"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-zsh-codex-assistant-codex-session-attached-to-your-shell", "markdown": "https://wpnews.pro/news/show-hn-zsh-codex-assistant-codex-session-attached-to-your-shell.md", "text": "https://wpnews.pro/news/show-hn-zsh-codex-assistant-codex-session-attached-to-your-shell.txt", "jsonld": "https://wpnews.pro/news/show-hn-zsh-codex-assistant-codex-session-attached-to-your-shell.jsonld"}}