Skip to content

feat(openclaw): add session pattern filtering for ignore and stateless sessions#909

Merged
nicoloboschi merged 3 commits intovectorize-io:mainfrom
Rutimka:feat/openclaw-session-patterns
Apr 9, 2026
Merged

feat(openclaw): add session pattern filtering for ignore and stateless sessions#909
nicoloboschi merged 3 commits intovectorize-io:mainfrom
Rutimka:feat/openclaw-session-patterns

Conversation

@Rutimka
Copy link
Copy Markdown
Contributor

@Rutimka Rutimka commented Apr 7, 2026

Summary

  • Adds ignoreSessionPatterns, statelessSessionPatterns, and skipStatelessSessions config options to the OpenClaw plugin, mirroring the same feature in lossless-claw
  • Sessions matching ignoreSessionPatterns skip both recall and retain entirely (e.g. cron jobs)
  • Sessions matching statelessSessionPatterns always skip retain; skip recall too when skipStatelessSessions: true (default)
  • Glob syntax: * matches non-colon chars, ** matches anything including colons (e.g. agent:*:cron:**)
  • New session-patterns.ts module with compileSessionPattern / matchesSessionPattern helpers
  • 11 unit tests + 5 integration tests covering all filter behaviors

Config example

{
  "ignoreSessionPatterns": ["agent:*:cron:**"],
  "statelessSessionPatterns": ["agent:*:subagent:**", "agent:*:heartbeat:**"],
  "skipStatelessSessions": true
}

Test plan

  • Unit tests: npm test — 77/77 pass
  • Integration tests: npm run test:integration against live Hindsight API — 40/40 pass
  • Live deployment verified: Skipping recall: session 'agent:main:cron:1022fbf2-...' matches ignoreSessionPatterns

🤖 Generated with Claude Code

Marco Rutsch and others added 2 commits April 7, 2026 14:02
…s sessions

Adds three new config options to the OpenClaw plugin that allow filtering
sessions by key pattern before recall and retain operations fire:

- `ignoreSessionPatterns`: glob patterns for sessions to skip entirely
  (no recall, no retain). Useful for cron/scheduled agent sessions.
- `statelessSessionPatterns`: glob patterns for read-only sessions —
  retain is always skipped; recall is also skipped when
  `skipStatelessSessions` is true (default).
- `skipStatelessSessions`: boolean (default: true). When false, sessions
  matching statelessSessionPatterns can still recall but never retain.

Pattern syntax mirrors lossless-claw: `*` matches non-colon characters,
`**` matches anything including colons. Session keys follow the OpenClaw
format `agent:<agentId>:<type>:<uuid>`.

Example config:
  ignoreSessionPatterns:    ["agent:*:cron:**"]
  statelessSessionPatterns: ["agent:*:subagent:**", "agent:*:heartbeat:**"]
  skipStatelessSessions:    true

Implementation:
- New `session-patterns.ts` module with compile/match utilities
- Session filter applied in `before_prompt_build` and `agent_end` hooks
  immediately after the existing `excludeProviders` check
- New fields wired through `getPluginConfig`
- Schema added to `openclaw.plugin.json` (additionalProperties: false
  was already set, causing config validation errors without this)
- 11 unit tests in `session-patterns.test.ts`
- 5 integration tests added to `hooks.integration.test.ts`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass HINDSIGHT_API_TOKEN env var through to HindsightClient and plugin
config in integration tests so tests work against authenticated APIs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Rutimka Rutimka force-pushed the feat/openclaw-session-patterns branch from 419ba1b to bdef3d2 Compare April 7, 2026 12:02
Add ignoreSessionPatterns, statelessSessionPatterns, and skipStatelessSessions
to the README config table with glob syntax reference and usage examples.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

LGTM

@nicoloboschi nicoloboschi merged commit 5a61ac5 into vectorize-io:main Apr 9, 2026
40 of 41 checks passed
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.

2 participants