diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..8307ae9 --- /dev/null +++ b/.env.example @@ -0,0 +1,35 @@ +LOGIN_ORIGIN=http://localhost:3000 +DATABASE_URL="postgresql://docker:docker@postgres:5432/postgres?schema=echo" + +# This sets the URL used for direct connections to the database and should only be needed in limited circumstances +# See: https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#fields:~:text=the%20shadow%20database.-,directUrl,-No +DIRECT_URL=${DATABASE_URL} + +REMIX_APP_PORT=3000 +APP_ENV=production +NODE_ENV=${APP_ENV} +APP_ORIGIN=http://localhost:3000 + +SESSION_SECRET=27192e6432564f4788d55c15131bd5ac +ENCRYPTION_KEY=27192e6432564f4788d55c15131bd5ac + +########### Sign.in with google ############ +AUTH_GOOGLE_CLIENT_ID= +AUTH_GOOGLE_CLIENT_SECRET= + +REDIS_HOST=redis +REDIS_PORT=6379 +REDIS_TLS_DISABLED=true + +ENABLE_EMAIL_LOGIN=true + +NEO4J_URI=bolt://neo4j:7687 +NEO4J_USERNAME=neo4j +NEO4J_PASSWORD=27192e6432564f4788d55c15131bd5ac +OPENAI_API_KEY= + + +MAGIC_LINK_SECRET=27192e6432564f4788d55c15131bd5ac + + +NEO4J_AUTH=neo4j/27192e6432564f4788d55c15131bd5ac \ No newline at end of file diff --git a/README.md b/README.md index 967f28c..4708dfb 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,151 @@
- + CORE logo
-# CORE +# C.O.R.E. -Simple memory management system for AI agents with per-space ingestion and search capabilities. +**Contextual Observation & Recall Engine** -## Core APIs +C.O.R.E. is a private memory management system designed to give users full control over their data. It enables you to create a personal memory space, where you can ingest, organize, and search your information. You can selectively share or connect this memory with multiple tools, putting you in charge of what gets recalled and where. -### 1. Ingest API +## Getting Started -- Endpoint per space for data ingestion -- Queue-based processing per user -- Creates and links graph nodes automatically -- Optional review queue for controlled ingestion +Follow these steps to run C.O.R.E. locally: -### 2. Search API +1. **Copy Environment Variables** -- Simple text-based search -- Input: query string -- Output: relevant text matches -- Scoped to specific memory space + Copy the example environment file to `.env`: + + ```bash + cp .env.example .env + ``` + +2. **Start the Application** + + Use Docker Compose to start all required services: + + ```bash + docker-compose up + ``` + +3. **Access the App** + + Once the containers are running, open your browser and go to [http://localhost:3000](http://localhost:3000). + +4. **Login with Magic Link** + + - Choose the "Magic Link" login option. + - Enter your email address. + - The magic link will be output in the terminal logs. Copy and paste it into your browser to complete login. + +5. **Create Your Private Space & Ingest Data** + + - In the dashboard, go to the ingest section. + - Type a message, e.g., `I love playing badminton`, and click "Add". + - Your memory is queued for processing; you can monitor its status in the server logs. + - Once processing is complete, nodes will be added to your private knowledge graph and visible in the dashboard. + - You can later choose to connect this memory to other tools or keep it private. + +6. **Search Your Memory** + + - Use the dashboard's search feature to query your ingested data within your private space. + +## Connecting to the API + +You can also interact with C.O.R.E. programmatically via its APIs. + +1. **Generate an API Key** + + - In the dashboard, navigate to the API section and generate a new API key. + +2. **API Endpoints** + + - Use your API key to authenticate requests to the following endpoints: + + - **Ingest API:** `POST /ingest` + - **Search API:** `POST /search` + + - See below for example request bodies and details. + +### Ingest API + +- **Endpoint:** `/ingest` +- **Method:** `POST` +- **Authentication:** Bearer token (API key) +- **Body Example:** + + ```json + { + "episodeBody": "I love playing badminton", + "referenceTime": "2024-06-01T12:00:00Z", + "type": "Conversation", // or "Text" + "source": "user", // Which tool or user is ingesting + "spaceId": "your-space-id", // optional, for multiple spaces + "sessionId": "your-session-id" // optional + } + ``` + +- **Behavior:** + - Each ingestion is queued per user for processing in their private space. + - The system automatically creates and links graph nodes. + - You can monitor the status in the logs or dashboard. + - You can later connect this memory to other tools as you wish. + +### Search API + +- **Endpoint:** `/search` +- **Method:** `POST` +- **Authentication:** Bearer token (API key) +- **Body Example:** + + ```json + { + "query": "badminton", + "spaceId": "your-space-id", // optional + "sessionId": "your-session-id" // optional + } + ``` + +- **Behavior:** + - Returns relevant text matches scoped to your private memory space. + +> For detailed API schemas, see [`apps/webapp/app/routes/ingest.tsx`](apps/webapp/app/routes/ingest.tsx) and [`apps/webapp/app/routes/search.tsx`](apps/webapp/app/routes/search.tsx). + +--- ## Features (v1) -- [ ] Auto-mode default with optional queue review +### Feature Checklist + +#### ✅ Done + +- [x] Private memory space: You can ingest and search your own data. +- [x] Ingest for workspace: You can ingest data into a workspace. +- [x] Search for workspace: You can search within a workspace. + +#### 🛠️ In Progress / Planned + - [ ] Multiple Spaces support (unique URL per space) +- [ ] User-controlled sharing: Add memory to multiple tools or keep it private - [ ] Basic rules engine for ingestion filters -- [ ] Clear, user-friendly guidelines -- [ ] Simple text search +- [ ] Granular API Key Permissions: Allow API keys to be scoped to specific spaces and actions (e.g., read, write, ingest, search), so users can control access per space and per operation. +- [ ] Full Session and Space Support: Ensure all endpoints and UI fully support sessionId and spaceId for true multi-tenancy and session-based context. +- [ ] Audit Logging & API Key Management: Add audit logs for API usage and allow users to view, revoke, and rotate API keys. +- [ ] Role-Based Access Control (RBAC): Enable roles (admin, member, viewer) per space for better team collaboration and security. +- [ ] Webhooks/Notifications: Allow users to receive real-time notifications or webhooks on ingestion, search, or other events. ## Usage Guidelines -Store: +**Store:** - Conversation history - User preferences - Task context - Reference materials -Don't Store: +**Don't Store:** - Sensitive data (PII) - Credentials diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..164dbeb --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,76 @@ +version: "3.8" + +services: + core: + container_name: core-app + image: redplanethq/core:${VERSION} + environment: + - NODE_ENV=${NODE_ENV} + - DATABASE_URL=${DATABASE_URL} + - DIRECT_URL=${DIRECT_URL} + - SESSION_SECRET=${SESSION_SECRET} + - ENCRYPTION_KEY=${ENCRYPTION_KEY} + - MAGIC_LINK_SECRET=${MAGIC_LINK_SECRET} + - LOGIN_ORIGIN=${LOGIN_ORIGIN} + - APP_ORIGIN=${APP_ORIGIN} + - REDIS_HOST=${REDIS_HOST} + - REDIS_PORT=${REDIS_PORT} + - REDIS_TLS_DISABLED=${REDIS_TLS_DISABLED} + - NEO4J_URI=${NEO4J_URI} + - NEO4J_USERNAME=${NEO4J_USERNAME} + - NEO4J_PASSWORD=${NEO4J_PASSWORD} + - OPENAI_API_KEY=${OPENAI_API_KEY} + - AUTH_GOOGLE_CLIENT_ID=${AUTH_GOOGLE_CLIENT_ID} + - AUTH_GOOGLE_CLIENT_SECRET=${AUTH_GOOGLE_CLIENT_SECRET} + - ENABLE_EMAIL_LOGIN=${ENABLE_EMAIL_LOGIN} + ports: + - "3000:3000" + depends_on: + - postgres + - redis + - neo4j + networks: + - core + + postgres: + container_name: core-postgres + image: postgres:15 + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + networks: + - core + + redis: + container_name: core-redis + image: redis:7 + ports: + - "6379:6379" + networks: + - core + + neo4j: + container_name: core-neo4j + image: neo4j:5 + environment: + - NEO4J_AUTH=${NEO4J_AUTH} + ports: + - "7474:7474" + - "7687:7687" + volumes: + - neo4j_data:/data + networks: + - core + +networks: + core: + driver: bridge + +volumes: + postgres_data: + neo4j_data: diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index df7a764..6fefa5e 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -2,6 +2,7 @@ version: "3.8" services: core: + container_name: core-app build: context: ../ dockerfile: ./docker/Dockerfile @@ -33,27 +34,30 @@ services: networks: - core - # postgres: - # image: postgres:15 - # environment: - # - POSTGRES_USER=${POSTGRES_USER} - # - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - # - POSTGRES_DB=${POSTGRES_DB} - # ports: - # - "5432:5432" - # volumes: - # - postgres_data:/var/lib/postgresql/data - # networks: - # - core + postgres: + container_name: core-postgres + image: postgres:15 + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + networks: + - core - # redis: - # image: redis:7 - # ports: - # - "6379:6379" - # networks: - # - core + redis: + container_name: core-redis + image: redis:7 + ports: + - "6379:6379" + networks: + - core neo4j: + container_name: core-neo4j image: neo4j:5 environment: - NEO4J_AUTH=${NEO4J_AUTH} diff --git a/package.json b/package.json index 21789f0..b8aee4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "core", "private": true, + "version": "0.1.0", "workspaces": [ "apps/*", "packages/*" ] , diff --git a/packages/emails/emails/components/Footer.tsx b/packages/emails/emails/components/Footer.tsx index b2e02d4..0c8cef4 100644 --- a/packages/emails/emails/components/Footer.tsx +++ b/packages/emails/emails/components/Footer.tsx @@ -8,7 +8,7 @@ export function Footer() {
©Sol.ai - + C.O.R.E