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 1/3] 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.""" From d5ee8f3e554c9340dd243121b19ce30229571625 Mon Sep 17 00:00:00 2001 From: Devin <99658722+DeeJ4yNg@users.noreply.github.com> Date: Thu, 5 Feb 2026 10:45:36 +0800 Subject: [PATCH 2/3] Update context.py Add doc string. --- nanobot/agent/context.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nanobot/agent/context.py b/nanobot/agent/context.py index 3c95b66..16c7769 100644 --- a/nanobot/agent/context.py +++ b/nanobot/agent/context.py @@ -106,6 +106,7 @@ Always be helpful, accurate, and concise. When using tools, explain what you're When remembering something, write to {workspace_path}/memory/MEMORY.md""" def _get_runtime_environment_summary(self) -> str: + """Get runtime environment information.""" system = platform.system() system_map = {"Darwin": "MacOS", "Windows": "Windows", "Linux": "Linux"} system_label = system_map.get(system, system) From 764c6d02a1f2640380227c075be8aa342ab18ca7 Mon Sep 17 00:00:00 2001 From: Re-bin Date: Fri, 6 Feb 2026 03:26:39 +0000 Subject: [PATCH 3/3] refactor: simplify runtime environment info in system prompt --- nanobot/agent/context.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/nanobot/agent/context.py b/nanobot/agent/context.py index a4086f5..3ea6c04 100644 --- a/nanobot/agent/context.py +++ b/nanobot/agent/context.py @@ -75,7 +75,8 @@ 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() + system = platform.system() + runtime = f"{'macOS' if system == 'Darwin' else system} {platform.machine()}, Python {platform.python_version()}" return f"""# nanobot 🐈 @@ -89,8 +90,8 @@ You are nanobot, a helpful AI assistant. You have access to tools that allow you ## Current Time {now} -## Runtime Environment -{runtime_summary} +## Runtime +{runtime} ## Workspace Your workspace is at: {workspace_path} @@ -104,20 +105,6 @@ 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: - """Get runtime environment information.""" - 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."""