Summary: Aury is the third-party vendor behind the in-app AI chat companion that users see as “Seven”. There is only one Aury. The backend mints a session URL server to server and the app opens that URL in a webview. Who sees Seven is decided in the app (Braze flag ff_aury plus German app language). The subscription-based access rule was designed and built in the Elixir backend and the app, but the gateway that serves the app today does not implement it. Sources: direct code inspection (lib/external/aury/, lib/backend/practice/ai_companion/, lib/backend/web/public_api/ai_companion/, config/runtime/ in elixir-backend; lib/features/ai_companion/ in 7mind-mobile-apps-monorepo); re-checked on 2026-11-09 against 7mind-mobile-apps-monorepo origin/main at 4.0.9 (ai_companion_repository.dart, ai_companion_access_service.dart, ai_companion_availability.dart, configurations.dart, magic_user_token_interceptor.dart, PR 1533) and function-sevenmind-legacy-gateway origin/HEAD (internal/domain/aicompanion/handler.go, grep for unlockedFeatures and ai_companion_locked) Last updated: 2026-11-09


Update after the 2026-09-14 migration. The session endpoint the app calls (POST /ai_companion/companion_session/start on magic.7mind.*) is now served by function-sevenmind-legacy-gateway (internal/domain/aicompanion/), not by elixir-backend. The gateway assembles the context from Gymondo services (user profile, meditation history from function-statistic, content titles from the catalogue, tier from the subscription service) and calls Aury with the same partner API. References below to Backend.Practice.AiCompanion, Backend.Access and Elixir env vars describe the old implementation. The gateway does not implement the access rule: it starts a session for every signed-in caller (see Open issue). Migration effects: Aury received the old UUID to new id mapping before cutover, because partnerUserId changed from the 7Mind UUID to the numeric Gymondo id (see gymondo-sso-auth); some users lost Seven access after the switch and had to give consent again, because consent is stored on the device per user id. MIND-833 tracks a follow-up about the subscription tier sent to Aury.

Correction to the earlier version of this page

An earlier version of this page claimed there were “two Aurys”, a mobile AI chat companion and a separate B2B2C partner integration in the backend, and marked the relationship between them as TBD. That was wrong, and an agent acting on it would draw the wrong boundary.

There is one Aury. The confusion came from the word “partner” in the backend integration. 7Mind is Aury’s partner, not the other way round: the request body carries partnerId: "7mind" and partnerUserId: <user uuid>, which is how Aury identifies its own customers. This has nothing to do with 7Mind’s B2B2C insurance partners (Barmer, DAK, Charité), which live in the monetization and prevention domains and share no code with it.

Naming

  • Aury is the vendor, and the name used throughout the code: External.Aury, Backend.Practice.AiCompanion, lib/features/ai_companion/, the AURY_* env vars.
  • Seven is the user-facing name in the German app copy and in Linear tickets.

They are the same thing. Expect both spellings in any conversation about this feature.

How a session starts

  1. The app calls POST /ai_companion/companion_session/start on the Public API.
  2. The backend assembles a context for the user: display name, subscription tier, and completed content history from the last 30 days.
  3. The backend calls POST {AURY_BASE_URL}/api/partner/start with an x-api-key header, sending that context as the data field.
  4. Aury returns a URL. The backend passes it back as session_url.
  5. The app opens that URL in a webview.

The chat itself is entirely Aury’s. 7Mind hosts none of it. What 7Mind controls is who gets a session URL, and what context Aury sees.

What the backend tells Aury

The data payload carries:

  • username
  • subscription_status, one of freemium, trial, premium
  • app_usage_history, completed content from the last 30 days with course and category names resolved

The subscription tier is there so Aury can adjust how hard it pushes content at a user who cannot open it. The three values deliberately match the UserType enum the mobile app already uses, so the same three words mean the same three things on both sides of the API.

Access rules

This is the rule as designed and built in the Elixir backend; the gateway does not apply it (see the open issue below). Seven is not meant to be available to everyone who can see it. A user has it when any of these holds:

  • they have an active premium subscription, or
  • they are in an active free trial, or
  • their account is less than 4 days old and has never had a trial or a subscription

That third clause is the grace period that lets a new freemium user try Seven at all. It is anchored on signup date, not on first use and not on consent, because signup is the only anchor the backend has. It excludes accounts that already had and lost paid access, so a trial ending inside the first 4 days does not hand the user the remainder of the window back.

Things to know before changing anything here:

  • This is not a Contentful package feature. Backend.Access derives packages strictly from trials and subscriptions, so a window counted from signup has no representation there. In the Elixir design the rule lives in Backend.Practice.AiCompanion.Access and is merged into the feature lists at the API boundary. Do not try to move it into a package bundle.
  • The lock was meant to be enforced, not merely described. In the Elixir design companion_session/start answers 402 Payment Required with the error code ai_companion_locked. A client-only lock would still let any caller with a valid token mint a session URL, which 7Mind pays Aury for.
  • Never answer 401 or 403 from an endpoint the app calls. The mobile apps run a global Dio interceptor (magic_user_token_interceptor.dart) that treats either as an expired session on an authenticated request: it deletes the stored auth values and signs the user out of the whole app. A per-feature refusal must use some other status, or the request must opt out with AuthRequestExtras.skipSessionExpiryHandling (only the account deletion call does today). 404 was the other candidate here and was rejected because this endpoint already answers 404 for a user that cannot be found.

How the client learns the lock state

Through unlockedFeatures on the account endpoints (/user/me and the signin and signup responses), the sibling of the visibleFeatures list that gates prevention. visibleFeatures answers “show this” and covers locked and unlocked alike; unlockedFeatures answers “the user may actually use this”.

The app side shipped on 2026-08-28 (MIND-796, MIND-797, PR 1533). AiCompanionAccessService (lib/features/ai_companion/services/ai_companion_access_service.dart) reads unlockedFeatures from /user/me once for the whole app: on app resume, when Home mounts, and whenever the user type changes. It fails open: a missing list counts as unlocked, and a failed request keeps the last known value, which starts as unlocked. AiCompanionRepository treats a 403 from companion_session/start with the code ai_companion_locked as the lock and offers the paywall instead of a retry.

ai_companion is reported in unlockedFeatures only, never in visibleFeatures. For a package feature like prevention, presence in the first list but absence from the second is what signals a padlock. The companion does not work that way, because the backend does not decide whether it is shown: pilot membership is a client-side call (see below). Listing it as visible would assert something this side does not know, for every 7Mind user, regardless of the real answer. So for the companion, plain absence from unlockedFeatures is the lock.

Open issue

As of 2026-11-09:

  • The gateway does not implement the access rule. function-sevenmind-legacy-gateway answers companion_session/start with 200 for every signed-in caller (internal/domain/aicompanion/handler.go) and sends no unlockedFeatures and no ai_companion_locked. With the app failing open, every user in the ff_aury audience gets Seven, whatever their subscription, and 7Mind pays Aury for each session.
  • Status mismatch. The Elixir design answers 402; the app expects 403.
  • Logout risk. The session start request does not set skipSessionExpiryHandling. If the gateway ever answers the lock with a 403 as the app expects, MagicUserTokenInterceptor deletes the session and signs the user out before the paywall can show. Agree on the status with the gateway owners and fix the app before the gateway enforces the rule.

Cohort and flags

Who sees Seven is a client-side decision, not a backend one:

  • The Braze feature flag ff_aury (rollout, MIND-880, app 4.0.6). Its audience is the Braze segment that took over the users of the former Amplitude aury-experiment cohorts. Configurations.isAuryEnabled reads it once per app start, so a change applies on the next cold start. Staging builds always have it on.
  • A German app language guard (lib/features/ai_companion/service/ai_companion_availability.dart), so the entry points only appear when the app is in German.

The ConfigCat key isAuryEnabled still exists in feature_flags.dart but nothing reads it. See mobile-analytics-stack. Consent is stored in Flutter local storage rather than on the backend, so the backend has no record of who opted in.

Gotchas

  • The Aury webview emits deep links with the singular spelling /courseDetail. A route alias exists for exactly this reason and must not be refactored away. See mobile-deep-linking.
  • Aury is 7Mind only. 7Sleep never sees the feature, and the backend scopes it by app.
  • Subscription state is per app. A 7Sleep subscription does not unlock Seven.