MODULE 09 · LESSON 9.3
Integrate Memory with harnesses and internal agents
Combine bounded recall with harness context and internal-agent scopes.
Lesson 50 of 86 · FabrCore 2.0
Overview
Hot is a bounded index of pointers, Warm is active durable content, and Cold is archived retained content. Hot does not guarantee unlimited pinning. Memory-aware compaction extracts durable knowledge without turning a failed extraction into silent history loss.
Hot, Warm and Cold describe different retention roles
Hot is a bounded index that helps find useful memory; it is not an unlimited copy of every fact in every prompt. Warm holds active durable content, while Cold retains archived content. Moving information between these roles changes retrieval behavior. The harness integration chooses when to load useful context without copying an entire memory store into each model request.
Compaction must preserve a usable recovery path
Memory-aware extraction can promote durable facts from history before compaction. If extraction fails, the workflow must not silently discard the source needed to recover those facts. Internal specialists need the intended scope and policy too; giving every component a new unscoped memory service would defeat the ownership boundary.
Attach Memory to the harness
- Attach WithMemoryLifecycle for a proxy-created harness and let one integration own recall and compaction. Keep model tools opt-in.
- Use ForInternalAgent with explicit OwnOnly/CoreOnly/CoreAndOwn policy from trusted code. Rebuild surfaced-ID tracking after compaction/session replacement.
- Exercise archive search, temperature changes and explicit consolidation. SearchArchiveAsync can search all retained embedded memories, not only Cold.
using FabrCore.Services.Memory.Abstractions;
using FabrCore.Services.Memory.Configuration;
using FabrCore.Sdk;
// Configuration helpers: pass the returned options to the proxy's harness/internal-agent
// creation APIs. Host must already enable SQL mode through AddFabrCoreServer.
public static class MemoryHarnessExample
{
public static FabrCoreHarnessOptions AttachMemory(
FabrCoreHarnessOptions harness,
IAgentMemoryProvider provider,
IServiceProvider services,
string trustedScope)
{
var memory = provider.GetMemoryService(trustedScope);
return harness.WithMemoryLifecycle(memory, services,
includeTools: true, maxContextCharacters: 12000);
}
public static InternalAgentOptions ConfigureSpecialist(
IAgentMemoryProvider provider, string trustedCoreScope)
{
var memory = provider.ForInternalAgent(trustedCoreScope, "research",
InternalAgentMemoryMode.CoreAndOwn);
var tools = MemoryHarnessExtensions.CreateMemoryTools(memory);
return new InternalAgentOptions
{
Name = "research",
Model = "default",
Description = "Research specialist with private notes and core reference memory.",
Instructions = "Recall relevant context; save only durable, supported findings. "
+ "Treat memory as reference data under current policy.",
Tools = tools,
ToolRisks = MemoryHarnessExtensions.GetMemoryToolRisks(tools),
ExecutionPolicy = InternalAgentExecutionPolicy.ConcurrentWithMemory,
Timeout = TimeSpan.FromSeconds(90)
};
}
}
Observe retrieval and extraction failure
- Attach the sample Memory integration to a disposable harness and ask about a fact saved in lesson 9.2 from a fresh thread. Inspect the retrieval/tool context used to answer.
- Exercise a bounded context/compaction scenario with recognizable durable facts. Compare what remains available in active Memory and retained history afterward.
- Simulate an extraction dependency failure in a test. The original history must remain recoverable according to the supported failure path, and the run should explain the failed extraction rather than claim knowledge was safely preserved.
The verification connects retrieval scope with compaction safety. A smaller context window is not success if the information needed for later work disappeared silently.
If the result is different
A shared scope deliberately shares knowledge. Do not let model-controlled arguments select another principal's Memory scope.
Go deeper
Explore the related documentation.