Commit graph

26 commits

Author SHA1 Message Date
f3c305089c feat(reliability): implement automatic offline model detection for production
Add @soulcraft/brainy-models as optional dependency for zero-config offline reliability. Enhance robustModelLoader with hierarchical loading strategy (local → online → fail). Add comprehensive production deployment documentation and update README with clear benefits.

This solves critical production issues where Universal Sentence Encoder fails to load in Docker/Cloud Run environments due to network timeouts or blocked URLs. The solution provides 100% offline reliability while maintaining backward compatibility and requires no code changes from users.
2025-08-05 09:32:15 -07:00
24b0df8df5 fix(storage): resolve pagination warnings and improve S3 adapter performance
- Fix deprecated getAllNodes() warnings by using getNodesWithPagination() in S3 adapter
- Add getNounsWithPagination() method to S3CompatibleStorage for proper pagination support
- Create optimizedS3Search module for efficient pagination and filtering
- Update baseStorage to properly detect pagination support in adapters
- Add comprehensive documentation for performance and logging fixes
- Ensure backward compatibility with existing code

This resolves the following warnings in dependent projects:
- "getAllNodes() is deprecated and will be removed in a future version"
- "Storage adapter does not support pagination, falling back to loading all nouns"
- "Only returning the first 1000 nodes. There are more nodes available"
2025-08-05 07:22:05 -07:00
b32538b9f1 docs: add comprehensive performance docs and rebrand to Zero-to-Smart™
- Add complete PERFORMANCE_FEATURES.md with auto-configuration guide
- Document intelligent cache system with 100x performance improvements
- Add cursor-based pagination and real-time sync documentation
- Include distributed storage considerations and best practices
- Update README.md with performance highlights and auto-config features
- Replace "It Just Works™" with trademark-friendly "Zero-to-Smart™"
- Fix storage configuration examples for consistency
- All tests passing with zero breaking changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 14:33:39 -07:00
26e9c26852 feat(distributed): add distributed mode with multi-instance coordination
Implements Phase 1 and Phase 2 of distributed enhancements for horizontal scaling:

Phase 1 - Zero-Config Distributed Mode:
- Add DistributedConfigManager for shared S3 configuration coordination
- Implement explicit role configuration (reader/writer/hybrid) for safety
- Add instance registration with heartbeat and health monitoring
- Create hash-based partitioner for deterministic data distribution

Phase 2 - Intelligent Data Management:
- Add DomainDetector for automatic data categorization (medical, legal, product, etc.)
- Implement domain-aware search filtering for improved relevance
- Create role-based operational modes with specific optimizations
- Add HealthMonitor for comprehensive metrics tracking

Key Features:
- Multi-writer support with consistent hash partitioning
- Reader instances optimize for 80% cache utilization
- Writer instances optimize for batched writes
- Automatic domain detection and tagging
- Real-time health monitoring across all instances
- Cross-platform crypto utilities for browser compatibility

Safety Improvements:
- Require explicit role configuration (no automatic assignment)
- Validate role compatibility on startup
- Track instance health and performance metrics

Testing:
- Add comprehensive test suite for distributed features
- All 25 distributed tests passing
- Fixed domain filtering in search functionality

Documentation:
- Update README with distributed mode highlights
- Add examples showing reader/writer setup
- Document new capabilities and benefits

🤖 Generated with Claude Code
https://claude.ai/code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 12:18:58 -07:00
29625cc1af docs: add revised distributed implementation plan with practical phases
- Replace complex 8-enhancement proposal with simpler 3-phase approach
- Switch from semantic to hash-based partitioning for multi-writer scenarios
- Introduce zero-config distributed mode with automatic role detection
- Add shared JSON config coordination instead of complex locking mechanisms
- Focus on minimal user burden with progressive disclosure for advanced features
- Phase 1: Foundation with shared config and hash partitioning (3-4 days)
- Phase 2: Optimizations for caching and domain metadata (2-3 days)
- Phase 3: Optional advanced features for write-heavy workloads (3-4 days)
2025-08-04 11:20:23 -07:00
dd158c8073 feat(tools): propagate safety features to all projects
Enhanced the claude-commit tool with comprehensive safety features and
deployed them across all projects:

Safety improvements:
- Added mandatory review warning with visual indicators
- Implemented double confirmation before committing
- Added regenerate option for new commit messages
- Shows edited messages for review after modifications
- Added configuration file creation in setup script
- Created ~/.claude-commit.conf for user preferences

Deployment updates:
- Updated setup.sh with embedded safety features
- Copied enhanced script to github-package
- Copied enhanced script to bluesky-package
- Copied enhanced script to scout-search
- Updated dotfiles version for portability

Documentation:
- Updated CLAUDE.md with clear commit workflow for Claude Code
- Documented review-approve-commit-push process
- Added instructions for multi-machine consistency

These changes ensure consistent safety features across all projects
and machines, with mandatory review before any commit operation.
2025-08-04 10:28:01 -07:00
55b171bd44 feat(safety): enhance claude-commit with mandatory review and safety features
Added comprehensive safety features to prevent accidental commits and ensure
user review of all generated commit messages:

Safety enhancements:
- Added mandatory review warning with clear visual indicators
- Implemented double confirmation for all commit operations
- Added option to regenerate commit message if not satisfied
- Shows edited message for review after modifications
- Added explicit "no auto-push" reminders after commits
- Created ~/.claude-commit.conf for safety preferences

Documentation updates:
- Updated CLAUDE.md with clear commit workflow for Claude Code
- Added safety features section to tool documentation
- Clarified that manual review is always required
- Documented the review-approve-commit-push workflow

These changes ensure users always have full control over commit messages
and prevent accidental commits or pushes without explicit approval.
2025-08-04 10:21:52 -07:00
d2cef55644 feat(tools): add claude-commit AI-powered git commit tool
Implemented a comprehensive AI-powered commit message generator using Claude that:
- Automatically generates Conventional Commit formatted messages
- Analyzes git diff to create context-aware commit messages
- Works globally across all git repositories with 'git cc' command
- Supports multi-computer setup through portable dotfiles

Major changes:
- Added global claude-commit script with git aliases (git cc, git smart-commit)
- Created organized documentation in docs/tools/claude-commit/
- Included portable dotfiles structure for easy multi-machine deployment
- Updated README with TLDR Node.js quickstart section featuring all Brainy capabilities
- Moved documentation section to bottom of README for better flow
- Added CLAUDE.md with project-specific instructions for Claude Code

The tool eliminates manual commit message writing by leveraging AI to understand
code changes and generate properly formatted, meaningful commit messages that
follow the Conventional Commits specification.
2025-08-04 10:14:33 -07:00
9b3a8a2d05 docs: add distributed deployment architecture and enhancement proposals
- Add comprehensive guide for multi-instance S3-backed deployment
- Document configuration strategies for read/write separated instances
- Propose core enhancements for distributed operations
- Include implementation timeline and monitoring strategies

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 08:42:31 -07:00
e24a6eb527 feat(docs): add S3 migration guide for optimized data transfer strategies 2025-08-03 18:01:30 -07:00
24076c3eba feat(docs): add comprehensive user guides and installation instructions for Brainy 2025-08-03 17:33:52 -07:00
69ca8e1ced feat(docs): update README and add large-scale optimizations guide for v0.36.0
- Enhanced key features section with new optimizations
- Introduced a dedicated section for large-scale performance optimizations
- Added detailed auto-configuration setup instructions
- Included performance benchmarks and core optimization systems
- Created a new document for comprehensive large-scale optimizations
2025-08-03 17:22:32 -07:00
b846342681 **chore(docs): remove deprecated architecture documentation**
- **Documentation Removal**:
  - Deleted `brainy_architecture_diagram.md` and `brainy_architecture_visual.md`:
    - Removed outdated architecture descriptions, diagrams, and structured content no longer in use.

- **Purpose**:
  - Clean up legacy documentation to reduce confusion and ensure only the latest and most accurate resources are available for developers and stakeholders.
2025-08-02 16:54:10 -07:00
5f9e807952 **feat(docs): add comprehensive architecture documentation for Brainy**
- **Documentation Additions**:
  - Created `brainy_architecture_diagram.md` to detail Brainy's architecture using diagrams and structured descriptions:
    - Added overviews of the system, core architecture, and augmentation pipeline.
    - Defined data models, graph structures, storage architecture, and performance optimizations.
    - Explained vector search engine design, HNSW index structure, and usage flow examples.
  - Developed `brainy_architecture_visual.md` to complement the architecture with visual aids in Mermaid.js:
    - Provided detailed flowcharts, mind maps, and sequence diagrams for system components and data flow.

- **Purpose**:
  - Provide in-depth technical insights into Brainy's architecture for developers and stakeholders.
  - Enhance understanding of the system's core design principles with easy-to-follow diagrams and examples.
2025-08-02 16:05:48 -07:00
25dd68e9e7 **feat(brainy-models): implement robust format field validation and update workflow scripts**
- **Documentation**:
  - Added a detailed explanation in `model-management.md` for resolving `"format"` field compatibility issues in TensorFlow.js.
  - Introduced a dual-layer protection approach to mitigate errors like `RangeError: byte length of Float32Array should be a multiple of 4`.

- **Scripts**:
  - Removed the redundant `release:minor` script entry from `package.json`.
  - Enhanced `_deploy` script consistency.

- **Protection Mechanisms**:
  - Updated `download-full-models.js` to inject a missing `"format"` field during downloads.
  - Enhanced `RobustModelLoader` to validate and restore the `"format"` field automatically at runtime, ensuring persistence and compatibility
2025-08-01 18:00:36 -07:00
1539ba74de **chore(archive): remove outdated documentation and summaries**
- Deleted the following obsolete files:
  - `CHANGES.md`, `changes-summary.md`, `CHANGES_SUMMARY.md`: Contained redundant or outdated change logs and implementation summaries.
  - `COMPATIBILITY.md`: Detailed compatibility behavior no longer relevant after environment detection updates.
  - `fix-documentation.md`: Addressed a resolved issue regarding `process.memoryUsage` errors in testing.
  - `DIMENSION_MISMATCH_SUMMARY.md`: Provided a legacy summary of resolved embedding dimension mismatch issues.
  - `demo.md`: Documented an outdated demo process for testing Brainy features.
  - `CONCURRENCY_IMPLEMENTATION_SUMMARY.md`: Summarized already-documented concurrency features.
  - `IMPLEMENTATION_SUMMARY.md`: Detailed an obsolete implementation of optional model bundling.

- Purpose:
  - Streamline and declutter archive by removing redundant or outdated documentation.
  - Align repository with current feature set and documentation standards.
2025-08-01 16:21:35 -07:00
42571c5883 **feat(docs): add comprehensive documentation for model bundling and robust loading**
- Introduced new documentation files under `docs/`:
  - `model-bundling-analysis.md`: Provides detailed analysis of current, bundled, hybrid, and dynamic model loading approaches, including pros, cons, and recommendations.
  - `model-management.md`: Explains how Brainy manages Universal Sentence Encoder models, including setup, usage, and troubleshooting.
  - `optional-model-bundling.md`: Details the `@soulcraft/brainy-models` package for offline reliability with pre-bundled models.

- Added `src/utils/robustModelLoader.ts`:
  - Implements enhanced model loading with retry mechanisms, timeout handling, fallback URLs, and optional local model bundling.
  - Supports Node.js and browser environments with exponential backoff logic.

- Key Updates:
  - **Hybrid Loading Strategy**: Recommended for balancing reliability and flexibility via hybrid online/offline mechanisms.
  - **Enhanced Fallback Scenarios**: Robust loader improves network-dependent reliability for embedding workflows.
  - **Offline Reliability Support**: Optional model bundling eliminates dependency on external services, supporting air-gapped and edge environments.

**Purpose**: Introduce a hybrid model loading approach with robust options for
2025-08-01 15:35:29 -07:00
69f8b999ea **feat(docs): add comprehensive cache configuration guide and enhance adaptive tuning**
- Added `cache-configuration.md` under `docs/guides`:
  - Detailed multi-level cache system (hot, warm, cold) overview.
  - Explained new adaptive tuning capabilities:
    - Memory-based adjustments across Node.js, Browser, and Worker environments.
    - Dynamic sizing for read-heavy/write-heavy workloads.
    - Environment-specific configurations for optimal caching.
  - Included best practices for large datasets, memory-constrained and read-only environments.
  - Added monitoring and advanced manual tuning instructions.
- Modified `cacheManager.ts`:
  - Introduced `environmentConfig` for tailored per-environment cache settings.
  - Enhanced auto-tuning with support for dynamic memory detection and cache hit/miss ratio.
  - Added fine-grained tuning for eviction thresholds, TTLs, and batch sizes based on workload characteristics.
  - Improved adaptive tuning with async memory detection and detailed cache statistics tracking.

**Purpose**: Provide developers with detailed guidance and dynamic tools for optimizing Brainy's cache system, ensuring better performance across diverse environments and workloads.
2025-08-01 11:47:34 -07:00
6ee0881d86 **docs(guides): add service identification guide**
- Created `service-identification.md` in `docs/guides`:
  - Detailed guidelines on how services should identify themselves within Brainy.
  - Documented two identification methods: default service initialization and operation-specific service naming.
  - Included service name conventions and common examples (`github`, `reddit`, `default`).
- Described benefits of proper service identification:
  - Enhanced statistics tracking and JSON field discovery by service.
- Provided best practices for consistent and descriptive service naming.
- Explained internal implementation details, such as `getServiceName` usage and statistic tracking.

**Purpose**: Help users properly identify services to enable statistics tracking, field discovery, and improved data management in Brainy.
2025-08-01 10:16:18 -07:00
f86295eab8 **feat(search): enhance JSON document search with field-level filtering and prioritization**
- Added support for field-specific and prioritized searches in `brainyData`:
  - Introduced `searchField` option to enable targeted field-level searches.
  - Implemented `priorityFields` option for weighted vectorization and query relevance.
- Developed utilities in `jsonProcessing.ts` and `fieldNameTracking.ts`:
  - `extractTextFromJson` for text extraction with customizable depth and field prioritization.
  - `extractFieldFromJson` to target specific fields in JSON documents.
  - `prepareJsonForVectorization` for optimized JSON vectorization.
- Enhanced management of field names and mappings:
  - Integrated `trackFieldNames` to associate fields with their services.
  - Supported cross-service consistency through `standardFieldMappings`.
- Updated documentation:
  - Added detailed guides for JSON search enhancements and HNSW limitations.
  - Extended usage examples in `README.md` and `json-search-test.js`.
- Verified improvements with comprehensive tests:
  - Created unit and integration tests demonstrating search behavior improvements.
  - Addressed previous TypeScript errors related to search parameters.

**Purpose**: Improve search accuracy and usability when working with complex JSON documents by enabling field-specific searches and enhancing contextual relevance.
2025-08-01 08:27:39 -07:00
79df44351c **chore: remove outdated changelog and summary documents**
- Deleted `CHANGES.md`, `CHANGES_SUMMARY.md`, `CONCURRENCY_ANALYSIS.md`, `CONCURRENCY_IMPLEMENTATION_SUMMARY.md`, and related developer documentation files.
- Removed redundant or legacy content no longer aligned with the current codebase and workflows.
- Updated repository to reflect streamlined documentation approach, reducing clutter and improving maintainability.

**Purpose**: Simplify and declutter repository by removing obsolete documentation files, ensuring it remains focused and relevant.
2025-07-30 11:51:39 -07:00
f0db5b471f **feat(tests): add tests for TextEncoder, TensorFlow.js, and fallback mechanisms**
- Introduced `test-fallback-function.js` and `test-fallback-simple.js` to validate `executeInThread` fallback functionality with both named and anonymous compute-intensive functions.
- Added `test-tensorflow-textencoder.js` for TensorFlow.js and TextEncoder tests in a Node.js environment.
- Created `test-tensorflow-textencoder.html` for browser-based TensorFlow.js and TextEncoder tests.
- Implemented cross-environment test support in `cli-package/src/test-tensorflow-textencoder.ts` for CLI functionality.
- Enhanced `src/utils/embedding.ts`, `textEncoding.ts`, and `brainy-wrapper.js` to include updated global `TextEncoder` and `TextDecoder` utilities for compatibility and worker improvements.
- Standardized and expanded utility methods in `PlatformNode` for broader support, including `isFloat32Array` and `isTypedArray` checks.
- Updated Node.js requirement to `>= 24.4.0` across documentation and configuration files for compatibility improvements.

This update introduces comprehensive testing for fallback mechanisms, TensorFlow.js, and TextEncoder across multiple environments, ensuring robustness and compatibility.
2025-07-11 11:11:56 -07:00
00039f836f **chore(release): bump version to 0.10.0 and refactor project structure**
- Updated version to `0.10.0` in `README.md`, `cli-package/package.json`, and `src/utils/version.ts`.
- Removed `CHANGELOG.md` from the root and `cli-package`, as GitHub auto-generates release notes.
- Refactored `brainy-wrapper.js` to simplify utility methods (`isFloat32Array` and `isTypedArray`) by moving them to instance-level definitions.
- Standardized Node.js version requirement to `>= 24.3.0` across documentation and configuration files.
- Improved `textEncoding.ts` by introducing a unified `Platform` class for cross-environment compatibility (Node.js and browser).
- Restructured scripts:
  - Replaced outdated commands (e.g., `test-cli` -> `test:cli` and `test-all` -> `test:all`) for consistency.
  - Removed changelog updates from `scripts/create-github-release.js` as part of simplification.
- Enhanced `patch-textencoder.js` to also patch `worker.js` for both `TextEncoder` and `TextDecoder`.

This release improves compatibility with Node.js 24, simplifies the deployment/changelog process, and refines text encoding and worker functionalities.
2025-07-07 10:19:04 -07:00
2fea43acd6 docs: update Node.js version requirement to 23.0.0 in documentation 2025-07-04 10:27:07 -07:00
be56ea52b7 **chore(version): bump version to 0.9.30 and enhance publishing instructions**
- Updated version to `0.9.30` in `package.json`, `cli-package/package.json`, `src/utils/version.ts`, and `README.md`.
- Synced `@soulcraft/brainy` dependency version to `0.9.30` for CLI package consistency.
- Modified npm version badge in `README.md` to reflect the new version.
- Added detailed publishing instructions in `docs/publishing-cli.md` to guide users on publishing both, main, or CLI packages.
- Introduced new npm scripts `publish:cli` and `build:cli` for streamlined package-specific operations.

This update ensures cohesive versioning, provides clearer publishing guidelines, and improves maintainability with new build/publish scripts.
2025-07-02 16:33:30 -07:00
7e3e6654a9 **feat(cli, scripts): introduce CLI package and automated publishing process**
- Added a new `@soulcraft/brainy-cli` package to provide a dedicated CLI interface for the Brainy database.
- Implemented a CLI wrapper script (`cli-wrapper.js`) to manage global package execution and version handling.
- Introduced `scripts/publish-cli.js` to automate synchronized publishing of the main package and CLI, ensuring version consistency.
- Created documentation for CLI usage and publishing workflow (`publishing-cli.md`).
- Updated `package.json` to include CLI-related build and deploy scripts.
- Adjusted `README.md` to document the CLI package, usage instructions, and build separation.

This feature introduces a standalone CLI package, improves deployment automation, and enhances documentation to align with the updated architecture.
2025-07-02 11:32:06 -07:00