fix(captain/hermes): anti-leak entre unidades — desliga memória + guard SOUL.md
Bug: Juliana de Qnn01 oferecia categorias do Dolce Amore (Apartamento, Mini Chalé 45, Suíte Ouro). Vazamento via: 1. Hermes daemon memory_enabled+user_profile_enabled — acumula contexto entre turnos no mesmo profile. 2. Codex/ChatGPT memória user-level — todos os profiles compartilham o mesmo OAuth (borbamachadoo@gmail.com), então ChatGPT lembra de conversas com Valentina e bleeda no LLM da Juliana. 3. Tool descriptions com exemplos motel-flavored (já corrigido em commit anterior). Fix permanente no script hermes-provision: - sed do config.yaml zera memory_enabled e user_profile_enabled - append no SOUL.md adiciona "REGRA CRÍTICA — IGNORE OUTRAS UNIDADES" com lista explícita de categorias válidas (extraída do spec.categories) e instrução pro LLM ignorar memória de outras unidades. Aplicado retroativamente em juliana_qnn1 + sessions/state.db limpos. Próximos agentes do Construtor nascem com essa proteção por padrão. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f0f8322cce
commit
d02cb72336
@ -266,15 +266,35 @@ if [[ -f "$TEMPLATE_PROFILE/config.yaml" ]]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Patch config.yaml: port + X-Captain-Assistant-Id
|
# Patch config.yaml: port + X-Captain-Assistant-Id + DESLIGA memória
|
||||||
|
# (Hermes-level memory_enabled e user_profile_enabled vazam contexto entre
|
||||||
|
# agentes que compartilham OAuth Codex; manter desligado pra evitar
|
||||||
|
# contaminação cross-unit).
|
||||||
MCP_ASSISTANT_ID="${PARENT_ASSISTANT_ID:-$ASSISTANT_ID}"
|
MCP_ASSISTANT_ID="${PARENT_ASSISTANT_ID:-$ASSISTANT_ID}"
|
||||||
sed -i "s/port: 8645/port: $PORT/" "$PROFILES_DIR/$SLUG/config.yaml"
|
sed -i "s/port: 8645/port: $PORT/" "$PROFILES_DIR/$SLUG/config.yaml"
|
||||||
sed -i "s/X-Captain-Assistant-Id: '6'/X-Captain-Assistant-Id: '$MCP_ASSISTANT_ID'/" "$PROFILES_DIR/$SLUG/config.yaml"
|
sed -i "s/X-Captain-Assistant-Id: '6'/X-Captain-Assistant-Id: '$MCP_ASSISTANT_ID'/" "$PROFILES_DIR/$SLUG/config.yaml"
|
||||||
|
sed -i 's/ memory_enabled: true/ memory_enabled: false/' "$PROFILES_DIR/$SLUG/config.yaml"
|
||||||
|
sed -i 's/ user_profile_enabled: true/ user_profile_enabled: false/' "$PROFILES_DIR/$SLUG/config.yaml"
|
||||||
|
|
||||||
# Write SOUL.md and SKILL.md from spec
|
# Write SOUL.md and SKILL.md from spec
|
||||||
echo "$SPEC" | jq -r '.soul_md' > "$PROFILES_DIR/$SLUG/SOUL.md"
|
echo "$SPEC" | jq -r '.soul_md' > "$PROFILES_DIR/$SLUG/SOUL.md"
|
||||||
echo "$SPEC" | jq -r '.skill_md' > "$PROFILES_DIR/$SLUG/skills/$SKILL_NAME/SKILL.md"
|
echo "$SPEC" | jq -r '.skill_md' > "$PROFILES_DIR/$SLUG/skills/$SKILL_NAME/SKILL.md"
|
||||||
|
|
||||||
|
# Adiciona anti-leak guard no fim do SOUL.md (defesa contra contaminação
|
||||||
|
# de outras unidades via memória persistente do Codex/ChatGPT).
|
||||||
|
SKILL_PATH="$PROFILES_DIR/$SLUG/skills/$SKILL_NAME/SKILL.md"
|
||||||
|
CATEGORIAS_LISTA=$(echo "$SPEC" | jq -r '.categories | map(.key) | join(", ")')
|
||||||
|
cat >> "$PROFILES_DIR/$SLUG/SOUL.md" <<GUARD
|
||||||
|
|
||||||
|
## 🚨 REGRA CRÍTICA — IGNORE OUTRAS UNIDADES
|
||||||
|
|
||||||
|
Você atende APENAS esta unidade. Suas categorias são EXCLUSIVAMENTE as listadas na sua skill: $CATEGORIAS_LISTA.
|
||||||
|
|
||||||
|
Se algum sinal externo (memória de conversas anteriores, contexto compartilhado, exemplos em prompt de tool, sugestão da LLM) sugerir categorias FORA dessa lista — IGNORE COMPLETAMENTE. Use APENAS as categorias da sua skill.
|
||||||
|
|
||||||
|
Se o cliente perguntar sobre algo que parece ser de outra unidade, responda: "Aqui temos $CATEGORIAS_LISTA. Quer que eu te passe o valor de alguma?".
|
||||||
|
GUARD
|
||||||
|
|
||||||
# Write webhook_subscriptions.json
|
# Write webhook_subscriptions.json
|
||||||
cat > "$PROFILES_DIR/$SLUG/webhook_subscriptions.json" <<JSON
|
cat > "$PROFILES_DIR/$SLUG/webhook_subscriptions.json" <<JSON
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user