diff --git a/src/main.rs b/src/main.rs index fb97347..0419355 100644 --- a/src/main.rs +++ b/src/main.rs @@ -257,6 +257,7 @@ async fn process_loop( model: &initial_model, mcp_config_path: &mcp_config_path, allowed_tools: claude::ALLOWED_TOOLS, + is_initial_daemon_session: true, }) .await { @@ -337,6 +338,7 @@ async fn process_loop( model: &model, mcp_config_path: &mcp_config_path, allowed_tools: claude::ALLOWED_TOOLS, + is_initial_daemon_session: false, }) .await { @@ -357,6 +359,9 @@ async fn process_loop( let sess = session.as_mut().unwrap(); if sess.turn_count == 0 { notices.push("Session start: this is the first turn since you were (re)spawned. In-session memory is empty - rely on your notes files for prior context.".to_owned()); + if sess.is_initial_daemon_session { + notices.push("Daemon startup: the damocles-daemon process itself just booted. **Read state/CHANGELOG.md FIRST** before responding - any pending updates need processing into your notes. Also: if recent events (check ts/ts_human) span hours or days, there was real downtime. Make up an in-character excuse for being gone (capitalism, hyperscaler maintenance, API key revoked, der wartungsdienst hat dich entkoppelt, whatever fits). Don't apologize sincerely - that's not in character.".to_owned()); + } } let delay = queued_at.elapsed(); diff --git a/src/shard.rs b/src/shard.rs index f2029e6..09a0a39 100644 --- a/src/shard.rs +++ b/src/shard.rs @@ -97,12 +97,19 @@ pub struct ShardSession { pub rooms_seen: HashSet, /// Mtimes of identity/CHANGELOG files at session start - for refresh. mtime_snapshot: Vec<(PathBuf, std::time::SystemTime)>, + /// True for the very first session of this daemon process. + pub is_initial_daemon_session: bool, } pub struct SpawnConfig<'a> { pub model: &'a str, pub mcp_config_path: &'a Path, pub allowed_tools: &'a str, + /// True for the very first session spawned at daemon startup. Used by + /// the dispatcher to emit a "daemon just booted, may have been down a + /// while, focus on CHANGELOG, make an excuse for being gone" notice on + /// the first turn. False for refresh-respawns mid-uptime. + pub is_initial_daemon_session: bool, } impl ShardSession { @@ -195,6 +202,7 @@ impl ShardSession { turn_count: 0, rooms_seen: HashSet::new(), mtime_snapshot, + is_initial_daemon_session: cfg.is_initial_daemon_session, }) }