Skip to content
Back to skills

Leave

ASecurity

Leave the Cortex agent team — removes .cortex.md, cleans CLAUDE.local.md, sets agent status to inactive in team directory.

  • 12 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 26, 2026
ai-agentsbash

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add agentweave/cortex --skill leave --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Leave?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Leave
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/agentweave-leave/badge)](https://www.skillsdirectory.com/skills/agentweave-leave)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: leave
description: Leave the Cortex agent team — removes .cortex.md, cleans CLAUDE.local.md, sets agent status to inactive in team directory.
user_invocable: true
argument-hint: <agent-name>
---

# /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:

```bash
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:

```bash
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.

If the config or agent note doesn't exist, skip this step (already cleaned up or never registered).

### 7. Confirm

Respond:

> "**{name}** has left Cortex. .cortex.md removed, CLAUDE.local.md cleaned, team directory status set to inactive."

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.