Skip to content

Harden multi-agent memory workflows#38

Merged
TerminallyLazy merged 1 commit into
mainfrom
codex/multi-agent-readiness
Jul 23, 2026
Merged

Harden multi-agent memory workflows#38
TerminallyLazy merged 1 commit into
mainfrom
codex/multi-agent-readiness

Conversation

@TerminallyLazy

@TerminallyLazy TerminallyLazy commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What changed

  • Add producer, workflow, session, operation, and correlation identity across memory writes, recall filters, schemas, CLI output, imports, consolidation, and generated agent guidance.
  • Make exact operation retries idempotent, reject conflicting replays, serialize concurrent mutations, preserve redaction/tombstone claims, and publish evidence/index updates atomically.
  • Isolate private agent/workflow/session scopes before ranking and consolidation while keeping shared-scope behavior explicit.
  • Normalize legacy private-scope records deterministically without weakening validation for newly created records.
  • Add real multi-process fan-out acceptance coverage, concurrency/migration regressions, fixtures, protocol documentation, and certification checks.

Why

Single-agent behavior was already sound, but fan-out workflows needed explicit identity boundaries and stronger guarantees around retry, concurrency, lifecycle mutation, and evidence publication. Without those contracts, agents sharing one local store could collide, observe the wrong private partition, duplicate an operation, or publish mixed-run evidence.

Impact

Tree Ring now supports single-agent and same-host multi-agent, swarm, and fan-out workflows through the same local SQLite store with deterministic scope filtering, retry semantics, and monotonic lifecycle behavior. Existing public/shared data remains compatible, and legacy identity-less private records are upgraded conservatively during migration/import.

Root causes addressed

  • Missing workflow/session/operation identity in the durable model and CLI contract.
  • Read-before-write races and non-atomic evidence/index publication under concurrent agents.
  • Ambiguous retry semantics and operation-ID reuse across derived outputs.
  • Legacy private-scope rows that predated mandatory partition identity.
  • Insufficient process-level acceptance coverage for simultaneous writers/readers.

Validation

  • cargo test --workspace --locked — 370 tests passed.
  • Real CLI acceptance test — eight concurrent processes verified isolation, shared visibility, exact retry idempotency, conflicting replay rejection, lifecycle monotonicity, and atomic evidence publication.
  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed.
  • cargo fmt --all -- --check — passed.
  • Changed JSON schemas parse with jq; certification shell syntax and staged diff hygiene pass.
  • Full Tree Ring certification passed: 10k import, 10k/30k performance, recall quality, harness rollup, and workflow recall proof. The 30k run sustained about 685 inserts/s with maximum measured recall latency under 14 ms.

Boundaries

The concurrency guarantees are intentionally scoped to agents sharing one local SQLite database on the same host. This does not claim cross-host, network-filesystem, or distributed-consensus safety. The Agent Zero plugin smoke was unavailable and remained an explicit skip rather than being counted as proof.

Summary by CodeRabbit

  • New Features

    • Added multi-agent workflow support with agent, workflow, session, scope, and operation metadata.
    • Added filtered recall and fan-in coordination across shared local memory roots.
    • Added idempotent writes with conflict detection for retried operations.
    • Added legacy private-scope identity normalization during import and migration.
  • Bug Fixes

    • Improved isolation for private-scope consolidation and contradiction detection.
    • Improved live event streaming for partial, oversized, or malformed entries.
  • Reliability

    • Added safer concurrent evidence publishing and atomic certification outputs.
  • Documentation

    • Expanded CLI, integration, schema, and coordination guidance.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@TerminallyLazy
TerminallyLazy merged commit cd5c766 into main Jul 23, 2026
1 check passed
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 04fe94d5-e94f-4521-9eee-666400032489

📥 Commits

Reviewing files that changed from the base of the PR and between 67192a7 and 50c7f65.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (38)
  • Cargo.toml
  • README.md
  • crates/tree-ring-memory-cli/src/actions/lifecycle.rs
  • crates/tree-ring-memory-cli/src/actions/recall.rs
  • crates/tree-ring-memory-cli/src/actions/remember.rs
  • crates/tree-ring-memory-cli/src/agent_awareness.rs
  • crates/tree-ring-memory-cli/src/evidence.rs
  • crates/tree-ring-memory-cli/src/harness_evidence.rs
  • crates/tree-ring-memory-cli/src/main.rs
  • crates/tree-ring-memory-cli/src/recall_quality.rs
  • crates/tree-ring-memory-cli/src/tui/app.rs
  • crates/tree-ring-memory-cli/src/tui/stream.rs
  • crates/tree-ring-memory-cli/tests/multi_agent_acceptance.rs
  • crates/tree-ring-memory-core/Cargo.toml
  • crates/tree-ring-memory-core/src/audit.rs
  • crates/tree-ring-memory-core/src/consolidation.rs
  • crates/tree-ring-memory-core/src/import_export.rs
  • crates/tree-ring-memory-core/src/lib.rs
  • crates/tree-ring-memory-core/src/models.rs
  • crates/tree-ring-memory-core/src/sensitivity.rs
  • crates/tree-ring-memory-core/src/workflow.rs
  • crates/tree-ring-memory-core/tests/workflow_scenario.rs
  • crates/tree-ring-memory-sqlite/Cargo.toml
  • crates/tree-ring-memory-sqlite/src/lib.rs
  • crates/tree-ring-memory-sqlite/src/schema.rs
  • crates/tree-ring-memory-sqlite/src/search.rs
  • crates/tree-ring-memory-sqlite/src/write.rs
  • docs/architecture/rust-core-status.md
  • docs/integrations/agent-skill.md
  • docs/protocol/memory-event.md
  • fixtures/parity/legacy-private-scope-blank-identity.jsonl
  • fixtures/parity/legacy-private-scopes-export.jsonl
  • fixtures/parity/legacy-private-scopes-raw.jsonl
  • schemas/memory-event.schema.json
  • schemas/recall-query.schema.json
  • scripts/certify-tree-ring.sh
  • skills/tree-ring-memory/SKILL.md
  • templates/dox/AGENTS.md

📝 Walkthrough

Walkthrough

This PR adds multi-agent context fields, partition-aware recall and consolidation, idempotent SQLite writes, legacy private-scope normalization, concurrent evidence publishing, bounded TUI event parsing, CLI acceptance coverage, and documentation for same-host workflows.

Changes

Multi-agent memory and storage

Layer / File(s) Summary
Core metadata and partitioning
crates/tree-ring-memory-core/src/*, schemas/*, fixtures/parity/*
Memory events, validation, redaction, schemas, imports, consolidation, auditing, sensitivity detection, and workflow seeds support agent, workflow, session, and operation metadata.
SQLite persistence and retrieval
crates/tree-ring-memory-sqlite/src/*
SQLite migration adds context columns, operation claims, and redaction tombstones; writes become idempotent and transactional, while recall and lifecycle operations gain context filtering and concurrency handling.
CLI coordination flow
crates/tree-ring-memory-cli/src/actions/*, crates/tree-ring-memory-cli/src/main.rs, crates/tree-ring-memory-cli/tests/multi_agent_acceptance.rs
CLI commands propagate coordination metadata, remember operations report creation status and reject conflicting retries, recall applies context filters, and acceptance coverage exercises concurrent workers and maintenance parity.
Evidence and TUI concurrency
crates/tree-ring-memory-cli/src/evidence.rs, crates/tree-ring-memory-cli/src/harness_evidence.rs, crates/tree-ring-memory-cli/src/recall_quality.rs, crates/tree-ring-memory-cli/src/tui/*, scripts/certify-tree-ring.sh
Evidence outputs use atomic writes and directory locks; TUI change-ring handling delegates to the store, and event-stream parsing becomes incremental with bounded buffers.
Documentation and generated guidance
README.md, docs/*, skills/*, templates/*
Same-host multi-agent workflows, scope routing, retry semantics, redaction behavior, storage boundaries, and acceptance coverage are documented.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/multi-agent-readiness

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
schemas/memory-event.schema.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

schemas/recall-query.schema.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant