Skip to content

fix(openclaw): skip retain for operational session patterns#1410

Open
vernmic wants to merge 2 commits into
vectorize-io:mainfrom
vernmic:fix/session-pattern-filter
Open

fix(openclaw): skip retain for operational session patterns#1410
vernmic wants to merge 2 commits into
vectorize-io:mainfrom
vernmic:fix/session-pattern-filter

Conversation

@vernmic
Copy link
Copy Markdown
Contributor

@vernmic vernmic commented May 4, 2026

Heartbeat, cron, subagent, and autonomic sessions are machine-driven and produce low-value or duplicative retains. Add a defense-in-depth gate that checks sessionKey patterns before any retention logic runs.

The :autonomic: pattern was missing from the upstream skip regex, causing autonomic sessions to flood the memory bank with procedural noise.

Closes: #1403

// These sessions are machine-driven and produce low-value or duplicative retains
if (
agentEndSessionKey && (
agentEndSessionKey.includes(":heartbeat") ||
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, can we make this list configurable via plugin config with these ones as default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoloboschi implemented 6710f72

vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Replace hardcoded session pattern includes() checks with a configurable
skipRetainSessionPatterns array in plugin config. Uses the existing glob
pattern system (compileSessionPatterns/matchesSessionPattern) for matching.

Default patterns preserve current behavior:
  **:heartbeat**, **:cron:**, **:subagent:**, **:autonomic:**

Users can customize via plugin config:
  skipRetainSessionPatterns: ['**:heartbeat**', '**:custom:**']

Addresses nicoloboschi review feedback on PR vectorize-io#1410.
vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Replace hardcoded session pattern includes() checks with a configurable
skipRetainSessionPatterns array in plugin config. Bare tokens like
'heartbeat' are auto-wrapped as glob patterns '**:heartbeat**'.

Default patterns preserve current behavior:
  heartbeat, cron, subagent, autonomic

Users can customize via plugin config:
  skipRetainSessionPatterns: ['heartbeat', 'cron', 'custom-pattern']

- Add skipRetainSessionPatterns to PluginConfig type
- Add bare-token-to-glob wrapping in getPluginConfig
- Replace hardcoded includes() with compileSessionPatterns matching
- Add tests for wrapping logic and pattern matching
- Document new config field in openclaw.md

Addresses nicoloboschi review feedback on PR vectorize-io#1410.
@vernmic vernmic force-pushed the fix/session-pattern-filter branch from 6710f72 to 62a9fc8 Compare May 4, 2026 19:32
vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Replace hardcoded session pattern includes() checks with a configurable
skipRetainSessionPatterns array in plugin config. Uses the existing glob
pattern system (compileSessionPatterns/matchesSessionPattern) for matching.

Default patterns preserve current behavior:
  **:heartbeat**, **:cron:**, **:subagent:**, **:autonomic:**

Users can customize via plugin config:
  skipRetainSessionPatterns: ['**:heartbeat**', '**:custom:**']

Addresses nicoloboschi review feedback on PR vectorize-io#1410.
vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Replace hardcoded session pattern includes() checks with a configurable
skipRetainSessionPatterns array in plugin config. Bare tokens like
'heartbeat' are auto-wrapped as glob patterns '**:heartbeat**'.

Default patterns preserve current behavior:
  heartbeat, cron, subagent, autonomic

Users can customize via plugin config:
  skipRetainSessionPatterns: ['heartbeat', 'cron', 'custom-pattern']

- Add skipRetainSessionPatterns to PluginConfig type
- Add bare-token-to-glob wrapping in getPluginConfig
- Replace hardcoded includes() with compileSessionPatterns matching
- Add tests for wrapping logic and pattern matching
- Document new config field in openclaw.md

Addresses nicoloboschi review feedback on PR vectorize-io#1410.
vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Add skipRetainSessionPatterns config field to control which session
types skip memory retention. Supports glob patterns and bare tokens
(heartbeat, cron, subagent, autonomic) that auto-wrap as **:token**.

Fixes vectorize-io#1410
@vernmic vernmic force-pushed the fix/session-pattern-filter branch from 6e132ad to 637b081 Compare May 4, 2026 20:02
vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Replace hardcoded includes() checks with configurable glob patterns via
new skipRetainSessionPatterns config field. Bare tokens like 'heartbeat'
auto-wrap as '**:heartbeat**'. Adds PluginConfig type, 4 unit tests,
and documentation in openclaw integration docs.

Per PR vectorize-io#1410 reviewer feedback.
@vernmic vernmic force-pushed the fix/session-pattern-filter branch from 637b081 to 522a7c2 Compare May 4, 2026 20:07
vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Replace hardcoded includes() checks with configurable glob patterns via
new skipRetainSessionPatterns config field. Bare tokens like 'heartbeat'
auto-wrap as '**:heartbeat**'. Adds PluginConfig type, 4 unit tests,
and documentation in openclaw integration docs.

Per PR vectorize-io#1410 reviewer feedback.
@vernmic vernmic force-pushed the fix/session-pattern-filter branch from 522a7c2 to a871dc3 Compare May 4, 2026 20:26
@vernmic vernmic requested a review from nicoloboschi May 4, 2026 20:35
vernmic added a commit to vernmic/hindsight that referenced this pull request May 4, 2026
Replace hardcoded includes() checks with configurable glob patterns via
new skipRetainSessionPatterns config field. Bare tokens like 'heartbeat'
auto-wrap as '**:heartbeat**'. Adds PluginConfig type, 4 unit tests,
and documentation in openclaw integration docs.

Also regenerates skills/hindsight-docs/references/developer/configuration.md
via generate-docs-skill.sh. The removed HINDSIGHT_API_LLM_DEFAULT_HEADERS
entry is a pre-existing upstream sync issue: the source
hindsight-docs/docs/developer/configuration.md already dropped this line
but the committed generated copy hadn't been regenerated. Including the
regenerated version to satisfy CI's generated-file-sync check.

Per PR vectorize-io#1410 reviewer feedback.
@vernmic vernmic force-pushed the fix/session-pattern-filter branch 2 times, most recently from ab32639 to 3b227d9 Compare May 7, 2026 15:07
vernmic added a commit to vernmic/hindsight that referenced this pull request May 7, 2026
Replace the opaqueness of a single ignoreSessionPatterns knob for
machine-driven session types with a dedicated, configurable
skipRetainSessionPatterns field. Unlike full ignore (no recall + no
retain), this gate only skips retain — recall still fires, which means
agents can still learn from past operational sessions even if the
transcripts themselves aren't worth retaining.

Bare tokens like 'heartbeat' auto-wrap as glob patterns '**:heartbeat**'.
Users who need glob-wildcard patterns can pass them directly.

Defaults: heartbeat, cron, subagent (the three session types confirmed in
core OpenClaw source). autonomic removed from defaults — it does not
appear in openclaw/openclaw code, session-key-utils, or docs. Users with
custom session types can configure them via skipRetainSessionPatterns or
the existing ignoreSessionPatterns field.

Refs: vectorize-io#1403, PR review feedback on vectorize-io#1410
vernmic added a commit to vernmic/hindsight that referenced this pull request May 7, 2026
Replace the opaqueness of a single ignoreSessionPatterns knob for
machine-driven session types with a dedicated, configurable
skipRetainSessionPatterns field. Unlike full ignore (no recall + no
retain), this gate only skips retain — recall still fires, which means
agents can still learn from past operational sessions even if the
transcripts themselves aren't worth retaining.

Bare tokens like 'heartbeat' auto-wrap as glob patterns '**:heartbeat**'.
Users who need glob-wildcard patterns can pass them directly.

Defaults: heartbeat, cron, subagent (the three session types confirmed in
core OpenClaw source). autonomic removed from defaults — it does not
appear in openclaw/openclaw code, session-key-utils, or docs. Users with
custom session types can configure them via skipRetainSessionPatterns or
the existing ignoreSessionPatterns field.

Refs: vectorize-io#1403, PR review feedback on vectorize-io#1410
@vernmic vernmic force-pushed the fix/session-pattern-filter branch from 3b227d9 to 6886fbe Compare May 7, 2026 15:24
Replace the opaqueness of a single ignoreSessionPatterns knob for
machine-driven session types with a dedicated, configurable
skipRetainSessionPatterns field. Unlike full ignore (no recall + no
retain), this gate only skips retain — recall still fires, which means
agents can still learn from past operational sessions even if the
transcripts themselves aren't worth retaining.

Bare tokens like 'heartbeat' auto-wrap as glob patterns '**:heartbeat**'.
Users who need glob-wildcard patterns can pass them directly.

Defaults: heartbeat, cron, subagent (the three session types confirmed in
core OpenClaw source). autonomic removed from defaults — it does not
appear in openclaw/openclaw code, session-key-utils, or docs. Users with
custom session types can configure them via skipRetainSessionPatterns or
the existing ignoreSessionPatterns field.

Refs: vectorize-io#1403, PR review feedback on vectorize-io#1410
@vernmic vernmic force-pushed the fix/session-pattern-filter branch from 6886fbe to a9a4341 Compare May 7, 2026 15:35
The verify-generated-files CI job runs lint.sh (prettier) across all
integration packages and fails if any file changes. This n8n test file
was not prettier-formatted in upstream/main, causing the CI gate to
fail on this branch.

Prettier reformat only — no behavioral change. The cast expression on
lines 37-39 was split across three lines to stay within the 100-char
printWidth limit configured in the root .prettierrc.json.

Not related to the skipRetainSessionPatterns change. Committed here
because the repo-wide verify-generated-files check blocks all PRs
regardless of which integration they touch.
statelessSessionPatterns: Array.isArray(config.statelessSessionPatterns)
? config.statelessSessionPatterns
: [],
skipRetainSessionPatterns: (() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't se this as default - default must be empty array (disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(openclaw): autonomic sessions are retained and recalled instead of being skipped

2 participants