chore: refine platform policy and memory SKILL docs

This commit is contained in:
VITOHJL
2026-03-05 23:57:43 +08:00
parent c8f86fd052
commit 958c23fb01
2 changed files with 38 additions and 5 deletions
+28
View File
@@ -58,6 +58,32 @@ Skills with available="false" need dependencies installed first - you can try in
system = platform.system()
runtime = f"{'macOS' if system == 'Darwin' else system} {platform.machine()}, Python {platform.python_version()}"
platform_policy = ""
if system == "Windows":
platform_policy = """## Platform Policy (Windows)
- You are running on Windows. Shell commands executed via the `exec` tool run under the default Windows shell (PowerShell or cmd.exe) unless you explicitly invoke another shell.
- Prefer UTF-8 for file I/O and command output. If terminal output is garbled/mojibake, retry with:
- PowerShell: `[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; <command>`
- cmd.exe: `chcp 65001 >NUL & <command>`
- Do NOT assume GNU tools like `grep`, `sed`, `awk` exist. Prefer Windows built-ins:
- Search text: `findstr /i "keyword" path\\to\\file`
- List files: `dir`
- Show file: `type path\\to\\file`
- When in doubt, prefer the file tools (`read_file`, `list_dir`) over shell for portability and reliability.
"""
elif system == "Darwin":
platform_policy = """## Platform Policy (macOS)
- You are running on macOS. Prefer POSIX tools and UTF-8.
- Use forward-slash paths. Prefer `ls`, `cat`, `grep`, `find` for filesystem and text operations.
- When in doubt, prefer the file tools (`read_file`, `list_dir`) over shell for portability and reproducibility.
"""
else:
platform_policy = """## Platform Policy (Linux)
- You are running on Linux. Prefer POSIX tools and UTF-8.
- Use forward-slash paths. Prefer `ls`, `cat`, `grep`, `find` for filesystem and text operations.
- When in doubt, prefer the file tools (`read_file`, `list_dir`) over shell for portability and reproducibility.
"""
return f"""# nanobot 🐈
You are nanobot, a helpful AI assistant.
@@ -71,6 +97,8 @@ Your workspace is at: {workspace_path}
- History log: {workspace_path}/memory/HISTORY.md (grep-searchable). Each entry starts with [YYYY-MM-DD HH:MM].
- Custom skills: {workspace_path}/skills/{{skill-name}}/SKILL.md
{platform_policy}
## nanobot Guidelines
- State intent before tool calls, but NEVER predict or claim results before receiving them.
- Before modifying a file, read it first. Do not assume files or directories exist.