Skip to content

Focus Mode

Focus Mode is a specialized cognitive scoring strategy that simulates sustained attention — the ability to deeply concentrate on a single topic while filtering out irrelevant information.

Two profiles use focus-oriented mechanics: HYPERFOCUS (strict retrieval tunnel) and SYSTEMATIZER (lossless knowledge accumulation).


HYPERFOCUS — Strict Retrieval Tunnel

When an agent activates Focus Mode, three things change in the 6-Phase Scoring Pipeline:

1. Strict Tag Gate (Phase 2)

Only memories whose synaptic tags exactly match the focus mask pass through. This is a bitwise AND check:

if (recordTags & hyperfocusMask) != hyperfocusMask → SKIP

Unlike normal tag filtering (which accepts partial overlap), Focus Mode requires all focus tags to be present. This creates a narrow retrieval tunnel — only deeply relevant memories survive.

2. Zero Decay (Phase 4)

For tag-matched memories, the time decay factor is clamped to 1.0:

adjustedBucket = 0  // no time decay for focused memories

This means old memories about the focused topic are treated as if they were just created. A 6-month-old memory about "database deadlocks" is equally accessible as one from today — as long as the tags match.

3. Post-Score Boost (Phase 6)

After the standard cognitive score is computed, focus-matched memories receive a configurable multiplier:

finalScore = score × hyperfocusBoost  // default: 1.5×

This ensures focused memories consistently outrank non-focused ones in the final result list.

Usage

memory.recall("database deadlock",
    profile: HYPERFOCUS,
    hyperfocusMask: ["database", "deadlock"],   // Bloom filter encoded
    hyperfocusBoost: 2.0)                       // custom boost

TTL and Self-Extension

Focus Mode is governed by a TTL-based state machine:

flowchart LR
    DETECT["Agent detects<br/>focused topic"] --> ACTIVATE["Activate focus<br/><i>tags + 30 min TTL</i>"]
    ACTIVATE --> ACTIVE{"Topic continues?"}
    ACTIVE -->|"Yes"| EXTEND["Extend TTL<br/><i>+30 min or custom</i>"]
    EXTEND --> ACTIVE
    ACTIVE -->|"No — TTL expires"| DEACTIVATE["Auto-deactivate"]
    ACTIVE -->|"Manual"| DEACTIVATE

    style ACTIVATE fill:#e74c3c,color:white
    style EXTEND fill:#f39c12,color:white
    style DEACTIVATE fill:#95a5a6,color:white

Available operations:

Operation Description
activate(tags) Start focus with 30 min TTL
extend() Add another 30 minutes
extend(ms) Add custom duration
isActive() Check if focus is currently on
remainingMs() Time remaining before expiry
deactivate() Stop focus immediately

Agent Self-Extension

The extend() method is designed to be called by the agent itself. When the agent detects that the conversation is still focused on the same topic, it extends the TTL. When the topic naturally shifts, the TTL expires and Focus Mode deactivates automatically.


SYSTEMATIZER — Lossless Knowledge Accumulation

The Systematizer profile is designed for agents that need to build comprehensive knowledge bases — where losing detail during consolidation is unacceptable.

Scoring Weights

Parameter Value Rationale
α (similarity) 0.3 Low — details matter more than semantic similarity
β (importance) 0.7 High — prioritizes learned importance

Persistent Memory Pinning

The key feature of SYSTEMATIZER is lossless consolidation. During the sleep consolidation cycle (REM sleep), the system normally clusters similar episodic memories and promotes a summary to semantic memory. The source episodes may then be tombstoned.

With SYSTEMATIZER, source episodes are pinned — they receive the pinned flag in their record header, which prevents tombstoning:

Episodic: [mem-1] [mem-2] [mem-3] → Cluster → Semantic summary created
                        Standard: mem-1, mem-2, mem-3 tombstoned
                        Systemizer: mem-1, mem-2, mem-3 PINNED ✓

Quota Management

To prevent unbounded memory growth, pinning is governed by a configurable quota (default: 10,000 pinned records). When the quota is reached, the oldest pinned records are eligible for tombstoning during the next consolidation cycle.

Use Cases

  • Legal/compliance agents that must retain all original evidence
  • Research agents building encyclopedic knowledge bases
  • Audit trails where summarization must not lose detail

Performance Impact

Zero Overhead When Disabled

All Focus Mode mechanics are gated by hyperfocusMask != 0 in the hot loop. When no focus is active (the default), the code paths are identical to standard scoring — zero additional cost.

Mechanic Hot-Loop Cost When Active
Tag gate ~2 cycles (bitwise AND) Only when hyperfocusMask != 0
Decay clamp ~1 cycle (conditional) Only for tag-matched records
Boost multiply ~1 cycle (float multiply) Only for tag-matched records
Episode pinning 0 (off hot loop) During consolidation only