feat: 更新钩子模板检查逻辑,支持基于唯一模式的命令匹配;在搜索元数据中添加回退模式字段

This commit is contained in:
catlog22
2025-12-22 10:25:53 +08:00
parent f3f2051c45
commit 17002345c9
3 changed files with 26 additions and 10 deletions

View File

@@ -138,14 +138,14 @@ const HOOK_TEMPLATES = {
category: 'memory',
timeout: 5000
},
// Session Context - Fires once per session at startup
// Uses state file to detect first prompt, only fires once
// Session Context - Progressive disclosure based on session state
// First prompt: returns cluster overview, subsequent: intent-matched sessions
'session-context': {
event: 'UserPromptSubmit',
matcher: '',
command: 'bash',
args: ['-c', 'STATE_FILE="/tmp/.ccw-session-$CLAUDE_SESSION_ID"; [ -f "$STATE_FILE" ] && exit 0; touch "$STATE_FILE"; curl -s -X POST -H "Content-Type: application/json" -d "{\\"sessionId\\":\\"$CLAUDE_SESSION_ID\\"}" http://localhost:3456/api/hook/session-context 2>/dev/null | jq -r ".content // empty"'],
description: 'Load session context once at startup (cluster overview)',
command: 'ccw',
args: ['hook', 'session-context', '--stdin'],
description: 'Progressive session context (cluster overview → intent matching)',
category: 'context',
timeout: 5000
}