{"id":"3271add1-ce4d-4ec3-8656-bc3d14112f9e","slug":"tinybrain","kind":"mcp","name":"tinybrain","summary":"LLM local persistent storage for security nerds","owner":"rainmana","repoUrl":"https://github.com/rainmana/tinybrain","license":"MIT","licenseTier":"permissive","trust":"community","stars":4,"match":null,"fewStars":true,"format":"mcp","createdAt":"2025-10-07T22:06:38.000Z","addedAt":"2026-10-21T04:06:54.951Z","logoUrl":"https://avatars.githubusercontent.com/u/66031080?u=4470e8781997ab0f900f953b13c3eaf3b48ce80b&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["developer-tools","cloud-infra","memory-knowledge"],"tags":["knowledge-graph","llm","penetration-testing","penetration-testing-tools"],"runtime":"go","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-21T04:07:15.716Z","sample":false,"url":"https://conduits.dev/tools/tinybrain","language":"Go","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# TinyBrain 🧠\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Go Version](https://img.shields.io/badge/Go-1.24+-blue.svg)](https://golang.org/)\n[![MCP Protocol](https://img.shields.io/badge/MCP-Protocol-green.svg)](https://modelcontextprotocol.io/)\n[![Security Focused](https://img.shields.io/badge/Security-Focused-red.svg)](https://github.com/rainmana/tinybrain)\n[![Version](https://img.shields.io/badge/version-v3.0.1-blue.svg)](https://github.com/rainmana/tinybrain/releases)\n\n**Security-Focused LLM Memory Storage with Intelligence Gathering, Reverse Engineering, and MITRE ATT&CK Integration**\n\nTinyBrain is a comprehensive memory storage system designed specifically for security professionals, penetration testers, and AI assistants working on offensive security tasks. It provides intelligent memory management, pattern recognition, and comprehensive intelligence gathering capabilities through the Model Context Protocol (MCP).\n\n📖 **[View Complete Documentation](https://rainmana.github.io/tinybrain/)** | 🐛 [Report Issues](https://github.com/rainmana/tinybrain/issues) | 💬 [Discussions](https://github.com/rainmana/tinybrain/discussions)\n\n## ✨ Key Features\n\n### 🧠 Intelligence Gathering\n- **OSINT**: Open Source Intelligence collection and analysis\n- **HUMINT**: Human Intelligence gathering and social engineering assessment\n- **SIGINT**: Signals Intelligence and communications analysis\n- **GEOINT**: Geospatial Intelligence and location-based analysis\n- **MASINT**: Measurement and Signature Intelligence\n- **TECHINT**: Technical Intelligence and technology assessment\n- **FININT**: Financial Intelligence and cryptocurrency tracking\n- **CYBINT**: Cyber Intelligence and threat analysis\n\n### 🔍 Reverse Engineering\n- **Malware Analysis**: Static and dynamic malware analysis capabilities\n- **Binary Analysis**: PE, ELF, Mach-O file format analysis\n- **Vulnerability Research**: Fuzzing, exploit development, and vulnerability analysis\n- **Protocol Analysis**: Network and application protocol reverse engineering\n- **Code Analysis**: Source code and assembly analysis tools\n\n### 🎯 MITRE ATT&CK Integration\n- **Complete Framework**: All 14 Enterprise tactics and 200+ techniques\n- **TTP Mapping**: Map findings to specific tactics, techniques, and procedures\n- **Attack Chain Analysis**: Complete attack chain mapping and analysis\n- **Threat Hunting**: Hunt for specific TTPs and attack patterns\n- **Campaign Tracking**: Track attack campaigns and threat actor activities\n- **Real-Time Data**: Live MITRE ATT&CK dataset with 823+ techniques and 14 tactics\n- **Intelligent Querying**: Semantic search across attack techniques and procedures\n\n### 🛡️ Security Patterns & Standards\n- **CWE Integration**: Common Weakness Enumeration patterns and classifications\n- **OWASP Compliance**: OWASP Top 10 2021 and testing guide integration\n- **Multi-Language Support**: Security patterns for 10+ programming languages\n- **Authorization Templates**: RBAC, ABAC, and DAC access control patterns\n- **Standards Compliance**: NIST, ISO 27001, PTES, and industry standards\n- **NVD Integration**: National Vulnerability Database with 314,835+ CVEs\n- **OWASP Testing Guide**: Complete web application security testing procedures\n\n### 🔬 Security Knowledge Hub\n- **NVD Integration**: National Vulnerability Database with 314,835+ CVEs\n- **MITRE ATT&CK**: Complete framework with 823+ techniques and 14 tactics\n- **OWASP Testing Guide**: Comprehensive web application security testing procedures\n- **Intelligent Retrieval**: Context-aware querying with summarization\n- **Real-Time Updates**: Incremental data updates from official sources\n- **Rate Limiting**: Respectful API usage with proper rate limiting\n\n### 📊 Memory Management\n- **30+ Memory Categories**: Comprehensive categorization for intelligence, reconnaissance, and analysis data\n- **Intelligence Objects**: Threat actors, attack campaigns, IOCs, TTPs, patterns, and correlations\n- **Context-Aware Storage**: Automatically categorizes and prioritizes information\n- **Advanced Search**: Semantic, exact, fuzzy, tag-based, and relationship-based search\n- **Access Tracking**: Monitors which memories are most relevant and frequently accessed\n- **Context Summaries**: Provides relevant memory summaries for current tasks\n\n### High Performance & Reliability\n- **Embedded SQLite Backend**: Single binary with a pure-Go SQLite engine (no cgo) and FTS5 full-text search\n- **Dashboard**: Web-based status dashboard at http://127.0.0.1:8090/_/ (in `serve` mode)\n- **REST API**: Full REST API at http://127.0.0.1:8090/api/ for external integrations\n- **MCP Protocol**: JSON-RPC 2.0 over stdio for AI assistant integration\n- **Optimized Queries**: Indexed searches and efficient relationship traversal\n- **Transaction Safety**: ACID compliance for data integrity\n- **Concurrent Access**: Thread-safe operations for multiple LLM interactions\n- **Zero Configuration**: Works out of the box with minimal setup\n\n### AI-Enhanced Search & Intelligence\n- **Semantic Search**: AI-powered memory search using embeddings for conceptual similarity\n- **Embedding Generation**: Generate embeddings for text (placeholder for AI integration)\n- **Similarity Calculation**: Calculate semantic similarity between embeddings\n- **Future-Ready**: Complete foundation for OpenAI, Cohere, or local model integration\n\n### Real-Time Notifications & Alerts\n- **Memory Notifications**: Real-time alerts for memory events and system activities\n- **High Priority Alerts**: Notifications for high-priority memories (priority ≥8, confidence ≥0.8)\n- **Duplicate Detection**: Alerts for potential duplicate memories with similarity scores\n- **Cleanup Notifications**: Notifications for automated cleanup operations\n- **Notification Management**: Mark notifications as read, filter by session, priority-based sorting\n\n### Developer Experience\n- **Simple Installation**: `go install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest`\n- **Comprehensive Logging**: Detailed logging with structured output\n- **Extensive Testing**: Full test coverage for all MCP tool handlers\n- **Docker Support**: Containerized deployment ready\n- **50+ MCP Tools**: Complete API for all memory management operations\n- **Single Binary**: MCP server, REST API, and dashboard in one executable\n\n## 🛠️ Complete MCP Tool Set (50+ Tools)\n\nTinyBrain provides a comprehensive set of more than 50 MCP tools for complete LLM memory management:\n\n### Core Memory Operations (8 tools)\n- `store_memory` - Store new memory entries\n- `get_memory` - Retrieve memory by ID\n- `search_memories` - Advanced search with multiple strategies\n- `update_memory` - Update existing memory entries\n- `delete_memory` - Delete memory entries\n- `find_similar_memories` - Find similar memories by content\n- `check_duplicates` - Check for duplicate memories\n- `get_memory_stats` - Get comprehensive memory statistics\n\n### Session & Task Management (6 tools)\n- `create_session` - Create new security assessment sessions\n- `get_session` - Retrieve session information\n- `list_sessions` - List all sessions with filtering\n- `create_task_progress` - Create task progress entries\n- `update_task_progress` - Update task progress\n- `list_task_progress` - List task progress entries\n\n### Advanced Memory Features (8 tools)\n- `create_relationship` - Create memory relationships\n- `get_related_memories` - Get related memories\n- `create_context_snapshot` - Create context snapshots\n- `get_context_snapshot` - Retrieve context snapshots\n- `list_context_snapshots` - List context snapshots\n- `get_context_summary` - Get memory summaries for context\n- `export_session_data` - Export session data\n- `import_session_data` - Import session data\n\n### Security Templates & Batch Operations (6 tools)\n- `get_security_templates` - Get predefined security templates\n- `create_memory_from_template` - Create memories from templates\n- `batch_create_memories` - Bulk create memory entries\n- `batch_update_memories` - Bulk update memory entries\n- `batch_delete_memories` - Bulk delete memory entries\n- `get_detailed_memory_info` - Get detailed memory debugging info\n\n### Memory Lifecycle & Cleanup (4 tools)\n- `cleanup_old_memories` - Age-based memory cleanup\n- `cleanup_low_priority_memories` - Priority-based cleanup\n- `cleanup_unused_memories` - Access-based cleanup\n- `get_system_diagnostics` - Comprehensive system diagnostics\n\n### AI-Enhanced Search (3 tools)\n- `semantic_search` - AI-powered semantic search\n- `generate_embedding` - Generate embeddings for text\n- `calculate_similarity` - Calculate embedding similarity\n\n### Real-Time Notifications (4 tools)\n- `get_notifications` - Get notifications and alerts\n- `mark_notification_read` - Mark notifications as read\n- `check_high_priority_memories` - Check for high-priority alerts\n- `check_duplicate_memories` - Check for duplicate alerts\n\n### System Monitoring (1 tool)\n- `health_check` - Perform system health checks\n\n## 🛡️ Security Standards & Source Attribution\n\n### **Standards Compliance**\nTinyBrain's security patterns and vulnerability datasets are aligned with industry-standard security frameworks:\n\n- **[OWASP Top 10 2021](https://owasp.org/Top10/)** - Web Application Security Risks\n- **[CWE (Common Weakness Enumeration)](https://cwe.mitre.org/)** - Software Weakness Classification\n- **[NIST SP 800-115](https://csrc.nist.gov/publications/detail/sp/800-115/final)** - Technical Guide to Information Security Testing\n- **[ISO 27001](https://www.iso.org/isoiec-27001-information-security.html)** - Information Security Management Systems\n- **[PTES (Penetration Testing Execution Standard)](http://www.pentest-standard.org/)** - Penetration Testing Methodology\n\n### **Source Attribution**\nOur security patterns and vulnerability datasets are based on authoritative sources:\n\n- **[OWASP Code Review Guide](https://github.com/OWASP/www-project-code-review-guide)** - Comprehensive secure code review methodology\n- **[OWASP Secure Coding Dojo](https://owasp.org/SecureCodingDojo/codereview101/)** - Interactive security code review training\n- **[OWASP Testing Guide](https://owasp.org/www-project-web-security-testing-guide/)** - Web application security testing methodology\n- **[SANS Top 25 CWE](https://cwe.mitre.org/top25/)** - Most dangerous software errors\n- **[NIST Cybersecurity Framework](https://www.nist.gov/cyberframework)** - Cybersecurity risk management\n\n### **Multi-Language Coverage**\nOur security patterns cover 10 major programming languages with language-specific vulnerability patterns:\n\n- **JavaScript/Node.js** - Web application security patterns\n- **Python** - Backend and automation security patterns  \n- **Java** - Enterprise application security patterns\n- **C#/.NET** - Microsoft ecosystem security patterns\n- **PHP** - Web application security patterns\n- **Ruby** - Web framework security patterns\n- **Go** - System and API security patterns\n- **C/C++** - System-level security patterns\n- **TypeScript** - Type-safe web application patterns\n- **Rust** - Memory-safe system programming patterns\n\n## 🚀 Quick Start\n\n### Installation\n\n#### Option 1: Pre-built Binaries (Recommended)\n\nDownload the latest release for your platform from [Releases](https://github.com/rainmana/tinybrain/releases):\n\n- **macOS (Apple Silicon)**: `tinybrain_*_Darwin_arm64.tar.gz`\n- **macOS (Intel)**: `tinybrain_*_Darwin_x86_64.tar.gz`\n- **Linux (x86_64)**: `tinybrain_*_Linux_x86_64.tar.gz`\n- **Linux (ARM64)**: `tinybrain_*_Linux_arm64.tar.gz`\n- **Windows**: `tinybrain_*_Windows_x86_64.zip`\n\nExtract and run:\n```bash\n# Extract (Linux/macOS)\ntar -xzf tinybrain_*_*.tar.gz\ncd tinybrain_*\n\n# Make executable\nchmod +x tinybrain\n\n# Run\n./tinybrain serve\n```\n\n#### Option 2: Install from Source with go install\n\n```bash\n# Install latest version\ngo install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest\n\n# Install specific version\ngo install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest\n\n# The binary will be installed as 'tinybrain' in your $GOPATH/bin or $GOBIN\n# Make sure $GOPATH/bin or $GOBIN is in your PATH\n```\n\n#### Option 3: Clone and Build Locally\n\n```bash\ngit clone https://github.com/rainmana/tinybrain.git\ncd tinybrain\ngo build -o tinybrain ./cmd/tinybrain\n```\n\n#### Option 4: Docker\n\n```bash\ndocker pull rainmana/tinybrain:latest\ndocker run -p 8090:8090 rainmana/tinybrain\n```\n\n### Claude Code Plugin (MCP server + skills in one install)\n\nTinyBrain ships as a Claude Code plugin that registers the MCP server **and** installs\nskills teaching Claude how to use it well (capture findings as you go, build an engagement\nknowledge graph, recall it across sessions). The plugin includes a core `using-tinybrain`\nskill plus domain workflows for code review, CTFs, and threat intelligence.\n\nFirst install the binary (the plugin's MCP config runs `tinybrain` from your PATH):\n\n```bash\ngo install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest\n```\n\nThen add the marketplace and install the plugin from inside Claude Code:\n\n```\n/plugin marketplace add rainmana/tinybrain\n/plugin install tinybrain@tinybrain-marketplace\n```\n\nThat's it — the `tinybrain` MCP server is registered (pointed at `~/.tinybrain/memory.db`)\nand the skills activate automatically when you do security work. To point at a different\ndatabase, set `TINYBRAIN_DB_PATH` in your environment before launching Claude Code.\n\n### Basic Usage\n\n```bash\n# Start the server (data stored in ~/.tinybrain by default)\ntinybrain serve\n\n# Or specify a custom data directory\ntinybrain serve --dir /path/to/your/data\n\n# Customize the HTTP host/port (default is 127.0.0.1:8090)\ntinybrain serve --port 9000\ntinybrain serve --host 0.0.0.0 --port 8090\n\n# Or use environment variables\nTINYBRAIN_HOST=0.0.0.0 TINYBRAIN_PORT=9000 tinybrain serve\n\n# Access the dashboard\nopen http://127.0.0.1:8090/_/\n\n# The REST API is available at:\n# http://127.0.0.1:8090/api/\n```\n\nIn `serve` mode TinyBrain speaks the MCP protocol over stdio *and* serves the\nREST API/dashboard over HTTP. Running plain `tinybrain` (no subcommand) starts\na stdio-only MCP server, which is what most MCP client configs use.\n\n### Server Features\n\n- **Single Binary**: Everything in one executable with zero configuration\n- **Dashboard**: Web interface at http://127.0.0.1:8090/_/ for stats and links\n- **REST API**: Sessions and memory endpoints at http://127.0.0.1:8090/api/\n- **Optional Auth**: Set `TINYBRAIN_API_TOKEN` to require a bearer token on the REST API\n- **Data Persistence**: SQLite database at `<dir>/memory.db` (default `~/.tinybrain/memory.db`)\n- **MCP over stdio**: JSON-RPC 2.0; works with Claude Desktop, Cursor, Cline, and any MCP client\n\n### Intelligence Gathering Example\n\n```go\n// Create an OSINT intelligence session\nsession := &Session{\n    Name: \"OSINT Intelligence Gathering\",\n    TaskType: \"intelligence_analysis\",\n    IntelligenceType: \"osint\",\n    Classification: \"unclassified\",\n    ThreatLevel: \"medium\",\n}\n\n// Store intelligence findings\nfinding := &IntelligenceFinding{\n    Title: \"Social Media Intelligence\",\n    IntelligenceType: \"osint\",\n    ThreatLevel: \"medium\",\n    MITRETactic: \"TA0001\",\n    MITRETechnique: \"T1591\",\n    KillChainPhase: \"reconnaissance\",\n}\n```\n\n### MCP Integration\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"tools/call\",\n  \"params\": {\n    \"name\": \"mcp_tinybrain-mcp-server_create_session\",\n    \"arguments\": {\n      \"name\": \"Security Assessment\",\n      \"task_type\": \"penetration_test\",\n      \"intelligence_type\": \"osint\"\n    }\n  }\n}\n```\n\n### Troubleshooting Installation\n\nIf you encounter issues with `go install`, try these solutions:\n\n```bash\n# Standard install (note the /v3 in the module path — required for v3.x)\ngo install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest\n\n# Build from a clone instead\ngit clone https://github.com/rainmana/tinybrain.git\ncd tinybrain\ngo build -o tinybrain ./cmd/tinybrain\n\n# For Go module proxy issues, use direct mode\nGOPROXY=direct go install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest\n\n# For checksum database errors right after a new release\nGOSUMDB=off go install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest\n```\n\n**Common Issues**:\n- **\"module path must match major version\" error**: Include the `/v3` in the path — `go install github.com/rainmana/tinybrain/v3/cmd/tinybrain@latest`\n- **Binary not found**: Ensure `$GOPATH/bin` or `$GOBIN` is in your PATH\n- **Checksum errors**: Wait a few minutes after a new release, or temporarily use `GOSUMDB=off`\n\n### MCP Client Configuration\n\nAdd to your MCP client configuration (e.g., Claude Desktop):\n\n```json\n{\n  \"mcpServers\": {\n    \"tinybrain\": {\n      \"command\": \"tinybrain\",\n      \"args\": [\"serve\"],\n      \"env\": {\n        \"TINYBRAIN_DB_PATH\": \"~/.tinybrain/memory.db\"\n      }\n    }\n  }\n}\n```\n\n**Note**: The binary name is `tinybrain` (from `cmd/tinybrain`); `go install github.com/rainmana/tinybrain/v3/cmd/server@latest` installs the same program as `server`. The SQLite database is created at `~/.tinybrain/memory.db` by default.\n\n## 📚 Documentation\n\nFor complete documentation, API reference, and detailed guides, visit our comprehensive documentation site:\n\n### 📖 **[Complete Documentation](https://rainmana.github.io/tinybrain/)**\n\nThe documentation includes:\n- **[Getting Started](https://rainmana.github.io/tinybrain/getting-started/)** - Installation and basic usage\n- **[Core Features](https://rainmana.github.io/tinybrain/core-features/)** - Memory management, sessions, and search\n- **[Intelligence & Reconnaissance](https://rainmana.github.io/tinybrain/intelligence/)** - OSINT, HUMINT, SIGINT, and more\n- **[Reverse Engineering](https://rainmana.github.io/tinybrain/reverse-engineering/)** - Malware analysis and vulnerability research\n- **[Security Patterns](https://rainmana.github.io/tinybrain/security-patterns/)** - CWE, OWASP, and multi-language patterns\n- **[Integration](https://rainmana.github.io/tinybrain/integration/)** - AI assistant integration and development setup\n- **[API Reference](https://rainmana.github.io/tinybrain/api-reference/)** - Complete MCP tools and REST API documentation\n- **[Contributing](https://rainmana.github.io/tinybrain/contributing/)** - Guidelines for contributors\n\n### Quick API Reference\n\n#### Session Management\n\n**Task Types**: `security_review`, `penetration_test`, `exploit_dev`, `vulnerability_analysis`, `threat_modeling`, `incident_response`, `intelligence_analysis`\n\n**Intelligence Types**: `osint`, `humint`, `sigint`, `geoint`, `masint`, `techint`, `finint`, `cybint`\n\n#### List Sessions\n```json\n{\n  \"name\": \"list_sessions\",\n  \"arguments\": {\n    \"task_type\": \"security_review\",\n    \"status\": \"active\",\n    \"limit\": 10\n  }\n}\n```\n\n### Memory Operations\n\n#### Store Memory\n```json\n{\n  \"name\": \"store_memory\",\n  \"arguments\": {\n    \"session_id\": \"session_123\",\n    \"title\": \"SQL Injection in Login Form\",\n    \"content\": \"Found SQL injection vulnerability in username parameter of login form. Payload: ' OR 1=1--\",\n    \"category\": \"vulnerability\",\n    \"content_type\": \"text\",\n    \"priority\": 8,\n    \"confidence\": 0.9,\n    \"tags\": \"[\\\"sql-injection\\\", \\\"authentication\\\", \\\"critical\\\"]\",\n    \"source\": \"manual-testing\"\n  }\n}\n```\n\n**Categories**: `finding`, `vulnerability`, `exploit`, `payload`, `technique`, `tool`, `reference`, `context`, `hypothesis`, `evidence`, `recommendation`, `note`\n\n#### Search Memories\n```json\n{\n  \"name\": \"search_memories\",\n  \"arguments\": {\n    \"query\": \"SQL injection authentication\",\n    \"session_id\": \"session_123\",\n    \"search_type\": \"semantic\",\n    \"categories\": \"[\\\"vulnerability\\\", \\\"exploit\\\"]\",\n    \"min_priority\": 7,\n    \"limit\": 20\n  }\n}\n```\n\n**Search Types**: `semantic`, `exact`, `fuzzy`, `tag`, `category`, `relationship`\n\n#### Get Related Memories\n```json\n{\n  \"name\": \"get_related_memories\",\n  \"arguments\": {\n    \"memory_id\": \"memory_456\",\n    \"relationship_type\": \"exploits\",\n    \"limit\": 10\n  }\n}\n```\n\n### Relationship Management\n\n#### Create Relationship\n```json\n{\n  \"name\": \"create_relationship\",\n  \"arguments\": {\n    \"source_memory_id\": \"memory_123\",\n    \"target_memory_id\": \"memory_456\",\n    \"relationship_type\": \"exploits\",\n    \"strength\": 0.8,\n    \"description\": \"SQL injection can be used to bypass authentication\"\n  }\n}\n```\n\n**Relationship Types**: `depends_on`, `causes`, `mitigates`, `exploits`, `references`, `contradicts`, `supports`, `related_to`, `parent_of`, `child_of`\n\n### Context Management\n\n#### Get Context Summary\n```json\n{\n  \"name\": \"get_context_summary\",\n  \"arguments\": {\n    \"session_id\": \"session_123\",\n    \"current_task\": \"Analyzing authentication vulnerabilities\",\n    \"max_memories\": 20\n  }\n}\n```\n\n## 🏗️ Architecture\n\nTinyBrain is built with:\n- **Go 1.24+** - High-performance backend\n- **modernc.org/sqlite** - Pure-Go embedded SQLite with FTS5 full-text search (no cgo)\n- **MCP Protocol** - LLM integration standard with 50+ tools over stdio (JSON-RPC 2.0)\n- **MITRE ATT&CK** - Security framework integration\n- **Jekyll** - Documentation site with Minimal theme\n\n### Single-Binary Benefits\n\n- **No External Dependencies**: Works anywhere Go runs; CGO-free cross-compilation\n- **Embedded Database**: SQLite database file managed by the binary\n- **Dashboard**: Built-in status dashboard at `/_/`\n- **REST API**: Full REST API for external integrations and automation\n- **Zero Configuration**: Works out of the box with sensible defaults\n- **Data Persistence**: All data automatically persisted across restarts\n\n### Key Design Principles\n\n1. **Security-First**: All data structures and operations designed for security tasks\n2. **Intelligence-Focused**: Comprehensive intelligence gathering and analysis capabilities\n3. **Performance**: Optimized queries and indexes for fast retrieval\n4. **Flexibility**: Extensible schema and relationship system\n5. **Reliability**: ACID transactions and data integrity checks\n6. **Usability**: Simple API with comprehensive documentation\n\n## 🧪 Testing\n\n```bash\n# Run all tests\nmake test\n\n# Run tests with coverage\ngo test -v -race -coverprofile=coverage.out ./...\ngo tool cover -html=coverage.out -o coverage.html\n\n# Run benchmarks\nmake bench\n\n# Run specific test\ngo test -v ./internal/database -run TestNewDatabase\n```\n\n## 🐳 Docker Deployment\n\n```bash\n# Build Docker image\nmake docker-build\n\n# Run container\ndocker run --rm -it \\\n  -v ~/.tinybrain:/app/data \\\n  tinybrain:latest\n```\n\n## 📊 Performance\n\n### Benchmarks\n\n- **Memory Entry Creation**: ~1000 entries/second\n- **Search Operations**: ~100 searches/second\n- **Relationship Queries**: ~500 queries/second\n- **Database Size**: ~1MB per 10,000 memory entries\n\n### Optimization Features\n\n- **Connection Pooling**: Optimized for SQLite single-writer model\n- **Index Strategy**: Comprehensive indexing for all query patterns\n- **Full-Text Search**: FTS5 virtual tables for semantic search\n- **Caching**: Access pattern tracking for intelligent caching\n\n## 🔧 Configuration\n\n### Environment Variables\n\n- `TINYBRAIN_DB_PATH`: Path to the SQLite database (default: `~/.tinybrain/memory.db`)\n- `TINYBRAIN_HOST`: HTTP listen host in serve mode (default: `127.0.0.1`)\n- `TINYBRAIN_PORT`: HTTP listen port in serve mode (default: `8090`)\n- `TINYBRAIN_HTTP`: Set to `false` to disable the HTTP API in serve mode\n- `TINYBRAIN_API_TOKEN`: If set, the REST API requires this bearer token\n\n### Server Endpoints (serve mode)\n\n- **Dashboard**: http://127.0.0.1:8090/_/\n- **REST API index**: http://127.0.0.1:8090/api/\n- **Health check**: http://127.0.0.1:8090/health\n- **MCP protocol**: stdio (JSON-RPC 2.0)\n\n### Data Directory Structure\n\n```\n~/.tinybrain/\n├── memory.db          # SQLite database\n├── memory.db-wal      # Write-ahead log\n└── memory.db-shm      # Shared memory file\n```\n\n## 🛡️ Security Datasets & Templates\n\n### **Comprehensive Security Patterns**\n\nThe security pattern libraries, CWE references, and templates are published on the\n[documentation site](https://rainmana.github.io/tinybrain/security-patterns/):\n\n- **[Security Patterns](https://rainmana.github.io/tinybrain/security-patterns/)** - OWASP Top 10 2021 patterns, CWE Top 25, multi-language vulnerability patterns, and exploitation techniques\n- **[CWE LLM Dataset](CWE_LLM_DATASET.json)** - LLM-optimized CWE dataset in structured JSON format for efficient consumption (ships in this repo)\n\n### **AI Assistant Configurations**\n- **[Cursor Rules](.cursorrules)** - Security assessment rules for Cursor AI assistant\n- **[Cline Rules](.clinerules)** - Code review and exploitation framework for Cline\n- **[Roo Mode](.roo-mode)** - Penetration testing configuration for Roo AI assistant\n- **[User Configuration Template](.cursorrules.user-template)** - Customizable user configuration template\n\n### **Standards-Based Approach**\nAll security patterns are derived from authoritative sources and aligned with industry standards:\n\n- **OWASP Top 10 2021** - Based on [OWASP Top 10](https://owasp.org/Top10/) web application security risks\n- **CWE Patterns** - Derived from [Common Weakness Enumeration](https://cwe.mitre.org/) software weakness classification\n- **Code Review Standards** - Aligned with [OWASP Code Review Guide](https://github.com/OWASP/www-project-code-review-guide)\n- **Training Integration** - Compatible with [OWASP Secure Coding Dojo](https://owasp.org/SecureCodingDojo/codereview101/)\n- **Testing Methodology** - Follows [NIST SP 800-115](https://csrc.nist.gov/publications/detail/sp/800-115/final) security testing guidelines\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass\n5. Submit a pull request\n\n### Development Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/rainmana/tinybrain.git\ncd tinybrain\n\n# Setup development environment\nmake dev-setup\n\n# Run tests\nmake test\n\n# Build\nmake build\n```\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n### **Technical Dependencies**\n- [mcp-go](https://github.com/mark3labs/mcp-go) for MCP server framework\n- [go-sqlite3](https://github.com/mattn/go-sqlite3) for SQLite driver\n- [charmbracelet/log](https://github.com/charmbracelet/log) for structured logging\n\n### **Security Standards & Sources**\n- [OWASP](https://owasp.org/) for security standards and vulnerability classifications\n- [OWASP Code Review Guide](https://github.com/OWASP/www-project-code-review-guide) for secure code review methodology\n- [OWASP Secure Coding Dojo](https://owasp.org/SecureCodingDojo/codereview101/) for interactive security training\n- [CWE (Common Weakness Enumeration)](https://cwe.mitre.org/) for software weakness classification\n- [NIST](https://www.nist.gov/) for cybersecurity frameworks and testing guidelines\n- [SANS](https://www.sans.org/) for security research and training materials\n\n## 📈 Roadmap\n\n- [x] Intelligence gathering frameworks (OSINT, HUMINT, SIGINT, etc.)\n- [x] MITRE ATT&CK integration\n- [x] Reverse engineering capabilities\n- [x] Enhanced memory categories\n- [x] Comprehensive documentation site\n- [ ] HTTP transport support\n- [ ] Memory compression and archiving\n- [ ] Advanced analytics and insights\n- [ ] Multi-user support with access controls\n- [ ] Plugin system for custom memory types\n- [ ] Integration with popular security tools\n- [ ] Web dashboard for memory visualization\n\n---\n\n**TinyBrain** - Making LLM memory storage intelligent, fast, and security-focused. 🧠🔒\n"}