Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ This project uses speckit for feature specification and planning. Available comm

Templates are stored in `.specify/templates/` and project constitution in `.specify/memory/constitution.md`.

**Important:** After implementing a spec, always update `README.md` to reflect the new functionality.

## Active Technologies
- Go 1.21+ (per IC-001) + Standard library only (os/exec for tmux, encoding/json for JSONL) (001-agent-mail-structure)
- JSONL file in `.agentmail/` directory (001-agent-mail-structure)
Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ A Go CLI tool for inter-agent communication within tmux sessions. Agents running
- **Agent status tracking** - Agents can set status (ready/work/offline) for smart notifications
- **MCP server** - Model Context Protocol server for Claude Code, Codex CLI, and Gemini CLI
- **Claude Code integration** - Plugin and hooks for AI agent orchestration
- **Cleanup utility** - Remove stale recipients, old messages, and empty mailboxes

## Requirements

Expand Down Expand Up @@ -257,6 +258,51 @@ This command outputs a quick reference for AI agents to understand AgentMail's c
**Exit codes:**
- `0` - Success

### cleanup

Remove stale data from the AgentMail system.

```bash
agentmail cleanup [flags]
```

**What gets cleaned:**
- **Offline recipients** - Entries in recipients.jsonl for tmux windows that no longer exist
- **Stale recipients** - Recipients not updated within the threshold (default: 48 hours)
- **Old delivered messages** - Read messages older than the threshold (default: 2 hours)
- **Empty mailboxes** - Mailbox files with zero messages

**Flags:**
- `--stale-hours <N>` - Hours threshold for stale recipients (default: 48)
- `--delivered-hours <N>` - Hours threshold for delivered messages (default: 2)
- `--dry-run` - Report what would be cleaned without deleting

**Examples:**
```bash
# Preview what would be cleaned
agentmail cleanup --dry-run

# Clean with default thresholds (48h stale, 2h delivered)
agentmail cleanup

# Clean with custom thresholds
agentmail cleanup --stale-hours 24 --delivered-hours 1
```

Comment thread
coderabbitai[bot] marked this conversation as resolved.
**Output:**
```
Cleanup complete:
Recipients removed: 3 (2 offline, 1 stale)
Messages removed: 15
Mailboxes removed: 2
```

Comment thread
coderabbitai[bot] marked this conversation as resolved.
**Exit codes:**
- `0` - Success
- `1` - Error during cleanup

**Note:** This is an administrative command not intended for AI agent use. It is not exposed via MCP tools or onboarding.

### help

Display usage information.
Expand Down
2 changes: 1 addition & 1 deletion specs/011-cleanup/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Feature Branch**: `011-cleanup`
**Created**: 2026-01-15
**Status**: Draft
**Status**: Implemented
**Input**: User description: "I want to have ability to cleanup old recipients/messages/mailboxes."

## Clarifications
Expand Down