Skip to content

Commit b9a09ff

Browse files
author
Dylan Storey
committed
feat(plugin): add SessionStart hook for Metis project detection
Add hook that detects .metis directory and provides project context: - Checks for metis-mcp command availability - Outputs JSON with hookSpecificOutput for Claude - Lists available skills and MCP server info - Add MCP server configuration to plugin
1 parent 3a8536b commit b9a09ff

File tree

4 files changed

+76
-2
lines changed

4 files changed

+76
-2
lines changed

plugins/metis/.mcp.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"mcpServers": {
3+
"metis": {
4+
"command": "metis-mcp",
5+
"args": [],
6+
"env": {}
7+
}
8+
}
9+
}

plugins/metis/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Flight Levels methodology plugin for Metis work management. Includes methodology
99
| **Skills** | Flight Levels methodology guidance (decomposition, phases, patterns) |
1010
| **Agent** | `flight-levels` - Methodology expert for document selection and best practices |
1111
| **Commands** | `/metis-ralph`, `/metis-decompose`, `/cancel-metis-ralph` - Iterative work loops |
12-
| **Hooks** | Stop hook for Ralph loop control |
12+
| **Hooks** | SessionStart (project detection), Stop (Ralph loop control) |
13+
| **MCP** | Metis MCP server configuration |
1314

1415
## Skills: Flight Levels Methodology
1516

plugins/metis/hooks/hooks.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
{
2-
"description": "Metis Ralph stop hook for task execution and initiative decomposition loops",
2+
"description": "Metis hooks for project detection and Ralph loops",
33
"hooks": {
4+
"SessionStart": [
5+
{
6+
"matcher": "*",
7+
"hooks": [
8+
{
9+
"type": "command",
10+
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start-hook.sh"
11+
}
12+
]
13+
}
14+
],
415
"Stop": [
516
{
617
"matcher": "*",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
# SessionStart hook for Metis projects
3+
# Detects .metis directory and provides project context
4+
5+
# Exit silently if not in a Metis project
6+
if [ ! -d "$CLAUDE_PROJECT_DIR/.metis" ]; then
7+
exit 0
8+
fi
9+
10+
# Check if metis-mcp is installed
11+
if ! command -v metis-mcp &> /dev/null; then
12+
cat << 'ENDJSON'
13+
{
14+
"hookSpecificOutput": {
15+
"hookEventName": "SessionStart",
16+
"additionalContext": "WARNING: This is a Metis project (`.metis` directory found) but the `metis-mcp` command is not installed or not in PATH. Install it from: https://github.com/colliery-io/metis"
17+
}
18+
}
19+
ENDJSON
20+
exit 0
21+
fi
22+
23+
# Build context message for active Metis project
24+
read -r -d '' CONTEXT << 'EOF'
25+
This is a **Metis project** (detected `.metis` directory).
26+
27+
## Quick Reference
28+
- Use `mcp__metis__list_documents` to see current project state
29+
- Check active work items and their phases
30+
- Use Metis skills for methodology guidance
31+
32+
## Available Skills
33+
When working with this project:
34+
- **document-selection** - Guidance on choosing the right document type (vision, strategy, initiative, task, ADR)
35+
- **phase-transitions** - How to transition documents through phases correctly
36+
- **decomposition** - Patterns for breaking down work into tasks
37+
- **project-patterns** - Common project patterns (greenfield, tech debt, incident response, feature development)
38+
39+
## MCP Server
40+
The `metis` MCP server should be connected. If Metis tools are not available, the MCP server may need to be started.
41+
EOF
42+
43+
# Output JSON for Claude
44+
cat << ENDJSON
45+
{
46+
"hookSpecificOutput": {
47+
"hookEventName": "SessionStart",
48+
"additionalContext": "$(echo "$CONTEXT" | sed 's/"/\\"/g' | tr '\n' ' ')"
49+
}
50+
}
51+
ENDJSON
52+
53+
exit 0

0 commit comments

Comments
 (0)