> For the complete documentation index, see [llms.txt](https://cogna8-io.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cogna8-io.gitbook.io/docs/core-concepts/scope-and-isolation.md).

# Scope and Isolation

## Why Scope Matters

{% hint style="danger" %}
**Scope bleed is uniquely dangerous because the output looks correct.** The system generates well-reasoned, structurally valid actions - using the wrong client's constraints or the wrong project's deadlines. Everyone trusts the output because it sounds right.
{% endhint %}

***

## Scope Types

{% tabs %}
{% tab title="Thread Scope" %}
**Bound to a single conversation**

State exists only within one interaction thread. Appropriate for isolated workflows and per-session interactions.
{% endtab %}

{% tab title="Entity Scope" %}
**Bound to a specific entity across threads**

State is tied to a customer, project, patient, or account and persists across multiple conversations. **This is where most production integrity operates.**
{% endtab %}

{% tab title="Global Scope" %}
**Applies across the organization**

Organization-wide policies, universal compliance constraints, shared operational defaults.
{% endtab %}
{% endtabs %}

***

## Scope Inheritance

Scopes can be configured with inheritance rules. A **global compliance policy** applies across all entity scopes. **Entity-level constraints** extend or override global defaults. **Thread-level state** operates within its entity context.

***

## Scope in Practice

> A multi-client platform serves different accounts through shared agent infrastructure. Client A has a $50,000 position limit. Client B has a $500,000 limit. Without structural scope isolation, the agent might pull the wrong constraint set. With scope-aware integrity, each client's state exists in an **isolated entity scope**.

{% hint style="info" %}
**The pattern is the same across domains.** Whether it's client accounts in finance, patient records in healthcare, or tenant configurations in SaaS - scope isolation ensures that the right state governs the right context.
{% endhint %}
