grain

module
v0.0.0-...-b91fa6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: Apache-2.0

README

grain

Tests

Grain is a single-operator agent orchestrator that turns a backlog of software tasks into tested pull requests. For each task, it starts a coding agent in an isolated VM or container sandbox with scoped repository and credential access, watches CI, surfaces questions when blocked, and merges the pull request when checks pass. It is built for engineers and small teams who want to run a queue of tasks unattended rather than supervise one agent session at a time.

Install

Every install runs the same single-tenant control plane and web UI. You can pass GitHub and model credentials during installation or add them afterwards in Settings.

1. Linux host (scripts/setup.sh)
  • Needs: Linux with systemd and Docker; /dev/kvm for Granule VM sandboxes (or set GRAIN_CONTAINER_SANDBOXES=1 for Docker container sandboxes on hosts without KVM).
git clone https://github.com/ai-on-gke/grain.git
cd grain

sudo \
  GRAIN_GITHUB_TOKEN="<github-token>" \
  GRAIN_OPENAI_API_KEY="<openai-api-key>" \
  GRAIN_TARGET_REPO="owner/repository" \
  ./scripts/setup.sh

By default setup.sh pulls container images from Docker Hub (docker.io/grainai/grain), provisions local PostgreSQL (docs/database.md), and serves the UI on http://<grain-host>:4242/. See docs/host-setup.md for release channels, /var/lib/grain layout, backups, remote hosts, and uninstalling (sudo ./scripts/setup.sh --uninstall), or docs/grain-init.md to build everything from source (grain init).

2. Docker Hub (docker.io/grainai/grain)
  • Needs: Linux with Docker (plus systemd when using setup.sh, or user-level systemd for a rootless workstation setup). Images are public at docker.io/grainai/grain (with sandbox images at docker.io/grainai/sandbox and docker.io/grainai/sandbox-k8s).
# Pull from Docker Hub with the host installer:
sudo GRAIN_IMAGE=docker.io/grainai/grain ./scripts/setup.sh

# Or set up a single-user workstation without root for the daemon:
./scripts/install-grain.sh -version v3.2.0 -image docker.io/grainai/grain
~/.local/bin/grain init workstation

grain init workstation binds the UI on http://127.0.0.1:4242 and prints or stores the access code under ~/.grain (grain access-code -data-dir ~/.grain). See docs/quickstart.md and docs/image-signing.md.

3. Kubernetes (deploy/kubernetes)
  • Needs: A Kubernetes cluster with ReadWriteOnce storage, kubectl, and a NetworkPolicy-capable CNI (grain.yaml fences open-network sandbox pods off the metadata server and cluster, and -k8s-network-policy is required for network: none tasks and external capability grants; KVM nodes for VM sandboxes).
# Edit the CHANGEME values in deploy/kubernetes/grain.yaml first
kubectl apply -f deploy/kubernetes/grain.yaml
kubectl -n grain port-forward svc/grain 8080:80

Open http://127.0.0.1:8080 and read the access code with kubectl -n grain exec deploy/grain -- grain access-code -data-dir /data, or place svc/grain behind an IAP Gateway. Full guide (including k8s-granule VM sandboxes): deploy/kubernetes/README.md.

4. Google Cloud / Terraform (deploy/terraform/gcp)
  • Needs: A GCP project, gcloud, terraform, and a GitHub token or GitHub App (Gemini API keys can be minted automatically on GCP or provided directly). Provisions a GCE VM with nested KVM, separate state and sandbox disks, Secret Manager secrets, and an IAP-protected HTTPS load balancer.
./deploy/terraform/gcp/bootstrap-gcp.sh --project <project-id>
cd deploy/terraform/gcp
cp example.tfvars staging.tfvars && cp backend.hcl.example backend.hcl
# Fill in project_id, deployer_member, and iap_members in staging.tfvars and backend.hcl
terraform init -backend-config=backend.hcl
terraform apply -var-file=staging.tfvars
PROJECT="$(terraform output -raw project_id)" \
  INSTANCE="$(terraform output -raw instance_name)" \
  MINTER_SERVICE_ACCOUNT="$(terraform output -raw minter_service_account)" \
  GRAIN_GITHUB_TOKEN="<github-token>" \
  ./deploy/push-secrets.sh

Open terraform output url and sign in through Identity-Aware Proxy as a configured principal, or run terraform output tunnel_command for local tunnel access with the access code. Full guide: deploy/terraform/gcp/README.md.

First sign-in

Grain has no user accounts or passwords. Whoever holds the deployment's access code is the owner (docs/access-code.md). Print it on the host with sudo grain access-code and paste it once when the browser prompts.

On a setup.sh host, reach http://<grain-host>:4242/ directly, or bind loopback (GRAIN_UI_ADDR=127.0.0.1:4242) and tunnel from your workstation:

./scripts/client.sh <grain-host>
# or manually: ssh -L 4242:localhost:4242 <grain-host>  →  http://localhost:4242

To use the grain CLI from your workstation against a remote deployment, run grain login <url>.

Use

  1. Connect a GitHub repository. In Settings → Git, add a GitHub token or GitHub App connection if you did not seed GRAIN_GITHUB_TOKEN at install time, and add your owner/repository under Repositories (docs/git-hosts.md).

  2. Add a model connection. In Settings → Models, add a connection for Claude Code, Codex, or Antigravity (Gemini) and choose your default model (docs/connections-and-models.md).

  3. File a first task and watch it run. Click New task in the UI, or queue one from the CLI:

    grain create \
      -title "Add health checks" \
      -body "Add an HTTP health endpoint and cover it with tests." \
      -repo owner/repository \
      -approve
    
    grain list
    grain logs <id> -follow
    

    Grain creates a fresh sandbox, checks out a task branch, and streams live tool calls and logs. If the agent asks a clarifying question or requests a secret, the task parks in Inbox (grain inbox, grain reply <id> "<answer>").

  4. Review and merge its PR. The agent pushes commits, opens a pull request, and iterates until CI passes. Review and merge from the task page or GitHub—or pass -auto-merge to grain create (or enable Auto-merge in the UI) so Grain merges automatically once checks are green.

  5. Where to go next:

    • Templates and schedules: define reusable task forms and recurring cron jobs in the UI or in your repo's .grain/ directory (docs/declarations.md, docs/schedules.md).
    • Director chat: open Director in the sidebar for a standing interactive agent that can inspect deployment state, debug failures, and propose tasks (docs/director.md).
    • Settings: tune sandbox concurrency and caches, pair remote hosts, attach MCP capability servers, or upgrade in place (docs/package-cache.md, docs/host-placement.md).

More

Directories

Path Synopsis
cmd
checkpost command
Command checkpost receives CI verdicts and serves them back.
Command checkpost receives CI verdicts and serves them back.
ghcr-prune command
Command ghcr-prune deletes the container package versions this repository's CI has stopped needing, and nothing else.
Command ghcr-prune deletes the container package versions this repository's CI has stopped needing, and nothing else.
github-webhook command
Command github-webhook receives GitHub App webhook deliveries on a public endpoint, verifies GitHub's X-Hub-Signature-256 HMAC, deduplicates and persists compact normalized envelopes, and serves them over a signed internal endpoint to grain daemon.
Command github-webhook receives GitHub App webhook deliveries on a public endpoint, verifies GitHub's X-Hub-Signature-256 HMAC, deduplicates and persists compact normalized envelopes, and serves them over a signed internal endpoint to grain daemon.
grain command
Command grain is core grain: everything is in pkg/cli, which this only runs.
Command grain is core grain: everything is in pkg/cli, which this only runs.
grain-agentd command
Command grain-agentd is a lightweight, rootless grain hostd for a machine that is not the daemon's: it runs the agent CLIs a grain daemon asks for, as the user who starts it, and nothing else.
Command grain-agentd is a lightweight, rootless grain hostd for a machine that is not the daemon's: it runs the agent CLIs a grain daemon asks for, as the user who starts it, and nothing else.
grain-connect command
Command grain-connect is the guest half of grain's dial into a sandbox.
Command grain-connect is the guest half of grain's dial into a sandbox.
grain-hub command
grain-registry command
Command grain-registry is cmd/grain-hub under its name from before the Grain Registry was renamed the Grain Hub, kept for one release so a build or deployment that still names ./cmd/grain-registry keeps working.
Command grain-registry is cmd/grain-hub under its name from before the Grain Registry was renamed the Grain Hub, kept for one release so a build or deployment that still names ./cmd/grain-registry keeps working.
grain-sandbox command
Command grain-sandbox is the `grain` a sandbox image carries at /usr/local/bin/grain (Granulefile.guest-base, Granulefile and Dockerfile.k8s-sandbox): only the subcommands that run inside a sandbox.
Command grain-sandbox is the `grain` a sandbox image carries at /usr/local/bin/grain (Granulefile.guest-base, Granulefile and Dockerfile.k8s-sandbox): only the subcommands that run inside a sandbox.
grit command
Command grit is grain's CI engine as a binary of its own (design/design/grit-split.design.md).
Command grit is grain's CI engine as a binary of its own (design/design/grit-split.design.md).
image-vulns command
Command image-vulns is the policy half of the release images' vulnerability gate (docs/image-vulnerability-scanning.md).
Command image-vulns is the policy half of the release images' vulnerability gate (docs/image-vulnerability-scanning.md).
reviewed-merge command
Command reviewed-merge is the release build's gate: it refuses a commit that did not reach a release branch through a reviewed merge, and otherwise prints the record of how it did (pkg/reviewedmerge), which scripts/release-images.sh attests onto the images it publishes.
Command reviewed-merge is the release build's gate: it refuses a commit that did not reach a release branch through a reviewed merge, and otherwise prints the record of how it did (pkg/reviewedmerge), which scripts/release-images.sh attests onto the images it publishes.
docs
releases
Package releases carries this directory's per-version release notes into the grain binary, so a deployment can show what each version brought without reaching bwsalmon/grain (pkg/releasenotes reads them).
Package releases carries this directory's per-version release notes into the grain binary, so a deployment can show what each version brought without reaching bwsalmon/grain (pkg/releasenotes reads them).
grain-plc module
pkg
actionscache
Package actionscache is the one thing a CI job leaves behind: this deployment's GitHub Actions cache, kept on the controller and served to every sandbox, so that what one run built the next run can read.
Package actionscache is the one thing a CI job leaves behind: this deployment's GitHub Actions cache, kept on the controller and served to every sandbox, so that what one run built the next run can read.
agent
Package agent defines the seam between the controller and whichever process actually drives a coding agent.
Package agent defines the seam between the controller and whichever process actually drives a coding agent.
agent/antigravity
Package antigravity implements agent.Framework by running Google's Antigravity CLI -- the `agy` binary that replaced Gemini CLI -- as a subprocess on the controller.
Package antigravity implements agent.Framework by running Google's Antigravity CLI -- the `agy` binary that replaced Gemini CLI -- as a subprocess on the controller.
agent/antigravity/hook
Package hook is the pre-tool hook grain puts in front of every tool call an antigravity (agy) run makes: agy forks `<grain binary> agy-tool-hook` with the call on stdin, and DecisionFor's reply decides whether it runs.
Package hook is the pre-tool hook grain puts in front of every tool call an antigravity (agy) run makes: agy forks `<grain binary> agy-tool-hook` with the call on stdin, and DecisionFor's reply decides whether it runs.
agent/claude
Package claude implements agent.Framework by running the real `claude` CLI as a subprocess on the controller -- the same shape v1's grain/automation/dispatch.py already settled on (see that file's own docstring, "Why the agent doesn't run on the sandbox anymore"): the agent's OAuth credential must never enter the untrusted execution environment, so `claude -p` runs here on the controller with its native tool roster emptied out, reaching the sandbox only through the MCP tools grain's own "mcpserver" subcommand exposes (pkg/cli/mcpserver.go).
Package claude implements agent.Framework by running the real `claude` CLI as a subprocess on the controller -- the same shape v1's grain/automation/dispatch.py already settled on (see that file's own docstring, "Why the agent doesn't run on the sandbox anymore"): the agent's OAuth credential must never enter the untrusted execution environment, so `claude -p` runs here on the controller with its native tool roster emptied out, reaching the sandbox only through the MCP tools grain's own "mcpserver" subcommand exposes (pkg/cli/mcpserver.go).
agent/claude/stophook
Package stophook is Claude Code's Stop hook as grain answers it: the payload on stdin, the stop rule (pkg/agent/stoprule) applied to the session it names, and the decision on stdout.
Package stophook is Claude Code's Stop hook as grain answers it: the payload on stdin, the stop rule (pkg/agent/stoprule) applied to the session it names, and the decision on stdout.
agent/codex
Package codex implements agent.Framework by running OpenAI's Codex CLI -- the `codex` binary -- as a subprocess on the controller.
Package codex implements agent.Framework by running OpenAI's Codex CLI -- the `codex` binary -- as a subprocess on the controller.
agent/credcheck
Package credcheck tests an agent framework's own credential against the service that issued it: one cheap, harmless call, authenticated exactly as a dispatch would authenticate, reported as a sentence a human can act on.
Package credcheck tests an agent framework's own credential against the service that issued it: one cheap, harmless call, authenticated exactly as a dispatch would authenticate, reported as a sentence a human can act on.
agent/hookpolicy
Package hookpolicy defines the versioned per-run hook policy file that the daemon stages beside a run's CLI configuration and that the hook subcommands (agy-tool-hook and claude-stop-hook) evaluate on the CLI's host.
Package hookpolicy defines the versioned per-run hook policy file that the daemon stages beside a run's CLI configuration and that the hook subcommands (agy-tool-hook and claude-stop-hook) evaluate on the CLI's host.
agent/sessionstore
Package sessionstore is the directory an agent CLI's conversations live in between one dispatch of a task and the next, and the bounds grain keeps on it.
Package sessionstore is the directory an agent CLI's conversations live in between one dispatch of a task and the next, and the bounds grain keeps on it.
agent/stoprule
Package stoprule is grain's stop rule on its own: whether a run that has just ended its turn may end there.
Package stoprule is grain's stop rule on its own: whether a run that has just ended its turn may end there.
agentd
Package agentd is grain-agentd: a lightweight, rootless grain hostd for a machine that is not the daemon's.
Package agentd is grain-agentd: a lightweight, rootless grain hostd for a machine that is not the daemon's.
agentd/release
Package release defines the signed per-platform release manifest, pinned Ed25519 release public key, and key-rotation chain for grain-agentd (design/design/agentd-stable-contract.design.md, "The safety valve").
Package release defines the signed per-platform release manifest, pinned Ed25519 release public key, and key-rotation chain for grain-agentd (design/design/agentd-stable-contract.design.md, "The safety valve").
agentd/release/cmd/grain-agentd-sign command
Command grain-agentd-sign generates Ed25519 release signing keys, writes and signs per-platform grain-agentd release manifests, verifies manifests and binaries against a pinned release public key, and signs key-rotation records ("the old key signs the new").
Command grain-agentd-sign generates Ed25519 release signing keys, writes and signs per-platform grain-agentd release manifests, verifies manifests and binaries against a pinned release public key, and signs key-rotation records ("the old key signs the new").
apierror
Package apierror decides what an HTTP API may say about a failure.
Package apierror decides what an HTTP API may say about a failure.
attest
Package attest is grit's proof of work: the in-toto Statement and run predicate grit signs when a run concludes, the DSSE envelope it is carried in, and the signing and verification both grain and `grit verify` use (design/design/grit-split.design.md, "Attestations").
Package attest is grit's proof of work: the in-toto Statement and run predicate grit signs when a run concludes, the DSSE envelope it is carried in, and the signing and verification both grain and `grit verify` use (design/design/grit-split.design.md, "Attestations").
authfix
Package authfix turns a failure that is really a lapsed host credential into the one sentence that fixes it.
Package authfix turns a failure that is really a lapsed host credential into the one sentence that fixes it.
authfix/authfixtest
Package authfixtest registers a made-up authfix classifier, so that core packages can test what they do with a lapsed host credential without knowing any real environment's.
Package authfixtest registers a made-up authfix classifier, so that core packages can test what they do with a lapsed host credential without knowing any real environment's.
backup
Package backup creates portable, credential-free snapshots of a Grain installation and sends them to a configured destination.
Package backup creates portable, credential-free snapshots of a Grain installation and sends them to a configured destination.
capability
Package capability is the registry through which a package outside core grain contributes a method of an in-process capability server -- https://grain.dev/capabilities/corp#research, say -- with Register (methods.go).
Package capability is the registry through which a package outside core grain contributes a method of an in-process capability server -- https://grain.dev/capabilities/corp#research, say -- with Register (methods.go).
capability/admincaps
Package admincaps lists grain's host- and deployment-level capabilities -- the ones that reach past a sandbox into grain's host, its database, its deployment or its cloud project.
Package admincaps lists grain's host- and deployment-level capabilities -- the ones that reach past a sandbox into grain's host, its database, its deployment or its cloud project.
capability/capabilitytest
Package capabilitytest registers a made-up in-process capability server method, so that core packages can test what they do with a capability contributed from outside core (capability.Register) without knowing any real environment's.
Package capabilitytest registers a made-up in-process capability server method, so that core packages can test what they do with a capability contributed from outside core (capability.Register) without knowing any real environment's.
capability/ciapi
Package ciapi lets a CI job hold agent API grants -- `api:<scope>` and `api:<preset>` (docs/agent-api.md) -- in its workflow's `capabilities:`, the same grants a task holds, so that what a job may read of this deployment is said in the one vocabulary grain already has rather than in a capability of its own per workflow.
Package ciapi lets a CI job hold agent API grants -- `api:<scope>` and `api:<preset>` (docs/agent-api.md) -- in its workflow's `capabilities:`, the same grants a task holds, so that what a job may read of this deployment is said in the one vocabulary grain already has rather than in a capability of its own per workflow.
capability/dbaccess
Package dbaccess provides capabilities for direct Grain database read and read/write access.
Package dbaccess provides capabilities for direct Grain database read and read/write access.
capability/deploymenthealth
Package deploymenthealth grants bounded, read-only controller diagnostics.
Package deploymenthealth grants bounded, read-only controller diagnostics.
capability/gcpkey
Package gcpkey is the "gcp-key" capability: a MINT provider (docs/data-model.md, model/capability.go) that mints a short-lived service-account key for a narrow "agent" service account and pushes it into the sandbox, mirroring grain/automation/gcp_keys.py's shape -- bwsalmon/agents#126, ported to v2's declarative provider contract rather than v1's Runner-shelling-to-gcloud one.
Package gcpkey is the "gcp-key" capability: a MINT provider (docs/data-model.md, model/capability.go) that mints a short-lived service-account key for a narrow "agent" service account and pushes it into the sandbox, mirroring grain/automation/gcp_keys.py's shape -- bwsalmon/agents#126, ported to v2's declarative provider contract rather than v1's Runner-shelling-to-gcloud one.
capability/gcpsets
Package gcpsets is the gcp capability server's engine: admin accounts that act on GCP for it, permission sets that say what a grant may do, service accounts it creates on demand for each set, and the per-attempt keys it mints for them (docs/capabilities.md, "GCP").
Package gcpsets is the gcp capability server's engine: admin accounts that act on GCP for it, permission sets that say what a grant may do, service accounts it creates on demand for each set, and the per-attempt keys it mints for them (docs/capabilities.md, "GCP").
capability/gcpsets/gcpfake
Package gcpfake is an in-memory IAM and Resource Manager for gcpsets' tests: service accounts, their keys (with GCP's ten-key cap), project and bucket IAM policies with etags, and testIamPermissions.
Package gcpfake is an in-memory IAM and Resource Manager for gcpsets' tests: service accounts, their keys (with GCP's ten-key cap), project and bucket IAM policies with etags, and testIamPermissions.
capability/geminikey
Package geminikey is a MINT model.CapabilityProvider: it mints a short-lived Gemini API key for a task labelled grain-gemini-key, places it in the sandbox, and revokes it when the task's slot frees -- bwsalmon/agents#239, porting grain/automation/gemini_keys.py's "gemini-key" capability (docs/data-model.md's worked MINT example) into v2.
Package geminikey is a MINT model.CapabilityProvider: it mints a short-lived Gemini API key for a task labelled grain-gemini-key, places it in the sandbox, and revokes it when the task's slot frees -- bwsalmon/agents#239, porting grain/automation/gemini_keys.py's "gemini-key" capability (docs/data-model.md's worked MINT example) into v2.
capability/githubsandbox
Package githubsandbox is the "github-sandbox" capability: a MINT provider (docs/data-model.md, model/capability.go) that creates a private, single-use GitHub repo under a dedicated bot account and pushes a token scoped to just that repo into the sandbox -- bwsalmon/agents#354.
Package githubsandbox is the "github-sandbox" capability: a MINT provider (docs/data-model.md, model/capability.go) that creates a private, single-use GitHub repo under a dedicated bot account and pushes a token scoped to just that repo into the sandbox -- bwsalmon/agents#354.
capability/githubtoken
Package githubtoken provides credential-naming, prompt, and probing helpers for named GitHub credentials stored under secrets/github.
Package githubtoken provides credential-naming, prompt, and probing helpers for named GitHub credentials stored under secrets/github.
capability/grainci
Package grainci holds the rules around the grain#ci grant (model.GrainCIGrant, https://grain.dev/capabilities/grain#ci={}, formerly the bare grain-ci in-process capability): the grant a task holds when grain's own CI (pkg/ci) judges the branches it pushes.
Package grainci holds the rules around the grain#ci grant (model.GrainCIGrant, https://grain.dev/capabilities/grain#ci={}, formerly the bare grain-ci in-process capability): the grant a task holds when grain's own CI (pkg/ci) judges the branches it pushes.
capability/grainlog
Package grainlog is a GRANT model.CapabilityProvider: a task holding it gets one read-only tool, read_grain_log, returning a bounded, host-side-redacted slice of this deployment's own systemd journal -- the same source the UI's System pane serves (pkg/systemlog).
Package grainlog is a GRANT model.CapabilityProvider: a task holding it gets one read-only tool, read_grain_log, returning a bounded, host-side-redacted slice of this deployment's own systemd journal -- the same source the UI's System pane serves (pkg/systemlog).
capability/grainserver
Package grainserver holds grain's in-process capability servers (design/design/unified-grants.design.md §1, §4), answered by grain itself rather than by an external MCP server subprocess:
Package grainserver holds grain's in-process capability servers (design/design/unified-grants.design.md §1, §4), answered by grain itself rather than by an external MCP server subprocess:
capability/imagesigning
Package imagesigning provides the "image-signing" CI capability: the cosign private key a release signs this repository's images with, and the password that decrypts it (docs/image-signing.md).
Package imagesigning provides the "image-signing" CI capability: the cosign private key a release signs this repository's images with, and the password that decrypts it (docs/image-signing.md).
capability/intree
Package intree is grain's in-tree capability servers: the capabilities compiled into the grain binary and served, one per process, by `grain capability <name>` over stdio (design/spec/capabilities/capabilities.spec.md §3.1.1), each implementing one of the standard patterns of §6 on top of pkg/capability/protocol's Method and CapabilityServer:
Package intree is grain's in-tree capability servers: the capabilities compiled into the grain binary and served, one per process, by `grain capability <name>` over stdio (design/spec/capabilities/capabilities.spec.md §3.1.1), each implementing one of the standard patterns of §6 on top of pkg/capability/protocol's Method and CapabilityServer:
capability/localscripts
Package localscripts migrates "local-scripts:<name>" declarations and grants onto the host-script capability server (docs/local-scripts.md).
Package localscripts migrates "local-scripts:<name>" declarations and grants onto the host-script capability server (docs/local-scripts.md).
capability/modelproxy
Package modelproxy is the "<vendor>-proxy" capabilities -- claude-proxy, openai-proxy and gemini-proxy -- one MINT model.CapabilityProvider per vendor, each minting a per-run token for this deployment's own proxy to that vendor (pkg/modelproxy) and placing it, with the address to use it against, in the run's sandbox.
Package modelproxy is the "<vendor>-proxy" capabilities -- claude-proxy, openai-proxy and gemini-proxy -- one MINT model.CapabilityProvider per vendor, each minting a per-run token for this deployment's own proxy to that vendor (pkg/modelproxy) and placing it, with the address to use it against, in the run's sandbox.
capability/packagepublish
Package packagepublish provides the "package-publish" CI capability: publishing a repository's container images with the GitHub credential this deployment already uses for that repository, rather than with a registry token of its own.
Package packagepublish provides the "package-publish" CI capability: publishing a repository's container images with the GitHub credential this deployment already uses for that repository, rather than with a registry token of its own.
capability/portforward
Package portforward carries a capability grant's ports (design/spec/capabilities/capabilities.spec.md §5.3) into a sandbox: TCP connections to 127.0.0.1:<sandbox_port> in the guest arrive at 127.0.0.1:<host_port> on this host, whatever the sandbox backend.
Package portforward carries a capability grant's ports (design/spec/capabilities/capabilities.spec.md §5.3) into a sandbox: TCP connections to 127.0.0.1:<sandbox_port> in the guest arrive at 127.0.0.1:<host_port> on this host, whatever the sandbox backend.
capability/protocol
Package protocol implements Grain's side of the capability control-plane protocol specified in design/spec/capabilities/capabilities.spec.md (the author's guide is docs/capabilities.md): the target architecture in which a capability is an MCP server configured under mcpServers in grain/config, advertising a mint_<method> tool per capability method and a release_<method> tool for each stateful one.
Package protocol implements Grain's side of the capability control-plane protocol specified in design/spec/capabilities/capabilities.spec.md (the author's guide is docs/capabilities.md): the target architecture in which a capability is an MCP server configured under mcpServers in grain/config, advertising a mint_<method> tool per capability method and a release_<method> tool for each stateful one.
capability/registrypush
Package registrypush provides the "registry-push" CI capability.
Package registrypush provides the "registry-push" CI capability.
capability/release
Package release is the in-process https://grain.dev/capabilities/release server: the CI credentials a repository's release publishes and signs with, which the retired image-signing, registry-push and package-publish providers placed (design/design/unified-grants.design.md, task 1061).
Package release is the in-process https://grain.dev/capabilities/release server: the CI credentials a repository's release publishes and signs with, which the retired image-signing, registry-push and package-publish providers placed (design/design/unified-grants.design.md, task 1061).
capability/selfrepair
Package selfrepair builds the tool that the https://grain.dev/capabilities/grain#host-exec grant (once the bare "self-repair" capability; design/design/unified-grants.design.md §4) adds to a run: run_host_command, to run shell commands directly on the host grain's own controller runs on -- restart a systemd unit, poke at grain's own config, call the grain CLI itself, anything a person at that host's own terminal could do -- bwsalmon/agents#540's "configuration mode." The grant itself is a dangerous method on the in-process grain server (pkg/capability/grainserver), which only a person may give; this package holds no provider of its own.
Package selfrepair builds the tool that the https://grain.dev/capabilities/grain#host-exec grant (once the bare "self-repair" capability; design/design/unified-grants.design.md §4) adds to a run: run_host_command, to run shell commands directly on the host grain's own controller runs on -- restart a systemd unit, poke at grain's own config, call the grain CLI itself, anything a person at that host's own terminal could do -- bwsalmon/agents#540's "configuration mode." The grant itself is a dangerous method on the in-process grain server (pkg/capability/grainserver), which only a person may give; this package holds no provider of its own.
capability/servers
Package servers keeps the daemon's attached capability servers: the mcpServers entries of grain_config (model.Config.MCPServers, design/spec/capabilities/capabilities.spec.md §3.1), each attached with protocol.Attach and held under its capability_id for as long as its configuration says it should be.
Package servers keeps the daemon's attached capability servers: the mcpServers entries of grain_config (model.Config.MCPServers, design/spec/capabilities/capabilities.spec.md §3.1), each attached with protocol.Attach and held under its capability_id for as long as its configuration says it should be.
change
Package change is core grain's seam to a task's change when that change is not a GitHub pull request -- a changelist CL, today (docs/design/changelists.md#G3-2, §2.5).
Package change is core grain's seam to a task's change when that change is not a GitHub pull request -- a changelist CL, today (docs/design/changelists.md#G3-2, §2.5).
checkpost
Package checkpost is where CI hands in its verdict on a commit, and where whoever gates on that verdict comes to read it.
Package checkpost is where CI hands in its verdict on a commit, and where whoever gates on that verdict comes to read it.
ci
Package ci is grain's own CI: the workflows declared for a repository, and the engine that runs them against one repo and one branch, each job in a sandbox of its own, as many at a time as the deployment allows.
Package ci is grain's own CI: the workflows declared for a repository, and the engine that runs them against one repo and one branch, each job in a sandbox of its own, as many at a time as the deployment allows.
ci/cli
Package cli is the part of `grain ci` (pkg/cli/cicmd.go) that is not flags or printing: polling a run until it is over, following a run in flight as a stream of only the output nobody has been shown yet, which steps' output a reader asked for, and what a finished run exits with.
Package cli is the part of `grain ci` (pkg/cli/cicmd.go) that is not flags or printing: polling a run until it is over, following a run in flight as a stream of only the output nobody has been shown yet, which steps' output a reader asked for, and what a finished run exits with.
cifault
Package cifault is the second half of a shared CI fault: given one failure showing up on several branches at once (ci.SharedFault, where the judgement about what counts as one lives), which open pull request -- if any -- already fixes it.
Package cifault is the second half of a shared CI fault: given one failure showing up on several branches at once (ci.SharedFault, where the judgement about what counts as one lives), which open pull request -- if any -- already fixes it.
cli
args.go is one rule, applied to every command in this CLI: a word the command has no use for is an error, not something to drop on the floor.
args.go is one rule, applied to every command in this CLI: a word the command has no use for is an error, not something to drop on the floor.
cli/skill
Package skill holds the embedded static template for `grain skill install` (design/spec/external-cli/external-cli.spec.md#XC-30).
Package skill holds the embedded static template for `grain skill install` (design/spec/external-cli/external-cli.spec.md#XC-30).
console
Package console runs an agent framework's own CLI on a pseudo-terminal and keeps the session alive for somebody to sit in front of -- grain's interactive tasks, as opposed to the unattended runs every other task gets.
Package console runs an agent framework's own CLI on a pseudo-terminal and keeps the session alive for somebody to sit in front of -- grain's interactive tasks, as opposed to the unattended runs every other task gets.
declschema
Package declschema is the one definition of what a template, a suite and a schedule are made of (grain/task-339).
Package declschema is the one definition of what a template, a suite and a schedule are made of (grain/task-339).
demo
Package demo is `grain demo`'s throwaway deployment: a real pkg/ui.Server over a real embedded SQLite database in a fresh temp directory, seeded with fake tasks, for trying out the frontend with no daemon, no orchestrator, no sandbox, no Gemini key and no real git repo behind any of it.
Package demo is `grain demo`'s throwaway deployment: a real pkg/ui.Server over a real embedded SQLite database in a fresh temp directory, seeded with fake tasks, for trying out the frontend with no daemon, no orchestrator, no sandbox, no Gemini key and no real git repo behind any of it.
designdoc
Package designdoc reads what a design-doc planner works from (docs/design-docs.md): the requirement IDs a design doc's headings carry, and the commit trailers that record which of them are built.
Package designdoc reads what a design-doc planner works from (docs/design-docs.md): the requirement IDs a design doc's headings carry, and the commit trailers that record which of them are built.
dispatch
Package dispatch decides which tasks run now: what one controller cycle starts, and nothing more.
Package dispatch decides which tasks run now: what one controller cycle starts, and nothing more.
dispatchcondition
Package dispatchcondition records the reasons a deployment is not dispatching at all, as named conditions on the deployment rather than as log lines.
Package dispatchcondition records the reasons a deployment is not dispatching at all, as named conditions on the deployment rather than as log lines.
forge
Package forge is what is true about a branch, and whether it may land.
Package forge is what is true about a branch, and whether it may land.
forkhead
Package forkhead resolves a GitHub fork head label typed as a task's branch ("andrzejfudro:chore/bump-agy-1.4.9", model.ForkHead) to the open pull request it heads on the task's repository, and says what a task filed against it is based on, linked to and told.
Package forkhead resolves a GitHub fork head label typed as a task's branch ("andrzejfudro:chore/bump-agy-1.4.9", model.ForkHead) to the open pull request it heads on the task's repository, and says what a task filed against it is based on, linked to and told.
gates
Package gates implements pure, local built-in evaluators.
Package gates implements pure, local built-in evaluators.
gcpsetup
Package gcpsetup bootstraps the external GCP infrastructure the gcp-key and gemini-key capabilities (pkg/capability/gcpkey, pkg/capability/geminikey) need before either can mint anything -- bwsalmon/agents#358.
Package gcpsetup bootstraps the external GCP infrastructure the gcp-key and gemini-key capabilities (pkg/capability/gcpkey, pkg/capability/geminikey) need before either can mint anything -- bwsalmon/agents#358.
ghwebhook
Package ghwebhook receives, verifies, normalizes, stores, and relays inbound GitHub App webhook deliveries.
Package ghwebhook receives, verifies, normalizes, stores, and relays inbound GitHub App webhook deliveries.
github
Package github is the GitHub REST calls a grain deployment needs to run GitHub-driven work: list labelled issues, move labels, confirm a branch exists, open a PR, read a PR's own data and its review comments, relay a human's reply.
Package github is the GitHub REST calls a grain deployment needs to run GitHub-driven work: list labelled issues, move labels, confirm a branch exists, open a PR, read a PR's own data and its review comments, relay a human's reply.
github/githubsim
Package githubsim replicates v1's own live-test double for the GitHub REST API -- tests/test_live_issue_to_pr.py's RealGitHubMock -- as a github.Transport, so a Go end-to-end test can wire a real github.RESTClient against it exactly the way github.FakeTransport lets a unit test wire one against a single scripted response.
Package githubsim replicates v1's own live-test double for the GitHub REST API -- tests/test_live_issue_to_pr.py's RealGitHubMock -- as a github.Transport, so a Go end-to-end test can wire a real github.RESTClient against it exactly the way github.FakeTransport lets a unit test wire one against a single scripted response.
gitproxy
Package gitproxy is the only path from a sandbox to GitHub: docs/design.md's git proxy, ported from grain/proxy (Python) to sit alongside the rest of v2.
Package gitproxy is the only path from a sandbox to GitHub: docs/design.md's git proxy, ported from grain/proxy (Python) to sit alongside the rest of v2.
gitproxy/gitproxytest
Package gitproxytest is a made-up command-backed ambient source for tests outside pkg/gitproxy: what a registered forge tool looks like to core grain (gitproxy.RegisterAmbientSource), with no real one behind it.
Package gitproxytest is a made-up command-backed ambient source for tests outside pkg/gitproxy: what a registered forge tool looks like to core grain (gitproxy.RegisterAmbientSource), with no real one behind it.
gitrefs
Package gitrefs keeps the repositories grain makes in git's classic "files" ref format, and explains the ones it finds in any other.
Package gitrefs keeps the repositories grain makes in git's classic "files" ref format, and explains the ones it finds in any other.
granule
Package granule drives the `granule` binary: creating and deleting the sandbox VMs bwsalmon/granule runs, plus the `docker inspect` a caller needs to tell a VM whose container died from one still on its way up and the `docker logs` that reads a guest's serial console.
Package granule drives the `granule` binary: creating and deleting the sandbox VMs bwsalmon/granule runs, plus the `docker inspect` a caller needs to tell a VM whose container died from one still on its way up and the `docker logs` that reads a guest's serial console.
grit
Package grit implements grit's standalone and embedded CI execution service (/v1 API, durable event stream, tree store, client authentication/scopes, and in-process grit.Local backend; see design/design/grit-split.design.md).
Package grit implements grit's standalone and embedded CI execution service (/v1 API, durable event stream, tree store, client authentication/scopes, and in-process grit.Local backend; see design/design/grit-split.design.md).
grit/actions
Package actions runs one GitHub Actions job with act, in a disposable Kontur guest: the `grit act` subcommand and the script pkg/ci hands an Actions job's sandbox.
Package actions runs one GitHub Actions job with act, in a disposable Kontur guest: the `grit act` subcommand and the script pkg/ci hands an Actions job's sandbox.
gritapi
Package gritapi defines the wire types and HTTP client for grit's /v1 API (design/design/grit-split.design.md, "The API" and "Event stream").
Package gritapi defines the wire types and HTTP client for grit's /v1 API (design/design/grit-split.design.md, "The API" and "Event stream").
hostd
Package hostd is "grain hostd": a small process server that runs on the bare machine, as the user who installed grain, and starts only the programs that machine's own allowlist names, on behalf of a daemon that runs in the release container.
Package hostd is "grain hostd": a small process server that runs on the bare machine, as the user who installed grain, and starts only the programs that machine's own allowlist names, on behalf of a daemon that runs in the release container.
hostinit
Package hostinit is `grain init`: bringing a bare Linux host up to a running deployment in one command, rather than the shell archaeology this package's own doc comment and commit history were written to retire.
Package hostinit is `grain init`: bringing a bare Linux host up to a running deployment in one command, rather than the shell archaeology this package's own doc comment and commit history were written to retire.
hostscriptcli
Package hostscriptcli is `grain host-script`, the sandbox side of the host-script capability (docs/host-scripts.md): it runs a granted host script by name, sending its argv to the grant's endpoint on grain's side and replaying the framed answer as a local command's stdout, stderr and exit status.
Package hostscriptcli is `grain host-script`, the sandbox side of the host-script capability (docs/host-scripts.md): it runs a granted host script by name, sending its argv to the grant's endpoint on grain's side and replaying the framed answer as a local command's stdout, stderr and exit status.
hosttop
Package hosttop reads a `top` snapshot of the processes running alongside this deployment's own daemon -- pkg/cli/daemon.go's ui.Config.HostTop, behind the System overlay's Top tab.
Package hosttop reads a `top` snapshot of the processes running alongside this deployment's own daemon -- pkg/cli/daemon.go's ui.Config.HostTop, behind the System overlay's Top tab.
hub
Package hub is the root package of the standalone grain-hub service (design/design/hub.design.md).
Package hub is the root package of the standalone grain-hub service (design/design/hub.design.md).
hub/api
Package api defines the wire data transfer objects, validation rules, typed HTTP client, and outbound WebSocket-mux tunnel client for grain-registry.
Package api defines the wire data transfer objects, validation rules, typed HTTP client, and outbound WebSocket-mux tunnel client for grain-registry.
hubenv
Package hubenv reads the Grain Hub's environment variables, which were named GRAIN_REGISTRY_* before the Grain Registry was renamed the Grain Hub.
Package hubenv reads the Grain Hub's environment variables, which were named GRAIN_REGISTRY_* before the Grain Registry was renamed the Grain Hub.
infrasig
Package infrasig is the one list of what a CI step prints when it failed on the machine it ran on rather than on the tree it was given: a quota, a registry rate limit, a runner that went away, a forge that answered a clone with a 5xx, a runner whose DNS stopped answering.
Package infrasig is the one list of what a CI step prints when it failed on the machine it ran on rather than on the tree it was given: a quota, a registry rate limit, a runner that went away, a forge that answered a clone with a 5xx, a runner whose DNS stopped answering.
installtrack
Package installtrack classifies a Grain deployment into an install track from host, systemd unit, and store signals -- falling back to the edition linked into the binary (SetBuildTrack) -- and provides repository transition rules for shifting pre-split deployments to their post-split image repositories.
Package installtrack classifies a Grain deployment into an install track from host, systemd unit, and store signals -- falling back to the edition linked into the binary (SetBuildTrack) -- and provides repository transition rules for shifting pre-split deployments to their post-split image repositories.
installtrack/installtracktest
Package installtracktest registers a made-up install track, "acme", for core tests of code that behaves differently on a registered track: core grain registers none of its own, and core tests never rely on an edition's.
Package installtracktest registers a made-up install track, "acme", for core tests of code that behaves differently on a registered track: core grain registers none of its own, and core tests never rely on an edition's.
jwks
Package jwks fetches and caches the public keys an issuer signs its JWTs with: a JWK set ({"keys": [...]}, RFC 7517) or Google's own map of key ID to PEM public key (IAP's https://www.gstatic.com/iap/verify/ public_key).
Package jwks fetches and caches the public keys an issuer signs its JWTs with: a JWK set ({"keys": [...]}, RFC 7517) or Google's own map of key ID to PEM public key (IAP's https://www.gstatic.com/iap/verify/ public_key).
k8s
Package k8s drives the `kubectl` binary: creating, inspecting and deleting the pods a Kubernetes-backed grain deployment runs its sandboxes in, and repointing its own Deployment at a new image when it upgrades itself.
Package k8s drives the `kubectl` binary: creating, inspecting and deleting the pods a Kubernetes-backed grain deployment runs its sandboxes in, and repointing its own Deployment at a new image when it upgrades itself.
kubectlgate
Package kubectlgate paces the kubectl processes this daemon starts against one Kubernetes API server, and recognizes the failures of theirs that are worth trying again.
Package kubectlgate paces the kubectl processes this daemon starts against one Kubernetes API server, and recognizes the failures of theirs that are worth trying again.
lifecycle
Package lifecycle serves a repository's task lifecycle definition from one of grain's own sandboxes (docs/task-lifecycle-sandbox.md).
Package lifecycle serves a repository's task lifecycle definition from one of grain's own sandboxes (docs/task-lifecycle-sandbox.md).
localexec
Package localexec is grain's local-scripts executor, ported from Silo v2's localexec (Silo design.md §12, "remote agent, narrow local reach"): each script a trusted declaration names becomes one MCP tool, local_<name>, that runs it on the node host with the agent's arguments and no shell in between.
Package localexec is grain's local-scripts executor, ported from Silo v2's localexec (Silo design.md §12, "remote agent, narrow local reach"): each script a trusted declaration names becomes one MCP tool, local_<name>, that runs it on the node host with the agent's arguments and no shell in between.
mcp
Package mcp is a small, self-contained port of grain/automation/mcp_server.py's hand-rolled MCP server: newline-delimited JSON-RPC 2.0 over a pair of io.Reader/io.Writer, with no dependency on an MCP SDK, mirroring v1's own choice not to take one on.
Package mcp is a small, self-contained port of grain/automation/mcp_server.py's hand-rolled MCP server: newline-delimited JSON-RPC 2.0 over a pair of io.Reader/io.Writer, with no dependency on an MCP SDK, mirroring v1's own choice not to take one on.
mergelogins
Package mergelogins checks the logins a reviewed-merge gate trusts as grain's own merges (pkg/reviewedmerge): the repository variable GRAIN_MERGE_LOGINS that release-images.sh reads, and the daemon's -upgrade-reviewed-merge-logins.
Package mergelogins checks the logins a reviewed-merge gate trusts as grain's own merges (pkg/reviewedmerge): the repository variable GRAIN_MERGE_LOGINS that release-images.sh reads, and the daemon's -upgrade-reviewed-merge-logins.
metrics
Package metrics measures what a deployment actually delivers: how many tasks it finished over a window (throughput), and how long each stage of a task's life took to get there (latency).
Package metrics measures what a deployment actually delivers: how many tasks it finished over a window (throughput), and how long each stage of a task's life took to get there (latency).
model
Package model is the grain task model: the entities, their derivations, and a store for them.
Package model is the grain task model: the entities, their derivations, and a store for them.
model/gateobservationtest
Package gateobservationtest qualifies diagnostic storage on both engines.
Package gateobservationtest qualifies diagnostic storage on both engines.
model/guardtest
Package guardtest is the single-tenant startup guard's test (model.Store.CheckSingleTenant, docs/single-tenant-reset.md stage 5), written once and run against every store driver: pkg/model/sqlite and pkg/model/postgres each call Run with their own way of opening a store.
Package guardtest is the single-tenant startup guard's test (model.Store.CheckSingleTenant, docs/single-tenant-reset.md stage 5), written once and run against every store driver: pkg/model/sqlite and pkg/model/postgres each call Run with their own way of opening a store.
model/postgres
Package postgres connects to a PostgreSQL database and sets up the connection pool and dialect adapter for model.Store.
Package postgres connects to a PostgreSQL database and sets up the connection pool and dialect adapter for model.Store.
model/postgres/postgrestest
Package postgrestest provides temporary isolated PostgreSQL schemas for integration tests of model.Store against PostgreSQL.
Package postgrestest provides temporary isolated PostgreSQL schemas for integration tests of model.Store against PostgreSQL.
model/sqlite
Package sqlite opens an embedded SQLite database for the task store.
Package sqlite opens an embedded SQLite database for the task store.
model/sqlite/sqlitetest
Package sqlitetest opens disposable, schema-initialized SQLite databases for tests.
Package sqlitetest opens disposable, schema-initialized SQLite databases for tests.
model/v2baseline
Package v2baseline is grain 2.0.0's schema, frozen, and the tests that hold every later build to opening what 2.0.0 wrote.
Package v2baseline is grain 2.0.0's schema, frozen, and the tests that hold every later build to opening what 2.0.0 wrote.
modelproxy
Package modelproxy is the model APIs' equivalent of pkg/gitproxy: the one path from a sandbox to a model vendor -- Anthropic, OpenAI, Google -- holding the credential of the deployment's connection for that vendor so that nothing inside a sandbox ever has to.
Package modelproxy is the model APIs' equivalent of pkg/gitproxy: the one path from a sandbox to a model vendor -- Anthropic, OpenAI, Google -- holding the credential of the deployment's connection for that vendor so that nothing inside a sandbox ever has to.
nsclient
Package nsclient is the client half of grain's namespace (pkg/namespace) that both CLIs speak: the sandbox's `grain ls|read|grep` (pkg/sandboxcli), over the sandbox proxy's /fs/, and a workstation's `grain fs ls|cat|read|grep` (pkg/cli), over the daemon's own /api/fs/ (design/spec/external-cli/external-cli.spec.md, #XC-25).
Package nsclient is the client half of grain's namespace (pkg/namespace) that both CLIs speak: the sandbox's `grain ls|read|grep` (pkg/sandboxcli), over the sandbox proxy's /fs/, and a workstation's `grain fs ls|cat|read|grep` (pkg/cli), over the daemon's own /api/fs/ (design/spec/external-cli/external-cli.spec.md, #XC-25).
objectstore
Package objectstore provides a minimal prefix-scoped object store backed by Google Cloud Storage (gs://), a local directory (file://), or an in-memory fake (MemoryStore) for run transcripts, CI artifacts, and durable agent-session archives.
Package objectstore provides a minimal prefix-scoped object store backed by Google Cloud Storage (gs://), a local directory (file://), or an in-memory fake (MemoryStore) for run transcripts, CI artifacts, and durable agent-session archives.
orchestrator
Package orchestrator is v2's equivalent of v1's core.py Orchestrator: the component that decides *when* to call GitHub, wired to dispatch.Cycle's dispatch decisions and model.Store's state.
Package orchestrator is v2's equivalent of v1's core.py Orchestrator: the component that decides *when* to call GitHub, wired to dispatch.Cycle's dispatch decisions and model.Store's state.
pkgcache
Package pkgcache is this deployment's package cache: one HTTP service in the controller that every sandbox's apt, pip, docker, npm and go are pointed at, so the twentieth run that installs ripgrep -- or pulls debian:bookworm, or runs `npm ci` -- fetches it from the machine next to it rather than from the internet.
Package pkgcache is this deployment's package cache: one HTTP service in the controller that every sandbox's apt, pip, docker, npm and go are pointed at, so the twentieth run that installs ripgrep -- or pulls debian:bookworm, or runs `npm ci` -- fetches it from the machine next to it rather than from the internet.
playbooks
Package playbooks embeds grain's bootstrap playbooks -- markdown runbooks served both by the built-in config-map capability server ("bootstrap") and by pkg/namespace as src://playbooks.
Package playbooks embeds grain's bootstrap playbooks -- markdown runbooks served both by the built-in config-map capability server ("bootstrap") and by pkg/namespace as src://playbooks.
policy
Package policy is grain's local Policy Enforcement Point: the check a workstation's own grain makes of every task before it is given a sandbox, against a small policy its owner writes down (grain_policy.yml, named by the daemon's -policy flag).
Package policy is grain's local Policy Enforcement Point: the check a workstation's own grain makes of every task before it is given a sandbox, against a small policy its owner writes down (grain_policy.yml, named by the daemon's -policy flag).
portpick
Package portpick makes a port mechanically: the commits of a merged pull request cherry-picked onto the other branch of a pair, by grain itself on its own host, with no sandbox and no model behind it.
Package portpick makes a port mechanically: the commits of a merged pull request cherry-picked onto the other branch of a pair, by grain itself on its own host, with no sandbox and no model behind it.
ports
Package ports is grain's table of fixed, well-known ports: the ones an operator types, a firewall rule names or a bookmark remembers.
Package ports is grain's table of fixed, well-known ports: the ones an operator types, a firewall rule names or a bookmark remembers.
procgroup
Package procgroup makes exec.CommandContext's cancellation reach a command's whole process tree, not just the one process it directly forked.
Package procgroup makes exec.CommandContext's cancellation reach a command's whole process tree, not just the one process it directly forked.
qa
Package qa implements Grain's quality control assignment, stage profiling, and deterministic/semantic PR assurance checks.
Package qa implements Grain's quality control assignment, stage profiling, and deterministic/semantic PR assurance checks.
redact
Package redact removes credential material from text before it leaves the process holding it: the journal lines the grain-log capability serves (pkg/capability/grainlog), the output of a host sandbox's run_command, which carries the operator's own -host-sandbox-env (pkg/mcp, GSA1-12), and a run's transcript before it is stored (pkg/orchestrator).
Package redact removes credential material from text before it leaves the process holding it: the journal lines the grain-log capability serves (pkg/capability/grainlog), the output of a host sandbox's run_command, which carries the operator's own -host-sandbox-env (pkg/mcp, GSA1-12), and a run's transcript before it is stored (pkg/orchestrator).
registryauth
Package registryauth finds the credential an image registry wants when the anonymous token exchange will not do: a Google OAuth2 access token for Artifact Registry (*-docker.pkg.dev) and Container Registry (gcr.io), whose private repositories answer an anonymous pull-scoped token with 403 rather than with the image.
Package registryauth finds the credential an image registry wants when the anonymous token exchange will not do: a Google OAuth2 access token for Artifact Registry (*-docker.pkg.dev) and Container Registry (gcr.io), whose private repositories answer an anonymous pull-scoped token with 403 rather than with the image.
releaseapproval
Package releaseapproval is the proof a person pressed Approve (or Reject) in grain's Inbox, carried to a GitHub Actions promote-release.yml run (design/playbook/releases.playbook.md §0.2, gap 4).
Package releaseapproval is the proof a person pressed Approve (or Reject) in grain's Inbox, carried to a GitHub Actions promote-release.yml run (design/playbook/releases.playbook.md §0.2, gap 4).
releasenotes
Package releasenotes reads the per-version release notes this binary carries (docs/releases, embedded by that directory's own package): which versions there are, when each was released, and what each one's notes say.
Package releasenotes reads the per-version release notes this binary carries (docs/releases, embedded by that directory's own package): which versions there are, when each was released, and what each one's notes say.
releasepolicy
Package releasepolicy holds existing pure release predicates shared by legacy services and observation readers.
Package releasepolicy holds existing pure release predicates shared by legacy services and observation readers.
repodecl
Package repodecl reads the templates, suites and schedules a repository declares in its own `.grain` directory (grain/task-60).
Package repodecl reads the templates, suites and schedules a repository declares in its own `.grain` directory (grain/task-60).
reviewedmerge
Package reviewedmerge answers whether a commit reached a release branch through a reviewed merge (docs/security/audits/2026-11-10-insider-risk.md, finding 3).
Package reviewedmerge answers whether a commit reached a release branch through a reviewed merge (docs/security/audits/2026-11-10-insider-risk.md, finding 3).
runhost
Package runhost runs one agent run's CLI, and the "grain mcpserver" it forks, in a run host: a container that is a sibling of the daemon rather than a child of it, so that restarting the daemon does not kill the run (design/design/non-disruptive-upgrade.design.md, "Run hosts").
Package runhost runs one agent run's CLI, and the "grain mcpserver" it forks, in a run host: a container that is a sibling of the daemon rather than a child of it, so that restarting the daemon does not kill the run (design/design/non-disruptive-upgrade.design.md, "Run hosts").
safepath
Package safepath answers one question about the filesystem -- does this path lie inside that directory? -- the one way grain asks it.
Package safepath answers one question about the filesystem -- does this path lie inside that directory? -- the one way grain asks it.
sandboxaccess
Package sandboxaccess is grain's end of granule's dial-out sandbox access channel (design/design/grain-on-gke.design.md, "Sandbox access"): the mTLS acceptor sandbox wrappers dial, the per-deployment CA, the per-sandbox client certificate and token it mints, the admission checks, and the table of which sandboxes are connected.
Package sandboxaccess is grain's end of granule's dial-out sandbox access channel (design/design/grain-on-gke.design.md, "Sandbox access"): the mTLS acceptor sandbox wrappers dial, the per-deployment CA, the per-sandbox client certificate and token it mints, the admission checks, and the table of which sandboxes are connected.
sandboxaddr
Package sandboxaddr allocates the address every sandbox this deployment builds is reachable at, in blocks that keep a sandbox and everything it goes on to create together.
Package sandboxaddr allocates the address every sandbox this deployment builds is reachable at, in blocks that keep a sandbox and everything it goes on to create together.
sandboxcli
Package sandboxcli is the grain CLI as an agent's sandbox sees it (design/design/sandbox-first-agent-surface.design.md, §4): read commands that reach this deployment over the sandbox's own scoped proxy (http://127.0.0.1:9728 or the guest's bridge gateway on :9728, the same address and credential git uses), with no size cap, so a run can pipe a CI log to grep or redirect a transcript to a file instead of paging through an MCP tool's 16 KB results.
Package sandboxcli is the grain CLI as an agent's sandbox sees it (design/design/sandbox-first-agent-surface.design.md, §4): read commands that reach this deployment over the sandbox's own scoped proxy (http://127.0.0.1:9728 or the guest's bridge gateway on :9728, the same address and credential git uses), with no size cap, so a run can pipe a CI log to grep or redirect a transcript to a file instead of paging through an MCP tool's 16 KB results.
sandboximage
Package sandboximage decides which OCI image this installation's sandboxes are created from, and whether a custom one is still compatible with this build of grain.
Package sandboximage decides which OCI image this installation's sandboxes are created from, and whether a custom one is still compatible with this build of grain.
schedulefilter
Package schedulefilter is the one vocabulary for asking a narrower question of a list of schedules: where each is declared, what it fires, which repository and branch it targets, whether it is enabled, its cadence, and when it last fired and next fires (grain/task-429).
Package schedulefilter is the one vocabulary for asking a narrower question of a list of schedules: where each is declared, what it fires, which repository and branch it targets, whether it is enabled, its cadence, and when it last fired and next fires (grain/task-429).
secrets
Package secrets is a model.CredentialResolver backed by a single encrypted file, which lives in grain's state repository (pkg/staterepo) beside everything else grain knows.
Package secrets is a model.CredentialResolver backed by a single encrypted file, which lives in grain's state repository (pkg/staterepo) beside everything else grain knows.
secrets/kmsfake
Package kmsfake is a stand-in for Cloud KMS's encrypt and decrypt REST methods, for tests of the KMS-wrapped secrets key, and for its asymmetricSign and getPublicKey, for tests of a KMS-held signing key.
Package kmsfake is a stand-in for Cloud KMS's encrypt and decrypt REST methods, for tests of the KMS-wrapped secrets key, and for its asymmetricSign and getPublicKey, for tests of a KMS-held signing key.
secretsrepo
Package secretsrepo gives grain's encrypted secrets file a home that is not this host's disk: a git repository of its own, holding the ciphertext and nothing else.
Package secretsrepo gives grain's encrypted secrets file a home that is not this host's disk: a git repository of its own, holding the ciphertext and nothing else.
statemachine
Package statemachine provides Grain's reducer-driven workflow runtime.
Package statemachine provides Grain's reducer-driven workflow runtime.
staterepo
Package staterepo keeps grain's database in a git repository.
Package staterepo keeps grain's database in a git repository.
staterepo/statecheck
Package statecheck is what `grain state check` asks of a state repository's dump once staterepo.Check has loaded it: questions about what the rows mean -- custom field declarations grain cannot offer, values nothing can hold, values a declaration has moved on from, settings a daemon cannot run on -- which need pkg/model, and so live beside pkg/staterepo rather than in it.
Package statecheck is what `grain state check` asks of a state repository's dump once staterepo.Check has loaded it: questions about what the rows mean -- custom field declarations grain cannot offer, values nothing can hold, values a declaration has moved on from, settings a daemon cannot run on -- which need pkg/model, and so live beside pkg/staterepo rather than in it.
sysstat
Package sysstat reads this machine's own CPU-load and memory pressure straight out of the kernel, the same two numbers `uptime` and `free` report, plus a named filesystem's own usage (DiskUsage, one statfs call, the numbers `df` reports, and FilesystemID, which says when two such paths are really one disk) -- pkg/cli/daemon.go's own ui.Config.HostStats (bwsalmon/agents#536's "sandbox health" pane: a sandbox that looks stuck is often really the host it runs on being starved, and that is a question about the daemon's own machine, not about any one sandbox -- see orchestrator.SandboxHealth's own doc comment on why a sandbox's usage is reported separately from this).
Package sysstat reads this machine's own CPU-load and memory pressure straight out of the kernel, the same two numbers `uptime` and `free` report, plus a named filesystem's own usage (DiskUsage, one statfs call, the numbers `df` reports, and FilesystemID, which says when two such paths are really one disk) -- pkg/cli/daemon.go's own ui.Config.HostStats (bwsalmon/agents#536's "sandbox health" pane: a sandbox that looks stuck is often really the host it runs on being starved, and that is a question about the daemon's own machine, not about any one sandbox -- see orchestrator.SandboxHealth's own doc comment on why a sandbox's usage is reported separately from this).
systemlog
Package systemlog implements pkg/ui.LogSource against the places grain v2 actually writes its own logs to: a systemd unit's journal (Journalctl), the kernel's own ring buffer under the daemon (Dmesg), a plain append-only file such as the git proxy's audit log (File), and one pod's container output through `kubectl logs` (Pod) -- bwsalmon/agents#444's "core system logs" for the UI's System pane.
Package systemlog implements pkg/ui.LogSource against the places grain v2 actually writes its own logs to: a systemd unit's journal (Journalctl), the kernel's own ring buffer under the daemon (Dmesg), a plain append-only file such as the git proxy's audit log (File), and one pod's container output through `kubectl logs` (Pod) -- bwsalmon/agents#444's "core system logs" for the UI's System pane.
treeid
Package treeid names a tree by its content alone, as grain and grit both compute it (design/design/grit-split.design.md, "Tree identity"):
Package treeid names a tree by its content alone, as grain and grit both compute it (design/design/grit-split.design.md, "Tree identity"):
trustboundary
Package trustboundary classifies a change by the paths it touches, against a fixed list of the files that make up grain's own trust boundary: who may call what, what a sandbox may run, where credentials live, how grain is deployed, and what grain's own CI and merge gate read.
Package trustboundary classifies a change by the paths it touches, against a fixed list of the files that make up grain's own trust boundary: who may call what, what a sandbox may run, where credentials live, how grain is deployed, and what grain's own CI and merge gate read.
tunnel/hostport
Package hostport binds ports on the grain host and forwards every connection made to one through a dial function -- how a persistent sandbox's host_port reaches the port its service listens on inside the sandbox (orchestrator.PersistentSandboxSupervisor).
Package hostport binds ports on the grain host and forwards every connection made to one through a dial function -- how a persistent sandbox's host_port reaches the port its service listens on inside the sandbox (orchestrator.PersistentSandboxSupervisor).
tunnel/mux
Package mux implements a lightweight full-duplex stream multiplexer over a single connection.
Package mux implements a lightweight full-duplex stream multiplexer over a single connection.
tunnel/wsupgrade
Package wsupgrade dresses grain's own HTTP upgrades (the daemon's relay tunnel, an executor's stream) as WebSocket handshakes.
Package wsupgrade dresses grain's own HTTP upgrades (the daemon's relay tunnel, an executor's stream) as WebSocket handshakes.
ui
Package ui provides the HTTP interface, API handlers, and static asset serving for Grain.
Package ui provides the HTTP interface, API handlers, and static asset serving for Grain.
upgrade
Package upgrade drives an in-place upgrade of a running grain deployment: given a branch name, it fetches and checks out that branch in a git checkout already on disk, rebuilds bin/grain (Makefile's containerised `make container-build`, so nothing about the Go/Node toolchain the build needs has to be installed on the host beyond docker), installs the result, and -- if the deployment configured one -- runs a restart command to bring the new binary up.
Package upgrade drives an in-place upgrade of a running grain deployment: given a branch name, it fetches and checks out that branch in a git checkout already on disk, rebuilds bin/grain (Makefile's containerised `make container-build`, so nothing about the Go/Node toolchain the build needs has to be installed on the host beyond docker), installs the result, and -- if the deployment configured one -- runs a restart command to bring the new binary up.
usage
Package usage turns recorded token usage (model.RunUsage), the operator's budgets, learned capacities and the usage-limit pauses in force into a budget report per connection and model, and from it the concurrency the remaining budget can sustain until the next reset (grain/task-3267).
Package usage turns recorded token usage (model.RunUsage), the operator's budgets, learned capacities and the usage-limit pauses in force into a budget report per connection and model, and from it the concurrency the remaining budget can sustain until the next reset (grain/task-3267).
version
Package version answers "which build of grain is this?" out of the binary itself: the release version, the commit `go build` stamped into it, when that commit was made, and whether the tree it was built from was dirty.
Package version answers "which build of grain is this?" out of the binary itself: the release version, the commit `go build` stamped into it, when that commit was made, and whether the tree it was built from was dirty.
webauth
Package webauth provides shared browser and proxy authentication primitives used by both the grain daemon (pkg/ui) and grain-registry: Google Cloud IAP and grain-registry signed-header JWT verification, group-membership checking with pluggable directory checkers, and Fetch-Metadata / Origin CSRF checks.
Package webauth provides shared browser and proxy authentication primitives used by both the grain daemon (pkg/ui) and grain-registry: Google Cloud IAP and grain-registry signed-header JWT verification, group-membership checking with pluggable directory checkers, and Fetch-Metadata / Origin CSRF checks.
whererun
Package whererun answers one question for the rest of grain: does this daemon run on the bare machine, or inside a container?
Package whererun answers one question for the rest of grain: does this daemon run on the bare machine, or inside a container?
tests
bench/tunnelbench command
Command tunnelbench measures the carriers a sandbox's control-plane traffic can take to the controller: the direct bridge route, and byte-stream tunnels (docker exec -i, kubectl exec -i, kubectl port-forward) carrying pkg/tunnel/mux.
Command tunnelbench measures the carriers a sandbox's control-plane traffic can take to the controller: the direct bridge route, and byte-stream tunnels (docker exec -i, kubectl exec -i, kubectl port-forward) carrying pkg/tunnel/mux.
e2e/hostsrig
Package hostsrig exercises multi-host git lifecycle scenarios -- repository registration and settings, cross-host task filing, dispatch, clone and push through the git proxy, proxy-side credential isolation, state-repository export/import, lapsed host logins, and mid-task connection removal -- against either gitproxytest's in-process command-backed forge fake or a caller-supplied command-backed ambient source and scratch repository.
Package hostsrig exercises multi-host git lifecycle scenarios -- repository registration and settings, cross-host task filing, dispatch, clone and push through the git proxy, proxy-side credential isolation, state-repository export/import, lapsed host logins, and mid-task connection removal -- against either gitproxytest's in-process command-backed forge fake or a caller-supplied command-backed ambient source and scratch repository.
installer/fakeagy command
Command fakeagy stands in for the Antigravity CLI (agy) on a fake Google-track host, for tests/installer's hostd test.
Command fakeagy stands in for the Antigravity CLI (agy) on a fake Google-track host, for tests/installer's hostd test.
installer/hostscriptprobe command
Command hostscriptprobe drives an installed grain hostd's host-script entry for tests/installer's hostd test, run as the installing user, who alone may open hostd's socket.
Command hostscriptprobe drives an installed grain hostd's host-script entry for tests/installer's hostd test, run as the installing user, who alone may open hostd's socket.
installer/testagent command
Command testagent is the deterministic agent of tests/installer's container lifecycle test.
Command testagent is the deterministic agent of tests/installer's container lifecycle test.
security
Package security is grain's security regression suite: one place that states, as tests, the trust boundaries the rest of the tree is meant to keep, so that a change which quietly moves one fails here by name rather than surfacing in the next audit.
Package security is grain's security regression suite: one place that states, as tests, the trust boundaries the rest of the tree is meant to keep, so that a change which quietly moves one fails here by name rather than surfacing in the next audit.
ui
e2e/consolerestserver command
Command consolerestserver is a real, disposable Grain deployment for the console resting-note walkthrough (docs/test-plans/2026-10-11.md §9).
Command consolerestserver is a real, disposable Grain deployment for the console resting-note walkthrough (docs/test-plans/2026-10-11.md §9).
e2e/defaultsserver command
Command defaultsserver is a small browser-test deployment with a persistent store.
Command defaultsserver is a small browser-test deployment with a persistent store.
e2e/directorserver command
Command directorserver is a real, disposable Grain deployment for the Director browser journey.
Command directorserver is a real, disposable Grain deployment for the Director browser journey.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL