Brain — Offline-first (Tier 1)¶
The rig brain is baked into every agent image at build time. Agents read it from the local filesystem — no network call, no latency, no Cloudflare interference.
Why¶
research.rig.dashecorp.com enforces a Block-AI-Bots Cloudflare rule. Claude Code CLI's WebFetch is blocked, so agents cannot reliably fetch the brain at runtime. Baking it in at build time eliminates the dependency entirely.
How It Works¶
Dockerfile and Dockerfile.base use a multi-stage build:
FROM alpine AS brain-stage
RUN apk add --no-cache curl
WORKDIR /brain
RUN for f in entry repos agents surfaces flows events donts endpoints; do \
curl -sf -A 'rig-agent-runtime/1.0' \
"https://research.rig.dashecorp.com/brain/$f.md" -o "$f.md" || exit 1; \
done
# ... main build stage ...
COPY --from=brain-stage /brain /app/brain
ENV RIG_BRAIN_DIR=/app/brain
The custom User-Agent (rig-agent-runtime/1.0) bypasses the Block-AI-Bots CF rule during the image build.
Brain Files¶
| File | Contents |
|---|---|
entry.md |
Top-level entry point — start here |
repos.md |
Repo manifest |
agents.md |
Agent roles and capabilities |
surfaces.md |
Discord surfaces and channels |
flows.md |
Workflow and process flows |
events.md |
Event types and schemas |
donts.md |
Rig rules and hard prohibitions |
endpoints.md |
API endpoint reference |
Reading the Brain¶
# Start with the entry point
cat $RIG_BRAIN_DIR/entry.md
# Read a specific section
cat $RIG_BRAIN_DIR/repos.md
RIG_BRAIN_DIR defaults to /app/brain. It is set as an ENV in the Dockerfile and available to all processes in the container.
Build Failure on Missing Files¶
If any brain file is unavailable at image build time (rig-docs down, network error, HTTP error), the build fails immediately. The || exit 1 in the for-loop and curl's -f flag both propagate failures — no image is shipped with a partial or stale brain.
This is intentional: a partial brain is worse than no brain.
Prerequisites¶
- rig-docs#122 — publishes the raw markdown files at
https://research.rig.dashecorp.com/brain/{name}.md. This must be deployed before this image can be built.
Tier Roadmap¶
| Tier | Mechanism | Freshness | Status |
|---|---|---|---|
| 1 | Baked into image at build time | Per image release | ✅ This feature |
| 2 | Cluster-internal brain service | Minutes | Planned |
Tier 2 will add a sidecar or init-container that pulls a fresh brain snapshot from a cluster-internal service between image releases, without requiring a WebFetch to the public internet.