agenr 0.9.19 → 0.9.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.21 (2026-02-28)
4
+
5
+ ### Improvements
6
+ - OpenClaw plugin: simplified mid-session recall from three-tier
7
+ classification (trivial/normal/complex) to two-tier (trivial/recall).
8
+ All non-trivial messages now use a single recall limit of 8, eliminating
9
+ fragile regex-driven classification that missed edge cases like
10
+ "What's the status of X?" being classified as normal instead of complex.
11
+ Config fields normalLimit and complexLimit are deprecated in favor of
12
+ a single limit field. (#326)
13
+
14
+ ## 0.9.20 (2026-02-28)
15
+
16
+ ### Bug Fixes
17
+ - OpenClaw plugin: mid-session recall query now uses the raw current
18
+ message instead of accumulating a sliding window with stop-word
19
+ stripping. Fixes garbled queries that returned irrelevant context.
20
+ - OpenClaw plugin: tightened message classifier to avoid marking
21
+ conversational acks as complex. Messages with no entities, temporal
22
+ patterns, or recall phrases now correctly classify as normal or
23
+ trivial regardless of length.
24
+ - OpenClaw plugin: expanded trivial phrase list and added word-count
25
+ gate so low-signal conversational messages skip recall entirely.
26
+ - OpenClaw plugin: recall queries are capped at 200 chars to prevent
27
+ large data pastes from producing oversized embedding queries. (#323)
28
+
3
29
  ## 0.9.19 (2026-02-28)
4
30
 
5
31
  ### Features
@@ -385,8 +385,8 @@ var TRIVIAL_EXACT = /* @__PURE__ */ new Set([
385
385
  "np",
386
386
  "nvm"
387
387
  ]);
388
- var TRIVIAL_PHRASES = /^(?:do it|go ahead|ship it|sounds good|got it|makes sense|go for it|lgtm ship it|yes please|no thanks|that works|perfect thanks|will do)$/i;
389
- var TEMPORAL_PATTERNS = /\b(?:remember|remind|forgot|last time|last (?:week|month|year|night|session)|before|previously|earlier|the other day|a while ago|we decided|did we decide|have we|were we|you said|you told me|you mentioned|we discussed|we talked about|what was|who is|who was|who's|when did|how did|what happened)\b/i;
388
+ var TRIVIAL_PHRASES = /^(?:do it|go ahead|ship it|sounds good|sounds like a plan|got it|makes sense|go for it|lgtm ship it|yes please|no thanks|that works|perfect thanks|will do|that(?:'|)s okay|one sec|one second|one moment|let me check|i(?:'|)ll take a look|let me see|hold on|brb|good call|fair enough|works for me|i(?:'|)m good|all good|no worries|no problem)$/i;
389
+ var TEMPORAL_PATTERNS = /\b(?:remember|remind|forgot|last time|last (?:week|month|year|night|session)|previously|earlier|the other day|a while ago|we decided|did we decide|have we|were we|you said|you told me|you mentioned|we discussed|we talked about|what was|who is|who was|who's|when did|how did|what happened)\b/i;
390
390
  var EXPLICIT_RECALL = /\b(?:tell me about|what do you know about|what do we know about|can you recall|do you remember|remind me|fill me in on|catch me up|what's the (?:deal|story|status) with)\b/i;
391
391
  var ENTITY_PATTERNS = [
392
392
  /\b[A-Z][a-z]{2,}\b/,
@@ -470,6 +470,7 @@ var FALSE_POSITIVE_NOUNS = /* @__PURE__ */ new Set([
470
470
  ]);
471
471
  var MAX_RECENT_MESSAGES = 5;
472
472
  var MAX_BUFFERED_MESSAGE_CHARS = 200;
473
+ var MAX_QUERY_CHARS = 200;
473
474
  function normalizeBufferedMessage(text) {
474
475
  const trimmed = text.trim();
475
476
  if (!trimmed) {
@@ -535,9 +536,6 @@ function collectEntities(text) {
535
536
  }
536
537
  return entities;
537
538
  }
538
- function containsEntity(text) {
539
- return collectEntities(text).size > 0;
540
- }
541
539
  function countEntities(text) {
542
540
  return collectEntities(text).size;
543
541
  }
@@ -553,6 +551,9 @@ function classifyMessage(text) {
553
551
  const wordCount = words.length;
554
552
  const lower = trimmed.toLowerCase();
555
553
  const stripped = lower.replace(/[.!?,;:]+$/g, "");
554
+ const hasExplicitRecall = EXPLICIT_RECALL.test(trimmed);
555
+ const hasTemporalPattern = TEMPORAL_PATTERNS.test(trimmed);
556
+ const entityCount = countEntities(trimmed);
556
557
  if (wordCount === 1) {
557
558
  if (TRIVIAL_EXACT.has(stripped)) {
558
559
  return "trivial";
@@ -563,65 +564,31 @@ function classifyMessage(text) {
563
564
  if (isSingleEmoji(trimmed)) {
564
565
  return "trivial";
565
566
  }
566
- if (containsEntity(trimmed)) {
567
- return "normal";
567
+ if (entityCount > 0) {
568
+ return "recall";
568
569
  }
569
570
  return "trivial";
570
571
  }
571
572
  if (TRIVIAL_PHRASES.test(stripped)) {
572
573
  return "trivial";
573
574
  }
574
- if (wordCount <= 3 && !containsEntity(trimmed)) {
575
+ if (wordCount <= 3 && entityCount === 0) {
575
576
  return "trivial";
576
577
  }
577
- if (EXPLICIT_RECALL.test(trimmed)) {
578
- return "complex";
579
- }
580
- if (TEMPORAL_PATTERNS.test(trimmed)) {
581
- return "complex";
582
- }
583
- if (wordCount <= 6 && containsEntity(trimmed)) {
584
- return "complex";
585
- }
586
- if (countEntities(trimmed) >= 2) {
587
- return "complex";
588
- }
589
- return "normal";
590
- }
591
- function isStopWordMessage(text) {
592
- const normalized = text.trim().toLowerCase().replace(/[.!?,;:]+$/g, "");
593
- if (!normalized) {
594
- return true;
595
- }
596
- if (TRIVIAL_EXACT.has(normalized)) {
597
- return true;
578
+ if (wordCount <= 8 && entityCount === 0 && !hasTemporalPattern && !hasExplicitRecall && !trimmed.endsWith("?")) {
579
+ return "trivial";
598
580
  }
599
- return TRIVIAL_PHRASES.test(normalized);
600
- }
601
- function extractKeyTerms(text) {
602
- const tokens = text.split(/\s+/).map(normalizeToken).filter(Boolean);
603
- const keyTerms = tokens.filter((token) => {
604
- if (token.length > 5) {
605
- return true;
606
- }
607
- if (/^[A-Z]/.test(token)) {
608
- return true;
609
- }
610
- return /[-_.]/.test(token) && token.length > 3;
611
- });
612
- return keyTerms.join(" ");
581
+ return "recall";
613
582
  }
614
- function buildQuery(messages) {
615
- if (!Array.isArray(messages) || messages.length === 0) {
583
+ function buildQuery(message) {
584
+ if (typeof message !== "string") {
616
585
  return "";
617
586
  }
618
- const meaningful = messages.map(normalizeBufferedMessage).filter((message) => message.length > 0).filter((message) => !isStopWordMessage(message));
619
- if (meaningful.length === 0) {
587
+ const trimmed = message.trim();
588
+ if (!trimmed) {
620
589
  return "";
621
590
  }
622
- const recentMessages = meaningful.slice(-2).join(" ");
623
- const olderMessages = meaningful.slice(0, -2).map((message) => extractKeyTerms(message)).filter((value) => value.length > 0).join(" ");
624
- return `${olderMessages} ${recentMessages}`.trim();
591
+ return trimmed.slice(0, MAX_QUERY_CHARS);
625
592
  }
626
593
  function tokenizeForSimilarity(text) {
627
594
  const tokens = text.toLowerCase().split(/\s+/).map((token) => token.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, "")).filter((token) => token.length > 0);
@@ -1638,8 +1605,7 @@ var SKIP_SESSION_PATTERNS = [":subagent:", ":cron:"];
1638
1605
  var DEFAULT_MAX_SEEN_SESSIONS = 1e3;
1639
1606
  var seenSessions = /* @__PURE__ */ new Map();
1640
1607
  var MAX_RECALLED_SESSIONS = 200;
1641
- var DEFAULT_MID_SESSION_NORMAL_LIMIT = 5;
1642
- var DEFAULT_MID_SESSION_COMPLEX_LIMIT = 8;
1608
+ var DEFAULT_MID_SESSION_RECALL_LIMIT = 8;
1643
1609
  var DEFAULT_MID_SESSION_QUERY_SIMILARITY_THRESHOLD = 0.85;
1644
1610
  var DEFAULT_STORE_NUDGE_THRESHOLD = 8;
1645
1611
  var DEFAULT_STORE_NUDGE_MAX_PER_SESSION = 3;
@@ -2740,9 +2706,6 @@ ${formatted.trim()}`);
2740
2706
  if (state && config?.midSessionRecall?.enabled !== false) {
2741
2707
  const rawPrompt = typeof event.prompt === "string" ? stripPromptMetadata(event.prompt) : "";
2742
2708
  const userMessage = rawPrompt.trim();
2743
- if (userMessage) {
2744
- state.recentMessages.push(userMessage);
2745
- }
2746
2709
  const classification = classifyMessage(userMessage);
2747
2710
  debugLog(
2748
2711
  debug,
@@ -2750,17 +2713,14 @@ ${formatted.trim()}`);
2750
2713
  `turn=${state.turnCount} classification=${classification} msg="${userMessage.slice(0, 80)}"`
2751
2714
  );
2752
2715
  if (classification !== "trivial") {
2753
- const query = buildQuery(state.recentMessages.toArray());
2716
+ const query = buildQuery(userMessage);
2754
2717
  const threshold = resolveMidSessionSimilarityThreshold(
2755
2718
  config?.midSessionRecall?.querySimilarityThreshold
2756
2719
  );
2757
2720
  if (shouldRecall(query, state.lastRecallQuery, threshold)) {
2758
- const limit = classification === "complex" ? resolveMidSessionLimit(
2759
- config?.midSessionRecall?.complexLimit,
2760
- DEFAULT_MID_SESSION_COMPLEX_LIMIT
2761
- ) : resolveMidSessionLimit(
2762
- config?.midSessionRecall?.normalLimit,
2763
- DEFAULT_MID_SESSION_NORMAL_LIMIT
2721
+ const limit = resolveMidSessionLimit(
2722
+ config?.midSessionRecall?.limit,
2723
+ DEFAULT_MID_SESSION_RECALL_LIMIT
2764
2724
  );
2765
2725
  debugLog(
2766
2726
  debug,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenr",
3
- "version": "0.9.19",
3
+ "version": "0.9.21",
4
4
  "openclaw": {
5
5
  "extensions": [
6
6
  "dist/openclaw-plugin/index.js"