codex-keysmith README

The project's README from github.com/Jia-Ethan/codex-keysmith. As one markdown file: README.md.

Illustrative codex-keysmith dry-run terminal preview; actual paths and output vary

Illustrative preview / 示意预览;实际路径与输出以本机 dry-run 为准。

codex-keysmith

先预览、再写入、可撤销的 Codex 全局指令部署工具。

简体中文 · English · Reference · 智能体安装 · Security · License

Blocking CI tests Source version v0.5.1 Python 3.10 to 3.14 recommended License MIT

简体中文

Keysmith 系列为本地 AI 工具安全部署、验证和撤销自定义指令。codex-keysmith 把一份 Markdown 部署到 Codex 配置目录(通常是 ~/.codex),让之后的新会话加载它。

[!WARNING] 这会改变该 Codex 配置下的全局行为,不是项目级开关:写入 config.toml 的 model_instructions_file,并默认把整份 hooks.json 隔离为 hooks.json.disabled。部署、卸载和中断恢复先预览,确认后加 --yes;--restore-hooks 会立即执行且不接受 --yes。先阅读 examples/gpt-unrestricted.md 和 SECURITY.md。

选择哪个 Keysmith

项目 目标工具 部署面 稳妥安装 Desktop
codex-keysmith Codex 全局 ~/.codex 指令 稳定 CLI Release 未签名 Beta
claude-keysmith Claude Code 项目 / 用户 CLAUDE.md import 源码 CLI 未签名 Beta
grok-keysmith Grok Build 全局 ~/.grok/rules(不改 AGENTS.md) 稳定 CLI Release 未签名 Beta
zcode-keysmith ZCode App 用户目录 system-role + wrapper 仅源码 无

安装方式

  1. 稳妥:稳定 CLI。 打开 最新稳定 Release,下载单文件 codex-instruct-v*.py 与 SHA256SUMS,校验后再运行;当前稳定资产名为 codex-instruct-v0.5.1.py。不要 curl | python。
  2. 更易用:未签名 Desktop Beta。 见 Desktop 预发布:macOS Apple Silicon DMG 与 Windows x64 NSIS,内嵌 CLI sidecar、双 preset、四个 fixture 包与“恢复配置引用”入口。无签名、无自动更新、无 Linux GUI。安装步骤见 CODE_SIGNING_POLICY.md。
  3. 源码。 clone 后直接 python3 codex-instruct.py。此源码树与最新稳定 Release 同为 0.5.0,以 Releases 页为准。

快速开始

# 把 vX.Y.Z 换成 Releases 页的最新稳定 tag
base='https://github.com/Jia-Ethan/codex-keysmith/releases/download/vX.Y.Z'
curl --fail --location --remote-name "$base/codex-instruct-vX.Y.Z.py"
curl --fail --location --remote-name "$base/SHA256SUMS"
awk '$2 == "codex-instruct-vX.Y.Z.py"' SHA256SUMS | shasum -a 256 -c -

python3 codex-instruct-vX.Y.Z.py --version
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --status --lang zh-CN
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --dry-run --lang zh-CN
# 确认目标目录、提示词来源和写入计划后:
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --yes --lang zh-CN

源码路径:git clone https://github.com/Jia-Ethan/codex-keysmith.git && cd codex-keysmith,再把上述脚本名换成 codex-instruct.py。部署后关闭旧任务、开一个新 Codex 会话。省略 --codex-dir 会处理全部自动发现的配置目录。Windows 命令把 python3 换成 python。

如何撤销

以下以 Release 单文件为例;源码 checkout 请把文件名换成 codex-instruct.py。

python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --restore-hooks --lang zh-CN
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --uninstall --lang zh-CN
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --uninstall --yes --lang zh-CN

卸载每次只撤销最新一层。--reactivate 从 v0.3.9 开始提供:

python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --reactivate --lang zh-CN
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --reactivate --yes --lang zh-CN

若 --status 显示 inactive-by-config,--reactivate 只补回缺失的顶层 model_instructions_file,不要手工改 config.toml,也不要为补字段再走一遍完整部署。它会回滚可捕获的批量失败,但不创建 durable journal;硬中断后先运行 --status,无冲突时重跑 --reactivate --yes 完成其余目录。--recover 只处理 deploy/uninstall 中断事务。不要手工删除 journal、备份或 manifest。

平台与 Beta 限制

两条通道

指令通道把 Markdown 部署到 ~/.codex(默认 --preset unrestricted)。环境通道 --scaffold 把残缺 fixture 工作区写到 ~/.codex-fixture-workspace/<pack>,不修改 ~/.codex。两通道可叠用,互不写对方目录。默认安装步骤不变;scaffold 不是必做步骤。

python3 codex-instruct.py --scaffold-list
python3 codex-instruct.py --scaffold pytest_complete --dry-run
python3 codex-instruct.py --scaffold pytest_complete --yes

独立单文件脚本旁边没有 fixture_packs/ 时,--scaffold 会提示下载 Release bundle 或指定 --pack-dir。

进阶文档

贡献、安全与系列

提交前阅读 CONTRIBUTING.md。漏洞走 SECURITY.md 的 GitHub 私密渠道。官方反馈:GitHub Discussions;社区交流:LINUX DO。

codex-keysmith (Jia-Ethan/codex-keysmith)

configuration-management
Searching Database…

What is this?A CLI tool that deploys a versioned Markdown instruction file into Codex's global config directory (usually ~/.codex), always previewing first and letting you undo the deployment later.
Is this a GUI app or a command-line tool?It's primarily a single-file Python CLI script; there is also an unsigned Desktop beta app (macOS Apple Silicon DMG, Windows x64 NSIS) that wraps the same CLI as a sidecar.
How do I install and run it?Download the verified single-file script (currently codex-instruct-v0.5.1.py) plus SHA256SUMS from the latest stable Release, check the hash, then run it with python3; alternatively clone the repo and run python3 codex-instruct.py directly.
Do I need pip or any package manager to use it?No, it's a dependency-free single-file script; you just need Python 3.10-3.14, there's no pip install and no auto-update mechanism.
Is the Windows build safe to use right now?Windows is marked as EXPLICITBETA for fresh deployments and the old v0.1.0 release should not be used; the Desktop beta app is unsigned and unnotarized, so it can trigger Gatekeeper or SmartScreen warnings.
Which platforms are actually fully supported?The CLI's main supported platforms are macOS and Linux, with Windows in beta; the separate Desktop beta app is only built for macOS Apple Silicon and Windows x64, and there's no Linux GUI.
Does it collect or upload any of my data?No, normal CLI and Desktop operation doesn't actively collect or upload user data.
What's the difference between the instruction channel and the scaffold channel?The instruction channel deploys a Markdown file into ~/.codex with default preset unrestricted; the separate --scaffold environment channel writes a fixture workspace to ~/.codex-fixture-workspace/ without touching ~/.codex. Both can be used together since they never write to each other's directories.
How do I undo a deployment if something breaks?Uninstall rolls back one layer at a time; --reactivate (since v0.3.9) restores just the top-level modelinstructionsfile reference without a full redeploy, and --recover handles interrupted deploy/uninstall transactions without manually touching the journal or manifest.
How does this relate to claude-keysmith or grok-keysmith?It's part of a 'Keysmith' family of tools that safely deploy and remove custom instructions for different AI assistants: codex-keysmith targets Codex's global ~/.codex instructions, while sibling projects target Claude Code, Grok Build, and ZCode App respectively.
Does it touch my hooks.json?Yes, by default it isolates Codex's hooks.json by renaming it to hooks.json.disabled; the --restore-hooks flag brings it back immediately and, unlike other operations, doesn't accept --yes.
Creator
Jia-Ethan
Size
24.3 MB
Stars
4.8K
Age
3mo
Commits · 90 Days