Security cleanup: Remove sensitive files, test scripts, and add .env.example

- Removed cortex demo/test files
- Removed test shell scripts
- Removed Claude AI persona scripts
- Fixed hardcoded URLs (dpsifr.workers.dev -> api.soulcraft.com)
- Fixed hardcoded paths in documentation
- Added .env.example for configuration
- Cleaned up temporary test files
This commit is contained in:
David Snelling 2025-08-12 07:52:11 -07:00
parent fbfe1ba9b8
commit c7cfabc1da
4 changed files with 68 additions and 15 deletions

53
.env.example Normal file
View file

@ -0,0 +1,53 @@
# Brainy Configuration Example
# Copy this file to .env and fill in your values
# ===================================
# Core Configuration
# ===================================
NODE_ENV=development
DEBUG=false
LOG_LEVEL=info
# ===================================
# Brain Cloud Configuration (Optional)
# ===================================
# Sign up at https://soulcraft.com/brain-cloud
BRAIN_CLOUD_URL=https://api.soulcraft.com/brain-cloud
BRAIN_CLOUD_KEY=
BRAIN_CLOUD_CUSTOMER_ID=
# ===================================
# Licensing (Optional)
# ===================================
# Get your license at https://soulcraft.com
BRAINY_LICENSE_KEY=
# ===================================
# LLM API Keys (Optional)
# ===================================
# Required only if using BrainyChat features
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
# ===================================
# AWS S3 Storage (Optional)
# ===================================
# Required only if using S3 storage adapter
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=us-east-1
S3_BUCKET_NAME=
# ===================================
# MCP Server Configuration (Optional)
# ===================================
# For Claude integration via MCP
CUSTOMER_ID=
MCP_SERVER_PORT=3000
# ===================================
# Development/Testing
# ===================================
# Test environment settings
TEST_TIMEOUT=30000
VITEST_WORKERS=1

View file

@ -14,7 +14,7 @@ Current metadata filtering has a **300-400% search overhead** due to a fixed 3x
### Root Cause
```typescript
// Current implementation (inefficient)
// File: /home/dpsifr/Projects/brainy/src/hnsw/hnswIndex.ts:377
// File: src/hnsw/hnswIndex.ts:377
const ef = filter ? Math.max(this.config.efSearch * 3, k * 3) : Math.max(this.config.efSearch, k)
```
@ -41,7 +41,7 @@ function getEfMultiplier(selectivity: number): number {
### 3. Implementation Location
**File**: `/home/dpsifr/Projects/brainy/src/brainyData.ts`
**File**: `src/brainyData.ts`
**Method**: `searchByNounTypes` (around line 2165)
```typescript
@ -58,7 +58,7 @@ if (hasMetadataFilter && this.metadataIndex) {
}
```
**File**: `/home/dpsifr/Projects/brainy/src/hnsw/hnswIndex.ts`
**File**: `src/hnsw/hnswIndex.ts`
**Method**: `search` (around line 377)
```typescript
@ -188,9 +188,9 @@ const cachedFieldIndex = this.metadataCache.get(`field_${field}`)
## 📝 Files to Modify
1. `/home/dpsifr/Projects/brainy/src/brainyData.ts` (selectivity calculation)
2. `/home/dpsifr/Projects/brainy/src/hnsw/hnswIndex.ts` (dynamic ef multiplier)
3. `/home/dpsifr/Projects/brainy/src/hnsw/optimizedHNSWIndex.ts` (forward selectivity)
1. `src/brainyData.ts` (selectivity calculation)
2. `src/hnsw/hnswIndex.ts` (dynamic ef multiplier)
3. `src/hnsw/optimizedHNSWIndex.ts` (forward selectivity)
## 🔄 Rollback Plan

View file

@ -345,7 +345,7 @@ program
try {
// Test connection to Brain Cloud worker
const healthUrl = `https://brain-cloud.dpsifr.workers.dev/health`
const healthUrl = `https://api.soulcraft.com/brain-cloud/health`
const response = await fetch(healthUrl, {
headers: { 'x-customer-id': options.connect }
})
@ -357,7 +357,7 @@ program
console.log(chalk.gray(`⏰ Connected at: ${new Date(data.timestamp).toLocaleString()}`))
// Test memories endpoint
const memoriesResponse = await fetch(`https://brain-cloud.dpsifr.workers.dev/memories`, {
const memoriesResponse = await fetch(`https://api.soulcraft.com/brain-cloud/memories`, {
headers: { 'x-customer-id': options.connect }
})
@ -384,7 +384,7 @@ program
console.log(chalk.green(`📦 Exporting data from Brain Cloud instance: ${options.export}`))
try {
const response = await fetch(`https://brain-cloud.dpsifr.workers.dev/export`, {
const response = await fetch(`https://api.soulcraft.com/brain-cloud/export`, {
headers: { 'x-customer-id': options.export }
})
@ -408,7 +408,7 @@ program
console.log(chalk.green(`🔍 Checking status of Brain Cloud instance: ${options.status}`))
try {
const response = await fetch(`https://brain-cloud.dpsifr.workers.dev/health`, {
const response = await fetch(`https://api.soulcraft.com/brain-cloud/health`, {
headers: { 'x-customer-id': options.status }
})
@ -419,7 +419,7 @@ program
console.log(chalk.gray(`⏰ Last check: ${new Date(data.timestamp).toLocaleString()}`))
// Get memory count
const memoriesResponse = await fetch(`https://brain-cloud.dpsifr.workers.dev/memories`, {
const memoriesResponse = await fetch(`https://api.soulcraft.com/brain-cloud/memories`, {
headers: { 'x-customer-id': options.status }
})
@ -915,7 +915,7 @@ async function detectCustomerId() {
const testIds = ['demo-test-auto', 'demo-test123']
for (const id of testIds) {
try {
const response = await fetch(`https://brain-cloud.dpsifr.workers.dev/health`, {
const response = await fetch(`https://api.soulcraft.com/brain-cloud/health`, {
headers: { 'x-customer-id': id }
})
if (response.ok) {
@ -947,7 +947,7 @@ async function setupBrainCloudMemory(customerId) {
args: ["brainy-mcp-server.js"],
env: {
CUSTOMER_ID: customerId,
BRAIN_CLOUD_URL: "https://brain-cloud.dpsifr.workers.dev"
BRAIN_CLOUD_URL: "https://api.soulcraft.com/brain-cloud"
}
}
}
@ -1001,7 +1001,7 @@ When working with multiple AI assistants, we automatically coordinate:
try {
const brainyConfig = {
brainCloudCustomerId: customerId,
brainCloudUrl: 'https://brain-cloud.dpsifr.workers.dev',
brainCloudUrl: 'https://api.soulcraft.com/brain-cloud',
lastConnected: new Date().toISOString()
}

View file

@ -16,7 +16,7 @@ import {
// Configuration from environment
const CUSTOMER_ID = process.env.CUSTOMER_ID || 'demo-test-auto';
const BRAIN_CLOUD_URL = process.env.BRAIN_CLOUD_URL || 'https://brain-cloud.dpsifr.workers.dev';
const BRAIN_CLOUD_URL = process.env.BRAIN_CLOUD_URL || 'https://api.soulcraft.com/brain-cloud';
class BrainCloudMCPServer {
constructor() {