gofer AGENTS.md #
You work on gofer's code here. README.md says what gofer is and how
to install it, skills/ says how to use it, and plans/00-design.md is
the design.
Plans are in plans/. Read plans/README.md before you add, build, or
close one. Numbered plans build the design one plan at a time, and code
exists only where a plan calls for it. A plan states contracts and
leaves the shape of the code to the person or agent who builds it.
Layout #
The operator is one Go module, tangled.org/guid.foo/gofer, with
packages named by domain. In place of client-go, it uses the
Kubernetes packages of liken:
apiclient, informer, events, conditions, and memo. The
sidecar is the one part in another language, because
Playwright and its MCP server are
TypeScript.
cmd/goferhasmain, which reads the settings, loads the key-encryption key, and starts the parts below. It also has the code that keeps the webhook's CA and decides the CA rollover.api/v1alpha1has theBrowserProfileas Go types. The CRD indeploy/crds/is written by hand. The tests inapi/v1alpha1check that the two match field by field, and run examples through the CRD's schema and CEL rules. Change both in one commit.clusteris every read and write to the API server, andcluster/clustertestis the tests' fake of it.profilekeeps each profile's finalizer and conditions.injectis the mutating webhook: the sidecar it adds and the rules that refuse a pod.stateapiserves each profile's state and secrets to sidecars, andstoreandsealkeep that state on the operator's volume, sealed.servingcertmakes and renews the operator's CA and serving certificate, with no cert-manager.metricsserves the operator's series and/healthz. Each domain declares its own series.sidecar/is the browser sidecar, in Node: the egress proxy, the browser's launch inchromium.mjs, the MCP tools, and the state's save and merge. Its image builds fromsidecar/Dockerfile. The image also containsworkload.mjs, an MCP client that the README's example ande2e/run as the workload.deploy/is the kustomize base, with no setting of any one cluster.deploy/monitoringis a component that adds aPodMonitor.e2e/contains the experiments that test a cluster end to end. Each is a script that runskubectlagainst the context named byCONTEXTand the namespace named byNS, which defaults toerrands. Runsetup.shfirst to prepare the namespace. The experiments need a cluster with gofer installed, so CI does not run them.transect/describes theBrowserProfilekind and gofer's programs for liken'stransect.skills/is the usage documentation, as Agent Skills..claude-plugin/andplugin.jsonmake the repository a plugin marketplace for them.
Where the parts are #
The parts are the ones that plans/00-design.md names.
- The operator:
cmd/gofer,profile,cluster,metrics, andservingcert. - The webhook:
inject. - The sidecar:
sidecar/. - The state API:
stateapi, withstoreandseal.
Commands #
make test # the Go checks, the sidecar's tests, and the kustomize build
make test-go # gofmt, go mod tidy -diff, go vet, staticcheck, go test -race
make test-sidecar # npm ci and node --test in sidecar/
make test-deploy # kustomize build of deploy/
prek run --all-files # goimports, go vet, staticcheck, go test, and file hygiene
claude plugin validate .
go test -race needs cgo and a C compiler. Without a compiler, run
make test RACE=. The tests write coverage.out, which git ignores.
STATICCHECK and KUSTOMIZE name the commands that run those tools.
KUSTOMIZE defaults to kubectl kustomize, and CI sets it to
kustomize build. The sidecar's only check is node --test.
Images and release #
.tangled/workflows/ci.yml runs on a Tangled
spindle with the kubernetes engine. CI runs make test without the
race detector. It builds and smoke-tests the sidecar image with
docker-buildx, on the buildkitd that the workflow pod names in
BUILDX_BUILDER. It builds the operator image with ./ko-build.sh.
On a push to main, in the weekly scheduled run, and in a manual run
on main, CI then pushes both images and the gofer-deploy artifact
under one tag, <UTC yyyymmddHHMMSS>-<short sha>. The images are also
tagged latest. The artifact goes last, so no cluster sees a tag whose
images are missing. A pull request builds both images and pushes
nothing.
The ATCR_DEVICE_SECRET secret is the registry login. It is an
atcr.io device secret, which can push and delete images but cannot
write the account's other records.
ko builds the operator image from .ko.yaml. The
image's entrypoint is the binary at /ko-app/gofer. Nothing sets
command, so a pod runs the entrypoint. The sidecar image builds from
sidecar/Dockerfile, with
Chrome for Testing
at Chrome's current stable version:
make sidecar-image # builds the image and runs its smoke test
./ko-build.sh --push=false # builds the operator image
How work lands #
Work lands as commits on main, with no merge commits. Rebase a change
made on a branch onto main. Each push to main is a release. There
are no version numbers, only the tags CI publishes.
Security is the product #
gofer holds logins and card numbers for workloads that read untrusted
web pages. Every change keeps the principles and the security premise
in plans/00-design.md. A change that weakens one says so in its plan
and its commit.