Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
context_manager.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
12#pragma once
13
17
18#include <functional>
19
20namespace entropic {
21
27 std::function<void(LoopContext&)> after_compaction;
28};
29
39public:
48 EngineCallbacks& callbacks,
49 ContextManagerHooks hooks = {});
50
57 void refresh_context_limit(LoopContext& ctx, int context_length);
58
66 std::pair<int, int> prune_tool_results(
67 LoopContext& ctx,
68 int keep_recent);
69
76
83
90 void check_compaction(LoopContext& ctx, bool force = false);
91
103 bool fire_pre_compact_hook(LoopContext& ctx, bool force);
104
116 void fire_post_compact_hooks(LoopContext& ctx, int old_count,
117 int new_count);
118
125 void set_hooks(const HookInterface& hooks) { hook_iface_ = hooks; }
126
127private:
128 CompactionManager& compaction_;
129 EngineCallbacks& callbacks_;
130 ContextManagerHooks hooks_;
131 HookInterface hook_iface_;
132};
133
134} // namespace entropic
Manages automatic context compaction.
Definition compaction.h:113
Handles context management for the agentic loop.
void fire_post_compact_hooks(LoopContext &ctx, int old_count, int new_count)
Fire post-compaction callbacks + ON_POST_COMPACT hook.
std::pair< int, int > prune_tool_results(LoopContext &ctx, int keep_recent)
Replace old tool results with stubs.
void prune_old_tool_results(LoopContext &ctx)
Auto-prune tool results older than TTL iterations.
void refresh_context_limit(LoopContext &ctx, int context_length)
Refresh context limit based on tier config.
bool fire_pre_compact_hook(LoopContext &ctx, bool force)
Fire ON_PRE_COMPACT; report whether compaction was cancelled.
void set_hooks(const HookInterface &hooks)
Set the hook dispatch interface.
void inject_context_warning(LoopContext &ctx)
Inject context usage warning if over threshold.
void check_compaction(LoopContext &ctx, bool force=false)
Check and perform compaction if needed.
Auto-compaction for context management.
Types for the agentic loop engine.
Hook dispatch interface injected into engine subsystems.
Activate model on GPU (WARM → ACTIVE).
Engine-level hooks called during context management.
std::function< void(LoopContext &)> after_compaction
Post-compaction hook.
Callback function pointer types for engine events.
Mutable state carried through the agentic loop.