moodle-on-gcp
AGENTS.md74 starsChanged 9 days agoApache-2.0View on GitHub
This file configures Jules (https://jules.google/docs, @google/jules CLI) and coding agents working on google/moodle-on-gcp. Before making any changes, read both this file and .jules/sentinel.md. google/moodle-on-gcp provisions and deploys a cloud-native, horizontally scalable Moodle LMS (v5.2.4) on Google Kubernetes Engine (GKE) backed by Cloud SQL for MySQL Enterprise (MYSQL_8_4), Memorystore for Redis / Redis Cluster (local_redislock), selectable shared storage (Filestore NFS (RWX) or Regional Replicated Persistent Disk (regional-pd)), and Google Cloud CDN (USE_ORIGIN_HEADERS). Every automated agent (including Jules and Sentinel) MUST enforce…
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,542 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 repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 4
Before making any changes, read both this file and .jules/sentinel.md.
- Very specific: line 27
Every automated agent (including Jules and Sentinel) MUST enforce these 10 rules derived from the 110 inline review comments on PR #38:
- Very specific: line 30
Never replace template placeholders (e.g., "<YOUR-PROJECT-ID>", "<IPV4-FROM-CLOUD-SQL>", "<NAME-OF-YOUR-DOMAIN-LIKE-example.com>", …
- Very specific: line 31
Always keep <YOUR-...> placeholders wrapped in double quotes in 0-infra/envs.sh so source 0-infra/envs.sh never triggers Bash </> …
- Very specific: line 46
Do not revert worker_processes auto.
- Very specific: line 50
Never combine unrelated infrastructure, runtime, and documentation changes into a single monolithic PR.
- Distinctive: line 58
Always run these verification commands locally before committing or submitting a session via Jules:
- Distinctive: line 110
Treat source code and tests as authoritative.
- Distinctive: line 111
Prefer the narrowest quiet validation that proves the changed behavior.
≈ “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
Agent & Jules Configuration Guide (google/moodle-on-gcp)
This file configures Jules (https://jules.google/docs, @google/jules CLI) and coding agents working on google/moodle-on-gcp.
Before making any changes, read both this file and .jules/sentinel.md.
1. Repository Architecture & Current Stack (main)
google/moodle-on-gcp provisions and deploys a cloud-native, horizontally scalable Moodle LMS (v5.2.4) on Google Kubernetes Engine (GKE) backed by Cloud SQL for MySQL Enterprise (MYSQL_8_4), Memorystore for Redis / Redis Cluster (local_redislock), selectable shared storage (Filestore NFS (RWX) or Regional Replicated Persistent Disk (regional-pd)), and Google Cloud CDN (USE_ORIGIN_HEADERS).
| Directory | Purpose | Key Files |
0-infra/ | GCP VPC, NAT, GKE, Cloud SQL (MYSQL_8_4), Filestore, Regional PD, Memorystore (redis & redis-cluster), and Jumpbox provisioning scripts (#!/bin/bash, set -eo pipefail). | 0-infra/envs.sh, 0-infra/infra-creation.sh |
1-networking/ | Reserve global static IP (moodle-ingress-ip) for GKE External Ingress. | 1-networking/reserve-external-ip.md |
2-pvc/ | PersistentVolume and PersistentVolumeClaim templates for Filestore NFS (RWX) and Regional Replicated Persistent Disk (regional-pd, gcePersistentDisk). | 2-pvc/pvc-filestore.yaml, 2-pvc/pvc-regional-pd.yaml |
3-Shortcut/ | Summary guide linking directly to 5a-deployment-no-helm/. (Legacy Bitnami & 7-helm/ were removed in PR #43). | 3-Shortcut/README.md |
4-moodle-image/ | Multi-stage Alpine 3.21 + PHP 8.3.36 + GNU libiconv 1.18 (preloadable_libiconv.so) + Moodle v5.2.4 + Moosh 1.51 + local_redislock image. | 4-moodle-image/Dockerfile, 4-moodle-image/scripts/setup_moodle.sh, 4-moodle-image/config/nginx/moodle.conf, 4-moodle-image/config/nginx/nginx.conf, 4-moodle-image/config/php83/php.ini, 4-moodle-image/config/php83/fpm-pool.conf |
5a-deployment-no-helm/ | Canonical Kubernetes manifests (ConfigMap, Secret, Deployment, Service, BackendConfig, FrontendConfig, ManagedCertificate, Ingress, HorizontalPodAutoscaler, CronJob) and interactive generator script. | 5a-deployment-no-helm/moodle-configmap-nginx.yaml, 5a-deployment-no-helm/moodle-configmap-nginx-sample.yaml, 5a-deployment-no-helm/create-config-files.sh |
6-ssl-Redirect/ | Post-SSL activation manifests (FrontendConfig HTTP->HTTPS 301 redirect and reverseproxy = true in ConfigMap). | 6-ssl-Redirect/enable-ssl-redirect-after-cert-prov.yaml |
.jules/ | Jules / Sentinel persistent security journal and review guardrails. | .jules/sentinel.md |
2. Mandatory Guardrails (Preventing PR #38 Regressions)
Every automated agent (including Jules and Sentinel) MUST enforce these 10 rules derived from the 110 inline review comments on PR #38:
- Preserve
<YOUR-...>and<ANGLE_BRACKETS>Placeholders:- Never replace template placeholders (e.g.,
"<YOUR-PROJECT-ID>","<IPV4-FROM-CLOUD-SQL>","<NAME-OF-YOUR-DOMAIN-LIKE-example.com>",<CERT-LIST>) in0-infra/envs.shor5a-deployment-no-helm/moodle-configmap-nginx*.yamlwith hardcoded or dummy values (moodle-project-12345,10.119.0.3,moodle.example.com). - Always keep
<YOUR-...>placeholders wrapped in double quotes in0-infra/envs.shsosource 0-infra/envs.shnever triggers Bash</>redirection errors.
- Never replace template placeholders (e.g.,
- Keep
REDIS_*Variables Empty in Template YAML Manifests:- In
5a-deployment-no-helm/moodle-configmap-nginx.yamlandmoodle-configmap-nginx-sample.yaml,REDIS_HOST,REDIS_PORT,REDIS_AUTH,REDIS_SSL, andREDIS_CLUSTER_MODEmust remain"".
- In
- Preserve
MOODLE_LANGUAGE: "pt-BR"inmoodle-configmap-nginx-sample.yaml:moodle-configmap-nginx.yamluses"en", whilemoodle-configmap-nginx-sample.yamlintentionally showcases"pt-BR".
- Isolate Upload Pod PVC
subPathMounts:moodle-deploymentmountssubPath: etc/nginxandsubPath: etc/php83.moodle-deployment-uploadsMUST mountsubPath: etc/nginx-uploadsandsubPath: etc/php83-uploadssosetup_moodle.sh'ssed -ioverrides (MOODLE_UPLOAD_MAX_FILESIZE: "2048") do not overwritephp.ini/nginx.conffor the standard web pods on shared storage.
- Keep Dynamic
sed -iOverrides Immediately Afterenvsubstinsetup_moodle.sh:- In
4-moodle-image/scripts/setup_moodle.sh, thesed -ioverrides forMOODLE_MAX_INPUT_VARS,MOODLE_POST_MAX_SIZE,MOODLE_UPLOAD_MAX_FILESIZE, andMOODLE_MEMORY_LIMITmust execute immediately afterenvsubst(around line 83), before NGINX and PHP-FPM start.
- In
- Preserve Moodle 5.1+
/publicWebroot (MDL-83424) and Cloud CDN Headers:- NGINX
rootin4-moodle-image/config/nginx/moodle.confmust remain/var/www/html/moodle/public. - Static asset locations (
/theme/,/lib/javascript.php,/lib/requirejs.php,/lib/font.php,/pix/) must includefastcgi_hide_header Set-Cookie;so Cloud CDN (cacheMode: USE_ORIGIN_HEADERS) caches public static assets without caching session cookies. - Private file locations (
/pluginfile.php,/draftfile.php) must enforceadd_header Cache-Control "private, no-store, no-cache, must-revalidate" always;.
- NGINX
- Preserve NGINX & PHP-FPM Container Tuning:
- Do not revert
worker_processes auto;/worker_connections 2048;in4-moodle-image/config/nginx/nginx.conf,pm = ondemand/pm.max_children = 8in4-moodle-image/config/php83/fpm-pool.conf, or the OPcache / upload limits in4-moodle-image/config/php83/php.ini.
- Do not revert
- Preserve Multi-Stage
gnu-libiconv(preloadable_libiconv.so), Composer, and Moosh1.51:- In
4-moodle-image/Dockerfile, keep theiconv-builderstage (libiconv-1.18),ENV LD_PRELOAD=/usr/lib/preloadable_libiconv.so,composer install --no-dev --classmap-authoritative, andlocal_redislock.
- In
- Keep
PRsAtomic and Linear onmain:- Never combine unrelated infrastructure, runtime, and documentation changes into a single monolithic PR. Target
maindirectly (delete_branch_on_mergeis enabled on this repository).
- Never combine unrelated infrastructure, runtime, and documentation changes into a single monolithic PR. Target
- Never Delete
.jules/sentinel.mdEntries:- Append new security learnings chronologically to
.jules/sentinel.mdwithout deleting prior entries.
- Append new security learnings chronologically to
3. Verification & Test Suite (Run Before Every Commit / PR)
Always run these verification commands locally before committing or submitting a session via Jules:
# 1. Validate Bash syntax on all infrastructure & config generator scripts
bash -n 0-infra/*.sh 5a-deployment-no-helm/create-config-files.sh
# 2. Validate POSIX sh syntax on container entrypoint scripts
sh -n 4-moodle-image/scripts/*.sh
# 3. Validate all Kubernetes YAML manifests (accounting for template placeholders)
python3 -c '
import glob, yaml
for f in sorted(glob.glob("**/*.yaml", recursive=True)):
if f.startswith("openwiki/") or f.startswith("graphify-out/"):
continue
raw = open(f).read().replace("<CERT-LIST>", "[moodle-managed-cert]")
list(yaml.safe_load_all(raw))
print("All YAML manifests valid!")
'
# 4. End-to-end smoke test of 5a-deployment-no-helm/create-config-files.sh4. Using the Jules CLI (@google/jules) with This Repository
The official Jules CLI (@google/jules, https://jules.google/docs/cli/reference) is installed and can be used to dispatch scoped tasks that automatically inherit AGENTS.md and .jules/sentinel.md:
# Verify Jules CLI installation and authentication
jules version
jules login
# List connected repositories and active sessions
jules remote list --repo
jules remote list --session
# Start a scoped, atomic session on google/moodle-on-gcp (always keep tasks small and atomic)
jules remote new --repo google/moodle-on-gcp --session "<concise-atomic-task-description>"
# Pull or apply a completed session patch locally for verification before creating a PR
jules remote pull --session <SESSION_ID>
jules teleport <SESSION_ID><!-- OPENWIKI:START -->OpenWiki
This repository has a generated openwiki/ evidence index. It is optional just-in-time context, not required startup reading.
- Treat source code and tests as authoritative. A brief's unknowns and review items are verification gaps, not automatic requirements.
- Prefer the narrowest quiet validation that proves the changed behavior. Preserve complete failure output.
The scheduled OpenWiki GitHub Actions workflow refreshes the repository wiki. Do not hand-edit generated OpenWiki pages unless explicitly asked; prefer updating source code/docs and letting OpenWiki regenerate.
<!-- OPENWIKI:END -->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.

