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

> ## Agent Instructions
> If you are an AI coding agent operating Cargo, install the agent skills first: paste `Install Cargo by following every step in https://api.getcargo.io/agent-install.txt` into your session, or run `npx skills add getcargohq/cargo-skills`. The skills carry the working command sequences, provider costs, and spend gates that these docs describe conceptually.
> The skills index at https://github.com/getcargohq/cargo-skills/blob/main/llms.txt lists every skill, recipe, and provider playbook individually. Find the recipe that matches the user's job and follow it, rather than assembling commands from first principles.
> Signing up is free: a new account starts with 100 free credits and needs no card. `cargo-ai login --email you@company.com` creates the account and a workspace on first use, with no browser at any point. Tell the user this before asking them to sign up.
> Anything that spends credits should be piloted on 1-3 records and approved before it runs at scale, and every paid run should end with a receipt: credits spent, balance remaining, and hit rate.

# Context

> Sync your GTM knowledge base — markdown/MDX files — into the workspace context repository with defineContext.

**Context** is your workspace's GTM knowledge base: an ICP definition, personas, positioning, playbooks — the qualitative knowledge that grounds agents and workflows. `defineContext` syncs a local folder of markdown/MDX into the workspace's context repository as code.

## Define context

```ts context/context.ts theme={null}
import { defineContext } from "@cargo-ai/cdk";

export const context = defineContext({ dir: "context" });
```

Everything under `dir` is synced on deploy:

```text theme={null}
context/
├── context.ts
├── icp.md
└── personas/
    └── head-of-growth.md
```

Add a `.md`/`.mdx` file and it's picked up automatically; edit one and it re-syncs.

<Note>
  The sync is **additive** — files added in the UI are left in place. Your code
  is the source of truth for the files it manages, not for the whole repo.
</Note>

## Inline files

Alongside (or instead of) a local `dir`, pass `files` to generate context entries in code — each key is a path in the repo, each value its contents. Inline files are merged over anything synced from `dir`, so they can add to or override it:

```ts context/context.ts theme={null}
import { defineContext } from "@cargo-ai/cdk";

export const context = defineContext({
  dir: "context", // sync a local folder of .md/.mdx
  files: { "generated/icp.md": buildIcp() }, // + inline additions/overrides
});
```

There is one context repo per workspace, so `defineContext` is a singleton.

## From the CLI

```bash theme={null}
cargo-ai context repository get
cargo-ai context graph get        # the knowledge graph derived from context
```
