docs/research/rvagent-rvf-integration/README.md
Status: Research (Exploration) — Pre-Proposal Date: 2026-05-24 Author: ruv
vendor/ruvector/crates/rvAgent/ ships a production-grade Rust AI-agent framework with eight composable crates (rvagent-core, -middleware, -tools, -subagents, -backends, -a2a, -acp, -mcp, -cli). The framework already speaks RVF cognitive containers as its native state-persistence and inter-agent transport. RuView already uses RVF in v2/crates/wifi-densepose-sensing-server/src/rvf_container.rs.
Integration thesis: the two systems share a serialization substrate. Wiring rvAgent swarms into RuView turns the existing sensing pipeline into the substrate that an agentic flow can read from, reason about, and respond to — without writing a new agent runtime.
Concrete value:
cog-pose-estimation, cog-person-count, cog-ha-matter, and the new BFLD pipeline can negotiate via rvAgent's CRDT state merging instead of ad-hoc IPC.| Crate | Role | Key types |
|---|---|---|
rvagent-core | State machine + COW state cloning + budget tracking | AgentState, Message, AgiContainer, Arena, Budget, Graph |
rvagent-middleware | 14 built-in middlewares (security, witness, sanitizer, sona, hnsw) | PipelineConfig, build_default_pipeline() |
rvagent-tools | Tool definitions + dispatch | Tool, ToolInput, ToolOutput |
rvagent-subagents | Spawn isolated subagents with O(1) state clone | Subagent, CRDT merge |
rvagent-backends | LLM provider abstraction (Anthropic, OpenAI, local) | Backend trait |
rvagent-mcp | MCP server integration | MCP-style tool registry |
rvagent-a2a / -acp | Agent-to-agent transport, agent communication protocol | wire format |
rvagent-cli | Operator CLI | argv parsing |
Selling points relevant to RuView:
Arc → can spawn one subagent per sensing zone without copying gigabytes of context.data/recordings/) stay sandboxed.rvagent-middleware::witness → already RVF-formatted; round-trips cleanly with ADR-028.v2/crates/wifi-densepose-sensing-server/src/rvf_container.rs defines the on-disk container format used for:
SEG_MANIFEST, SEG_META).docs/research/soul/specification.md §3).Each RVF blob is content-addressed (BLAKE3 of the canonical byte representation) and carries a typed segment manifest. The format is intentionally extension-friendly — segment types are u8 enums, new types can land without breaking older readers.
Three concrete touchpoints, each shippable independently.
rvAgent's AgiContainer (rvagent-core/src/agi_container.rs, 627 LOC) already produces RVF-compatible blobs as its persistent state format. RuView only needs to define two segment types in rvf_container.rs:
SEG_AGENT_STATE = 0x08 — serialized rvagent_core::AgentState (the cloned-on-write tree from cow_state.rs).SEG_DECISION = 0x09 — a single agent decision step: tool calls issued, outputs received, witness signature.With these two segments, an rvAgent session and a RuView sensing session can interleave entries in the same RVF blob. The witness-bundle script (ADR-028) iterates segments by type, so it would attest both halves with one signing pass.
wifi-densepose-bfld::BfldEvent (iter 13) is already JSON-serializable via to_json(). Wrapping it as an rvagent_tools::ToolOutput is a 20-line shim: the agent issues a read_bfld_state() tool, the runtime returns the latest event JSON, the agent reasons over it. The full event surface (presence/motion/count/identity_risk/zone_id) becomes available as agent context without any new IPC.
BfldEvent → ToolOutput mapping:
impl From<BfldEvent> for ToolOutput {
fn from(e: BfldEvent) -> Self {
ToolOutput::json(e.to_json().expect("BfldEvent JSON"))
}
}
cog-pose-estimation, cog-person-count, cog-ha-matter, and (proposed) cog-bfld already share a packaging convention (ADR-100). Each cog can register as a subagent with rvAgent's hub: the cog implements the Subagent trait, exports its tool surface, and inherits the parent agent's CRDT state. The queen agent (rvagent-queen.md persona) routes operator queries across the cog mesh.
Concrete example:
cog-bfld (presence in bedroom), cog-quantum-vitals (HR baseline shift), cog-pose-estimation (sitting/standing transition).vendor/ruvector/crates/rvAgent/ already on the v2 workspace path, or does it need to be added as a path dep under wifi-densepose-bfld / a new wifi-densepose-agent crate?Publish trait is intentionally sync (iter 22). A small adapter (sync Publish ↔ async Backend) probably belongs in a wifi-densepose-agent crate, not in BFLD itself.PrivacyClass? rvagent-middleware::sanitizer strips at the tool-output boundary; should it consume PrivacyClass from the originating BFLD event so the agent never even sees a class-3 identity field?SoulMatchOracle integration (ADR-121 §2.6) could be the bridge from the Soul Signature graph (docs/research/soul/) to the agent decision layer. Worth a dedicated sub-section.rvagent-mcp exposes tools to external MCP clients. Should the BFLD BfldPipelineHandle::send surface land as an MCP tool here, or stay private to in-process rvAgent flows?v2/crates/wifi-densepose-agent with the sync ↔ async adapter and one example tool (read_bfld_state).SEG_AGENT_STATE and SEG_DECISION to rvf_container.rs as #[cfg(feature = "agent")] segments so the v0 ship doesn't pull rvAgent's transitive deps by default.examples/agent-bedroom-check/ showing the queen-agent flow end-to-end against the BfldPipelineHandle.vendor/ruvector/crates/rvAgent/README.md, rvagent-core/src/agi_container.rs, rvagent-middleware/docs/UNICODE_SECURITY.mdvendor/ruvector/crates/rvAgent/.ruv/agents/{rvagent-coder,rvagent-queen,rvagent-tester,rvagent-security}.mdv2/crates/wifi-densepose-sensing-server/src/rvf_container.rsdocs/adr/ADR-028-esp32-capability-audit.mddocs/adr/ADR-118-bfld-beamforming-feedback-layer-for-detection.mddocs/research/soul/specification.mdfeat/adr-118-bfld-impl, currently at iter 25 (e8b4fdbc8)