- Moved API design docs to docs/api-design/ - Moved planning docs to docs/planning/ - Root now only contains standard repo files (README, LICENSE, etc.) - Keeps CLAUDE.md and PLAN.md uncommitted for privacy Clean root directory for better project organization.
5.5 KiB
5.5 KiB
🚨 CRITICAL API AUDIT - What We Changed & Lost
📅 Timeline of Changes (Friday-Saturday)
Friday Changes:
- Started unifying augmentation system to single BrainyAugmentation interface
- Made old methods (add, get, delete) private
- Created new specific methods (addNoun, getNoun, deleteNoun)
- Started removing backward compatibility
Saturday Changes:
- Combined getNounsByIds and queryNouns into single getNouns method
- Simplified search API (may have oversimplified!)
- Accidentally introduced MongoDB operators ($gt, $in, etc.)
- May have removed critical features while "simplifying"
❌ CRITICAL MISTAKES WE MADE:
1. MongoDB Operators (LEGAL RISK!)
// ❌ WRONG - We accidentally added:
where: { field: {$gt: value} }
// ✅ CORRECT - Should be:
where: { field: {greaterThan: value} }
2. Lost Neural API Methods
// ❌ MISSING - These were removed or not properly exposed:
brain.neural.similar(a, b)
brain.neural.clusters()
brain.neural.hierarchy(id)
brain.neural.neighbors(id)
brain.neural.outliers()
brain.neural.semanticPath(from, to)
brain.neural.visualize() // Critical for external tools!
brain.neural.clusterFast() // O(n) performance
brain.neural.clusterLarge() // Million-item support
3. Lost Import Capabilities
// ❌ WRONG - We made it too complex:
neuralImport.csv()
neuralImport.json()
neuralImport.text()
// ✅ CORRECT - Should be ONE simple method:
brain.neuralImport(data, options?) // Auto-detects format!
4. Lost Clustering for Visualization
The visualization data format for external tools (D3, Cytoscape, GraphML) is missing!
// ❌ MISSING - Critical for external visualization:
{
format: 'd3' | 'cytoscape' | 'graphml',
nodes: [...],
edges: [...],
layout: {...}
}
5. Oversimplified Search
// ❌ REMOVED too many methods:
searchByNounTypes()
searchWithinItems()
searchByStandardField()
searchVerbs()
searchNounsByVerbs()
// ✅ BUT this is actually OK if find() handles everything!
// Just need to ensure find() is complete
🔍 COMPARISON: Backup vs Current
Methods in BACKUP but NOT in current:
// From backup's brainyData.ts:
brain.neural // ❌ Not properly exposed
brain.visualize() // ❌ Missing
brain.clusters() // ❌ Missing
brain.similar() // ❌ Missing
brain.neuralImport() // ❌ Wrong implementation
// Operators in backup:
greaterThan, lessThan, equals // ❌ Replaced with $gt, $lt, $eq
oneOf, contains, matches // ❌ Replaced with $in, $contains, $regex
Methods we ADDED (some good, some questionable):
// New specific methods (GOOD ✅):
addNoun(), getNoun(), deleteNoun()
// Unified method (GOOD if complete ✅):
getNouns(idsOrOptions)
// But lost flexibility (BAD ❌):
- Can't do complex queries easily
- Lost specific search methods
📊 Feature Comparison Table
| Feature | Backup | Current | Status |
|---|---|---|---|
| Operators | greaterThan, lessThan | $gt, $lt | ❌ WRONG |
| Neural API | Complete (10+ methods) | Missing/Hidden | ❌ BROKEN |
| Clustering | Full support | Missing | ❌ LOST |
| Visualization | D3/Cytoscape export | None | ❌ LOST |
| Import | Simple neuralImport() | Complex multi-method | ❌ WRONG |
| Search | Multiple specific | Simplified to 2 | ⚠️ OK if complete |
| Verb Scoring | Full intelligence | Partial | ⚠️ CHECK |
| Synapses | External connectors | Unknown | ⚠️ CHECK |
| Conduits | Brainy-to-Brainy | Partial | ⚠️ CHECK |
🔧 WHAT WE NEED TO FIX IMMEDIATELY:
Priority 1 (CRITICAL):
-
Replace ALL MongoDB operators with Brainy operators
- This is a legal requirement!
- greaterThan not $gt
-
Restore Neural API completely
- brain.neural must have all methods
- Visualization MUST work for external tools
-
Fix neuralImport to be simple
- ONE method that auto-detects
- Not multiple complex methods
Priority 2 (IMPORTANT):
-
Restore clustering APIs
- For visualization tools
- For analysis
-
Verify Triple Intelligence is complete
- find() must handle everything
- All operators must work
-
Check augmentation system
- Synapses (external)
- Conduits (internal)
🎯 RECOVERY PLAN:
Step 1: Fix Operators (LEGAL REQUIREMENT)
- Find all $gt, $lt, $in, $regex references
- Replace with greaterThan, lessThan, oneOf, matches
- Update all documentation
Step 2: Restore Neural API
- Ensure brain.neural is properly exposed
- All methods available: similar, clusters, hierarchy, etc.
- Visualization must return proper format
Step 3: Fix Import
- Single neuralImport() method
- Auto-detection of format
- Simple options
Step 4: Verify Nothing Lost
- Compare method-by-method with backup
- Test all features
- Update documentation
💡 LESSONS LEARNED:
- Don't oversimplify - We lost important features
- Check legal requirements - MongoDB operators were avoided for a reason
- Preserve all features - Even if reorganizing
- Test against backup - Always compare functionality
- Document changes - Track what and why
🚀 NEXT ACTIONS:
- STOP all other work
- Fix operators IMMEDIATELY (legal risk)
- Restore neural API completely
- Test everything works
- Document the final API properly