Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions docs/effectors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Effectors

Status: **draft for discussion**. Nothing here is implemented.

CCF today only observes: agents collect evidence, the API turns it into posture, and
people read dashboards. Effectors add the other direction. When something in CCF reaches a
state a user cares about, CCF **acts** through effector plugins: it notifies someone,
blocks a change, or remediates, depending on the plugins installed.

The smallest useful loop needs no SSP at all:

```mermaid
flowchart LR
AG["Agent<br/>collects evidence"] -->|"evidence: not-satisfied"| API["CCF API<br/>rule matches"]
API -->|"effect.apply"| EF["Effector<br/>plugin fixes it"]
EF -->|"changes"| SYS["GitHub / AWS / Slack"]
SYS -.->|"next collection"| AG
AG -->|"evidence: satisfied"| API
API -->|"effect.clear"| EF
```

## Documents

Read them in this order. Each one ends with its own open questions.

| Document | Covers | Read it if you're... |
| --- | --- | --- |
| [User interface](user-interface.md) | What users do through the API: register effectors, create rules, pick targets, see what happened, decide on exceptions | designing the UI or the rule model |
| [Triggers](triggers.md) | Trigger sources (evidence, risk, workflow, SSP, catalog) and their subject schemas, CEL conditions, state vs event rules, how the API evaluates them | working on the API's rule engine |
| [Events and states](events-and-states.md) | Every state rules can test and every event they can react to, per source, and how the API computes each | checking what a rule can react to |
| [Wire interface](wire-interface.md) | The API ↔ agent protocol for effectors: registration, webhooks, effect document, callbacks, delivery guarantees | building the API side or the agent's effector support |
| [Effector interface](effector-interface.md) | Effectors as agents: the `effector` block, effector plugins and actions, remote config, validation, the plugin gRPC contract | operating an effector or writing a plugin |
| [Plugin runtime](plugin-runtime.md) | How the agent runs effector plugins: processes, listener, gRPC messages, status flow, timeouts, ordering, retries | implementing the agent side or a plugin |
| [Example plugins](plugins.md) | Illustrative plugins and how a plugin maps onto the contract. Plugins themselves are out of scope | writing a plugin |
| [Security](security.md) | Trust boundaries, identity, signing, credentials, who may create which rules | reviewing the design |
| [Operations](operations.md) | Failure modes, observability, HA, phasing, how this relates to notifications | planning the rollout |

## Glossary

| Term | Meaning |
| --- | --- |
| **Rule** | *When* something holds or happens, *do* these actions. Top-level resource; not owned by an SSP. |
| **Trigger** | The *when* of a rule: a **source** (evidence, risk, workflow, SSP, catalog) and either a CEL **condition** over its subjects (`when`) or **event types** with an optional CEL filter (`on`, `if`). |
| **State rule** | Its trigger is a condition that holds or doesn't ("evidence is failing"). Its effects turn on and off. |
| **Event rule** | Its trigger is something that happens ("a catalog control changed"). Each occurrence produces a one-off effect. |
| **Rule action** | The *do* of a rule: which **effector**, which of its **effector actions**, which target, and an optional delay. No config. |
| **Target** | What an action acts on, as an identity `scheme:value` (`github-repo:github.com/acme/repo-1`, `slack-channel:#platform`). Fixed in the rule, or computed by a CEL expression from whatever triggered it. |
| **Effect** | The live record of one rule action on one target: desired state, generation, the subjects that caused it, and what the effector reports back. |
| **Effector** | A CCF **agent** running effector plugins, in the customer's environment. It receives effects and runs its effector actions. The same agent can also run collector plugins. |
| **Effector plugin** | An agent plugin with `type: effector` that declares and performs one or more effect types against one provider. go-plugin over gRPC, distributed like collector plugins. |
| **Effector action** | A named thing an effector can do, defined by its operator in the effector's config: plugin, effect type (a label the plugin declares, such as `notify` or `block`), allowed targets, and config. Registered with the API without the config. |

## Big picture

```mermaid
flowchart TB
subgraph Sources["Trigger sources (API)"]
E["Evidence status"]
R["Risk status"]
W["Workflow status"]
S["SSP status"]
C["Catalog changes"]
end
Sources --> DE["Domain events"]
DE --> RE["Rule engine"]
RU["Rules + actions<br/>(user interface)"] --> RE
RE --> FX[("Effects")]
FX --> DL["Webhook delivery<br/>(wire interface)"]
DL --> EF["Agent + effector plugins<br/>(effector interface)"]
EF -->|"status, observations"| FX
EF --> EXT["External systems"]
```

## Design principles

1. **The API decides, effectors act.** Effectors hold no rules and no policies. They make
a provider reflect the effect they were given.
2. **Desired state, not commands.** Effects are level-triggered documents with a
generation number. Missed deliveries and restarts converge on their own.
3. **Credentials stay with the customer.** The API never holds Slack, GitHub or AWS
credentials for effects.
4. **The operator has the last word.** An effector only runs the effector actions its
operator defined, with the config they wrote. Rules pick an action and a target, nothing
more.
5. **Effectors are agents.** An effector is the agent with effector plugins: identity,
keys, heartbeats, remote configuration and the plugin model come from the agent.
6. **One rule action, one effector.** Each rule action names the effector that receives its
effects. Effectors never compete for rules, and an effect is never sent to two agents.
Delivery is at least once; agents drop a generation they've already received.
Loading