--- description: The known instance-wide data is announcement dismissals, the announcement publication-ID registry, personal workspace presentation preferences, the per-user sidebar company order, and the instance-admin server metrics snapshot; these grant no authority, and a new exception must be added to this list. globs: "packages/db/src/schema/announcement_dismissals.ts,packages/shared/src/announcements.ts,server/src/routes/announcements.ts,server/src/services/announcements.ts,server/src/services/announcement-feed.ts,packages/db/src/schema/user_workspace_preferences.ts,packages/shared/src/workspace-preferences.ts,server/src/routes/workspace-preferences.ts,server/src/services/workspace-preferences.ts,packages/db/src/schema/user_sidebar_preferences.ts,packages/shared/src/types/sidebar-preferences.ts,server/src/routes/sidebar-preferences.ts,server/src/services/sidebar-preferences.ts,server/src/routes/instance-server-metrics.ts,server/src/services/server-metrics.ts" alwaysApply: false --- # Company-scope exceptions ## Scope and purpose Every domain entity is scoped to a company, and routes and services enforce company boundaries. This rule lists the known data that is instance-wide and the conditions that keep it safe. Its `globs` cover only the files of the listed exceptions. `AGENTS.md` section 5 sends any change that adds data without a company scope here. ## The exceptions - **Announcement dismissals** are instance-wide user preferences, keyed by user and announcement so they persist across companies. Their audit context must still validate company membership. - **The announcement publication-ID registry** is instance-level feed metadata. It contains no company or user data. - **Personal workspace presentation preferences** are instance-wide by user, with validated company membership supplying audit context. They never grant execution authority, change company capabilities or agent configuration, or rewrite canonical work records. Optional conversation guidance must retain the same action permissions. - **The sidebar company order** in `user_sidebar_preferences` is instance-wide by user, because it orders the user's companies. Sidebar preferences inside one company stay company-scoped in `company_user_sidebar_preferences`. - **The server metrics snapshot** (`GET /api/instance/server-metrics`) describes one server process: CPU, event-loop load, statement rate, latency percentiles and missed lease renewals. Company scope does not fit, because the process serves every company and the numbers cannot be split by company. Only an instance admin can read it, it is off unless `PAPERCLIP_SERVER_METRICS` is set, and it returns numbers and a build revision only: no SQL, names, IDs or hostnames. It persists nothing and changes nothing. ## Requirements - Do not add another instance-wide entity unless you add it to this list in the same pull request and state why company scope does not fit. - An instance-wide preference must not change what an actor is allowed to do. ## Review criteria Flag a new table, route, or service that holds domain data without a company scope and is not listed here. Flag an exception that skips company membership validation for its audit context. Flag a preference that grants authority, changes company or agent configuration, or rewrites work records.