feat: M6 complete — summarize strategy + tool result persistence

SummarizeStrategy: calls LLM to condense older messages into a
summary, preserving key decisions, file changes, tool outputs.
Falls back to truncation on failure. Keeps 6 recent messages.

Tool result persistence: outputs >50K chars saved to disk at
.gnoma/sessions/tool-results/{id}.txt with 2K preview inline.

TUI: /compact command for manual compaction, /clear now resets
engine history. Summarize strategy used by default (with
truncation fallback).
This commit is contained in:
2026-04-03 18:51:28 +02:00
parent b0b393517e
commit f3d3390b86
5 changed files with 213 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
gnomactx "somegit.dev/Owlibou/gnoma/internal/context"
"somegit.dev/Owlibou/gnoma/internal/message"
"somegit.dev/Owlibou/gnoma/internal/permission"
"somegit.dev/Owlibou/gnoma/internal/provider"
@@ -248,6 +249,12 @@ func (e *Engine) executeTools(ctx context.Context, calls []message.ToolCall, cb
output = e.cfg.Firewall.ScanToolResult(output)
}
// Persist large results to disk
if persisted, ok := gnomactx.PersistLargeResult(output, call.ID, ".gnoma/sessions"); ok {
e.logger.Debug("tool result persisted to disk", "name", call.Name, "size", len(output))
output = persisted
}
// Emit tool result event for the UI
if cb != nil {
cb(stream.Event{