Metadata-Version: 2.5
Name: agent-chat-archiver
Version: 0.1.0
Summary: Archive local AI chat histories to S3, freeing up disk space while keeping conversations searchable
Author-email: Mark Stouffer <1802850+InTEGr8or@users.noreply.github.com>
License: MIT
Requires-Python: >=3.12
Requires-Dist: agent-cli-registry>=0.1.2
Requires-Dist: boto3>=1.42.17
Requires-Dist: google-genai>=1.56.0
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: requests>=2.32.5
Requires-Dist: rich>=13.9.4
Requires-Dist: tqdm>=4.67.1
Requires-Dist: verkit>=0.1.4
Description-Content-Type: text/markdown

# ChatArch: AI Conversation Archiver

ChatArch is a utility designed to migrate local AI chat histories to AWS S3, freeing up local disk space while preserving conversations in a human-readable, summarized, and searchable format.

## Features

- **Multi-Platform Support:** Automatically discovers chats from Gemini CLI, Roo Code (Cline), and Aider.
- **Smart Cleanup:** Identifies and deletes "commit-only" chats (short messages used solely for git commits) before archiving.
- **Markdown Conversion:** Converts complex JSON chat schemas into clean, readable Markdown files within the archive.
- **AI-Powered Summarization:** Uses Gemini 2.5 Flash to generate 1-2 sentence summaries for every archived conversation.
- **Safe Archival:**
  - **Retention Policy:** Only archives chats older than 20 days.
  - **Verification:** Local files are only deleted after a successful S3 upload.
  - **Rate Limit Handling:** Includes configurable delays and exponential backoff for API calls.
- **Space Reporting:** Reports the total disk space reclaimed at the end of each run.

## Prerequisites

- **Python & uv:** Managed via `uv`.
- **AWS CLI:** Must be configured with credentials that have `s3:PutObject` permissions.
- **1Password CLI (`op`):** Used to securely retrieve the Gemini API key.
- **Google Gemini API Key:** Stored in 1Password at `op://Private/GEMINI_API_KEY/credential`.

## Usage

Commands are managed via the `Makefile` for convenience.

### 1. Dry Run (Recommended)
Verify which files will be deleted or archived without actually performing any actions:
```bash
make dry-run
```

### 2. Actual Archive
Perform the cleanup and migration:
```bash
make archive
```

### 3. Using Limits
To test the full process on a small sample (e.g., 5 files):
```bash
make archive ARGS="--limit 5"
```

### 4. Maintenance
Run linting and auto-fixes:
```bash
make lint
```

## Configuration

Settings like S3 bucket names, local search paths, and API delays are managed in `config.yaml`.

## Logging

All detailed operations and API responses are logged to `chatarch/archiver.log`. Progress is displayed in the terminal via a status bar.
