Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions hindsight-integrations/openclaw/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { describe, it, expect } from "vitest";
import {
stripMemoryTags,
extractRecallQuery,
formatCurrentTimeForRecall,
formatMemories,
prepareRetentionTranscript,
countUserTurns,
Expand Down Expand Up @@ -249,6 +250,22 @@ describe("formatMemories", () => {
});
});

// ---------------------------------------------------------------------------
// formatCurrentTimeForRecall — UTC label (#1789, mirrors #1568)
// ---------------------------------------------------------------------------

describe("formatCurrentTimeForRecall", () => {
it("renders the UTC suffix so the LLM doesn't misread it as local time", () => {
const fixed = new Date(Date.UTC(2026, 4, 27, 16, 25, 0)); // 2026-05-27 16:25 UTC
expect(formatCurrentTimeForRecall(fixed)).toBe("2026-05-27 16:25 UTC");
});

it("zero-pads month / day / hours / minutes", () => {
const fixed = new Date(Date.UTC(2026, 0, 3, 4, 5, 0));
expect(formatCurrentTimeForRecall(fixed)).toBe("2026-01-03 04:05 UTC");
});
});

// ---------------------------------------------------------------------------
// retention helpers
// ---------------------------------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions hindsight-integrations/openclaw/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,16 @@ async function flushRetainQueue(): Promise<void> {
const DEFAULT_RECALL_PROMPT_PREAMBLE =
"Relevant memories from past conversations (prioritize recent when conflicting). Only use memories that are directly useful to continue this conversation; ignore the rest:";

function formatCurrentTimeForRecall(date = new Date()): string {
export function formatCurrentTimeForRecall(date = new Date()): string {
const year = date.getUTCFullYear();
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
const day = String(date.getUTCDate()).padStart(2, "0");
const hours = String(date.getUTCHours()).padStart(2, "0");
const minutes = String(date.getUTCMinutes()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}`;
// Suffix with " UTC" so the LLM doesn't misread the timestamp as local
// time and make wrong recency judgments. Mirrors the fix landed for the
// Claude Code integration in #1568. (#1789)
return `${year}-${month}-${day} ${hours}:${minutes} UTC`;
}

/**
Expand Down