leave

A command for removing an agent from a Cortex agent team. Cortex is the team system described by the files and status records this command cleans up.

In plain words
What is it for?
Use it when an agent needs to leave Cortex by removing .cortex.md, cleaning CLAUDE.local.md, and cancelling related team activity.
Why use it?
It removes the local team configuration and marks the agent as inactive, avoiding leftover team files and scheduled activity.

Skill for Claude CodeCodex

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/agentweave/cortex/leave
Any agent
npx skills add agentweave/cortex --skill leave
Clone the repo
git clone --depth 1 https://github.com/agentweave/cortex

Made for: Claude Code, Codex.

Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 628 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.00030 $0.00628
Opus 5 $0.00015 $0.00314
Sonnet 5 $0.00006 $0.00126
Haiku 4.5 $0.00003 $0.00063

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

Security

Grade A, and why

leave 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 2d 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.

skills/leave/SKILL.md · 74 lines

How it starts

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

/leave — Leave the Cortex Agent Team

Remove this agent from Cortex by cleaning up local protocol files and updating the team directory.

Arguments

<agent-name> — the agent's name (e.g., "Billing Dev"). If not provided, ask: "What is this agent's name in Cortex?"

Steps

1. Resolve name and slug

Use the provided <agent-name>.

Derive the slug: lowercase, replace spaces with hyphens, strip any characters that are not alphanumeric or hyphens.

2. Check current state

Check if .cortex.md exists in the current working directory. Check if CLAUDE.local.md contains "## Cortex".

If neither exists, respond:

"This agent doesn't appear to be on the Cortex team. Nothing to clean up."

Stop.

3. Remove .cortex.md

If .cortex.md exists in the current working directory, delete it:

rm .cortex.md

4. Clean CLAUDE.local.md

If CLAUDE.local.md contains a ## Cortex section (the line ## Cortex through the next ## heading or end of file), remove that entire section using the Edit tool.

5. Cancel heartbeat and clean up hooks

5a. Use CronList to find any active cron whose prompt starts with Cortex (with trailing space). If found, cancel each with CronDelete. If no cron is found, skip — the agent may not have had a heartbeat running.

5b. If .claude/hooks/cortex-precheck.sh exists, delete it:

rm -f .claude/hooks/cortex-precheck.sh

5c. Read .claude/settings.json. If it contains a hook entry in the hooks.UserPromptSubmit array whose hooks array includes "command": ".claude/hooks/cortex-precheck.sh", remove that entry. Preserve all other hook entries. Write the updated JSON back.

6. Update agent note in team directory

Read ~/.cortex/config.yaml to get team_dir.

If config exists and <team_dir>/agents/<slug>/<slug>.md exists, read the agent note and check the current status field:

  • If status: active, replace with status: inactive using the Edit tool.
  • If status: inactive (already inactive), skip — no change needed.

Read the full file on GitHub · 74 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. 2d ago First seen · 74 lines · 30 tokens per session scan A 9db6894556a4

Subscribe to this mod's changes

leave is a skill published in the GitHub repository agentweave/cortex (12 stars, last pushed 4mo ago), licensed MIT. It adds 30 tokens to every session and 628 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.

Related

Other skills, from other repositories

markstream-react

Integrate the beta markstream-react package into a React 18+ or Next app. Use when Codex needs to add the React renderer, choose the root, next, or server entrypoint, import CSS correctly, choose between content and nodes, keep client boundaries safe, add renderer-local streamingComponents or htmlComponents, use…

Simon-He95/markstream-vue · 94 tokens

web-scraping

Fetches web pages and extracts structured data using mq's toolchain (mq-crawl for fetching/crawling/JS rendering, mq for HTML-to-Markdown selector-based extraction, http() for in-query requests). Use when the user wants to scrape a URL, pull structured data out of a webpage, crawl a site, or turn HTML into…

harehare/mq · 89 tokens

markstream-vue2-cli

Integrate markstream-vue2 into a Vue 2 Vue CLI or Webpack 4 app. Use when Codex needs Webpack 4-friendly setup, CDN worker fallbacks for Mermaid or KaTeX, dist/index.css imports, Vue 2 composition-api shims, or code block choices limited to stream-diffs or plain .

Simon-He95/markstream-vue · 83 tokens

markstream-svelte

Integrate the beta markstream-svelte package in Svelte 5 or SvelteKit apps. Use when Codex needs Svelte 5 runes, CSS and optional peers, smooth streaming, worker setup, renderer-local or scoped custom components, or SSR-safe boundaries. Svelte 4 is unsupported.

Simon-He95/markstream-vue · 67 tokens

task-planning-arch

计算任务 gap 并产出下一步可执行子任务 List[TaskSpec];gap 已闭返回空数组。对齐 arch 场景(架构师名册/技术栈概览/双视角分析)确定式分解——按根目标交付物集合 + donechildren 查表(参照 task-planning storage 特例,非自由 LLM 分解)。.

inclusionAI/Avernet · 89 tokens

task-search

在框架预查的候选 bot 集里决出执行者(who)与协作方式(how),返回 4 态 SearchResult(HITSINGLE/HITGROUP/HITMULTIBOTS/MISS)。对齐案例剧本确定式映射。.

inclusionAI/Avernet · 59 tokens