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.
4.3 KiB
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
- LightCraft is consumed, never forked. Only
engine/coreimportslightcraft-*crates. Pin byrevin the rootCargo.toml. A bump is its own PR and must pass the reference-image tests. Missing engine features go upstream as PRs to storytold/lightcraft. - Edits are commands, not pixels. Every edit is an
EditCommand(packages/contracts, mirrored inengine/core). The server assigns a per-photoseq; clients replay from aseq. - Files and edits travel separately. Uploads go through the queue (tus / SFTPGo); edits through Socket.io.
- 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. - No Adobe assets or names in the UI. Same workflow as Lightroom, original icons, labels and presets.
- Biometrics are opt-in per organization and the legal basis is stored with the setting.
- No third-party AI by default. Faces and OCR run locally; external fallbacks are opt-in per organization.
- Language: code, comments, identifiers and commit messages in English. User-facing copy via i18n (pt-PT first).
- Never commit secrets,
.env, generated status/summary markdown files, or build output. Deploys never overwrite a server.env(norm BIT-25005,docs/DEPLOY.md). - Tests touch real infrastructure safely: API tests run against PostgreSQL and only on a database whose name
ends in
_test. Never runprisma migrate resetor other destructive commands against shared databases. - Green CI before merge:
pnpm -r build && pnpm -r typecheck && pnpm -r testandcargo fmt --check,cargo clippy -D warnings,cargo test. - 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. - 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. - 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 LightCraftrevin the rootCargo.toml, not a stale checkout of this repo. - 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. - 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.