@@ -143,7 +143,6 @@ type Options struct {
DebugLSP bool `json:"debug_lsp,omitempty" jsonschema:"description=Enable debug logging for LSP servers,default=false"`
DisableAutoSummarize bool `json:"disable_auto_summarize,omitempty" jsonschema:"description=Disable automatic conversation summarization,default=false"`
DataDirectory string `json:"data_directory,omitempty" jsonschema:"description=Directory for storing application data (relative to working directory),default=.crush,example=.crush"` // Relative to the cwd
- MaxMessages int `json:"max_messages,omitempty" jsonschema:"description=Maximum number of messages to keep in context (sliding window),default=50,minimum=10,maximum=200"`
}
type MCPs map[string]MCPConfig
@@ -315,9 +315,6 @@ func (c *Config) setDefaults(workingDir string) {
if c.Options.DataDirectory == "" {
c.Options.DataDirectory = filepath.Join(workingDir, defaultDataDirectory)
}
- if c.Options.MaxMessages < 10 {
- c.Options.MaxMessages = 50
- }
if c.Providers == nil {
c.Providers = csync.NewMap[string, ProviderConfig]()
}
@@ -355,8 +355,8 @@ func (a *agent) Run(ctx context.Context, sessionID string, content string, attac
}
genCtx, cancel := context.WithCancel(ctx)
- a.activeRequests.Set(sessionID, cancel)
+ a.activeRequests.Set(sessionID, cancel)
go func() {
slog.Debug("Request started", "sessionID", sessionID)
defer log.RecoverPanic("agent.Run", func() {
@@ -388,13 +388,6 @@ func (a *agent) processGeneration(ctx context.Context, sessionID, content string
return a.err(fmt.Errorf("failed to list messages: %w", err))
}
- // sliding window to limit message history
- maxMessagesInContext := cfg.Options.MaxMessages
- if maxMessagesInContext > 0 && len(msgs) > maxMessagesInContext {
- // Keep the first message (usually system/context) and the last N-1 messages
- msgs = append(msgs[:1], msgs[len(msgs)-maxMessagesInContext+1:]...)
- }
-
if len(msgs) == 0 {
// Use a context with timeout for title generation
titleCtx, titleCancel := context.WithTimeout(context.Background(), 30*time.Second)