From 22156d3a40884d79a9e914c76fc7778d2a22f7de Mon Sep 17 00:00:00 2001 From: Shukfan Law <410070474@qq.com> Date: Wed, 4 Feb 2026 22:17:35 +0800 Subject: [PATCH] feat: added runtime environment summary to system prompt --- nanobot/agent/context.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nanobot/agent/context.py b/nanobot/agent/context.py index f70103d..3c95b66 100644 --- a/nanobot/agent/context.py +++ b/nanobot/agent/context.py @@ -2,6 +2,7 @@ import base64 import mimetypes +import platform from pathlib import Path from typing import Any @@ -74,6 +75,7 @@ Skills with available="false" need dependencies installed first - you can try in from datetime import datetime now = datetime.now().strftime("%Y-%m-%d %H:%M (%A)") workspace_path = str(self.workspace.expanduser().resolve()) + runtime_summary = self._get_runtime_environment_summary() return f"""# nanobot 🐈 @@ -87,6 +89,9 @@ You are nanobot, a helpful AI assistant. You have access to tools that allow you ## Current Time {now} +## Runtime Environment +{runtime_summary} + ## Workspace Your workspace is at: {workspace_path} - Memory files: {workspace_path}/memory/MEMORY.md @@ -99,6 +104,19 @@ For normal conversation, just respond with text - do not call the message tool. Always be helpful, accurate, and concise. When using tools, explain what you're doing. When remembering something, write to {workspace_path}/memory/MEMORY.md""" + + def _get_runtime_environment_summary(self) -> str: + system = platform.system() + system_map = {"Darwin": "MacOS", "Windows": "Windows", "Linux": "Linux"} + system_label = system_map.get(system, system) + release = platform.release() + machine = platform.machine() + python_version = platform.python_version() + node = platform.node() + return ( + f"Runtime environment: OS {system_label} {release} ({machine}), " + f"Python {python_version}, Hostname {node}." + ) def _load_bootstrap_files(self) -> str: """Load all bootstrap files from workspace."""