multi-agent-archiver 0.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+
11
+ env:
12
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
13
+
14
+ jobs:
15
+ lint:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ # https://github.com/actions/checkout
19
+ - uses: actions/checkout@v6
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ # https://github.com/astral-sh/setup-uv
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v7
26
+ with:
27
+ enable-cache: true
28
+
29
+ - name: Set up Python
30
+ run: uv python install
31
+
32
+ - name: Run ruff
33
+ run: uv run ruff check .
@@ -0,0 +1,41 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ env:
9
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
10
+
11
+ jobs:
12
+ publish:
13
+ name: Build and publish
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ id-token: write
17
+ contents: write
18
+ attestations: write
19
+
20
+ steps:
21
+ # https://github.com/actions/checkout
22
+ - uses: actions/checkout@v6
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ # https://github.com/astral-sh/setup-uv
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v7
29
+ with:
30
+ enable-cache: true
31
+
32
+ - name: Set up Python
33
+ run: uv python install
34
+
35
+ - name: Build package
36
+ run: uv build
37
+
38
+ - name: Publish to PyPI
39
+ uses: pypa/gh-action-pypi-publish@release/v1
40
+ with:
41
+ verbose: true
@@ -0,0 +1,10 @@
1
+ .venv
2
+ __pycache__/
3
+ *.pyc
4
+ dist/
5
+ *.egg-info/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ .gemini
9
+ .logs/
10
+ archiver.log
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,66 @@
1
+ # GEMINI.md - ChatArch Project Context
2
+
3
+ ## Project Overview
4
+ **ChatArch** is a Python-based utility designed to manage and archive AI conversation histories from various local platforms (Gemini CLI, Roo Code/Cline, and Aider) to AWS S3. Its primary goal is to reclaim local disk space while preserving conversations in a summarized, searchable Markdown format.
5
+
6
+ ### Key Technologies
7
+ - **Python 3.12+**: Core logic.
8
+ - **uv**: Dependency management and environment isolation.
9
+ - **AWS SDK (boto3)**: For S3 uploads.
10
+ - **Google Gemini API (google-genai)**: For conversation summarization using `gemini-2.5-flash`.
11
+ - **1Password CLI (`op`)**: Secure retrieval of API keys.
12
+ - **Ruff**: Linting and code formatting.
13
+
14
+ ### Architecture
15
+ - `archiver.py`: Contains the core `ChatArchiver` class which handles file discovery, filtering (e.g., "commit-only" chats), Markdown conversion, summarization, and S3 uploading. Each conversation is archived as three separate files in S3:
16
+ - `<name>.md`: Human-readable Markdown with the summary at the top.
17
+ - `<name>.summary.txt`: A standalone text file containing the AI-generated summary.
18
+ - `<name>.json`: The original raw conversation data.
19
+ - `config.yaml`: Centralized configuration for S3 settings, summarization parameters, local search paths, and filtering rules.
20
+ - `Makefile`: Provides a simplified CLI interface for common tasks.
21
+ - `archiver.log`: Detailed execution logs.
22
+
23
+ ## Building and Running
24
+
25
+ ### Prerequisites
26
+ 1. **uv**: Install via `curl -LsSf https://astral.sh/uv/install.sh | sh`.
27
+ 2. **AWS CLI**: Configured with appropriate S3 permissions.
28
+ 3. **1Password CLI (`op`)**: Installed and signed in (`op signin`).
29
+ 4. **Gemini API Key**: Should be stored in 1Password at `op://Private/GEMINI_API_KEY/credential`.
30
+
31
+ ### Common Commands
32
+ - **Dry Run**: Preview changes without affecting local files or S3.
33
+ ```bash
34
+ make dry-run
35
+ ```
36
+ - **Run Archive**: Perform full linting, summarization, upload, and deletion.
37
+ ```bash
38
+ make archive
39
+ ```
40
+ - **Limited Run**: Process only a specific number of files (useful for testing).
41
+ ```bash
42
+ make archive ARGS="--limit 5"
43
+ ```
44
+ - **Linting**:
45
+ ```bash
46
+ make lint
47
+ ```
48
+
49
+ ## Development Conventions
50
+
51
+ ### Code Style
52
+ - Follows PEP 8 via **Ruff**.
53
+ - Ensure all changes are linted using `make lint` before execution.
54
+
55
+ ### Configuration
56
+ - Paths for different chat platforms are defined in `config.yaml`.
57
+ - When adding support for a new platform, update the `paths` section in `config.yaml` and implement the corresponding parsing logic in `archiver.py`.
58
+
59
+ ### Safety & Verification
60
+ - **Retention Policy**: By default, only files older than 20 days are archived (configurable/logic-driven in `archiver.py`).
61
+ - **Atomic Operations**: Files are only deleted locally if the S3 upload is confirmed successful.
62
+ - **Logging**: All operations should be logged to `archiver.log` using the `logger` instance.
63
+
64
+ ### Error Handling
65
+ - Use exponential backoff for API calls (handled in `archiver.py`).
66
+ - Critical errors are mirrored to `stderr` via the console handler, while detailed info stays in the log file.
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+ .PHONY: help
3
+ help: ## Display this help screen
4
+ @echo "Available commands:"
5
+ @awk 'BEGIN {FS = ":.*?## "}; /^[a-zA-Z_-]+:.*?## / {printf " \033[32m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
6
+
7
+ # ==============================================================================
8
+ # Application Tasks
9
+ # ==============================================================================
10
+
11
+ lint: ## Run linting and auto-fix with Ruff
12
+ uv run ruff check --fix .
13
+
14
+ dry-run: lint ## Perform a dry run of the archiver (e.g. make dry-run ARGS="--limit 5")
15
+ uv run cax dry-run $(ARGS)
16
+
17
+ archive: lint ## Archive chats to S3 and remove local files
18
+ uv run cax archive $(ARGS)
19
+
20
+ cleanup: lint ## Delete commit-only chats locally (no S3 upload)
21
+ uv run cax cleanup $(ARGS)
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.5
2
+ Name: multi-agent-archiver
3
+ Version: 0.1.5
4
+ Summary: Archive local AI chat histories to S3, freeing up disk space while keeping conversations searchable
5
+ Author-email: Mark Stouffer <1802850+InTEGr8or@users.noreply.github.com>
6
+ License: MIT
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: boto3>=1.42.17
9
+ Requires-Dist: google-genai>=1.56.0
10
+ Requires-Dist: multi-agent-registry>=0.2.0
11
+ Requires-Dist: pyyaml>=6.0.3
12
+ Requires-Dist: requests>=2.32.5
13
+ Requires-Dist: rich>=13.9.4
14
+ Requires-Dist: tqdm>=4.67.1
15
+ Requires-Dist: verkit>=0.1.4
16
+ Description-Content-Type: text/markdown
17
+
18
+ # ChatArch: AI Conversation Archiver
19
+
20
+ 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.
21
+
22
+ ## Features
23
+
24
+ - **Multi-Platform Support:** Automatically discovers chats from Gemini CLI, Roo Code (Cline), and Aider.
25
+ - **Smart Cleanup:** Identifies and deletes "commit-only" chats (short messages used solely for git commits) before archiving.
26
+ - **Markdown Conversion:** Converts complex JSON chat schemas into clean, readable Markdown files within the archive.
27
+ - **AI-Powered Summarization:** Uses Gemini 2.5 Flash to generate 1-2 sentence summaries for every archived conversation.
28
+ - **Safe Archival:**
29
+ - **Retention Policy:** Only archives chats older than 20 days.
30
+ - **Verification:** Local files are only deleted after a successful S3 upload.
31
+ - **Rate Limit Handling:** Includes configurable delays and exponential backoff for API calls.
32
+ - **Space Reporting:** Reports the total disk space reclaimed at the end of each run.
33
+
34
+ ## Prerequisites
35
+
36
+ - **Python & uv:** Managed via `uv`.
37
+ - **AWS CLI:** Must be configured with credentials that have `s3:PutObject` permissions.
38
+ - **1Password CLI (`op`):** Used to securely retrieve the Gemini API key.
39
+ - **Google Gemini API Key:** Stored in 1Password at `op://Private/GEMINI_API_KEY/credential`.
40
+
41
+ ## Usage
42
+
43
+ Commands are managed via the `Makefile` for convenience.
44
+
45
+ ### 1. Dry Run (Recommended)
46
+ Verify which files will be deleted or archived without actually performing any actions:
47
+ ```bash
48
+ make dry-run
49
+ ```
50
+
51
+ ### 2. Actual Archive
52
+ Perform the cleanup and migration:
53
+ ```bash
54
+ make archive
55
+ ```
56
+
57
+ ### 3. Using Limits
58
+ To test the full process on a small sample (e.g., 5 files):
59
+ ```bash
60
+ make archive ARGS="--limit 5"
61
+ ```
62
+
63
+ ### 4. Maintenance
64
+ Run linting and auto-fixes:
65
+ ```bash
66
+ make lint
67
+ ```
68
+
69
+ ## Configuration
70
+
71
+ Settings like S3 bucket names, local search paths, and API delays are managed in `config.yaml`.
72
+
73
+ ## Logging
74
+
75
+ All detailed operations and API responses are logged to `.logs/archiver.log`, rotated daily and kept for 180 days. Progress is displayed in the terminal via a status bar.
76
+
77
+ ## Development
78
+
79
+ The package publishes three equivalent commands: `chatarch`, and its short aliases `cax` and `maa` (`pip install multi-agent-archiver` / `uv tool install multi-agent-archiver`).
80
+
81
+ Inside this repo, `bin/` (added to `PATH` via `mise.toml`'s `[env]` when you `cd` in, since this repo's dev environment is managed with [mise](https://mise.jdx.dev/)) shadows the globally installed commands with a shim that runs this repo's live source via `uv run`. Outside the repo, `chatarch`/`cax`/`maa` resolve back to whatever version is installed globally. Run `mise trust` once after cloning to enable it.
@@ -0,0 +1,64 @@
1
+ # ChatArch: AI Conversation Archiver
2
+
3
+ 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.
4
+
5
+ ## Features
6
+
7
+ - **Multi-Platform Support:** Automatically discovers chats from Gemini CLI, Roo Code (Cline), and Aider.
8
+ - **Smart Cleanup:** Identifies and deletes "commit-only" chats (short messages used solely for git commits) before archiving.
9
+ - **Markdown Conversion:** Converts complex JSON chat schemas into clean, readable Markdown files within the archive.
10
+ - **AI-Powered Summarization:** Uses Gemini 2.5 Flash to generate 1-2 sentence summaries for every archived conversation.
11
+ - **Safe Archival:**
12
+ - **Retention Policy:** Only archives chats older than 20 days.
13
+ - **Verification:** Local files are only deleted after a successful S3 upload.
14
+ - **Rate Limit Handling:** Includes configurable delays and exponential backoff for API calls.
15
+ - **Space Reporting:** Reports the total disk space reclaimed at the end of each run.
16
+
17
+ ## Prerequisites
18
+
19
+ - **Python & uv:** Managed via `uv`.
20
+ - **AWS CLI:** Must be configured with credentials that have `s3:PutObject` permissions.
21
+ - **1Password CLI (`op`):** Used to securely retrieve the Gemini API key.
22
+ - **Google Gemini API Key:** Stored in 1Password at `op://Private/GEMINI_API_KEY/credential`.
23
+
24
+ ## Usage
25
+
26
+ Commands are managed via the `Makefile` for convenience.
27
+
28
+ ### 1. Dry Run (Recommended)
29
+ Verify which files will be deleted or archived without actually performing any actions:
30
+ ```bash
31
+ make dry-run
32
+ ```
33
+
34
+ ### 2. Actual Archive
35
+ Perform the cleanup and migration:
36
+ ```bash
37
+ make archive
38
+ ```
39
+
40
+ ### 3. Using Limits
41
+ To test the full process on a small sample (e.g., 5 files):
42
+ ```bash
43
+ make archive ARGS="--limit 5"
44
+ ```
45
+
46
+ ### 4. Maintenance
47
+ Run linting and auto-fixes:
48
+ ```bash
49
+ make lint
50
+ ```
51
+
52
+ ## Configuration
53
+
54
+ Settings like S3 bucket names, local search paths, and API delays are managed in `config.yaml`.
55
+
56
+ ## Logging
57
+
58
+ All detailed operations and API responses are logged to `.logs/archiver.log`, rotated daily and kept for 180 days. Progress is displayed in the terminal via a status bar.
59
+
60
+ ## Development
61
+
62
+ The package publishes three equivalent commands: `chatarch`, and its short aliases `cax` and `maa` (`pip install multi-agent-archiver` / `uv tool install multi-agent-archiver`).
63
+
64
+ Inside this repo, `bin/` (added to `PATH` via `mise.toml`'s `[env]` when you `cd` in, since this repo's dev environment is managed with [mise](https://mise.jdx.dev/)) shadows the globally installed commands with a shim that runs this repo's live source via `uv run`. Outside the repo, `chatarch`/`cax`/`maa` resolve back to whatever version is installed globally. Run `mise trust` once after cloning to enable it.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ # Dev shim: runs this repo's live source via `uv run` instead of the
3
+ # globally uv-tool-installed agent-chat-archiver. Only on PATH while inside
4
+ # this repo (see mise.toml's [env]._.path) -- outside it, the `cax`/
5
+ # `chatarch` on PATH are the globally installed, published version.
6
+ set -euo pipefail
7
+ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
8
+ exec uv run --project "$repo_root" "$(basename "${BASH_SOURCE[0]}")" "$@"
@@ -0,0 +1 @@
1
+ cax
@@ -0,0 +1 @@
1
+ cax
@@ -0,0 +1,29 @@
1
+ s3:
2
+ bucket: chatarch
3
+ prefix: chats/
4
+
5
+ retention:
6
+ days: 20 # Only archive chats older than this
7
+ keep_recent: 5 # Always keep the N most recent chats per workspace
8
+
9
+ summarization:
10
+ model: "gemini-2.5-flash-lite"
11
+ delay: 20 # Seconds to wait between API calls
12
+
13
+ paths:
14
+ gemini:
15
+ - "~/.gemini/tmp/**/chats/session-*.json"
16
+ roo:
17
+ - "~/.vscode-server/data/User/globalStorage/rooveterinaryinc.roo-cline/tasks/*/ui_messages.json"
18
+ - "~/.vscode-server-insiders/data/User/globalStorage/rooveterinaryinc.roo-cline/tasks/*/ui_messages.json"
19
+ - "~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/tasks/*/ui_messages.json"
20
+ - "~/.config/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/tasks/*/ui_messages.json"
21
+ # aider and claude are now discovered via agent-cli-registry, not globs here.
22
+
23
+ filters:
24
+ gemini_commit_only:
25
+ keywords:
26
+ - "git diff --cached"
27
+ - "create a git commit"
28
+ - "perform the commit without asking"
29
+ max_messages: 2