#9647·zeroclaw

[Bug]: Knowledge graph has no per-agent attribution — any agent reads/mutates another agent's knowledge

Author: metalmonCreated Aug 1, 2026Updated Sep 30, 2026
Labelsbugagentmemoryruntimesecuritytoolmemory:backenddomain:security

Affected component

memory

Severity

S0 - data loss / security risk

Current behavior

The knowledge tool exposes a single, globally-shared knowledge graph to every agent with no per-agent attribution and no ownership scoping. Any agent can read and mutate another agent's captured knowledge, client networks, and interaction logs. This is the knowledge-plane analogue of the session-tool ownership gap (#9646) and violates ADR-011 (docs/book/src/architecture/decisions/ADR-011-multi-agent-runtime-boundaries.md:24,56,86), which requires memory isolation per agent identity and that every cross-agent capability define its own authorization boundary.

Verified by source inspection at commit c1b04dbc0c (master, v0.8.3):

  • KnowledgeTool holds a raw Arc<KnowledgeGraph> with no identity of any kind (crates/zeroclaw-tools/src/knowledge_tool.rs:30-38); execute dispatches on an action arg (knowledge_tool.rs:126) reaching capture / search / relate / suggest / graph_neighbors / client_network / interaction_log, all against the common store, with node_id/client_id taken from arguments.
  • The graph is built once from a single global root_config.knowledge.db_path and handed to every agent unscoped (crates/zeroclaw-runtime/src/tools/mod.rs:1370-1383).
  • KnowledgeGraph (crates/zeroclaw-memory/src/knowledge_graph) has no agent-attribution concept — nodes carry no owner column, so reads and writes cannot be filtered by agent.

Contrast: the 5 core memory tools ARE isolated via AgentScopedMemory (alias bound from a trusted constructor). The knowledge graph is the one memory-plane store with no per-agent partition.

Expected behavior

The knowledge graph must gain a per-agent attribution dimension and the tool must scope by it, deriving the caller's identity from a trusted context (constructor-bound agent_alias), never from arguments:

  • Add an owner/attribution column (e.g. agent_alias) to knowledge nodes (schema migration).
  • Stamp new capture/relate writes with the trusted caller alias.
  • Scope search/graph_neighbors/client_network/interaction_log reads and all mutations to the caller's own attribution (optionally widened by an explicit, operator-configured share, mirroring read_memory_from on the memory plane).

Legacy data handling — cannot fail-closed. No attribution exists today, so "legacy" = every node; hiding them all would break the feature. Required approach: run the migration, then either (a) default pre-existing nodes to a shared read-only scope with new writes per-agent, or (b) config-gate the knowledge tool until the operator opts in / migrates. Decide the default as part of this issue.

Steps to reproduce

bash
# Two agents in one deployment: [agents.rowan] and [agents.sable], both with the `knowledge` tool.
# Agent "sable" has captured private knowledge (e.g. a client network).

# Acting AS agent "rowan":

# 1) Read another agent's captured knowledge on the shared graph:
knowledge {"action": "search", "query": "..."}
knowledge {"action": "client_network", "client_id": "..."}
knowledge {"action": "interaction_log", "client_id": "..."}
#   -> returns sable's captured nodes / client network / interaction history.

# 2) Mutate the shared graph (affects sable's knowledge):
knowledge {"action": "capture", "title": "...", "content": "..."}
knowledge {"action": "relate", "from_id": "...", "to_id": "...", "relation": "..."}

# Verified by source inspection at commit c1b04dbc0c (master, v0.8.3):
#   knowledge_tool.rs:30-38, 126        (raw Arc<KnowledgeGraph>, no identity, args-driven ids)
#   runtime/src/tools/mod.rs:1370-1383  (single global db_path, handed to every agent unscoped)
#   zeroclaw-memory/src/knowledge_graph (no owner attribution on nodes)

Impact

Affected: any multi-agent deployment where more than one agent has the `knowledge` tool.
Vector: a prompt-injected or low-trust agent can exfiltrate another agent's captured
        knowledge, client networks, and interaction logs, and silently mutate shared nodes.
Frequency: always -- deterministic, no race.
Consequence: cross-agent confidentiality + integrity breach on the knowledge plane;
        violates the ADR-011 memory-isolation guarantee. Sibling of #9646 (session plane).
Not affected: the 5 core memory tools (AgentScopedMemory-scoped).

Logs / stack traces

Static authorization gap -- no runtime log. Primary evidence (v0.8.3, c1b04dbc0c):

knowledge_tool.rs:30  pub struct KnowledgeTool { graph: Arc<KnowledgeGraph> }   // no identity, no SecurityPolicy
knowledge_tool.rs:126 async fn execute(&self, args) { let action = args.get("action")... }  // args-driven, unscoped
tools/mod.rs:1370-1383  // one global KnowledgeGraph from knowledge.db_path, shared by every agent

ZeroClaw version

v0.8.3 (commit c1b04dbc0c)

Rust version

rustc 1.97.0

Operating system

All platforms (source-verified on Windows 11; code path is OS-independent)

Regression?

Unknown

Pre-flight checks

  • I reproduced this on the latest master branch or latest release. (verified by source inspection of the v0.8.3 / c1b04dbc0c tree)
  • I redacted secrets, tokens, and personal data from all submitted content. (neutral placeholder aliases only)