Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "theseus"
version = "0.6.2"
version = "0.6.3"
description = "Theseus for Mac"
authors = ["Theseus contributors"]
license = "MIT"
Expand Down
23 changes: 22 additions & 1 deletion apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ fn find_claude() -> Option<PathBuf> {
.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)
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -721,7 +738,11 @@ fn permissions(s: State<'_, S>) -> Vec<Permission> {
"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
}
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions docs/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.2
0.6.3
4 changes: 4 additions & 0 deletions engine/scheduled/claude-login.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions engine/scheduled/run-channel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"; }
Expand Down
1 change: 1 addition & 0 deletions engine/scheduled/run-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions engine/scheduled/run-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"; }
Expand All @@ -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."
Expand Down
1 change: 1 addition & 0 deletions engine/templates/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"adapt": true
},
"job_time_limit_minutes": 45,
"claude_config_dir": "",
"checks": {
"enabled": false,
"every_minutes": 5,
Expand Down
12 changes: 11 additions & 1 deletion engine/tools/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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():
Expand All @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading