Skip to content

Overview ​

This guide describes @chamvi/core as it is built today. Every sample on these pages type-checks against the current source.

The concepts ​

ConceptIn coreWhat it is
AgentdefineModelAgent()A model, instructions, channel subscriptions, tools, hooks, a budget and state
ChannelIChannel, ctx.channelsAnything a run comes from or talks to (cron, HTTP, MCP, webhooks, GitHub, OpenClaw, the console). Intake is normalized into a TriggerEnvelope; tools send through it
RunRunOne execution of an agent for one envelope, with a status, usage and output
StepStepAn llm, tool or wait record, appended as the run progresses
CheckpointCheckpointThe message history after a step; a resumed run continues from the latest one
ToolAI SDK tool(), defineTool(), defineEffectTool()What the model can call. defineTool() tools read the run context; effect tools apply at most once per effect key
StateAgentStatePer-agent key-value data and typed collections that outlive runs
RepositoryRepositoryRuns, steps, checkpoints, keys, locks, effects and state. Pluggable
Workspace@chamvi/sandboxA disposable directory or container a run executes commands in, optionally a checkout of a repository. See Workspaces & Coding

The App concept (one app with store, channels, HTTP and UI, booted from env) is @chamvi/app.

The engine in one picture ​

             dispatch(envelope)
                    |
        idempotency key seen? ----yes----> existing run id
                    | no
                    v
               [ queued ] <--------------------------------+
                    | slot free, key free, claim taken     |
                    v                                      |
               [ running ] --- step --> checkpoint         |
                    |                                      |
   +----------------+-----------------+-----------------+  |
   |                |                 |                 |  |
completed         failed          cancelled        waiting -- resume / timeout
                                                    interrupted -- recover

See Run Lifecycle for every transition.

Reading order ​

  1. Agents and Channels & the Envelope
  2. Run Lifecycle and Execution & Checkpoints
  3. Budgets, Tools, Effect Tools, Approvals & Hooks, State
  4. Workspaces & Coding for agents that run commands and edit code
  5. Concurrency, Cancel, Drain & Recovery, Errors