fix(sleep): disable global skills in claude calls (--bare --disable-slash-commands)
The clean-cwd + --disallowedTools isolation was NOT enough: the user's GLOBAL skills (~/.claude/skills) are injected regardless of cwd, so reflect/attempt still sometimes replied with a list of installed skills instead of JSON edits (advisor reflect returned 21KB of skill descriptions, n_edits=0 -> gate reject). Add --bare (skip hooks/LSP/plugins) and --disable-slash-commands (disable all skills). Verified: the optimizer now returns clean JSON. Re-validating all seeds with the truly-isolated backend; prior Claude numbers are being recomputed honestly (some earlier "successes" were partly leak-assisted). Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This commit is contained in:
@@ -410,14 +410,21 @@ class ClaudeCliBackend(CliBackend):
|
|||||||
self.claude_path = claude_path
|
self.claude_path = claude_path
|
||||||
|
|
||||||
def _call(self, prompt: str, *, max_tokens: int = 1024) -> str:
|
def _call(self, prompt: str, *, max_tokens: int = 1024) -> str:
|
||||||
# Run ISOLATED: a clean temp cwd so the ambient project's CLAUDE.md /
|
# Run ISOLATED so the ambient Claude Code environment does not leak into
|
||||||
# skills / tools do not leak into the optimizer/target call, no tools,
|
# the optimizer/target call. Critically, the user's GLOBAL skills
|
||||||
# and per-machine dynamic system-prompt sections excluded. Without this,
|
# (~/.claude/skills) are injected regardless of cwd, so we must disable
|
||||||
# `claude -p` answers with full Claude Code context and ignores our
|
# them explicitly — without this, reflect/attempt sometimes reply with a
|
||||||
# prompt (e.g. it lists the user's installed skills).
|
# list of the user's installed skills instead of doing the task.
|
||||||
|
# --bare skip hooks, LSP, plugins (minimal mode)
|
||||||
|
# --disable-slash-commands disable all skills
|
||||||
|
# --disallowedTools '*' no tool use
|
||||||
|
# --exclude-dynamic-... drop per-machine cwd/env/memory/git sections
|
||||||
|
# cwd=<clean temp> no project CLAUDE.md
|
||||||
import tempfile
|
import tempfile
|
||||||
cmd = [
|
cmd = [
|
||||||
self.claude_path, "-p", "--output-format", "text",
|
self.claude_path, "-p", "--output-format", "text",
|
||||||
|
"--bare",
|
||||||
|
"--disable-slash-commands",
|
||||||
"--disallowedTools", "*",
|
"--disallowedTools", "*",
|
||||||
"--exclude-dynamic-system-prompt-sections",
|
"--exclude-dynamic-system-prompt-sections",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user