Skip to content

V3.5.1

Choose a tag to compare

@liuqin164 liuqin164 released this 20 Jun 15:33
· 2 commits to main since this release
794662a

Cogmem 3.5.1 — Episode Dream Engine Hardening

Cogmem 3.5.1 hardens the Episode Dream Engine introduced in 3.5.0.

This release does not add a new memory layer. Instead, it strengthens episode classification, assistant-context handling, topic-boundary detection, Dream retry behavior, import idempotency, MCP safety, and Dream evidence validation.

The core design remains:

Raw Ledger
→ Episode Assembler
→ Sealed Episode
→ Dream Scheduler
→ Episode Dream Curator
→ Governance

The goal of this release is:

Make Episode Dream Engine harder to misclassify, duplicate, over-dream, or accidentally promote unsafe memory.

Highlights

  • Upgraded turn classification with richer context and confidence metadata.
  • Added advisory hybrid classification support for ambiguous cases.
  • Added assistant-context handling for short user replies.
  • Added explicit assistant/tool relation semantics.
  • Split topic movement into hard topic switches, subtopic shifts, and ambiguous shifts.
  • Added episode tags, candidate types, importance signals, and importance reasons.
  • Added semantic episode summaries as non-evidence hints.
  • Added episode-level Dream status.
  • Added stronger closure receipt metadata.
  • Added Dream retry controls with retryable, terminal, and scheduled retry states.
  • Made Dream mode affect curator behavior, not just batch size.
  • Added episode-scoped exact evidence enforcement for Dream candidates.
  • Added assistant-proposal + user-confirmation evidence modeling.
  • Added temporal decision candidates for decision episodes.
  • Added streaming JSONL import with checkpoint/resume support.
  • Reworked generated import IDs to avoid line-index dependence.
  • Added MCP maintenance-mode guard for Dream ticks.
  • Improved MCP status output for hookless agents.
  • Added schema migration 0023_episode_dream_hardening.
  • Updated OpenClaw plugin metadata to 0.4.1.
  • Updated core version to 3.5.1.
  • Updated schema version to 23.

Richer Turn Classification

Turn classification now accepts structured conversation context instead of only a single text string.

The classifier can use:

currentUserText
currentAssistantText
previousUserText
previousAssistantText
activeEpisodeSummary
activeEpisodeTopicPath
recentRelations

The classifier now returns:

relation
confidence
signals
needsLlmReview
candidateTypes
topicPath
closureCandidate
switchKind
episodeType
importance
rationale

This makes episode assembly more inspectable and safer.


Hybrid Classifier Support

Cogmem now supports an advisory hybrid classifier path.

CPU rules still run first.

LLM review may be requested only for ambiguous or high-value cases, such as:

ambiguous topic shifts
possible corrections
possible decisions
possible prospective intent
short replies that depend on assistant context
messages that match multiple strong rules

The advisory reviewer can suggest classification fields, but it cannot mutate memory.

Any model-shaped mutation output is ignored.

Durable memory still requires CPU governance.


Assistant Context for Short Replies

Short user replies such as:

yes
对
不对
第二个
可以

can now be resolved against the previous assistant message.

This allows Cogmem to identify:

accepts_assistant_proposal
rejects_assistant_proposal
answers_assistant_question
continues_previous

A confirmation like:

assistant: I recommend the second option. Should we use it?
user: yes

can now become an explicit confirmed-proposal relation candidate instead of a vague continuation.


Explicit Assistant and Tool Relations

Assistant and tool messages no longer reuse user-turn relation semantics.

New relation types include:

assistant_response
assistant_proposal
assistant_summary
assistant_question
assistant_clarification
tool_result_context

This produces cleaner episode relation graphs and prevents assistant output from being misread as user memory.


Safer Topic Movement

Topic movement is now classified more carefully.

Instead of treating all topic movement as a hard switch, Cogmem distinguishes:

hard_topic_switch
subtopic_shift
ambiguous_shift

Behavior:

hard_topic_switch → hard-seal the old episode
subtopic_shift → continue the same episode
ambiguous_shift → soft-seal the old episode and create a reviewable linked episode

This prevents same-project subtopics from being split too aggressively.


Semantic Episode Summary

Sealed episodes now receive a semantic summary.

The summary may contain:

userPosition
assistantContribution
decision
correction
openQuestions
candidateTypes
evidenceEventIds
evidenceAuthority

Important rule:

Episode semantic summaries are hints, not evidence.
Only raw event IDs are evidence.

Dream can use the summary to understand the episode, but every candidate must still cite raw event IDs.


Stronger Episode Metadata

Episodes now track:

episodeTags
candidateTypes
importanceSignals
importanceReason
linkedEpisodeId
dreamStatus
lastDreamRunId
lastDreamedAt
dreamCandidateCount
dreamError

This makes episode state, Dream progress, and review/debugging easier to inspect.


Stronger Closure Receipts

Closure receipts now include:

closureReasonCode
closureReasonDetail
requiresReview
ignoredNearbyEventIds
unassignedNearbyEventIds

Closure reason codes include:

explicit_user_closure
topic_switch
batch_boundary
idle_timeout
manual
soft_seal_stabilized
repair

Low-confidence batch seals can now require review instead of entering Dream directly.


Episode-Level Dream Status

Dream state is now visible directly on the episode.

Episode state and Dream state are separate:

episode.status = open | soft_sealed | sealed
episode.dreamStatus = none | queued | processing | processed | failed

Episodes also track:

lastDreamRunId
lastDreamedAt
dreamCandidateCount
dreamError

This improves debugging, repair, and operator visibility.


Dream Retry Controls

Dream job states now include:

pending
processing
processed
failed_retryable
failed_terminal
retry_scheduled
skipped

Dream jobs now support:

retryAfter
failureCategory
lease recovery
terminal failure classification
manual retry for retryable failures

Validation-like failures become terminal.

Provider/rate-limit/timeout-like failures become retryable with delayed retry.

This prevents failed Dream jobs from being blindly reprocessed on every tick.


Dream Mode Now Affects Curator Behavior

Dream mode is now passed into the Dream Curator.

Modes affect both candidate limits and curation behavior:

micro  → eventLimit 20, maxCandidates 20
normal → eventLimit 100, maxCandidates 100
deep   → eventLimit 500, maxCandidates 500

The Dream Curator also receives:

dreamMode
sourceEpisodeId
sourceEpisodeEventIds
episodeType
closureReason
semanticSummary
episodeRelations

This makes micro/normal/deep meaningful beyond batch size.


Exact Episode Evidence Enforcement

Episode-scoped Dream runs now enforce exact raw evidence.

For episode Dream, every candidate must cite a non-empty subset of the episode’s raw event IDs.

Candidates using summary-only evidence or ["all"] are rejected.

Dream candidate content is annotated with:

sourceEpisodeId
evidenceAuthority: raw_event_ids_only
evidenceEventIds
dreamMode
episodeType
closureReason

This keeps Dream source-grounded.


Assistant Proposal Confirmed by User

Cogmem now models assistant proposal + user confirmation as a paired evidence relation.

When an assistant proposal is followed by a user confirmation, Dream can emit:

assistant_proposal_confirmed_by_user

The candidate stores:

proposalEvidenceEventId
confirmationEvidenceEventId
evidenceKind: assistant_proposal_confirmed_by_user

This avoids treating assistant text as user memory unless the user explicitly confirms it.


Decision Episodes Emit Temporal Candidates

Decision episodes now create temporal decision candidates.

For an episode classified as a decision, Dream can emit:

temporal_fact_update
promotionTargetType: temporal_decision

The candidate includes:

occurredAt
startSeq
endSeq
source event evidence

This improves historical decision recall and project timeline reconstruction.


Orphan Correction Safety

Correction candidates now carry target-search metadata.

A correction candidate may include:

correctedClaimKey
correctedBeliefCandidateIds
correctionTargetSearchQuery

If no prior target is found, the correction must remain under review.

It cannot silently become a new active belief.


Streaming Import and Resume

cogmem episode import now streams JSONL input instead of reading the whole file into memory.

It supports:

--chunk-size
--checkpoint-file
--resume

The importer writes checkpoint files atomically and can resume from a previous checkpoint.

This makes large Hermes/OpenClaw-style imports safer.


Stable Import Identity

Generated import IDs no longer depend on line position.

They are based on:

sourceAgent
sourceSessionId
role
timestamp
normalizedTextHash
occurrence counter

This prevents a single inserted line from changing every later generated ID in the file.

Duplicate messages with the same timestamp and content are still disambiguated by occurrence count.


MCP Dream Tick Guard

cogmem_dream_tick is now maintenance-only by default.

Without:

maintenanceMode: true

the tool returns a recommendation and does not process backlog.

This prevents hookless agents from accidentally running Dream during normal answer generation.


MCP Episode Status Improvements

cogmem_episode_status now reports:

recentRawAvailable
recentEpisodesAvailable
dreamBacklogAvailable
semanticMemoryMayLag
recommendedAction
warnings

For hookless agents, Cogmem can report:

no_recent_episode_ingestion_detected

This makes it clearer when Hermes-like agents need to append or import messages before expecting memory to be current.


Hookless Agent Guidance

MCP server instructions now explicitly state that Cogmem cannot automatically observe hookless Hermes conversations.

Hermes-like agents must use:

cogmem_episode_append
cogmem_episode_import

to provide bounded conversation messages.

This avoids the false assumption that Cogmem can see all conversations automatically.


Migration 23

A new migration was added:

0023_episode_dream_hardening

It adds:

conversation_thread_id
semantic_summary_json
episode_tags_json
candidate_types_json
importance_signals_json
importance_reason
linked_episode_id
dream_status
last_dream_run_id
last_dreamed_at
dream_candidate_count
dream_error
closure_reason_code
closure_reason_detail
requires_review
ignored_nearby_event_ids_json
unassigned_nearby_event_ids_json
retry_after
failure_category

It also backfills Dream status from existing 3.5.0 episode Dream jobs.

New indexes support active episode lookup and retry scheduling.

The core schema version is now:

23

OpenClaw Plugin 0.4.1

OpenClaw plugin metadata now reports version 0.4.1.

The plugin continues to keep Dream out of the foreground response path.

Queued turn writes store Raw Ledger evidence and update Episode Assembler without running Dream during answer generation.

The README now documents that the plugin uses assistant context for confirmations and corrections.


BrainEval and Tests

The hardening branch adds tests for:

short replies resolved against assistant context
correction classification
safe topic movement
assistant/tool relation semantics
hybrid advisory classification
stable import identity
streaming import resume
retryable vs terminal Dream failures
episode-level Dream status
migration 23 backfill
Dream mode curator limits
semantic summaries as non-evidence
source/thread active episode scoping
MCP Dream maintenance guard
hookless lag status
temporal candidates from decision episodes
assistant proposal + user confirmation evidence
exact raw evidence enforcement
orphan correction review

These tests directly target the failure modes identified after 3.5.0.


Current Scope

Cogmem 3.5.1 is a hardening release.

It intentionally does not add:

a new memory layer
always-on LLM monitoring
foreground Dream during recall
automatic durable memory promotion
LLM-owned memory governance
tool execution from Dream

The release strengthens the existing Episode Dream Engine.