bex / lego
AGENTS.md576 starsChanged 15 days agoApache-2.0View on GitHub
All Go lives here (Latin legō, "I assemble" — bex assembles bought bricks; the modules are the bricks), self-contained: one image with multiple entrypoints from a Go workspace (go.work) of four modules — types/ (the App/Database CRD contract; leaf, imports nothing), operator/ (the mechanism-only, DB-free manager), backend/ (bex-api + the isolated SSH gateway), and cli/ (the bex CLI launcher). Dependency arrows point one way: operator → types ← backend; the operator never imports the backend, and cli/ imports none of…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dashboard/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- mobile/AGENTS.mdAGENTS.md
- .pm/AGENTS.mdAGENTS.md
- deploy-app-from-localSkill
- deploy-appSkill
- loopxSkill
- mermaidSkill
- mock-clusterSkill
- pm-brainstormSkill
- pmSkill
- qa-find-bugs-cliSkill
- qa-find-bugsSkill
- releaseSkill
- rt-fix-logic-bugsSkill
- rt-fix-prod-crashesSkill
- rt-flatten-abstractionsSkill
- rt-normalize-abstractionsSkill
- rt-prune-useless-testsSkill
- rt-remove-dead-codeSkill
- rt-simplify-logicSkill
- rt-unify-duplicatesSkill
- security-auditSkill
- shipSkill
- simplifySkill
- stripe-best-practicesSkill
- stripe-directorySkill
- stripe-docsSkill
- stripe-projectsSkill
- unblockSkill
- upgrade-stripeSkill
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
All three test suites (make test, go test ./..., yarn test) must pass before deploy.yml builds or pushes any image: deploy.yml's build job …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
lego/AGENTS.md
All Go lives here (Latin legō, "I assemble" — bex assembles bought bricks; the modules are the bricks), self-contained: one image with multiple entrypoints from a Go workspace (go.work) of four modules — types/ (the App/Database CRD contract; leaf, imports nothing), operator/ (the mechanism-only, DB-free manager), backend/ (bex-api + the isolated SSH gateway), and cli/ (the bex CLI launcher). Dependency arrows point one way: operator → types ← backend; the operator never imports the backend, and cli/ imports none of the three. Overview: README.md.
Commands (run from operator/)
All Go is a workspace under lego/ (lego/go.work over types/ operator/ backend/ cli/). The three platform modules — types/operator/backend — are on the go 1.26 line, and the shipped image compiles them per-module with golang:1.26 (the Docker build has no workspace file). cli is on go 1.27 because the pinned upstream render-oss/cli moved to Go 1.27 at v2.26.0 (w8/m33) requires Go 1.27.2 at v2.29.0 (w8/m67) and Go 1.27.3 at v2.35.0 (w2/m256); to keep it in the workspace, lego/go.work also declares go 1.27.3 (a workspace directive ≥ every member's directive — the 1.26 platform modules build unchanged under it). The image is unaffected (no workspace file); cli ships on its own bex-cli/v* train, not the platform image. CI stays consistent: the jobs that build the workspace (cli-test, cli-release, go-lint) take their Go version from lego/cli/go.mod (1.27), while the platform suites run GOWORK=off on their own 1.26 go.mod. The platform moved off 1.25 with the golang.org/x/crypto v0.56.0 bump (v0.56.0 requires Go 1.26; it fixes the reachable ssh-gateway DoS the govulncheck gate flagged). The make targets live in lego/operator/ (codegen, manager build, image build with context lego/, deploy). Build/test bex-api from lego/backend/ (cd lego/backend && go build ./... && go test ./...); the CRD types are in lego/types/. Run make below from lego/operator/:
make test— unit + envtest; auto-runs manifests/generate/fmt/vet first. First run downloads envtest binaries tobin/. (codegen reads CRD/deepcopy markers from../types, RBAC from./....) CI-enforced on every push/PR touchinglego/operator/**orlego/types/**(.github/workflows/operator-test.yml).cd lego/backend && go test ./...— backend unit + integration tests. Integration tests gated onBEX_TEST_DB_URI/BEX_TEST_OPENFGA_URL/BEX_TEST_OPENBAO_KV_*(and promtool) skip locally but fail in CI:.github/workflows/backend-test.ymlprovides real ephemeral Postgres + OpenFGA + OpenBao and setsBEX_TEST_REQUIRE_DEPS=1, sotestenv.Skipturns a missing dependency into a failure there (w5/m112). Run them locally against the same pinned containers withbash scripts/backend-test-deps.sh up && eval "$(bash scripts/backend-test-deps.sh env)", thenGOWORK=off go test -p 1 ./...; repeat both before each suite run (everyupstarts empty containers on new ports — the suite assumes a fresh database), anddownremoves them./shipruns exactly that for any push touchinglego/backend/**orlego/types/**(scripts/ship-gates.sh). CI-enforced on every push/PR touchinglego/backend/**orlego/types/**.make lint— golangci-lint over all four modules (operator + backend + types + cli), then pinned whole-program dead-code analysis across their executable, test, and e2e-tagged roots.make lint-fixfixes the golangci findings;make lint-backendruns backend golangci-lint alone (its.golangci.ymldepguard-enforces the id convention, docs/ADR020-identifiers.md). CI-enforced on every push/PR touching anylego/module (.github/workflows/go-lint.yml, which runsmake lint).cd lego/cli && go test ./...— CLI launcher tests; CI-enforced on pushes/PRs touchinglego/cli/**(.github/workflows/cli-test.yml). Releases ride thebex-cli/v*tag train (cli-release.yml, docs/bex-cli.md, ADR058) — never the platform image.make build— build the manager binary.- Dev inner loop against a cluster:
make install && BEX_RUNTIME=kubernetes make run(runs the operator from the host). make docker-build IMG=…/make deploy IMG=…— image build / kustomize deploy to the current kubeconfig.- ⚠️
make test-e2ecreates and deletes a kind cluster (control-plane-test-e2e) — slow, CI territory; don't run casually. - All three test suites (
make test,go test ./...,yarn test) must pass beforedeploy.ymlbuilds or pushes any image: deploy.yml'sbuildjobneeds:all three test jobs.
Rules
- New Go files carry the Apache-2.0 header from
lego/operator/hack/boilerplate.go.txt. - Mint every resource id through
lego/backend/internal/id(id.New(kind)), never by hand. Ids are typed opaque<prefix>-<xid>strings with a hyphen separator (never an underscore — they must stay valid DNS/k8s names); a new id-bearing resource adds itsid.Kindto that package's registry (which the guard test then enforces). Rationale + known deviations: docs/ADR020-identifiers.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

