# Contexts and Scopes

Contexts are the mechanism that connects your data sources to your agents during live meetings. A context is a named collection of files with a configurable _scope_ — a rule that determines which agents and meetings that content is active for.

## Why contexts exist

Without contexts, all your files would be available to all agents in all meetings, all the time. That would produce noisy, unfocused retrieval — a compliance agent accidentally pulling from a product roadmap, or a customer support agent surfacing HR documentation.

Contexts let you be precise: "this content is only active for this specific agent" or "this content should be available in every meeting, regardless of agent."

## Creating a context

1. Go to **Data Sources** and click the **Contexts** tab  
2. Click **New Context**  
3. Give it a name (e.g. "Sales Playbook", "Objection Library", "Product Docs")  
4. Choose a colour for visual identification  
5. Add one or more files to the context  
6. Set the context scope  
7. Save

## Adding files to a context

The context file picker shows all your available data sources in collapsible sections. Files from all sources are retrieved together as a single pool — you can mix them freely within the same context.

### Uploaded files  
Files from **File Uploads** cannot be added if they are in _Failed_ status; files still _Processing_ can be added.

### GitHub  
If you've connected a GitHub account, a collapsible GitHub section will appear. Select a repository, navigate the folder tree, and check the files you want. Selected files are downloaded and indexed when you save the context.

### Google Drive  
If you've connected a Google Drive account, a collapsible Drive section will appear. Navigate your Drive folder structure and check the files you want. Selected files are downloaded and indexed when you save.

### Notion  
If you've connected a Notion workspace, a collapsible Notion section will appear. Browse and check the pages and databases you want to include. Content is synced when you save the context and re-synced automatically when pages change.

## Scope types

The scope determines when a context's content is retrieved. There are four scope types:

| Scope                  | When active                                                 |
|------------------------|-------------------------------------------------------------|
| **Account-wide**       | Every meeting for your account, regardless of agent       |
| **Agent**              | All meetings where a specific agent is participating        |
| **Meeting**            | All agents in one specific upcoming meeting                 |
| **Agent + Meeting**    | Only a specific agent in a specific upcoming meeting        |

Multiple contexts with different scopes stack additively — if an agent-scoped context and an account-wide context both match, content from both is available.

## Scope examples

**Account-wide context:** "General product documentation"  
- Scope: Account-wide  
- Effect: All agents in all meetings can reference your product docs. Good for baseline product knowledge every agent should have.

**Agent-scoped context:** "Sales objection playbook"  
- Scope: Agent → "Sales Assist"  
- Effect: Only the Sales Assist agent gets this content, across all its meetings.

**Meeting-scoped context:** "Acme Corp deal brief"  
- Scope: Meeting → "Acme Corp QBR"  
- Effect: All agents in the Acme QBR meeting get this content. Perfect for one-off meeting prep.

**Agent + Meeting context:** "Technical deep-dive notes"  
- Scope: Agent + Meeting → "Solutions Agent" + "TechCorp Demo"  
- Effect: Only the Solutions Agent gets this content, and only in that specific meeting.

## Context retrieval during meetings

When a trigger fires during a meeting, CoAgentor:

1. Resolves all active contexts for the current agent and meeting (based on scope matching)
2. Embeds the most recent portion of the transcript as a search query
3. Runs a semantic search across all chunks from the active contexts
4. Returns the most relevant chunks (up to the plan's per-query limit)
5. Injects the retrieved text into the agent's evaluation context

Retrieval is **per-evaluation, not just once** — as the conversation evolves, different chunks surface. The retrieval query adapts to the current topic.

## The meeting-scope prerequisite

Meeting-scoped and Agent+Meeting-scoped contexts require the meeting to have a row in CoAgentor's meetings table. This only exists once an agent has been assigned to a calendar event.  
**In practice:** if you want to create a meeting-scoped context for an upcoming call, first assign an agent to that calendar event in the Upcoming Meetings view. The meeting will then appear as an option in the scope picker.

## Editing and deleting contexts

- **Edit a context** — add or remove files, change the scope, rename it. Changes take effect for future meetings.
- **Delete a context** — the context and its scope rules are removed. The underlying files are not deleted from your data sources.

## Tips

✅ Start with an account-wide context for general product knowledge — it's your baseline  
✅ Create agent-scoped contexts for specialist content each agent needs  
✅ Create meeting-scoped contexts the day before important calls with custom prep material  
✅ Use Google Drive for content that changes frequently — edits sync automatically  
✅ Use GitHub for technical documentation that lives in your codebase  
✅ Keep contexts focused — 5–10 well-chosen files retrieve better than 50 loosely related ones  
❌ Don't add the same file to multiple contexts that will both be active for the same meeting — it will be retrieved twice and consume chunk quota.
