RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Diff/photoprism-photoprism-agents ↔ photoprism-photoprism-github-instructions-backend-instructions

Comparison

A · AGENTS.md · photoprism/photoprismB · Copilot instructions · photoprism/photoprism
What each file covers, counted
DimensionSharedOnly in AOnly in BOverlap
Sections01650%
Commands12963%
Section tags57333%

What each file covers

Sections

0 shared · 16 only in A · 5 only in B
  • − PhotoPrism Repository Guidelines
  • − Purpose
  • − Sources of Truth
  • − Subtree Guides
  • − Local Agent Progress
  • − Style Notes
  • − Commit Messages
  • − GitHub Issues
  • − Specifications & Documentation
  • − Safety & Data
  • − Project Layout & Shared Rules
  • − JS/Go Code Comments
  • − Agent Runtime
  • − Build, Format & Test
  • − Continuous Integration
  • − Container Image Builds
  • + Backend Instructions (Go)
  • + Style
  • + Package Boundaries & Filesystem
  • + Tests
  • + API, Config & Schema

Commands

1 shared · 29 only in A · 6 only in B
  • − make notice
  • − git status
  • − git config
  • − npm exec --yes <agent> -- --help
  • − npx <agent> ...
  • − npm ci
  • − npm install
  • − make
  • − npm rebuild --ignore-scripts=false <pkg>
  • − npm rebuild
  • − make help
  • − make list
  • − make docker-build
  • − docker compose up
  • − docker compose up -d
  • − docker compose logs -f --tail=100 photoprism
  • − docker compose exec photoprism ./photoprism help
  • − docker compose exec -u "$(id -u):$(id -g)" photoprism <command>
  • − make terminal
  • − docker compose --profile=all down --remove-orphans
  • − make down
  • − make dep
  • − make build-js
  • − make build-go
  • − make watch-js
  • − make test
  • − make lint
  • − make check-make-help
  • − go test ./path/to/pkg -run Name -count=1
  • + make lint-go
  • + go test ./internal/<pkg> -run '<TestName>' -count=1
  • + make test-go
  • + make test-short
  • + make reset-testdb
  • + make fmt-go swag-fmt swag
  •   make fmt-go

Section tags

5 shared · 7 only in A · 3 only in B
  • − setup
  • − build
  • − architecture
  • − testing-strategy
  • − git-pr
  • − security
  • − docs
  • + types
  • + database
  • + api
  •   test
  •   lint-format
  •   code-style
  •   do-not
  •   agent-behaviour

Line diff

+23 added−168 removed12 unchanged6.7% identical
photoprism/photoprism · AGENTS.md
@@ −1 @@
1# PhotoPrism Repository Guidelines
 
 
2 
 
 
3**Last Updated:** July 28, 2026
4 
5## Purpose
6 
7Entry point for agents and humans.
8 
9## Sources of Truth
 
 
 
10 
11- Makefile: https://github.com/photoprism/photoprism/blob/develop/Makefile
12- Setup guide: https://docs.photoprism.app/developer-guide/setup/
13- Test guide: https://docs.photoprism.app/developer-guide/tests/
14- Contributing: https://github.com/photoprism/photoprism/blob/develop/CONTRIBUTING.md
15- Security: https://github.com/photoprism/photoprism/blob/develop/SECURITY.md
16- REST API: https://docs.photoprism.dev/ and https://docs.photoprism.app/developer-guide/api/
17- Code maps: [`CODEMAP.md`](CODEMAP.md), [`frontend/CODEMAP.md`](frontend/CODEMAP.md)
18- Package docs: `README.md` files under `internal/`, `pkg/`, `frontend/`, and `frontend/src/`
19- Frontend dependency pins, override layer, and orphan-audit pattern: [`frontend/README.md`](frontend/README.md) (read before bumping any non-caret pin or adding/removing a top-level dep)
20- AI/Vision docs: [`internal/ai/face/README.md`](internal/ai/face/README.md), [`internal/ai/vision/README.md`](internal/ai/vision/README.md), [`internal/ai/vision/openai/README.md`](internal/ai/vision/openai/README.md), [`internal/ai/vision/ollama/README.md`](internal/ai/vision/ollama/README.md)
21- Glossary: [`GLOSSARY.md`](GLOSSARY.md)
22- When dependencies change, regenerate `NOTICE` files with `make notice`; do not edit `NOTICE` or `frontend/NOTICE` manually.
23 
24## Subtree Guides
 
 
25 
26- [`internal/AGENTS.md`](internal/AGENTS.md): internal Go rules.
27- [`internal/api/AGENTS.md`](internal/api/AGENTS.md): API rules.
28- [`internal/config/AGENTS.md`](internal/config/AGENTS.md): config rules.
29- [`internal/commands/AGENTS.md`](internal/commands/AGENTS.md): CLI rules.
30- [`internal/photoprism/AGENTS.md`](internal/photoprism/AGENTS.md): import and index rules.
31- [`internal/service/cluster/AGENTS.md`](internal/service/cluster/AGENTS.md): cluster rules.
32- [`frontend/AGENTS.md`](frontend/AGENTS.md): frontend rules.
33- [`pkg/AGENTS.md`](pkg/AGENTS.md): `pkg/*` security and test rules.
34 
35Optional nested repositories such as `plus/`, `pro/`, `portal/`, and `specs/` may contain their own `AGENTS.md` files. When present, treat those files as additional directory-local guidance.
 
 
36 
37## Local Agent Progress
38 
39- Use `.agents/TODO.md` for actionable tasks and `.agents/DONE.md` for completed work.
40- These files are local workflow aids and may not exist in every workspace.
41 
42## Style Notes
43 
44### Commit Messages
45 
46- Use concise imperative subjects with a one-word prefix, for example `Config: Add tests for "darktable-cli" path detection`.
47- Append issue or PR IDs when relevant.
48- Commit messages must not exceed 80 characters.
49 
50### GitHub Issues
51 
52- Titles MUST be concise, imperative, and start with one capitalized prefix plus `: `, for example `Search: Add filter for RAW image formats`.
53- Descriptions MUST begin with a one-sentence bold user story: `**As a <role>, I want <goal>, so that <outcome>.**`
54- Use level-3 Markdown headings for sections within issue descriptions, for example `### Acceptance Criteria`.
55- Follow with behavior, rationale, technical considerations, and constraints.
56- End with `- [ ]` checklist items for the acceptance criteria, each using `MUST`, `SHOULD`, or `MAY`.
57 - Keep the checklist current: once the work for a criterion is implemented **and verified**, mark it done (`- [x]`).
58 - Leave items that are unverified, not yet implemented, or skipped optional (`MAY`) enhancements unchecked.
59 - An issue is complete only when every `MUST` is checked; never tick a box on the strength of a plan alone or an unrun test.
60 - When referencing an issue from a commit that fulfills some of its criteria, update the matching boxes first.
61- Agents MUST create, edit, close, reopen, relabel, or otherwise modify GitHub issues only when explicitly requested by the user.
62 
63### Specifications & Documentation
64 
65- Markdown headings use a Chicago-style title case, with additional code- and path-aware normalization rules (see *Title Case rules* below). Always spell the product name as `PhotoPrism`.
66- Put option flags before positional arguments unless the command requires another order.
67- Use RFC 3339 UTC timestamps and valid ID, UID, and UUID examples in docs and tests.
68- The nested `specs/` repository may be absent. Do not add main-repo `Makefile` targets that depend on it; when present, you may run its tools manually.
69- Testing guides live at `specs/dev/backend-testing.md` and `specs/dev/frontend-testing.md`.
70- Do not read, analyze, or modify `specs/generated/`; refer humans to `specs/generated/README.md` when regeneration is needed.
71- Refresh `**Last Updated:**` when you change document contents, but leave it unchanged for whitespace-only or formatting-only edits.
72- Nested Git repositories may appear ignored; change into them before staging or committing updates.
73 
74Title Case rules (Chicago-style, with code- and path-aware normalization):
75- Capitalize the first word, the first word after a colon, dash, or end punctuation, and all major words, including the second part of a hyphenated major word.
76- Lowercase only articles, short conjunctions, and short prepositions of three letters or fewer when they are not in one of those positions.
77- Preserve known acronyms (for example, API, CLI, HTTP, JSON) and slash-separated acronym groups (for example, CSV/TSV) as uppercase.
78- Preserve RFC 2119 / RFC 8174 normative keywords (MUST, SHOULD, MAY, SHALL, REQUIRED, RECOMMENDED, OPTIONAL) as uppercase when used in their normative sense.
79- Preserve inline code spans (`` `foo` ``), file paths (e.g. `docs/foo-bar.md`), and slash commands (e.g. `/grill-me`) verbatim; do not recase their contents.
80- Use `&` instead of `And`/`Or` in headings.
81 
82## Safety & Data
83 
84- If `git status` shows unexpected changes, assume a human may be editing; ask before using reset-style commands.
85- Do not run `git config` at either the global or repository level.
86- Do not run destructive commands against production data; prefer ephemeral volumes and test fixtures for acceptance tests.
87- Never commit secrets, local configurations, or cache files; use environment variables or a local `.env`.
88- Ensure `.env`, `.config`, `.local`, `.codex`, and `.gocache` are ignored in `.gitignore` and `.dockerignore`.
89- Prefer existing caches, workers, and batching strategies already referenced by the code and `Makefile`.
90- Consider CPU and memory impact; only suggest profiling or benchmarks when justified.
91- If anything here conflicts with the `Makefile` or the sources of truth, ask for clarification before proceeding.
92 
93## Project Layout & Shared Rules
94 
95- Backend: Go in `internal/`, `pkg/`, and `cmd/`, backed by MariaDB or SQLite.
96- Frontend: Vue 3 plus Vuetify 3 under `frontend/`.
97- Local dev and CI use Docker Compose; Traefik provides local TLS via `*.localssl.dev`.
98- Code in `pkg/*` must not import from `internal/*`. If you need config, entity, or DB access, add code under `internal/`.
99- Shared Go rules:
100 - After Go edits, run `make fmt-go` and keep `gofmt` tab indentation.
101 - Every added/modified Go function, including unexported helpers, must have focused test coverage in the corresponding `*_test.go` files; update existing tests or add new ones as needed.
102 - Every Go package must contain a root `<package>.go` file with the standard license header and a short package description comment.
103 - Use `pkg/fs` permission constants: `fs.ModeDir`, `fs.ModeFile`, `fs.ModeConfigFile`, `fs.ModeSecretFile`, and `fs.ModeBackupFile`.
104 - When importing the stdlib `io/fs`, alias it to avoid collisions, for example `iofs "io/fs"` or `gofs "io/fs"`.
105 - Do not pass stdlib `io/fs` mode flags where permission bits are expected.
106 - Prefer `filepath.Join` for filesystem paths and `path.Join` only for URL paths.
107 - Normalize slash-based logical paths stored in DB, config, or API payloads with `clean.SlashPath(...)`.
108- Shared JS/Vue rules:
109 - Added/modified JavaScript functions, including helpers, should be tested whenever practical; update existing tests or add new ones as needed.
110 - Added/modified Vue components should have component-test coverage, and existing component tests should be updated as needed when behavior changes.
111- When adding a metadata source such as `SrcOllama` or `SrcOpenAI`, update both `internal/entity/src.go` and `frontend/src/common/util.js` so backend and UI stay aligned.
112 
113### JS/Go Code Comments
114 
115A doc comment is **required** for every function (including unexported helpers), as well as for every non-trivial Vue `methods:` / `computed:` / watcher:
116- Keep comments **compact** and default to one line for "what" in the format `// Name does X.`. Skip trivial getters (`isOpen: () => this.open`).
117- Add 1-2 follow-up lines (`// …`) **only** if the "why" is non-obvious: a hidden invariant, a workaround that would otherwise be undone by a future cleanup, a contract a reader can't infer from the code. If readers can infer the "why" from the function body or a nearby line, then omit it.
118- Multi-paragraph explanations belong in `specs/`, package `README.md` files, or GitHub issues — never in the source itself.
119 
120Doc comments for packages and exported identifiers must be complete sentences that begin with the name of the thing being described and end with a period. For short examples in comments, indent code instead of using backticks.
121 
122Use US English spelling in all code comments (`parameterized`, `behavior`, `color`, `serialize`, `normalize`, `optimize`, …) — not the British `-ised`/`-our`/`-re` variants.
123 
124> **Don't include in code comments:** Issue / PR numbers, "previously…" history, alternatives considered, what the function used to do, references to old commits, names of subsequent reviewers, or any narrative that names the change rather than the steady-state behavior. That context belongs in commit messages, specs, or handover notes.
125 
126## Agent Runtime
127 
128- Detect container mode by checking for `/.dockerenv`.
129- If the repo path is `/go/src/github.com/photoprism/photoprism` and `/.dockerenv` is absent, treat the environment as host mode with a bind mount and prefer host-side Docker commands.
130- Bash check: `[ -f "/.dockerenv" ] && echo container || echo host`
131- Node.js check: `require("fs").existsSync("/.dockerenv")`
132- Inside the container, prefer `npm exec --yes <agent> -- --help` or `npx <agent> ...`; if a global npm install is unavoidable, install it only inside the container.
133- The `photoprism/develop` base image and the repo `Makefile` both set `NPM_CONFIG_IGNORE_SCRIPTS=true`, so `npm ci`/`npm install` via `make` targets skip install scripts out of the box. When running npm directly in an environment that does not set or inherit that default, pass `--ignore-scripts` explicitly to mitigate supply-chain attacks. Rebuild native addons with `npm rebuild --ignore-scripts=false <pkg>` — a bare `npm rebuild` is a silent no-op wherever the env default is active.
134- On the host, use the vendor-recommended install method and run from the repository root so agent discovery sees this file.
135 
136## Build, Format & Test
137 
138- Run `make help` for an overview of the most common targets, and `make list` to see all of them.
139- Host mode:
140 - `make docker-build`
141 - `docker compose up` or `docker compose up -d`
142 - `docker compose logs -f --tail=100 photoprism`
143 - `docker compose exec photoprism ./photoprism help`
144 - `docker compose exec -u "$(id -u):$(id -g)" photoprism <command>` to avoid root-owned files
145 - `make terminal`
146 - `docker compose --profile=all down --remove-orphans` or `make down`
147- Container mode:
148 - `make dep`
149 - `make build-js` and `make build-go`
150 - `make watch-js` or `cd frontend && npm run watch`
151 - `./photoprism start`
152 - Local URLs: `http://localhost:2342/` and, with Traefik, `https://app.localssl.dev/`
153 - Local compose defaults to `admin` / `photoprism`; inspect `compose.yaml` if they differ.
154 - Do not use the Docker CLI inside the container; manage Compose from the host instead.
155- The public CLI name is always `photoprism`; development-only side-by-side binaries may use edition-specific names.
156- Our command examples assume a Linux or Unix shell on 64-bit AMD64 or ARM64; see the Developer Guide FAQ for Windows-specific notes.
157 
158Formatting and test entry points:
159- Full suite: `make test`, `make lint`
160- After renaming or removing a Makefile target, run `make check-make-help` (also included in `make lint`) so that no `make help` overview keeps advertising it.
161- Go-specific lint, format, and package-test rules live in [`internal/AGENTS.md`](internal/AGENTS.md).
162- Frontend lint, Vitest, acceptance, and Playwright rules live in [`frontend/AGENTS.md`](frontend/AGENTS.md).
163- Go tests live next to their sources; use PascalCase `t.Run(...)` names for related subtests. Keep consecutive subtests inside the same `Test*` function back-to-back without blank lines so the cases read as a compact table; reserve blank lines for separating distinct setup blocks.
164- Do not run multiple test commands in parallel; suites share fixtures, assets, and database state.
165- Prefer focused test runs such as `go test ./path/to/pkg -run Name -count=1` while iterating.
166- Use `mariadb -D photoprism` inside the dev shell when you need to inspect MariaDB state directly.
167- Run `shellcheck <file>` on edited shell scripts, or use the corresponding `make` target.
168 
169### Continuous Integration
170 
171- **GitHub Actions is not enabled for this repository.** The workflow files under `.github/workflows/` do not execute, so pushes and pull requests produce no check runs. Treat them as dormant configuration: do not diagnose the absence of runs as a broken workflow, do not propose enabling Actions, and do not add workflows or bot configuration that assumes they will run. Ask a maintainer before changing anything under `.github/workflows/`.
172- The `make` targets above are the authoritative build, format, and test gate. Run them locally and report the output rather than relying on a hosted runner.
173 
174### Container Image Builds
175 
176- **Never mix Debian and Ubuntu `apt` repositories in the same image:**
177 - Don't add a Debian source to an Ubuntu base (or vice versa) to install a single missing package — the transitive deps drift, apt's solver pulls newer libraries from the foreign distro, and other build steps in the same `RUN` (e.g. `install-libheif.sh` running `apt-get install libavcodec-dev`) silently link against the wrong soname.
178 - Symptoms surface much later as `dlopen: libfoo.so.N: cannot open shared object file` at image runtime, with the binary referencing a soname that exists only in the foreign distro.
179 - If a package isn't available in the host distro's repos, prefer (a) a same-distro PPA / backports source, (b) a vendor-supplied .deb (e.g. Google Chrome from `dl.google.com`), or (c) a from-source build pinned to a known version.
180 
photoprism/photoprism · .github/instructions/backend.instructions.md
@@ +1 @@
1---
2applyTo: "internal/**,pkg/**,cmd/**"
3---
4 
5# Backend Instructions (Go)
6 
7**Last Updated:** July 28, 2026
8 
9Package-level rules live in the nearest `AGENTS.md`, for example `internal/AGENTS.md`, `internal/api/AGENTS.md`, `internal/config/AGENTS.md`, `internal/commands/AGENTS.md`, and `pkg/AGENTS.md`.
10 
11## Style
12 
13- Keep functions small and focused, wrap errors with context, and keep the exported surface minimal.
14- Doc comments begin with the name of the identifier and stay compact: one line for the "what", plus a line or two only when the "why" cannot be inferred from the code. No issue numbers, no change history.
15- Every package contains a `<package>.go` file with the license header and a short package comment.
16- Run `make fmt-go` (gofmt + goimports) and `make lint-go` after edits; never hand-format indentation.
17 
18## Package Boundaries & Filesystem
 
 
 
 
 
 
 
 
 
 
 
19 
20- `pkg/*` must not import from `internal/*`. Code that needs config, entity, or database access belongs under `internal/`.
21- Use the permission constants from `pkg/fs` (`fs.ModeDir`, `fs.ModeFile`, `fs.ModeConfigFile`, `fs.ModeSecretFile`) instead of literal file modes, and alias the standard library as `iofs "io/fs"` where both are needed.
22- Use `filepath.Join` for filesystem paths and reserve `path.Join` for URL paths.
23 
24## Tests
 
 
 
 
 
 
 
25 
26- Every added function, including unexported helpers and helpers extracted by a refactor, needs a matching `Test<Name>` in a sibling `*_test.go`, with at least a success and a failure case.
27- Group cases with `t.Run(...)` and PascalCase names such as `Success` or `InvalidRequest`.
28- Prefer focused runs — `go test ./internal/<pkg> -run '<TestName>' -count=1` — over `make test-go`, which takes about 20 minutes. `make test-short` is the fast full pass, and `make reset-testdb` resets the test databases.
29 
30## API, Config & Schema
31 
32- Keep handlers thin, register new routes in `internal/server/routes.go`, and regenerate the documentation with `make fmt-go swag-fmt swag`. Never edit `internal/api/swagger.json` by hand.
33- Declare new config options in `internal/config/options.go`, register them in `internal/config/flags.go`, and expose a getter. Confirm names with `photoprism --help`, `photoprism show config-options`, or `photoprism show config-yaml` before suggesting them.
34- Schema changes need a migration in `internal/entity/migrate/`; verify with `photoprism migrations ls` and `photoprism migrations run`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35 
@@ −1 +1 @@
1−# PhotoPrism Repository Guidelines
1+---
2+applyTo: "internal/**,pkg/**,cmd/**"
3+---
24  
5+# Backend Instructions (Go)
6+ 
37 **Last Updated:** July 28, 2026
48  
5−## Purpose
9+Package-level rules live in the nearest `AGENTS.md`, for example `internal/AGENTS.md`, `internal/api/AGENTS.md`, `internal/config/AGENTS.md`, `internal/commands/AGENTS.md`, and `pkg/AGENTS.md`.
610  
7−Entry point for agents and humans.
11+## Style
812  
9−## Sources of Truth
13+- Keep functions small and focused, wrap errors with context, and keep the exported surface minimal.
14+- Doc comments begin with the name of the identifier and stay compact: one line for the "what", plus a line or two only when the "why" cannot be inferred from the code. No issue numbers, no change history.
15+- Every package contains a `<package>.go` file with the license header and a short package comment.
16+- Run `make fmt-go` (gofmt + goimports) and `make lint-go` after edits; never hand-format indentation.
1017  
11−- Makefile: https://github.com/photoprism/photoprism/blob/develop/Makefile
12−- Setup guide: https://docs.photoprism.app/developer-guide/setup/
13−- Test guide: https://docs.photoprism.app/developer-guide/tests/
14−- Contributing: https://github.com/photoprism/photoprism/blob/develop/CONTRIBUTING.md
15−- Security: https://github.com/photoprism/photoprism/blob/develop/SECURITY.md
16−- REST API: https://docs.photoprism.dev/ and https://docs.photoprism.app/developer-guide/api/
17−- Code maps: [`CODEMAP.md`](CODEMAP.md), [`frontend/CODEMAP.md`](frontend/CODEMAP.md)
18−- Package docs: `README.md` files under `internal/`, `pkg/`, `frontend/`, and `frontend/src/`
19−- Frontend dependency pins, override layer, and orphan-audit pattern: [`frontend/README.md`](frontend/README.md) (read before bumping any non-caret pin or adding/removing a top-level dep)
20−- AI/Vision docs: [`internal/ai/face/README.md`](internal/ai/face/README.md), [`internal/ai/vision/README.md`](internal/ai/vision/README.md), [`internal/ai/vision/openai/README.md`](internal/ai/vision/openai/README.md), [`internal/ai/vision/ollama/README.md`](internal/ai/vision/ollama/README.md)
21−- Glossary: [`GLOSSARY.md`](GLOSSARY.md)
22−- When dependencies change, regenerate `NOTICE` files with `make notice`; do not edit `NOTICE` or `frontend/NOTICE` manually.
18+## Package Boundaries & Filesystem
2319  
24−## Subtree Guides
20+- `pkg/*` must not import from `internal/*`. Code that needs config, entity, or database access belongs under `internal/`.
21+- Use the permission constants from `pkg/fs` (`fs.ModeDir`, `fs.ModeFile`, `fs.ModeConfigFile`, `fs.ModeSecretFile`) instead of literal file modes, and alias the standard library as `iofs "io/fs"` where both are needed.
22+- Use `filepath.Join` for filesystem paths and reserve `path.Join` for URL paths.
2523  
26−- [`internal/AGENTS.md`](internal/AGENTS.md): internal Go rules.
27−- [`internal/api/AGENTS.md`](internal/api/AGENTS.md): API rules.
28−- [`internal/config/AGENTS.md`](internal/config/AGENTS.md): config rules.
29−- [`internal/commands/AGENTS.md`](internal/commands/AGENTS.md): CLI rules.
30−- [`internal/photoprism/AGENTS.md`](internal/photoprism/AGENTS.md): import and index rules.
31−- [`internal/service/cluster/AGENTS.md`](internal/service/cluster/AGENTS.md): cluster rules.
32−- [`frontend/AGENTS.md`](frontend/AGENTS.md): frontend rules.
33−- [`pkg/AGENTS.md`](pkg/AGENTS.md): `pkg/*` security and test rules.
24+## Tests
3425  
35−Optional nested repositories such as `plus/`, `pro/`, `portal/`, and `specs/` may contain their own `AGENTS.md` files. When present, treat those files as additional directory-local guidance.
26+- Every added function, including unexported helpers and helpers extracted by a refactor, needs a matching `Test<Name>` in a sibling `*_test.go`, with at least a success and a failure case.
27+- Group cases with `t.Run(...)` and PascalCase names such as `Success` or `InvalidRequest`.
28+- Prefer focused runs — `go test ./internal/<pkg> -run '<TestName>' -count=1` — over `make test-go`, which takes about 20 minutes. `make test-short` is the fast full pass, and `make reset-testdb` resets the test databases.
3629  
37−## Local Agent Progress
30+## API, Config & Schema
3831  
39−- Use `.agents/TODO.md` for actionable tasks and `.agents/DONE.md` for completed work.
40−- These files are local workflow aids and may not exist in every workspace.
41− 
42−## Style Notes
43− 
44−### Commit Messages
45− 
46−- Use concise imperative subjects with a one-word prefix, for example `Config: Add tests for "darktable-cli" path detection`.
47−- Append issue or PR IDs when relevant.
48−- Commit messages must not exceed 80 characters.
49− 
50−### GitHub Issues
51− 
52−- Titles MUST be concise, imperative, and start with one capitalized prefix plus `: `, for example `Search: Add filter for RAW image formats`.
53−- Descriptions MUST begin with a one-sentence bold user story: `**As a <role>, I want <goal>, so that <outcome>.**`
54−- Use level-3 Markdown headings for sections within issue descriptions, for example `### Acceptance Criteria`.
55−- Follow with behavior, rationale, technical considerations, and constraints.
56−- End with `- [ ]` checklist items for the acceptance criteria, each using `MUST`, `SHOULD`, or `MAY`.
57− - Keep the checklist current: once the work for a criterion is implemented **and verified**, mark it done (`- [x]`).
58− - Leave items that are unverified, not yet implemented, or skipped optional (`MAY`) enhancements unchecked.
59− - An issue is complete only when every `MUST` is checked; never tick a box on the strength of a plan alone or an unrun test.
60− - When referencing an issue from a commit that fulfills some of its criteria, update the matching boxes first.
61−- Agents MUST create, edit, close, reopen, relabel, or otherwise modify GitHub issues only when explicitly requested by the user.
62− 
63−### Specifications & Documentation
64− 
65−- Markdown headings use a Chicago-style title case, with additional code- and path-aware normalization rules (see *Title Case rules* below). Always spell the product name as `PhotoPrism`.
66−- Put option flags before positional arguments unless the command requires another order.
67−- Use RFC 3339 UTC timestamps and valid ID, UID, and UUID examples in docs and tests.
68−- The nested `specs/` repository may be absent. Do not add main-repo `Makefile` targets that depend on it; when present, you may run its tools manually.
69−- Testing guides live at `specs/dev/backend-testing.md` and `specs/dev/frontend-testing.md`.
70−- Do not read, analyze, or modify `specs/generated/`; refer humans to `specs/generated/README.md` when regeneration is needed.
71−- Refresh `**Last Updated:**` when you change document contents, but leave it unchanged for whitespace-only or formatting-only edits.
72−- Nested Git repositories may appear ignored; change into them before staging or committing updates.
73− 
74−Title Case rules (Chicago-style, with code- and path-aware normalization):
75−- Capitalize the first word, the first word after a colon, dash, or end punctuation, and all major words, including the second part of a hyphenated major word.
76−- Lowercase only articles, short conjunctions, and short prepositions of three letters or fewer when they are not in one of those positions.
77−- Preserve known acronyms (for example, API, CLI, HTTP, JSON) and slash-separated acronym groups (for example, CSV/TSV) as uppercase.
78−- Preserve RFC 2119 / RFC 8174 normative keywords (MUST, SHOULD, MAY, SHALL, REQUIRED, RECOMMENDED, OPTIONAL) as uppercase when used in their normative sense.
79−- Preserve inline code spans (`` `foo` ``), file paths (e.g. `docs/foo-bar.md`), and slash commands (e.g. `/grill-me`) verbatim; do not recase their contents.
80−- Use `&` instead of `And`/`Or` in headings.
81− 
82−## Safety & Data
83− 
84−- If `git status` shows unexpected changes, assume a human may be editing; ask before using reset-style commands.
85−- Do not run `git config` at either the global or repository level.
86−- Do not run destructive commands against production data; prefer ephemeral volumes and test fixtures for acceptance tests.
87−- Never commit secrets, local configurations, or cache files; use environment variables or a local `.env`.
88−- Ensure `.env`, `.config`, `.local`, `.codex`, and `.gocache` are ignored in `.gitignore` and `.dockerignore`.
89−- Prefer existing caches, workers, and batching strategies already referenced by the code and `Makefile`.
90−- Consider CPU and memory impact; only suggest profiling or benchmarks when justified.
91−- If anything here conflicts with the `Makefile` or the sources of truth, ask for clarification before proceeding.
92− 
93−## Project Layout & Shared Rules
94− 
95−- Backend: Go in `internal/`, `pkg/`, and `cmd/`, backed by MariaDB or SQLite.
96−- Frontend: Vue 3 plus Vuetify 3 under `frontend/`.
97−- Local dev and CI use Docker Compose; Traefik provides local TLS via `*.localssl.dev`.
98−- Code in `pkg/*` must not import from `internal/*`. If you need config, entity, or DB access, add code under `internal/`.
99−- Shared Go rules:
100− - After Go edits, run `make fmt-go` and keep `gofmt` tab indentation.
101− - Every added/modified Go function, including unexported helpers, must have focused test coverage in the corresponding `*_test.go` files; update existing tests or add new ones as needed.
102− - Every Go package must contain a root `<package>.go` file with the standard license header and a short package description comment.
103− - Use `pkg/fs` permission constants: `fs.ModeDir`, `fs.ModeFile`, `fs.ModeConfigFile`, `fs.ModeSecretFile`, and `fs.ModeBackupFile`.
104− - When importing the stdlib `io/fs`, alias it to avoid collisions, for example `iofs "io/fs"` or `gofs "io/fs"`.
105− - Do not pass stdlib `io/fs` mode flags where permission bits are expected.
106− - Prefer `filepath.Join` for filesystem paths and `path.Join` only for URL paths.
107− - Normalize slash-based logical paths stored in DB, config, or API payloads with `clean.SlashPath(...)`.
108−- Shared JS/Vue rules:
109− - Added/modified JavaScript functions, including helpers, should be tested whenever practical; update existing tests or add new ones as needed.
110− - Added/modified Vue components should have component-test coverage, and existing component tests should be updated as needed when behavior changes.
111−- When adding a metadata source such as `SrcOllama` or `SrcOpenAI`, update both `internal/entity/src.go` and `frontend/src/common/util.js` so backend and UI stay aligned.
112− 
113−### JS/Go Code Comments
114− 
115−A doc comment is **required** for every function (including unexported helpers), as well as for every non-trivial Vue `methods:` / `computed:` / watcher:
116−- Keep comments **compact** and default to one line for "what" in the format `// Name does X.`. Skip trivial getters (`isOpen: () => this.open`).
117−- Add 1-2 follow-up lines (`// …`) **only** if the "why" is non-obvious: a hidden invariant, a workaround that would otherwise be undone by a future cleanup, a contract a reader can't infer from the code. If readers can infer the "why" from the function body or a nearby line, then omit it.
118−- Multi-paragraph explanations belong in `specs/`, package `README.md` files, or GitHub issues — never in the source itself.
119− 
120−Doc comments for packages and exported identifiers must be complete sentences that begin with the name of the thing being described and end with a period. For short examples in comments, indent code instead of using backticks.
121− 
122−Use US English spelling in all code comments (`parameterized`, `behavior`, `color`, `serialize`, `normalize`, `optimize`, …) — not the British `-ised`/`-our`/`-re` variants.
123− 
124−> **Don't include in code comments:** Issue / PR numbers, "previously…" history, alternatives considered, what the function used to do, references to old commits, names of subsequent reviewers, or any narrative that names the change rather than the steady-state behavior. That context belongs in commit messages, specs, or handover notes.
125− 
126−## Agent Runtime
127− 
128−- Detect container mode by checking for `/.dockerenv`.
129−- If the repo path is `/go/src/github.com/photoprism/photoprism` and `/.dockerenv` is absent, treat the environment as host mode with a bind mount and prefer host-side Docker commands.
130−- Bash check: `[ -f "/.dockerenv" ] && echo container || echo host`
131−- Node.js check: `require("fs").existsSync("/.dockerenv")`
132−- Inside the container, prefer `npm exec --yes <agent> -- --help` or `npx <agent> ...`; if a global npm install is unavoidable, install it only inside the container.
133−- The `photoprism/develop` base image and the repo `Makefile` both set `NPM_CONFIG_IGNORE_SCRIPTS=true`, so `npm ci`/`npm install` via `make` targets skip install scripts out of the box. When running npm directly in an environment that does not set or inherit that default, pass `--ignore-scripts` explicitly to mitigate supply-chain attacks. Rebuild native addons with `npm rebuild --ignore-scripts=false <pkg>` — a bare `npm rebuild` is a silent no-op wherever the env default is active.
134−- On the host, use the vendor-recommended install method and run from the repository root so agent discovery sees this file.
135− 
136−## Build, Format & Test
137− 
138−- Run `make help` for an overview of the most common targets, and `make list` to see all of them.
139−- Host mode:
140− - `make docker-build`
141− - `docker compose up` or `docker compose up -d`
142− - `docker compose logs -f --tail=100 photoprism`
143− - `docker compose exec photoprism ./photoprism help`
144− - `docker compose exec -u "$(id -u):$(id -g)" photoprism <command>` to avoid root-owned files
145− - `make terminal`
146− - `docker compose --profile=all down --remove-orphans` or `make down`
147−- Container mode:
148− - `make dep`
149− - `make build-js` and `make build-go`
150− - `make watch-js` or `cd frontend && npm run watch`
151− - `./photoprism start`
152− - Local URLs: `http://localhost:2342/` and, with Traefik, `https://app.localssl.dev/`
153− - Local compose defaults to `admin` / `photoprism`; inspect `compose.yaml` if they differ.
154− - Do not use the Docker CLI inside the container; manage Compose from the host instead.
155−- The public CLI name is always `photoprism`; development-only side-by-side binaries may use edition-specific names.
156−- Our command examples assume a Linux or Unix shell on 64-bit AMD64 or ARM64; see the Developer Guide FAQ for Windows-specific notes.
157− 
158−Formatting and test entry points:
159−- Full suite: `make test`, `make lint`
160−- After renaming or removing a Makefile target, run `make check-make-help` (also included in `make lint`) so that no `make help` overview keeps advertising it.
161−- Go-specific lint, format, and package-test rules live in [`internal/AGENTS.md`](internal/AGENTS.md).
162−- Frontend lint, Vitest, acceptance, and Playwright rules live in [`frontend/AGENTS.md`](frontend/AGENTS.md).
163−- Go tests live next to their sources; use PascalCase `t.Run(...)` names for related subtests. Keep consecutive subtests inside the same `Test*` function back-to-back without blank lines so the cases read as a compact table; reserve blank lines for separating distinct setup blocks.
164−- Do not run multiple test commands in parallel; suites share fixtures, assets, and database state.
165−- Prefer focused test runs such as `go test ./path/to/pkg -run Name -count=1` while iterating.
166−- Use `mariadb -D photoprism` inside the dev shell when you need to inspect MariaDB state directly.
167−- Run `shellcheck <file>` on edited shell scripts, or use the corresponding `make` target.
168− 
169−### Continuous Integration
170− 
171−- **GitHub Actions is not enabled for this repository.** The workflow files under `.github/workflows/` do not execute, so pushes and pull requests produce no check runs. Treat them as dormant configuration: do not diagnose the absence of runs as a broken workflow, do not propose enabling Actions, and do not add workflows or bot configuration that assumes they will run. Ask a maintainer before changing anything under `.github/workflows/`.
172−- The `make` targets above are the authoritative build, format, and test gate. Run them locally and report the output rather than relying on a hosted runner.
173− 
174−### Container Image Builds
175− 
176−- **Never mix Debian and Ubuntu `apt` repositories in the same image:**
177− - Don't add a Debian source to an Ubuntu base (or vice versa) to install a single missing package — the transitive deps drift, apt's solver pulls newer libraries from the foreign distro, and other build steps in the same `RUN` (e.g. `install-libheif.sh` running `apt-get install libavcodec-dev`) silently link against the wrong soname.
178− - Symptoms surface much later as `dlopen: libfoo.so.N: cannot open shared object file` at image runtime, with the binary referencing a soname that exists only in the foreign distro.
179− - If a package isn't available in the host distro's repos, prefer (a) a same-distro PPA / backports source, (b) a vendor-supplied .deb (e.g. Google Chrome from `dl.google.com`), or (c) a from-source build pinned to a known version.
32+- Keep handlers thin, register new routes in `internal/server/routes.go`, and regenerate the documentation with `make fmt-go swag-fmt swag`. Never edit `internal/api/swagger.json` by hand.
33+- Declare new config options in `internal/config/options.go`, register them in `internal/config/flags.go`, and expose a getter. Confirm names with `photoprism --help`, `photoprism show config-options`, or `photoprism show config-yaml` before suggesting them.
34+- Schema changes need a migration in `internal/entity/migrate/`; verify with `photoprism migrations ls` and `photoprism migrations run`.
18035  
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack