Consolidate all YAS files under ~/.claude/yas/ - #120
Merged
Conversation
Implements the consolidate-claude-dir-layout OpenSpec change: every YAS-owned file except yas.toml now lives under $CLAUDE_DIR/yas/, split into cache/ (regenerable), state/runtime/ (internal), state/signals/ (inbound), and state/sessions/ (mon handoff), with a version.json schema stamp. Paths are centralized as call-time functions in constants.py; a lazy idempotent runtime migration plus an eager installer migration move users automatically, the deprecated statusline-theme file is retired (folded into yas.toml by the installer), and uninstall now sweeps the whole subtree while preserving yas.toml. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- fold_legacy_theme: insert theme into an existing [appearance] table instead of appending a duplicate header (a TOML parse error), and fall back to tomli when tomllib is missing (Python 3.10) - migrate(): only delete statusline-theme once yas.toml actually contains a theme= line, so a failed fold can't lose the value; move mkstemp inside the OSError guard so migrate() never raises - config: derive the TOML cache path from the passed config_dir so sandboxed callers (tests) no longer write to the real ~/.claude - demo: seed logs at the new yas/state/runtime paths and pre-stamp version.json so the lazy migration can't eat the seeded rate log - sync skills/uninstall/SKILL.md with the extended do_uninstall sweep Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
tmck-code
marked this pull request as ready for review
August 20, 2026 11:24
Users running ops/install.sh want visibility into what migrate() is doing to their config dir. Add an opt-in verbose mode that logs each move/delete as it happens; the lazy render-time migration path stays silent so normal statusline renders aren't spammed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
tmck-code
pushed a commit
that referenced
this pull request
Aug 20, 2026
…/ path consolidation Resolves conflicts between the #120 path-consolidation (all YAS files moved under ~/.claude/yas/) and the transcript-parse-cache feature by routing the transcript cache path through a new transcript_cache_path() helper in constants.py, matching the consolidated cache_dir() convention. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Implements the
consolidate-claude-dir-layoutOpenSpec change (openspec/changes/consolidate-claude-dir-layout/). YAS scattered seven files and one directory across the top level of~/.claude/(statusline-*.log,statusline-output/,yas-last-prompt.json,terminal-width, …) with no cache/state distinction, no uninstall cleanup, and path constants copy-pasted across four places. This consolidates everything YAS owns — except the user'syas.toml— into a single~/.claude/yas/subtree, with an automatic migration so existing users keep their state. Bumps the version to 0.8.0.Changes
Layout: before
classDiagram direction LR class ClaudeDir["~/.claude/"] { +yas.toml +yas.toml.cache +statusline-theme +statusline-tokens.log +statusline-token-rate.log +statusline-render.log +yas-last-prompt.json +terminal-width } class StatuslineOutput["statusline-output/"] { +statusline.~sid~.json } ClaudeDir *-- StatuslineOutputLayout: after
classDiagram direction LR class ClaudeDir["~/.claude/"] { +yas.toml } class Yas["yas/"] class Cache["cache/"] { +config.toml.cache } class State["state/"] { +version.json } class Runtime["runtime/"] { +tokens.log +token-rate.log +render.log } class Signals["signals/"] { +last-prompt.json +terminal-width } class Sessions["sessions/"] { +~sid~.json } ClaudeDir *-- Yas Yas *-- Cache Yas *-- State State *-- Runtime State *-- Signals State *-- SessionsPer-file dispositions:
tokens.log,last-prompt.json, andterminal-widthare moved (contents preserved); the rolling logs,yas.toml.cache, andstatusline-output/are deleted (regenerable);statusline-themeis folded intoyas.tomlby the installer, then deleted.Automatic migration (runtime + installer)
claude/yas/migrate.py: lazy, idempotent, lock-free migration guarded by a singleversion.jsonstat per render; durable files are moved via no-clobber atomic renames; marker written last, atomically. Marked# REMOVE AFTER 0.11.0.ops/install.shruns the same migration eagerly, folds a legacystatusline-themevalue intoyas.toml(validated before replacing), anduninstallnow sweeps the wholeyas/subtree plus legacy files, preservingyas.toml.statusline-themeread path is removed fromconfig.py.Centralized path API
constants.py; no module outside it importsCLAUDE_DIR(grep-audited).session.py's duplicate constant is gone;test/conftest.pypatches one place instead of eight modules.ops/alacritty.pynow honoursCLAUDE_CONFIG_DIR(previously hardcoded$HOME, a latent bug) and writes the new signals path.Tests
yas/+yas.toml, and prompt-hook path coverage; 34 existing tests adapted to the new paths. Suite: 1523 passed.Checklist
Screenshots / recording
Benchmark
mainPRSystem info
🤖 Generated with Claude Code