recipe-emergency-flatten

recipe-emergency-flatten is a skill for Claude Code, Codex from crypto-com/cdcx-cli. It costs 35 tokens per session (586 once invoked), scanned A, original, Apache-2.0.

An emergency trading procedure that cancels all open orders and closes every open position. It is intended to leave the trading account with no active orders or positions.

In plain words
What is it for?
Use it to cancel orders, close positions at market price, verify the account is flat, and remove advanced orders during an emergency.
Why use it?
It provides a rapid way to reduce market exposure during a sharp market move, suspected API-key theft, or unexpected agent behavior. The procedure is destructive and requires explicit user approval.

Skill for Claude CodeCodex

Part of the cdcx-cli plugin — 13 skills, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/crypto-com/cdcx-cli/recipe-emergency-flatten
Any agent
npx skills add crypto-com/cdcx-cli --skill recipe-emergency-flatten
Clone the repo
git clone --depth 1 https://github.com/crypto-com/cdcx-cli

Made for: Claude Code, Codex.

Or install cdcx-cli, the plugin that ships this one along with the rest of its 13 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for recipe-emergency-flatten

README.md
[![agentmods](https://agentmods.dev/badge/skills/crypto-com/cdcx-cli/recipe-emergency-flatten.svg)](https://agentmods.dev/skills/crypto-com/cdcx-cli/recipe-emergency-flatten)
Your own site
<a href="https://agentmods.dev/skills/crypto-com/cdcx-cli/recipe-emergency-flatten"><img src="https://agentmods.dev/badge/skills/crypto-com/cdcx-cli/recipe-emergency-flatten.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 586 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00035 $0.00586
Opus 5 $0.00017 $0.00293
Sonnet 5 $0.00007 $0.00117
Haiku 4.5 $0.00003 $0.00059

Measured 5d ago against content hash 1ad6d6e2eb0d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

recipe-emergency-flatten scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cdcx-cli/skills/recipe-emergency-flatten/SKILL.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Emergency Flatten

When to Use

  • Market is moving violently against current exposure
  • Suspect API key compromise — reduce blast radius
  • End-of-session sweep to go flat overnight
  • Agent has behaved unexpectedly and the human wants a hard stop

This is a destructive workflow. Only run when the user asks for it explicitly.

Assumptions

  • Authentication is configured (CDCX_API_KEY / CDCX_API_SECRET, or a profile)
  • MCP mode: server must be started with --allow-dangerous (this workflow uses tier-dangerous commands)
  • CLI mode: use --yes to skip prompts, or acknowledge each prompt

Workflow

# 1. Cancel every open order (dangerous)
cdcx trade cancel-all --yes -o json

# 2. Confirm no open orders remain
cdcx trade open-orders -o json

# 3. List every open position
cdcx account positions -o json

# 4. Close each position at market
#    Run this per row returned in step 3
cdcx trade close-position <INSTRUMENT_NAME> --type MARKET --yes -o json

# 5. Verify positions are flat
cdcx account positions -o json

# 6. Also sweep advanced (OTO/OTOCO) orders — they live in a separate namespace
cdcx advanced cancel-all --yes -o json
cdcx advanced open-orders -o json

# 7. Final wallet check
cdcx account summary -o json

Automated One-Liner

cdcx trade cancel-all --yes && \
cdcx advanced cancel-all --yes && \
cdcx account positions -o json | \
    jq -r '.data[].instrument_name' | \
    while read i; do cdcx trade close-position "$i" --type MARKET --yes; done && \
cdcx account positions -o json

Notes

  • cancel-all without an instrument cancels every open order across the account
  • close-position is asynchronous — it returns an ack, not a fill. The position may remain open for a moment; step 5 confirms
  • Advanced orders (OTO/OTOCO) are not cancelled by cdcx trade cancel-all — sweep them separately with cdcx advanced cancel-all
  • If you are in doubt about the current state, re-run cdcx account positions and cdcx trade open-orders until both are empty
  • If API access itself is the concern, also rotate the API key at https://crypto.com/exchange/settings/api afterwards

Read the full file on GitHub · 68 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 68 lines · 35 tokens per session scan A 1ad6d6e2eb0d

Subscribe to this mod's changes

recipe-emergency-flatten is a skill published in the GitHub repository crypto-com/cdcx-cli (25 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 35 tokens to every session and 586 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.