agentleFS
Arvo-AIArvo-AI/aurora/AGENTS.md

aurora

AGENTS.md432 starsChanged 5 months agoApache-2.0View on GitHub

RCA (Root Cause Analysis) investigations are explicitly read-only per AGENTS.md guidelines. The agent can execute diagnostic queries in Ask mode during RCA without requiring Agent mode. is_read_only_command() classifies the command's operation (its positional arguments) and ignores option names and option values, matching on the leading word of a verb-looking positional: - describe-health-check → leading wo

  • Pipes a download into a shell
  • Reads credentials
  • Deletes or force-pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

15 rules. About 2 are common, 2 are distinctive, and 11 are very specific to this project.

  • ≈2

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Development: Use make dev-build to build the project, make dev to start containers, and make down to stop them.

    line 14
  2. Very specific:

    Production (prebuilt images): Use make prod-prebuilt to pull from GHCR, retag, and run.

    line 15
  3. Very specific:

    Production (build from source): Use make prod-local or make prod-build for feature branch demos and custom builds.

    line 16
  4. Very specific:

    Important: Always update both docker-compose.yaml and docker-compose.prod-local.yml together to keep environment variables in sync.

    line 17
  5. Very specific:

    A read cannot be used as a payload source: Every segment downstream of the first must be a recognised text filter (grep, jq, sort, head, …

    line 127
  6. Very specific:

    Every new connector (or connector route file) must satisfy all of the following before merge.

    line 210
  7. Very specific:

    Never mutate shared process state (e.g.

    line 250
  8. Common:

    Never log secrets, tokens, credentials, or full OAuth/auth responses at any log level.

    line 252
  9. Very specific:

    All client-to-backend HTTP requests must go through the Next.js API route proxy using forwardRequest from @/lib/backend-proxy.

    line 255
  10. Very specific:

    Never derive, store, or trust user identity (user_id, org_id) on the client side.

    line 256
  11. Common:

    All inter-service calls (frontend server → backend, MCP → backend) must include the internal API secret header.

    line 257
  12. Very specific:

    Never render untrusted HTML without sanitization.

    line 260
  13. Very specific:

    Never mount the Docker socket (/var/run/docker.sock) into application containers.

    line 263
  14. Distinctive:

    Python: Use Flask blueprints in routes/, async with langchain/langgraph, psycopg2 for DB, logging at INFO level

    line 300
  15. Distinctive:

    No tests found: Check with team before adding test infrastructure

    line 304

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Aurora - Agent Guidelines

Commands

  • Start dev: make dev (builds & starts all containers)
  • Stop: make down
  • View logs: make logs (shows last 50 lines, follows)
  • Rebuild API: make rebuild-server (rebuild aurora-server only)
  • Frontend lint: cd client && npm run lint
  • Frontend build: cd client && npm run build
  • Backend logs: docker logs -f aurora-celery_worker-1 (or kubectl logs -f deployment/aurora-celery-worker)
  • Deploy with Docker Compose: make prod (production build)

Docker deployments

  • Development: Use make dev-build to build the project, make dev to start containers, and make down to stop them.
  • Production (prebuilt images): Use make prod-prebuilt to pull from GHCR, retag, and run. Use make prod-local to build from source instead. Use make down to stop.
  • Production (build from source): Use make prod-local or make prod-build for feature branch demos and custom builds.
  • Important: Always update both docker-compose.yaml and docker-compose.prod-local.yml together to keep environment variables in sync.

Architecture

  • Docker Compose stack: aurora-server (Flask API on :5080), celery_worker (background tasks), chatbot (WebSocket on :5006), frontend (Next.js on :3000), postgres (:5432), redis (:6379), vault (secrets :8200), seaweedfs (object storage :8333)
  • Backend (server/): Flask REST API (main_compute.py), WebSocket chatbot (main_chatbot.py), Celery tasks, connectors for GCP/AWS/Azure/Datadog/New Relic/Grafana, LangGraph agent workflow
  • Frontend (client/): Next.js 15, TypeScript, Tailwind CSS, shadcn/ui components, Auth.js authentication, path alias @/* → ./src/*
  • Database: PostgreSQL (aurora_db), Redis for Celery queue
  • Secrets: HashiCorp Vault (KV v2 engine at aurora mount)
  • Object Storage: S3-compatible via SeaweedFS (default), supports AWS S3, Cloudflare R2, MinIO, etc.
  • Config: Environment in ./.env, GCP service account in server/connectors/gcp_connector/*.json

Secrets Management (Vault)

Aurora uses HashiCorp Vault for secrets storage. User credentials (cloud provider tokens, API keys) are stored in Vault rather than directly in the database.

  • Persistent storage: Vault uses file-based storage with data persisted in Docker volumes (vault-data, vault-init).
  • Auto-initialization: The vault-init container automatically initializes and unseals Vault on startup, storing keys in the vault-init volume.
  • Secret references: Stored in DB as vault:kv/data/aurora/users/{secret_name}, resolved at runtime.
  • Configuration: VAULT_ADDR, VAULT_TOKEN, VAULT_KV_MOUNT, VAULT_KV_BASE_PATH env vars.
  • First run: On first startup, check vault-init container logs for the root token. Set VAULT_TOKEN in .env to this value.
  • Test Vault: vault kv put aurora/users/test-secret value='hello' then vault kv get aurora/users/test-secret

Object Storage

Aurora uses S3-compatible object storage via server/utils/storage/storage.py. SeaweedFS is the default backend (Apache 2.0).

  • Storage module: from utils.storage.storage import get_storage_manager
  • Design doc: See docs/oss/PLUGGABLE_STORAGE.md for full details
  • SeaweedFS UI: http://localhost:8888 (file browser), http://localhost:9333 (cluster status)
  • S3 API: http://localhost:8333 (credentials: admin/admin)
  • Supports: AWS S3, Cloudflare R2, Backblaze B2, GCS (via S3 interop), MinIO, any S3-compatible service

RCA Mode & Ask Mode

RCA (Root Cause Analysis) investigations are explicitly read-only per AGENTS.md guidelines. The agent can execute diagnostic queries in Ask mode during RCA without requiring Agent mode.

How It Works

is_read_only_command() classifies the command's operation (its positional arguments) and ignores option names and option values, matching on the leading word of a verb-looking positional:

  • describe-health-check → leading word describe → read-only ✅
  • get-metric-statistics → leading word get → read-only ✅
  • list-nodegroups → leading word list → read-only ✅
  • terminate-instances --query Reservations → leading word terminate → blocked ✅ (the --query option can never supply the verb)

This general approach works for any hyphenated diagnostic verb, not just hardcoded ones.

Read-vs-write is decided by two different scans, because a service or command group can itself be spelled like a read verb:

  • Write check — every positional. aws logs delete-log-group, az search service delete and gcloud config set account x all have a read verb (logs / search / config) as their first verb-looking positional, so stopping there classified three mutations as read-only. Any write verb anywhere in the operation now blocks.
  • Read check — the first verb. kubectl logs update-cache-cronjob-x is a read: kubectl takes its operands as positional resource names, so the tokens after the verb are names, not operations.

kubectl is the only entry in OPERAND_POSITIONAL_CLIS, which is what exempts it from the full scan. Membership only relaxes the scan, so a CLI missing from it over-blocks rather than under-blocks — the safe direction for this gate. The cost is that a non-kubectl read whose positional resource name starts with a write verb is refused (gcloud compute instances describe delete-me-vm); that fails closed, and Agent mode covers it.

The relaxed scan stops at the verb, which was one token too early for kubectl's one subcommand group spelled like a read verb: kubectl config set-context, delete-context, use-context and unset all sat past config and classified as reads. They only rewrite the local kubeconfig, but that repoints the cluster and namespace every later read resolves against, so they are writes. config is in SUBCOMMAND_GROUPS, which carries the scan one positional further — config view / get-contexts / current-context stay read-only.

describe_rejection() returns why a command was refused, and ensure_cloud_command_allowed() puts it in the error the agent sees — naming the offending token is what lets the agent repair a command instead of retrying it:

aws logs delete-log-group    → 'delete-log-group' is a write operation (it leads with 'delete')
aws sts get-session-token    → it returns a credential, key, secret or token
kubectl get pods | bash      → its output is piped into 'bash', which is not a text filter

The credential reason is a fixed string that names no token on purpose: the reason reaches a log line, and interpolating the matched credential word there trips CodeQL's clear-text-logging rule for no gain, since the agent can already see the command it sent.

Six rules keep the gate fail-closed:

  1. Credential/token reads are denied even though they mutate nothing. Rather than an ever-incomplete per-service list, any credential word (key, keys, secret, credential, password, token, sas, …) in the operation path blocks the command — this covers sts get-session-token, eks get-token, ecr get-login-password, secretsmanager get-secret-value, kubectl get secrets, az storage account keys list, az signalr key list, and the long tail of <service> keys list commands alike. Matching peels off kubectl's resource syntax (secret,pods, secret/my-tls, secrets.v1) but not hyphens, so a pod named api-key-service is not mistaken for a key fetch. Options that dump secrets (--with-decryption, --expand-keys) are blocked too. aks get-credentials and container clusters get-credentials are exempt: they only write a local kubeconfig and start every managed-Kubernetes investigation.
  2. Any write verb blocks the command, including hyphenated mutations (modify-*, terminate-*, reboot-*, delete-*) and state toggles that read like reads (tag-*, untag-*, unset, clear, rotate). Scanned across every positional, not just the first verb, so a mutation cannot hide behind a read-verb-named service (aws logs delete-log-group).
  3. Each shell segment is classified separately. A write behind &&, ;, a pipe, a newline, or a $(...)/backtick substitution blocks the whole command, so kubectl get pods && kubectl delete pod x is not read-only.
  4. A read cannot be used as a payload source. Every segment downstream of the first must be a recognised text filter (grep, jq, sort, head, awk, wc, …). That's an allowlist, so an interpreter or exfil tool needs no enumeration — it simply isn't a filter. It blocks kubectl get cm evil -o jsonpath='{.data.sh}' | bash, whose first segment is genuinely read-only but whose ConfigMap supplies the script. Commands that take another command as an argument (sudo, env, xargs, timeout, watch, …) are refused as the leading program, since the operation this function classifies wouldn't be the one that runs. Redirections (>, >>, <) are blocked because they write a file regardless of what produced the bytes. Note this gates on shape, never on a list of CLI names — OVH's RCA skill emits a bare cloud project list, so an allowlist of known CLIs breaks real providers.
  5. Unknown operations default to blocked, and an unparseable command (unbalanced quotes) is blocked rather than guessed at.
  6. Boolean switches don't swallow the verb — kubectl --insecure-skip-tls-verify get pods stays read-only.

Implementation: server/utils/security/read_only_classifier.py. Tests: server/tests/security/test_read_only_classifier.py.

Relationship to the Security settings guardrails

These are different questions and both are needed:

is_read_only_command()Security tab (org_command_policies)
Asks"is this a write?""is this dangerous?"
ScopeAsk mode onlyevery mode
On blockhard fail, "switch to Agent mode"HITL prompt (Yes / No / Yes-Always)
Configurablenoyes, per org, and can be disabled

kubectl delete pod x is a routine operation no guardrail should block, but it must fail in Ask mode. Conversely rm -rf / is caught by the denylist in any mode. Ask mode can't delegate to the guardrails: they're HITL (there's no user to prompt during a background RCA), org-configurable, and switchable off via GUARDRAILS_ENABLED=false — Ask mode still has to hold when they're all off.

So keep this classifier narrow. It answers read-vs-write and defers everything about danger to the shared layers (signature_match.py, _UNIVERSAL_DENY_RULES, the LLM judge) via gate_command(). The one overlap is deliberate: piping a read into an interpreter has to be refused here because the wrapped command's verb is invisible to a read-vs-write check, and the shared denylist only covers the base64|sh / curl|sh / bash -c spellings.

Allowed RCA Diagnostic Commands (Ask Mode)

The following diagnostic queries are always allowed in Ask mode during RCA investigations:

AWS Route 53 Health Checks:

aws route53 describe-health-check --health-check-id <id>
aws route53 get-health-check-status --health-check-id <id>

AWS CloudWatch Metrics:

aws cloudwatch get-metric-statistics --namespace AWS/Route53 --metric-name HealthCheckStatus ...
aws cloudwatch describe-alarms --alarm-names <name>
aws cloudwatch list-metrics --namespace AWS/Route53

AWS EKS Cluster Info:

aws eks describe-cluster --name <cluster-name> --region <region>
aws eks describe-nodegroup --cluster-name <cluster> --nodegroup-name <nodegroup>
aws eks list-nodegroups --cluster-name <cluster>

Kubernetes Diagnostics:

kubectl get statefulsets -n <namespace>
kubectl describe pod <pod-name> -n <namespace>
kubectl logs <pod-name> -n <namespace>
kubectl top nodes

Blocked in Ask mode (use Agent mode): any mutation, and any credential- or token-returning read such as aws sts get-session-token, aws eks get-token, aws ecr get-login-password, or aws ssm get-parameter --with-decryption.

New Connector Checklist

Every new connector (or connector route file) must satisfy all of the following before merge. CI enforces RBAC via server/tests/architectural/test_connector_rbac.py.

RBAC (mandatory — CI-enforced)

  • Every route function decorated with @require_permission("connectors", "read") (GET/status) or @require_permission("connectors", "write") (POST/connect/disconnect)
  • Import from utils.auth.rbac_decorators import require_permission
  • Route function accepts user_id as first positional arg (injected by decorator)
  • No manual get_user_id_from_request() or OPTIONS handling (decorator does both)
  • Webhook/callback routes exempt only if authenticated via HMAC/signing secret or OAuth state param

Skills Integration

  • SKILL.md created at server/chat/backend/agent/skills/integrations/<name>/SKILL.md
  • Skill registered in server/chat/backend/agent/skills/registry.py with check_connection callable
  • rca_priority set appropriately (lower = loaded earlier in RCA prompt)
  • RCA workflow section is read-only — agent searches but never writes during RCA

Agent Tools

  • Tools registered as LangChain StructuredTool in server/chat/backend/agent/tools/cloud_tools.py
  • Tools gated behind is_<name>_connected(user_id) check
  • run_<name>_tool() pattern with _do(client) callback for auth + error handling

Frontend

  • Provider added to ConnectorRegistry.ts with proper stateEvent name
  • Status query uses revalidateOnEvents with the provider's state event
  • Disconnect triggers window.dispatchEvent(new Event('<name>StateChanged'))
  • Event-triggered revalidation uses queryClient.invalidate() (not .fetch())

Token Storage

  • Tokens stored via store_tokens_in_db(user_id, payload, "<name>")
  • Token retrieval via get_token_data(user_id, "<name>")
  • Disconnect deletes via delete_user_secret(user_id, "<name>")

Blueprint Registration

  • Blueprint registered in server/main_compute.py with appropriate url_prefix
  • Connector directory added to CONNECTOR_DIRS in server/tests/architectural/test_connector_rbac.py

Security Invariants

These rules are enforced by automated review (CodeRabbit) and must be followed during development to avoid review churn.

Credential Isolation

  • Never mutate shared process state (e.g. os.environ, on-disk CLI config) with per-user credentials. Credentials must be scoped per-invocation and passed explicitly.
  • Subprocess calls (subprocess.run, Popen, etc.) must receive an explicit env parameter with only the variables they need — never inherit the full server environment.
  • Never log secrets, tokens, credentials, or full OAuth/auth responses at any log level.

Client ↔ Backend Boundary

  • All client-to-backend HTTP requests must go through the Next.js API route proxy using forwardRequest from @/lib/backend-proxy. Never call the Flask backend directly from browser code.
  • Never derive, store, or trust user identity (user_id, org_id) on the client side. Identity resolution is server-side only.
  • All inter-service calls (frontend server → backend, MCP → backend) must include the internal API secret header.

HTML & XSS

  • Never render untrusted HTML without sanitization. Any use of dangerouslySetInnerHTML must sanitize the content first.

Infrastructure

  • Never mount the Docker socket (/var/run/docker.sock) into application containers.
  • CORS handling must go through the centralized utility — never add ad-hoc Access-Control-* headers in route files.
  • Environment variable changes must stay in sync across all Docker Compose files (docker-compose.yaml, docker-compose.prod-local.yml) and .env.example.

Route & Connector Security

  • Routes must use RBAC decorators (@require_permission), never manual auth checks.
  • Token storage must go through centralized helpers (store_tokens_in_db / get_token_data), not ad-hoc DB writes.
  • OAuth callbacks must never log full token responses.

Security Invariants

These rules are enforced by automated review (CodeRabbit) and must be followed during development to avoid review churn.

Credential Isolation

  • Never mutate shared process state (e.g. os.environ, on-disk CLI config) with per-user credentials. Credentials must be scoped per-invocation and passed explicitly.
  • Subprocess calls (subprocess.run, Popen, etc.) must receive an explicit env parameter with only the variables they need — never inherit the full server environment.
  • Never log secrets, tokens, credentials, or full OAuth/auth responses at any log level.

Client ↔ Backend Boundary

  • All client-to-backend HTTP requests must go through the Next.js API route proxy using forwardRequest from @/lib/backend-proxy. Never call the Flask backend directly from browser code.
  • Never derive, store, or trust user identity (user_id, org_id) on the client side. Identity resolution is server-side only.
  • All inter-service calls (frontend server → backend, MCP → backend) must include the internal API secret header.

HTML & XSS

  • Never render untrusted HTML without sanitization. Any use of dangerouslySetInnerHTML must sanitize the content first.

Infrastructure

  • Never mount the Docker socket (/var/run/docker.sock) into application containers.
  • CORS handling must go through the centralized utility — never add ad-hoc Access-Control-* headers in route files.
  • Environment variable changes must stay in sync across all Docker Compose files (docker-compose.yaml, docker-compose.prod-local.yml) and .env.example.

Route & Connector Security

  • Routes must use RBAC decorators (@require_permission), never manual auth checks.
  • Token storage must go through centralized helpers (store_tokens_in_db / get_token_data), not ad-hoc DB writes.
  • OAuth callbacks must never log full token responses.

Code Style

  • Python: Use Flask blueprints in routes/, async with langchain/langgraph, psycopg2 for DB, logging at INFO level
  • TypeScript: Strict mode, ESLint (next/core-web-vitals), no-unused-vars off in src/, use @/ imports, React 18 functional components
  • Naming: Snake_case (Python), camelCase (TS/React), kebab-case (URLs)
  • Errors: Flask error handlers, try/except with logging in Python
  • No tests found: Check with team before adding test infrastructure

Row-Level Security (RLS) — Critical for Celery Tasks

PostgreSQL tables use FORCE ROW LEVEL SECURITY. All queries on RLS-protected tables require myapp.current_org_id set on the connection — without it, queries silently return 0 rows.

  • Flask requests: RLS vars are set automatically by _set_rls_vars() in the connection pool
  • Celery workers / background tasks: There is NO Flask request context, so RLS vars are NEVER set automatically. You MUST call set_rls_context(cursor, conn, user_id) (from utils.auth.stateless_auth) before any query on an RLS-protected table.
  • Helper: from utils.auth.stateless_auth import set_rls_context; org_id = set_rls_context(cursor, conn, user_id, log_prefix="[YourTask]")
  • Cross-org tasks (iterating all users): Query the users table first (NOT RLS-protected), then iterate per-org setting RLS context before querying RLS tables.
  • RLS-protected tables: incidents, chat_sessions, user_tokens, user_connections, postmortems, llm_usage_tracking, incident_alerts, incident_lifecycle_events, connected_repos, execution_steps, and all monitoring event tables (datadog_events, grafana_alerts, etc.)
  • NOT RLS-protected: users, incident_thoughts, incident_suggestions (CASCADE delete from incidents)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.