Add agent-hook script and SKILLS_PROMPT.md
- Added agent-hook for future use with wrapper script - Created SKILLS_PROMPT.md for automatic skill loading - Updated mkfile to install both - Kept explicit commands in agent config (agent-hook needs wrapper)
This commit is contained in:
parent
01efe06831
commit
5fdcc039d1
|
|
@ -0,0 +1,26 @@
|
|||
# Skills System
|
||||
|
||||
You have access to specialized capabilities through the skills library.
|
||||
|
||||
## How It Works
|
||||
|
||||
Before responding to any request, evaluate if you need specialized tools or knowledge:
|
||||
|
||||
1. **Check for relevant skills**: Run `anvillm-skills list` to see available capabilities
|
||||
2. **Load what you need**: Run `anvillm-skills load <skill-name>` for any relevant skills
|
||||
3. **Apply the skill**: Follow the loaded documentation to complete the task
|
||||
|
||||
## When to Load Skills
|
||||
|
||||
Load skills proactively based on the user's request:
|
||||
|
||||
- **Agent communication** → load `anvillm-communication` skill
|
||||
- **Multi-agent workflows** → load `anvillm-communication` skill
|
||||
- **Mailbox operations** → load `anvillm-communication` skill
|
||||
|
||||
## Commands
|
||||
|
||||
- `anvillm-skills list` - List all available skills with descriptions
|
||||
- `anvillm-skills load <skill-name>` - Load specific skill documentation
|
||||
|
||||
Always check available skills first if the request requires capabilities beyond basic operations.
|
||||
3
mkfile
3
mkfile
|
|
@ -12,6 +12,8 @@ build:V:
|
|||
chmod 0755 $INSTALL_PATH/Alog
|
||||
cp scripts/anvillm-skills $INSTALL_PATH/anvillm-skills
|
||||
chmod 0755 $INSTALL_PATH/anvillm-skills
|
||||
cp scripts/agent-hook $INSTALL_PATH/agent-hook
|
||||
chmod 0755 $INSTALL_PATH/agent-hook
|
||||
cp scripts/9p-read-inbox $INSTALL_PATH/9p-read-inbox
|
||||
chmod 0755 $INSTALL_PATH/9p-read-inbox
|
||||
mkdir -p $INSTALL_PATH/Workflows
|
||||
|
|
@ -23,6 +25,7 @@ build:V:
|
|||
mkdir -p $HOME/.claude/agents
|
||||
mkdir -p $HOME/.claude/hooks
|
||||
cp kiro-cli/agent/* $HOME/.kiro/agents/
|
||||
cp kiro-cli/SKILLS_PROMPT.md $HOME/.kiro/
|
||||
cp claude/agent/* $HOME/.claude/agents/
|
||||
cp claude/hooks/* $HOME/.claude/hooks/
|
||||
chmod +x $HOME/.claude/hooks/*.sh
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Kiro (and many other agents) pass JSON payload to hook on stdin
|
||||
TIMEOUT=$(command -v gtimeout 2>/dev/null || command -v timeout 2>/dev/null || :)
|
||||
payload=$(${TIMEOUT:+"$TIMEOUT" 3} jq -c . 2>/dev/null || :)
|
||||
|
||||
# Debug: log what we received
|
||||
echo "[agent-hook] Received payload: $payload" >> /tmp/agent-hook.log
|
||||
|
||||
[[ $payload ]] || exit 0 # Just exit
|
||||
|
||||
event=''
|
||||
cwd=$PWD
|
||||
IFS=$'\t' read -r _event _cwd < <(jq -r '"\(.hook_event_name // "")\t\(.cwd // "")"' <<<"$payload") || :
|
||||
[[ ${_event:-} ]] && event=$_event
|
||||
[[ ${_cwd:-} ]] && cwd=$_cwd
|
||||
|
||||
echo "[agent-hook] Parsed event: $event, cwd: $cwd" >> /tmp/agent-hook.log
|
||||
|
||||
# Helper for anvillm state transitions
|
||||
anvillm_set_state() {
|
||||
local agent_id=${AGENT_ID:-}
|
||||
[[ $agent_id ]] && echo "$1" | 9p write "agent/$agent_id/state" 2>/dev/null || true
|
||||
}
|
||||
|
||||
case "$event" in
|
||||
agentSpawn)
|
||||
cat ~/.kiro/SKILLS_PROMPT.md
|
||||
;;
|
||||
userPromptSubmit)
|
||||
anvillm_set_state running
|
||||
;;
|
||||
preToolUse)
|
||||
;;
|
||||
postToolUse)
|
||||
;;
|
||||
stop)
|
||||
anvillm_set_state idle
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue