Merge project_path into project: one path relative to ~/code, or to / outside it

This commit is contained in:
2026-09-25 00:00:54 +02:00
parent a28b3e0f6d
commit 56f49c1a19
3 changed files with 13 additions and 22 deletions
+7 -14
View File
@@ -15,9 +15,10 @@ Exit 2: the human is needed and stdin or stdout is not a terminal, or the interr
them typing anything. Rerunning resumes the session after either exit. Before an interrupt every
worktree is marked trusted in ~/.claude.json.
Each project has one session, "A ~/code/<path> auto-mode" (the absolute path outside ~/code),
deleted when the chunk finishes. Its transcript is archived under $AUTO_MODE_TRANSCRIPTS (default
~/.claude/auto-mode-transcripts/<path>/) whenever the human is asked and when the chunk finishes.
Each project has one session, "A <path> auto-mode", <path> being the checkout relative to ~/code,
or to / outside it, deleted when the chunk finishes. Its transcript is archived under
$AUTO_MODE_TRANSCRIPTS (default ~/.claude/auto-mode-transcripts/<path>/) whenever the human is asked
and when the chunk finishes.
JUDGE_MODEL and WORKER_MODEL override the model the project's Claude Code settings pick. A change to
this file takes effect at the next cycle boundary, once the new file answers --help.
@@ -105,15 +106,7 @@ def read_premises():
def project():
root = os.path.expanduser("~/code")
cwd = os.getcwd()
if cwd == root or cwd.startswith(f"{root}/"):
return "~/" + os.path.relpath(cwd, os.path.dirname(root))
return cwd
def project_path():
return project().removeprefix("~/code").lstrip("/") or "code"
return os.getcwd().removeprefix(os.path.expanduser("~/code/")).lstrip("/")
def session_name():
@@ -188,14 +181,14 @@ def make_private(folder):
def archive(path, note):
folder = os.path.join(ARCHIVE, project_path())
folder = os.path.join(ARCHIVE, project())
try:
stamp = time.strftime("%Y-%m-%dT%H-%M-%SZ", time.gmtime(os.path.getmtime(path)))
make_private(folder)
dest = os.path.join(folder, f"{stamp}.md")
if not os.path.exists(dest):
with open(os.open(dest, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600), "w", encoding="utf-8") as copy:
copy.write(f"# {stamp} {project_path()}\n\n{note}\n\n{render(entries(path))}\n")
copy.write(f"# {stamp} {project()}\n\n{note}\n\n{render(entries(path))}\n")
print(f"transcript: {dest}", file=sys.stderr)
except OSError as failure:
print(f"could not archive the transcript: {failure}", file=sys.stderr)