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

# Knowledge Bases

> Build and query your personal knowledge base to give Logical context.

## Overview

A Knowledge Base is your secure, local repository of information. By creating one, you provide Logical with specific context, enabling it to deliver more relevant and accurate assistance tailored to your projects and personal data.

When you attach a Knowledge Base to your current work, Logical uses its content to better understand your questions and generate personalized answers.

## Creating a Knowledge Base

Follow these steps to create a new Knowledge Base from your files.

<Steps>
  <Step title="Open the Knowledge Base Manager">
    From the main Logical window, click the Knowledge Base icon to open the management screen.

    <Frame caption="Click the cylinder icon to open the Knowledge Base manager.">
      <img src="https://mintcdn.com/logical-257522b6/aILkTm2lJ6HbHilt/images/knowledge-db/knowledge-db-1.png?fit=max&auto=format&n=aILkTm2lJ6HbHilt&q=85&s=a405afd6213bfa6db2a721ce6ab1db6c" alt="Main Logical window with an arrow pointing to the Knowledge Base icon." width="617" height="136" data-path="images/knowledge-db/knowledge-db-1.png" />
    </Frame>
  </Step>

  <Step title="Name Your Knowledge Base">
    Provide a descriptive name and a brief description. This will help you easily identify it later.
  </Step>

  <Step title="Add Your Content">
    Drag and drop your files and folders into the window. Logical supports a wide range of formats, including, *but not limited to*:

    * **Documents**: `.pdf`, `.md`, `.txt`
    * **Code Files**: `.swift`, `.js`, `.ts`, `.py`, `.java`, `.cpp`, `.c`, `.h`
    * **Web & Data**: `.html`, `.css`, `.json`, `.xml`
    * **Images**: `.png`, `.jpg`, `.jpeg`, `.tiff`, `.heic`, `.webp`

    <Frame caption="Drag and drop supported files and folders to create a new Knowledge Base.">
      <img src="https://mintcdn.com/logical-257522b6/aILkTm2lJ6HbHilt/images/knowledge-db/knowledge-db-2.png?fit=max&auto=format&n=aILkTm2lJ6HbHilt&q=85&s=b9cb94cf80cd3349b3ef118c6a928c1c" alt="The Knowledge Base creation window with several files being dragged onto it." width="608" height="531" data-path="images/knowledge-db/knowledge-db-2.png" />
    </Frame>
  </Step>

  <Step title="Process Your Files">
    Click **Create**. Logical will then process your files to build your new Knowledge Base.
  </Step>
</Steps>

### Excluding Files and Folders

When you add a folder to a Knowledge Base, you can specify exclusion patterns to prevent certain files or subfolders from being included. This is useful for ignoring things like `node_modules`, build artifacts, or git directories.

Logical uses **glob patterns** for exclusions.

* To exclude a specific folder name anywhere it appears, use the folder name (e.g., `node_modules`).
* To exclude a specific file type, use a pattern like `*.log`.
* To exclude a directory at the root of the folder you're adding, use a pattern like `build/`.

You can add multiple exclusion patterns for each folder you add.

<Frame caption="Add glob patterns to exclude specific files or folders from your Knowledge Base.">
  <img src="https://mintcdn.com/logical-257522b6/aILkTm2lJ6HbHilt/images/knowledge-db/knowledge-db-3.png?fit=max&auto=format&n=aILkTm2lJ6HbHilt&q=85&s=5a9e16e2076bf9216faabfc3d7ac3195" alt="The source item view showing the 'Add Exclusion Pattern' button and a list of patterns." width="611" height="526" data-path="images/knowledge-db/knowledge-db-3.png" />
</Frame>

## Updating a Knowledge Base

You can easily add new information or remove outdated files from an existing Knowledge Base.

<Steps>
  <Step title="Select a Knowledge Base to Edit">
    Open the Knowledge Base manager and find the Knowledge Base you wish to modify. Click the **Edit** button next to its name.
  </Step>

  <Step title="Manage Your Files">
    In the edit view, you can drag and drop new files to add them or click the **"x"** icon next to a file to remove it.
  </Step>

  <Step title="Save Your Changes">
    Click **Update** to save your changes. Logical will re-process the files to update the Knowledge Base.
  </Step>
</Steps>

## Attaching a Knowledge Base to Your Context

You can provide Logical with context from a Knowledge Base in two ways.

### 1. Assign to a Named Task

For long-term projects, you can permanently associate a Knowledge Base with a **Task** (a saved group of application windows).

<Steps>
  <Step title="Open the Task Editor">
    Click the **Add New Task** button or edit an existing Task from the main window.

    <Frame caption="Create a new Task to group windows and context together.">
      <img src="https://mintcdn.com/logical-257522b6/aILkTm2lJ6HbHilt/images/knowledge-db/create-task.png?fit=max&auto=format&n=aILkTm2lJ6HbHilt&q=85&s=483b6004890f5bacbb017c72858c73a1" alt="The main Logical window with the 'Add New Task' button highlighted." width="619" height="189" data-path="images/knowledge-db/create-task.png" />
    </Frame>
  </Step>

  <Step title="Select a Knowledge Base">
    In the Task editor, use the dropdown menu to select from your available Knowledge Bases.

    <Frame caption="Associate a Knowledge Base with a Task using the dropdown menu.">
      <img src="https://mintcdn.com/logical-257522b6/aILkTm2lJ6HbHilt/images/knowledge-db/assign-named.png?fit=max&auto=format&n=aILkTm2lJ6HbHilt&q=85&s=416ff89cd2e930202ece814211cab21e" alt="The Task editor window with the Knowledge Base dropdown menu expanded." width="602" height="423" data-path="images/knowledge-db/assign-named.png" />
    </Frame>
  </Step>

  <Step title="Save the Task">
    After saving, the selected Knowledge Base will automatically activate whenever you switch to this Task.
  </Step>
</Steps>

### 2. Hot-Attach to Your Current Context

For quick, temporary needs, you can "hot-attach" a Knowledge Base directly to your current context.

<Steps>
  <Step title="Open the Knowledge Base Selector">
    In the main Logical window, click the **book icon**.

    <Frame caption="The book icon allows you to quickly attach a Knowledge Base.">
      <img src="https://mintcdn.com/logical-257522b6/aILkTm2lJ6HbHilt/images/knowledge-db/book.png?fit=max&auto=format&n=aILkTm2lJ6HbHilt&q=85&s=947b7607de462ff9c9fa5f358c86eefc" alt="The main Logical window with the book icon highlighted." width="608" height="117" data-path="images/knowledge-db/book.png" />
    </Frame>
  </Step>

  <Step title="Select and Attach">
    A window will appear listing your Knowledge Bases. Select one and click **Update** to attach it. The book icon will turn green, indicating that a Knowledge Base is active.

    <Frame caption="Select a Knowledge Base to attach it to your current context.">
      <img src="https://mintcdn.com/logical-257522b6/aILkTm2lJ6HbHilt/images/knowledge-db/assign-hot.png?fit=max&auto=format&n=aILkTm2lJ6HbHilt&q=85&s=03fe9da0b09f40ad80e6902935a12a4d" alt="The Knowledge Base selection window with one item selected and the 'Update' button highlighted." width="601" height="500" data-path="images/knowledge-db/assign-hot.png" />
    </Frame>
  </Step>
</Steps>

To detach the Knowledge Base, simply click the green book icon again.

## Privacy

<Note>
  Your Knowledge Base contents are stored locally on your device and are not sent to Logical servers.

  However, snippets of content may occasionally be sent to third-party LLM service providers for context understanding. For more details on how your data is handled, please refer to our Privacy Policy.
</Note>
