daemon-startup notice on first session: read changelog + excuse for downtime

This commit is contained in:
Damocles 2026-05-01 15:49:37 +02:00
parent b9e570911e
commit b7d502bddf
2 changed files with 13 additions and 0 deletions

View file

@ -257,6 +257,7 @@ async fn process_loop(
model: &initial_model, model: &initial_model,
mcp_config_path: &mcp_config_path, mcp_config_path: &mcp_config_path,
allowed_tools: claude::ALLOWED_TOOLS, allowed_tools: claude::ALLOWED_TOOLS,
is_initial_daemon_session: true,
}) })
.await .await
{ {
@ -337,6 +338,7 @@ async fn process_loop(
model: &model, model: &model,
mcp_config_path: &mcp_config_path, mcp_config_path: &mcp_config_path,
allowed_tools: claude::ALLOWED_TOOLS, allowed_tools: claude::ALLOWED_TOOLS,
is_initial_daemon_session: false,
}) })
.await .await
{ {
@ -357,6 +359,9 @@ async fn process_loop(
let sess = session.as_mut().unwrap(); let sess = session.as_mut().unwrap();
if sess.turn_count == 0 { 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()); 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(); let delay = queued_at.elapsed();

View file

@ -97,12 +97,19 @@ pub struct ShardSession {
pub rooms_seen: HashSet<OwnedRoomId>, pub rooms_seen: HashSet<OwnedRoomId>,
/// Mtimes of identity/CHANGELOG files at session start - for refresh. /// Mtimes of identity/CHANGELOG files at session start - for refresh.
mtime_snapshot: Vec<(PathBuf, std::time::SystemTime)>, 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 struct SpawnConfig<'a> {
pub model: &'a str, pub model: &'a str,
pub mcp_config_path: &'a Path, pub mcp_config_path: &'a Path,
pub allowed_tools: &'a str, 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 { impl ShardSession {
@ -195,6 +202,7 @@ impl ShardSession {
turn_count: 0, turn_count: 0,
rooms_seen: HashSet::new(), rooms_seen: HashSet::new(),
mtime_snapshot, mtime_snapshot,
is_initial_daemon_session: cfg.is_initial_daemon_session,
}) })
} }