> 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/overview.md).

# Overview

Methara is a pre-processing middleware library that sits between raw user input and an LLM. It handles routing, safety checks, entity extraction, behavioral profiling, and text compression locally.

It runs in under 10ms. It adds no API cost. It keeps sensitive data on your server.

{% hint style="info" %}
Methara does not make network requests. All processing stays inside your Node.js process.
{% endhint %}

### The problem Methara solves

A typical AI agent sends every user message to an LLM. That includes simple commands like `"delete all my tasks"` or `"show me my schedule"`.

This creates a few avoidable problems:

* Unnecessary API cost
* Added round-trip latency
* Sensitive data leaving your server
* Unpredictable behavior for deterministic tasks

Methara acts as a local filter. Only messages that need real reasoning reach the LLM.

### Architecture

Methara is organized into five independent modules. Each module is a plain JavaScript object with named functions.

| Module    | Responsibility                                       | Key function                     |
| --------- | ---------------------------------------------------- | -------------------------------- |
| Intent    | Route user commands without an LLM                   | `Intent.analyze(text)`           |
| Patterns  | Build a behavioral profile from conversation history | `Patterns.profile(conversation)` |
| Entities  | Extract dates, times, @mentions, IDs, quantities     | `Entities.extract(text)`         |
| Guard     | Detect injections and mask PII                       | `Guard.sanitize(text)`           |
| Processor | Compress text to reduce LLM token usage              | `Processor.shrink(text)`         |


---

# 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/overview.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.
