Skip to content

feat: tmux snapshot summarization with multi-backend support#174

Closed
snibbor2 wants to merge 4 commits intoYeachan-Heo:devfrom
snibbor2:feat/snapshot-summarization-split
Closed

feat: tmux snapshot summarization with multi-backend support#174
snibbor2 wants to merge 4 commits intoYeachan-Heo:devfrom
snibbor2:feat/snapshot-summarization-split

Conversation

@snibbor2
Copy link
Copy Markdown

@snibbor2 snibbor2 commented Apr 8, 2026

Summary

Adds configurable snapshot summarization for monitored tmux sessions. Instead of forwarding raw terminal output, clawhip can condense it through a pluggable backend before delivery.

  • `summarizer = "raw"` — verbatim terminal output, ANSI stripped (default behaviour, no external dependency)
  • `summarizer = "gemini"` / `summarizer = "gemini:"` — Google Gemini LLM condenses the output
  • `summarizer = "openrouter:"` — OpenRouter-compatible LLM backend
  • `summarizer = "openai:"` — OpenAI-compatible LLM backend

Config example

[[monitors.tmux.sessions]]
session = "my-agent"
summarize = true
summarizer = "gemini:gemini-2.0-flash"
summarize_interval_mins = 2
min_new_lines = 5
channel = "1234567890"

Key fields

Field Default Description
`summarize` `false` Enable snapshot summarization
`summarizer` `"raw"` Backend: `raw`, `gemini`, `gemini:`, `openrouter:`, `openai:`
`summarize_interval_mins` `5` How often to summarize (minutes)
`summary_interval` `0` Override in minutes (takes precedence over `summarize_interval_mins`)
`min_new_lines` `0` Minimum new lines required to trigger a summary

Notes

  • `GOOGLE_API_KEY` / `OPENROUTER_API_KEY` / `OPENAI_API_KEY` environment variables supply credentials for LLM backends
  • Raw mode has no external dependencies and works offline
  • LLM backends gracefully fall back on API error (error logged, delivery skipped for that cycle)

Test plan

  • `cargo test` — all tests passing
  • Live integration tested: Gemini summaries delivered to Discord channel with condensed natural-language output verified against raw terminal content
  • `min_new_lines` gate confirmed: no delivery when below threshold

snibbor and others added 4 commits April 8, 2026 19:40
Add content-change summarization and heartbeat events for tmux sessions.
Supports Gemini CLI, OpenRouter API, and OpenAI-compatible API backends
with configurable intervals, min-new-lines thresholds, and raw passthrough.

- New summarize module with Summarizer trait and three backends
- Provider configs (gemini, openrouter, openai) in AppConfig
- tmux.content_changed and tmux.heartbeat event types with routing/rendering
- Summarization dispatch in both poll_tmux and monitor_registered_session loops
- Tests for count_new_lines, should_summarize_now, and render formats

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hanced-session-list

- Add is_infrastructure_failure() helper to distinguish 5xx/network errors
  from Discord API policy rejections (4xx)
- Gate circuit breaker record_failure on infrastructure failures only
- Replace eager per-change summarization with interval-gated approach:
  summaries fire only when the summary interval has elapsed AND content
  has changed since the last summary, checked after heartbeat in both
  wrapper and config polling paths
- Add session_last_summarized_snapshot tracking for min_new_lines checks
- Add maybe_emit_registered_session_summary() for wrapper path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sion end

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collapse nested if/if-let into if-let chain at tmux.rs:537
(same fix as feat/enhanced-session-list).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@snibbor2 snibbor2 force-pushed the feat/snapshot-summarization-split branch from ef3af50 to a0773df Compare April 8, 2026 23:41
@Yeachan-Heo
Copy link
Copy Markdown
Owner

Thanks for the draft. I'm closing this for now instead of leaving it open in draft limbo. The tmux summarization scope is substantial, introduces new backend/config surface, and needs to come back as a merge-ready update on top of current dev with a tighter verification/review pass. Please reopen or resubmit when the branch is refreshed and ready for final review.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo Yeachan-Heo closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants