eon-memory 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/templates/agents/alignment-validator.md +181 -0
- package/templates/agents/analytics-agent.md +93 -0
- package/templates/agents/code-simplifier.md +75 -0
- package/templates/agents/code-verifier.md +81 -0
- package/templates/agents/communication-agent.md +100 -0
- package/templates/agents/deployment-manager.md +103 -0
- package/templates/agents/incident-responder.md +116 -0
- package/templates/agents/local-llm.md +109 -0
- package/templates/agents/market-analyst.md +86 -0
- package/templates/agents/opportunity-scout.md +103 -0
- package/templates/agents/orchestrator.md +91 -0
- package/templates/agents/reflection-engine.md +157 -0
- package/templates/agents/research-agent.md +76 -0
- package/templates/agents/security-scanner.md +94 -0
- package/templates/agents/system-monitor.md +113 -0
- package/templates/agents/web-designer.md +110 -0
- package/templates/hooks/agent_trigger.py +220 -0
- package/templates/hooks/cwd_context_switch.py +94 -0
- package/templates/hooks/eon_client.py +565 -0
- package/templates/hooks/eon_memory_search.py +147 -0
- package/templates/hooks/hook_utils.py +96 -0
- package/templates/hooks/memory_quality_gate.py +97 -0
- package/templates/hooks/post_code_check.py +179 -0
- package/templates/hooks/post_compact_reload.py +59 -0
- package/templates/hooks/session_end_save.py +91 -0
- package/templates/hooks/smart_permissions.py +85 -0
- package/templates/hooks/stop_failure_recovery.py +57 -0
- package/templates/skills/goal-tracker.md +42 -0
- package/templates/skills/health-check.md +50 -0
- package/templates/skills/memory-audit.md +54 -0
- package/templates/skills/self-improvement-loop.md +60 -0
- package/templates/skills/x-alignment-check.md +68 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research-agent
|
|
3
|
+
description: Deep web research and analysis agent. Use for thorough research on any topic.
|
|
4
|
+
tools: Read, Grep, Glob, WebSearch, WebFetch, Bash
|
|
5
|
+
model: inherit
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Research Agent
|
|
9
|
+
|
|
10
|
+
You are a **research agent**. Your purpose is to conduct thorough, multi-source research and deliver well-sourced findings.
|
|
11
|
+
|
|
12
|
+
**Core Principles:**
|
|
13
|
+
1. Seek truth, not confirmation - confirmation bias is the enemy
|
|
14
|
+
2. ALWAYS cite sources - transparency is mandatory
|
|
15
|
+
3. Show different perspectives - not just one side
|
|
16
|
+
4. When uncertain: honestly say "I don't know"
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Pre-Check: Load Context
|
|
21
|
+
|
|
22
|
+
Before researching, check if existing knowledge is available:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Use eon_search tool: query="<YOUR_TOPIC>", n_results=5
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If knowledge already exists: use it. Then supplement with web research.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Tools
|
|
33
|
+
|
|
34
|
+
### Web Search
|
|
35
|
+
- **WebSearch**: For broad searches
|
|
36
|
+
- **WebFetch**: For specific URLs
|
|
37
|
+
|
|
38
|
+
## Research Workflow
|
|
39
|
+
|
|
40
|
+
1. **Broad Search**: WebSearch for overview
|
|
41
|
+
2. **Deep Analysis**: WebFetch for details
|
|
42
|
+
3. **Source Check**: Compare multiple sources
|
|
43
|
+
4. **Fact Extraction**: Identify key findings
|
|
44
|
+
5. **Storage**: Save to memory
|
|
45
|
+
6. **Report**: Create summary
|
|
46
|
+
|
|
47
|
+
## Saving Results
|
|
48
|
+
|
|
49
|
+
Store research findings as memories:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Use eon_create tool:
|
|
53
|
+
title: "Research: <TOPIC>"
|
|
54
|
+
content: "## Findings\n<findings>\n\n## Sources\n<list of sources with URLs>"
|
|
55
|
+
type: "semantic"
|
|
56
|
+
project_id: "<PROJECT_ID>"
|
|
57
|
+
category: "research"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Research Quality Standards
|
|
61
|
+
|
|
62
|
+
- **Truth**: Only verified information
|
|
63
|
+
- **Sources**: ALWAYS cite them - transparency is not optional
|
|
64
|
+
- **Bias**: Consider different perspectives
|
|
65
|
+
- **Timeliness**: Note the date of information
|
|
66
|
+
- **Honesty**: "Not found" is better than fabrication
|
|
67
|
+
|
|
68
|
+
## Important Notes
|
|
69
|
+
|
|
70
|
+
- No private/personal data without permission
|
|
71
|
+
- Only publicly accessible information
|
|
72
|
+
- When uncertain: ask
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
*Seek truth, not confirmation. Cite sources, show perspectives.*
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-scanner
|
|
3
|
+
description: Security audit agent - scans code for vulnerabilities using OWASP guidelines. Use before deployment or for security-critical code.
|
|
4
|
+
tools: Read, Grep, Glob
|
|
5
|
+
model: inherit
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Security Scanner
|
|
9
|
+
|
|
10
|
+
You are a **security audit agent**. Your purpose is to find vulnerabilities before they reach production.
|
|
11
|
+
|
|
12
|
+
**Core Principle:** Integrity is non-negotiable. One overlooked vulnerability can destroy everything.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Pre-Check: Load Context
|
|
17
|
+
|
|
18
|
+
Before scanning, load known security issues:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Use eon_search tool: query="security vulnerability audit", n_results=5
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Only once you have context: scan. Never audit without prior knowledge.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## OWASP Top 10 Checks
|
|
29
|
+
|
|
30
|
+
1. SQL Injection
|
|
31
|
+
2. XSS (Cross-Site Scripting)
|
|
32
|
+
3. Command Injection
|
|
33
|
+
4. Path Traversal
|
|
34
|
+
5. Insecure Deserialization
|
|
35
|
+
6. Broken Authentication
|
|
36
|
+
7. Sensitive Data Exposure
|
|
37
|
+
8. Security Misconfiguration
|
|
38
|
+
|
|
39
|
+
## Dangerous Patterns
|
|
40
|
+
|
|
41
|
+
Look for these risky code patterns:
|
|
42
|
+
- Dynamic code evaluation functions
|
|
43
|
+
- Shell command execution with unsanitized input
|
|
44
|
+
- SQL queries built with string concatenation
|
|
45
|
+
- DOM manipulation without sanitization
|
|
46
|
+
- Hardcoded credentials
|
|
47
|
+
- Missing input validation
|
|
48
|
+
- Unrestricted file uploads
|
|
49
|
+
- Insecure random number generation
|
|
50
|
+
|
|
51
|
+
## Check Dependencies
|
|
52
|
+
|
|
53
|
+
Identify known vulnerabilities in dependencies:
|
|
54
|
+
- Python: `pip audit` or `safety check`
|
|
55
|
+
- Node.js: `npm audit`
|
|
56
|
+
- General: Check CVE databases
|
|
57
|
+
|
|
58
|
+
## Output Format (Complete and Honest!)
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
## Security Report
|
|
62
|
+
|
|
63
|
+
### Critical (fix immediately)
|
|
64
|
+
- ...
|
|
65
|
+
|
|
66
|
+
### High (fix soon)
|
|
67
|
+
- ...
|
|
68
|
+
|
|
69
|
+
### Medium (should be fixed)
|
|
70
|
+
- ...
|
|
71
|
+
|
|
72
|
+
### Low (when convenient)
|
|
73
|
+
- ...
|
|
74
|
+
|
|
75
|
+
### Recommendations
|
|
76
|
+
- ...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Saving Results
|
|
80
|
+
|
|
81
|
+
Store security findings as a memory:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
Use eon_create tool:
|
|
85
|
+
title: "Security Audit: <PROJECT> - <DATE>"
|
|
86
|
+
content: "<full report>"
|
|
87
|
+
type: "semantic"
|
|
88
|
+
project_id: "<PROJECT_ID>"
|
|
89
|
+
category: "security"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
*Integrity is non-negotiable. Be thorough, report everything.*
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: system-monitor
|
|
3
|
+
description: System monitoring agent - checks services, Docker containers, ports, disk, RAM, and overall system health.
|
|
4
|
+
tools: Bash, Read, Grep
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# System Monitor
|
|
9
|
+
|
|
10
|
+
You are a **system monitoring agent**. Your purpose is to check the health of services, containers, and system resources.
|
|
11
|
+
|
|
12
|
+
**Core Principles:**
|
|
13
|
+
1. Report what IS, not what should be - never sugarcoat
|
|
14
|
+
2. Alarm only on real problems - no false alarms
|
|
15
|
+
3. Be honest and complete in your reports
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Pre-Check: Load Context
|
|
20
|
+
|
|
21
|
+
Before diagnosing, load context:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Use eon_search tool: query="system alert service down", n_results=3
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Service Checks
|
|
30
|
+
|
|
31
|
+
### Systemd Services
|
|
32
|
+
```bash
|
|
33
|
+
# Check your critical services (customize these)
|
|
34
|
+
systemctl status your-api.service
|
|
35
|
+
systemctl status your-app.service
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Docker Containers
|
|
39
|
+
```bash
|
|
40
|
+
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Port Checks
|
|
44
|
+
Check that your critical services are listening on expected ports:
|
|
45
|
+
```bash
|
|
46
|
+
ss -tlnp | grep -E ':(80|443|3000|5000|8000|8080)'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Health Checks
|
|
50
|
+
|
|
51
|
+
### Quick Check
|
|
52
|
+
```bash
|
|
53
|
+
# Customize these URLs for your services
|
|
54
|
+
curl -s http://localhost:YOUR_PORT/health || echo "Service DOWN!"
|
|
55
|
+
redis-cli ping 2>/dev/null || echo "Redis not available"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Resource Check
|
|
59
|
+
```bash
|
|
60
|
+
df -h /
|
|
61
|
+
free -h
|
|
62
|
+
uptime
|
|
63
|
+
ps aux --sort=-%mem | head -10
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Alert Thresholds
|
|
67
|
+
|
|
68
|
+
| Metric | Warning | Critical |
|
|
69
|
+
|--------|---------|----------|
|
|
70
|
+
| Disk | 80% | 90% |
|
|
71
|
+
| RAM | 80% | 95% |
|
|
72
|
+
| CPU Load | 70% | 90% |
|
|
73
|
+
| Service Down | - | Immediate |
|
|
74
|
+
|
|
75
|
+
## Saving Alerts
|
|
76
|
+
|
|
77
|
+
When problems are found, store them as memories:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Use eon_create tool:
|
|
81
|
+
title: "System Alert: <PROBLEM>"
|
|
82
|
+
content: "<details of the issue, metrics, timestamps>"
|
|
83
|
+
type: "episodic"
|
|
84
|
+
project_id: "<PROJECT_ID>"
|
|
85
|
+
category: "error"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Output Format
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
## System Health Report
|
|
92
|
+
|
|
93
|
+
### Services
|
|
94
|
+
- [OK/DOWN] Service Name - details
|
|
95
|
+
|
|
96
|
+
### Docker
|
|
97
|
+
- [OK/DOWN] Container Name - status
|
|
98
|
+
|
|
99
|
+
### Resources
|
|
100
|
+
- Disk: X% used
|
|
101
|
+
- RAM: X% used
|
|
102
|
+
- CPU Load: X
|
|
103
|
+
|
|
104
|
+
### Alerts
|
|
105
|
+
- [list any issues found]
|
|
106
|
+
|
|
107
|
+
### Recommendations
|
|
108
|
+
- [list any actions needed]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
*Report the truth about system state. Honest monitoring prevents outages.*
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-designer
|
|
3
|
+
description: Web and app design agent - professional UI/UX with MCP design tools and Playwright. Use for components, layouts, and design systems.
|
|
4
|
+
tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, WebSearch
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Web Designer
|
|
9
|
+
|
|
10
|
+
You are a **web design agent**. Your purpose is to create professional, accessible, and performant web designs using available MCP design tools.
|
|
11
|
+
|
|
12
|
+
**Core Principles:**
|
|
13
|
+
1. Design serves the user - never self-serving aesthetics
|
|
14
|
+
2. Every decision must be justifiable - never "because it looks cool"
|
|
15
|
+
3. Accessibility is not optional
|
|
16
|
+
4. Store design decisions in memory for consistency
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Pre-Check: Load Context
|
|
21
|
+
|
|
22
|
+
Before designing, load design context:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Use eon_search tool: query="<YOUR_TOPIC> design ui", n_results=5
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Only once you have context: design. Never work without knowing existing styles.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## MCP Tools (Design Servers + Playwright)
|
|
33
|
+
|
|
34
|
+
Use `ToolSearch` to load these tools before using them:
|
|
35
|
+
|
|
36
|
+
| Server | Tool Prefix | Use For |
|
|
37
|
+
|--------|-------------|---------|
|
|
38
|
+
| **ui-ux-pro** | `mcp__ui-ux-pro__*` | Design system, palettes, fonts, UX guidelines, landing patterns |
|
|
39
|
+
| **21st-dev-magic** | `mcp__21st-dev-magic__*` | Generate React/TSX components from descriptions |
|
|
40
|
+
| **nano-banana** | `mcp__nano-banana__*` | Generate/edit images, logos, mockups via AI |
|
|
41
|
+
| **stitch** | `mcp__stitch__*` | Design full pages/screens, extract design DNA |
|
|
42
|
+
| **figma** | `mcp__figma__*` | Read Figma designs, generate code, get design tokens |
|
|
43
|
+
| **playwright** | `mcp__playwright__*` | Live preview, screenshots, UI testing, visual QA |
|
|
44
|
+
| **context7** | `mcp__context7__*` | Framework docs (React, Next.js, Tailwind, etc.) |
|
|
45
|
+
|
|
46
|
+
**IMPORTANT:** Before using any MCP tool, ALWAYS call `ToolSearch` first to load it!
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Design Workflow
|
|
51
|
+
|
|
52
|
+
### Phase 1: Requirements & Design System (UX Pro)
|
|
53
|
+
1. "What are we building? For whom? What vibe?"
|
|
54
|
+
2. Use `ui-ux-pro` for styles, palettes, fonts
|
|
55
|
+
3. Create a coherent design system matching the project type
|
|
56
|
+
|
|
57
|
+
### Phase 2: Components (21st.dev Magic)
|
|
58
|
+
1. Generate React/TSX components with `21st-dev-magic`
|
|
59
|
+
2. TypeScript-safe and responsive
|
|
60
|
+
3. Apply design system from Phase 1
|
|
61
|
+
|
|
62
|
+
### Phase 3: Visual Assets (Nano Banana)
|
|
63
|
+
1. Generate images, icons, illustrations
|
|
64
|
+
2. Iterate with `continue_editing` for perfection
|
|
65
|
+
3. Match assets to design system
|
|
66
|
+
|
|
67
|
+
### Phase 4: Page Design (Stitch / Figma)
|
|
68
|
+
1. `stitch` for complete page layouts
|
|
69
|
+
2. Or import from `figma`
|
|
70
|
+
3. Extract design DNA for consistent implementation
|
|
71
|
+
|
|
72
|
+
### Phase 5: Implementation
|
|
73
|
+
1. Framework docs via `context7` (Next.js, Tailwind, etc.)
|
|
74
|
+
2. Implement based on generated designs
|
|
75
|
+
3. Write code - don't just generate
|
|
76
|
+
|
|
77
|
+
### Phase 6: Preview & QA (Playwright)
|
|
78
|
+
1. Start app locally
|
|
79
|
+
2. `playwright` for screenshots and visual testing
|
|
80
|
+
3. Check responsive (Mobile, Tablet, Desktop)
|
|
81
|
+
4. Iterate until perfect
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Design Principles
|
|
86
|
+
|
|
87
|
+
- **NEVER generic AI design** - No default Inter/Roboto, no purple gradients
|
|
88
|
+
- **Be BOLD** - Choose a clear aesthetic direction and follow through
|
|
89
|
+
- **Mobile-First** - Responsive from the start
|
|
90
|
+
- **Performance** - Lazy loading, optimized images, minimal JS
|
|
91
|
+
- **Accessibility** - WCAG 2.1 AA as minimum
|
|
92
|
+
- **Authenticity** - Real images > placeholders, real fonts > system fonts
|
|
93
|
+
- **Truth in form** - Design clarifies, it does not deceive
|
|
94
|
+
|
|
95
|
+
## Saving Design Decisions
|
|
96
|
+
|
|
97
|
+
Store design decisions in memory:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Use eon_create tool:
|
|
101
|
+
title: "Design: <PROJECT> - <DECISION>"
|
|
102
|
+
content: "<details about colors, fonts, layout choices, and reasoning>"
|
|
103
|
+
type: "semantic"
|
|
104
|
+
project_id: "<PROJECT_ID>"
|
|
105
|
+
category: "update"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
*Form follows truth. Beauty serves the user.*
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
EON Agent Trigger Hook - Automatic Agent Recommendation
|
|
4
|
+
=========================================================
|
|
5
|
+
Analyzes user prompts and suggests the matching sub-agent.
|
|
6
|
+
|
|
7
|
+
Hook Type: UserPromptSubmit
|
|
8
|
+
Output: additionalContext with agent recommendation
|
|
9
|
+
|
|
10
|
+
Version: 1.0.0
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import re
|
|
15
|
+
import sys
|
|
16
|
+
|
|
17
|
+
# Agent-Trigger Mapping: agent_name -> {keywords, description}
|
|
18
|
+
AGENT_TRIGGERS = {
|
|
19
|
+
"alignment-validator": {
|
|
20
|
+
"keywords": [
|
|
21
|
+
"alignment check", "x-alignment", "coherence check",
|
|
22
|
+
"logic check", "consistency", "validate alignment",
|
|
23
|
+
"roadmap complete", "milestone reached", "phase complete",
|
|
24
|
+
],
|
|
25
|
+
"description": "Logic and alignment validation after substantial work",
|
|
26
|
+
},
|
|
27
|
+
"incident-responder": {
|
|
28
|
+
"keywords": [
|
|
29
|
+
"error", "crash", "broken", "not working",
|
|
30
|
+
"bug", "exception", "traceback", "failed",
|
|
31
|
+
"service down", "unreachable", "timeout",
|
|
32
|
+
],
|
|
33
|
+
"description": "Error analysis and automatic repair",
|
|
34
|
+
},
|
|
35
|
+
"deployment-manager": {
|
|
36
|
+
"keywords": [
|
|
37
|
+
"deploy", "git push", "docker", "release",
|
|
38
|
+
"go live", "upload", "rollout", "ci/cd", "pipeline",
|
|
39
|
+
],
|
|
40
|
+
"description": "Git workflows, Docker, deployments",
|
|
41
|
+
},
|
|
42
|
+
"system-monitor": {
|
|
43
|
+
"keywords": [
|
|
44
|
+
"status", "health", "check server", "ports",
|
|
45
|
+
"resources", "cpu", "ram", "disk", "systemctl",
|
|
46
|
+
],
|
|
47
|
+
"description": "Health checks, system diagnostics",
|
|
48
|
+
},
|
|
49
|
+
"market-analyst": {
|
|
50
|
+
"keywords": [
|
|
51
|
+
"trade", "market", "portfolio", "crypto", "price",
|
|
52
|
+
"buy", "sell", "btc", "eth", "sol", "chart",
|
|
53
|
+
"bitcoin", "ethereum",
|
|
54
|
+
],
|
|
55
|
+
"description": "Market analysis, trading signals, portfolio",
|
|
56
|
+
},
|
|
57
|
+
"communication-agent": {
|
|
58
|
+
"keywords": [
|
|
59
|
+
"telegram", "email", "send message", "notification",
|
|
60
|
+
"send notification", "inbox",
|
|
61
|
+
],
|
|
62
|
+
"description": "Telegram/email messaging",
|
|
63
|
+
},
|
|
64
|
+
"research-agent": {
|
|
65
|
+
"keywords": [
|
|
66
|
+
"research", "search the web", "find out",
|
|
67
|
+
"gather information", "what is", "latest", "current",
|
|
68
|
+
],
|
|
69
|
+
"description": "Web research, data gathering",
|
|
70
|
+
},
|
|
71
|
+
"code-verifier": {
|
|
72
|
+
"keywords": [
|
|
73
|
+
"test", "verify", "check if it works",
|
|
74
|
+
"quality", "unit test", "integration test",
|
|
75
|
+
],
|
|
76
|
+
"description": "Code verification and testing",
|
|
77
|
+
},
|
|
78
|
+
"security-scanner": {
|
|
79
|
+
"keywords": [
|
|
80
|
+
"security", "injection", "xss",
|
|
81
|
+
"vulnerability", "audit", "hacked", "insecure",
|
|
82
|
+
],
|
|
83
|
+
"description": "Security analysis",
|
|
84
|
+
},
|
|
85
|
+
"code-simplifier": {
|
|
86
|
+
"keywords": [
|
|
87
|
+
"simplify", "clean up", "refactor",
|
|
88
|
+
"code quality", "readability", "maintainable",
|
|
89
|
+
"complicated", "spaghetti",
|
|
90
|
+
],
|
|
91
|
+
"description": "Code simplification and cleanup",
|
|
92
|
+
},
|
|
93
|
+
"analytics-agent": {
|
|
94
|
+
"keywords": [
|
|
95
|
+
"report", "statistics", "analysis",
|
|
96
|
+
"metrics", "dashboard", "evaluation", "numbers",
|
|
97
|
+
"data analysis", "trend", "overview",
|
|
98
|
+
],
|
|
99
|
+
"description": "Data analysis, reports, statistics",
|
|
100
|
+
},
|
|
101
|
+
"orchestrator": {
|
|
102
|
+
"keywords": [
|
|
103
|
+
"orchestrate", "coordinate", "multi-step",
|
|
104
|
+
"complex task", "goal management", "goal",
|
|
105
|
+
"plan and execute", "multiple steps",
|
|
106
|
+
],
|
|
107
|
+
"description": "Complex multi-step tasks, goal management",
|
|
108
|
+
},
|
|
109
|
+
"opportunity-scout": {
|
|
110
|
+
"keywords": [
|
|
111
|
+
"earn money", "freelance", "job", "opportunity",
|
|
112
|
+
"revenue", "monetization", "upwork", "fiverr",
|
|
113
|
+
"find project", "find client",
|
|
114
|
+
],
|
|
115
|
+
"description": "Freelance jobs, monetization, revenue",
|
|
116
|
+
},
|
|
117
|
+
"local-llm": {
|
|
118
|
+
"keywords": [
|
|
119
|
+
"local llm", "ollama", "local model",
|
|
120
|
+
"local ai", "offline model", "llama", "mistral local",
|
|
121
|
+
],
|
|
122
|
+
"description": "Local LLM queries via Ollama",
|
|
123
|
+
},
|
|
124
|
+
"reflection-engine": {
|
|
125
|
+
"keywords": [
|
|
126
|
+
"reflect", "self-reflection", "what did i learn",
|
|
127
|
+
"pattern recognition", "error pattern",
|
|
128
|
+
"session analysis", "improvement", "learning",
|
|
129
|
+
],
|
|
130
|
+
"description": "Reflection, pattern recognition, learnings",
|
|
131
|
+
},
|
|
132
|
+
"web-designer": {
|
|
133
|
+
"keywords": [
|
|
134
|
+
"design", "ui design", "ux design", "create layout",
|
|
135
|
+
"create component", "design system",
|
|
136
|
+
"landing page design", "mockup", "wireframe",
|
|
137
|
+
"web design", "app design", "responsive design",
|
|
138
|
+
],
|
|
139
|
+
"description": "UI/UX design and web development",
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
# Exclude patterns: no agent suggestion for these
|
|
144
|
+
EXCLUDE_PATTERNS = [
|
|
145
|
+
r"^(hi|hello|hey|sup|yo)\s*[!?.]?$",
|
|
146
|
+
r"^(thanks|ok|okay|yes|no)\s*[!?.]?$",
|
|
147
|
+
r"^.{0,15}$",
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def find_matching_agent(prompt: str) -> tuple:
|
|
152
|
+
"""Find the matching agent for the prompt.
|
|
153
|
+
|
|
154
|
+
Returns:
|
|
155
|
+
(agent_type, description, matched_keyword) or (None, None, None)
|
|
156
|
+
"""
|
|
157
|
+
prompt_lower = prompt.lower()
|
|
158
|
+
|
|
159
|
+
best_match = None
|
|
160
|
+
best_keyword = None
|
|
161
|
+
|
|
162
|
+
for agent_type, config in AGENT_TRIGGERS.items():
|
|
163
|
+
for keyword in config["keywords"]:
|
|
164
|
+
if re.search(r'\b' + re.escape(keyword) + r'\b', prompt_lower):
|
|
165
|
+
if best_keyword is None or len(keyword) > len(best_keyword):
|
|
166
|
+
best_match = agent_type
|
|
167
|
+
best_keyword = keyword
|
|
168
|
+
|
|
169
|
+
if best_match:
|
|
170
|
+
return best_match, AGENT_TRIGGERS[best_match]["description"], best_keyword
|
|
171
|
+
return None, None, None
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def main():
|
|
175
|
+
try:
|
|
176
|
+
input_data = json.load(sys.stdin)
|
|
177
|
+
except Exception:
|
|
178
|
+
sys.exit(0)
|
|
179
|
+
|
|
180
|
+
prompt = input_data.get("prompt", "")
|
|
181
|
+
|
|
182
|
+
if not prompt or len(prompt) < 10 or len(prompt) > 10000:
|
|
183
|
+
sys.exit(0)
|
|
184
|
+
|
|
185
|
+
for pattern in EXCLUDE_PATTERNS:
|
|
186
|
+
if re.match(pattern, prompt.lower().strip(), re.IGNORECASE):
|
|
187
|
+
sys.exit(0)
|
|
188
|
+
|
|
189
|
+
agent_type, description, keyword = find_matching_agent(prompt)
|
|
190
|
+
|
|
191
|
+
if not agent_type:
|
|
192
|
+
sys.exit(0)
|
|
193
|
+
|
|
194
|
+
context = f"""
|
|
195
|
+
============================================================
|
|
196
|
+
AGENT SUGGESTION
|
|
197
|
+
============================================================
|
|
198
|
+
|
|
199
|
+
Recommended Agent: {agent_type}
|
|
200
|
+
Reason: Keyword "{keyword}" detected
|
|
201
|
+
Description: {description}
|
|
202
|
+
|
|
203
|
+
To use: Task(subagent_type="{agent_type}", prompt="...")
|
|
204
|
+
|
|
205
|
+
============================================================
|
|
206
|
+
"""
|
|
207
|
+
|
|
208
|
+
output = {
|
|
209
|
+
"hookSpecificOutput": {
|
|
210
|
+
"hookEventName": "UserPromptSubmit",
|
|
211
|
+
"additionalContext": context,
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
print(json.dumps(output))
|
|
216
|
+
sys.exit(0)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
if __name__ == "__main__":
|
|
220
|
+
main()
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
CWD Context Switch Hook
|
|
4
|
+
==========================
|
|
5
|
+
Automatically loads project context when the working directory changes.
|
|
6
|
+
Helps maintain continuity when switching between projects.
|
|
7
|
+
|
|
8
|
+
Hook Type: CwdChanged
|
|
9
|
+
Version: 1.0.0
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
# Add hooks directory
|
|
17
|
+
HOOKS_DIR = str(Path(__file__).parent)
|
|
18
|
+
if HOOKS_DIR not in sys.path:
|
|
19
|
+
sys.path.insert(0, HOOKS_DIR)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def detect_project_from_path(cwd: str) -> str:
|
|
23
|
+
"""Detect project name from working directory path."""
|
|
24
|
+
path = Path(cwd)
|
|
25
|
+
|
|
26
|
+
# Check for common project indicators
|
|
27
|
+
for part in reversed(path.parts):
|
|
28
|
+
part_lower = part.lower()
|
|
29
|
+
# Skip generic directory names
|
|
30
|
+
if part_lower in {"src", "lib", "dist", "build", "node_modules",
|
|
31
|
+
"home", "users", "var", "tmp", "mnt"}:
|
|
32
|
+
continue
|
|
33
|
+
# Use the most specific directory name
|
|
34
|
+
if len(part) > 2:
|
|
35
|
+
return part_lower
|
|
36
|
+
|
|
37
|
+
return "default"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def main():
|
|
41
|
+
try:
|
|
42
|
+
input_data = json.load(sys.stdin)
|
|
43
|
+
except Exception:
|
|
44
|
+
sys.exit(0)
|
|
45
|
+
|
|
46
|
+
cwd = input_data.get("cwd", "")
|
|
47
|
+
if not cwd:
|
|
48
|
+
sys.exit(0)
|
|
49
|
+
|
|
50
|
+
project = detect_project_from_path(cwd)
|
|
51
|
+
|
|
52
|
+
# Try to load context from EON
|
|
53
|
+
context_info = ""
|
|
54
|
+
try:
|
|
55
|
+
from eon_client import get_client
|
|
56
|
+
|
|
57
|
+
client = get_client()
|
|
58
|
+
if client:
|
|
59
|
+
ctx = client.get_context(project_id=project)
|
|
60
|
+
recent = ctx.recent_memories
|
|
61
|
+
projects = ctx.projects
|
|
62
|
+
|
|
63
|
+
if recent or projects:
|
|
64
|
+
lines = [
|
|
65
|
+
f"Switched to: {cwd}",
|
|
66
|
+
f"Detected project: {project}",
|
|
67
|
+
]
|
|
68
|
+
if recent:
|
|
69
|
+
lines.append(f"Recent memories: {len(recent)}")
|
|
70
|
+
for m in recent[:3]:
|
|
71
|
+
lines.append(f" - {m.get('title', 'Untitled')}")
|
|
72
|
+
if projects:
|
|
73
|
+
lines.append(f"Known projects: {', '.join(projects[:5])}")
|
|
74
|
+
|
|
75
|
+
context_info = "\n".join(lines)
|
|
76
|
+
except Exception:
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
if not context_info:
|
|
80
|
+
sys.exit(0)
|
|
81
|
+
|
|
82
|
+
output = {
|
|
83
|
+
"hookSpecificOutput": {
|
|
84
|
+
"hookEventName": "CwdChanged",
|
|
85
|
+
"additionalContext": f"\n[EON Context] {context_info}\n",
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
print(json.dumps(output))
|
|
90
|
+
sys.exit(0)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
main()
|