SkillOpt icon indicating copy to clipboard operation
SkillOpt copied to clipboard

sleep: a claude_home or codex_home starting with ~ is not expanded, so nothing is harvested and the skill and state land under ./~

Open 1AbdullahButt opened this issue 2 weeks ago • 0 comments

claude_home and codex_home are used as given, with no ~ expansion. JSON and YAML config files are not shell-expanded, so "claude_home": "~/.claude-work" in ~/.skillopt-sleep/config.json is read as a relative path named ~. pi_home and cursor_home are already expanded (pi_sessions_dir, cursor_projects_dir), and so is claude_home in skill_resolver.py.

Commit: 45f65ca04f5f6713bca7b9797b495696ba812751

https://github.com/microsoft/SkillOpt/blob/45f65ca04f5f6713bca7b9797b495696ba812751/skillopt_sleep/config.py#L118-L141 https://github.com/microsoft/SkillOpt/blob/45f65ca04f5f6713bca7b9797b495696ba812751/skillopt_sleep/config.py#L176-L182

What goes wrong:

  • transcripts_dir and history_path point at ~/.claude-work/... literally. The directory does not exist, so the Claude harvest finds no sessions and the night reports nothing to learn.
  • skills_dir / managed_skill_path() point at ./~/.claude-work/skills/..., so an adopted skill is written under a ~ folder in the current directory, where Claude Code never loads it.
  • state_dir compares abspath("~/.claude-work") with the real home, so state moves to ./~/.skillopt-sleep. This happens even for "claude_home": "~/.claude", which is the default.
  • codex_archived_sessions_dir has the same problem for codex_home.
  • --claude-home and --codex-home call os.path.abspath without expanduser, unlike --pi-home and --cursor-home. A quoted --claude-home "~/.claude-work", or a shell that does not expand ~, hits the same paths.

Repro:

from skillopt_sleep.config import SleepConfig, DEFAULTS

cfg = SleepConfig(data={**DEFAULTS, "claude_home": "~/.claude-work"})
print(cfg.transcripts_dir)        # ~/.claude-work/projects
print(cfg.managed_skill_path())   # ~/.claude-work/skills/skillopt-sleep-learned/SKILL.md
print(cfg.state_dir)              # <cwd>/~/.skillopt-sleep

cfg = SleepConfig(data={**DEFAULTS, "claude_home": "~/.claude"})
print(cfg.state_dir)              # <cwd>/~/.skillopt-sleep, not ~/.skillopt-sleep

Expected: ~ expands to the home directory, as it does for pi_home and cursor_home. Actual: the paths stay relative to the current directory, so nothing is harvested and the skill and state are written under ./~.

I have a fix with a regression test and will open a PR.

1AbdullahButt avatar Nov 11 '26 18:11 1AbdullahButt