From 3bf02e9600a60a576a6f69e03cba618ccc1ec20e Mon Sep 17 00:00:00 2001 From: Jordan Partridge Date: Wed, 11 Feb 2026 07:23:31 -0700 Subject: [PATCH] fix: remove hardcoded personal references for public usability - IndexCodeCommand: clear hardcoded /home/jordan/* paths, use empty defaults (users pass --path or will get helpful error) - config/services.php: remove hardcoded Tailscale IP (100.68.122.24) from prefrontal and odin defaults, default odin sync to disabled - PatternDetectorService: replace hardcoded project names (jordanpartridge, the-shit, pstrax, etc.) with config-driven patterns via search.project_patterns config key - docker-compose.odin.yml: replace hardcoded IPs with ${BIND_ADDR} env var, defaults to 127.0.0.1 for safety - Add .env.example with localhost defaults and documented options - Add search.project_patterns config key for custom pattern detection --- .env.example | 25 +++++++++++++++++++++++++ app/Commands/IndexCodeCommand.php | 10 ++-------- app/Services/PatternDetectorService.php | 17 ++++++----------- config/search.php | 15 +++++++++++++++ config/services.php | 6 +++--- docker-compose.odin.yml | 17 +++++++++++++---- 6 files changed, 64 insertions(+), 26 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..2fba421 --- /dev/null +++ b/.env.example @@ -0,0 +1,25 @@ +# Vector Database (Qdrant) +QDRANT_ENABLED=true +QDRANT_HOST=localhost +QDRANT_PORT=6333 +EMBEDDING_PROVIDER=qdrant +QDRANT_EMBEDDING_SERVER=http://localhost:8001 + +# Redis Cache (optional, improves query speed) +REDIS_HOST=localhost +REDIS_PORT=6379 + +# Ollama LLM (optional, for auto-tagging and query expansion) +OLLAMA_ENABLED=false +OLLAMA_HOST=localhost +OLLAMA_PORT=11434 +OLLAMA_MODEL=llama3.2:3b + +# Centralized Sync (optional, for multi-machine knowledge sharing) +ODIN_SYNC_ENABLED=false +# ODIN_URL=http://your-server:8080 +# ODIN_API_TOKEN=your-token + +# Cloud API Sync (optional) +# PREFRONTAL_API_URL=http://your-api:8080 +# PREFRONTAL_API_TOKEN=your-token diff --git a/app/Commands/IndexCodeCommand.php b/app/Commands/IndexCodeCommand.php index 488705e..a14d530 100644 --- a/app/Commands/IndexCodeCommand.php +++ b/app/Commands/IndexCodeCommand.php @@ -24,14 +24,8 @@ class IndexCodeCommand extends Command protected $description = 'Index code files for semantic search'; - private const DEFAULT_PATHS = [ - '/home/jordan/projects/knowledge', - '/home/jordan/prefrontal-cortex', - '/home/jordan/packages/api-gateway', - '/home/jordan/packages/conduit-ui', - '/home/jordan/packages/monitor', - '/home/jordan/Sites/jordanpartridge.us', - ]; + /** @var array */ + private const DEFAULT_PATHS = []; public function handle(CodeIndexerService $indexer): int { diff --git a/app/Services/PatternDetectorService.php b/app/Services/PatternDetectorService.php index d50c482..abba83e 100644 --- a/app/Services/PatternDetectorService.php +++ b/app/Services/PatternDetectorService.php @@ -155,17 +155,12 @@ private function extractProjects(string $text): array { $projects = []; - // Match common project patterns - $patterns = [ - '/\b(conduit-\w+)\b/i', - '/\b(synapse-\w+)\b/i', - '/\b(the-shit)\b/i', - '/\b(pstrax-\w+)\b/i', - '/\b(jordanpartridge[\w\-]*)\b/i', - '/\b(knowledge)\b/i', - '/\b(prefrontal-cortex)\b/i', - '/\b(vision)\b/i', - '/\b(odin)\b/i', + // Match project patterns from config, with fallback generic patterns + /** @var array $configPatterns */ + $configPatterns = config('search.project_patterns', []); + + $patterns = $configPatterns !== [] ? $configPatterns : [ + '/\b([\w]+-[\w]+(?:-[\w]+)*)\b/', // hyphenated project names (e.g. my-project) ]; foreach ($patterns as $pattern) { diff --git a/config/search.php b/config/search.php index 8c56931..ee68b9d 100644 --- a/config/search.php +++ b/config/search.php @@ -90,6 +90,21 @@ |-------------------------------------------------------------------------- */ + /* + |-------------------------------------------------------------------------- + | Project Pattern Detection + |-------------------------------------------------------------------------- + | + | Regex patterns for detecting project names in knowledge entries. + | Used by PatternDetectorService to extract project associations. + | Leave empty to use a generic hyphenated-name pattern. + | + | Example: ['/\b(my-project)\b/i', '/\b(other-app)\b/i'] + | + */ + + 'project_patterns' => [], + 'ollama' => [ 'enabled' => env('OLLAMA_ENABLED', true), 'host' => env('OLLAMA_HOST', 'localhost'), diff --git a/config/services.php b/config/services.php index 8fdefcd..5ddf9b9 100644 --- a/config/services.php +++ b/config/services.php @@ -13,7 +13,7 @@ */ 'prefrontal' => [ - 'url' => env('PREFRONTAL_API_URL', 'http://100.68.122.24:8080'), + 'url' => env('PREFRONTAL_API_URL'), 'token' => env('PREFRONTAL_API_TOKEN'), ], @@ -29,8 +29,8 @@ */ 'odin' => [ - 'enabled' => env('ODIN_SYNC_ENABLED', true), - 'url' => env('ODIN_URL', 'http://100.68.122.24:8080'), + 'enabled' => env('ODIN_SYNC_ENABLED', false), + 'url' => env('ODIN_URL'), 'token' => env('ODIN_API_TOKEN', env('PREFRONTAL_API_TOKEN')), 'timeout' => env('ODIN_TIMEOUT', 10), 'batch_size' => env('ODIN_BATCH_SIZE', 50), diff --git a/docker-compose.odin.yml b/docker-compose.odin.yml index 9af1e39..71d72bf 100644 --- a/docker-compose.odin.yml +++ b/docker-compose.odin.yml @@ -1,11 +1,20 @@ +# Production/centralized server deployment +# Binds to a specific network interface (e.g. Tailscale, VPN, LAN) +# +# Usage: +# BIND_ADDR=100.68.122.24 docker compose -f docker-compose.odin.yml up -d +# +# Set BIND_ADDR to your server's interface IP (Tailscale, LAN, etc.) +# Defaults to 127.0.0.1 (localhost only) if not set. + services: qdrant: image: qdrant/qdrant:latest container_name: knowledge-qdrant restart: unless-stopped ports: - - "100.68.122.24:6333:6333" # HTTP API - Tailscale only - - "100.68.122.24:6334:6334" # gRPC API - Tailscale only + - "${BIND_ADDR:-127.0.0.1}:6333:6333" + - "${BIND_ADDR:-127.0.0.1}:6334:6334" volumes: - qdrant_storage:/qdrant/storage environment: @@ -22,7 +31,7 @@ services: container_name: knowledge-redis restart: unless-stopped ports: - - "100.68.122.24:6380:6379" # Tailscale only + - "${BIND_ADDR:-127.0.0.1}:6380:6379" volumes: - redis_data:/data command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru @@ -39,7 +48,7 @@ services: container_name: knowledge-embeddings restart: unless-stopped ports: - - "100.68.122.24:8001:8001" # Tailscale only + - "${BIND_ADDR:-127.0.0.1}:8001:8001" volumes: - embedding_cache:/root/.cache environment: