fleet-memory/hindsight-integrations
Rutimka 5a61ac50e9
feat(openclaw): add session pattern filtering for ignore and stateless sessions (#909)
* feat(openclaw): add session pattern filtering for ignore and stateless 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:*💓**"]
  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>

* test(openclaw): support HINDSIGHT_API_TOKEN in integration tests

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>

* docs(openclaw): document session pattern filtering options

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>

---------

Co-authored-by: Marco Rutsch <marco@rutimka.de>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 10:43:35 +02:00
..
ag2 fix(deps): address critical and high severity security vulnerabilities (#827) 2026-04-01 09:20:34 +02:00
agno fix(deps): address critical and high severity security vulnerabilities (#827) 2026-04-01 09:20:34 +02:00
ai-sdk security: bump vite across integrations (high CVE fix) (#913) 2026-04-08 09:11:21 +02:00
autogen release(autogen): v0.1.1 2026-04-01 17:51:46 +02:00
chat security: bump vite across integrations (high CVE fix) (#913) 2026-04-08 09:11:21 +02:00
claude-code Fix trailing commas in openclaw.plugin.json and add JSON manifest CI tests (#774) 2026-03-30 16:55:06 +02:00
codex release(codex): v0.2.0 2026-03-30 17:50:02 +02:00
crewai fix: resolve remaining Dependabot security alerts (#833) 2026-04-01 17:22:38 +02:00
langgraph fix(deps): address critical and high severity security vulnerabilities (#827) 2026-04-01 09:20:34 +02:00
litellm security: bump litellm to >=1.83.0 (#912) 2026-04-07 16:54:24 +02:00
llamaindex fix(deps): address critical and high severity security vulnerabilities (#827) 2026-04-01 09:20:34 +02:00
nemoclaw security: bump vite across integrations (high CVE fix) (#913) 2026-04-08 09:11:21 +02:00
openclaw feat(openclaw): add session pattern filtering for ignore and stateless sessions (#909) 2026-04-09 10:43:35 +02:00
opencode security: bump vite across integrations (high CVE fix) (#913) 2026-04-08 09:11:21 +02:00
paperclip security: bump vite across integrations (high CVE fix) (#913) 2026-04-08 09:11:21 +02:00
pydantic-ai fix(deps): address critical and high severity security vulnerabilities (#827) 2026-04-01 09:20:34 +02:00
strands fix(deps): address critical and high severity security vulnerabilities (#827) 2026-04-01 09:20:34 +02:00