# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cogna8-io.gitbook.io/docs/core-concepts/scope-and-isolation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
