diff --git a/.claude/rules/change_guardrails_rules.md b/.claude/rules/change_guardrails_rules.md index 78cdbf4c9..685c65c54 100644 --- a/.claude/rules/change_guardrails_rules.md +++ b/.claude/rules/change_guardrails_rules.md @@ -93,9 +93,6 @@ These rules sit between subsystems. Each canonical doc covers its own surface; o 16. Authority over loopback / proxy / `X-Forwarded-For` trust lives in `src/actions.ts` (`isLocalRequest`, `forwardedForValues`, `isProductionEnvironment`) and the matching helpers in `src/services/root_landing/**`. Any new code that needs to know "is this request local?" MUST consume those exports — not a bare `req.socket.remoteAddress` check, not a `Host` header read, not an inlined fork (`docs/security/threat_model.md`). Treat the v0.11.1 advisory shape as a regression class, not a one-off. 17. Every new Express route MUST land in `scripts/security/protected_routes_manifest.json` (auth-required) or in the runtime allow-list with a stated `reason`. Run `npm run security:manifest:write` in the same change; CI's `security_gates` job runs `--check` and rejects drift. 18. Every release that the diff classifier (`scripts/security/classify_diff.js`) labels `sensitive=true` MUST land with a filled `docs/releases/in_progress//security_review.md` and a supplement `Security hardening` section linking it. `none` provider mode is acceptable, manual fill is mandatory. -19. Every new **destructive or data-mutating operation** (DB migration, encryption migration, repair command, bulk-rewrite over user data) MUST ship with a real round-trip integration test that operates on a real file, not in-memory stubs. The test MUST cover: identity (forward→inverse leaves the data unchanged), dry-run non-mutation, idempotency on re-run, and NULL preservation. See `docs/testing/testing_standard.md` § Destructive operations. -20. Every new **external-file-shape parser** (harness transcripts, SQLite imports, third-party config formats) MUST ship with a test that exercises the actual parsing path against a fixture file in the supported format. Detection-only tests (asserting `detectSource` returns the right tag) are not coverage of parsing. -21. Every new **HTTP server runtime-config knob** (timeouts, connection behavior, header policy) MUST ship with a test that asserts the *runtime* behavior — a response header value, a socket lifetime, an observable connection property — not just the source string. A constant declared in code with no runtime assertion regresses silently. ### MUST NOT @@ -152,11 +149,6 @@ Before opening a PR that touches any surface in the Touchpoint Matrix, confirm: - [ ] `npm run security:classify-diff` recorded; if `sensitive=true`, `npm run security:lint` is clean, `npm run security:manifest:check` passes, `npm run test:security:auth-matrix` passes, and `docs/releases/in_progress//security_review.md` exists with a sign-off verdict. - [ ] New Express routes registered in `protected_routes_manifest.json` (or runtime unauth allow-list with a `reason`); manifest regenerated via `npm run security:manifest:write` when needed. - [ ] No bare `req.socket.remoteAddress`, `X-Forwarded-For`, or `Host` reads outside `src/actions.ts` / `src/services/root_landing/**`; auth-local fallbacks (`!auth && isLocalRequest`) gated through `assertExplicitlyTrusted`. -- [ ] **User-facing-surface coverage**: any new CLI command, new CLI flag, new destructive/data-mutating operation, new external-file-shape parser, or new HTTP runtime-config knob has a test that exercises the **user-observable behavior end-to-end**, not just a helper function. A test file with the right name that only covers an internal helper is not coverage. Required regression tests by surface class: - - Destructive operations (DB migrations, encryption migrations, repair commands): real round-trip test against a real file — encrypt→decrypt identity, dry-run non-mutation, idempotency on re-run, NULL preservation. - - External-file-shape parsers (harness transcripts, SQLite imports, third-party config): at least one fixture per supported format that exercises the actual parser path, not just `detectSource`. - - Discovery / detection / parser pairs: a roundtrip test asserting paths emitted by discovery are parseable by the parser. - - HTTP runtime config (timeouts, headers, keep-alive): a test that asserts the *runtime* behavior (response header, socket lifetime), not just the source string. ## Canonical doc index diff --git a/.claude/rules/gmail_proactive.md b/.claude/rules/gmail_proactive.md new file mode 100644 index 000000000..3f64b0300 --- /dev/null +++ b/.claude/rules/gmail_proactive.md @@ -0,0 +1,37 @@ +--- +description: Agents MUST use the Gmail MCP proactively to check email whenever task context makes it relevant, without waiting to be asked. +globs: +alwaysApply: true +--- + + + + +# Gmail Proactive Check Rule + +## Purpose + +Ensures agents check Gmail proactively when task context implies email may contain relevant information, rather than waiting for an explicit instruction to check. + +## Trigger Patterns + +Agents MUST check Gmail proactively when: + +- Waiting on an external action that sends email confirmation (account signups, invitations, verifications, notifications) +- A workflow step is blocked pending an email (e.g. invitation acceptance, token delivery, approval) +- The user asks about status of something that would be communicated via email +- Setting up third-party integrations that send credentials or confirmation links by email +- Any context where "did the email arrive?" is a natural next question + +## Agent Actions + +1. Use `mcp__aa7dd3ca-ee1b-423d-8787-cf03044822ee__search_threads` with a targeted query (recipient, sender, subject keywords, time window) +2. If relevant emails are found, surface the key details and next action +3. If no relevant emails are found, report that and suggest next steps + +## Constraints + +- MUST check Gmail proactively when task context implies email is a dependency — do not wait for the user to say "check my email" +- MUST use targeted queries (narrow by sender, recipient, subject, or time) rather than fetching all mail +- MUST store any emails retrieved in Neotoma per the external-tool store-first rule +- MUST NOT check Gmail in unrelated contexts where email is not a plausible dependency diff --git a/.claude/rules/inspector_shadcn_rules.md b/.claude/rules/inspector_shadcn_rules.md new file mode 100644 index 000000000..280394961 --- /dev/null +++ b/.claude/rules/inspector_shadcn_rules.md @@ -0,0 +1,81 @@ +--- +description: Enforce shadcn/ui primitives in Inspector UI work; prefer existing inspector components over native HTML controls. +globs: + - inspector/** +alwaysApply: false +--- + + + + +# Inspector shadcn UI Rules + +## Purpose + +Keep the Inspector app visually and behaviorally consistent with the Neotoma design system by using shadcn/ui-style primitives from `inspector/src/components/ui/` instead of ad hoc native HTML controls and one-off Tailwind patterns. + +Inspector is an inspection surface, not a marketing or agentic UI. Prefer consistency, accessibility, and design tokens over decorative variation. + +## Canonical references + +- `docs/ui/shadcn_components.md` — component inventory and Select vs DropdownMenu guidance +- `docs/ui/design_system/implementation_notes.md` — prefer shadcn over native HTML, tokens, dark mode, WCAG AA +- `docs/ui/inspector_shadcn_audit.md` — route-level adoption backlog (if present) + +## Installed primitives (`inspector/src/components/ui/`) + +Prefer these when they fit the interaction. Do not add new primitives in feature work without a short justification. + +**Core (use first):** `Button`, `Input`, `Label`, `Textarea`, `Select`, `Card`, `Badge`, `Separator`, `Dialog`, `Sheet`, `Alert`, `Skeleton`, `Tooltip`, `ScrollArea`, `Tabs`, `Switch`, `DropdownMenu` + +**Composites (preserve mirror contract):** `DataTable`, `Pagination`, `ConfirmDialog` — keep in sync with `frontend/src/components/ui/` when editing; see comments in those files. + +**Available but often unused in pages:** `Checkbox`, `Popover`, `Toggle`, `ToggleGroup` — use them before inventing custom segmented controls or native checkboxes. + +**Not present in Inspector yet (add only with plan):** shadcn `Table` markup inside `DataTable`, `AlertDialog` (prefer `ConfirmDialog` until added), `Command` for search/command palettes. + +## MUST + +### Control selection + +- **MUST** use `Select` from `@/components/ui/select` for single-value dropdowns. **MUST NOT** use native ``. +- **MUST** use `Textarea` for multi-line text entry — not unstyled native `