fix(audit-h2,h3): remove bare-name bypass in compose-solution phase-2; backup settings.json in activate_hooks

- phase-2-decompose.md: delete 'or researcher if that agent is present in the user's
  global fleet' clause that silently bypassed the kei-namespace. Replace with an
  explicit prefer-kei note warning that bare 'researcher' matches only the user's
  personal fleet and may have divergent handoffs.
- install.sh activate_hooks(): call backup_file "$target" on the merge path
  (after the 'create new' early-return) so ERR-trap rollback can restore the
  pre-merge settings.json. Previously an ERR in the jq-merge or mv left no
  backup pair to restore.
This commit is contained in:
Parfii-bot 2026-04-21 20:07:42 +08:00
parent 77184ca2ae
commit a23cde32a8
2 changed files with 9 additions and 3 deletions

View file

@ -142,6 +142,10 @@ activate_hooks() {
say "created $target from snippet (no prior settings.json)"
return 0
fi
# Merge path: back up the pre-merge settings.json so rollback can restore
# it if a later step ERR-traps. The "create new" path above exits before
# reaching here, so backup_file is only invoked when $target exists.
backup_file "$target"
# Merge: walk each matcher-group in PostToolUse / PreToolUse, append hooks,
# unique_by command. jq filter is written for readability, not golf.
tmp="$(mktemp "$target.XXXXXX")"

View file

@ -8,9 +8,11 @@ independently researched and composed.
For heavy / deep-domain / unfamiliar-domain tasks, delegate to the
`research` skill (`skills/research/SKILL.md`, Variant C "Deep decomposition"
is the pattern — Wave 0 decomposition, then Wave 1 per-component
exploration). Invoke via the Agent tool with `subagent_type: kei-researcher`
(or `researcher` if that agent is present in the user's global fleet). Pass
`DESC` as the research question with the constraint:
exploration). Invoke via the Agent tool with `subagent_type: kei-researcher`.
Always prefer `kei-researcher` when it exists in the kit; bare `researcher`
matches only the user's personal fleet and may have divergent handoffs — do
not fall back to it silently. Pass `DESC` as the research question with the
constraint:
> Decompose into 2-5 orthogonal components, each with a 1-line description
> and 3-5 distinctive keywords suitable for grep prior-art search.