From a4fe2a5114391bcdda2cfd463177869efd45671a Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:29:26 -0700 Subject: [PATCH 1/2] Let Theseus run on a chosen Claude Code login (claude_config_dir) Every claude the app, the run scripts and the theseus command start gets CLAUDE_CONFIG_DIR from config.json when it's set. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WXVQ9fPeLvyg7aVwZojFt7 --- apps/desktop/src-tauri/src/lib.rs | 23 ++++++++++++++++++++++- docs/SETUP.md | 4 ++++ engine/scheduled/claude-login.sh | 4 ++++ engine/scheduled/run-channel.sh | 1 + engine/scheduled/run-job.sh | 1 + engine/scheduled/run-remote.sh | 2 ++ engine/templates/config.json | 1 + engine/tools/cli.py | 12 +++++++++++- tests/test_engine.py | 12 ++++++++++++ 9 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 engine/scheduled/claude-login.sh diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index a45e816..1774319 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -105,6 +105,21 @@ fn find_claude() -> Option { .find(|p| p.exists()) } +/// Which Claude Code login Theseus runs on: config.json → claude_config_dir, if it's set. Otherwise Claude Code's default (~/.claude). +/// Passed as CLAUDE_CONFIG_DIR to every claude the app starts, so a Mac with two logins runs Theseus on the one you chose. +fn claude_login(ws: &Path) -> Vec<(&'static str, PathBuf)> { + let dir = config(ws)["claude_config_dir"].as_str().map(str::trim).unwrap_or("").to_string(); + if dir.is_empty() { + return vec![]; + } + let path = match dir.strip_prefix("~/") { + Some(rest) => home().join(rest), + None if dir == "~" => home(), + None => PathBuf::from(dir), + }; + vec![("CLAUDE_CONFIG_DIR", path)] +} + fn config(ws: &Path) -> Value { fs::read_to_string(ws.join("config.json")).ok().and_then(|s| serde_json::from_str(&s).ok()).unwrap_or(Value::Null) } @@ -230,6 +245,7 @@ fn remote_loop(s: S) { .args(["remote-control", "--name", &name]) .current_dir(&s.ws) .env("PATH", path_env()) + .envs(claude_login(&s.ws)) .stdin(Stdio::piped()) .stdout(out) .stderr(err) @@ -379,6 +395,7 @@ fn run_job(s: &S, kind: &str, reason: &str) -> Result<(), String> { .current_dir(&s2.ws) .env("PATH", path_env()) .env("THESEUS_HOME", &s2.ws) + .envs(claude_login(&s2.ws)) .stdin(Stdio::null()) .stdout(out) .stderr(err) @@ -721,7 +738,11 @@ fn permissions(s: State<'_, S>) -> Vec { "Claude Code", "Theseus runs on your own Claude Code account.", if s.claude.is_some() { "ok" } else { "denied" }, - &s.claude.as_ref().map(|p| p.display().to_string()).unwrap_or("Not found. Install Claude Code, then reopen this app.".into()), + &match (s.claude.as_ref(), claude_login(&s.ws).first()) { + (None, _) => "Not found. Install Claude Code, then reopen this app.".into(), + (Some(p), None) => p.display().to_string(), + (Some(p), Some((_, dir))) => format!("{} · login: {}", p.display(), dir.display()), + }, )); out } diff --git a/docs/SETUP.md b/docs/SETUP.md index 4a772ff..3c09c8a 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -112,6 +112,10 @@ bash ~/Theseus/engine/install.sh --schedule - **Apps it opens for you:** before each scheduled run, Theseus quietly opens anything listed in `ensure_apps` that isn't running (for example `["Claude"]` for the Claude desktop app). Apple Mail is opened automatically if you chose Apple Mail. The jobs themselves don't need any app open. They run Claude Code directly. +- **Which Claude Code login runs Theseus:** Claude Code's default (`~/.claude`) unless you set `"claude_config_dir"`. If you use two logins on this Mac + (for example a work account under `CLAUDE_CONFIG_DIR=~/.claude-work`), set `"claude_config_dir": "~/.claude-work"` and every Claude run Theseus starts uses it: + scheduled jobs, frequent checks, Remote Control, the iMessage channel and the `theseus` command. Connectors you added to one login aren't on the other, so add them + there too. The app's Setup tab shows the login next to Claude Code. Remote Control then shows up under that account in the Claude app. - Remove the schedule: `bash ~/Theseus/engine/install.sh --unschedule` ## 6. Everyday use diff --git a/engine/scheduled/claude-login.sh b/engine/scheduled/claude-login.sh new file mode 100644 index 0000000..5ebc0f2 --- /dev/null +++ b/engine/scheduled/claude-login.sh @@ -0,0 +1,4 @@ +# Sourced by the run scripts after they cd into the workspace. +# Which Claude Code login Theseus runs on: config.json → claude_config_dir, if it's set. Otherwise Claude Code's default (~/.claude). +CLAUDE_LOGIN_DIR="$(/usr/bin/python3 -c 'import json, os; print(os.path.expanduser((json.load(open("config.json")).get("claude_config_dir") or "").strip()))' 2>/dev/null || true)" +if [[ -n "$CLAUDE_LOGIN_DIR" ]]; then export CLAUDE_CONFIG_DIR="$CLAUDE_LOGIN_DIR"; fi diff --git a/engine/scheduled/run-channel.sh b/engine/scheduled/run-channel.sh index df81d72..c2844ed 100755 --- a/engine/scheduled/run-channel.sh +++ b/engine/scheduled/run-channel.sh @@ -8,6 +8,7 @@ WS="${THESEUS_HOME:-$HOME/Theseus}" CLAUDE_BIN="__CLAUDE_BIN__" export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$HOME/.bun/bin:$HOME/.local/bin:$PATH" cd "$WS" || exit 1 +[[ -f engine/scheduled/claude-login.sh ]] && source engine/scheduled/claude-login.sh # which Claude Code login to use mkdir -p logs LOG="logs/channel.log" note() { echo "$(date '+%F %T') $*" >> "$LOG"; } diff --git a/engine/scheduled/run-job.sh b/engine/scheduled/run-job.sh index 6a7c884..b014a37 100755 --- a/engine/scheduled/run-job.sh +++ b/engine/scheduled/run-job.sh @@ -10,6 +10,7 @@ export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$PA [[ -n "$CLAUDE_BIN" ]] || { echo "Can't find Claude Code." >&2; exit 127; } MANUAL="${THESEUS_MANUAL:-}" # set by the theseus command: you asked for this run, so it goes ahead whoever hosts the schedule cd "$WS" || exit 1 +[[ -f engine/scheduled/claude-login.sh ]] && source engine/scheduled/claude-login.sh # which Claude Code login to use # When Theseus.app hosts the schedule, it runs these jobs itself (with the app's permissions); the old launchd jobs stand down. if [[ -z "$MANUAL" ]] && /usr/bin/python3 -c 'import json,sys; sys.exit(0 if json.load(open("config.json")).get("scheduler_host")=="app" else 1)' 2>/dev/null; then exit 0 diff --git a/engine/scheduled/run-remote.sh b/engine/scheduled/run-remote.sh index 1aebbe0..a6ae11c 100755 --- a/engine/scheduled/run-remote.sh +++ b/engine/scheduled/run-remote.sh @@ -14,6 +14,7 @@ WS="${THESEUS_HOME:-$HOME/Theseus}" CLAUDE_BIN="__CLAUDE_BIN__" export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$PATH" cd "$WS" || exit 1 +[[ -f engine/scheduled/claude-login.sh ]] && source engine/scheduled/claude-login.sh # which Claude Code login to use mkdir -p logs cache bin LOG="logs/remote-control.log" note() { echo "$(date '+%F %T') $*" >> "$LOG"; } @@ -38,6 +39,7 @@ if [[ "$HOST" == "terminal" ]]; then #!/bin/bash # Opened by the Theseus watchdog. Keep this window open (minimizing is fine): it's how your phone reaches Theseus. cd "$WS" || exit 1 +[[ -f engine/scheduled/claude-login.sh ]] && source engine/scheduled/claude-login.sh echo \$\$ > "$PIDF" printf '\\033]0;Theseus · Remote Control\\007' echo "Theseus Remote Control: keep this window open (minimize is fine). If it gets closed, it reopens within a minute. To turn phone access off, set remote_control.enabled to false in config.json." diff --git a/engine/templates/config.json b/engine/templates/config.json index c430e5b..071055a 100644 --- a/engine/templates/config.json +++ b/engine/templates/config.json @@ -61,6 +61,7 @@ "adapt": true }, "job_time_limit_minutes": 45, + "claude_config_dir": "", "checks": { "enabled": false, "every_minutes": 5, diff --git a/engine/tools/cli.py b/engine/tools/cli.py index ac7daf1..b63c2b5 100644 --- a/engine/tools/cli.py +++ b/engine/tools/cli.py @@ -47,6 +47,15 @@ def claude(): return found or fail("This needs Claude Code, and I can't find it. Install it from https://claude.com/claude-code") +def claude_login(ws): + """CLAUDE_CONFIG_DIR from config.json → claude_config_dir, if it's set, so Theseus runs on the Claude Code login you chose.""" + try: + d = (json.loads((ws / "config.json").read_text()).get("claude_config_dir") or "").strip() + except (OSError, ValueError, AttributeError): + d = "" + return {"CLAUDE_CONFIG_DIR": os.path.expanduser(d)} if d else {} + + def section_title(heading): return re.sub(r"^[^\w]+", "", re.sub(r"^##\s*", "", heading)).split(":")[0].strip() @@ -311,7 +320,7 @@ def run_job(ws, job): def ask(ws, question): prompt = (f'The user asked this at the command line: "{question}". Answer briefly and follow engine/RULES.md. If it\'s something to do or remember, add it to the list. ' "Never send anything. This run can't ask follow-up questions, so make the sensible choice and say what you did.") - sys.exit(subprocess.call([claude(), "-p", prompt, "--output-format", "text"], cwd=ws, stdin=subprocess.DEVNULL, env={**os.environ, "THESEUS_HOME": str(ws)})) + sys.exit(subprocess.call([claude(), "-p", prompt, "--output-format", "text"], cwd=ws, stdin=subprocess.DEVNULL, env={**os.environ, "THESEUS_HOME": str(ws), **claude_login(ws)})) def main(): @@ -324,6 +333,7 @@ def main(): path = claude() os.chdir(ws) os.environ["THESEUS_HOME"] = str(ws) + os.environ.update(claude_login(ws)) os.execv(path, [path]) command, rest = args[0], args[1:] if command in ("sync", "morning") and not rest: diff --git a/tests/test_engine.py b/tests/test_engine.py index 4a44a32..da6e144 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -517,6 +517,18 @@ def test_a_sync_you_ask_for_runs_even_when_the_app_hosts(self): self.assertIn("quiet sync", self.calls.read_text()) self.assertFalse((self.ws / "data/.job.lock").exists()) + def test_every_claude_run_uses_the_login_you_chose(self): + self.env.pop("CLAUDE_CONFIG_DIR", None) # the login of whoever runs the tests + fake = self.ws / "fake/claude" + fake.write_text(f'#!/bin/bash\necho "login=${{CLAUDE_CONFIG_DIR:-default}}" >> "{self.calls}"\necho fake answer\n') + self.theseus("sync") + self.assertIn("login=default", self.calls.read_text()) + self.calls.unlink() + (self.ws / "config.json").write_text(json.dumps({"scheduler_host": "app", "claude_config_dir": "~/.claude-two"})) + self.assertEqual(self.theseus("sync").returncode, 0) + self.theseus("what is next") + self.assertEqual(self.calls.read_text().split(), [f"login={self.ws}/.claude-two"] * 2) + def test_a_scheduled_job_still_stands_down_for_the_app(self): env = {k: v for k, v in self.env.items() if k != "THESEUS_MANUAL"} subprocess.run(["/bin/bash", str(self.ws / "engine/scheduled/run-job.sh"), "sync"], env=env, capture_output=True) From a2f797c93d9aaff27e083061e8effae1b93c92bf Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:42:27 -0700 Subject: [PATCH 2/2] Release 0.6.3 Every version file says 0.6.3. The changelog entry covers claude_config_dir, which picks the Claude Code login Theseus runs on. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WXVQ9fPeLvyg7aVwZojFt7 --- .claude-plugin/plugin.json | 2 +- CHANGELOG.md | 3 +++ apps/desktop/package.json | 2 +- apps/desktop/src-tauri/Cargo.lock | 2 +- apps/desktop/src-tauri/Cargo.toml | 2 +- apps/desktop/src-tauri/tauri.conf.json | 2 +- engine/VERSION | 2 +- 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index fb694c8..cbb18a3 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "theseus", - "version": "0.6.2", + "version": "0.6.3", "description": "A private, never-sends personal assistant for Claude Code on macOS: one prioritized list, morning and evening briefings, texts you owe replies, drafts in your voice. Independent project, not affiliated with Anthropic.", "author": { "name": "Theseus contributors" }, "license": "MIT", diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b819e..a42d222 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.6.3 +- **Theseus can run on the Claude Code login you choose.** If this Mac has more than one login, set `"claude_config_dir"` in `config.json` (for example `"~/.claude-work"`). Scheduled runs, checks, Remote Control, the iMessage channel and the `theseus` command then all use it. Setup shows which login is in use. Connectors added to one login aren't on another, so add the ones Theseus uses there too. + ## 0.6.2 - **An Impact view in the app, next to List and Markdown.** One bucket per category, each showing its best five: low effort and high impact first, then high/high, low/low and high effort with low impact. Effort comes from the size estimate, and you rate impact with one click. A Focus column holds the top item from each category, most imperative first. Something you finish there stays in place, marked completed, and the next one joins only when you ask. Drag to reorder a bucket, or drag (or use Move…) to put an item in another category. The List view hasn't changed. - **Other tools can hand Theseus items for your yes.** `engine/tools/intake.py` reads what they leave in `data/intake/`; nothing joins your list until you accept it. diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 83da742..8c12507 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,7 +1,7 @@ { "name": "theseus-desktop", "private": true, - "version": "0.6.2", + "version": "0.6.3", "type": "module", "description": "Theseus for Mac: hosts the Theseus engine (Remote Control, checks, briefings) with one set of macOS permissions.", "scripts": { diff --git a/apps/desktop/src-tauri/Cargo.lock b/apps/desktop/src-tauri/Cargo.lock index d9b2747..4d8be53 100644 --- a/apps/desktop/src-tauri/Cargo.lock +++ b/apps/desktop/src-tauri/Cargo.lock @@ -3277,7 +3277,7 @@ dependencies = [ [[package]] name = "theseus" -version = "0.6.2" +version = "0.6.3" dependencies = [ "serde", "serde_json", diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index 5885aab..13beeae 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "theseus" -version = "0.6.2" +version = "0.6.3" description = "Theseus for Mac" authors = ["Theseus contributors"] license = "MIT" diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 6727d2f..9f41c06 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Theseus", - "version": "0.6.2", + "version": "0.6.3", "identifier": "io.github.mgilardi.theseus", "build": { "beforeDevCommand": "pnpm dev", diff --git a/engine/VERSION b/engine/VERSION index b616048..844f6a9 100644 --- a/engine/VERSION +++ b/engine/VERSION @@ -1 +1 @@ -0.6.2 +0.6.3