AGENTS.md

Operating rules for AI coding agents working in this repository (the Directory, which replaces the LDAP tools of Whimsy). Claude Code loads this file and AGENTS.shared.md via CLAUDE.md; other agents read them directly.

Read AGENTS.shared.md first. It holds the rules that every Tooling repository shares - the container wrappers, worktrees, the quality ratchet, what the app answers, the pull request and review rules - and it comes from apache/tooling-devkit. This file adds the project shape and the rules that are only this repository‘s, and cannot make a shared rule weaker. An issue or pull request number cited in the shared file is the kit’s or tooling-agenda‘s, not this repository’s.

For full environment setup see CONTRIBUTING.md, and for the end-to-end harness see e2e/README.md. When something behaves strangely - a pull request with no checks, a suite that fails a different spec each run - look in docs/troubleshooting.md before investigating it fresh. If any instruction here conflicts with an explicit request from the user, ask before overriding it.

What the directory owns, the events it sends and receives, and the order of the work are in apache/tooling-migration (target-architecture.md and plan.md). Change what the directory does by changing that plan, never as a side effect of a feature.

Non-negotiables of this repository

  • The directory holds personal data, and nothing here may leak it. It holds the names, uids and addresses of real people, and this repository is public. Logs, telemetry, error messages and test output never contain a person‘s name or address. Fixtures are synthetic - never a real person, not even redacted - so a dev instance and the test suites never need production data. The behaviour record is made from the fixtures, and its difference is a CI artifact and a step summary that anybody can read, so it publishes whatever the fixtures hold. Every route that reads the directory is role-gated, not only the ones that change it. The directory will hold the only LDAP write bind and an audit log of LDAP changes, and that log will name people. The rules for the bind’s credentials and for what the log may record are written with the first code that reads or writes LDAP; nothing here does yet, and until then the rule above has no exception.
  • Before any interface change, read the design book and load the frontend-design skill. Both, together, every time. docs/design-book.html is the design system this tool shares with BAT — the chip vocabulary, the colour and type tokens, the component set, the keyboard model — and the skill is how to make well the choices the book leaves open. Neither is enough alone: the book by itself yields a change that is consistent and characterless, the skill by itself yields a good idea phrased in the wrong vocabulary. Read the chapter that covers what you are touching before you touch it, and follow CONTRIBUTING.md for which changes may just be built, which need a line in the PR description, and which need an issue and a change to the book. The copy here is BAT‘s; BAT’s is the source, so a change to the book is made there first and copied here.

The shared non-negotiables are in AGENTS.shared.md. Where it names a make target this repository does not have yet (make container-test-fast: the fast stage of scripts/ci/fast_stage.py is in the kit, and nothing here runs it), use make container-pytest for the question you have.

Project shape

LayerTechnologyLocation
BackendPython 3.14+ / Quart (async) via asfquartapp/
FrontendSvelte 5 runes / TypeScript / Vite, islands in Jinja pagesassets/src/, app/client/templates/
DatabaseSQLite / SQLModel / Alembicapp/db/
  • Pages: routes in app/client/routes.py, templates in app/client/templates/, each Svelte island an entry in assets/src/js/pages/ (and in the input list of assets/vite.config.js).
  • API routes: add a module under app/api/routes/ and import it in app/api/routes/__init__.py, or its routes do not exist.
  • Roles: app/models/role.py, worked out per request in app/access.py. Every mutating route carries require_role(..., to="..."), and so does every route that reads the directory.
  • Database: add models in app/db/models.py plus a sequential Alembic migration (0001, 0002, ...) in app/db/migrations/versions/; migrations auto-apply on startup, and startup refuses to serve when the models and the migrated schema disagree.
  • Admin pages: app/admin/, for the Admin role alone.
  • Frontend: components in assets/src/js/components/, pure logic in assets/src/js/libs/. Use Svelte 5 runes ($state, $derived, $props).

Rules that live where the code does

Two things are true only once you are in a particular directory, and each is written down there rather than here. Claude Code loads one when it touches that directory; anything else should read the file named below before changing what is in it.

WhereWhat it holds
assets/AGENTS.mdwhere components go, the Documentation page, both test layers, and the traps BAT already hit
e2e/README.mdthe end-to-end harness: the test login, the one shared server, and what is absent outside a secure context

This file is the contract; those are the detail. A rule that applies everywhere belongs here, and one that applies to a directory belongs in it — where it is read by whoever is about to break it, and not by everybody else.

Changing the UI requires tests

Both layers: vitest unit tests alongside the code in assets/src/, and Playwright end-to-end tests in e2e/tests/ for the user-facing flow. CI runs them as the frontend and e2e jobs, and a UI change without matching test updates is incomplete. assets/AGENTS.md has the rest.

Adding tables to the DB

Personal data is the Secretary's alone. Admin - the Tooling PMC and infra root - keeps the tool running and is never sent a personal field: not shown, and not selected or serialised either, so it does not travel over the wire to them.

The admin data browser (/admin/data, app/admin/routes.py) shows a table only where BROWSABLE lists it, and only the columns listed there: an admin does not read the directory, and a browser read from the metadata would show a person's name and address the moment its model existed. Each new table goes into BROWSABLE, with no column holding personal fields, or into NOT_BROWSABLE, in the pull request that adds it - tests/test_admin_data.py fails until it does.