brainy/API-CRITICAL-FIXES.md
David Snelling 26c7d61185 CHECKPOINT: Brainy 2.0 API refactor - pre-fixes state
Current state:
- Unified augmentation system to BrainyAugmentation interface
- Changed methods to specific noun/verb naming (addNoun, getNoun, etc)
- Made old methods private
- Combined getNouns into single unified method
- Neural API exists and is complete
- Triple Intelligence uses correct Brainy operators (not MongoDB)

Issues identified:
- Documentation incorrectly shows MongoDB operators (code is correct)
- Need to ensure all features are properly exposed
- Need to verify nothing was lost in simplification

This commit serves as a rollback point before applying fixes.
2025-08-25 09:52:32 -07:00

2.7 KiB

🚨 CRITICAL API FIXES NEEDED FOR BRAINY 2.0

We accidentally introduced MongoDB-style operators which we specifically avoided for legal reasons!

MUST REPLACE:

// ❌ WRONG (MongoDB style)
where: {
  field: {$in: [values]},
  field: {$gt: value},
  field: {$regex: pattern}
}

// ✅ CORRECT (Brainy style)
where: {
  field: {oneOf: [values]},
  field: {greaterThan: value},
  field: {matches: pattern}
}

Complete Operator Mapping:

  • $eqequals or is
  • $nenotEquals
  • $gtgreaterThan
  • $gtegreaterEqual
  • $ltlessThan
  • $ltelessEqual
  • $inoneOf
  • $ninnotOneOf
  • $regexmatches
  • $containscontains
  • (NEW) → startsWith
  • (NEW) → endsWith
  • (NEW) → between

2. 📊 Missing Neural API Features

The backup shows we had extensive neural capabilities:

brain.neural.similar(a, b)         // Semantic similarity
brain.neural.clusters()            // Auto-clustering
brain.neural.hierarchy(id)         // Semantic hierarchy
brain.neural.neighbors(id)         // Neighbor graph
brain.neural.outliers()           // Outlier detection
brain.neural.semanticPath(a, b)   // Path finding
brain.neural.visualize()          // Visualization data

3. 🔄 Missing Triple Intelligence Features

We need to ensure Triple Intelligence has all its features:

  • Query optimization
  • Progressive filtering
  • Parallel execution
  • Query learning/caching
  • Explanations

4. 🧩 Missing Augmentation Features

  • Synapses (Notion, Slack, Salesforce connectors)
  • Conduits (Brainy-to-Brainy sync)
  • Real-time bidirectional sync

5. 📥 Missing Import/Export Features

  • Neural import with entity extraction
  • CSV import with AI parsing
  • JSON flattening and structure detection
  • Batch neural processing

6. 🎯 API Simplification Issues

While simplifying, we may have lost:

  • Verb scoring intelligence
  • Clustering management
  • Performance monitoring
  • Health checks
  • Statistics collection

7. 🔍 Search Method Confusion

Need to clarify:

  • search(query) = simple convenience for find({like: query})
  • find(query) = full Triple Intelligence
  • Remove duplicate methods like searchByNounTypes, etc.

IMMEDIATE ACTIONS:

  1. Replace ALL MongoDB operators with Brainy operators
  2. Restore neural API with all methods
  3. Ensure Triple Intelligence is complete
  4. Verify augmentation system works
  5. Test import/export capabilities
  6. Document the clean API properly

BACKUP LOCATIONS:

  • /home/dpsifr/Projects/BACKUP/brainy (Copy) - Full backup
  • /home/dpsifr/Projects/BACKUP/brainy-clean - Clean version
  • /home/dpsifr/Projects/brainy (Copy) - Another backup