feat: add runtime context awareness — system.info tool + date/time in system prompt

- assembleSystemPrompt() now injects '# Runtime Context' with current date/time
- New system.info tool: date, time, hostname, platform, arch, uptime, memory, Node.js version
- Tool available in all profiles (minimal/messaging/coding/full)
- 983 tests passing (+7 new)
This commit is contained in:
William Valentin
2026-02-07 16:22:17 -08:00
parent 33f6f142bc
commit 8bf88049bf
9 changed files with 228 additions and 16 deletions
+20 -3
View File
@@ -63,10 +63,27 @@ export function assembleSystemPrompt(config: PromptTemplateConfig): PromptTempla
}
}
// Fallback if nothing was loaded
if (sections.length === 0) {
// Inject current date/time as runtime context
const now = new Date();
const dateStr = now.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric',
});
const timeStr = now.toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit',
timeZoneName: 'short',
hour12: false,
});
const runtimeContext = `# Runtime Context\n\nCurrent date: ${dateStr}\nCurrent time: ${timeStr}`;
sections.push(runtimeContext);
// Fallback if only the runtime context was loaded (no actual prompt files)
if (sections.length === 1) {
return {
prompt: 'You are Flynn, a helpful personal AI assistant. Be direct, concise, and helpful. Use markdown when it improves readability.',
prompt: `You are Flynn, a helpful personal AI assistant. Be direct, concise, and helpful. Use markdown when it improves readability.\n\n${runtimeContext}`,
loadedFiles: [],
};
}