Skip to content

Feature: configurable cross-agent reflection inheritance (prevent main→other agent bleed) #448

@stanleeyY

Description

@stanleeyY

Problem

isOwnedByAgent() in src/reflection-store.ts hardcodes a fallback that allows all agents to inherit reflection slices from the main agent:

function isOwnedByAgent(metadata: Record<string, unknown>, agentId: string): boolean {
  const owner = typeof metadata.agentId === "string" ? metadata.agentId.trim() : "";
  if (!owner) return true;
  return owner === agentId || owner === "main";  // ← hardcoded
}

This means every agent (sysadmin, boss, designer, etc.) receives main agent's reflection invariants and derived lines, even when their workloads are completely unrelated.

Impact

  • Derived lines (recent session deltas) from main bleed into specialized agents, injecting irrelevant context
  • Invariants from main may or may not be relevant to other agents
  • No way to opt out via config

Proposed Solution

Add a config option to control cross-agent reflection inheritance:

// In memoryReflection config
{
  "reflectionInheritFrom": ["main"],  // explicit list, or empty [] for full isolation
  // OR
  "reflectionIsolation": true  // simple toggle: only own reflections
}

Minimal alternative (lower effort)

Split the inheritance logic for invariants vs. derived:

  • Invariants: keep main fallback (stable cross-session rules are usually generic)
  • Derived: strict agent-only ownership (recent deltas are agent-specific)

This would prevent the most harmful bleed (irrelevant derived context) while preserving useful shared invariants.

Current Workaround

Manually patch isOwnedByAgent() to remove || owner === "main".

Environment

  • memory-lancedb-pro 1.1.0-beta.10
  • Multi-agent setup (6 agents with separate workspaces)
  • injectMode: "inheritance+derived"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions