agentleFS
OWASPOWASP/OpenCRE/AGENTS.md

OpenCRE

AGENTS.md199 starsChanged 5 months agoCC0-1.0View on GitHub

Cursor agents working in this repo must follow the rules in .cursor/rules/. Prefer existing Makefile targets and scripts/ helpers over ad-hoc Docker, GA, import, or prod-DB setup. Read script headers or --help for env vars and flags; do not reimplement their logic. Use Makefile targets — do not hand-roll docker run: Reset volumes: make docker-neo4j-rm / make docker-redis-rm / make docker-postgres-rm. Local Postgres is pgvector/pgvector:pg16 by default (POSTGRESIMAGE override). Plain postgres images are not supported for app DB use —…

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

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

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

    Prefer existing Makefile targets and scripts/ helpers over ad-hoc Docker, GA, import, or prod-DB setup.

    line 19
  2. Very specific:

    Use Makefile targets — do not hand-roll docker run:

    line 23
  3. Very specific:

    Use scripts/db/* — never raw destructive psql against prod without these wrappers.

    line 69
  4. Very specific:

    After prod GA cache changes, verify with make verify-ga-complete-prod / make monitor-ga-health-prod.

    line 80
  5. Distinctive:

    Create via Cursor → Automations → New (Agents Window).

    line 105
  6. Very specific:

    Before deploy or flask db upgrade: make alembic-guardrail (or python scripts/check_alembic_revision_guardrail.py).

    line 113

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

OpenCRE Agent Instructions

Cursor agents working in this repo must follow the rules in .cursor/rules/.

Quick start

  1. Requirements gate — If goal, success criteria, @ file refs, or constraints are missing, stop and ask (requirements-gate.mdc).
  2. Plan first — Non-trivial or multi-file work requires a plan and user approval before coding (plan-first-workflow.mdc, multi-agent-workflow.mdc).
  3. Verify — After code changes, run checks and iterate until green (verifiable-goals.mdc):
    • make lint
    • make mypy
    • make test
    • make frontend (if frontend touched)
  4. Review — Substantive work needs independent judge/subagent review (multi-agent-workflow.mdc).
  5. Production gap analysis — On Heroku/opencreorg, gap analysis is cache-only: serve precomputed rows from Postgres; do not compute GA on production (cache miss → 404).

Operational scripts

Prefer existing Makefile targets and scripts/ helpers over ad-hoc Docker, GA, import, or prod-DB setup. Read script headers or --help for env vars and flags; do not reimplement their logic.

Local Docker services

Use Makefile targets — do not hand-roll docker run:

make docker-neo4j      # Neo4j (7474/7687)
make docker-redis      # Redis Stack (6379/8001)
make docker-postgres   # local Postgres+pgvector (5432, cre/password)
make start-containers  # neo4j + redis only
make migrate-upgrade   # after postgres is up

Reset volumes: make docker-neo4j-rm / make docker-redis-rm / make docker-postgres-rm. Local Postgres is pgvector/pgvector:pg16 by default (POSTGRES_IMAGE override). Plain postgres images are not supported for app DB use — embedding_vec / chat / Librarian need the vector extension.

Imports and Neo4j populate

make import-all        # full standards import via scripts/import-all.sh
make import-projects   # skip core CRE import (CRE_SKIP_IMPORT_CORE=1)
make import-neo4j      # populate Neo4j from cache

scripts/import-all.sh handles parallel importers, SQLite export, and verification. For embeddings-only SQLite → Postgres push, use scripts/sync_embeddings_table.py (see its docstring).

Gap analysis (local compute, prod verify)

Local backfill (starts containers, workers, migrations — see scripts/backfill_gap_analysis.sh):

make backfill-gap-analysis              # parallel workers + --ga_backfill_missing
make backfill-gap-analysis-sync         # Neo4j populate + backfill without queue
make sync-gap-analysis-table-local      # upsert material rows sqlite → local Postgres

Prod / staging checks (HTTP only — never compute GA on opencreorg):

make verify-ga-complete-prod    # scripts/verify_ga_completeness.py
make monitor-ga-health-prod     # scripts/monitor_ga_health.py (503 / empty result alerts)
make monitor-chatbot-health-prod # scripts/monitor_chatbot_health.py (SPA + /completion 401)
make verify-ga-parity-local     # scripts/verify_ga_postgres_neo_parity.py

Table sync between databases: scripts/sync_gap_analysis_table.py, scripts/sync_embeddings_table.py.

Production DB (Heroku opencreorg)

Use scripts/db/* — never raw destructive psql against prod without these wrappers. All flows capture and wait for a fresh Heroku backup first (scripts/db/common.sh).

scripts/db/backup-opencreorg.sh                                    # backup only
scripts/db/surgery-opencreorg.sh --sql-file path/to/change.sql     # targeted SQL
scripts/db/surgery-opencreorg.sh --sql-file … --destructive        # DELETE/DROP/TRUNCATE
scripts/db/sync-local-to-opencreorg.sh [--table node]…             # local → prod sync

Destructive surgery requires CONFIRM_DESTRUCTIVE=I_UNDERSTAND_OPENCREORG_PROD_DB_DESTRUCTIVE_ACTION (exact phrase). Override app: APP_NAME=opencreorg. See production-db-ops-safety.mdc.

After prod GA cache changes, verify with make verify-ga-complete-prod / make monitor-ga-health-prod.

Weekly prod GA & data completeness (Cursor Automation)

Schedule a Cursor Automation (not GitHub Actions) to run weekly — prod is cache-only; checks are HTTP + repo scripts only.

SettingValue
TriggerCron: 0 9 * * 1 (Mondays 09:00)
RepoOWASP/OpenCRE, branch main
ToolsNone required (cloud agent uses repo checkout)

Agent prompt (paste into Automations editor):

Weekly OpenCRE prod GA, chatbot, and data completeness for opencreorg.

1. python3 scripts/monitor_ga_health.py --base-url https://opencre.org --output-json tmp/prod-ga-health.json
2. python3 scripts/verify_ga_completeness.py --base-url https://opencre.org --output-json tmp/prod-ga-completeness.json
3. python3 scripts/monitor_chatbot_health.py --base-url https://opencre.org --output-json tmp/prod-chatbot-health.json
4. Confirm /rest/v1/standards and /rest/v1/ga_standards return non-empty lists.
5. If incomplete_pairs > 0, chatbot checks fail, or non-zero exit: list failing pairs/buckets/checks; recommend AGENTS.md Operational scripts (local backfill + scripts/sync_gap_analysis_table.py). Do not compute GA on Heroku, do not send authenticated chatbot prompts, and do not run destructive prod DB ops without explicit approval.
6. If all pass: report complete/total pairs, standards counts, and chatbot check results.

Create via Cursor → Automations → New (Agents Window). Do not hand-roll docker/GA setup in the automation prompt.

Staging bootstrap

scripts/setup-heroku-staging.sh — provisions staging from prod + local SQLite; supports --embeddings, --gap_analysis, or full sync. Requires PROD_APP, STAGING_APP, LOCAL_SQLITE_DB.

Deploy / migrations

Before deploy or flask db upgrade: make alembic-guardrail (or python scripts/check_alembic_revision_guardrail.py).

Rule index

RulePurpose
requirements-gate.mdcClarifying questions + requirements template
complete-ticket.mdcTicket gate for .md/.txt files; uses requirements-gate template + coding standards
plan-first-workflow.mdcPlan Mode before non-trivial edits
multi-agent-workflow.mdcBig changes, approval gates, builder ≠ judge
verifiable-goals.mdcLint, mypy, test, CI — show evidence
never-assume.mdcNo guessing; complete code; minimal scope
tdd-workflow.mdcTest-first for new behavior and importers
autonomous-workflow.mdcExecute after approval; no unsolicited commits
context-management.mdc/clear, @ refs, stale context recovery
production-db-ops-safety.mdcDestructive prod DB confirmation
alembic-deploy-guardrail.mdcPre-deploy migration guardrail

OpenCRE commands

make lint              # black + frontend prettier
make mypy              # Python typecheck
make test              # Python unittest suite
make frontend          # yarn build (when TS/TSX changed)
make alembic-guardrail # before deploy/migration ops
make install-python    # includes `playwright install` for Python embeddings (prompt_client) — not frontend e2e; do not remove when adding Cypress
make e2e-db            # seed ./standards_cache.sqlite for e2e (create_all from models + fixture seed)
make e2e               # frontend Cypress e2e (build, serve Flask on 127.0.0.1:5000, cypress run)

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.