Organisations and teams Recommended
Keep the organisation in the address
Put the organisation's ID or slug in every address inside it, such as /acme/invoices/42, and take the organisation for each request from the address.
How to do it
A shared link then opens in the right organisation, and two tabs can show two organisations. Never keep the current organisation only in the session or a cookie. When someone opens an address for an organisation they cannot see, answer 404.
How to check
Open organisation A in one tab and B in another, then create a record in each. Each record lands in the organisation of its own tab.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers accounts playbook: https://agentwranglers.se/playbook/accounts/organisations-and-teams/organisation-in-url.