> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cogniagent.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Context and inheritance

> How shared knowledge moves between actors so users never repeat themselves and you never duplicate prompts.

Most conversational AI systems force you to either repeat the same context block on every agent ("you work for Acme Inc., we sell …") or pass state around manually. Conversation Flows handles this with **layered context inheritance** — write once, inherit where it matters.

## The three layers

Every actor's system prompt is built from three layers, in order:

```mermaid theme={null}
flowchart TB
    Global[Global context<br/>flow-level]
    Parent[Parent actor's context<br/>optional]
    Own[The actor's own context + instructions]

    Global --> Parent
    Parent --> Own
    Own --> Prompt[Final system prompt]
```

1. **Global context** — Set on the flow itself. Inherited by any actor that opts in.
2. **Parent actor context** — If actor B inherits from actor A, B sees A's context too. Inheritance is explicit, not automatic up the chain.
3. **The actor's own context + instructions** — Always included.

This means you can write your company introduction **once** at the flow level and have every actor inherit it, while still letting each actor have its own specialised knowledge.

## Context vs Instructions

A subtle but important distinction:

<CardGroup cols={2}>
  <Card title="Context (inheritable)" icon="share-from-square">
    Background knowledge. *What's true about the world this actor lives in.*

    Example: "Acme sells two products: Pro at \$49/seat/month and Enterprise on annual contract."

    Child actors can inherit it.
  </Card>

  <Card title="Instructions (private)" icon="lock">
    Behaviour rules. *What this specific actor should do, this turn.*

    Example: "Greet the user and figure out whether they want product or pricing help. Hand off as soon as you know."

    Never inherited.
  </Card>
</CardGroup>

Why the split? Behaviour is actor-specific by design — if a child inherited a parent's instructions, both would try to do the same job. Context is universally useful, so it's the part that travels.

## Setting global context

Open **Flow settings → General** and fill in **Global Context**:

<Frame>
  <img src="https://mintcdn.com/glorium/eqWkhSfBUec9afZU/images/conversation-flows/settings-panel.png?fit=max&auto=format&n=eqWkhSfBUec9afZU&q=85&s=5b316fb721eed928668c78893706b8a5" alt="Flow settings with global context filled in" width="1471" height="1225" data-path="images/conversation-flows/settings-panel.png" />
</Frame>

This text gets injected into every actor whose **Inherit Context → Global flow context** checkbox is checked (the default for new actors).

## Inheriting from a parent actor

When you create an actor that's a child of another (drawn by dragging a routing edge from parent to child), the child gets an **Inherit Context** list:

<Frame caption="An actor's Inherit Context list shows the global context and any ancestors it can opt into.">
  <img src="https://mintcdn.com/glorium/eqWkhSfBUec9afZU/images/conversation-flows/actor-config-triage.png?fit=max&auto=format&n=eqWkhSfBUec9afZU&q=85&s=c9262441e1c250cc82c7cdc054edeb3c" alt="Triage actor config showing inherit context checkboxes" width="1471" height="1225" data-path="images/conversation-flows/actor-config-triage.png" />
</Frame>

Each checkbox controls one source:

* **Global flow context** — opt in to the flow's global context.
* **\<Parent actor name>** — opt in to a specific ancestor's context.
* **Collected information so far** — automatic slot summary (the values collected by `ask-question` steps, see [Step builder](/conversation-flows/build/step-builder)).

Inheritance is **not automatic up the chain**. If actor A inherits from B, and B inherits from C, then A doesn't get C unless you also check C on A. This sounds annoying at first but it's the right default — it forces you to think about what each agent actually needs.

## A worked example

The Sales Triage flow has three actors. Their context wiring:

```mermaid theme={null}
flowchart TB
    G[Global context:<br/>Acme Inc., products, tone]
    T[Triage Agent<br/>inherits: global]
    Pr[Product Specialist<br/>inherits: global<br/>own context: detailed product knowledge]
    Pc[Pricing Specialist<br/>inherits: global<br/>own context: pricing tiers, Enterprise model]

    G -.inherits.-> T
    G -.inherits.-> Pr
    G -.inherits.-> Pc
```

* Triage has **only** the global context. It's a router — doesn't need product-specific knowledge.
* Product Specialist has the global context **plus** its own detailed knowledge of features and integrations.
* Pricing Specialist has the global context **plus** its own knowledge of pricing tiers and the Enterprise commercial model.

When a user asks "how much does Pro cost?", Pricing Specialist's compiled prompt looks like:

```text theme={null}
You work for Acme Inc., a SaaS platform that sells two products:
- Acme Pro — a self-serve workflow builder, $49/seat/month, 14-day free trial.
- Acme Enterprise — adds SSO, SLAs, a dedicated success manager, ...
Always be friendly, concise, and professional.

You handle pricing questions for Acme Inc. You know the seat-based Pro pricing,
the volume discount tiers, the Enterprise commercial model (annual contract,
custom quote), and the free-trial mechanics.

[Pricing Specialist's instructions go here...]
```

If you edit the global context, every actor that inherits picks up the change on its **next turn** — no redeploy needed.

## Slots — automatic memory

There's a fourth layer that works differently: **slots**.

Slots are pieces of information collected during a conversation — typically by `ask-question` steps. They include things like the user's name, their email, the order number they're asking about, etc.

By default, every actor sees a **"Collected information so far"** block summarising the slots. This means:

* Triage asks: "What's your name?" → user says "Sarah" → slot `user_name = "Sarah"`
* The conversation hands off to Pricing Specialist
* Pricing Specialist's prompt automatically includes: *Collected information so far: user\_name = Sarah*

Sarah doesn't have to repeat her name. The slot survives every handoff for the lifetime of the conversation.

You can turn this off per actor (uncheck **Collected information so far**) for privacy-sensitive branches.

## Anti-patterns to avoid

<Warning>
  **Don't copy-paste context across siblings.** If three actors all need "you work for Acme Inc.", that goes in **global context** — not on each actor. Future edits become one-line changes instead of three.
</Warning>

<Warning>
  **Don't put behaviour rules in Context.** "Always reply in three sentences" belongs in Instructions. If you put it in Context, child actors will inherit it and behave identically to the parent — that's almost never what you want.
</Warning>

<Warning>
  **Don't forget to opt in to ancestors.** If A inherits from B but you don't also check Global, A won't see global context. The platform doesn't auto-walk the chain.
</Warning>

## Next

<CardGroup cols={2}>
  <Card title="Focus modes" icon="crosshairs" href="/conversation-flows/concepts/focus-modes">
    How strictly each actor sticks to its job mid-conversation.
  </Card>

  <Card title="Configure an actor" icon="user-gear" href="/conversation-flows/build/configure-actor">
    The full field-by-field guide.
  </Card>
</CardGroup>
