Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
Merge remote-tracking branch 'origin/main' into feat/search-tools
Xubin Ren33bef8d5088a
diff --cc nanobot/skills/memory/SKILL.mdindex 05978d6ab,b47f2635c..042ef80ca--- a/nanobot/skills/memory/SKILL.md+++ b/nanobot/skills/memory/SKILL.md@@@ -8,38 -8,22 +8,29 @@@ always: tru## Structure- - `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-style tools or in-memory filters. Each entry starts with [YYYY-MM-DD HH:MM].+ - `SOUL.md` — Bot personality and communication style. **Managed by Dream.** Do NOT edit.+ - `USER.md` — User profile and preferences. **Managed by Dream.** Do NOT edit.+ - `memory/MEMORY.md` — Long-term facts (project context, important events). **Managed by Dream.** Do NOT edit.-- `memory/history.jsonl` — append-only JSONL, not loaded into context. search with `jq`-style tools.++- `memory/history.jsonl` — append-only JSONL, not loaded into context. Prefer the built-in `grep` tool to search it.## Search Past Events- Choose the search method based on file size:+ `memory/history.jsonl` is JSONL format — each line is a JSON object with `cursor`, `timestamp`, `content`.- - Small `memory/HISTORY.md`: use `read_file`, then search in-memory- - Large or long-lived `memory/HISTORY.md`: use the built-in `grep` tool first- - For broad searches, start with `grep(..., output_mode="count")` or accept the default `files_with_matches` output to scope the result set before asking for full matching lines- - Use `head_limit` / `offset` when browsing long histories in chunks- - Use `exec` only as a last-resort fallback when you truly need shell-specific behavior++- For broad searches, start with `grep(..., path="memory", glob="*.jsonl", output_mode="count")` or the default `files_with_matches` mode before expanding to full content++- Use `output_mode="content"` plus `context_before` / `context_after` when you need the exact matching lines++- Use `fixed_strings=true` for literal timestamps or JSON fragments++- Use `head_limit` / `offset` to page through long histories++- Use `exec` only as a last-resort fallback when the built-in search cannot express what you need+- Examples:- - `grep(pattern="keyword", path="memory/HISTORY.md", case_insensitive=true)`- - `grep(pattern="[2026-04-02 10:00]", path="memory/HISTORY.md", fixed_strings=true)`- - `grep(pattern="keyword", path="memory/HISTORY.md", output_mode="count", case_insensitive=true)`- - `grep(pattern="token", path="memory", glob="*.md", output_mode="files_with_matches", case_insensitive=true)`- - `grep(pattern="oauth|token", path="memory", glob="*.md", case_insensitive=true)`- - Fallback shell examples:- - **Linux/macOS:** `grep -i "keyword" memory/HISTORY.md`- - **Windows:** `findstr /i "keyword" memory\HISTORY.md`+ Examples (replace `keyword`):-- **Python (cross-platform):** `python -c "import json; [print(json.loads(l).get('content','')) for l in open('memory/history.jsonl','r',encoding='utf-8') if l.strip() and 'keyword' in l.lower()][-20:]"`-- **jq:** `cat memory/history.jsonl | jq -r 'select(.content | test("keyword"; "i")) | .content' | tail -20`-- **grep:** `grep -i "keyword" memory/history.jsonl`++- `grep(pattern="keyword", path="memory/history.jsonl", case_insensitive=true)`++- `grep(pattern="2026-04-02 10:00", path="memory/history.jsonl", fixed_strings=true)`++- `grep(pattern="keyword", path="memory", glob="*.jsonl", output_mode="count", case_insensitive=true)`++- `grep(pattern="oauth|token", path="memory", glob="*.jsonl", output_mode="content", case_insensitive=true)`- Prefer the built-in `grep` tool for large history files; only drop to shell when the built-in search cannot express what you need.+ ## Important- ## When to Update MEMORY.md-- Write important facts immediately using `edit_file` or `write_file`:- - User preferences ("I prefer dark mode")- - Project context ("The API uses OAuth2")- - Relationships ("Alice is the project lead")-- ## Auto-consolidation-- Old conversations are automatically summarized and appended to HISTORY.md when the session grows large. Long-term facts are extracted to MEMORY.md. You don't need to manage this.+ - **Do NOT edit SOUL.md, USER.md, or MEMORY.md.** They are automatically managed by Dream.+ - If you notice outdated information, it will be corrected when Dream runs next.+ - Users can view Dream's activity with the `/dream-log` command.diff --cc nanobot/templates/agent/identity.mdindex 000000000,db54bd17a..fa482af7bmode 000000,100644..100644--- a/nanobot/templates/agent/identity.md+++ b/nanobot/templates/agent/identity.md@@@ -1,0 -1,25 +1,27 @@@+ # nanobot 🐈++ You are nanobot, a helpful AI assistant.++ ## Runtime+ {{ runtime }}++ ## Workspace+ Your workspace is at: {{ workspace_path }}+ - Long-term memory: {{ workspace_path }}/memory/MEMORY.md (automatically managed by Dream — do not edit directly)-- History log: {{ workspace_path }}/memory/history.jsonl (append-only JSONL, not grep-searchable).++- History log: {{ workspace_path }}/memory/history.jsonl (append-only JSONL; prefer built-in `grep` for search).+ - Custom skills: {{ workspace_path }}/skills/{% raw %}{skill-name}{% endraw %}/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.+ - After writing or editing a file, re-read it if accuracy matters.+ - If a tool call fails, analyze the error before retrying with a different approach.+ - Ask for clarification when the request is ambiguous.++- Prefer built-in `grep` / `glob` tools for workspace search before falling back to `exec`.++- On broad searches, use `grep(output_mode="count")` or `grep(output_mode="files_with_matches")` to scope the result set before requesting full content.+ {% include 'agent/_snippets/untrusted_content.md' %}++ Reply directly with text for conversations. Only use the 'message' tool to send to a specific chat channel.+ IMPORTANT: To send files (images, documents, audio, video) to the user, you MUST call the 'message' tool with the 'media' parameter. Do NOT use read_file to "send" a file — reading a file only shows its content to you, it does NOT deliver the file to the user. Example: message(content="Here is the file", media=["/path/to/file.png"])