Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
10 changes: 2 additions & 8 deletions app/Commands/IndexCodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> */
private const DEFAULT_PATHS = [];

public function handle(CodeIndexerService $indexer): int
{
Expand Down
17 changes: 6 additions & 11 deletions app/Services/PatternDetectorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> $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) {
Expand Down
15 changes: 15 additions & 0 deletions config/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
6 changes: 3 additions & 3 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
],

Expand All @@ -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),
Expand Down
17 changes: 13 additions & 4 deletions docker-compose.odin.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down
Loading