codex-plusplus-tweak-system
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecodex-plusplus Tweak System
codex-plusplus 调整系统
Skill by ara.so — Daily 2026 Skills collection.
codex-plusplusapp.asarstart/stopInstallation
安装
Homebrew (macOS, recommended)
Homebrew(macOS,推荐)
sh
brew install b-nnett/codex-plusplus/codexplusplus
codexplusplus installsh
brew install b-nnett/codex-plusplus/codexplusplus
codexplusplus installBun (global)
Bun(全局安装)
sh
bun install -g github:b-nnett/codex-plusplus
codexplusplus installsh
bun install -g github:b-nnett/codex-plusplus
codexplusplus installSource bootstrap (macOS / Linux)
源码引导安装(macOS / Linux)
sh
curl -fsSL https://raw.githubusercontent.com/b-nnett/codex-plusplus/main/install.sh | bashsh
curl -fsSL https://raw.githubusercontent.com/b-nnett/codex-plusplus/main/install.sh | bashWindows PowerShell
Windows PowerShell
powershell
irm https://raw.githubusercontent.com/b-nnett/codex-plusplus/main/install.ps1 | iexThe installer:
- Locates (or Windows equivalent)
Codex.app - Backs up the original to
~/.codex-plusplus/backup/ - Patches to require the loader
app.asar - Recomputes asar header SHA-256, writes it into
Info.plist - Flips in the Electron Framework binary
EnableEmbeddedAsarIntegrityValidation - Re-signs ad-hoc on macOS ()
codesign --force --deep --sign - - Installs a launch agent / login item for auto-repair on Codex updates
- Installs default tweaks unless is passed
--no-default-tweaks
powershell
irm https://raw.githubusercontent.com/b-nnett/codex-plusplus/main/install.ps1 | iex安装程序会执行以下操作:
- 定位(或Windows对应版本)
Codex.app - 将原始文件备份到
~/.codex-plusplus/backup/ - 修补以引入加载器
app.asar - 重新计算asar头的SHA-256,并写入
Info.plist - 在Electron Framework二进制文件中开启
EnableEmbeddedAsarIntegrityValidation - 在macOS上进行临时签名()
codesign --force --deep --sign - - 安装启动代理/登录项,以便在Codex更新时自动修复
- 安装默认调整项,除非传入参数
--no-default-tweaks
Key CLI Commands
核心CLI命令
sh
codexplusplus install # Patch Codex and install runtime
codexplusplus install --no-default-tweaks # Skip default tweak set
codexplusplus status # Show patch status and runtime version
codexplusplus doctor # Diagnose issues (integrity, signing, etc.)
codexplusplus repair # Re-apply patch (e.g. after Codex update)
codexplusplus repair --quiet # Silent repair (used by watcher/launch agent)
codexplusplus update # Pull latest codex-plusplus source, rebuild, repair
codexplusplus update-codex # Restore official-signed Codex for Sparkle updater
codexplusplus uninstall # Revert all patches, restore backup
codexplusplus tweaks list # List installed tweaks and enabled state
codexplusplus tweaks open # Open user tweaks directory in Finder/Explorersh
codexplusplus install # 修补Codex并安装运行时
codexplusplus install --no-default-tweaks # 跳过默认调整项集合
codexplusplus status # 显示补丁状态和运行时版本
codexplusplus doctor # 诊断问题(完整性、签名等)
codexplusplus repair # 重新应用补丁(例如Codex更新后)
codexplusplus repair --quiet # 静默修复(由监视器/启动代理使用)
codexplusplus update # 拉取最新codex-plusplus源码、重建并修复
codexplusplus update-codex # 恢复官方签名的Codex版本以适配Sparkle更新器
codexplusplus uninstall # 还原所有补丁,恢复备份
codexplusplus tweaks list # 列出已安装的调整项及其启用状态
codexplusplus tweaks open # 在Finder/资源管理器中打开用户调整项目录File Locations
文件位置
| Artifact | Path |
|---|---|
| Loader stub | |
| Runtime | |
| Tweaks | |
| Config | |
| Backup | |
<user-data-dir>- macOS:
~/Library/Application Support/codex-plusplus/ - Linux: (default
$XDG_DATA_HOME/codex-plusplus/)~/.local/share/codex-plusplus/ - Windows:
%APPDATA%/codex-plusplus/
| 产物 | 路径 |
|---|---|
| 加载器存根 | |
| 运行时 | |
| 调整项 | |
| 配置文件 | |
| 备份文件 | |
各系统的路径:
<user-data-dir>- macOS:
~/Library/Application Support/codex-plusplus/ - Linux: (默认
$XDG_DATA_HOME/codex-plusplus/)~/.local/share/codex-plusplus/ - Windows:
%APPDATA%/codex-plusplus/
Writing a Tweak
编写调整项
Folder Structure
文件夹结构
<user-data-dir>/tweaks/my-tweak/
├── manifest.json
└── index.ts # or .js / .mjs<user-data-dir>/tweaks/my-tweak/
├── manifest.json
└── index.ts # 或 .js / .mjsmanifest.json
manifest.json
json
{
"id": "com.yourname.my-tweak",
"name": "My Tweak",
"version": "0.1.0",
"githubRepo": "yourname/my-tweak",
"author": "yourname",
"description": "Short description of what this tweak does.",
"minRuntime": "0.1.0"
}Required fields: (reverse-domain), , , (for update checks), , , .
idnameversiongithubRepoauthordescriptionminRuntimejson
{
"id": "com.yourname.my-tweak",
"name": "My Tweak",
"version": "0.1.0",
"githubRepo": "yourname/my-tweak",
"author": "yourname",
"description": "Short description of what this tweak does.",
"minRuntime": "0.1.0"
}必填字段: (反向域名格式)、、、(用于更新检查)、、、。
idnameversiongithubRepoauthordescriptionminRuntimeindex.ts — Minimal Tweak
最简调整项(index.ts)
ts
import type { Tweak } from "@codex-plusplus/sdk";
export default {
start(api) {
api.log.info("My tweak started");
},
stop() {
// Cleanup: remove event listeners, DOM nodes, etc.
},
} satisfies Tweak;ts
import type { Tweak } from "@codex-plusplus/sdk";
export default {
start(api) {
api.log.info("My tweak started");
},
stop() {
// 清理操作:移除事件监听器、DOM节点等
},
} satisfies Tweak;index.ts — Settings Panel
设置面板(index.ts)
ts
import type { Tweak } from "@codex-plusplus/sdk";
export default {
start(api) {
api.settings.register({
id: "my-tweak",
title: "My Tweak",
render(root) {
root.innerHTML = `
<div style="padding: 16px;">
<h2>My Tweak Settings</h2>
<label>
<input type="checkbox" id="my-tweak-toggle" />
Enable feature
</label>
</div>
`;
const toggle = root.querySelector<HTMLInputElement>("#my-tweak-toggle")!;
toggle.checked = api.storage.get("enabled") ?? false;
toggle.addEventListener("change", () => {
api.storage.set("enabled", toggle.checked);
});
},
});
},
stop() {},
} satisfies Tweak;ts
import type { Tweak } from "@codex-plusplus/sdk";
export default {
start(api) {
api.settings.register({
id: "my-tweak",
title: "My Tweak",
render(root) {
root.innerHTML = `
<div style="padding: 16px;">
<h2>My Tweak Settings</h2>
<label>
<input type="checkbox" id="my-tweak-toggle" />
Enable feature
</label>
</div>
`;
const toggle = root.querySelector<HTMLInputElement>("#my-tweak-toggle")!;
toggle.checked = api.storage.get("enabled") ?? false;
toggle.addEventListener("change", () => {
api.storage.set("enabled", toggle.checked);
});
},
});
},
stop() {},
} satisfies Tweak;index.ts — DOM Injection with Cleanup
带清理的DOM注入(index.ts)
ts
import type { Tweak } from "@codex-plusplus/sdk";
let cleanup: (() => void) | null = null;
export default {
start(api) {
// Wait for DOM element to appear
const unobserve = api.dom.waitFor(".codex-toolbar", (toolbar) => {
const btn = document.createElement("button");
btn.textContent = "My Action";
btn.className = "codex-plusplus-btn";
btn.addEventListener("click", () => {
api.log.info("Button clicked");
});
toolbar.appendChild(btn);
cleanup = () => btn.remove();
});
api.onStop(() => {
unobserve();
cleanup?.();
});
},
stop() {},
} satisfies Tweak;ts
import type { Tweak } from "@codex-plusplus/sdk";
let cleanup: (() => void) | null = null;
export default {
start(api) {
// 等待DOM元素出现
const unobserve = api.dom.waitFor(".codex-toolbar", (toolbar) => {
const btn = document.createElement("button");
btn.textContent = "My Action";
btn.className = "codex-plusplus-btn";
btn.addEventListener("click", () => {
api.log.info("Button clicked");
});
toolbar.appendChild(btn);
cleanup = () => btn.remove();
});
api.onStop(() => {
unobserve();
cleanup?.();
});
},
stop() {},
} satisfies Tweak;index.ts — Keyboard Shortcut
键盘快捷键(index.ts)
ts
import type { Tweak } from "@codex-plusplus/sdk";
export default {
start(api) {
const handler = (e: KeyboardEvent) => {
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.key === "k") {
e.preventDefault();
api.log.info("Shortcut triggered: Cmd/Ctrl+Shift+K");
// your action here
}
};
document.addEventListener("keydown", handler);
api.onStop(() => document.removeEventListener("keydown", handler));
},
stop() {},
} satisfies Tweak;ts
import type { Tweak } from "@codex-plusplus/sdk";
export default {
start(api) {
const handler = (e: KeyboardEvent) => {
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.key === "k") {
e.preventDefault();
api.log.info("Shortcut triggered: Cmd/Ctrl+Shift+K");
// 此处添加你的操作
}
};
document.addEventListener("keydown", handler);
api.onStop(() => document.removeEventListener("keydown", handler));
},
stop() {},
} satisfies Tweak;Tweak API Reference (api
object in start
)
apistart调整项API参考(start
中的api
对象)
startapi| API | Description |
|---|---|
| Log to Codex++ console |
| Warning log |
| Error log |
| Add a panel under Settings → Tweaks |
| Read persisted value for this tweak |
| Persist value (JSON-serializable) |
| Watch for a DOM element; returns unobserve fn |
| Register a cleanup callback called on |
| API | 描述 |
|---|---|
| 输出日志到Codex++控制台 |
| 输出警告日志 |
| 输出错误日志 |
| 在「设置」→「调整项」下添加面板 |
| 读取当前调整项的持久化值 |
| 持久化存储值(需支持JSON序列化) |
| 监听指定DOM元素;返回取消监听函数 |
| 注册在 |
Config (config.json
)
config.json配置文件(config.json
)
config.jsonjson
{
"autoRepair": true,
"autoUpdateRuntime": true,
"tweaks": {
"com.yourname.my-tweak": {
"enabled": true
}
}
}- — watcher re-patches after Codex updates (default
autoRepair)true - — daily runtime refresh from CLI (default
autoUpdateRuntime); disable in Settings → Codex Plus Plus → Configtrue
json
{
"autoRepair": true,
"autoUpdateRuntime": true,
"tweaks": {
"com.yourname.my-tweak": {
"enabled": true
}
}
}- — 监视器会在Codex更新后重新修补(默认
autoRepair)true - — 每天从CLI刷新运行时(默认
autoUpdateRuntime);可在「设置」→「Codex Plus Plus」→「配置」中禁用true
Tweak Update Checks
调整项更新检查
Every tweak with set is checked against GitHub Releases once per day. Codex++ compares the latest release tag (semver) to the local version.
githubRepomanifest.json- No auto-update — users see "Update Available" in Settings → Tweaks with a link to the release.
- To publish a tweak update: create a GitHub Release with a semver tag (e.g. ) and attach the tweak folder as a zip.
v0.2.0
每个设置了的调整项每天会与GitHub Releases进行一次版本检查。Codex++会将最新的发布标签(语义化版本)与本地中的版本进行对比。
githubRepomanifest.json- 无自动更新 — 用户会在「设置」→「调整项」中看到「有可用更新」提示,并附带发布链接。
- 发布调整项更新:创建带有语义化版本标签(例如)的GitHub Release,并将调整项文件夹打包为zip附件。
v0.2.0
Default Tweaks
默认调整项
Installed on first run (skip with ):
--no-default-tweaks| ID | Repo |
|---|---|
| |
| |
首次运行时会安装(可通过跳过):
--no-default-tweaks| ID | 仓库 |
|---|---|
| |
| |
Updating Codex (macOS — Sparkle conflict)
更新Codex(macOS — Sparkle冲突)
Codex++ ad-hoc signs the app, breaking Sparkle's integrity check. Use:
sh
codexplusplus update-codexThis restores an official Developer ID–signed build for the updater. After Codex updates and restarts, the launch agent watcher re-applies Codex++ automatically.
Codex++的临时签名会破坏Sparkle的完整性校验。请使用:
sh
codexplusplus update-codex该命令会恢复官方开发者ID签名的版本以适配更新器。Codex更新并重启后,启动代理监视器会自动重新应用Codex++补丁。
Uninstall
卸载
sh
codexplusplus uninstallRestores the backed-up original , removes the launch agent, and removes . Tweaks you wrote remain on disk unless you delete them manually.
app.asar<user-data-dir>sh
codexplusplus uninstall还原备份的原始,移除启动代理,并删除。你编写的调整项会保留在磁盘上,除非手动删除。
app.asar<user-data-dir>Troubleshooting
故障排除
"App is damaged and can't be opened" (macOS)
"应用已损坏,无法打开"(macOS)
The ad-hoc signature isn't trusted on first launch. Run:
sh
xattr -cr /Applications/Codex.appThen open the app again.
首次启动时临时签名不被信任。执行以下命令:
sh
xattr -cr /Applications/Codex.app然后重新打开应用。
Patch not persisting after Codex update
Codex更新后补丁未保留
The launch agent should re-run automatically. Check status:
repairsh
codexplusplus status
codexplusplus doctorIf the launch agent isn't running, reinstall:
sh
codexplusplus uninstall && codexplusplus install启动代理应自动重新执行命令。检查状态:
repairsh
codexplusplus status
codexplusplus doctor如果启动代理未运行,请重新安装:
sh
codexplusplus uninstall && codexplusplus installTweak not loading
调整项未加载
- Check has all required fields (
manifest.json,id,name,version,githubRepo,author,description).minRuntime - Ensure /
index.jsexports a default object withindex.tsandstart.stop - Check logs: output appears in Codex DevTools console.
api.log.error - Run for runtime integrity checks.
codexplusplus doctor
- 检查包含所有必填字段(
manifest.json、id、name、version、githubRepo、author、description)。minRuntime - 确保/
index.js导出包含index.ts和start的默认对象。stop - 检查日志:的输出会显示在Codex开发者工具控制台中。
api.log.error - 执行进行运行时完整性检查。
codexplusplus doctor
Runtime version mismatch
运行时版本不匹配
sh
codexplusplus repair # refreshes runtime from CLIsh
codexplusplus repair # 从CLI刷新运行时Tweaks directory location
调整项目录位置
sh
codexplusplus tweaks open # opens in Finder/Explorersh
codexplusplus tweaks open # 在Finder/资源管理器中打开Security Model
安全模型
- Tweaks run in the renderer process with the same privileges as Codex's own renderer code.
- Codex++ does not auto-update tweak code — users must manually review and install updates.
- is only used for version checks via the GitHub Releases API, not for auto-downloading code.
githubRepo - See for the full policy and vulnerability reporting process.
SECURITY.md
- 调整项在渲染进程中运行,拥有与Codex自身渲染代码相同的权限。
- Codex++不会自动更新调整项代码——用户必须手动审核并安装更新。
- 仅用于通过GitHub Releases API进行版本检查,不会自动下载代码。
githubRepo - 完整的安全策略和漏洞上报流程请查看。
SECURITY.md
Community
社区
- Discord — channel for tweak authors
#tweak-dev - GitHub Issues — bug reports and feature requests
- Docs: and
docs/WRITING-TWEAKS.mddocs/ARCHITECTURE.md
- Discord — 频道供调整项开发者交流
#tweak-dev - GitHub Issues — 提交Bug报告和功能请求
- 文档:和
docs/WRITING-TWEAKS.mddocs/ARCHITECTURE.md