rig-resources
Reusable skills, tools, behavior patterns, and resource adapters for rig-compose agents.
Overview
rig-resources is the reusable implementation layer for rig-compose agents. Where rig-compose defines the kernel traits and registries, this crate supplies concrete baseline stores, baseline tools, memory lookup tools, behavior-pattern skills, memory-pivot skills, optional graph resources, and optional security-oriented skills.
The default build is intentionally small. Graph resources are behind graph; security primitives are behind security; full enables both.
Why it exists
Agent systems built on rig-compose need common resources that should not live inside the kernel: statistical baselines, behavior-pattern registries, graph pivots, memory lookup pivots, and reusable security detections. rig-resources provides those pieces as rig_compose::Skill and rig_compose::Tool implementations so downstream agents can register them without duplicating kernel surfaces.
Status
- Crate version:
0.2.0. - Rust edition: 2024.
- MSRV: 1.88.
- Runtime stance: runtime-agnostic library;
tokiois only a dev-dependency. rig-composedependency:version = "0.4".- The 0.1.6 \u2192 0.2.0 line shipped the canonical
memory.lookuptool contract, streaming baseline accumulation, ECS-to-security-signal helpers, resource context projection helpers with shared provenance keys (source_uri,principal,scope,recorded_at_millis,confidence,source_frame_id,projection_state,reason),MemoryLookupHitprovenance builder methods, and a local resource trace envelope. See CHANGELOG.md for the per-release breakdown.
The crate-local maturity plan lives in ROADMAP.md. Cross-crate
coordination lives in
rig-ecosystem/docs/roadmap.md.
Feature Flags
| Feature | Default | Enables | Checked by just check |
|---|---|---|---|
| none | yes | Baseline store/tool, online baseline accumulator, memory lookup tool, behavior-pattern registry/skill, projection helpers, baseline compare skill, and memory pivot skill. | default clippy and test runs |
security |
no | Namespaced security skills in src/security: credential, ECS signal helpers, exfil, lateral, and recon modules. | clippy and tests with --features security |
graph |
no | petgraph-backed graph store, graph tool, and graph expansion skill from src/graph. |
clippy and tests with --features graph |
full |
no | Convenience feature enabling security and graph. |
clippy and tests with --features full; docs with all features |
Key Types
- src/baseline.rs:
BaselineStore,InMemoryBaselineStore,EntityBaseline,OnlineStats,BaselineCompareTool, andBaselineError. The tool returns availability and in-bound flags for an observed value against mean plus or minusk * std_dev;OnlineStatsbuilds baselines from streaming observations. - src/memory.rs:
MemoryLookupStore,MemoryLookupHit,MemoryLookupTool, andMemoryLookupError. The tool is namedmemory.lookup, matchingMemoryPivotSkill. Hits can carry source URI, principal, scope, and recorded-at metadata for downstream context projection. - src/patterns.rs:
BehaviorPattern,BehaviorRegistry,BehaviorPatternSkill,PatternRule, andPatternId. Patterns are append-style, versioned rules overInvestigationContextsignals. - src/projection.rs:
IntoContextItemplus helpers for projecting behavior patterns, baselines, memory hits, graph expansions, and accumulated evidence intorig_compose::ContextItem/ContextPack. Projection provenance uses stable JSON keys aligned withrig-compose's typed context provenance vocabulary while this crate continues to depend on releasedrig-compose = "0.4". - src/skills.rs:
BaselineCompareSkillandMemoryPivotSkill. The baseline skill suppresses confidence for in-baseline behavior; the memory skill calls a registeredmemory.lookuptool after confidence crosses a threshold. - src/trace.rs:
ResourceTraceEnvelope, a crate-local JSON envelope for resource evidence metadata while cross-kernel trace shapes are still being proven. - src/graph/store.rs:
GraphStore,GraphEdge,Subgraph, andGraphError, gated behindgraph. - src/graph/inmem.rs:
InMemoryGraph, apetgraph::DiGraph-backed implementation with idempotent edge upserts and degree-style centrality. - src/graph/tool.rs:
GraphTool, arig_compose::Toolnamedgraph.entitywithupsert,expand, andcentralityoperations. - src/graph/skills.rs:
GraphExpansionSkillandGraphExpansionConfig, which lift confidence when an entity's expanded graph fan-out exceeds a threshold. - src/security: optional domain skills including
HighFanoutSkill,EntropyCheckSkill,SlowBeaconSkill, credential, ECS signal helpers, lateral, and exfil modules.
Integration With Rig
rig-resources integrates through rig-compose, not directly through rig-core. It pins rig-compose as version = "0.4" in Cargo.toml.
All exported skills implement rig_compose::Skill; exported tools implement rig_compose::Tool. That means agents register them in SkillRegistry and ToolRegistry the same way they register caller-defined local logic.
Quick start
The baseline path is covered by unit tests in src/baseline.rs. This example mirrors tool_reports_available_and_within while avoiding test-only unwraps.
use Arc;
use Tool;
use ;
use json;
# async
Graph behavior is covered by tests in src/graph/tool.rs, src/graph/skills.rs, and src/graph/inmem.rs when the graph feature is enabled. For a fixture-backed walkthrough of expand, centrality, sparse context, and multi-hop summary projection, run:
Validation
Canonical validation is just check.
That recipe runs formatter checks, clippy and tests for default, security, graph, and full, then rustdoc with all features and -D warnings -D rustdoc::broken_intra_doc_links.
Gotchas
MemoryPivotSkilldoes not provide storage. RegisterMemoryLookupToolwith a backend implementingMemoryLookupStore, or register another compatible tool namedmemory.lookup.BaselineCompareTooltreats missing baselines as an unavailable result, not as a tool failure.GraphExpansionSkilltreatsKernelError::ToolNotApplicablefromGraphToolas sparse context and returnsSkillOutcome::noop().- Projection helpers are caller-side: they convert existing records or accumulated evidence into
ContextItems without adding fields torig_compose::InvestigationContext. Shared provenance keys includesource_uri,principal,scope,recorded_at_millis,confidence,source_frame_id,projection_state, andreasonwhere the source can provide them. - The graph feature pulls in
petgraph; keep graph-specific code gated behind#[cfg(feature = "graph")]. - The library uses
parking_lotguards. Do not hold guards across.awaitpoints.
Ecosystem
These companion crates are maintained as separate repositories. Together they form a small stack around the upstream Rig project: rig-compose provides the kernel surface, rig-resources contributes reusable skills and tools, rig-mcp moves tools across MCP, rig-memvid connects Rig agents to persistent .mv2 memory, and rig-model-catalog abstracts LLM metadata and probes.
flowchart TD
rig["rig / rig-core"]
compose["rig-compose 0.4.x"]
resources["rig-resources 0.1.x"]
mcp["rig-mcp 0.1.x"]
memvid["rig-memvid 0.1.x"]
model_meta["rig-model-catalog 0.1.x"]
compose -. "Rig-shaped kernel; no direct rig-core dep" .-> rig
resources -- "rig-compose = 0.4; features: security, graph, full" --> compose
mcp -- "rig-compose = 0.4; rmcp stdio bridge" --> compose
memvid -- "rig-core = 0.37.0; features: lex, simd, vec, api_embed, temporal, encryption, compaction, context-projection" --> rig
model_meta -. "optional rig-core = 0.37 via rig-hook" .-> rig
Pinned Rig-facing dependencies from the current manifests:
| Crate | Direct Rig-facing dependency | Notes |
|---|---|---|
rig-compose |
none | Defines a Rig-shaped kernel surface without depending on rig-core. |
rig-resources |
rig-compose = 0.4 |
Provides reusable skills, resource tools, and security helpers. |
rig-mcp |
rig-compose = 0.4 |
Bridges rig-compose tools over MCP stdio and loopback transports. |
rig-memvid |
rig-core = 0.37.0; optional rig-compose = 0.4 |
Implements Rig vector-store, prompt-hook, compaction, and context-projection flows over Memvid. |
rig-model-catalog |
optional rig-core = 0.37 via rig-hook |
Provides standalone model traits plus optional Rig prompt-hook telemetry. |
The concrete multi-crate workflow tested today is the MCP loopback path: a rig_compose::ToolRegistry is exposed through rig_mcp::LoopbackTransport, remote schemas are wrapped as rig_mcp::McpTool, and the wrapped tools are registered back into another ToolRegistry. That proves a local rig-compose tool and an MCP-adapted tool are indistinguishable to callers. The backing test is mcp_tool_indistinguishable_from_local in rig-mcp/src/transport.rs.
License
Licensed under either Apache-2.0 or MIT, at your option.