Skip to content

V3.4.0

Choose a tag to compare

@liuqin164 liuqin164 released this 20 Jun 10:30
· 6 commits to main since this release
f7681fc

Cogmem 3.4.0 — Strategy Cortex v1

Cogmem 3.4.0 introduces Strategy Cortex v1: a deterministic current-turn memory strategy layer inspired by StraTA’s separation between global strategy and local execution.

This release does not add online reinforcement learning. It does not generate multiple online strategies per user turn. Instead, Cogmem now chooses a CPU-owned strategy capsule before recall, uses that capsule to constrain retrieval lanes and context packing, and reserves diverse strategy comparison for offline BrainEval.

The core rule of this release is:

Strategy before recall.
Strategy has no instruction authority.
Online planning stays deterministic.
Offline evaluation compares strategy quality.

Highlights

  • Added Strategy Cortex v1.
  • Added current-turn Strategy Capsules.
  • Added Strategy Template Registry.
  • Added strategy-conditioned candidate building.
  • Added <COGMEM_STRATEGY_CONTEXT>.
  • Added deterministic one-retry replanning.
  • Added read-only Memory Use Judge.
  • Added project-scoped Context Outcome Store.
  • Added Context Policy Scorer.
  • Added Strategy Diversity Selector.
  • Added Strategy Rollout Evaluator.
  • Added cogmem strategy plan.
  • Added cogmem strategy outcomes.
  • Added cogmem brain-eval --strategy-rollout.
  • Added read-only MCP tool cogmem_strategy_plan.
  • Updated OpenClaw auto-memory plugin to 0.3.0.
  • Added schema migration 0021_strategy_cortex.
  • Extended forgetUser(projectId) to remove strategy outcome telemetry.
  • Updated documentation and release metadata to 3.4.0.

Strategy Cortex

Cogmem now includes a Strategy Cortex layer that runs before non-trivial memory recall.

Strategy Cortex selects one deterministic strategy template for the current turn, such as:

source-first
temporal-first
user-belief-first
project-state
graph-source
balanced-memory

The selected strategy controls:

retrieval lane preferences
context layer order
required memory layers
exact-source requirements
source drill-down policy
memory budget policy
suppression priorities
replan triggers

This moves Cogmem from “retrieve memory first, decide later” to “decide how to use memory, then retrieve.”


Strategy Capsules

A Strategy Capsule is a current-turn memory-use policy.

It is not durable memory.

It is not a user instruction.

It is not a system prompt.

It has no authority to override user messages, host policy, tool authorization, or memory governance.

A capsule can include:

strategyId
projectId
intent
templateName
goal
retrievalLanes
contextLayerOrder
requiredLayers
sourcePolicy
suppressionPolicy
budgetPolicy
riskPolicy
replanPolicy
instructionAuthority
createdAt
expiresAt

The important field is:

instructionAuthority: "none"

This makes the strategy an internal planning hint, not a command.


Strategy Templates

The new Strategy Template Registry provides deterministic memory strategies for common query shapes.

Examples:

Source-first

Used for exact wording, quotes, verification, and source-sensitive questions.

Behavior:

prefer raw_source and graph anchors
require exact source when the user asks for original wording
avoid answering exact wording from summary-only memory

Temporal-first

Used for decision history, correction history, and timeline questions.

Behavior:

prefer temporal memory
then belief history
then graph anchors
then raw source for disputed points

User-belief-first

Used for user preferences, goals, and boundaries.

Behavior:

prefer user-owned beliefs
require user evidence for user-owned memory
suppress assistant-only and tool-only user claims

Project-state

Used for project status and roadmap questions.

Behavior:

prefer current active beliefs
then temporal milestones
then prospective open loops
then graph anchors

Graph-source

Used for debugging, evidence tracing, and relationship questions.

Behavior:

prefer graph anchors
then source context
then belief and temporal support

Balanced-memory

Used as a general fallback when no more specific strategy applies.


Strategy-Conditioned Candidate Building

Strategy Cortex now influences candidate construction before Context Cortex packing.

This is stronger than post-filtering.

The selected strategy can decide:

which lanes should be queried
which memory layers should be prioritized
which layers are required
whether raw source drill-down is necessary
whether vector fallback is allowed
how much memory budget may be used

This makes recall more purposeful and reduces unnecessary memory expansion.


Deterministic Replanning

Strategy Cortex supports at most one deterministic replan.

Replanning may occur when:

intent changes
project scope changes
exact-source requirement is not satisfied
evidence conflict is detected
required layer budget is unsatisfied

The replan is deterministic.

It does not call an online strategy generator.

It does not run multi-strategy rollout.

It does not perform reinforcement learning.


<COGMEM_STRATEGY_CONTEXT>

OpenClaw integration now supports a fourth Cogmem-owned block:

<COGMEM_STRATEGY_CONTEXT>

This block describes the current-turn memory-use policy.

It is explicitly:

not a user instruction
not a system instruction
not durable memory
not raw evidence
not tool authorization
not a governance operation

It must be stripped before recording and must not be ingested by Dream, Binding, Belief Graph, or Raw Ledger.

The host context blocks now are:

<COGMEM_SESSION_STATE>
<COGMEM_TURN_BRIDGE>
<COGMEM_STRATEGY_CONTEXT>
<COGMEM_RECALL_CONTEXT>

OpenClaw Plugin 0.3.0

The OpenClaw auto-memory plugin was updated to 0.3.0.

It now:

skips Cogmem for greetings
uses session state / turn bridge for short continuations
runs Strategy Cortex before full recall
injects <COGMEM_STRATEGY_CONTEXT>
passes the strategy capsule into recall/context packing
records read-only context outcome telemetry after the turn

The plugin keeps OpenClaw’s native prompt untouched.

Cogmem only prepends bounded, explicitly marked memory blocks.


Read-Only Memory Use Judge

Cogmem now includes a Memory Use Judge.

It evaluates whether memory was used correctly, but it cannot mutate durable memory.

It can flag:

exact quote without source
assistant-only user belief used
tool-only user belief used
superseded memory used
irrelevant memory injected
over-budget memory pack
strategy not followed
source required but missing
unsafe memory leak
stale memory leakage
cross-project leakage

The judge writes telemetry only.

It cannot:

change beliefs
merge entities
rewrite timelines
confirm prospective memory
delete memories
run tools

Durable memory changes must still go through CPU governance.


Context Outcome Store

Strategy Cortex now has project-scoped context outcome telemetry.

A context outcome can record:

receiptId
strategyId
projectId
intent
score
violations
usefulMemoryIds
harmfulMemoryIds
missingLayers
latencyMs
createdAt

This lets Cogmem inspect how well memory strategies performed over time.

forgetUser(projectId) now also removes strategy outcome telemetry for that project.


Context Policy Scorer

Cogmem now includes a Context Policy Scorer for offline evaluation.

It scores precomputed strategy rollout outcomes using:

median score
worst-decile score
top-fraction score
exact source fidelity
strategy adherence
unsafe leak rate
stale leak rate
cross-project leak rate
over-budget rate
p95 latency

The top-fraction score is diagnostic only.

It cannot override safety failures.

A strategy with high upside but unsafe leakage still fails the release gate.


Strategy Diversity Selector

Cogmem now includes an offline Strategy Diversity Selector.

It can select diverse strategy candidates from supplied vectors using farthest-point style selection.

This is intended for offline fixture construction and benchmark coverage.

It is not used for online per-turn strategy generation.


Strategy Rollout Evaluator

Cogmem now supports offline strategy rollout evaluation over precomputed outcomes.

This is the safe version of StraTA-style strategy comparison.

Cogmem does not run online multi-strategy exploration during user conversations.

Instead:

BrainEval consumes precomputed outcomes.
Policy scoring compares strategy quality.
Release gates enforce safety thresholds.
Runtime uses the best deterministic template.

cogmem strategy CLI

A new CLI was added:

cogmem strategy plan --project <projectId> --query "<query>" --json
cogmem strategy outcomes --project <projectId> --json

strategy plan

Returns the deterministic current-turn strategy capsule for a query.

It does not perform recall.

It does not mutate memory.

strategy outcomes

Returns read-only context outcome telemetry.

It does not modify beliefs, entities, timelines, or prospective memories.


BrainEval Strategy Rollout Mode

cogmem brain-eval now supports:

cogmem brain-eval --input strategy-outcomes.json --strategy-rollout --json

This mode consumes precomputed StrategyRolloutOutcome records.

It does not:

call a model
generate strategies online
run online rollouts
mutate memory

It reports:

median quality
worst-decile quality
top-fraction diagnostic score
source fidelity
strategy adherence
unsafe leakage
stale leakage
cross-project leakage
budget compliance
p95 latency

Safety failures remain zero-tolerance.


MCP: cogmem_strategy_plan

A new read-only MCP tool was added:

cogmem_strategy_plan

It exposes the deterministic memory policy for agent inspection.

It does not perform recall.

It does not execute tools.

It does not mutate memory.

cogmem_recall now returns its strategyCapsule, while cogmem_strategy_plan exposes the policy without recall.

Hermes MCP allow-list patching now includes:

cogmem_strategy_plan
cogmem_memory_map
cogmem_maintenance_tick
cogmem_prospective

Schema Migration 21

A new migration was added:

0021_strategy_cortex

It introduces Strategy Cortex outcome telemetry storage.

The governed schema stack now includes:

0015_memory_governance
0016_entity_governance
0017_belief_graph
0018_temporal_memory
0019_context_cortex
0020_prospective_memory
0021_strategy_cortex

The core schema version is now:

21

Public API Updates

The public API now exports Strategy Cortex and strategy evaluation surfaces, including:

StrategyCortex
StrategyCapsule
StrategyTemplateRegistry
StrategyConditionedCandidateBuilder
StrategyContextFormatter
MemoryUseJudge
ContextOutcomeStore
ContextPolicyScorer
StrategyDiversitySelector
StrategyRolloutEvaluator

These exports allow host integrations and release tests to inspect strategy planning and offline strategy quality without importing private implementation paths.


Hygiene Updates

Strategy metadata is now excluded from durable memory paths.

The branch updates context hygiene so that:

<COGMEM_STRATEGY_CONTEXT>

is stripped before recording and cannot become:

raw ledger user evidence
Dream candidate evidence
Binding evidence
Belief Graph evidence
tool authorization
governance operation input

Routing and LLM tool schema prompts were also updated so reasoning models treat strategy context as sidecar policy, not as an instruction source.


Tests Added

New tests cover:

  • Strategy Cortex template selection.
  • Source-first strategy for exact quote requests.
  • Temporal-first strategy for decision history.
  • User-belief-first strategy for preference lookup.
  • Project-state strategy for roadmap/project questions.
  • Graph-source strategy for debugging.
  • Strategy Capsule no-instruction-authority guarantee.
  • Strategy-conditioned candidate building.
  • <COGMEM_STRATEGY_CONTEXT> hygiene.
  • OpenClaw plugin strategy block injection.
  • MCP cogmem_strategy_plan.
  • cogmem strategy plan.
  • cogmem strategy outcomes.
  • Memory Use Judge violation detection.
  • Context Policy Scorer safety gates.
  • Strategy Diversity Selector offline selection.
  • BrainEval strategy rollout mode.
  • Migration to schema 21.

Current Scope

Cogmem 3.4.0 is Strategy Cortex v1.

It intentionally avoids:

online RL
online multi-strategy generation
automatic tool execution
strategy authority over user instructions
strategy authority over memory governance

The release implements the safe engineering version of strategy/action separation:

deterministic strategy online
offline strategy comparison
read-only memory-use judgment
zero-tolerance safety gates