mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:18:28 +00:00
feat: add "Current Date:" label to timestamp prefix
Changes [Wed 2026-01-28 20:30 EST] to [Current Date: Wed 2026-01-28 20:30 EST]. Tested with qwen3-1.7B: even with DOW in the timestamp, the model ignored it and tried to compute the day using Zeller's Congruence. The "Current Date:" semantic label is widely present in training data and gives small models the best chance of recognizing the timestamp as authoritative context rather than metadata to parse. Cost: ~18 tokens per message. Prevents hallucination spirals that burn hundreds or thousands of tokens on date derivation.
This commit is contained in:
committed by
Tak Hoffman
parent
a6c68e8690
commit
b6c8c1e89d
@@ -53,13 +53,14 @@ export function injectTimestamp(message: string, opts?: TimestampInjectionOption
|
||||
const formatted = formatZonedTimestamp(now, timezone);
|
||||
if (!formatted) return message;
|
||||
|
||||
// Add 3-letter day-of-week for smaller models that can't derive DOW
|
||||
// from a date. Costs ~1 token, cheap insurance.
|
||||
// "Current Date:" label is unambiguous even for tiny models (1.7B+).
|
||||
// 3-letter DOW included because small models can't derive it from a date.
|
||||
// Total cost: ~18 tokens — saves thousands when it prevents hallucination.
|
||||
const dow = new Intl.DateTimeFormat("en-US", { timeZone: timezone, weekday: "short" }).format(
|
||||
now,
|
||||
);
|
||||
|
||||
return `[${dow} ${formatted}] ${message}`;
|
||||
return `[Current Date: ${dow} ${formatted}] ${message}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user