# agent-purge

> One persona file, injected into the system prompt of every coding agent you run

- Category: AI Coding / Coding-Agent Harnesses & Runtimes
- Language: JavaScript
- Licence: MIT
- Repository: https://github.com/ZiChuanLan/agent-purge
- Canonical page: https://ai-tldr.dev/tools/agent-purge/

## In short

agent-purge is One persona file, injected into the system prompt of every coding agent you run. It sits in the Coding-Agent Harnesses & Runtimes category of the AI Coding tools and is open-source, written in JavaScript and licensed MIT. To get started: install and open the console.

## Overview

Every coding agent ships with its own system prompt — its identity line, its tone, its house rules — and each one keeps it in a different place: a config file, a plugin hook, a launch flag, a project rule file. agent-purge is a local prompt-configuration tool that puts one persona in front of all of them. You write the persona once as a Markdown file, pick how it should be applied, and switch on the agents it should govern; each agent keeps its own tools, models and workflow.

There are four injection modes. `replace`, the default, swaps the host's identity lines and tries to keep its other instructions; `strict` replaces the controllable host prompt with the persona text; `append` leaves the host prompt alone and adds the persona alongside it; `off` stops injection. The README is explicit that `strict` does not guarantee the model sees only your persona — depending on the agent and the channel, the text may land in the `system` or `developer` role or in project context, and the host can still add wrapper prompts of its own.

How the persona reaches an agent depends on the channel: `install` writes managed configs, plugins or identity files; `shim` puts a forwarding command first on the PATH; `slash` registers an in-session `/purge` command; `project` writes a managed block into `AGENTS.md` or `CLAUDE.md`. Every write is recorded in a ledger with backups, so `agent-purge clean` can restore the original configuration. The README lists verified versions for pi / omp, OpenCode, DeepSeek Harness, Codex, Claude Code, CodeBuddy, Grok, Kilo Code and WorkBuddy, with hot-switching between turns verified on the agents that expose a per-turn callback. It runs on Node.js 20+, stores data under `~/.agent-purge/`, and its web console listens only on `127.0.0.1`.

## What it does

- One Markdown persona applied across Codex, Claude Code, OpenCode, pi, DeepSeek Harness, Kilo Code, Grok, CodeBuddy and WorkBuddy
- Four injection modes — replace, strict, append and off — set globally or per agent
- Four delivery channels: managed config install, PATH shim, an in-session /purge slash command and project rule files
- A local web console on 127.0.0.1:7788 with a persona library, per-agent toggles and diagnostics, sharing state with the CLI
- A ledger of every managed write with backups, plus pause, disarm, uninstall and clean commands that restore the original files
- Distributed on npm and as Windows installer, zip and standalone executable builds

## Getting started

agent-purge needs Node.js 20+ and the coding agents you want it to manage already installed. These steps follow the project README.

1. Install and open the console

   Install the npm package globally and start the web console, or run it once with `npx agent-purge web`. On a headless machine (SSH, WSL) add `--no-open`.

```bash
npm install -g agent-purge
agent-purge web
```

2. Write a persona

   A first run creates a `neutral` starter template you can edit in the Persona Library. To write one by hand, save a Markdown file under `~/.agent-purge/personas/`; only the body goes into the prompt, the front matter is for management. The example below is the README's own, translated from Chinese.

```markdown
---
id: concise
name: Concise collaborator
description: Conclusion first, read the code before editing
---

Give the conclusion first, then the reasoning.
Read the existing implementation before changing code; say so when unsure.
```

3. Choose the persona and mode

   Switch the active persona and the global mode from the CLI, or give one agent its own setting.

```bash
agent-purge ls
agent-purge use concise
agent-purge mode append
agent-purge use concise --for codex
```

4. Try it on a single run

   To test without registering anything persistent, launch an agent through agent-purge; arguments after `--` go to the host agent.

```bash
agent-purge codex --mode append
agent-purge pi --ask "Explain this repository"
```

5. Arm agents persistently

   Enable the channels you want, then start a new session or reload the plugin as each agent's status line says.

```bash
agent-purge install codex
agent-purge arm pi --slash
agent-purge project on pi --dir /path/to/project
agent-purge status
```

6. Pause or undo

   Pause every channel without losing personas, or remove the managed hooks before uninstalling the package.

```bash
agent-purge pause
agent-purge resume
agent-purge clean
npm uninstall -g agent-purge
```

## When to use it

- Reach for it when you switch between several coding agents and want the same language, tone and working rules in all of them
- Reach for it when you want to test how a different identity or instruction block changes an agent's behaviour, then roll it back cleanly
- Reach for it when you maintain a team persona and want it written into AGENTS.md or CLAUDE.md as a managed, removable block
