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

Merged
lilleman merged 4 commits from project-path into main 2026-09-25 00:10:04 +02:00
4 changed files with 15 additions and 23 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)
+6 -7
View File
@@ -56,17 +56,16 @@ class HumanTurns(unittest.TestCase):
class Project(unittest.TestCase):
def test_names_a_checkout_under_code_by_its_relative_path_and_any_other_by_its_absolute_one(self):
def test_names_a_checkout_relative_to_code_and_any_other_relative_to_root(self):
with unittest.mock.patch.dict(os.environ, {"HOME": "/h"}):
with unittest.mock.patch("os.getcwd", return_value="/h/code/a/b"):
self.assertEqual(loop.session_name(), "A ~/code/a/b auto-mode")
self.assertEqual(loop.project_path(), "a/b")
self.assertEqual(loop.project(), "a/b")
self.assertEqual(loop.session_name(), "A a/b auto-mode")
with unittest.mock.patch("os.getcwd", return_value="/h/code"):
self.assertEqual(loop.session_name(), "A ~/code auto-mode")
self.assertEqual(loop.project_path(), "code")
self.assertEqual(loop.project(), "h/code")
with unittest.mock.patch("os.getcwd", return_value="/srv/x"):
self.assertEqual(loop.session_name(), "A /srv/x auto-mode")
self.assertEqual(loop.project_path(), "srv/x")
self.assertEqual(loop.project(), "srv/x")
self.assertEqual(loop.session_name(), "A srv/x auto-mode")
class WorkerArgs(unittest.TestCase):
+1 -1
View File
@@ -6,7 +6,7 @@
## loop-claude: one session per project, at a fixed id
2026-09-21, lilleman. Serves goal 4. One fixed id per project keeps the session picker at one entry per project and makes any transcript under that id the script's own to delete. Valid while the picker lists sessions by id.
2026-09-21, lilleman; the rename and mirrored-path costs accepted 2026-09-25 by larv-review. Serves goal 4. One fixed id per project keeps the session picker at one entry per project and makes any transcript under that id the script's own to delete. The id derives from the checkout's path, so a rename migrates nothing: transcripts open under the old id stay in the picker until the human deletes them, a one-human audience not being worth the code, and the `auto-mode` → `loop-claude` rename in the plan ships on the same terms. A checkout outside `~/code` mirroring a path inside it would share its id; none does. Valid while the picker lists sessions by id.
## loop-claude: the trust file is rewritten before an interrupt
+1 -1
View File
@@ -4,7 +4,6 @@
Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`) named the place; each is one chunk.
- Merge `project` and `project_path` into one name and one shape for the project's path.
- Name the session, the archive folder and its env var `loop-claude`; today they say `auto-mode`.
- Pin every `CLAUDE.md` heading the agents and skills cite with a test that resolves each citation.
- Define chunk, plan and release inside `JUDGE_RULES`; the judge reads nothing else.
@@ -14,4 +13,5 @@ Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`)
- Give the comprehension floor in `larv-review` its own heading and move its six-project calibration sentence to `docs/decisions.md`; today it sits under §2 "Trigger".
- Cut what `review-protocol.md` → "Documenting decisions" restates from `CLAUDE.md`: the decision kinds, the create-or-fix line and the record-nothing default.
- Make the missing-premises exit name what is missing: `README.md` itself, a `## Goals` or `## Audience` heading, or a body under one; today all three print the same line.
- Spell the false-claim rule once under `CLAUDE.md` → "Comments and documentation" with its tie-break, the doc corrected unless consumers rely on what it promises, and cite it from "Working with the codebase", "Working loop" and the README paragraph; today four spellings, two of which disagree on which side to fix.
- Re-run the four-seat scoring panel and record the score in `docs/decisions.md`; the target is every dimension at 7.0 or above.