load-skills-and-agents.sh bash
81 lines 2.5 KB
Raw
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd feat(calendar): enforce agent context tiers in retrieval AP… Human minor ⚠ breaking 1 day ago
1 #!/usr/bin/env bash
2 ######################################################################
3 # load-skills-and-agents.sh
4 #
5 # Imports the 5 Knowtation skills and the 22 agent definitions
6 # (18 conveyor-belt + 1 controller + 3 bridges) into Paperclip.
7 #
8 # Run AS the paperclip user, AFTER push-secrets.sh AND wire-knowtation-mcp.sh
9 # have both passed:
10 # sudo -u paperclip /opt/paperclip/scripts/load-skills-and-agents.sh
11 #
12 # Idempotent: re-runs replace existing skills/agents with the latest from
13 # /opt/paperclip/skills/ and /opt/paperclip/agents/.
14 ######################################################################
15
16 set -euo pipefail
17
18 PAPERCLIP_HOME=/opt/paperclip
19
20 # Sanity checks before we touch anything.
21 if [[ ! -d "$PAPERCLIP_HOME/skills" ]]; then
22 echo "FAIL: $PAPERCLIP_HOME/skills missing. Did install.sh complete?"
23 exit 1
24 fi
25
26 if [[ ! -d "$PAPERCLIP_HOME/agents" ]]; then
27 echo "FAIL: $PAPERCLIP_HOME/agents missing. Did install.sh complete?"
28 exit 1
29 fi
30
31 # Verify every skill compiles via Node.
32 echo "[load] Verifying skill modules compile..."
33 SKILL_FILES=(
34 "$PAPERCLIP_HOME/skills/hub-client.mjs"
35 "$PAPERCLIP_HOME/skills/read-style-guide.mjs"
36 "$PAPERCLIP_HOME/skills/read-positioning.mjs"
37 "$PAPERCLIP_HOME/skills/read-playbook.mjs"
38 "$PAPERCLIP_HOME/skills/search-vault.mjs"
39 "$PAPERCLIP_HOME/skills/write-draft.mjs"
40 )
41
42 for f in "${SKILL_FILES[@]}"; do
43 if [[ ! -r "$f" ]]; then
44 echo " FAIL: $f missing or unreadable"
45 exit 1
46 fi
47 node --check "$f" && echo " ok: $(basename "$f")"
48 done
49
50 # Verify every agent yaml parses.
51 echo ""
52 echo "[load] Verifying agent YAML files parse..."
53 AGENT_DIRS=(controller bornfree storefree knowtation bridges)
54 TOTAL=0
55 for d in "${AGENT_DIRS[@]}"; do
56 for yaml in "$PAPERCLIP_HOME/agents/$d"/*.yaml; do
57 if [[ ! -r "$yaml" ]]; then continue; fi
58 python3 -c "import yaml; yaml.safe_load(open('$yaml'))" || {
59 echo " FAIL: $yaml does not parse as YAML"
60 exit 1
61 }
62 echo " ok: ${yaml#$PAPERCLIP_HOME/agents/}"
63 TOTAL=$((TOTAL + 1))
64 done
65 done
66 echo " total agents loaded: $TOTAL"
67
68 # Trigger Paperclip to reload (if it has a reload mechanism) — falls back to systemd reload.
69 echo ""
70 echo "[load] Asking Paperclip to reload..."
71 sudo systemctl reload paperclip.service 2>/dev/null || sudo systemctl restart paperclip.service
72 sleep 3
73
74 if systemctl is-active --quiet paperclip.service; then
75 echo "[load] PASS — Paperclip restarted cleanly with $TOTAL agents."
76 exit 0
77 else
78 echo "[load] FAIL — Paperclip did not start. Check logs:"
79 echo " journalctl -u paperclip.service -n 50"
80 exit 1
81 fi
File History 2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd feat(calendar): enforce agent context tiers in retrieval AP… Human minor 1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6 docs: accept Calendar Events v0 spec with Phase 0 security … Human 1 day ago