Skip to main content
implementedInspired by Cephalopod chromatophore networks (octopus, cuttlefish)

Chromatophore Context

Counterpart to Flat context windows / sliding-window truncation in LLM agents

Key Properties

  • Commitment topology: items carry lifecycle state (Discussed, Decided, Committed, Completed, Superseded) with priority protection
  • Dependency-driven auto-advancement: blocked items express automatically when their blockers complete
  • Interrupt/resume: working sets are saved and restored across task switches via a bounded stack
  • Hippocampal consolidation: cross-task references promote items; unreferenced items decay
  • Immune selection: committed items resist suppression; superseded items are immediately dormanted
  • Per-tick overhead: 161us at 200 items (600x cheaper than a fast LLM call)

Operation Complexity

Side-by-side comparison with the classical counterpart.

Operation complexity comparison
OperationChromatophore ContextFlat context windows / sliding-window truncation in LLM agents
activate (per agent step)O(N log N)O(1) (no activation management)
introduce itemO(1)O(1) (append to context)
interrupt/resume cycleO(N log N)N/A (no interrupt support)
maintenance tick (decay + consolidation)O(N)N/A
dependency resolutionO(D)N/A

Interface Preview

chromatophore_context.rs
rust
1pub struct ChromatophorePolicy { /* ... */ }
2
3impl ChromatophorePolicy {
4    pub fn new(config: ChromatophoreConfig) -> Result<Self, ChromatophoreError>;
5    pub fn balanced() -> Self;
6
7    // Item lifecycle
8    pub fn introduce(&mut self, content: String, commitment: CommitmentLevel) -> ItemId;
9    pub fn reference(&mut self, id: ItemId);
10    pub fn decide(&mut self, id: ItemId);
11    pub fn commit(&mut self, id: ItemId);
12    pub fn complete(&mut self, id: ItemId);
13    pub fn supersede(&mut self, id: ItemId, superseded_by: ItemId);
14    pub fn add_blocks(&mut self, from: ItemId, to: ItemId);
15
16    // Activation (call before each LLM step)
17    pub fn activate(&mut self) -> ActivationResult;
18
19    // Interrupt/Resume
20    pub fn interrupt(&mut self, signal: &InterruptSignal) -> ActivationPlan;
21    pub fn resume(&mut self) -> Result<ActivationPlan, ChromatophoreError>;
22}
23
24impl Maintainable for ChromatophorePolicy {
25    fn tick(&mut self) -> MaintenanceReport;
26}
27
chromatophore_context.ts
typescript
1// Pure TypeScript (no WASM required — this is a policy, not a data structure)
2class ChromatophorePolicy {
3  constructor(config?: ChromatophoreConfig);
4
5  // Item lifecycle
6  introduce(content: string, commitment: CommitmentLevel): ItemId;
7  reference(id: ItemId): void;
8  decide(id: ItemId): void;
9  commit(id: ItemId): void;
10  complete(id: ItemId): void;
11  supersede(id: ItemId, supersededBy: ItemId): void;
12  addBlocks(from: ItemId, to: ItemId): void;
13
14  // Activation
15  activate(): ActivationResult;
16
17  // Interrupt/Resume
18  interrupt(signal: InterruptSignal): ActivationPlan;
19  resume(): ActivationPlan;
20
21  // Introspection
22  readonly tick: number;
23  readonly expressedCount: number;
24  readonly interruptDepth: number;
25  stats(): SessionStats;
26}
27

Where This Matters

LLM Agent Frameworks (LangChain, CrewAI, AutoGen)

Context Window Management

Improvement comparison
TodayWith Chromatophore ContextHow
Flat context with sliding-window truncationSelective activation with commitment-aware priority scoringCommitted items resist suppression; discussed tangents decay naturally; the agent always sees the highest-priority working set
No interrupt recovery (context lost after tangents)Bounded interrupt stack saves and restores working setsTask switches save the current expressed set; when the interrupt resolves, the prior context resumes at the point of interruption
No dependency tracking between context itemsDependency graph with auto-advancement on blocker completionWhen task A completes, task B (which was blocked by A) automatically enters the active working set

Interactive Simulation

Discussion

Questions, ideas, or experiences with Chromatophore Context? Join the discussion.