MemoryStore.BuildPromptBlock* hard-codes a 8,000-character cap on how much memory is injected into the system prompt. The value is never exposed to the user.
CompactionConfig.MaxCharsPerHistoryMessage is the direct precedent: same default, same rationale (token budget), already documented and user-facing. MemoryConfig (src/Core/Models/MemoryConfig.cs) exists but only covers Provider and Webhook — it has no tuning knobs.
Suggested change:
-
Add a property to MemoryConfig:
/// <summary>
/// Maximum characters injected into the system prompt from the memory store.
/// Default: <c>8000</c> (~2 000 tokens). Raise for large-context models; lower for small ones.
/// </summary>
public int MaxPromptBlockChars { get; init; } = 8_000;
-
Update MemoryStore.BuildPromptBlock and BuildPromptBlockAsync to accept an optional int maxChars = 8_000 parameter.
-
Pass the config value at the two call sites:
src/Infrastructure/AgentFactory.cs:124 — MemoryStore.ForAgent(config.Name).BuildPromptBlock()
src/Cli/Commands/Repl/ReplCommand.cs:167 — memoryStore.BuildPromptBlockAsync(cwd)
Both callers have access to a MemoryConfig or can reach it via OrchestrationConfig — check how CompactionConfig.MaxCharsPerHistoryMessage is accessed at its call sites for the right pattern.
-
Add a test case to tests/FuseraftCli.Tests/MemoryStoreTests.cs verifying that the block is truncated at the configured limit.
Files to touch:
src/Core/Models/MemoryConfig.cs
src/Infrastructure/MemoryStore.cs
src/Infrastructure/AgentFactory.cs
src/Cli/Commands/Repl/ReplCommand.cs
tests/FuseraftCli.Tests/MemoryStoreTests.cs
MemoryStore.BuildPromptBlock*hard-codes a 8,000-character cap on how much memory is injected into the system prompt. The value is never exposed to the user.CompactionConfig.MaxCharsPerHistoryMessageis the direct precedent: same default, same rationale (token budget), already documented and user-facing.MemoryConfig(src/Core/Models/MemoryConfig.cs) exists but only coversProviderandWebhook— it has no tuning knobs.Suggested change:
Add a property to
MemoryConfig:Update
MemoryStore.BuildPromptBlockandBuildPromptBlockAsyncto accept an optionalint maxChars = 8_000parameter.Pass the config value at the two call sites:
src/Infrastructure/AgentFactory.cs:124—MemoryStore.ForAgent(config.Name).BuildPromptBlock()src/Cli/Commands/Repl/ReplCommand.cs:167—memoryStore.BuildPromptBlockAsync(cwd)Both callers have access to a
MemoryConfigor can reach it viaOrchestrationConfig— check howCompactionConfig.MaxCharsPerHistoryMessageis accessed at its call sites for the right pattern.Add a test case to
tests/FuseraftCli.Tests/MemoryStoreTests.csverifying that the block is truncated at the configured limit.Files to touch:
src/Core/Models/MemoryConfig.cssrc/Infrastructure/MemoryStore.cssrc/Infrastructure/AgentFactory.cssrc/Cli/Commands/Repl/ReplCommand.cstests/FuseraftCli.Tests/MemoryStoreTests.cs