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

# Context Awareness

> Pastures AI adapts its suggested questions based on which Rancher page you're viewing.

Pastures AI is context-aware — when you open the AI drawer, it reads the current route and surfaces relevant suggested questions for the page you're on.

## How it works

When the drawer opens, Pastures captures the current Rancher URL pathname and resolves it to a route name. A mapping in `aiContext.ts` associates each route with a set of suggested questions tailored to that page's domain.

The suggested questions appear as clickable pills in the empty state of the drawer. Clicking one immediately sends it as a query.

```typescript theme={null}
export interface AIContext {
  pageName: string;
  suggestedQuestions: string[];
}
```

## Page-specific suggestions

Each Pastures page maps to a unique set of questions:

<AccordionGroup>
  <Accordion title="Operations">
    * "Is my cluster ready to upgrade to the latest K3s?"
    * "What failed in the last CIS benchmark scan?"
  </Accordion>

  <Accordion title="Infrastructure">
    * "Which GPU nodes are over 80% utilization?"
    * "How do I fix Longhorn replica degradation?"
  </Accordion>

  <Accordion title="Advisories">
    * "What are the critical advisories for this cluster?"
    * "How do I fix the etcd single-member warning?"
  </Accordion>

  <Accordion title="Overview (Cluster Intelligence)">
    * "What is the health score of this cluster?"
    * "Are there any open issues across my fleet?"
  </Accordion>

  <Accordion title="Harvester">
    * "Why is my VM stuck in Starting state?"
    * "How do I restore a VM from snapshot?"
  </Accordion>

  <Accordion title="Workloads">
    * "Why is my pod in CrashLoopBackOff?"
    * "How do I debug OOMKilled containers?"
  </Accordion>

  <Accordion title="AI Agents">
    * "How do I configure a NemoClaw gateway?"
    * "What sandbox policies are available?"
  </Accordion>

  <Accordion title="Projects & Quotas">
    * "How do I set GPU quotas for a project?"
    * "What are recommended resource limits for staging?"
  </Accordion>

  <Accordion title="Access Control">
    * "Who has cluster-admin access?"
    * "How do I create a read-only role for auditors?"
  </Accordion>
</AccordionGroup>

## Route resolution

The route name is derived from the Rancher URL pathname. Pastures uses the Vue Router route name (e.g., `c-cluster-pastures-operations`) as the key into the context map.

```typescript theme={null}
export function getAIContext(routeName: string): AIContext | null {
  return CONTEXT_MAP[routeName] ?? null;
}
```

If the current route doesn't match any entry in the context map, the drawer falls back to a generic empty state with no suggested questions.

<Info>
  Context awareness works in all modes — Oracle, BYO model, and demo. The suggested questions are determined by the page, not the AI backend.
</Info>
