# Lifecycle Plugin Seam

> Drop plugin.toml or plugin.json manifests into ~/.config/vapor/plugins/<name>/ to react to session events or supply custom capabilities like claim_reset.

- Site: VAPOR.TOWN (https://vapor.town)
- Canonical: https://vapor.town/docs/plugins
- Markdown: https://vapor.town/docs/plugins.md
- Section: Operations

## Manifest Configuration

Vapor discovers plugins automatically from ~/.config/vapor/plugins/<name>/plugin.toml (or plugin.json). Hook plugins receive structured JSON event payloads on stdin with zero daemon recompilation.

```vapor-diagram vapor-plugin-claude-reset — TLA+ Verified Reset Claim
claude-reset
```

```toml ~/.config/vapor/plugins/tokscale/plugin.toml
name = "tokscale"
mode = "hook"
events = ["session_ended", "handoff_committed"]
command = ["tokscale", "sync"]
```

```json Example JSON Event Payload (stdin)
{
  "event": "handoff_committed",
  "provider": "claude",
  "from_account": "claude:pro-2",
  "to_account": "claude:pro-3",
  "swap_epoch": 4,
  "fencing_token": 43,
  "timestamp_ms": 1796408490000
}
```

## Supported Events & Testing

Inspect discovered manifests and fire synthetic test events before relying on a plugin in production.

| Lifecycle Event | Emitted When |
| --- | --- |
| session_started | A wrapped agent PTY acquires a lease and boots |
| session_ended | An agent session exits cleanly or is closed |
| limit_hit | Quota exhaustion is detected on the active account |
| handoff_committed | In-place PTY swap commits onto a replacement account |
| reset_eligible | A probed account exposes a claimable earned reset |

```sh
# Inspect & Test Plugins
vapor plugin ls
vapor plugin test tokscale
```
