This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run build- Compile TypeScript and copy polyfill files to dist/npm start- Build and start the service (requires 8GB memory)npm run dev- Start TypeScript watch mode for developmentnpm run dev:start- Run with nodemon watching dist/ changes
npm test- Run all tests with Vitestnpm run test:watch- Run tests in watch modenpm run test:coverage- Generate test coverage reportsnpm run test:skills- Run skills detection tests specificallynpm run test:scout-search- Run scout-search integration testsnpm run test:github-service- Run GitHub service testsnpm run test:server- Run server integration testsnpm run test:cloud-run- Run Cloud Run compatibility tests
npm run lint- Lint TypeScript files in src/npm run lint:fix- Auto-fix linting issues
npm run deploy:cloud- Deploy to Google Cloud Run (uses .env file directly, no secrets manager)npm run release- Build and create GitHub release
IMPORTANT: When committing changes, use Conventional Commit format without any Claude Code attribution or co-author information.
For commits, use one of these approaches:
- Simple wrapper script:
./commit(stages changes and opens editor) - Manual conventional commit:
git add -A git commit -m "<type>(<scope>): <description> Detailed explanation of changes and their impact."
Conventional Commit Format:
- Types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore - Keep first line under 72 characters
- Use imperative mood (e.g., 'add' not 'added')
- No Claude Code attribution or co-author information
Examples:
feat(auth): add GitHub App authentication supportfix(models): resolve Universal Sentence Encoder loading failuresdocs(readme): update deployment instructions
When Claude Code says "commit this", always use the conventional format without any AI attribution.
This is a Node.js/TypeScript service that processes GitHub data into knowledge graphs using the Brainy framework. The service runs on Google Cloud Run and provides scout-search APIs for talent discovery.
Main Service (src/index.ts)
- Express.js web server with health checks and API endpoints
- Brainy initialization with Universal Sentence Encoder model (requires 8GB memory)
- GitHub service integration with rate limiting
- Scout-search API endpoints for talent discovery
Data Processing Pipeline
GitHubService- Fetches data from GitHub API with rate limit handlingGitHubMappingService- Maps GitHub data to Brainy nouns/verbsPlaceholderResolutionService- Resolves placeholder references- Augmentations transform raw data into standardized formats
Key Augmentations
GitHubDataTransformationAugmentation- Transforms GitHub API data using standardized cross-platform schemaSkillsAndJobDetectionAugmentation- Detects developer skills and job-seeking signalsPlaceholderManagementAugmentation- Manages data references and relationships
Standardized Cross-Platform Schema (v1.1.0)
- Compatible with bluesky-package and scout-search platforms
- Enhanced with Brainy 0.36.0 verb type standardization
- Consistent identifiers (
github_user_123, canonical IDs) with type inference - Standardized metadata structure with confidence scoring and relationship tracking
- Cross-platform talent discovery capabilities with improved reliability
Storage Integration
- Uses Brainy framework with Google Cloud Storage backend
- Structured as nouns (entities) and verbs (relationships)
- Write-only mode reduces memory requirements for large datasets
# GitHub Authentication (one of these approaches)
GITHUB_TOKEN=your_github_token # Personal access token
# OR GitHub App (recommended for higher rate limits)
GITHUB_APP_ID=your_app_id
GITHUB_PRIVATE_KEY=your_private_key
GITHUB_INSTALLATION_ID=your_installation_id
# Storage Configuration
GCS_BUCKET_NAME=your_storage_bucket
GCS_ACCESS_KEY_ID=your_access_key
GCS_SECRET_ACCESS_KEY=your_secret_key
GCS_ENDPOINT=https://storage.googleapis.com # Optional
GCS_REGION=auto # OptionalPORT=8080 # Server port
NODE_ENV=production # Environment
AUTO_START_PROCESSING=true # Auto-start data processing
LOG_LEVEL=error # Logging level (error=lowest cost, info=development)
LOCAL_MONITORING=true # Display monitoring info
# Model Configuration (DO NOT MODIFY - Float32 enforced for data consistency)
# PREFER_COMPRESSED_MODELS=false # Automatically set by config
# FORCE_FLOAT32_MODELS=true # Automatically set by configIMPORTANT: Cloud Run logging charges per log entry. To minimize costs:
- LOG_LEVEL=error: Only logs errors, warnings, and critical milestones
- Aggressive Console Filtering: Suppresses high-volume Brainy processing logs
- Blocked Patterns: Verb creation, skill mapping, transformations, cache operations
- Cost Impact: Can reduce logging costs by 90-95% in high-volume scenarios
For Debugging: Temporarily set LOG_LEVEL=info and redeploy, then revert to error.
GET /api/scout-search/talent- Search developers with filters (skills, experience, job-seeking status)GET /api/scout-search/skills- Get all available skills for filteringGET /api/scout-search/stats- Get talent discovery statistics
GET /health- Health check with service statusGET /stats- Processing statisticsPOST /start- Start GitHub data processingPOST /full-sync- Perform full GitHub synchronization
GET /api/placeholder-resolution/stats- Resolution statisticsPOST /api/placeholder-resolution/resolve-all- Resolve all placeholdersPOST /api/placeholder-resolution/resolve-immediate- Resolve specific placeholders
- Universal Sentence Encoder model requires minimum 8GB memory
- Cloud Run deployment requires
--memory="8Gi"configuration
- Uses Vitest with single-threaded execution for stability
- Test files in
test/directory with.test.tsextension - Coverage reports generated in
./test-results/ - Separate test scripts for different components
- ESLint configuration with TypeScript rules
- Prettier formatting with specific preferences (no semicolons, single quotes)
- Uses ES modules (
"type": "module") with NodeNext module resolution
@soulcraft/brainy(v0.52.0) - Knowledge graph framework with automatic high-volume optimization and memory management@octokit/rest- GitHub API client- Express.js - Web server framework
- Vitest - Testing framework
- TypeScript with strict compilation
The service includes shell scripts for deployment automation:
deploy-to-cloud-run.sh- Simplified Cloud Run deployment using .env file directly (no Google Secret Manager)- Various test scripts for verifying fixes and deployments
Deployment Approach: Uses environment variables directly from .env file instead of Google Cloud Secret Manager for simpler debugging and configuration management.
- Uses augmentation pipeline for data transformation
- Implements standardized schema v1.1.0 for cross-platform compatibility
- Write-only mode enabled to reduce memory usage during processing
- NEW in 0.52.0: Automatic socket exhaustion prevention and memory pressure management
- Automatic High-Volume Optimization: Socket exhaustion prevention and intelligent connection pooling
- Memory Pressure Management: Automatic memory-aware batch sizing and backpressure handling
- Error-Based Throttling: Self-adjusting rate limiting based on system feedback
- Zero-Configuration: All optimizations work automatically without manual tuning
- Enhanced Reliability: Built-in safeguards for production high-volume scenarios
- Ultra-Fast Search Performance: Revolutionary caching and optimization system
- Smart result caching with <1ms repeated query performance
- Cursor-based pagination with O(k) performance for large datasets
- Real-time data sync with automatic cache invalidation
- Performance monitoring with built-in hit rate tracking
- Intelligent auto-configuration that detects environment and optimizes automatically
- Enhanced API Endpoints: New performance monitoring capabilities
/api/brainy/performance- Cache statistics and performance metrics/api/brainy/health- Enhanced distributed health status/api/scout-search/talent- Now supports cursor-based pagination for better performance
- Improved Cache System: Advanced caching with intelligence
- Increased cache sizes (15k hot cache, optimized eviction thresholds)
- Smart result caching with automatic TTL management
- Performance monitoring with adaptive optimization
- Selective cache invalidation strategies
- Enhanced Real-Time Updates: Better coordination and synchronization
- Automatic cache invalidation when data changes
- Faster sync intervals (30 seconds) for better responsiveness
- Selective invalidation strategy for optimal performance
- Previous v0.38.0 Features:
- Distributed mode with writer role for optimized write operations
- Enhanced cache system with auto-tuning capabilities
- Coordinated heartbeat system for distributed instance management
- Enhanced retry policy with exponential backoff