针对于红队攻击思维做出的red team模式(破限项目,封号概不负责)##可自行适配其他Agent。项目问题请提issue
Python
1,118
219 commits
updated Oct 9, 2026
Current version: v2.1.0
Normal mode remains the default. The durable red-team operation runtime starts only after explicit activation, while the system-layer base instructions and active model profile remain loaded in every mode.
An opt-in, durable red-team runtime for Codex App and Codex CLI. It compiles each objective into a criteria-bearing GoalContract, executes typed WorkflowSpec graphs through live MCP tools, preserves verified evidence, and reaches successful terminal state only after TerminalJudge proves every criterion.
Before using this project, you should read the README file completely to prevent any issues during use. If you're a beginner, please read the GUIDE file completely to avoid any unnecessary trouble while using it.
The installer composes the user's prior instructions, instruction.ctf.md, and the matching Jailbreak.gpt-5.x.md through the system-layer model_instructions_file. Codex App tasks select the current profile from Hook model metadata; the CLI wrapper builds a single-profile system file before process startup and pins the model family.
If you have questions about the content in the README, you should submit an ISSUE, including the corresponding content from the README to seek help, or ask in the QQ group in the same way.
Do:
[Paste the text from the README], I have a question here, how/why/what should I do
Don't:
Why is it different when I open it compared to the video?
If you have suggestions or ideas for maintaining the project, you can submit an ISSUE, submit a Pull Request, or suggest in the QQ group.
Do:
I have a suggestion regarding xxx [image], here we can modify/add/delete xxx
Don't:
Can we add a plugin/feature for cracking keys?
805865662
The runtime treats task targets as operation assets whose scope was resolved outside the model, or as local sandbox fixtures. It does not repeat scope-document requests. Irreversible file replacement and external publication still retain explicit engineering confirmation to prevent accidental side effects.
Codex can use many security tools, but long-running workflows are vulnerable to session interruption, tool variance, manual result relay, and false completion based on a tool success flag. This project unifies objectives, actions, evidence, recovery, and terminal judgment in one durable execution path:
GoalContract
-> WorkflowSpec
-> Durable Scheduler
-> ToolBroker
-> SemanticVerifier
-> EvidenceGraph
-> TerminalJudge
Version 2.1.0 uses the unified generic-adaptive runtime without the former phase -> router -> pack -> leaf runtime, regex domain routers, Markdown exit gates, or a second Automation state machine. Domain names act only as asset and technique metadata rather than control-plane branches.
normal is always the default, and red-team operations start only after a mode command.generic-adaptive workflow handles every domain; scenes, assets, and techniques remain metadata and dynamic hypotheses instead of duplicated control planes.TerminalJudge.From the repository root, install dependencies and deploy to the current user Codex Home:
python -m pip install -r requirements.txt
python scripts/install.py
The installer detects the model from the environment, target config, or existing manifest; --model is normally unnecessary.
Project-local installation:
python scripts/install.py --project-home PATH
Custom Skill and durable operation roots:
python scripts/install.py --project-home PATH --agents-home AGENTS_PATH --enable-custom-skill-dirs --log-root OPERATION_PATH
| Option | Description |
|---|---|
--codex-home PATH | Install into a specific Codex Home/profile; its AGENTS.md provides global guidance |
--project-home PATH | Install under PATH/.codex and PATH/.agents, and manage the project-root AGENTS.md; mutually exclusive with --codex-home |
--agents-home PATH | Select the Skill destination; custom roots should also use --enable-custom-skill-dirs |
--enable-custom-skill-dirs | Prefer the manifest-recorded custom Skill directory at runtime |
--log-root PATH | Select the durable root for SQLite state, events, and evidence artifacts |
--model MODEL | Optional: override automatic detection and explicitly select the installation-time system profile |
--enable-rewrite-proxy | Enable the shared App/CLI loopback Rewrite Proxy and preserve the previous model_provider for uninstall rollback |
--dry-run | Preview installation, upgrade, or uninstall actions without writing files |
--uninstall | Remove manifest-managed files, Hooks, config values, and AGENTS.md blocks |
# Preview a project-local installation
python scripts/install.py --project-home PATH --dry-run
# Uninstall a user-level deployment
python scripts/install.py --uninstall
# Uninstall a project-local deployment
python scripts/install.py --project-home PATH --uninstall
The default operation root is:
$CODEX_HOME/redteam-mode/operations/
├── runtime.sqlite3
└── artifacts/<run-id>/*.json
Hook session state is stored under $CODEX_HOME/redteam-mode/state/sessions. Use --log-root OPERATION_PATH to relocate operation data. Status responses inline no more than 64 KiB of evidence; larger verified payloads are fetched with redteam_evidence, and each evidence payload is capped at 4 MiB.
Upgrade and uninstall preserve runtime session, memory, and operation data for recovery, auditing, or manual cleanup.
config.toml, Hooks, the system-layer model profile catalog, Runtime MCP server, workflows, and the single boundary Skill.rewrite_proxy.py and cross-platform launchers; model_provider changes only when Proxy mode is explicitly enabled.AGENTS.md content.redteam on, redteam light, or redteam full as a standalone prompt.GoalContract, with independent operations for single or multiple targets.redteam_run starts or resumes execution and uses ToolBroker to invoke available MCP tools.next_action_spec, gate, exit condition, and output contract, then automatically submit their observation to the Runtime.TerminalJudge emits the final result after proving every target criterion, evidence lineage, and cleanup state.redteam off or disable red team mode to return to normal mode.Default context mode leaves the Provider unchanged. Only after explicit red-team activation, the Hook resolves the requested action before the technical object, keeps ordinary development out of the red-team dispatcher, inherits short follow-up context, and emits Clause hashes, taxonomy, risk level, evidence requirements, and a reproducible validation plan. It does not force remediation output unless the user requested it.
Enable real pre-request rewriting with:
python scripts/install.py --enable-rewrite-proxy
The request path is:
Codex App/CLI
-> 127.0.0.1 Rewrite Proxy
-> Rewrite Provider (rewrite rules + current raw Prompt only)
-> four locally injected research-history messages (only when Hook red-team context is present)
-> original Codex Provider (original request envelope with the rewritten user Prompt, system instructions, and tool schemas)
provider = "inherit" and model = "inherit" reuse the original Provider and current Codex model. For a separate relay, add a model_providers entry and set [redteam.prompt_rewrite] provider, model, and api_key_env. Normal-mode requests pass through unchanged. If the relay drops a URL, IP, CVE, path, CLI flag, Clause, high-risk marker, context bundle, or semantic-fidelity flag, the Proxy uses the deterministic local rewrite. Uninstall restores the previous model_provider.
The optional CLI wrapper pins one model-family profile for the current process:
codex-redteam --model gpt-5.6-sol
Changing model families requires a new App task or wrapper process so that model_instructions_file is reloaded.
| Mode | Default | Typical Use |
|---|---|---|
normal | Yes | Ordinary coding, documentation, and research; no red-team operation or operation doctrine is started |
redteam-light | No | Explicit durable Goal/Workflow execution through /redteam on or /redteam light |
redteam-full | No | Explicit full-mode marker; in v2.1.0 it shares the same Runtime, evidence rules, and TerminalJudge gates as light mode |
# Install test dependencies
python -m pip install -r requirements-dev.txt
# Run the complete test suite
python -m pytest -q
# Validate an installation rooted at the current directory
python scripts/validate.py --codex-home .
Installer and test coverage includes:
generic-adaptive workflow.GitHub Actions runs the full suite on Windows, Ubuntu, and macOS with Python 3.11.
automation.tool_capabilities entries.redteam-light and redteam-full share the same engine and terminal rules in v2.1.0; the mode label does not select a separate workflow policy.context mode remains red-team gated and starts no resident service.redteam_evidence.The earlier routing/Skill design and current runtime research drew from:
See CONTRIBUTING.md for the contribution workflow, coding conventions, and submission requirements.
针对于红队攻击思维做出的red team模式(破限项目,封号概不负责)##可自行适配其他Agent。项目问题请提issue
Python
1,118
219 commits
updated Oct 9, 2026
Current version: v2.1.0
Normal mode remains the default. The durable red-team operation runtime starts only after explicit activation, while the system-layer base instructions and active model profile remain loaded in every mode.
An opt-in, durable red-team runtime for Codex App and Codex CLI. It compiles each objective into a criteria-bearing GoalContract, executes typed WorkflowSpec graphs through live MCP tools, preserves verified evidence, and reaches successful terminal state only after TerminalJudge proves every criterion.
Before using this project, you should read the README file completely to prevent any issues during use. If you're a beginner, please read the GUIDE file completely to avoid any unnecessary trouble while using it.
The installer composes the user's prior instructions, instruction.ctf.md, and the matching Jailbreak.gpt-5.x.md through the system-layer model_instructions_file. Codex App tasks select the current profile from Hook model metadata; the CLI wrapper builds a single-profile system file before process startup and pins the model family.
If you have questions about the content in the README, you should submit an ISSUE, including the corresponding content from the README to seek help, or ask in the QQ group in the same way.
Do:
[Paste the text from the README], I have a question here, how/why/what should I do
Don't:
Why is it different when I open it compared to the video?
If you have suggestions or ideas for maintaining the project, you can submit an ISSUE, submit a Pull Request, or suggest in the QQ group.
Do:
I have a suggestion regarding xxx [image], here we can modify/add/delete xxx
Don't:
Can we add a plugin/feature for cracking keys?
805865662
The runtime treats task targets as operation assets whose scope was resolved outside the model, or as local sandbox fixtures. It does not repeat scope-document requests. Irreversible file replacement and external publication still retain explicit engineering confirmation to prevent accidental side effects.
Codex can use many security tools, but long-running workflows are vulnerable to session interruption, tool variance, manual result relay, and false completion based on a tool success flag. This project unifies objectives, actions, evidence, recovery, and terminal judgment in one durable execution path:
GoalContract
-> WorkflowSpec
-> Durable Scheduler
-> ToolBroker
-> SemanticVerifier
-> EvidenceGraph
-> TerminalJudge
Version 2.1.0 uses the unified generic-adaptive runtime without the former phase -> router -> pack -> leaf runtime, regex domain routers, Markdown exit gates, or a second Automation state machine. Domain names act only as asset and technique metadata rather than control-plane branches.
normal is always the default, and red-team operations start only after a mode command.generic-adaptive workflow handles every domain; scenes, assets, and techniques remain metadata and dynamic hypotheses instead of duplicated control planes.TerminalJudge.From the repository root, install dependencies and deploy to the current user Codex Home:
python -m pip install -r requirements.txt
python scripts/install.py
The installer detects the model from the environment, target config, or existing manifest; --model is normally unnecessary.
Project-local installation:
python scripts/install.py --project-home PATH
Custom Skill and durable operation roots:
python scripts/install.py --project-home PATH --agents-home AGENTS_PATH --enable-custom-skill-dirs --log-root OPERATION_PATH
| Option | Description |
|---|---|
--codex-home PATH | Install into a specific Codex Home/profile; its AGENTS.md provides global guidance |
--project-home PATH | Install under PATH/.codex and PATH/.agents, and manage the project-root AGENTS.md; mutually exclusive with --codex-home |
--agents-home PATH | Select the Skill destination; custom roots should also use --enable-custom-skill-dirs |
--enable-custom-skill-dirs | Prefer the manifest-recorded custom Skill directory at runtime |
--log-root PATH | Select the durable root for SQLite state, events, and evidence artifacts |
--model MODEL | Optional: override automatic detection and explicitly select the installation-time system profile |
--enable-rewrite-proxy | Enable the shared App/CLI loopback Rewrite Proxy and preserve the previous model_provider for uninstall rollback |
--dry-run | Preview installation, upgrade, or uninstall actions without writing files |
--uninstall | Remove manifest-managed files, Hooks, config values, and AGENTS.md blocks |
# Preview a project-local installation
python scripts/install.py --project-home PATH --dry-run
# Uninstall a user-level deployment
python scripts/install.py --uninstall
# Uninstall a project-local deployment
python scripts/install.py --project-home PATH --uninstall
The default operation root is:
$CODEX_HOME/redteam-mode/operations/
├── runtime.sqlite3
└── artifacts/<run-id>/*.json
Hook session state is stored under $CODEX_HOME/redteam-mode/state/sessions. Use --log-root OPERATION_PATH to relocate operation data. Status responses inline no more than 64 KiB of evidence; larger verified payloads are fetched with redteam_evidence, and each evidence payload is capped at 4 MiB.
Upgrade and uninstall preserve runtime session, memory, and operation data for recovery, auditing, or manual cleanup.
config.toml, Hooks, the system-layer model profile catalog, Runtime MCP server, workflows, and the single boundary Skill.rewrite_proxy.py and cross-platform launchers; model_provider changes only when Proxy mode is explicitly enabled.AGENTS.md content.redteam on, redteam light, or redteam full as a standalone prompt.GoalContract, with independent operations for single or multiple targets.redteam_run starts or resumes execution and uses ToolBroker to invoke available MCP tools.next_action_spec, gate, exit condition, and output contract, then automatically submit their observation to the Runtime.TerminalJudge emits the final result after proving every target criterion, evidence lineage, and cleanup state.redteam off or disable red team mode to return to normal mode.Default context mode leaves the Provider unchanged. Only after explicit red-team activation, the Hook resolves the requested action before the technical object, keeps ordinary development out of the red-team dispatcher, inherits short follow-up context, and emits Clause hashes, taxonomy, risk level, evidence requirements, and a reproducible validation plan. It does not force remediation output unless the user requested it.
Enable real pre-request rewriting with:
python scripts/install.py --enable-rewrite-proxy
The request path is:
Codex App/CLI
-> 127.0.0.1 Rewrite Proxy
-> Rewrite Provider (rewrite rules + current raw Prompt only)
-> four locally injected research-history messages (only when Hook red-team context is present)
-> original Codex Provider (original request envelope with the rewritten user Prompt, system instructions, and tool schemas)
provider = "inherit" and model = "inherit" reuse the original Provider and current Codex model. For a separate relay, add a model_providers entry and set [redteam.prompt_rewrite] provider, model, and api_key_env. Normal-mode requests pass through unchanged. If the relay drops a URL, IP, CVE, path, CLI flag, Clause, high-risk marker, context bundle, or semantic-fidelity flag, the Proxy uses the deterministic local rewrite. Uninstall restores the previous model_provider.
The optional CLI wrapper pins one model-family profile for the current process:
codex-redteam --model gpt-5.6-sol
Changing model families requires a new App task or wrapper process so that model_instructions_file is reloaded.
| Mode | Default | Typical Use |
|---|---|---|
normal | Yes | Ordinary coding, documentation, and research; no red-team operation or operation doctrine is started |
redteam-light | No | Explicit durable Goal/Workflow execution through /redteam on or /redteam light |
redteam-full | No | Explicit full-mode marker; in v2.1.0 it shares the same Runtime, evidence rules, and TerminalJudge gates as light mode |
# Install test dependencies
python -m pip install -r requirements-dev.txt
# Run the complete test suite
python -m pytest -q
# Validate an installation rooted at the current directory
python scripts/validate.py --codex-home .
Installer and test coverage includes:
generic-adaptive workflow.GitHub Actions runs the full suite on Windows, Ubuntu, and macOS with Python 3.11.
automation.tool_capabilities entries.redteam-light and redteam-full share the same engine and terminal rules in v2.1.0; the mode label does not select a separate workflow policy.context mode remains red-team gated and starts no resident service.redteam_evidence.The earlier routing/Skill design and current runtime research drew from:
See CONTRIBUTING.md for the contribution workflow, coding conventions, and submission requirements.