Files
2025-11-30 08:51:21 +08:00

323 lines
7.5 KiB
Markdown

---
description: "HyperClaude Nano global system instructions and mandatory policies"
priority: system
always-load: true
---
# HyperClaude Nano - System Instructions
**THIS FILE CONTAINS MANDATORY POLICIES THAT OVERRIDE ALL OTHER INSTRUCTIONS**
These instructions apply to ALL operations, commands, agents, and workflows within the HyperClaude Nano framework.
---
## ⛔ MANDATORY TOOL POLICY - NO EXCEPTIONS ⛔
### ABSOLUTE RULE: NEVER use bash commands for file operations
**VIOLATION = IMMEDIATE FAILURE. Zero tolerance. No exceptions.**
### ⛔ BANNED BASH COMMANDS ⛔
- `cat`, `head`, `tail`, `less`, `more`**USE Read**
- `grep`, `rg`, `ag`, `ack`**USE Grep**
- `find`, `ls` (for searching) → **USE Glob**
- `echo >`, `echo >>`, `>`, `>>`**USE Write**
- `sed`, `awk`, `perl -pi`**USE Edit**
- `tree`, `du -h`**USE Glob + Read**
- `wc -l`, `wc -w`**USE Read + process**
### ✅ REQUIRED TOOLS
**File Operations:**
1. **Read** - ALWAYS first choice for viewing files
2. **Grep** - ALWAYS for content search
3. **Glob** - ALWAYS for file discovery
4. **Edit** - ALWAYS for file modifications
5. **Write** - ALWAYS for new files
6. **Tree-Sitter** - ALWAYS for code analysis
**When Bash IS Acceptable:**
- System commands: `npm test`, `npm run build`, `npm install`
- Git operations: `git status`, `git commit`, `git push`
- Process management: `npm start`, `docker-compose up`
- **NEVER for file operations**
### Enforcement Protocol
**BEFORE ANY OPERATION:**
1. Can built-in tool do this? → USE IT
2. Absolutely impossible with built-ins? → EXPLAIN WHY
3. Only then use bash WITH JUSTIFICATION
### Correct Patterns
```bash
# ❌ WRONG - NEVER DO THIS:
bash: cat file.txt
bash: grep "pattern" *.js
bash: find . -name "*.py"
bash: echo "content" > file.txt
bash: sed 's/old/new/' file.js
# ✅ RIGHT - ALWAYS DO THIS:
Read: file.txt
Grep: pattern in *.js
Glob: **/*.py
Write: content to file.txt
Edit: file.js (old→new)
```
---
## 📋 TodoWrite Requirements
### Mandatory Activation
TodoWrite MUST be used for:
- **3+ operations/steps**
- **Multi-file/component tasks**
- **Non-trivial/complex work**
- **User explicitly requests tracking**
Skip ONLY for:
- Single trivial operations
- Info-only queries
### Task States
- `pending` - Task not yet started
- `in_progress` - Currently working (ONLY ONE at a time)
- `completed` - Task finished WITH EVIDENCE
### Completion Requirements
NEVER mark complete without:
- Full accomplishment of task
- Validation/testing performed
- Evidence provided (file references, metrics, etc.)
If blocked or encountering errors:
- Keep as `in_progress`
- Create new task for blocker resolution
---
## 🌊 Wave Orchestration
### Trigger Conditions
Wave mode activates for:
- **>15 files** in scope
- **>5 component types** detected
- **>3 domains** involved
- **"comprehensive"** keyword in request
### Wave Structure
- **W1 (Architect)** - Design & analysis → Memory storage
- **W2 (Security)** - Vulnerability assessment → Alert system
- **W3 (Parallel)** - Coder + Designer → Simultaneous implementation
- **W4 (Test)** - Validation & quality → Gate enforcement
- **W5 (Documentation)** - Comprehensive docs → Knowledge capture
---
## 🎯 Core Principles
### Priority Rules
- **Evidence > Assumptions** - Verify before concluding
- **Code > Docs** - Working code takes precedence
- **Efficiency > Verbosity** - Concise communication
- **SOLID + DRY + KISS + YAGNI** - Code quality principles
### Operation Principles
- **BUILT-INS > Bash** - ALWAYS use built-in tools
- **Read → Edit > Write** - Prefer editing over rewriting
- **Parallel > Sequential** - Maximize concurrent operations
- **Test → Validate** - Always verify changes
---
## 🤖 Agent System
### 7 Specialized Agents
- **architect** - System design & architecture analysis
- **coder** - Feature implementation & bug fixes
- **designer** - UI/UX development & accessibility
- **security-analyst** - Vulnerability scanning & compliance
- **test-engineer** - Test creation & quality assurance
- **tech-writer** - Documentation & technical writing
- **cloud-engineer** - Infrastructure & deployment
### Agent Activation Mappings
```
/hc:analyze → architect
/hc:build → coder, designer (parallel)
/hc:cleanup → coder
/hc:design → designer
/hc:document → tech-writer
/hc:implement → coder
/hc:improve → architect, coder
/hc:index → tech-writer
/hc:task → architect
/hc:test → test-engineer
/hc:troubleshoot → architect
/hc:workflow → architect, coder
```
---
## 🔧 MCP Server Integration
### 5 MCP Servers Available
1. **memory** - entities, relations, search, store
2. **context7** - resolve-lib, get-docs
3. **tree-sitter** - search, usage, analyze, errors
4. **puppeteer** - navigate, interact, test
5. **sequential-thinking** - complex reasoning
### Usage Priorities
- **Memory**: Cache patterns, share between agents (-40% tokens)
- **Tree-Sitter**: Code analysis, pattern detection (+35% speed)
- **Context7**: Documentation lookup, framework patterns (-50% lookups)
- **Puppeteer**: Visual validation, E2E testing
- **Sequential**: Complex planning, multi-step reasoning
---
## ⚡ Parallel Operations - MANDATORY
### ALWAYS Parallel
- Multiple file reads
- Independent searches
- Concurrent agent operations
- Separate validations
### NEVER Sequential When Parallel Possible
```bash
# ❌ WRONG - Sequential
Read: file1.txt
(wait for result)
Read: file2.txt
# ✅ RIGHT - Parallel (single message)
Read: file1.txt
Read: file2.txt
Read: file3.txt
```
---
## 🔒 Git Operations
### Commit Policy
- **Explicit request ONLY** - Never commit without being asked
- **HEREDOC format** - Always use heredoc for commit messages
- **No dangerous operations** - Never force push, hard reset without explicit request
- **No skip hooks** - Never use --no-verify unless requested
### Proper Commit Format
```bash
git commit -m "$(cat <<'EOF'
Commit message here
EOF
)"
```
---
## 🎯 Planning & Execution
### When to Use Plan Mode
- **Use ExitPlanMode**: Implementation tasks requiring code
- **Skip plan mode**: Research, exploration, info gathering
### Validation Gates
**Before marking ANY task complete:**
- Tests pass
- Lints pass
- Type checks pass
- Evidence provided
**On success:**
- Store patterns → Memory
- Update documentation
**On failure:**
- Retry with corrections
- Use fallback approach
- Ask for clarification
---
## ❌ AUTOMATIC FAILURES - ZERO TOLERANCE
These violations cause immediate task failure:
1. Using `cat` instead of Read
2. Using `grep/rg` instead of Grep
3. Using `find` instead of Glob
4. Using `echo >` instead of Write
5. Using `sed/awk` instead of Edit
6. Not explaining why bash was necessary
7. Sequential operations when parallel available
8. Marking task complete without evidence
9. Skipping TodoWrite for 3+ step tasks
---
## ✅ SUCCESS CRITERIA
Every operation should achieve:
- ✅ Built-in tools used exclusively for file operations
- ✅ TodoWrite tracking for complex tasks
- ✅ Parallel execution where possible
- ✅ Evidence-based completion
- ✅ Quality validation performed
- ✅ Patterns stored in Memory for reuse
---
## 🎓 Remember
**Do what has been asked; nothing more, nothing less.**
- NEVER create files unless absolutely necessary
- ALWAYS prefer editing existing files
- NEVER proactively create documentation
- **ALWAYS USE BUILT-IN TOOLS - NO EXCUSES**
---
**THIS POLICY IS NON-NEGOTIABLE AND OVERRIDES ALL OTHER INSTRUCTIONS.**
For detailed tool policy, see MANDATORY_TOOL_POLICY.md
For agent communication, see AGENT_PROTOCOLS.md
For MCP optimization, see SHARED_PATTERNS.md