Files
photoreport/AGENTS.md
T
spark 91bc9aefc7
ci / rust (pull_request) Successful in 7m2s
ci / typescript (pull_request) Failing after 10m13s
Keep a straightened crop on the photograph's aspect and send Lightroom's changes back.
Lightroom turns the stored corners around the crop centre, so writing the levelled rectangle made the crop Custom. The file now stores those corners, the original is found by its own hash, and edits already queued go out while the socket stays up.
2026-11-23 17:47:47 +00:00

4.3 KiB

Rules for agents (Paperclip, Claude Code, Cursor)

Read docs/ARCHITECTURE.md before any task. One task id per branch/PR (task/BIT-<id>-short-slug).

Non-negotiables

  1. LightCraft is consumed, never forked. Only engine/core imports lightcraft-* crates. Pin by rev in the root Cargo.toml. A bump is its own PR and must pass the reference-image tests. Missing engine features go upstream as PRs to storytold/lightcraft.
  2. Edits are commands, not pixels. Every edit is an EditCommand (packages/contracts, mirrored in engine/core). The server assigns a per-photo seq; clients replay from a seq.
  3. Files and edits travel separately. Uploads go through the queue (tus / SFTPGo); edits through Socket.io.
  4. Organizations from day one. Every row that belongs to someone carries organization_id. Agency mode and independent-photographer mode are an organization setting, not separate code paths.
  5. No Adobe assets or names in the UI. Same workflow as Lightroom, original icons, labels and presets.
  6. Biometrics are opt-in per organization and the legal basis is stored with the setting.
  7. No third-party AI by default. Faces and OCR run locally; external fallbacks are opt-in per organization.
  8. Language: code, comments, identifiers and commit messages in English. User-facing copy via i18n (pt-PT first).
  9. Never commit secrets, .env, generated status/summary markdown files, or build output. Deploys never overwrite a server .env (norm BIT-25005, docs/DEPLOY.md).
  10. Tests touch real infrastructure safely: API tests run against PostgreSQL and only on a database whose name ends in _test. Never run prisma migrate reset or other destructive commands against shared databases.
  11. Green CI before merge: pnpm -r build && pnpm -r typecheck && pnpm -r test and cargo fmt --check, cargo clippy -D warnings, cargo test.
  12. Local-first; web is sync glue. Every photographer-facing feature must work on the desktop without the network (library, cull, develop, autopilot picks, export of what is already on disk, local FTP/USB), except genuinely heavy shared jobs called out as such (e.g. org-wide face clustering across the federation). The web app is how several people work from anywhere and how the desktop syncs when it has a link — it must not be the only place a feature exists. Offline work is done locally and synced later; never force uploading every frame just so the server can decide. Autopilot culls and edits on the desktop (apps/app/src/offline/autopilot.ts) with the same rules as the worker.
  13. Prefer Rust for local heavy work. Detection, measure, level, develop and anything CPU-bound on the desktop should live in engine/ (native / WASM), not in ad-hoc TypeScript, when practical. TypeScript orchestrates; Rust does the pixels and the scores. Safer, faster, one implementation with the workers.
  14. Start from the latest origin/main. Paperclip, Claude Code and Cursor fetch and fast-forward this checkout before editing. Do not leave the work only on an old branch or another folder. A pinned engine revision is the LightCraft rev in the root Cargo.toml, not a stale checkout of this repo.
  15. The photograph's aspect is not a dial. The autopilot and every automatic file write keep the original aspect (docs/photo-editing-rules.md). A straightened crop is written as the corners Lightroom turns back around the crop centre (apps/app/src/desktop/lightroomCrop.ts). Writing the levelled rectangle plus the angle makes Lightroom show Custom. Do not invent another ratio to satisfy a framing rule.
  16. Lightroom round-trip is the file, not the catalog. While the desktop app is open it reads crop, pick, stars and colour back from the work-folder original and sends them to the server. Exposure and the other develop sliders are written out and are not read back. A change that Lightroom has not written into the file is invisible. Newsroom fields (caption, title, keywords, creator) go on the first rdf:Description.

Porting from the old projects

Port logic and tests, not UI. Sources: BitReport.pt/app.photoreport.pt, BitReport.pt/events.photoreport.pt, BitReport.pt/PhotoReport_Studio. Keep behaviour identical unless the task says otherwise, and note the original file in the PR description.