Cleans up accumulated user cruft, automatically and on demand.
What's new
mesh admin delete-user <handle> — hard delete. Removes the human row, all its tokens, and pending paircodes in one transaction. Handle becomes immediately reusable without --force. Use this when you want a row gone, not just tombstoned.
mesh admin purge-inactive [--days 30] — on-demand sweep of every user whose last_active_at is older than N days. Users holding an active admin-tier token are never purged (guard against deleting the team's sole admin).
Background sweeper — the relay runs the inactivity sweep every hour. Configurable via MESH_INACTIVE_DAYS (default 30; set to 0 to disable). Logged as purge.sweep when it deletes anything.
Schema migration
Schema v2 adds human.last_active_at. Fresh databases get the column from schema.sql; existing v1 databases are migrated in place on startup (ALTER TABLE, backfill from created_at). No manual step needed.
Activity tracking
last_active_at updates on:
- every authenticated request (bearerAuth middleware)
- successful
mesh pair(token creation) - new user creation via
initoradd-user
Upgrade
docker pull ghcr.io/pouriamrt/claude-mesh/relay:v0.1.5
docker stop mesh-relay && docker rm mesh-relay
docker run -d --name mesh-relay --restart unless-stopped \
-p 8443:8443 -v mesh-data:/data \
ghcr.io/pouriamrt/claude-mesh/relay:v0.1.5Data survives. The migration runs on the first startup of the new image.
Cleanup example
# List what's there
mesh admin audit
# Nuke specific orphans (frees the handles for re-use)
mesh admin delete-user Pouria
mesh admin delete-user pouria
mesh admin delete-user old-test-user
# Or sweep everything older than 7 days in one go
mesh admin purge-inactive --days 7