docs: tool_choice automatisch, System-Prompt-Blöcke reduziert, History-Limit + Reminder

ARCHITECTURE.md + ARCHITECTURE_QUICK.md:
- tool_choice aus agents-Tabelle entfernt (nicht mehr konfigurierbar)
- Tool-Choice automatisch: any wenn Workspace/Skills/Memory, sonst auto
- System-Prompt-Blöcke 14 → 11 (Rules, Verhaltensregeln, Erinnerung entfernt)
- History-Limit: max 120 Messages dokumentiert
- System-Prompt-Reminder alle ~30 Messages dokumentiert (Lost-in-the-Middle)
- SystemPromptBuilder: + Reminder-Generierung
- ChatContext: PromptBlocks Property dokumentiert
- buildAgentCard: toolChoice-Badge entfernt
- Plan-Modus: übersprungene Blöcke aktualisiert
This commit is contained in:
Meleki committed 2026-03-09 06:40:13 +01:00
1 parent 47d6f44e07
commit 9ce210ab0c
2 files changed
+42 -39

No files matched your search

+18 -17
View File
@@ -66,7 +66,7 @@ User 1──* TelegramBot 1──* Session (via telegram_bot_id)
|---------|-------|
| `users` | Login, DisplayName, IsAdmin, Persona, Settings (JSON), DefaultPath |
| `tokens` | Auth-Tokens → User |
| `agents` | AI-Agenten (Model, ToolChoice, CustomCommands, AutoCommit, UseSoul/Identity/UserInfo/Memory, WebSearch, AllowUserChoice, TaskInstruction, AvatarScale/Offset, AvatarSmall, IsPublic) |
| `agents` | AI-Agenten (Model, CustomCommands, AutoCommit, UseSoul/Identity/UserInfo/Memory, WebSearch, AllowUserChoice, TaskInstruction, AvatarScale/Offset, AvatarSmall, IsPublic) |
| `sessions` | Chat-Sessions (Description, Image, ImageSmall, Workspace, Context, CustomCommands, TelegramBotId, TelegramChatId, AvatarScale/Offset, PreparerAgentId, ReviewAgentId, MaxReviewIterations, FinalizerAgentId) |
| `chains` | Ein Request-Response-Zyklus (Tokens, Timing, Iterations, PlanMode, ToolChoice, ToolNames, StreamErrorInfo, ArchiveId) |
| `messages` | Einzelne Nachrichten (text / tool_use / tool_result / error / web_search_result), Tag für Sub-Agent-Markierung oder Import-Herkunft (`openclaw-import`) |
@@ -114,7 +114,7 @@ User 1──* TelegramBot 1──* Session (via telegram_bot_id)
| **AnthropicService** | Claude API: SSE Streaming + Non-Streaming |
| **ToolService** | Tool-Definitionen + Ausführung (13 Tools) |
| **WorkspaceHelper** | Workspace-Pfad-Auflösung (relativ → absolut), Path-Traversal-Schutz (static) |
| **SystemPromptBuilder** | System-Prompt aus modularen Blöcken zusammenbauen (static) |
| **SystemPromptBuilder** | System-Prompt aus modularen Blöcken zusammenbauen + Reminder-Generierung (static) |
| **MemoryService** | Agent-Gedächtnis auf Dateisystem |
| **SkillService** | Skill-Discovery aus Dateisystem |
| **TelegramService** | Telegram Bot API (Bot-basiert, Multi-Session-Routing) |
@@ -131,7 +131,7 @@ User 1──* TelegramBot 1──* Session (via telegram_bot_id)
User-Input → POST /api/chat (SSE)
→ ChatService.BuildContext()
→ History aus DB laden (letzte N Chains)
→ SystemPromptBuilder: 14 Blöcke zusammensetzen (+ Plan-Modus/Preparer-Blöcke)
→ SystemPromptBuilder: 11 Blöcke zusammensetzen (+ Plan-Modus/Preparer-Blöcke)
→ Tool-Definitionen vom ToolService holen (im Plan-Modus: nur Read-only)
→ Preparer-Phase (optional, wenn PreparerAgentId gesetzt):
→ RunPreparer() → RunAgentChat(agentType: "preparer")
@@ -155,7 +155,7 @@ User-Input → POST /api/chat (SSE)
→ Chain + Messages in DB speichern
```
**History-Optimierung:** Ältere Chains nur Text-Messages (keine Tool-Calls). Letzte Chain vollständig. Tool-Results auf 20.000 Zeichen gekürzt. Attachments nur für letzte User-Message.
**History-Optimierung:** Max 120 Messages. Ältere Chains nur Text-Messages (keine Tool-Calls). Letzte Chain vollständig. Tool-Results auf 20.000 Zeichen gekürzt. Attachments nur für letzte User-Message. System-Prompt-Reminder alle ~30 Messages.
**Rendering:** Markdown via marked.js + LaTeX via KaTeX (`$$...$$` Block, `$...$` Inline). Timestamps im Format `dd.MM.yyyy HH:mm:ss` on hover.
@@ -181,29 +181,30 @@ User-Input → POST /api/chat (SSE)
**Sicherheit:** Alle Pfade werden auf das Workspace-Verzeichnis beschränkt (`..` wird blockiert). Tools sind pro Agent konfigurierbar (Feld `tools` als komma-separierte Liste).
**Tool-Choice:** Standard `auto`. Wird zu `none` bei `/no-tools`. Einzelne Tools forcierbar via `/tool:toolname`.
**Tool-Choice:** Automatisch `any` wenn Workspace/Skills/Memory vorhanden, sonst `auto`. Wird zu `none` bei `/no-tools`. Einzelne Tools forcierbar via `/tool:toolname`.
---
## System-Prompt (14+ Blöcke, in Reihenfolge)
## System-Prompt (11+ Blöcke, in Reihenfolge)
1. **Identity** – `IDENTITY.md` des Agents
2. **Soul** – `SOUL.md` des Agents
3. **Anweisungen** – `TaskInstruction` des Agents (optional, wenn gesetzt)
4. **User** – `USER.md` (globale User-Infos) + Persona
5. **Rules** – Verhaltensregeln (Tool-Nutzung, Workspace)
6. **Workspace** – Pfad-Info, Tool-Liste
7. **Rückfragen** – Hinweis zu `ask_user_choice` (wenn AllowUserChoice aktiv)
8. **Context** – Session-Kontext (custom system prompt)
9. **Skills** – Zugeordnete Skill-Prompts
10. **Memory** – Aktueller MEMORY.md-Inhalt + Regeln
11. **Git** – Commit-Verhalten (wenn AutoCommit konfiguriert)
12. **Verhaltensregeln** – "IMMER Tools aufrufen" (wenn Workspace + any)
13. **Erinnerung** – Höchste Priorität: Tool-Aufrufe! (wenn Workspace + any)
14. **Markierte Nachrichten** – Vom User als wichtig markiert
- **[Plan-Modus]** – Überspringt 5, 11, 12, 13; Read-only Tools; "Nur analysieren"
5. **Workspace** – Pfad-Info, Tool-Liste
6. **Rückfragen** – Hinweis zu `ask_user_choice` (wenn AllowUserChoice aktiv)
7. **Context** – Session-Kontext (custom system prompt)
8. **Skills** – Zugeordnete Skill-Prompts
9. **Memory** – Aktueller MEMORY.md-Inhalt + Regeln
10. **Git** – Commit-Verhalten (wenn AutoCommit konfiguriert)
11. **Markierte Nachrichten** – Vom User als wichtig markiert
- **[Plan-Modus]** – Überspringt 10; Read-only Tools; "Nur analysieren"
- **[Preparer-Block]** – Instruktionen für Vorbereiter-Agents
**Tool-Choice:** Automatisch `any` wenn Workspace/Skills/Memory vorhanden, sonst `auto`. Nicht konfigurierbar pro Agent.
**History-Reminder:** Alle ~30 Messages wird ein automatisch generierter Reminder injiziert (`[System Reminder] Beachte weiterhin den System-Prompt (...)`) – bekämpft "Lost-in-the-Middle"-Problem.
---
## Frontend-Routing