> For the complete documentation index, see [llms.txt](https://methara.gitbook.io/methara-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://methara.gitbook.io/methara-docs/methara-developer-documentation/intent.md).

# Intent

The Intent module determines what a user wants to do.

It uses a proximity scoring algorithm. After tokenizing the input, it checks whether action words like `"delete"` appear near scope words like `"all"`.

### Intent.analyze(text)

This is the primary routing function. It returns a structured result for agent decision logic.

```ts
const result = Intent.analyze('Delete all my team meetings');
// {
//   type: 'task',
//   action: 'delete',
//   scope: 'all',
//   confidence: 0.9
// }

Intent.analyze('Hey, what\'s up?');
// { type: 'conversation', action: 'chat', scope: 'single', confidence: 1.0 }

Intent.analyze('Remind me to call John tomorrow');
// { type: 'task', action: 'reminder', scope: 'single', confidence: 0.85 }
```

### Intent.score(text)

Returns raw token-level scoring for every action category.

Use it to debug routing decisions or build custom thresholds.

```ts
Intent.score('Remind me to call John tomorrow morning');
// {
//   scores: { creation: 1.5, deletion: 0, viewing: 0, completion: 0, update: 0, reminder: 1 },
//   primaryAction: 'reminder',
//   isAllScope: false,
//   hasTaskObjects: false,
//   allScopeScore: 0,
//   singleScopeScore: 1
// }
```

### Boolean helpers

These helpers return a yes or no answer without running the full scoring pipeline.

| Method                    | Returns true when...                         | Type    |
| ------------------------- | -------------------------------------------- | ------- |
| `Intent.isView(text)`     | User asks to see tasks or schedule           | boolean |
| `Intent.isCreate(text)`   | User wants to create or schedule something   | boolean |
| `Intent.isDelete(text)`   | User wants to delete or remove something     | boolean |
| `Intent.isUpdate(text)`   | User wants to reschedule or modify something | boolean |
| `Intent.isComplete(text)` | User marks a task as done or finished        | boolean |
| `Intent.isReminder(text)` | User wants to set a reminder or alert        | boolean |

```ts
Intent.isDelete('Remove everything from my schedule'); // true
Intent.isView('Show me my tasks for today'); // true
Intent.isUpdate('Reschedule my 3pm meeting'); // true
Intent.isComplete('Mark all tasks as done'); // true
```

### Return types

| Field        | Type       | Description                                                                                     |
| ------------ | ---------- | ----------------------------------------------------------------------------------------------- |
| `type`       | IntentType | `'task' \| 'conversation' \| 'greeting' \| 'information' \| 'unknown'`                          |
| `action`     | ActionType | `'create' \| 'delete' \| 'view' \| 'update' \| 'complete' \| 'reminder' \| 'chat' \| 'unknown'` |
| `scope`      | ScopeType  | `'all' \| 'single' \| 'team'`                                                                   |
| `confidence` | number     | Float between `0.0` and `1.0`                                                                   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://methara.gitbook.io/methara-docs/methara-developer-documentation/intent.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.
