SENA Controller
by Sena1996
README.md
# ๐ฆ SENA Controller - Complete Package
**Universal AI intelligence system for Claude Desktop + Claude Code CLI**
[](https://modelcontextprotocol.io/)
[](https://github.com/Sena1996/sena-mcp-server)
[](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 โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues