Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

Give agents the current date and warn against stale event pages

Oleksandr Ivanchenko8477152e2411
diff --git a/src/drivers/mod.rs b/src/drivers/mod.rs
index 4b0ab4d7..44cc0afd 100644
--- a/src/drivers/mod.rs
+++ b/src/drivers/mod.rs
@@ -59,6 +59,18 @@ pub struct Teammate {
pub title: String,
}
+/// Models only know their training cutoff, so every turn is told the real date and how to use it.
+pub fn current_date_block(now: chrono::DateTime<chrono::FixedOffset>) -> String {
+ format!(
+ "\n\n[Current date]\n\
+ Right now it is {} (UTC{}). Your training data is older than this: trust this date over your own sense of what year it is.\n\
+ Before saying an event, offer, deadline or opening is happening now or soon, check its dates against today. \
+ Websites often keep featuring events that are already over, so read the dates on the page; if they are missing, say you could not confirm them.",
+ now.format("%A, %-d %B %Y, %H:%M"),
+ now.format("%:z"),
+ )
+}
+
impl TurnInput {
pub fn format_system_prompt(&self) -> String {
let mut base = format!(
@@ -72,6 +84,7 @@ impl TurnInput {
soul
));
}
+ base.push_str(&current_date_block(chrono::Local::now().fixed_offset()));
let team_block = if let Some(ref team) = self.team_context {
let desc = team.description.as_deref().unwrap_or("General team objectives");
let mut ws_info = String::new();
diff --git a/tests/driver_test.rs b/tests/driver_test.rs
index a95eabad..8c4b4e58 100644
--- a/tests/driver_test.rs
+++ b/tests/driver_test.rs
@@ -159,6 +159,9 @@ fn test_turn_input_format_system_prompt_with_and_without_team_context() {
assert!(!solo_prompt.contains("Active Team Alignment"));
assert!(!solo_prompt.contains("[Teammates in this chat]"));
assert!(!solo_prompt.contains("Your soul"));
+ assert!(solo_prompt.contains("[Current date]"));
+ let year = chrono::Local::now().format("%Y").to_string();
+ assert!(solo_prompt.contains(&year));
let mut with_soul = input_solo.clone();
with_soul.kwant.soul = " Calm and wry; loves a good diagram. ".into();
@@ -227,3 +230,12 @@ fn test_turn_input_format_system_prompt_with_and_without_team_context() {
assert!(ws_prompt.contains("Git Repo: https://github.com/org/app"));
}
+
+#[test]
+fn test_current_date_block_names_weekday_year_and_offset() {
+ use chrono::TimeZone;
+ let now = chrono::FixedOffset::east_opt(2 * 3600).unwrap().with_ymd_and_hms(2026, 10, 16, 11, 7, 0).unwrap();
+ let block = kwnt::drivers::current_date_block(now);
+ assert!(block.contains("Friday, 16 October 2026, 11:07 (UTC+02:00)"), "{block}");
+ assert!(block.contains("already over"));
+}