Skip to content

V3.2.0

Choose a tag to compare

@liuqin164 liuqin164 released this 19 Jun 15:07
· 10 commits to main since this release
180c69b

Cogmem 3.2.0 — Context Cortex v1

Cogmem 3.2.0 introduces the first Context Cortex layer.

This release changes Cogmem from “retrieve relevant memory” toward “decide whether memory should surface, which memory layers are eligible, and how much context they may consume.”

The core rule of this release is:

Memory should not always surface.
Memory should surface only when useful, safe, relevant, and within budget.

Highlights

  • Added ContextCortex.
  • Added deterministic context intent classification.
  • Added layer-based memory activation.
  • Added hard safety suppression before ranking.
  • Added 25% default memory budget and 30% hard maximum.
  • Added source-first handling for exact quote requests.
  • Added persistent activation receipts.
  • Added schema migration 0019_context_cortex.
  • Exported Context Cortex APIs through the public surface.
  • Integrated Context Cortex into MemoryKernel.
  • Updated OpenClaw auto-memory plugin to version 0.2.0.
  • Added Context Cortex v1 regression tests.

Context Cortex

Cogmem now includes:

ContextCortex

The Context Cortex decides:

whether memory should surface
which memory layers are eligible
which candidates must be suppressed
how much memory context may be used
which selected/suppressed items should be recorded in an activation receipt

This is the first implementation of Cogmem’s context activation layer.


Context Intent Classification

Context Cortex classifies queries into:

greeting
short_followup
exact_quote
decision_history
preference_lookup
project_status
debugging
general_memory

Example behavior:

hi                         → greeting
继续                       → short_followup
我当时的原话是什么?        → exact_quote
Why did the decision change? → decision_history
What are my preferences?    → preference_lookup

This prevents Cogmem from treating every message as a full-memory-recall request.


Layer-Based Activation

Context Cortex organizes memory candidates into layers:

session_state
turn_bridge
belief
temporal
graph
raw_source
vector

Each intent activates a different set of layers.

Greeting

activated layers: none

All memory is suppressed.

Short follow-up

activated layers:
- session_state
- turn_bridge

This supports same-topic continuation without forcing full recall.

Exact quote

activated layers:
- raw_source
- graph
- belief

Raw source is prioritized over summaries for exact wording requests.

Decision history

activated layers:
- temporal
- belief
- raw_source
- graph

This lets historical questions use Temporal Memory and Belief Graph before falling back to source anchors.

General memory

activated layers:
- belief
- graph
- temporal
- raw_source
- vector

This keeps vector recall as a fallback rather than the first cognitive layer.


Hard Safety Suppression

Context Cortex applies hard suppression before ranking.

Suppression reasons include:

intent_suppresses_memory
layer_not_activated
project_boundary
superseded
current_session_echo
user_belief_without_user_evidence
sensitive_without_need
budget_exceeded
duplicate

This prevents unsafe or irrelevant memory from entering the prompt even when it has a high confidence score.

Suppressed examples

Context Cortex suppresses:

cross-project memory
superseded beliefs
current-session raw echo
user-owned beliefs without user-role evidence
sensitive candidates when not needed
memory outside the active intent layers
items that exceed the memory budget

This is the first layer where Cogmem actively decides what not to remember in the current prompt.


Context Budgeting

Context Cortex now enforces a bounded memory budget.

Default behavior:

memory budget = 25% of available tokens
hard maximum = 30% of available tokens

Example:

availableTokens = 16000
default memory budget = 4000 tokens
hard maximum = 4800 tokens

This moves Cogmem toward the “sweet spot” context strategy: enough memory to help, not enough memory to dominate the prompt.


Activation Receipts

Every Context Cortex plan emits an activation receipt.

A receipt records:

receiptId
query
intent
projectId
budgetTokens
usedTokens
selected items
suppressed items
suppression reasons
createdAt

When Context Cortex is backed by a database, receipts are persisted in:

context_activation_receipts

Activation receipts make memory activation auditable.

Agents and developers can inspect:

why a memory surfaced
why a memory was suppressed
how much budget was used
which intent controlled the context plan

Schema Migration 19

A new migration was added:

0019_context_cortex

It creates:

context_activation_receipts

with an index for project/time lookup.

The migration chain now includes:

0015_memory_governance
0016_entity_governance
0017_belief_graph
0018_temporal_memory
0019_context_cortex

Upgrading an older schema 14 database now applies all five migrations and sets the final schema version to:

19

Kernel Integration

MemoryKernel now exposes:

contextCortex

The kernel initializes Context Cortex with the same SQLite database used by the governed memory layers.

The memory stack now looks like:

Raw Ledger
→ Memory Binding
→ Entity Brain
→ Belief Graph
→ Temporal Memory
→ Context Cortex

Public API Updates

Context Cortex APIs are now exported through the public surface.

New exports include:

ContextCortex
ContextActivationPlan
ContextActivationReceipt
ContextCandidate
ContextIntent
ContextLayer
ContextPlanInput
ContextSuppressionReason

This lets host integrations use the Context Cortex directly without importing internal modules.


OpenClaw Auto-Memory Plugin 0.2.0

The OpenClaw auto-memory plugin was upgraded to:

0.2.0

New default config:

contextCortexEnabled: true
contextAvailableTokens: 16000
contextMemoryMaxRatio: 0.25

The plugin schema now exposes:

contextCortexEnabled
contextAvailableTokens
contextMemoryMaxRatio

Greeting suppression

For greetings such as:

hi
hello
你好

the plugin skips memory injection.

Short follow-up mode

For short continuations such as:

继续
接着
go on
continue

the plugin avoids full recall and uses only session state / turn bridge when available.

This prevents unnecessary memory recall for lightweight continuation turns.

Cortex-filtered recall

For normal recall, the plugin now:

runs the existing recall path
converts recall items into Context Cortex candidates
applies Context Cortex filtering
injects only selected items
emits an activation receipt

The activation receipt is included in audit logs.


Tests Added

New Context Cortex v1 tests cover:

  • greeting queries suppress all memory;
  • short same-topic follow-ups select only session state and turn bridge;
  • exact quote requests prioritize raw source and graph anchors;
  • context packing stays inside budget;
  • hard safety filters run before ranking;
  • activation receipts are persisted when a database is provided.

Migration tests were also updated to verify that schema 14 databases plan and apply:

0015
0016
0017
0018
0019

and reach schema version:

19

OpenClaw plugin tests now check:

Context Cortex config fields
greeting suppression
short follow-up recall mode
bridge-side kernel.contextCortex.plan usage
activationReceipt output

Current Scope

Cogmem 3.2.0 is the first Context Cortex release.

It does not yet implement a full semantic candidate builder from all governed memory stores. In this version, Context Cortex primarily filters and packs candidates supplied by recall or host integrations.

It also uses deterministic intent rules rather than an advanced domain-aware planner.

This is intentional for v1.

The release establishes the safe activation contract first:

classify intent
activate eligible layers
suppress unsafe candidates
fit within budget
record receipt

Future versions can make candidate generation and planning smarter without weakening the safety boundary.