Skip to main content

Welcome

The CosmaSense backend exposes a RESTful API for managing file indexing, search, queue control, and real-time updates. The backend runs on port 60534 by default. Base URL: http://localhost:60534 All endpoints are local-only and require no authentication. The backend is designed to run on your local machine and is not intended to be exposed to the internet.

Quick Start

Start the backend server:
cosma serve
Test the connection:
curl http://localhost:60534/api/status/

Endpoint Groups

Watch Directory

Add a directory to the watch list and start indexing

Search Files

Search indexed files using natural language queries

Watch Jobs

List and manage watched directory jobs

Queue Control

Pause, resume, and inspect the indexing queue

Scheduler

Configure automatic pause/resume based on system conditions

Real-time Updates

Stream processing status updates via Server-Sent Events

Filters

Configure file inclusion/exclusion patterns

Settings

Read and update application settings

Data Flow

File Processing States

When files are being indexed, they go through several states reported via SSE:
StateSSE OpcodeDescription
Queuedqueue_item_addedFile added to indexing queue, waiting for cooldown
Processingqueue_item_processingCooldown expired, processing started
Parsingfile_parsingExtracting content from file
Summarizingfile_summarizingAI generating summary and keywords
Embeddingfile_embeddingCreating vector embedding
Completefile_completeSuccessfully indexed
Failedfile_failedError during processing
Monitor these states in real-time using the /api/updates SSE endpoint.