Server converting Limitless AI lifelogs into indexed markdown, searchable via REST API and web UI
- Fetches Lifelog entries
- Persistent vector database using FAISS
- Multiple retrieval modes:
- Day: Search across entire days
- Memory: Search within specific memories
- Section: Search within sections of memories
- Line: Search individual lines/quotes
- Recency-weighted search results
- Web UI for settings and queries
- REST API for integration
-
Clone the repository:
git clone https://github.com/Maclean-D/context-server.git cd context-server
-
Get a Limitless API key (Account > Developers)
-
Enter it in
config.json
-
Create and activate a virtual environment:
# Windows python -m venv venv .\venv\Scripts\activate # Linux/Mac python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the server:
python main.py
-
Continute to
Starting The Server
-
Activate a virtual environment:
# Windows .\venv\Scripts\activate # Linux/Mac source venv/bin/activate
-
Start the server:
python main.py
-
- View server status and change settings at http://localhost:5712
This section provides instructions for running the application using Docker. This is generally recommended as it handles dependencies and environment setup consistently.
Prerequisites:
- Install Docker: Follow the official instructions for your operating system.
- Install Docker Engine
- If you plan to use
docker-compose
, also Install Docker Compose (Docker Desktop for Windows/Mac usually includes it).
Clone the repository (if you haven't already):
git clone https://github.com/Maclean-D/context-server.git
cd context-server
Docker Compose simplifies the management of multi-container applications and is convenient for development and deployment.
-
Configure API Key: Create a file named
.env
in the root of the project directory (alongsidedocker-compose.yml
) with the following content:LIMITLESS_API_KEY=your_actual_api_key_here
Replace
your_actual_api_key_here
with your actual Limitless API key. If this variable is not set or is empty, the application will attempt to use the API key specified inconfig.json
. -
Build and run the application: To start the services:
docker-compose up
If you have made changes to the application code or the
Dockerfile
and want to ensure the docker image is rebuilt, use:docker-compose up --build
To run in detached mode (in the background), add the
-d
flag:docker-compose up -d # or with an explicit rebuild docker-compose up --build -d
-
Access the application: Open your browser and go to
http://localhost:5712
. -
Stopping the application: If running in the foreground, press
Ctrl+C
. If running in detached mode:docker-compose down
If you prefer not to use Docker Compose, you can build and run the container using Docker CLI commands directly.
-
Prepare Configuration and Directories:
- Ensure you have a
config.json
file in the project root. You can copy the providedconfig.json
example or create your own. - Create the
./notes
and./faiss_index
directories in your project root if they don't exist:Ifmkdir -p notes faiss_index
config.json
does not exist in your project root when you run the container with a volume mount, Docker might create an empty directory instead of a file. It's best to haveconfig.json
present.
- Ensure you have a
-
Build the Docker image: Navigate to the project's root directory (where the
Dockerfile
is located) and run:docker build -t context-server-image .
(You can choose any name for
context-server-image
). -
Run the Docker container:
docker run -d \ --name context-server-app \ -p 5712:5712 \ -v "./data/notes":/app/notes \ -v "./data/faiss_index":/app/faiss_index \ -v "./data/config.json":/app/config.json \ -e LIMITLESS_API_KEY="your_actual_api_key_here" \ -e UVICORN_RELOAD="false" \ --restart unless-stopped \ context-server-image
Explanation of flags:
-d
: Run in detached mode (background).--name context-server-app
: Assign a name to the container.-p 5712:5712
: Map port 5712 on the host to port 5712 in the container.-v "$./data/notes":/app/notes
: Mount the localnotes
directory to/app/notes
in the container.-v "$./data/faiss_index":/app/faiss_index
: Mount the localfaiss_index
directory to/app/faiss_index
in the container.-v "$./data/config.json":/app/config.json
: Mount the localconfig.json
file to/app/config.json
in the container.-e LIMITLESS_API_KEY="your_actual_api_key_here"
: Set the Limitless API key. Replace with your actual key or omit if you want to rely solely onconfig.json
(though setting it here is recommended fordocker run
).-e UVICORN_RELOAD="false"
: Ensure Uvicorn's auto-reload is disabled.--restart unless-stopped
: Configure the container to restart automatically unless manually stopped.context-server-image
: The name of the image you built.
Replace
"your_actual_api_key_here"
with your actual Limitless API key. -
Access the application: Open your browser and go to
http://localhost:5712
. -
Viewing logs:
docker logs context-server-app
-
Stopping the container:
docker stop context-server-app
-
Removing the container:
docker rm context-server-app
Data Persistence (for both options): The setup ensures that your data is persisted on your host machine in the following locations within your project directory:
./notes
: Stores the downloaded markdown lifelogs../faiss_index
: Stores the FAISS vector index../config.json
: Stores your application configuration (when mounted).
These folders will be created in your project directory on your host machine if they don't already exist (though for config.json
with docker run
, it's best if it exists beforehand).
Once your server is started visit http://localhost:5712/docs#/ to view documentation.