pub trait Suggestor: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn dependencies(&self) -> &[ContextKey];
fn accepts(&self, ctx: &dyn Context) -> bool;
fn execute(&self, ctx: &dyn Context) -> AgentEffect;
}Expand description
The core suggestor contract.
Every suggestor in the Converge ecosystem implements this trait — whether it wraps an LLM, a policy engine, an optimizer, or a simple rule.
The engine calls accepts() to determine eligibility, then execute()
to collect effects. Effects are merged by the engine in deterministic
order (sorted by suggestor name).
§Thread Safety
Suggestors must be Send + Sync because the engine executes eligible
suggestors in parallel (via Rayon). Suggestor state, if any, must be
internally synchronized.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Human-readable name, used for ordering, logging, and provenance.
Must be unique within a convergence run. The engine sorts suggestors by name to ensure deterministic merge order.
Sourcefn dependencies(&self) -> &[ContextKey]
fn dependencies(&self) -> &[ContextKey]
Context keys this suggestor reads from.
The engine uses this to determine when a suggestor becomes eligible: a suggestor is a candidate when at least one of its dependency keys has been modified since the last cycle.
Sourcefn accepts(&self, ctx: &dyn Context) -> bool
fn accepts(&self, ctx: &dyn Context) -> bool
Pure predicate: should this suggestor execute given the current context?
§Contract
- Must be pure: no side effects, no I/O, no state mutation.
- Must be deterministic: same context → same answer.
- Must check idempotency via context: look for your own
contributions in context (both
Proposalsand target key), not internal flags.
Sourcefn execute(&self, ctx: &dyn Context) -> AgentEffect
fn execute(&self, ctx: &dyn Context) -> AgentEffect
Produce effects given the current context.
§Contract
- Read-only: do not mutate context. Return effects instead.
- Effects are collected by the engine and merged after all eligible suggestors have executed.
- For LLM suggestors: emit
ProposedFacttoContextKey::Proposals, not directly to the target key.