# Sequencing

Don't define all types before building the first end-to-end flow. The Discord hourly test is the forcing function — wire that one path and let the types prove themselves. Today `@arbe/core` has agent / house / room; bot dispatch is hardcoded with mention / ambient / always; activation is implicit in the entry-write hook; there's no concept of "I hold capability X against resource Y" — the agent just has credentials and knows how to post to streams. arbe's local execution model (run, session, sandbox, task) is fully built but lives entirely in repo-local SQLite + task files. Nothing projects into shared records yet. The bridge between these two systems is the actual work.

```
1. Resource records + secret bindings        unblock everything downstream — can't express activation
                                              policies without a resource to point at; agent can't act
                                              without credentials
2. Tool records                              define send-message; mostly bookkeeping but makes capability
                                              resolution expressible
3. Capability resolution                     resolveCapabilities; agent posts via permission check on
                                              tool + resource records, not baked-in credentials
4. Activation policies                       replace trigger_mode on AgentContent; mention + ambient
                                              pipelines read from policy records — biggest refactor
5. Run records + session rooms               shared runs only (dispatched / external resource / multi-agent);
                                              local repo runs stay in SQLite
6. Artifact records                          agent posts Discord message → artifact record with the remote
                                              message id; closes the "terminal text is not enough" loop
7. Memory records last                       DO SQLite working memory is fine; durable semantic memory
                                              waits until the execution path is solid
```

Three missing interfaces are the hard part — record types are easy. **Capability resolution** at activation time (see [capabilities](./capabilities.md)). **Shared run creation** — when an activation crosses a shared boundary (remote dispatch, external resource, multi-agent), the dispatcher creates a run record in the substrate at birth; arbe's local observability mirrors this for the operator's local view, but the substrate record is primary; local-only runs (repo coding work) never touch the substrate. **Activation dispatch** — a generic `dispatch(activationPolicy, event) → run` path that any adapter can use (see [activation](./activation.md)).

What changes conceptually: stop treating "automation" as a thing in itself — treat it as agent + activation policy + capabilities + optional sandbox + result policy. Stop treating runtime-local SQLite as general memory; it's working memory. Stop treating local task state as the universal planning model; it's a code-work planning model. Stop treating terminal output as the result; results need durable identity. Start modelling external targets as resources, not vague integrations. Start treating secrets as a named seam — a capability without secret management is theatre.

The one-sentence version: wire credentialed tool execution to the permission system, add cron activation to Durable Objects, and figure out agent memory — then the substrate becomes an automation engine without any new primitives.

**See:** [thinking/capabilities](./capabilities.md), [thinking/activation](./activation.md), [thinking/record-types](./record-types.md), [thinking/layers](./layers.md).
