Team members dispatched via team tasks can now read the leader's memory
files (MEMORY.md, memory/*.md) as a fallback when they have no own
memory. Memory writes are blocked for members — only the leader can
save memory files. This follows the existing team_workspace context
propagation pattern: dispatch metadata → RunRequest → context → tools.
Affected tools: read_file (interceptor), memory_get, memory_search,
list_files (interceptor). All include leader fallback with per-user →
global scope cascade.
- Add batch embedding generation in IngestExtraction (was missing, making vector search dead code)
- Add BackfillKGEmbeddings for existing entities without embeddings
- Add KGUserID() context helper to prevent entity duplication in shared KG mode
- Add IsSharedKG handling to DeleteEntity, DeleteRelation, ListEntities, ListAllRelations, PruneByConfidence
- Replace O(n²) bubble sort with slices.SortFunc in hybridMergeEntities
- Fix vectorSearchEntities duplicate param (reuse same $N for SELECT and ORDER BY)
- Update KG tool and memory interceptor to use KGUserID instead of MemoryUserID
- Remove unrelated MemoryStore additions from Loop/Resolver (should be separate PR)
- Fix comments: "team_id" → "agent-level sharing" to match actual implementation
* fix(memory): auto-backup + overwrite warning for memory files
When an agent writes to a memory file that already has content:
1. Old content is backed up to memory/.prev/{filename} (best-effort)
2. Write succeeds normally (no blocking)
3. Tool result includes warning with previous content (truncated to
4000 chars) so the agent can notice and merge if needed
Backup files are hidden from list_files and not indexed/embedded.
No database migration needed - uses existing PutDocument.
* fix(memory): support append mode + fix UTF-8 truncation in overwrite warning
- Add appendMode parameter to MemoryInterceptor.WriteFile() so
write_file(append=true) actually appends to memory files instead
of silently replacing content. Uses "\n\n---\n\n" separator.
- Fix UTF-8 truncation in overwrite warning: use []rune instead of
byte slicing to avoid cutting multi-byte characters.
- Fix char count in warning message: use len([]rune()) not len().
- Remove .prev/ backup mechanism (prevBackupPath, isPrevPath, backup
writes, ListFiles filter) in favor of simpler approach: append
mode prevents data loss, warning enables self-correction.
---------
Co-authored-by: Luvu182 <208665161+Luvu182@users.noreply.github.com>
Co-authored-by: viettranx <viettranx@gmail.com>
Two related fixes:
1. Memory interceptor now resolves workspace from request context
(per-user workspace) instead of using the static global workspace.
This fixes memory writes with absolute paths under per-user
workspaces (e.g. workspace/channel/userID/memory/) being bypassed
and written to disk instead of the database, which also prevented
KG extraction, memory indexing, and cross-session recall.
2. KG extractor: increase max_tokens 4096→8192, add retry on
truncation (finish_reason=length), and support chunking for
long inputs with deduplication on merge.
Memory (MEMORY.md, memory/*) and knowledge graph are now shared when
workspace sharing is active, matching the filesystem sharing behavior.
Previously memory was always per-user isolated even with shared workspace,
causing inconsistencies when collaborating on the same files.
Adds MemoryUserID(ctx) helper that returns empty userID (global scope)
when shared memory flag is set, used by memory interceptor, memory tools,
and KG search. UI warning updated to note data is not migrated on toggle.
- Add reviewer role to team system (backend + UI) for evaluate_loop workflows
- Fix handoff/evaluate_loop/delegate_search system prompt entries (were showing as custom tool)
- Filter inactive agents from delegation queries (DelegateTargets, SearchDelegateTargets)
- Fix agent link direction display (flip outbound→inbound when viewed from target side)
- Improve builtin tool seed descriptions with detailed action-oriented text
- Add i18n support for builtin tool descriptions (en/vi/zh frontend locale files)
- Notify LLM when KG extraction triggered on memory write
The memory interceptor handled read_file/write_file for memory paths
but list_files hit the filesystem, returning "Directory does not exist".
Now list_files queries memory_documents from PostgreSQL via the existing
ListDocuments store method.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Multi-agent AI gateway with WebSocket RPC, HTTP API, and messaging channel integrations.
Go port of OpenClaw with multi-tenant PostgreSQL, per-user isolation, security hardening,
and production observability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>