diff --git a/README.md b/README.md index 84157f2..5e93a03 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,35 @@ Hermes Agent session temizlik aracı: kısa konuşmaları sil, başlıksız session'lara title üret. +## Kurulum + +### Yöntem 1: Hermes Skill olarak (önerilen) + +```bash +hermes skills install https://git.softmediadesign.com/git_alhan/hermes-session-cleaner/raw/branch/main/SKILL.md +``` + +Skill yüklendikten sonra Hermes içinde "temizlik yap" veya "clean sessions" dediğinde otomatik çalışır. + +### Yöntem 2: Manuel (git clone) + +```bash +git clone https://git.softmediadesign.com/git_alhan/hermes-session-cleaner.git +cd hermes-session-cleaner +python3 hermes_cleaner.py --dry-run +``` + +### Yöntem 3: Tek komut (curl + run) + +```bash +curl -O https://git.softmediadesign.com/git_alhan/hermes-session-cleaner/raw/branch/main/hermes_cleaner.py +python3 hermes_cleaner.py --dry-run +``` + ## Kullanım ```bash -# Neler olacağını gör (dry-run) +# Neler olacağını gör (her zaman önce bunu çalıştır) python3 hermes_cleaner.py --dry-run # Gerçek temizlik @@ -23,12 +48,44 @@ python3 hermes_cleaner.py --no-delete --max-titles 50 ## Nasıl Çalışır -1. Tüm session'ları tarar -2. `< N` mesajlı session'ları siler (default: 5) -3. `>= N` mesajlı ama başlıksız session'lara title üretir (hermes3:latest ile) +1. Tüm session'ları tarar (`~/.hermes/state.db`) +2. `< N` mesajlı session'ları **siler** (default: 5) +3. `>= N` mesajlı ama başlıksız session'lara **title üretir** ## Gereksinimler -- Hermes Agent kurulu olmalı -- Ollama'da `hermes3:latest` modeli (env ile değiştirilebilir) -- `HERMES_CLEANER_MODEL` ve `HERMES_CLEANER_ENDPOINT` env override'ları +- Hermes Agent kurulu olmalı (hermes_state modülü için) +- Title üretimi için Ollama'da `hermes3:latest` modeli + +## Yapılandırma (Env Vars) + +| Değişken | Varsayılan | Açıklama | +|---|---|---| +| `HERMES_CLEANER_MODEL` | `hermes3:latest` | Title üretimi için model | +| `HERMES_CLEANER_ENDPOINT` | `http://100.83.239.61:11434/v1/chat/completions` | Ollama API adresi | + +```bash +# DeepSeek API ile kullanmak istersen: +export HERMES_CLEANER_ENDPOINT="https://api.deepseek.com/v1/chat/completions" +export HERMES_CLEANER_MODEL="deepseek-chat" +export HERMES_CLEANER_API_KEY="sk-..." +``` + +## Cron ile Otomatik Çalıştırma + +```bash +# Hermes içinde: +/cron "her hafta pazar 03:00'te session temizliği yap" + +# Veya manuel cron: +0 3 * * 0 cd /path/to/hermes-session-cleaner && python3 hermes_cleaner.py +``` + +## Projeler + +Bu proje `hermes-session-ending` ile birlikte çalışır: + +| Proje | Amaç | Ne zaman? | +|---|---|---| +| [session-ending](https://git.softmediadesign.com/git_alhan/hermes-session-ending) | Oturum sonu: title + save + reset | Her oturum sonunda ("ending") | +| session-cleaner (bu proje) | Toplu temizlik: sil + title | Haftalık bakım | diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..8168fc9 --- /dev/null +++ b/SKILL.md @@ -0,0 +1,27 @@ +--- +name: session-cleaner +description: "Clean Hermes session DB: delete short conversations, generate missing titles." +version: 1.0.0 +--- + +# Session Cleaner + +Scans the Hermes session DB and: +1. Deletes sessions with fewer than 5 messages (configurable) +2. Generates titles for sessions that don't have one + +Uses local Ollama (hermes3:latest) for title generation. + +## Usage + +```bash +python3 hermes_cleaner.py --dry-run # Preview +python3 hermes_cleaner.py # Full clean +python3 hermes_cleaner.py --no-delete # Titles only +python3 hermes_cleaner.py --min-messages 3 # Custom threshold +``` + +## Requirements + +- Hermes Agent installed (for hermes_state module) +- Ollama with hermes3:latest model (env-configurable)