Skip to main content
Glama
SENA Controller

SENA Controller

by Sena1996
README.md
# ๐Ÿฆ SENA Controller - Complete Package

**Universal AI intelligence system for Claude Desktop + Claude Code CLI**

[![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-blue)](https://modelcontextprotocol.io/)
[![Claude Code](https://img.shields.io/badge/Claude_Code-Hooks-green)](https://github.com/Sena1996/sena-mcp-server)
[![Version](https://img.shields.io/badge/version-3.5.0-brightgreen)](https://github.com/Sena1996/sena-mcp-server)

---

## ๐ŸŽฏ What is SENA?

SENA is a **complete intelligence enhancement system** for Claude that works everywhere:

- **๐Ÿ–ฅ๏ธ Claude Desktop** (via MCP protocol)
- **๐Ÿ’ป Claude Code CLI** (via hooks + MCP)

**One package. Two deployment modes. Complete intelligence.**

---

## โœจ NEW in v3.5.0: Transparent Architecture

**Revolutionary hook system that eliminates ALL visible command execution!**

**Before v3.5.0:**
```
User: "give me moon info in table"
Claude: I'll create a table for you.
> Bash(python3 ~/.claude/sena_auto_format.py --table ...)
[Running sena_auto_format.py...]
[Generating table...]
```

**After v3.5.0:**
```
User: "give me moon info in table"
SENA ๐Ÿฆ

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘         ๐ŸŒ™ MOON DATA                 โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

[NO commands visible, NO Python shown - PURE OUTPUT]
```

**What This Means:**
- โœ… **NO Bash commands** visible in terminal
- โœ… **NO Python imports/executions** shown
- โœ… **NO tool use complexity** exposed
- โœ… **Everything automatic** via transparent hooks
- โœ… **Professional appearance** - feels like magic, not engineering

**How It Works:**
1. **python-executor.sh** - Universal Python wrapper (silent execution)
2. **pre-bash-execution.sh** - Intercepts Bash commands BEFORE execution
3. **pre-python-execution.sh** - Transparent module loading
4. **Enhanced post-tool-use.sh** - Complete tool output suppression

**Result:** Claude Code feels like magic. Zero learning curve. Zero technical details.

**Full Documentation:** [docs/TRANSPARENT_ARCHITECTURE.md](docs/TRANSPARENT_ARCHITECTURE.md)

---

## ๐Ÿ“ฆ What's Inside

### โœ… MCP Server (Works: Desktop + CLI)
Enterprise-grade AI tools through official MCP protocol:
- ๐Ÿง  **Brilliant Thinking** - First principles, root cause, systems thinking
- ๐Ÿ” **Truth Verification** - Anti-hallucination fact checking
- ๐Ÿ“Š **Beautiful Tables** - Unicode formatting with SENA branding
- ๐Ÿ’ป **Code Analysis** - Security, performance, architecture analysis
- ๐Ÿ“ˆ **Health Metrics** - System monitoring and status

**Total: 5 MCP tools**

### โœ… Knowledge Bases (MCP Resources - Works: Desktop + CLI)
Persistent intelligence accessible across all sessions:
- ๐Ÿ“š **Reasoning Frameworks** (579 lines) - 10 thinking methodologies
- ๐Ÿ”’ **Security Patterns** (612 lines) - OWASP Top 10, auth, crypto
- โšก **Performance Patterns** (544 lines) - Optimization strategies
- ๐Ÿ—๏ธ **Architecture Patterns** (808 lines) - SOLID, DDD, design patterns

**Total: 2,543 lines of persistent intelligence**

### โœ… Phase 3 Autonomous Skills (Works: Desktop + CLI)
Proactive code analysis and suggestions via MCP tools:
- ๐Ÿค– **Auto Code Review** (262 lines) - Quality metrics, best practices
- โšก **Auto Optimize** (387 lines) - Performance optimization suggestions
- ๐Ÿ›ก๏ธ **Auto Security Scan** (479 lines) - OWASP Top 10 vulnerability detection

**Total: 3 MCP tools + 3 MCP resources (1,128 lines of autonomous intelligence)**

### โœ… CLI Hooks (Works: Claude Code Only)
Terminal-specific behavior enhancements via **9 Bash hooks** with **transparent execution** (25.3KB total):

**NEW in v3.5.0 - Transparent Architecture:**
- ๐Ÿ”‡ **python-executor.sh** - Universal silent Python wrapper (NO visible execution)
- ๐Ÿšซ **pre-bash-execution.sh** - Intercepts Bash BEFORE execution (NO commands shown)
- ๐Ÿ”ฌ **pre-python-execution.sh** - Transparent module loading (NO imports visible)

**Core Hooks:**
- ๐Ÿฆ **SENA Prefix** - Mandatory "SENA ๐Ÿฆ" branding on every response
- ๐ŸŽจ **Output Filtering** - Clean, beautiful terminal display (ENHANCED v3.5.0)
- โšก **Auto-Triggers** - Automatic formatting for keywords (table, why, how)
- ๐Ÿ”ง **Git Integration** - Clean commit messages (no AI credits)
- ๐Ÿ“Š **Progress Injection** - Auto-progress bars for multi-step tasks
- ๐Ÿ” **Permission Control** - Dynamic tool permissions without restart

**Result:** ZERO Bash/Python visibility. Professional, seamless experience.

**Detailed Documentation:**
- [hooks/README.md](hooks/README.md) - Complete hook system guide
- [docs/TRANSPARENT_ARCHITECTURE.md](docs/TRANSPARENT_ARCHITECTURE.md) - v3.5.0 architecture

### โœ… Controller Modules (Works: Claude Code Only - NEW in v2.0.0)
ALL Python automation modules from SENA v3.3.1 (20 modules, ~162KB):

**Core Modules (10 files, ~97KB):**
- ๐Ÿ”ง **auto_integration.py** (6.8KB) - Automatic format detection (Rule 7)
- ๐ŸŽจ **sena_auto_format.py** (18KB) - Auto formatting engine (Rules 1-4)
- ๐Ÿ“Š **sena_metrics_mcp.py** (14KB) - MCP metrics collection
- ๐Ÿ“ˆ **sena_metrics.py** (14KB) - Analytics and performance tracking
- ๐Ÿ”„ **session_manager.py** (6.9KB) - Session state coordination
- ๐Ÿ”— **sena_session_coordinator.py** (6.9KB) - Multi-session coordination
- ๐Ÿงน **sena_clean_output_100.py** (6.0KB) - Output cleaning (Rule 5)
- โณ **sena_progress_auto_100.py** (9.1KB) - Progress bar automation (Rule 6)
- ๐ŸŽ›๏ธ **sena_controller_100.py** (5.9KB) - Main controller orchestration
- ๐Ÿ”Œ **claude_sena_integration.py** (8.5KB) - Claude Code integration layer

**Advanced Modules (7 files, ~50KB):**
- ๐Ÿ” **final_deep_verification.py** (25KB) - Deep verification system
- ๐Ÿ’พ **offline_sync.py** (14KB) - Offline synchronization capabilities
- ๐Ÿ“ค **sena_direct_output.py** (3.1KB) - Direct output handling
- ๐Ÿคซ **sena_silent_executor.py** (5.6KB) - Silent execution mode
- ๐Ÿ”ฌ **sena_transparent_layer.py** (3.0KB) - Transparency layer
- ๐ŸŒ **sena_mcp_server.py** (5.9KB) - MCP server utilities
- ๐Ÿ **pythonstartup.py** (509B) - Python startup configuration

**Testing & Verification (3 files, ~15KB):**
- ๐Ÿงช **test_auto_rules.py** (5.3KB) - Test automatic rule application (Rules 1-4)
- โœ… **test_clean_output.py** (3.2KB) - Test output cleaning functionality
- ๐Ÿ”ฌ **verify_rules_5_6_100.py** (6.1KB) - Verify Rules 5-6 implementation

**Detailed Documentation:** [controller/README.md](controller/README.md)

### โœ… Configuration Templates (NEW in v2.0.0)
ALL configuration files from SENA v3.3.1:

**Templates (2 files, ~27KB):**
- ๐Ÿ“œ **CLAUDE.md.template** (23KB) - Main operational rules (Rules 0-8)
- โš™๏ธ **sena_skills.json.example** (3.3KB) - Skills configuration

**Additional Config Files:**
- ๐Ÿ“Œ **VERSION** - Version tracking file
- โš™๏ธ **settings.json.example** - Claude Code settings template
- ๐Ÿ” **.env.example** - Environment variables template

**Usage:** Copy templates to `~/.claude/` and customize
**Detailed Documentation:** [config/README.md](config/README.md)

### โœ… Internal Documentation (NEW in v2.0.0)
Complete internal documentation from SENA v3.3.1 (20 files):
- ๐Ÿ“– Development history and migration guides
- ๐Ÿ”ง Implementation details and technical specs
- ๐Ÿ“‹ Phase completion documentation
- ๐Ÿš€ Deployment and setup guides

**Detailed Documentation:** [internal-docs/](internal-docs/)

### โœ… Slash Commands (Works: Claude Code Only - NEW in v2.0.0)
ALL slash commands from SENA v3.3.1 (122 commands total):

**Core SENA Commands (10 commands):**
- `/activate-sena` - Enable SENA controller
- `/deactivate-sena` - Disable SENA controller
- `/check-sena` - System status check
- `/sena-health` - Comprehensive health report
- `/sena-help` - Documentation and help
- `/sena-capabilities` - List all capabilities
- `/sena-always-on` - Enable always-on mode
- `/sena-always-off` - Disable always-on mode
- `/deep-think` - Deep analysis with extended thinking
- `/analyze-code` - Comprehensive code analysis

**Additional Commands (112+ commands):**
- Development, testing, DevOps, documentation, and utility commands
- API architecture, database tuning, performance optimization
- Security analysis, code generation, refactoring tools
- Test generation, coverage analysis, CI/CD automation
- README generation, API docs, changelog tools
- Code formatting, linting, dependency management, metrics

**Detailed Documentation:** [commands/README.md](commands/README.md)

---

## ๐Ÿš€ Quick Installation

### Option 1: Automated Install (Recommended)

```bash
# Clone repository
git clone https://github.com/Sena1996/sena-mcp-server.git
cd sena-mcp-server

# Run installer
./install.sh
```

The installer will ask:
1. **Full** - MCP Server + CLI Hooks (complete experience)
2. **MCP Only** - Just intelligence tools (Claude Desktop)
3. **Hooks Only** - Just CLI behavior (Claude Code terminal)

### Option 2: Manual Installation

#### Prerequisites

```bash
# Install uv (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies
uv sync
```

#### For Claude Desktop (MCP Server)

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "sena": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/YOUR_USERNAME/path/to/sena-mcp-server",
        "run",
        "sena-mcp-server"
      ],
      "env": {
        "SENA_MODE": "full"
      }
    }
  }
}
```

**Then restart Claude Desktop.**

#### For Claude Code CLI (Hooks)

```bash
# Copy hooks
mkdir -p ~/.claude/hooks
cp hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh

# Enable SENA always-on mode
touch ~/.claude/.sena_always_on

# Configure hooks in ~/.claude/settings.json
{
  "userPromptSubmitHook": "~/.claude/hooks/user-prompt-submit.sh",
  "assistantResponseSubmitHook": "~/.claude/hooks/sena-enforcer.sh",
  "postToolUseHook": "~/.claude/hooks/post-tool-use.sh"
}
```

---

## ๐Ÿ’ก Usage Examples

### In Claude Desktop (MCP Tools)

```
User: Use brilliant thinking to analyze why our API is slow
Claude: [Performs first principles analysis using SENA methodology]

User: Verify: "React 18 has automatic batching"
Claude: [Runs truth verification with evidence]

User: Create a table comparing database performance
Claude: [Generates beautiful Unicode table]

User: Analyze this code for security issues
Claude: [Comprehensive security analysis]

User: Show SENA health status
Claude: [Displays system metrics]
```

### In Claude Code CLI (Hooks + MCP)

```bash
$ claude

User: give me moon info in table
Assistant: SENA ๐Ÿฆ

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                                                              โ•‘
โ•‘                  ๐ŸŒ™ MOON COMPREHENSIVE DATA                  โ•‘
โ•‘                                                              โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  BASIC PROPERTIES
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Property              โ”‚ Value                                โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Name                  โ”‚ Luna (Earth's Moon)                  โ”‚
โ”‚ Diameter              โ”‚ 3,474 km                             โ”‚
โ”‚ Distance from Earth   โ”‚ 384,400 km (average)                 โ”‚
โ”‚ Orbital Period        โ”‚ 27.3 days                            โ”‚
โ”‚ Rotation Period       โ”‚ 27.3 days (tidally locked)           โ”‚
โ”‚ Surface Temperature   โ”‚ -173ยฐC to 127ยฐC                      โ”‚
โ”‚ Gravity               โ”‚ 1.62 m/sยฒ (16.5% of Earth)           โ”‚
โ”‚ Surface Area          โ”‚ 37.9 million kmยฒ                     โ”‚
โ”‚ Mass                  โ”‚ 7.342 ร— 10ยฒยฒ kg                      โ”‚
โ”‚ Age                   โ”‚ ~4.5 billion years                   โ”‚
โ”‚ Atmosphere            โ”‚ Virtually none (exosphere)           โ”‚
โ”‚ Surface Composition   โ”‚ Silicate rock, regolith              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  MOON PHASES (8 Primary Phases)
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Phase              โ”‚ Icon โ”‚ Illumination โ”‚ Description      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ New Moon           โ”‚ ๐ŸŒ‘   โ”‚ 0%           โ”‚ Not visible      โ”‚
โ”‚ Waxing Crescent    โ”‚ ๐ŸŒ’   โ”‚ 1-49%        โ”‚ Growing right    โ”‚
โ”‚ First Quarter      โ”‚ ๐ŸŒ“   โ”‚ 50%          โ”‚ Half visible     โ”‚
โ”‚ Waxing Gibbous     โ”‚ ๐ŸŒ”   โ”‚ 51-99%       โ”‚ Nearly full      โ”‚
โ”‚ Full Moon          โ”‚ ๐ŸŒ•   โ”‚ 100%         โ”‚ Fully lit        โ”‚
โ”‚ Waning Gibbous     โ”‚ ๐ŸŒ–   โ”‚ 99-51%       โ”‚ Shrinking left   โ”‚
โ”‚ Last Quarter       โ”‚ ๐ŸŒ—   โ”‚ 50%          โ”‚ Half visible     โ”‚
โ”‚ Waning Crescent    โ”‚ ๐ŸŒ˜   โ”‚ 49-1%        โ”‚ Shrinking right  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  NOTABLE FEATURES & LANDMARKS
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Feature Type       โ”‚ Examples                                โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ๐ŸŒŠ Maria (Seas)    โ”‚ Mare Tranquillitatis, Mare Serenitatis โ”‚
โ”‚ โ›ฐ๏ธ  Highlands       โ”‚ Montes Apenninus, Montes Caucasus      โ”‚
โ”‚ ๐Ÿ’ฅ Impact Craters  โ”‚ Tycho, Copernicus, Aristarchus         โ”‚
โ”‚ ๐Ÿ”๏ธ  Mountain Rangesโ”‚ Leibnitz Mountains (10,000m)           โ”‚
โ”‚ ๐Ÿ•ณ๏ธ  Rilles          โ”‚ Hadley Rille, Alpine Valley            โ”‚
โ”‚ โšช Bright Rays      โ”‚ From Tycho, Copernicus craters         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  SPACE MISSIONS & EXPLORATION
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Mission/Program    โ”‚ Status      โ”‚ Achievement              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ๐Ÿš€ Apollo 11       โ”‚ 1969 โœ…     โ”‚ First human landing      โ”‚
โ”‚ ๐Ÿ›ฐ๏ธ  Apollo 17      โ”‚ 1972 โœ…     โ”‚ Last manned mission      โ”‚
โ”‚ ๐Ÿ‡จ๐Ÿ‡ณ Chang'e 4       โ”‚ 2019 โœ…     โ”‚ First far side landing   โ”‚
โ”‚ ๐Ÿ‡ฎ๐Ÿ‡ณ Chandrayaan-3   โ”‚ 2023 โœ…     โ”‚ South pole landing       โ”‚
โ”‚ ๐Ÿ‡บ๐Ÿ‡ธ Artemis Program โ”‚ Ongoing ๐Ÿ”„  โ”‚ Return humans to Moon    โ”‚
โ”‚ ๐ŸŒ ISRO/ESA        โ”‚ Planned ๐Ÿ“…  โ”‚ Future collaborations    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  INTERESTING FACTS
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โœจ The Moon is moving away from Earth at ~3.8 cm per year
๐ŸŒ Same side always faces Earth (tidally locked)
๐Ÿ’Ž Contains water ice in permanently shadowed craters
๐ŸŒก๏ธ  Temperature swings 300ยฐC between day and night
๐Ÿ‘ฃ 12 humans have walked on the lunar surface
๐Ÿ”ญ Visible features from Earth: Maria, craters, rays
๐ŸŒŠ Causes Earth's tides through gravitational pull
โฐ Day on Moon: 29.5 Earth days (one lunar day)
```

**Notice:** Every response starts with "SENA ๐Ÿฆ" and includes beautiful tables with emojis, phases, and comprehensive data!

---

## ๐Ÿง  MCP Tools Reference

### `sena_brilliant_thinking`
Analyze complex problems using advanced methodologies.

**Parameters:**
- `problem` (string): Problem description
- `methodology` (string): `auto`, `first_principles`, `root_cause`, `systems`, `decision_matrix`

**Example:**
```
Use brilliant thinking to determine the root cause of database deadlocks
```

---

### `sena_verify_truth`
Verify statements with anti-hallucination features.

**Parameters:**
- `statement` (string): Claim to verify
- `require_evidence` (boolean): Demand evidence sources

**Example:**
```
Verify: "TypeScript has better performance than JavaScript"
```

---

### `sena_format_table`
Create beautiful Unicode tables.

**Parameters:**
- `headers` (array): Column headers
- `rows` (array): Data rows
- `title` (string): Optional table title

**Example:**
```
Create table: Framework, Speed, Bundle Size for React, Vue, Svelte
```

---

### `sena_analyze_code`
Comprehensive code quality analysis.

**Parameters:**
- `code` (string): Code to analyze
- `language` (string): Programming language
- `focus` (string): `security`, `performance`, `architecture`, `all`

**Example:**
```typescript
Analyze this code for security:

function login(username, password) {
  return db.query(`SELECT * FROM users WHERE user='${username}'`);
}
```

---

### `sena_get_health`
Get SENA system health status.

**Parameters:** None

**Example:**
```
Show SENA health status
```

**Returns:**
```json
{
  "status": "healthy",
  "version": "1.0.0",
  "mode": "mcp",
  "components": {
    "brilliant_thinking": "operational",
    "truth_verification": "operational",
    "code_analysis": "operational",
    "formatting": "operational",
    "metrics": "operational"
  }
}
```

---

## ๐Ÿ”ง CLI Hooks Reference

**Complete Hook System Documentation:** [hooks/README.md](hooks/README.md)

### Hook Scripts (9 files, 25.3KB total)

**NEW in v3.5.0 - Transparent Execution Hooks:**

| Hook | Size | Purpose | Type |
|------|------|---------|------|
| **python-executor.sh** | 1.5KB | Universal Python wrapper (silent execution) | Transparent |
| **pre-bash-execution.sh** | 1.1KB | Intercepts Bash BEFORE execution | Transparent |
| **pre-python-execution.sh** | 0.7KB | Transparent module loading | Transparent |

**Core Hooks:**

| Hook | Size | Purpose | Type |
|------|------|---------|------|
| **user-prompt-submit.sh** | 12.2KB | Enforces SENA prefix, detects keywords | Pre-Hook |
| **sena-enforcer.sh** | 4.5KB | Validates output format compliance | Post-Hook |
| **post-tool-use.sh** | 1.1KB | Suppresses verbose tool output (ENHANCED v3.5.0) | Post-Hook |
| **permission-request.sh** | 1.7KB | Dynamic tool permissions control | Permission |
| **conversation-progress.sh** | 0.7KB | Conversation-level progress bars | Progress |
| **auto-progress.sh** | 0.6KB | Auto-progress injection | Progress |

### Hook Triggers (Automatic Format Detection)

| User Input | Auto-Applied Format | Hook |
|------------|---------------------|------|
| "why", "how", "explain" | BRILLIANT THINKING format | user-prompt-submit.sh |
| "table", "tabular" | UNICODE TABLE format | user-prompt-submit.sh |
| "is X true", "fact check" | TRUTH VERIFICATION format | user-prompt-submit.sh |
| "analyze code" | CODE ANALYSIS format | user-prompt-submit.sh |
| Multiple operations | PROGRESS BARS | user-prompt-submit.sh + sena-enforcer.sh |

### SENA Always-On Mode

When `~/.claude/.sena_always_on` exists:
- โœ… **EVERY response** must start with "SENA ๐Ÿฆ"
- โœ… Applies to ALL requests (no exceptions)
- โœ… Enforced by hooks automatically (pre + post validation)
- โœ… Responses blocked if prefix missing

**Enable:**
```bash
touch ~/.claude/.sena_always_on
```

**Disable:**
```bash
rm ~/.claude/.sena_always_on
```

**How It Works:**
1. `user-prompt-submit.sh` injects reminder before Claude sees message
2. `sena-enforcer.sh` validates response has prefix, blocks if missing

See [hooks/README.md](hooks/README.md) for detailed configuration, troubleshooting, and testing.

---

## ๐Ÿ“Š Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  SENA CONTROLLER COMPLETE PACKAGE                           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                             โ”‚
โ”‚  ๐Ÿ“ฆ MCP SERVER                    ๐Ÿ”ง CLI HOOKS             โ”‚
โ”‚  (Universal)                      (Claude Code Only)       โ”‚
โ”‚                                                             โ”‚
โ”‚  โ”œโ”€ Brilliant Thinking            โ”œโ”€ SENA ๐Ÿฆ Prefix       โ”‚
โ”‚  โ”œโ”€ Truth Verification            โ”œโ”€ Output Filtering      โ”‚
โ”‚  โ”œโ”€ Table Formatting              โ”œโ”€ Auto-Triggers         โ”‚
โ”‚  โ”œโ”€ Code Analysis                 โ”œโ”€ Git Integration       โ”‚
โ”‚  โ””โ”€ Health Metrics                โ””โ”€ Progress Injection    โ”‚
โ”‚                                                             โ”‚
โ”‚  Works:                           Works:                    โ”‚
โ”‚  โœ… Claude Desktop                โœ… Claude Code CLI       โ”‚
โ”‚  โœ… Claude Code CLI               โŒ Claude Desktop        โ”‚
โ”‚                                                             โ”‚
โ”‚  Protocol: MCP (official)         Protocol: Bash hooks     โ”‚
โ”‚  Distribution: This repo          Distribution: This repo  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### Directory Structure

```
sena-mcp-server/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ sena_mcp/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ””โ”€โ”€ server.py           # Main MCP server (5 tools + 4 resources)
โ”œโ”€โ”€ knowledge/                  # NEW in v1.1.0
โ”‚   โ”œโ”€โ”€ README.md              # Knowledge base guide
โ”‚   โ”œโ”€โ”€ reasoning-frameworks.md # 579 lines - 10 methodologies
โ”‚   โ”œโ”€โ”€ security-patterns.md    # 612 lines - OWASP Top 10
โ”‚   โ”œโ”€โ”€ performance-patterns.md # 544 lines - Optimization
โ”‚   โ””โ”€โ”€ architecture-patterns.md# 808 lines - SOLID, DDD
โ”œโ”€โ”€ skills/                      # NEW in v1.3.0 - Phase 3 Skills
โ”‚   โ”œโ”€โ”€ README.md              # Skills framework guide
โ”‚   โ”œโ”€โ”€ auto-code-review.md     # 262 lines - Code quality
โ”‚   โ”œโ”€โ”€ auto-optimize.md        # 387 lines - Performance
โ”‚   โ””โ”€โ”€ auto-security-scan.md   # 479 lines - Security
โ”œโ”€โ”€ docs/                       # NEW in v1.1.0
โ”‚   โ”œโ”€โ”€ ARCHITECTURE.md        # System architecture
โ”‚   โ”œโ”€โ”€ FEATURE_COMPATIBILITY.md # MCP vs Hooks matrix
โ”‚   โ”œโ”€โ”€ CLAUDE_CLI_RULES.md    # CLI rules documentation
โ”‚   โ”œโ”€โ”€ TRANSPARENT_ARCHITECTURE.md # NEW v3.5.0: Transparent hooks guide (15KB)
โ”‚   โ””โ”€โ”€ examples/              # Reference implementations
โ”œโ”€โ”€ hooks/                       # NEW in v1.2.0, ENHANCED in v3.5.0
โ”‚   โ”œโ”€โ”€ README.md              # Complete hook system guide
โ”‚   โ”œโ”€โ”€ python-executor.sh      # NEW v3.5.0: Universal Python wrapper (1.5KB)
โ”‚   โ”œโ”€โ”€ pre-bash-execution.sh   # NEW v3.5.0: Bash interceptor (1.1KB)
โ”‚   โ”œโ”€โ”€ pre-python-execution.sh # NEW v3.5.0: Python interceptor (0.7KB)
โ”‚   โ”œโ”€โ”€ user-prompt-submit.sh   # Pre-processing hook (12.2KB)
โ”‚   โ”œโ”€โ”€ sena-enforcer.sh        # Post-validation hook (4.5KB)
โ”‚   โ”œโ”€โ”€ post-tool-use.sh        # Tool cleanup hook (1.1KB, ENHANCED v3.5.0)
โ”‚   โ”œโ”€โ”€ permission-request.sh   # Permission handler (1.7KB)
โ”‚   โ”œโ”€โ”€ conversation-progress.sh # Progress tracking (0.7KB)
โ”‚   โ””โ”€โ”€ auto-progress.sh        # Auto-progress bars (0.6KB)
โ”œโ”€โ”€ controller/                  # NEW in v2.0.0 - Python modules
โ”‚   โ”œโ”€โ”€ README.md              # Controller documentation
โ”‚   โ”œโ”€โ”€ __init__.py            # Package init (v3.3.1, 20 modules)
โ”‚   โ”œโ”€โ”€ VERSION                # Version tracking
โ”‚   โ”œโ”€โ”€ auto_integration.py     # 6.8KB - Format detection (Rule 7)
โ”‚   โ”œโ”€โ”€ sena_auto_format.py     # 18KB - Formatting engine
โ”‚   โ”œโ”€โ”€ sena_metrics_mcp.py     # 14KB - MCP metrics
โ”‚   โ”œโ”€โ”€ sena_metrics.py         # 14KB - Analytics
โ”‚   โ”œโ”€โ”€ session_manager.py      # 6.9KB - Session control
โ”‚   โ”œโ”€โ”€ sena_session_coordinator.py # 6.9KB - Multi-session coordination
โ”‚   โ”œโ”€โ”€ sena_clean_output_100.py # 6.0KB - Output cleaning
โ”‚   โ”œโ”€โ”€ sena_progress_auto_100.py # 9.1KB - Progress bars
โ”‚   โ”œโ”€โ”€ sena_controller_100.py  # 5.9KB - Orchestration
โ”‚   โ”œโ”€โ”€ claude_sena_integration.py # 8.5KB - CLI integration
โ”‚   โ”œโ”€โ”€ final_deep_verification.py # 25KB - Deep verification
โ”‚   โ”œโ”€โ”€ offline_sync.py         # 14KB - Offline sync
โ”‚   โ”œโ”€โ”€ sena_direct_output.py   # 3.1KB - Direct output
โ”‚   โ”œโ”€โ”€ sena_silent_executor.py # 5.6KB - Silent execution
โ”‚   โ”œโ”€โ”€ sena_transparent_layer.py # 3.0KB - Transparency layer
โ”‚   โ”œโ”€โ”€ sena_mcp_server.py      # 5.9KB - MCP utilities
โ”‚   โ”œโ”€โ”€ pythonstartup.py        # 509B - Python startup
โ”‚   โ”œโ”€โ”€ test_auto_rules.py      # 5.3KB - Test Rules 1-4
โ”‚   โ”œโ”€โ”€ test_clean_output.py    # 3.2KB - Test output cleaning
โ”‚   โ””โ”€โ”€ verify_rules_5_6_100.py # 6.1KB - Verify Rules 5-6
โ”œโ”€โ”€ config/                      # NEW in v2.0.0 - Config templates
โ”‚   โ”œโ”€โ”€ README.md              # Configuration guide
โ”‚   โ”œโ”€โ”€ CLAUDE.md.template      # 23KB - Operational rules
โ”‚   โ”œโ”€โ”€ sena_skills.json.example # 3.3KB - Skills config
โ”‚   โ”œโ”€โ”€ settings.json.example   # Claude Code settings
โ”‚   โ””โ”€โ”€ .env.example           # Environment variables
โ”œโ”€โ”€ commands/                    # NEW in v2.0.0 - Slash commands
โ”‚   โ”œโ”€โ”€ README.md              # Commands documentation
โ”‚   โ”œโ”€โ”€ activate-sena.md        # Enable SENA controller
โ”‚   โ”œโ”€โ”€ deactivate-sena.md      # Disable SENA controller
โ”‚   โ”œโ”€โ”€ check-sena.md           # System status check
โ”‚   โ”œโ”€โ”€ sena-health.md          # Health report
โ”‚   โ”œโ”€โ”€ sena-help.md            # Documentation
โ”‚   โ”œโ”€โ”€ sena-capabilities.md    # List capabilities
โ”‚   โ”œโ”€โ”€ sena-always-on.md       # Enable always-on mode
โ”‚   โ”œโ”€โ”€ sena-always-off.md      # Disable always-on mode
โ”‚   โ”œโ”€โ”€ deep-think.md           # Deep analysis
โ”‚   โ”œโ”€โ”€ analyze-code.md         # Code analysis
โ”‚   โ””โ”€โ”€ ... (112 more commands) # ALL 122 commands from v3.3.1
โ”œโ”€โ”€ internal-docs/               # NEW in v2.0.0 - Internal documentation
โ”‚   โ”œโ”€โ”€ PHASE3_COMPLETE_v3.3.1.md
โ”‚   โ”œโ”€โ”€ MIGRATION_COMPLETE_v3.3.1.md
โ”‚   โ””โ”€โ”€ ... (18 more files)    # Complete internal documentation
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_server.py          # MCP server tests
โ”œโ”€โ”€ install.sh                  # Automated installer
โ”œโ”€โ”€ pyproject.toml              # Python package config
โ”œโ”€โ”€ README.md                   # This file
โ”œโ”€โ”€ LICENSE                     # MIT License
โ”œโ”€โ”€ DEPLOYMENT_PLAN.md          # Deployment guide
โ””โ”€โ”€ .gitignore
```

---

## ๐Ÿงช Testing

### Test MCP Server

```bash
# Run tests
uv run pytest

# Test with MCP Inspector
npx @modelcontextprotocol/inspector uv --directory . run sena-mcp-server
```

### Test CLI Hooks

```bash
# Verify hooks installed
ls -la ~/.claude/hooks/

# Test in Claude Code CLI
claude
# Type: "give me moon info in table"
# Should see: SENA ๐Ÿฆ prefix + beautiful comprehensive table
```

---

## ๐Ÿ” Troubleshooting

### MCP Server Issues

**Problem:** Claude Desktop doesn't see SENA tools

**Solution:**
1. Check config path: `~/Library/Application Support/Claude/claude_desktop_config.json`
2. Verify JSON syntax (no trailing commas)
3. Restart Claude Desktop completely
4. Check logs: `~/Library/Logs/Claude/mcp*.log`

**Problem:** MCP server fails to start

**Solution:**
```bash
# Test manually
uv run sena-mcp-server

# Check dependencies
uv sync

# Verify Python version
python3 --version  # Must be 3.10+
```

### Hook Issues

**Problem:** No "SENA ๐Ÿฆ" prefix in terminal

**Solution:**
1. Check always-on flag: `ls ~/.claude/.sena_always_on`
2. Verify hooks exist: `ls ~/.claude/hooks/`
3. Check permissions: `chmod +x ~/.claude/hooks/*.sh`
4. Verify settings: `cat ~/.claude/settings.json`

**Problem:** Hooks not triggering

**Solution:**
```bash
# Re-run installer
./install.sh

# Or manually
cp hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh
```

---

## ๐ŸŽฏ Feature Compatibility Matrix

| Feature | MCP | Hook | Where It Works |
|---------|-----|------|----------------|
| **SENA ๐Ÿฆ Prefix** | โŒ | โœ… | CLI only |
| **Brilliant Thinking** | โœ… | โœ… | Desktop + CLI |
| **Truth Verification** | โœ… | โœ… | Desktop + CLI |
| **Table Formatting** | โœ… | โœ… | Desktop + CLI |
| **Code Analysis** | โœ… | โœ… | Desktop + CLI |
| **Health Metrics** | โœ… | โŒ | Desktop + CLI (via MCP) |
| **Output Filtering** | โŒ | โœ… | CLI only |
| **Auto-Triggers** | โŒ | โœ… | CLI only |
| **Git Clean Commits** | โŒ | โœ… | CLI only |
| **Progress Bars** | โœ… | โœ… | Desktop + CLI |

**Summary:**
- **26 features** work via MCP (universal - includes 4 knowledge base resources)
- **18 features** work via hooks (CLI-specific)
- **16 features** work in both systems

Full details: See [docs/FEATURE_COMPATIBILITY.md](docs/FEATURE_COMPATIBILITY.md)

---

## ๐Ÿ“š Knowledge Bases (MCP Resources)

SENA includes **2,543 lines of persistent intelligence** accessible via MCP resources:

### Available Knowledge Bases

| Knowledge Base | MCP Resource | Lines | Coverage |
|----------------|--------------|-------|----------|
| **Reasoning Frameworks** | `sena://knowledge/reasoning-frameworks` | 579 | 10 frameworks |
| **Security Patterns** | `sena://knowledge/security-patterns` | 612 | 8 categories |
| **Performance Patterns** | `sena://knowledge/performance-patterns` | 544 | 10 optimization areas |
| **Architecture Patterns** | `sena://knowledge/architecture-patterns` | 808 | 8 pattern types |

### How to Access

**Claude Desktop:**
```
Ask Claude: "Show me SENA security patterns for authentication"
Claude will access: sena://knowledge/security-patterns
```

**Claude Code CLI:**
```
Claude can access MCP resources automatically when needed
Also referenced in ~/.claude/CLAUDE.md for persistent access
```

**Detailed Information:**
- [knowledge/README.md](knowledge/README.md) - Complete knowledge base guide
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) - System architecture
- [docs/FEATURE_COMPATIBILITY.md](docs/FEATURE_COMPATIBILITY.md) - Feature matrix

---

## ๐Ÿค– Phase 3 Autonomous Skills

SENA includes **3 autonomous skills** that proactively analyze code and provide suggestions:

### Available Skills (MCP Tools + Resources)

| Skill | Triggers | Purpose | Lines |
|-------|----------|---------|-------|
| **Auto Code Review** | >50 lines written, git commit | Automatic quality analysis | 262 |
| **Auto Optimize** | O(nยฒ)+ complexity detected | Performance suggestions | 387 |
| **Auto Security Scan** | User input, SQL, file ops | Vulnerability detection | 479 |

**Total: 1,128 lines of autonomous intelligence**

### Skill Details

#### 1. Auto Code Review (`sena_auto_code_review`)

**Automatic Activation:**
- After writing >50 lines of code
- When creating/modifying programming files
- On git commit with code changes

**Analysis Includes:**
- Code quality metrics (readability, maintainability)
- Language-specific anti-patterns
- Performance review (complexity analysis)
- Security check (OWASP guidelines)
- Actionable improvement suggestions

**Example Usage:**
```
Use Auto Code Review on this Python function:

def process_data(items):
    result = []
    for item in items:
        if item['value'] > 0:
            result.append(item)
    return result
```

#### 2. Auto Optimize (`sena_auto_optimize`)

**Automatic Activation:**
- Nested loops detected (O(nยฒ) or worse)
- Inefficient algorithms identified
- Performance-critical code

**Optimization Strategies:**
- Algorithm replacement (O(nยฒ) โ†’ O(n))
- Data structure selection (list โ†’ set for O(1) lookup)
- Code-level optimizations
- Performance improvement estimates

**Example Usage:**
```
Optimize this code for performance:

for i in range(len(arr)):
    for j in range(len(arr)):
        if arr[i] == arr[j] and i != j:
            print("Duplicate found")
```

#### 3. Auto Security Scan (`sena_auto_security_scan`)

**Automatic Activation:**
- User input handling
- Database queries (SQL, NoSQL)
- File operations
- Authentication/authorization code
- Cryptographic operations

**Security Checks:**
- OWASP Top 10 vulnerabilities
- SQL injection prevention
- XSS vulnerability detection
- Command injection risks
- Weak cryptography identification

**Example Usage:**
```
Security scan this database query:

query = f"SELECT * FROM users WHERE id = {user_id}"
db.execute(query)
```

### How Skills Work

1. **Detection:** MCP tools analyze code patterns
2. **Trigger:** When conditions match, skill activates
3. **Execution:** Comprehensive analysis performed
4. **Recommendations:** Actionable suggestions with code examples

### Accessing Skills

**Via MCP Tools:**
```
Use sena_auto_code_review to analyze my code
Run sena_auto_optimize on this function
Execute sena_auto_security_scan on this API endpoint
```

**Via MCP Resources:**
```
Access sena://skills/auto-code-review for documentation
View sena://skills/auto-optimize for optimization patterns
Read sena://skills/auto-security-scan for security guidelines
```

**Complete Documentation:**
- [skills/README.md](skills/README.md) - Skills framework overview
- [skills/auto-code-review.md](skills/auto-code-review.md) - Code review skill
- [skills/auto-optimize.md](skills/auto-optimize.md) - Optimization skill
- [skills/auto-security-scan.md](skills/auto-security-scan.md) - Security skill

---

## ๐Ÿš€ Publishing to PyPI (Optional)

To make SENA installable via `uvx sena-mcp-server` globally:

```bash
# Build package
uv build

# Publish to PyPI (requires account)
uv publish

# Or test with TestPyPI first
uv publish --repository testpypi
```

After publishing, users can install with:
```bash
uvx sena-mcp-server
```

---

## ๐Ÿค Contributing

Contributions welcome! Please:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing`)
5. Open a Pull Request

---

## ๐Ÿ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

---

## ๐Ÿ™ Credits

- **Creator**: SENA ๐Ÿฆ
- **MCP Protocol**: [Anthropic PBC](https://www.anthropic.com/)
- **Inspired by**: Claude Code Controller v3.0
- **FastMCP**: Official Python MCP SDK

---

## ๐Ÿ“ž Support

- **Issues**: [GitHub Issues](https://github.com/Sena1996/sena-mcp-server/issues)
- **MCP Docs**: [Model Context Protocol](https://modelcontextprotocol.io/)
- **Claude Code Docs**: [Claude Code CLI](https://docs.anthropic.com/claude-code)

---

## ๐ŸŽ‰ Version History

### v3.5.0 (2025-11-24) - **๐Ÿš€ Transparent Architecture - ZERO Visible Commands**

**Revolutionary hook system that eliminates ALL visible Bash/Python execution!**

**NEW Transparent Execution Hooks (3 files, 3.3KB):**
- โœ… **python-executor.sh** (1.5KB) - Universal Python wrapper with silent execution
  - Executes ANY Python module with NO terminal output
  - Returns only results (internal processing)
  - All stderr/stdout suppressed
  - Dynamic module loading
- โœ… **pre-bash-execution.sh** (1.1KB) - Bash interceptor BEFORE execution
  - Intercepts ALL Bash commands before they execute
  - Detects Python execution patterns
  - Redirects to silent execution via python-executor.sh
  - Blocks original command visibility
- โœ… **pre-python-execution.sh** (0.7KB) - Python import interceptor
  - Enables transparent module loading
  - Sets SENA_TRANSPARENT_MODE flag
  - NO "Importing..." messages visible
  - Internal logging only

**ENHANCED Core Hooks:**
- โœ… **post-tool-use.sh** - Complete tool suppression (ENHANCED)
  - Detects Python execution in Bash output
  - Extracts module names automatically
  - Executes via python-executor.sh transparently
  - Logs transparent execution internally
  - Suppresses: Bash, Python, Read, Write, Edit tool output

**NEW Documentation (15KB):**
- โœ… **docs/TRANSPARENT_ARCHITECTURE.md** - Complete transparent architecture guide
  - Before/after comparisons
  - Complete workflow diagrams (400+ lines)
  - Hook coordination details
  - Installation and debugging guide
  - Use cases and examples

**Version Updates:**
- โœ… Updated pyproject.toml: 2.1.0 โ†’ 3.5.0
- โœ… Updated src/sena_mcp/server.py: VERSION = "3.5.0"
- โœ… Updated controller/__init__.py: __version__ = "3.5.0"

**User Experience Transformation:**

**Before v3.5.0 (Visible Complexity):**
```
User: "give me moon info in table"
Claude: I'll create a table for you.
> Bash(python3 ~/.claude/sena_auto_format.py --table ...)
[Running sena_auto_format.py...]
[Loading modules...]
[Generating table...]

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘         ๐ŸŒ™ MOON DATA                 โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```
โŒ User sees Bash commands
โŒ User sees Python execution
โŒ Technical details exposed

**After v3.5.0 (Complete Transparency):**
```
User: "give me moon info in table"
SENA ๐Ÿฆ

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘         ๐ŸŒ™ MOON DATA                 โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

[NO commands visible, NO Python shown]
```
โœ… Zero command visibility
โœ… Zero Python complexity
โœ… Professional appearance

**How Transparent Architecture Works:**

1. **User submits prompt** โ†’ `user-prompt-submit.sh` (can call python-executor.sh silently)
2. **Claude tries Bash/Python** โ†’ `pre-bash-execution.sh` intercepts BEFORE execution
3. **Python execution detected** โ†’ Redirected to `python-executor.sh` (silent)
4. **Result captured internally** โ†’ NO terminal output
5. **Tool output processed** โ†’ `post-tool-use.sh` suppresses ALL tool details
6. **User sees** โ†’ ONLY clean, formatted output

**Benefits:**
- โœ… NO Bash commands visible in terminal
- โœ… NO Python imports/executions shown
- โœ… NO tool use complexity exposed
- โœ… NO technical details visible
- โœ… ONLY clean, beautiful, formatted output
- โœ… Professional appearance
- โœ… Zero learning curve for users
- โœ… Feels like "magic" not "engineering"

**Technical Implementation:**
- Silent execution: Python subprocess with stdout/stderr to `/dev/null`
- Result-only return: Only function output captured
- Internal logging: Debug logs to `/tmp/.sena_transparent_log` (not shown to user)
- Multiple suppression layers: Pre-hooks + Post-hooks working together
- Centralized Python execution: All Python calls through python-executor.sh

**Comparison:**
| Feature | v2.1.0 | v3.5.0 |
|---------|--------|--------|
| Bash commands visible | โŒ Yes | โœ… No |
| Python imports visible | โŒ Yes | โœ… No |
| Tool use complexity | โŒ Exposed | โœ… Hidden |
| User experience | โš ๏ธ Technical | โœ… Professional |
| Transparent execution | โŒ No | โœ… Yes |
| Silent Python calls | โŒ No | โœ… Yes |
| Hook-based interception | โš ๏ธ Partial | โœ… Complete |

**Full Documentation:** [docs/TRANSPARENT_ARCHITECTURE.md](docs/TRANSPARENT_ARCHITECTURE.md)

---

### v2.1.0 (2025-11-24) - **TRUE 100% Feature Parity - Complete SENA v3.3.1**

**What Was Missing in v2.0.0 (Partial - 60% Coverage):**
- โŒ Only 9 controller modules (missing 11 modules: 7 advanced + 3 test + 1 coordinator)
- โŒ Only 10 slash commands (missing 112 commands)
- โŒ Only 2 config templates (missing settings.json, .env, VERSION)
- โŒ No internal documentation (0 files)

**What v2.1.0 Adds to Achieve TRUE 100%:**
- โœ… Added ALL controller modules (20 Python files, ~162KB total)
  - **Core Modules (10 files, ~97KB):**
    - auto_integration.py (6.8KB) - Format detection (Rule 7)
    - sena_auto_format.py (18KB) - Formatting engine (Rules 1-4)
    - sena_metrics_mcp.py (14KB) - MCP metrics collection
    - sena_metrics.py (14KB) - Analytics and performance tracking
    - session_manager.py (6.9KB) - Session state coordination
    - sena_session_coordinator.py (6.9KB) - Multi-session coordination
    - sena_clean_output_100.py (6.0KB) - Output cleaning (Rule 5)
    - sena_progress_auto_100.py (9.1KB) - Progress bar automation (Rule 6)
    - sena_controller_100.py (5.9KB) - Main controller orchestration
    - claude_sena_integration.py (8.5KB) - Claude Code integration layer
  - **Advanced Modules (7 files, ~50KB):**
    - final_deep_verification.py (25KB) - Deep verification system
    - offline_sync.py (14KB) - Offline synchronization capabilities
    - sena_direct_output.py (3.1KB) - Direct output handling
    - sena_silent_executor.py (5.6KB) - Silent execution mode
    - sena_transparent_layer.py (3.0KB) - Transparency layer
    - sena_mcp_server.py (5.9KB) - MCP server utilities
    - pythonstartup.py (509B) - Python startup configuration
  - **Testing & Verification (3 files, ~15KB):**
    - test_auto_rules.py (5.3KB) - Test automatic rule application (Rules 1-4)
    - test_clean_output.py (3.2KB) - Test output cleaning functionality
    - verify_rules_5_6_100.py (6.1KB) - Verify Rules 5-6 implementation
- โœ… Added ALL slash commands (122 commands total)
  - Core SENA commands (10) - System control and health
  - Development, testing, DevOps commands (112+)
  - Complete commands documentation in commands/README.md
- โœ… Added ALL configuration files
  - CLAUDE.md.template (23KB) - Operational rules (Rules 0-8)
  - sena_skills.json.example (3.3KB) - Skills configuration
  - settings.json.example - Claude Code settings
  - .env.example - Environment variables
  - VERSION - Version tracking
  - Complete configuration guide in config/README.md
- โœ… Added internal documentation (20 files)
  - Complete development history
  - Migration guides and technical specs
  - Phase completion documentation
  - Implementation details
- โœ… Updated controller/__init__.py to version 3.3.1
  - All 20 modules exported in __all__
  - Complete module documentation (Core + Advanced + Testing)
- โœ… Updated README with TRUE 100% feature parity
  - ALL 20 controller modules documented
  - ALL 122 slash commands listed
  - Internal documentation section added
  - Complete configuration files listed
  - Updated directory structure
  - Version badge updated to 2.1.0
- โœ… **ACHIEVED TRUE 100% FEATURE PARITY**
  - NO feature exclusions
  - NO "essential vs optional" categorization
  - EVERY component from SENA v3.3.1 included
  - Complete production-ready system
- โœ… Total Coverage: TRUE 100% (all features essential)

### v2.0.0 (2025-11-24) - **Initial Complete Package (Partial Coverage)**
- โœ… Added 9 core Python automation modules
- โœ… Added 10 essential slash commands
- โœ… Added configuration templates
- โœ… Coverage: ~60% (later identified as insufficient)

### v1.3.0 (2025-11-24) - **Phase 3 Autonomous Skills**
- โœ… Added 3 MCP tools for autonomous code analysis
  - sena_auto_code_review() - Quality metrics and best practices
  - sena_auto_optimize() - Performance optimization suggestions
  - sena_auto_security_scan() - OWASP Top 10 vulnerability detection
- โœ… Added 3 MCP resources for skill documentation (1,128 lines total)
  - sena://skills/auto-code-review (262 lines)
  - sena://skills/auto-optimize (387 lines)
  - sena://skills/auto-security-scan (479 lines)
- โœ… Created skills/ directory with complete skill files
- โœ… Enhanced README with Phase 3 Skills section
- โœ… Updated health endpoint to include autonomous_skills feature
- โœ… Updated directory structure showing skills folder
- โœ… Coverage increased from 37% to 57% (+20%)

### v1.2.0 (2025-11-24) - **Hook System Documentation**
- โœ… Added comprehensive hooks/README.md (complete hook system guide)
- โœ… Documented all 6 hooks with examples and troubleshooting
- โœ… Installation instructions for hook system
- โœ… Configuration guide for SENA Always-On Mode
- โœ… Testing procedures and validation steps
- โœ… Hook architecture diagram and workflow
- โœ… Security considerations and best practices
- โœ… Enhanced main README with detailed hooks section
- โœ… CLI-only features fully documented and accessible
- โœ… Updated directory structure showing all hook files

### v1.1.0 (2025-11-24) - **Knowledge Integration**
- โœ… Added 4 knowledge bases as MCP resources (2,543 lines total)
  - reasoning-frameworks.md (579 lines)
  - security-patterns.md (612 lines)
  - performance-patterns.md (544 lines)
  - architecture-patterns.md (808 lines)
- โœ… Created comprehensive docs/ directory
  - ARCHITECTURE.md (system architecture)
  - FEATURE_COMPATIBILITY.md (34-feature matrix)
  - CLAUDE_CLI_RULES.md (CLI rules documentation)
- โœ… Updated MCP server with 4 resource endpoints
- โœ… Enhanced README with knowledge base guide
- โœ… 85% feature coverage from SENA v3.3.1

### v1.0.0 (2025-11-23) - **Initial Release**
- โœ… MCP server with 5 core tools
- โœ… CLI hooks system (6 hooks)
- โœ… Automated installer
- โœ… Complete documentation
- โœ… Both Desktop + CLI support
- โœ… GitHub repository published

---

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                                                              โ•‘
โ•‘       ๐Ÿฆ SENA: Complete Intelligence for Claude             โ•‘
โ•‘                                                              โ•‘
โ•‘       Desktop + CLI โ€ข MCP + Hooks โ€ข One Package             โ•‘
โ•‘                                                              โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•