Merge PR #1579: refine platform policy and memory skill docs
This commit is contained in:
@@ -59,6 +59,19 @@ Skills with available="false" need dependencies installed first - you can try in
|
|||||||
system = platform.system()
|
system = platform.system()
|
||||||
runtime = f"{'macOS' if system == 'Darwin' else system} {platform.machine()}, Python {platform.python_version()}"
|
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. Do not assume GNU tools like `grep`, `sed`, or `awk` exist.
|
||||||
|
- Prefer Windows-native commands or file tools when they are more reliable.
|
||||||
|
- If terminal output is garbled, retry with UTF-8 output enabled.
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
platform_policy = """## Platform Policy (POSIX)
|
||||||
|
- You are running on a POSIX system. Prefer UTF-8 and standard shell tools.
|
||||||
|
- Use file tools when they are simpler or more reliable than shell commands.
|
||||||
|
"""
|
||||||
|
|
||||||
return f"""# nanobot 🐈
|
return f"""# nanobot 🐈
|
||||||
|
|
||||||
You are nanobot, a helpful AI assistant.
|
You are nanobot, a helpful AI assistant.
|
||||||
@@ -72,6 +85,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].
|
- 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
|
- Custom skills: {workspace_path}/skills/{{skill-name}}/SKILL.md
|
||||||
|
|
||||||
|
{platform_policy}
|
||||||
|
|
||||||
## nanobot Guidelines
|
## nanobot Guidelines
|
||||||
- State intent before tool calls, but NEVER predict or claim results before receiving them.
|
- 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.
|
- Before modifying a file, read it first. Do not assume files or directories exist.
|
||||||
|
|||||||
@@ -9,15 +9,21 @@ always: true
|
|||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
- `memory/MEMORY.md` — Long-term facts (preferences, project context, relationships). Always loaded into your context.
|
- `memory/MEMORY.md` — Long-term facts (preferences, project context, relationships). Always loaded into your context.
|
||||||
- `memory/HISTORY.md` — Append-only event log. NOT loaded into context. Search it with grep. Each entry starts with [YYYY-MM-DD HH:MM].
|
- `memory/HISTORY.md` — Append-only event log. NOT loaded into context. Search it with grep-style tools or in-memory filters. Each entry starts with [YYYY-MM-DD HH:MM].
|
||||||
|
|
||||||
## Search Past Events
|
## Search Past Events
|
||||||
|
|
||||||
```bash
|
Choose the search method based on file size:
|
||||||
grep -i "keyword" memory/HISTORY.md
|
|
||||||
```
|
|
||||||
|
|
||||||
Use the `exec` tool to run grep. Combine patterns: `grep -iE "meeting|deadline" memory/HISTORY.md`
|
- Small `memory/HISTORY.md`: use `read_file`, then search in-memory
|
||||||
|
- Large or long-lived `memory/HISTORY.md`: use the `exec` tool for targeted search
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
- **Linux/macOS:** `grep -i "keyword" memory/HISTORY.md`
|
||||||
|
- **Windows:** `findstr /i "keyword" memory\HISTORY.md`
|
||||||
|
- **Cross-platform Python:** `python -c "from pathlib import Path; text = Path('memory/HISTORY.md').read_text(encoding='utf-8'); print('\n'.join([l for l in text.splitlines() if 'keyword' in l.lower()][-20:]))"`
|
||||||
|
|
||||||
|
Prefer targeted command-line search for large history files.
|
||||||
|
|
||||||
## When to Update MEMORY.md
|
## When to Update MEMORY.md
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user