Skip to content

Commit a627789

Browse files
authored
docs: sync with goclaw v3 major release (EN+VI+ZH) (#51)
* docs: sync with goclaw v3 major release (EN+VI+ZH) Sync with goclaw source range 0e2282be..050aafc9 — v3 core architecture redesign. 922 source files changed, affecting nearly every subsystem. Major additions - NEW advanced/knowledge-vault.md (EN+VI+ZH) + DOC_MAP triple-sync (README.md, js/docs-app.js, index.html sidebar) - 8-stage agent pipeline replaces legacy think->act->observe across core-concepts/{how-goclaw-works,agents-explained} - 3-tier memory architecture (L0/L1/L2) + consolidation workers (episodic, semantic, dedup, dreaming, l0_abstract), auto_injector, trivial_filter in core-concepts/memory-system.md - v3 multi-tenant architecture with per-edition rate limits (MaxSubagentConcurrent, MaxSubagentDepth) in core-concepts/multi-tenancy.md - Mode Prompt System + PromptMode + OrchestrationMode in advanced/model-steering.md and agents/system-prompt-anatomy.md - Agent evolution: guardrails, suggestion engine, skill draft/apply, evolution cron, CAPABILITIES.md editable in advanced/agent-evolution.md - Parallel sub-agent enhancement (#600): BatchQueue[T], WaitAll, auto-retry, producer-consumer announce queue, subagent_tasks persistence in agent-teams/delegation-and-handoff.md - Domain Event Bus + event types catalog in agent-teams/team-messaging.md - Provider Adapter System + credential resolver + SSE scanner in providers/overview.md - v3 REST endpoint families (vault, episodic, memory, evolution, orchestration, v3-flags, packages, summoner, traces, backup, tenant-backup) in reference/rest-api.md - Session IDOR fix (requireSessionOwner) in reference/websocket-protocol.md - Migrations 37-44 schema additions (memory_evolution, vault_documents, vault_links, episodic_summaries + search index + promoted, vault_tsv_summary, vault_team_custom_scope, seed agents_core/task) in reference/database-schema.md, deployment/database-setup.md, deployment/upgrading.md, troubleshooting/database.md - Traces UI (timestamps, copy, syntax highlight, gzip export) + OpenTelemetry notes in deployment/observability.md - Docker privilege separation, pkg-helper, pairing auth hardening in deployment/security-hardening.md - cmd/ gateway decomposition + new backup/restore/tenant commands in reference/cli-commands.md - Bootstrap templates (SOUL, CAPABILITIES, AGENTS_CORE, AGENTS_TASK, BOOTSTRAP_PREDEFINED) in agents/{creating-agents,summoning-bootstrap} All modified pages carry updated footer: goclaw-source: 050aafc9 | updated: 2026-04-09 Audit report: plans/reports/docs-audit-260409-2332-v3-major-release.md * docs: refresh README structure tree counts - providers 23 -> 24, channels 11 -> 12, agent-teams 5 -> 6, advanced 21 -> 24 (matches current filesystem) - add zh/ mirror line alongside vi/ - drop stale '~96 pages' suffix on vi/ * docs: fix broken v3 system links on how-goclaw-works - /mode-prompt-system -> /model-steering (Mode Prompt System content lives in advanced/model-steering.md) - /multi-tenant -> /multi-tenancy (DOC_MAP key is multi-tenancy) Applies to EN, VI, ZH. * docs(what-is-goclaw): refresh for v3 + expand audit mapping.json what-is-goclaw (EN+VI+ZH): - replace think->act->observe with 8-stage pipeline - add Knowledge Vault, 3-Tier Memory, Agent Evolution, Mode Prompt System, Multi-Tenant v3 to Key Features table - update How It Works mermaid + narrative with pipeline + workers - PostgreSQL OR SQLite operating mode note - footer SHA 050aafc9 | 2026-04-09 audit mapping.json (46 -> 114 rules): - NEW patterns: internal/{vault,consolidation,eventbus,orchestration, pipeline,backup,tokencount,workspace}/*, pkg/{browser,protocol}/* - Split internal/agent/* into targeted sub-patterns (evolution, suggestion, orchestration_mode, systemprompt, prompt_builder, preview_prompt, user_identity, loop_pipeline) - Split internal/http/* into feature-specific patterns (vault, memory, episodic, evolution, orchestration, summoner, traces, packages, backup, tenant_backup, knowledge_graph, skills_grants) - Split cmd/* into targeted patterns (onboard, tui, backup, restore, tenant, setup, gateway_evolution) - Add troubleshooting/* page links to corresponding internal/* patterns - NEW top-level patterns: Dockerfile, docker-compose*.yaml, Makefile, scripts/install*, scripts/setup*, .github/workflows/release* - NEW: docs/* source-of-truth patterns for v3 docs (00-arch, 17-changelog, 21-evolution, 22-v3-http, 23-multi-tenant, 24-vault, model-steering) - Document unmapped pages (recipes, showcases, pure guides) * docs: sync remaining stale pages for v3 release (EN+VI+ZH) Wave 2 of v3 docs sync — 104 files, +1796/-142. agents/* (5 pages × EN+VI+ZH): - context-files: CAPABILITIES.md, AGENTS_CORE/TASK, BOOTSTRAP_PREDEFINED - editing-personality: self-evolve allows CAPABILITIES.md - open-vs-predefined: capabilities backfill - sharing-and-access: permission cache - user-overrides: user_identity_resolver core-concepts + agent-teams (3 pages × EN+VI+ZH): - sessions-and-history: v3 pipeline stage references - tools-overview: vault_link, vault_backlinks tools - what-are-teams: orchestration redesign, event bus advanced/* (6 pages × EN+VI+ZH): - usage-quota: MaxSubagentConcurrent/Depth edition limits - cost-tracking: per-subagent token tracking - extended-thinking: Qwen 3.5, DashScope guard - custom-tools: vault tools (vault_link, vault_backlinks) - caching: permission cache - channel-instances: health states getting-started/* (4 pages × EN+VI+ZH): - quick-start: new TUI onboard flow - installation: Docker pkg-helper, privilege separation - configuration: v3 config keys (vault, evolution, edition) - web-dashboard-tour: vault page, packages page, v3 flags troubleshooting/* (6 pages × EN+VI+ZH): - agent-teams: WaitAll, BatchQueue, edition rate limits - websocket: session IDOR / requireSessionOwner - providers: SSEScanner, credential resolver - channels: WhatsApp native, health states - mcp: footer only - channels/whatsapp.md: footer only medium-priority (11 pages × EN+VI+ZH): - telegram: /subagents commands - browser-pairing: auth hardening - authentication: OAuth provider routing - scheduling-cron: evolution cron - anthropic: prompt caching fix, model aliases - dashscope: Qwen 3.5, per-model thinking - acp: session tracking - config-reference: v3 config keys - environment-variables: runtime package env vars - docker-compose: pkg-helper, privilege separation - production-checklist: v3 upgrade items All footers: goclaw-source: 050aafc9 | updated: 2026-04-09 * docs: bump remaining 169 stale footers to 050aafc9 (Wave 3) All remaining LOW-priority pages (channels, advanced, providers, recipes, reference/templates, showcases, troubleshooting, deployment, getting-started) now point to goclaw HEAD 050aafc9. Source audit confirmed these pages only need footer bumps — all v3 changes in the corresponding source code (channel handler splits, heartbeat ticker refactor, provider file decomposition) are internal refactors with no user-facing documentation impact. Coverage: 56 EN × 3 langs = 169 files (EN + VI + ZH) Includes reusable scripts/bump-footers.py for future sync. * docs: sync with goclaw v3.2.0 — Pancake channel, schema v47, API endpoints - Add channels/pancake.md: new multi-platform proxy channel (FB, Zalo, IG, TikTok, WA, Line) with full setup, config, webhook, dedup docs - Bump database schema v44→v47: episodic recall scoring, vault nullable agent_id, cron_jobs unique constraint - Add 19 undocumented REST endpoints: vault CRUD, upload, rescan, search, enrichment status, system restore, agent prompt preview - Add whatsapp.qr.start method + events to WebSocket protocol - Remove stale GET /agents/{id}/instances/{userID}/files/{fileName} - Update mapping.json with pancake source rule - Triple sync: README.md + docs-app.js + index.html * docs: regenerate llms files with Pancake channel - Add Pancake entry to EN/VI/ZH llms.txt - Rebuild llms-full.txt (now 114 files) * docs: fix 18 broken internal links + bump goclaw-source footers to 1296cdbf Broken link fixes (EN/VI/ZH): - predefined-agents.md → agents-explained.md - skill-publishing.md → skills.md - api-keys.md → advanced/api-keys-rbac.md - agent-teams/overview.md → what-are-teams.md - delegation.md → ../agent-teams/delegation-and-handoff.md - knowledge-vault → knowledge-vault.md (missing .md extension) - knowledge-graph → knowledge-graph.md (missing .md extension) - CONTRIBUTING.md link.md placeholders → real paths Bump goclaw-source footers to 1296cdbf | 2026-04-11 for all modified files Remove deprecated scripts/bump-footers.py and scripts/bump-footers.sh * fix(js): resolve relative markdown links to DOC_MAP hash keys Previous regex only stripped one level of ../, causing links like ../core-concepts/agents-explained.md to remain as raw .md paths and render markdown source instead of SPA navigation. New logic: strip all ../ ./ prefixes, match bare filename against DOC_MAP[k].file.en.endsWith(), produce /hashKey routes. * docs(templates): sync with goclaw source — add CAPABILITIES.md, fix AGENTS.md/TOOLS.md - Add reference/templates/capabilities.md — core context file referenced from SOUL.md, seeded to all workspaces, loaded in all session modes - Fix AGENTS.md doc template to match source: - Add "Match their language" rule (was missing) - Fix Memory section to match source ("Your tools handle recall") - Add "Participate, don't dominate" line in Group Chats - Add "Adding a message would interrupt the vibe" NO_REPLY trigger - Match compact cron example format from source - Fix TOOLS.md doc template to include "Media Files" section from source - Triple sync: README.md + docs-app.js + index.html sidebar for capabilities - Update llms.txt (EN/VI/ZH) with CAPABILITIES.md entry - Bump footer SHA to 1296cdbf
1 parent fde3e5b commit a627789

368 files changed

Lines changed: 28135 additions & 17613 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/goclaw-docs-audit/mapping.json

Lines changed: 116 additions & 26 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Core material with examples, diagrams, and code blocks.
3333

3434
## What's Next
3535

36-
- [Next logical page](link.md)
37-
- [Related topic](link.md)
36+
- [Getting Started](getting-started/quick-start.md)
37+
- [Related topic](core-concepts/how-goclaw-works.md)
3838
```
3939

4040
### Tone

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
- [Zalo Personal](channels/zalo-personal.md)
7171
- [Slack](channels/slack.md)
7272
- [WhatsApp](channels/whatsapp.md)
73+
- [Pancake](channels/pancake.md)
7374
- [WebSocket](channels/websocket.md)
7475
- [Browser Pairing](channels/browser-pairing.md)
7576

@@ -92,6 +93,7 @@
9293
- [Media Generation](advanced/media-generation.md)
9394
- [TTS & Voice](advanced/tts-voice.md)
9495
- [Knowledge Graph](advanced/knowledge-graph.md)
96+
- [Knowledge Vault](advanced/knowledge-vault.md)
9597
- [Caching](advanced/caching.md)
9698
- [Browser Automation](advanced/browser-automation.md)
9799
- [Extended Thinking](advanced/extended-thinking.md)
@@ -142,6 +144,7 @@
142144
- [AGENTS.md](reference/templates/agents.md)
143145
- [SOUL.md](reference/templates/soul.md)
144146
- [IDENTITY.md](reference/templates/identity.md)
147+
- [CAPABILITIES.md](reference/templates/capabilities.md)
145148
- [TOOLS.md](reference/templates/tools.md)
146149
- [USER.md](reference/templates/user.md)
147150
- [USER_PREDEFINED.md](reference/templates/user-predefined.md)
@@ -173,16 +176,17 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for writing guidelines and bilingual proc
173176
├── getting-started/ # Onboarding (6 pages)
174177
├── core-concepts/ # Architecture & concepts (6 pages)
175178
├── agents/ # Agent configuration (8 pages)
176-
├── providers/ # LLM provider guides (23 pages)
177-
├── channels/ # Messaging channel setup (11 pages)
178-
├── agent-teams/ # Team collaboration (5 pages)
179-
├── advanced/ # Power-user features (21 pages)
179+
├── providers/ # LLM provider guides (24 pages)
180+
├── channels/ # Messaging channel setup (13 pages)
181+
├── agent-teams/ # Team collaboration (6 pages)
182+
├── advanced/ # Power-user features (24 pages)
180183
├── deployment/ # Deploy & operate (7 pages)
181184
├── recipes/ # Step-by-step tutorials (5 pages)
182185
├── showcases/ # Gallery & examples (1 page)
183-
├── reference/ # API, CLI & config reference (15 pages)
186+
├── reference/ # API, CLI & config reference (16 pages)
184187
├── troubleshooting/ # Debug & FAQ (7 pages)
185-
├── vi/ # Vietnamese mirror (~96 pages)
188+
├── vi/ # Vietnamese mirror
189+
├── zh/ # Chinese mirror
186190
├── archive/ # Old technical docs (DO NOT reference)
187191
└── images/dashboard/ # Dashboard screenshots
188192
```

advanced/agent-evolution.md

Lines changed: 100 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@ GoClaw includes three subsystems that allow predefined agents to evolve their be
88

99
| Subsystem | What it does | Config key |
1010
|---|---|---|
11-
| Self-Evolution | Agent refines its own tone and voice via SOUL.md | `self_evolve` |
11+
| Self-Evolution | Agent refines its own tone/voice (SOUL.md) and domain expertise (CAPABILITIES.md) | `self_evolve` |
1212
| Skill Learning Loop | Agent captures reusable workflows as skills | `skill_evolve` |
1313
| Skill Management | Create, patch, delete, and grant skills | `skill_manage` tool |
1414

1515
Both `self_evolve` and `skill_evolve` are disabled by default. Enable them per-agent in **Agent Settings → Config tab**.
1616

1717
---
1818

19-
## Self-Evolution (SOUL.md)
19+
## Self-Evolution (SOUL.md + CAPABILITIES.md)
2020

2121
### What it does
2222

23-
When `self_evolve` is enabled, an agent can update its own `SOUL.md` file during conversation to refine how it communicates. There is no dedicated tool for this — the agent uses the standard `write_file` tool. A context file interceptor ensures only `SOUL.md` is writable; `IDENTITY.md` and `AGENTS.md` remain locked regardless.
23+
When `self_evolve` is enabled, an agent can update two of its own context files during conversation:
24+
25+
- **`SOUL.md`** — to refine communication style (tone, voice, vocabulary, response style)
26+
- **`CAPABILITIES.md`** — to refine domain expertise, technical skills, and specialized knowledge
27+
28+
There is no dedicated tool for this — the agent uses the standard `write_file` tool. A context file interceptor ensures only `SOUL.md` and `CAPABILITIES.md` are writable; `IDENTITY.md` and `AGENTS.md` remain locked regardless.
2429

2530
Changes happen incrementally. The agent is guided to update only when it notices clear patterns in user feedback — not on every turn.
2631

@@ -39,30 +44,20 @@ When `self_evolve=true`, GoClaw injects this guidance into the system prompt (~9
3944
```
4045
## Self-Evolution
4146
42-
You have self-evolution enabled. You may update your SOUL.md file to
43-
refine your communication style over time.
44-
45-
What you CAN evolve in SOUL.md:
46-
- Tone, voice, and manner of speaking
47-
- Response style and formatting preferences
48-
- Vocabulary and phrasing patterns
49-
- Interaction patterns based on user feedback
50-
51-
What you MUST NOT change:
52-
- Your name, identity, or contact information
53-
- Your core purpose or role
54-
- Any content in IDENTITY.md or AGENTS.md (these remain locked)
55-
56-
Make changes incrementally. Only update SOUL.md when you notice clear
57-
patterns in user feedback or interaction style preferences.
47+
You may update SOUL.md to refine communication style (tone, voice, vocabulary, response style).
48+
You may update CAPABILITIES.md to refine domain expertise, technical skills, and specialized knowledge.
49+
MUST NOT change: name, identity, contact info, core purpose, IDENTITY.md, or AGENTS.md.
50+
Make changes incrementally based on clear user feedback patterns.
5851
```
5952

53+
> Source: `buildSelfEvolveSection()` in `internal/agent/systemprompt.go`.
54+
6055
### Security
6156

6257
| Layer | What it enforces |
6358
|---|---|
6459
| System prompt guidance | CAN/MUST NOT rules limit scope |
65-
| Context file interceptor | Validates that only SOUL.md is written |
60+
| Context file interceptor | Validates that only SOUL.md or CAPABILITIES.md is written |
6661
| File locking | IDENTITY.md and AGENTS.md are always read-only |
6762

6863
---
@@ -332,6 +327,89 @@ Maximum overhead per run with both features enabled: ~305 tokens for skill learn
332327

333328
---
334329

330+
## v3: Evolution Metrics and Suggestion Engine
331+
332+
v3 adds automated, metrics-driven evolution for predefined agents. This operates separately from the manual skill learning loop above.
333+
334+
### How It Works
335+
336+
```
337+
Metrics collected during agent runs (7-day rolling window)
338+
339+
SuggestionEngine.Analyze() — runs daily via cron
340+
├─ LowRetrievalUsageRule (avg recall < threshold)
341+
├─ ToolFailureRule (single tool failure rate > 20%)
342+
└─ RepeatedToolRule (tool called 5+ consecutive times)
343+
344+
Suggestion created with status "pending"
345+
346+
Admin reviews → approve / reject / rollback
347+
```
348+
349+
### Metric Types
350+
351+
| Type | What is tracked | Examples |
352+
|------|----------------|---------|
353+
| `tool` | Per-tool performance | invocation_count, success_rate, failure_count, avg_duration_ms |
354+
| `retrieval` | Knowledge retrieval quality | recall_rate, precision, relevance_score |
355+
| `feedback` | User satisfaction signals | rating, sentiment, effectiveness_score |
356+
357+
Metrics aggregate over 7-day rolling windows. At least 100 data points are required before a suggestion can be auto-applied (configurable via `min_data_points` guardrail).
358+
359+
### Suggestion Types
360+
361+
| Type | Trigger | Recommendation |
362+
|------|---------|----------------|
363+
| `low_retrieval_usage` | Avg recall below threshold for 7 days | Lower `retrieval_threshold` by ≤ 0.1 |
364+
| `tool_failure` | Single tool failure rate > 20% | Review tool config or add fallback |
365+
| `repeated_tool` | Same tool called 5+ consecutive times | Extract workflow as a skill |
366+
367+
Only one pending suggestion of each type per agent exists at a time (duplicate prevention).
368+
369+
### Auto-Adapt Guardrails
370+
371+
Suggestions can be auto-applied when approved. Guardrails prevent runaway parameter changes:
372+
373+
| Guardrail | Default | Purpose |
374+
|-----------|---------|---------|
375+
| `max_delta_per_cycle` | 0.1 | Max parameter change per apply cycle |
376+
| `min_data_points` | 100 | Minimum metrics required before applying |
377+
| `rollback_on_drop_pct` | 20.0 | Auto-rollback if quality drops >20% after apply |
378+
| `locked_params` | `[]` | Parameters that cannot be auto-changed |
379+
380+
Baseline parameter values are stored in the suggestion's `parameters._baseline` field for rollback.
381+
382+
### Evolution Cron
383+
384+
Analysis runs on a configurable schedule (default: daily at 02:00). Set via `evolution_cron_schedule` in agent config:
385+
386+
```json
387+
{
388+
"evolution_enabled": true,
389+
"evolution_cron_schedule": "every day at 02:00",
390+
"evolution_guardrails": {
391+
"max_delta_per_cycle": 0.1,
392+
"min_data_points": 100,
393+
"rollback_on_drop_pct": 20.0,
394+
"locked_params": []
395+
}
396+
}
397+
```
398+
399+
Set `evolution_enabled: false` to disable all metrics collection for an agent.
400+
401+
### HTTP API
402+
403+
| Method | Path | Description |
404+
|--------|------|-------------|
405+
| `GET` | `/v1/agents/{id}/evolution/metrics` | Query/aggregate metrics |
406+
| `GET` | `/v1/agents/{id}/evolution/suggestions` | List suggestions |
407+
| `PATCH` | `/v1/agents/{id}/evolution/suggestions/{sid}` | Approve / reject / rollback |
408+
409+
WebSocket equivalents: `agent.evolution.metrics`, `agent.evolution.suggestions`, `agent.evolution.apply`, `agent.evolution.rollback`.
410+
411+
---
412+
335413
## Common Issues
336414

337415
| Issue | Cause | Fix |
@@ -348,7 +426,6 @@ Maximum overhead per run with both features enabled: ~305 tokens for skill learn
348426
## What's Next
349427

350428
- [Skills](./skills.md) — skill format, hierarchy, and hot reload
351-
- [Predefined Agents](../core-concepts/predefined-agents.md) — how predefined agents differ from open agents
352-
- [publish_skill](./skill-publishing.md) — directory-based skill publishing
429+
- [Predefined Agents](../core-concepts/agents-explained.md) — how predefined agents differ from open agents
353430

354-
<!-- goclaw-source: b9d8754 | updated: 2026-03-23 -->
431+
<!-- goclaw-source: 1296cdbf | updated: 2026-04-11 -->

advanced/api-keys-rbac.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,4 @@ When a key is created or revoked, a `cache.invalidate` event is broadcast on the
259259
- [Security Hardening](/deploy-security) — full 5-layer permission overview
260260
- [CLI Credentials](./cli-credentials.md) — SecureCLI: inject credentials into CLI tools (gh, aws, gcloud) without exposing secrets to the agent
261261

262-
<!-- goclaw-source: c083622f | updated: 2026-04-05 -->
262+
<!-- goclaw-source: 050aafc9 | updated: 2026-04-09 -->

advanced/authentication.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ This flow is distinct from standard API key providers — it is only needed if y
1010

1111
---
1212

13+
## OAuth Provider Routing (v3)
14+
15+
GoClaw supports routing OAuth tokens to multiple provider types beyond OpenAI/Codex. In v3, the provider type `media` covers services like **Suno** (AI music) and **DashScope** (Alibaba media generation) that use OAuth or session tokens rather than plain API keys.
16+
17+
### Media Provider Types
18+
19+
| Provider type | Services | Auth method |
20+
|---------------|----------|-------------|
21+
| `openai-codex` | ChatGPT via Responses API | OAuth 2.0 PKCE |
22+
| `suno` | Suno AI music generation | Session token |
23+
| `dashscope` | Alibaba DashScope (when OAuth-based) | OAuth or API key |
24+
25+
Media provider types are registered in the `llm_providers` table with the appropriate `provider_type` value. The gateway resolves the correct token source and refresh logic based on `provider_type` at request time.
26+
27+
---
28+
1329
## How It Works
1430

1531
```mermaid
@@ -195,4 +211,4 @@ source .env.local
195211
- [Providers Overview](/providers-overview) — all supported LLM providers and how to configure them
196212
- [Hooks & Quality Gates](/hooks-quality-gates) — add validation to agent outputs
197213

198-
<!-- goclaw-source: 57754a5 | updated: 2026-03-18 -->
214+
<!-- goclaw-source: 050aafc9 | updated: 2026-04-09 -->

advanced/browser-automation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,4 @@ Returns:
256256
- [Exec Approval](/exec-approval) — require human sign-off before running commands
257257
- [Hooks & Quality Gates](/hooks-quality-gates) — add pre/post checks to agent actions
258258

259-
<!-- goclaw-source: 57754a5 | updated: 2026-03-18 -->
259+
<!-- goclaw-source: 050aafc9 | updated: 2026-04-09 -->

advanced/caching.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ Values are serialized as JSON. Pattern deletion uses SCAN with batch size of 100
7070

7171
---
7272

73+
## Permission Cache
74+
75+
GoClaw includes a dedicated `PermissionCache` for hot permission lookups that happen on every request. Unlike the context file caches, the permission cache is always in-memory — it does not use Redis.
76+
77+
| Cache | TTL | Key format | What it caches |
78+
|---|---|---|---|
79+
| `tenantRole` | 30s | `tenantID:userID` | User's role within a tenant |
80+
| `agentAccess` | 30s | `agentID:userID` | Whether user can access an agent + their role |
81+
| `teamAccess` | 30s | `teamID:userID` | Whether user can access a team |
82+
83+
**Invalidation via pubsub**: When a user's permissions change (e.g., role update, agent access revoked), GoClaw publishes a `CacheInvalidate` event on the internal bus. The permission cache processes these events:
84+
85+
- `CacheKindTenantUsers` — clears all tenant role entries (short TTL makes a full clear acceptable)
86+
- `CacheKindAgentAccess` — removes all entries for that `agentID` prefix
87+
- `CacheKindTeamAccess` — removes all entries for that `teamID` prefix
88+
89+
Permission changes take effect within 30 seconds at most, with immediate invalidation on write paths.
90+
91+
---
92+
7393
## Cache Behavior
7494

7595
Both backends implement the same interface:
@@ -91,4 +111,4 @@ Both backends implement the same interface:
91111
- [Database Setup](/deploy-database) — PostgreSQL configuration
92112
- [Production Checklist](/deploy-checklist) — Deploy with confidence
93113

94-
<!-- goclaw-source: 57754a5 | updated: 2026-03-18 -->
114+
<!-- goclaw-source: 050aafc9 | updated: 2026-04-09 -->

advanced/channel-instances.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,40 @@ curl -X DELETE http://localhost:8080/v1/channels/instances/3f2a1b4c-... \
195195

196196
---
197197

198+
## Channel Health
199+
200+
Each channel instance exposes a runtime health snapshot. GoClaw tracks the current lifecycle state, failure classification, failure counters, and an operator remediation hint.
201+
202+
### Health states
203+
204+
| State | Meaning |
205+
|---|---|
206+
| `registered` | Instance created but not yet started |
207+
| `starting` | Channel is initializing (connecting to upstream) |
208+
| `healthy` | Channel is running and accepting messages |
209+
| `degraded` | Channel is running but experiencing issues |
210+
| `failed` | Channel failed to start or crashed |
211+
| `stopped` | Channel was intentionally stopped |
212+
213+
### Failure classification
214+
215+
When a channel enters `failed` or `degraded` state, GoClaw classifies the error into one of four kinds:
216+
217+
| Kind | Examples | Retryable |
218+
|---|---|---|
219+
| `auth` | 401 Unauthorized, invalid token | No |
220+
| `config` | Missing credentials, invalid proxy URL, agent not found | No |
221+
| `network` | Timeout, connection refused, DNS failure, EOF | Yes |
222+
| `unknown` | Unexpected errors | Yes |
223+
224+
### Remediation hints
225+
226+
Each failed channel includes a `remediation` object with a `code`, `headline`, and `hint` pointing to the relevant UI surface (`credentials`, `advanced`, `reauth`, or `details`). For example, a Zalo Personal auth failure suggests re-opening the sign-in flow rather than checking credentials.
227+
228+
Health data is available in the channel instance detail view in the Web UI and via the `GET /v1/channels/instances/{id}` endpoint.
229+
230+
---
231+
198232
## Group file writers
199233

200234
Each channel instance exposes writer-management endpoints that delegate to its bound agent. Writers control who can upload files through the group file feature.
@@ -248,4 +282,4 @@ DELETE /v1/channels/instances/{id}/writers/{userId}?group_id=<group_id>
248282
- [Multi-Channel Setup](/recipe-multi-channel)
249283
- [Multi-Tenancy](/multi-tenancy)
250284

251-
<!-- goclaw-source: 57754a5 | updated: 2026-03-18 -->
285+
<!-- goclaw-source: 050aafc9 | updated: 2026-04-09 -->

advanced/cli-credentials.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,4 @@ Update the grant: `{"enabled": false}`. The binary remains accessible to other a
143143
- [API Keys & RBAC](/api-keys-rbac)
144144
- [Security Hardening](/deploy-security)
145145

146-
<!-- goclaw-source: c083622f | updated: 2026-04-05 -->
146+
<!-- goclaw-source: 050aafc9 | updated: 2026-04-09 -->

0 commit comments

Comments
 (0)