{"draft":null,"from":27,"to":28,"files":[{"path":"client/src/state-dir.ts","added":39,"removed":10,"diff":"--- a/client/src/state-dir.ts\n+++ b/client/src/state-dir.ts\n@@ -1,27 +1,56 @@\n // Where abso keeps its state (the rename from avcs). Reading takes .abso/ first, then .avcs/, so a folder in\n-// either works. A new folder is still made with .avcs/ for now: an edit mod or Cursor hook installed before the\n-// rename looks only for .avcs/config.json, and would stop recording a .abso/ folder's edits without a word.\n-// New folders move to .abso/ once installs can say which mods know it; `abso migrate` will move old ones. The\n-// user's files are written to ~/.abso/ (an older client that can't find them says so: it isn't silent).\n-// No imports from the rest of the client, so any module can use this.\n+// either works. A new folder is made with .abso/ unless an edit mod installed here is from before the rename:\n+// such a mod looks only for .avcs/config.json, and would stop recording a .abso/ folder's edits without a word.\n+// So a new folder gets .avcs/ while any installed mod is older than MOD_KNOWS_ABSO, and .abso/ otherwise.\n+// The user's files are written to ~/.abso/ (an older client that can't find them says so: it isn't silent).\n+// Nothing here imports from the rest of the client, so any module can use this.\n \n-import { existsSync } from \"node:fs\";\n+import { existsSync, readFileSync } from \"node:fs\";\n+import { homedir } from \"node:os\";\n import { join } from \"node:path\";\n \n export const STATE_DIR = \".abso\";\n export const OLD_STATE_DIR = \".avcs\";\n const STATE_DIRS = [STATE_DIR, OLD_STATE_DIR] as const;\n \n-/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else .avcs for a folder not made yet (see above). */\n+/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else the new folder's name (newFolderDir). */\n export function stateDir(root: string): string {\n \tfor (const name of STATE_DIRS) if (existsSync(join(root, name, \"config.json\"))) return join(root, name);\n \tfor (const name of STATE_DIRS) if (existsSync(join(root, name))) return join(root, name);\n-\treturn join(root, NEW_FOLDER_DIR);\n+\treturn join(root, newFolderDir());\n }\n \n-/** What a new folder is made with: .avcs until installed mods can be relied on to know .abso. */\n-export const NEW_FOLDER_DIR: string = OLD_STATE_DIR;\n+/** The first mod version whose hooks look for .abso/config.json as well as .avcs/config.json. */\n+export const MOD_KNOWS_ABSO = [0, 2, 0] as const;\n \n+/** Every name a mod has been installed under, in Claude Code's skills folder. */\n+const MOD_NAMES = [\"avcs\", \"avcs-view\", \"abso\", \"abso-view\"] as const;\n+\n+function versionAtLeast(version: string, min: readonly number[]): boolean {\n+\tconst parts = version.split(\"+\")[0]!.split(\".\").map(Number);\n+\tfor (let i = 0; i < min.length; i++) {\n+\t\tconst have = parts[i] ?? 0;\n+\t\tif (have !== min[i]) return have > min[i]!;\n+\t}\n+\treturn true;\n+}\n+\n+/** What a new folder is made with: .abso, unless an installed mod is older than the rename (see the top). */\n+export function newFolderDir(env: Readonly<Record<string, string | undefined>> = process.env): string {\n+\tconst skills = join(env.CLAUDE_CONFIG_DIR || join(homedir(), \".claude\"), \"skills\");\n+\tfor (const name of MOD_NAMES) {\n+\t\tlet version: unknown;\n+\t\ttry {\n+\t\t\tversion = (JSON.parse(readFileSync(join(skills, name, \".avcs-install.json\"), \"utf8\")) as { version?: unknown })\n+\t\t\t\t.version;\n+\t\t} catch {\n+\t\t\tcontinue; // not installed, or no readable record\n+\t\t}\n+\t\tif (typeof version !== \"string\" || !versionAtLeast(version, MOD_KNOWS_ABSO)) return OLD_STATE_DIR;\n+\t}\n+\treturn STATE_DIR;\n+}\n+\n /** A file under the user's home to read: ~/.abso/<parts>, else the old ~/.avcs/<parts> when only that exists, else the new place. */\n export function homeFile(home: string, ...parts: string[]): string {\n \tfor (const name of STATE_DIRS) {"}],"unmatched":[]}