Craft Anything: understand how any software works, and craft your own.
Rust
Choose Claude Code's folder per AI, so each can use another account (#664)
klerd8915a5bbee9
diff --git a/apps/craft-anything-cli/src/ai_cmd.rs b/apps/craft-anything-cli/src/ai_cmd.rsindex de349923..c3adef50 100644--- a/apps/craft-anything-cli/src/ai_cmd.rs+++ b/apps/craft-anything-cli/src/ai_cmd.rs@@ -59,6 +59,10 @@ pub enum AiCommand {/// Set the program an agent app runs, when it's installed where it isn't found (leave the/// path out to find it by its usual name again).Program { name: String, path: Option<String> },+ /// Set the folder Claude Code keeps its sign-in, settings and sessions in (its+ /// CLAUDE_CONFIG_DIR), so this AI uses another account: a full path or one under `~/`, on the+ /// computer it runs on. Leave the path out for its usual folder.+ Folder { name: String, path: Option<String> },/// Set the model an AI uses (Claude Code: the model it's asked for); leave it out to list the/// ones it can use.Model {@@ -350,6 +354,13 @@ pub fn ai(cli: &Cli, c: &AiCommand, f: Format) -> u8 {}Err(e) => fail(&e, f),},+ AiCommand::Folder { name, path } => match hub.set_config_dir(name, path.as_deref()) {+ Ok(found) => {+ emit(&json!({"name": name, "folder": path, "found": found}), f);+ if found { 0 } else { 1 }+ }+ Err(e) => fail(&e, f),+ },AiCommand::Builder { name } => match hub.set_role(craft_anything_ai::Role::Builder, name.as_deref()) {Ok(()) => {emit(&json!({"builder": name}), f);diff --git a/crates/ai/src/cli_agents/adapters.rs b/crates/ai/src/cli_agents/adapters.rsindex 199c4804..7f3f0502 100644--- a/crates/ai/src/cli_agents/adapters.rs+++ b/crates/ai/src/cli_agents/adapters.rs@@ -147,6 +147,11 @@ pub trait AgentAdapter: Send + Sync {}/// Whether it's signed in, checked before a build starts. `None`: can't tell (the run itself/// reports any sign-in problem).+ /// Whether it still names an account it was signed in to, so a sign-in that doesn't work any+ /// more has expired (or was signed out) rather than never happened.+ fn signed_in_before(&self) -> bool {+ false+ }fn signed_in(&self, _program: &str) -> Option<bool> {None}@@ -177,6 +182,17 @@ pub trait AgentAdapter: Send + Sync {fn restore_session(&self, _id: &str, _saved: &[u8], _cwd: &std::path::Path) -> Result<bool, ToolError> {Ok(false)}+ /// The environment variable that moves the agent's own folder (its sign-in, settings and+ /// sessions), for [`BackendOptions::config_dir`]. `None`: it has none, and the setting is+ /// ignored.+ fn folder_var(&self) -> Option<&'static str> {+ None+ }+ /// This adapter for the agent kept in `folder` on this computer: it runs there, checks the+ /// sign-in there and keeps its sessions there. `None` when it has no such folder.+ fn in_folder(&self, _folder: std::path::PathBuf) -> Option<Arc<dyn AgentAdapter>> {+ None+ }}/// The adapters a run can use.@@ -202,7 +218,7 @@ impl AgentAdapters {pub fn built_in() -> AgentAdapters {AgentAdapters {adapters: vec![- Arc::new(ClaudeCode),+ Arc::new(ClaudeCode::default()),Arc::new(Codex),Arc::new(GeminiCli),Arc::new(OpenCode),@@ -224,6 +240,13 @@ impl AgentAdapters {pub fn for_agent(&self, agent: &str) -> Arc<dyn AgentAdapter> {self.adapters.iter().find(|a| a.ids().contains(&agent)).cloned().unwrap_or_else(|| Arc::new(Plain))}++ /// The adapter for an agent with a backend's options: in the folder they choose for it, when+ /// it keeps one ([`AgentAdapter::in_folder`]).+ pub fn for_backend(&self, agent: &str, options: &BackendOptions) -> Arc<dyn AgentAdapter> {+ let adapter = self.for_agent(agent);+ options.config_dir_here().and_then(|dir| adapter.in_folder(dir)).unwrap_or(adapter)+ }}/// Any CLI: the prompt as its last argument, its output streamed as text.@@ -300,7 +323,18 @@ fn no_such_session(v: &Value) -> bool {}/// Claude Code in headless mode (flags checked against `claude --help`).-pub struct ClaudeCode;+#[derive(Default)]+pub struct ClaudeCode {+ /// The folder chosen for it ([`BackendOptions::config_dir`]); `None`: its usual one.+ folder: Option<std::path::PathBuf>,+}++impl ClaudeCode {+ /// The folder it keeps its sign-in and sessions in: the chosen one, else its usual one.+ fn config_dir(&self) -> Option<std::path::PathBuf> {+ self.folder.clone().or_else(claude_config_dir)+ }+}impl AgentAdapter for ClaudeCode {fn ids(&self) -> &'static [&'static str] {@@ -398,7 +432,7 @@ impl AgentAdapter for ClaudeCode {let failure = TurnFailure::claude(code);p.failure = Some(failure);let why = v.pointer("/message/content").map(content_text).unwrap_or_else(|| code.to_string());- let (message, hint) = claude_code_failure(&why);+ let (message, hint) = claude_code_failure_in(&why, self.folder.as_deref());let remediation = hint.or_else(|| match failure.kind {FailureKind::Authentication => self.sign_in_fix(),FailureKind::Billing => Some("Check the account's credits, plan and spending limit before trying again.".into()),@@ -453,7 +487,7 @@ impl AgentAdapter for ClaudeCode {} else if v.get("is_error").and_then(Value::as_bool).unwrap_or(false) {p.failure.get_or_insert(TurnFailure::new(FailureKind::Unknown));let why = if s("result").is_empty() { s("subtype") } else { s("result") };- let (message, remediation) = claude_code_failure(&why);+ let (message, remediation) = claude_code_failure_in(&why, self.folder.as_deref());out.push(AgentEvent::Error { message, remediation, log: None });}}@@ -466,24 +500,50 @@ impl AgentAdapter for ClaudeCode {true}- /// The person's own standalone Claude Code (see [`host_session_vars`]).+ /// The person's own standalone Claude Code (see [`host_session_vars`]), in its chosen folder.+ /// Under a Flatpak without one, it gets a folder it can write its conversations to (#506).fn process(&self, program: &str) -> Process {- standalone(program)+ let proc = standalone(program);+ if let Some(dir) = &self.folder {+ return proc.env("CLAUDE_CONFIG_DIR", dir);+ }+ match flatpak_claude_dir() {+ Some(dir) => {+ let _ = std::fs::create_dir_all(&dir);+ proc.env("CLAUDE_CONFIG_DIR", dir)+ }+ None => proc,+ }}fn signed_in(&self, program: &str) -> Option<bool> {- let out = standalone(program).args(["auth", "status", "--json"]).timeout(Duration::from_secs(15)).stdout_cap(64 * 1024).run().ok()?;+ let out = self.process(program).args(["auth", "status", "--json"]).timeout(Duration::from_secs(15)).stdout_cap(64 * 1024).run().ok()?;let v: Value = serde_json::from_str(out.stdout_text().trim()).ok()?;v.get("loggedIn").and_then(Value::as_bool)}+ /// The account its `.claude.json` names (`oauthAccount`), kept there while the sign-in itself+ /// is in the system's keychain. In a chosen folder the file is inside it; with its usual+ /// `~/.claude`, it's beside it in the home folder.+ fn signed_in_before(&self) -> bool {+ let set = self.folder.clone().or_else(|| std::env::var_os("CLAUDE_CONFIG_DIR").filter(|v| !v.is_empty()).map(std::path::PathBuf::from));+ let file = match set.or_else(flatpak_claude_dir) {+ Some(dir) => dir.join(".claude.json"),+ None => match dirs::home_dir() {+ Some(home) => home.join(".claude.json"),+ None => return false,+ },+ };+ claude_names_account(&file)+ }+fn sign_in_fix(&self) -> Option<String> {- sign_in_hint("login")+ sign_in_hint_in("login", in_flatpak(), self.folder.as_deref())}/// The session under Claude Code's own folder (see [`claude_session_file`]).fn session_file(&self, id: &str) -> Option<std::path::PathBuf> {- claude_session_file(&claude_config_dir()?, id)+ claude_session_file(&self.config_dir()?, id)}/// The kept session's requests and replies (see [`claude_handoff`]).@@ -494,9 +554,17 @@ impl AgentAdapter for ClaudeCode {/// Back under Claude Code's own folder (see [`claude_restore`]); without one there's nowhere/// to put it, which is said.fn restore_session(&self, id: &str, saved: &[u8], cwd: &std::path::Path) -> Result<bool, ToolError> {- let config = claude_config_dir().ok_or_else(|| ToolError::new(ErrorCode::BadSettings, "Couldn't find Claude Code's folder on this computer."))?;+ let config = self.config_dir().ok_or_else(|| ToolError::new(ErrorCode::BadSettings, "Couldn't find Claude Code's folder on this computer."))?;claude_restore(&config, id, saved, cwd)}++ fn folder_var(&self) -> Option<&'static str> {+ Some("CLAUDE_CONFIG_DIR")+ }++ fn in_folder(&self, folder: std::path::PathBuf) -> Option<Arc<dyn AgentAdapter>> {+ Some(Arc::new(ClaudeCode { folder: Some(folder) }))+ }}/// Claude Code's own folder: `CLAUDE_CONFIG_DIR` when it's set (the person's choice, which the@@ -566,6 +634,20 @@ pub fn claude_session_file(config: &std::path::Path, id: &str) -> Option<std::pastd::fs::read_dir(config.join("projects")).ok()?.flatten().take(SESSION_FOLDERS).map(|e| e.path().join(&name)).find(|p| p.is_file())}+/// Whether Claude Code's `.claude.json` names the account it was signed in to (`oauthAccount`).+/// It also keeps every project's history, so up to 32 MB is read; a bigger or unreadable file+/// names none.+pub fn claude_names_account(file: &std::path::Path) -> bool {+ use std::io::Read;+ const CAP: u64 = 32 << 20;+ let mut text = Vec::new();+ let read = std::fs::File::open(file).and_then(|f| f.take(CAP + 1).read_to_end(&mut text));+ if read.is_err() || text.len() as u64 > CAP {+ return false;+ }+ serde_json::from_slice::<Value>(&text).ok().is_some_and(|v| v.get("oauthAccount").is_some_and(Value::is_object))+}+/// Longest single request or reply in a handoff; a first brief runs to many thousands.const HANDOFF_ENTRY: usize = 1500;diff --git a/crates/ai/src/cli_agents/mod.rs b/crates/ai/src/cli_agents/mod.rsindex 72cc3393..81a603f1 100644--- a/crates/ai/src/cli_agents/mod.rs+++ b/crates/ai/src/cli_agents/mod.rs@@ -216,28 +216,47 @@ pub fn verify_flags(program: &str, help_args: &[&str], needed: &[&str]) -> bool/// The fix for a sign-in failure, in plain words. Sign-in always happens in Claude Code itself;/// we never see or handle the account.pub fn sign_in_hint(message: &str) -> Option<String> {- sign_in_hint_in(message, adapters::in_flatpak())+ sign_in_hint_in(message, adapters::in_flatpak(), None)}-/// [`sign_in_hint`] for a Flatpak or not. In a Flatpak, Claude Code keeps its sign-in and-/// conversations in a folder of the app's own (#506), so signing in from a normal terminal signs-/// in the other copy: it's done through the sandbox, with that folder.-fn sign_in_hint_in(message: &str, flatpak: bool) -> Option<String> {+/// [`sign_in_hint`] for a Flatpak or not, and for Claude Code in a folder chosen for it+/// (`folder`), whose sign-in is its own: the command signs in there. In a Flatpak, Claude Code+/// keeps its sign-in and conversations in a folder of the app's own (#506), so signing in from a+/// normal terminal signs in the other copy: it's done through the sandbox, with that folder.+pub(crate) fn sign_in_hint_in(message: &str, flatpak: bool, folder: Option<&Path>) -> Option<String> {let m = message.to_ascii_lowercase();let wants_sign_in = ["authenticat", "oauth", "log in", "login", "not logged", "api key", "unauthorized"].iter().any(|w| m.contains(w));if !wants_sign_in {return None;}- Some(if flatpak {- format!("Sign in to Claude Code inside this app's sandbox: open a terminal and run `{FLATPAK_SIGN_IN}`, then try again.")- } else {- "Sign in to Claude Code: open a terminal and run `claude auth login` (or start `claude` and type /login), then try again.".to_string()+ let folder = folder.map(|f| f.to_string_lossy().into_owned());+ Some(match (flatpak, folder) {+ (true, None) => format!("Sign in to Claude Code inside this app's sandbox: open a terminal and run `{FLATPAK_SIGN_IN}`, then try again."),+ (true, Some(f)) => format!(+ "Sign in to Claude Code inside this app's sandbox, in the folder chosen for it: open a terminal and run `{}`, then try again.",+ flatpak_sign_in(&crate::ssh::shell_quote(&f))+ ),+ (false, None) => "Sign in to Claude Code: open a terminal and run `claude auth login` (or start `claude` and type /login), then try again.".to_string(),+ (false, Some(f)) if cfg!(windows) => format!(+ "Sign in to Claude Code in the folder chosen for it: open PowerShell and run `$env:CLAUDE_CONFIG_DIR='{}'; claude auth login`, then try again.",+ f.replace('\'', "''")+ ),+ (false, Some(f)) => format!(+ "Sign in to Claude Code in the folder chosen for it: open a terminal and run `CLAUDE_CONFIG_DIR={} claude auth login`, then try again.",+ crate::ssh::shell_quote(&f)+ ),})}/// Signing in for the Claude Code that a Flatpak build starts: the same folder it will use.const FLATPAK_SIGN_IN: &str = "flatpak run --command=sh ai.storyteller.craft-anything -c 'CLAUDE_CONFIG_DIR=\"$XDG_DATA_HOME/craft-anything/claude\" \"$HOME/.local/bin/claude\" auth login'";+/// [`FLATPAK_SIGN_IN`] for a chosen folder, already quoted for the sandbox's shell.+fn flatpak_sign_in(quoted: &str) -> String {+ let inner = format!("CLAUDE_CONFIG_DIR={quoted} \"$HOME/.local/bin/claude\" auth login");+ format!("flatpak run --command=sh ai.storyteller.craft-anything -c {}", crate::ssh::shell_quote(&inner))+}+/// Words in an API's answer when the installed Claude Code is older than the model it was asked/// to use (#165).pub const TOO_OLD_FOR_MODEL: &str = "does not support this model";@@ -245,6 +264,12 @@ pub const TOO_OLD_FOR_MODEL: &str = "does not support this model";/// Claude Code's failure in plain words, and its fix when the person can make one: a version too/// old for the model (#165), or a sign-in.pub fn claude_code_failure(why: &str) -> (String, Option<String>) {+ claude_code_failure_in(why, None)+}++/// [`claude_code_failure`] for Claude Code in a folder chosen for it (`folder`), whose sign-in is+/// its own.+pub(crate) fn claude_code_failure_in(why: &str, folder: Option<&Path>) -> (String, Option<String>) {if why.to_ascii_lowercase().contains(TOO_OLD_FOR_MODEL) {return (format!("Claude Code is too old for the model it was asked to use ({}).", why.chars().take(200).collect::<String>()),@@ -254,7 +279,7 @@ pub fn claude_code_failure(why: &str) -> (String, Option<String>) {),);}- (format!("Claude Code stopped: {why}"), sign_in_hint(why))+ (format!("Claude Code stopped: {why}"), sign_in_hint_in(why, adapters::in_flatpak(), folder))}/// Variables a Claude Code session sets for its own child processes. When Craft Anything itself@@ -644,13 +669,17 @@ fn agent_env(builder: bool, effort: Option<crate::model::Effort>) -> Vec<(&'stat}/// The command run on another computer over SSH. ssh passes on none of our environment, so it is-/// set there with `env`.-fn remote_command(program: &str, args: Vec<String>, env: &[(&'static str, String)]) -> Vec<String> {- let mut cmd = vec!["env".to_string()];- cmd.extend(env.iter().map(|(k, v)| format!("{k}={v}")));- cmd.push(program.to_string());- cmd.extend(args);- cmd+/// set there with `env`. The result is the line for the remote shell, every word quoted, except+/// that a value starting with `~/` gets that computer's home folder (a quoted `~` is just a name).+fn remote_command(program: &str, args: Vec<String>, env: &[(&'static str, String)]) -> String {+ use crate::ssh::shell_quote;+ let set = env.iter().map(|(k, v)| match v.strip_prefix("~/") {+ Some(rest) => format!("{k}=\"$HOME\"/{}", shell_quote(rest)),+ None if v == "~" => format!("{k}=\"$HOME\""),+ None => shell_quote(&format!("{k}={v}")),+ });+ let words = std::iter::once(program.to_string()).chain(args).map(|a| shell_quote(&a));+ std::iter::once("env".to_string()).chain(set).chain(words).collect::<Vec<_>>().join(" ")}/// The run's shared state: the session it continues and reports, whether the agent's flags were@@ -686,7 +715,11 @@ fn run_cli(spec: &CliSpec, text: &str, retry: bool, tx: &Sender<AgentEvent>, stolet agent = spec.config.model.clone();let program = spec.options.command.clone().unwrap_or_else(|| program_for(&agent));let remote = spec.config.ssh_host.clone().filter(|h| !h.trim().is_empty());- let mut adapter = spec.adapters.for_agent(&agent);+ // A folder chosen for it is on the computer it runs on: on another one, it's set below.+ let mut adapter = match remote {+ None => spec.adapters.for_backend(&agent, &spec.options),+ Some(_) => spec.adapters.for_agent(&agent),+ };if adapter.requires_acp() {let sign_in = adapter.sign_in_fix().map(|fix| format!(" {fix}")).unwrap_or_default();let _ = tx.send(AgentEvent::Error {@@ -753,16 +786,15 @@ fn run_cli(spec: &CliSpec, text: &str, retry: bool, tx: &Sender<AgentEvent>, sto// 30 minutes and a background build at 10).let (turn, quiet) = if builder { (24 * 3600, 8 * 3600) } else { (30 * 60, 15 * 60) };let mut env = agent_env(builder, spec.options.effort);- // Under a Flatpak, Claude Code gets a folder it can write its conversations to (#506); on- // another computer over SSH it keeps its own.- if remote.is_none()- && let Some(dir) = adapters::flatpak_claude_dir()+ // Here the adapter's process runs the agent in its folder (`AgentAdapter::in_folder`); on+ // another computer over SSH it's the folder chosen there, else the agent keeps its own.+ if remote.is_some()+ && let (Some(var), Some(dir)) = (adapter.folder_var(), spec.options.config_dir_text()){- let _ = std::fs::create_dir_all(&dir);- env.push(("CLAUDE_CONFIG_DIR", dir.to_string_lossy().into_owned()));+ env.push((var, dir.to_string()));}let (prog, argv) = match &remote {- Some(host) => ("ssh".to_string(), crate::ssh::ssh_args(host, &remote_command(&program, args, &env))),+ Some(host) => ("ssh".to_string(), crate::ssh::ssh_line_args(host, remote_command(&program, args, &env))),None => (program.clone(), args),};let _ =@@ -1085,10 +1117,27 @@ mod tests {assert_eq!(adapters::flatpak_claude_dir_in(true, true, data()), None, "their own choice stays");assert_eq!(adapters::flatpak_claude_dir_in(false, false, data()), None, "a normal install keeps ~/.claude");assert_eq!(adapters::flatpak_claude_dir_in(true, false, None), None);- let hint = sign_in_hint_in("Not logged in", true).unwrap();+ let hint = sign_in_hint_in("Not logged in", true, None).unwrap();assert!(hint.contains("flatpak run") && hint.contains("CLAUDE_CONFIG_DIR") && hint.contains("auth login"), "{hint}");- assert!(sign_in_hint_in("Not logged in", false).unwrap().contains("`claude auth login`"));- assert_eq!(sign_in_hint_in("all fine", true), None);+ assert!(sign_in_hint_in("Not logged in", false, None).unwrap().contains("`claude auth login`"));+ assert_eq!(sign_in_hint_in("all fine", true, None), None);+ }++ /// Claude Code in a folder chosen for it signs in there: the fix names that folder, quoted.+ #[test]+ fn signing_in_claude_code_in_its_chosen_folder_names_the_folder() {+ let folder = Path::new("/Users/someone/Claude work");+ let hint = sign_in_hint_in("Not logged in", false, Some(folder)).unwrap();+ if cfg!(windows) {+ assert!(hint.contains("$env:CLAUDE_CONFIG_DIR='/Users/someone/Claude work'; claude auth login"), "{hint}");+ } else {+ assert!(hint.contains("`CLAUDE_CONFIG_DIR='/Users/someone/Claude work' claude auth login`"), "{hint}");+ }+ let hint = sign_in_hint_in("Not logged in", true, Some(folder)).unwrap();+ assert!(hint.starts_with("Sign in to Claude Code inside this app's sandbox, in the folder") && hint.contains("Claude work"), "{hint}");+ assert!(!hint.contains("XDG_DATA_HOME"), "the chosen folder, not the sandbox's own: {hint}");+ let (_, fix) = claude_code_failure_in("Invalid API key · Please run /login", Some(folder));+ assert!(fix.is_some_and(|f| f.contains("Claude work")));}/// Over SSH our environment doesn't reach the other computer, so the chosen effort (and Claude@@ -1098,14 +1147,66 @@ mod tests {let env = agent_env(true, Some(crate::model::Effort::Max));assert!(env.contains(&("CLAUDE_CODE_EFFORT_LEVEL", "max".to_string())));assert!(env.contains(&("CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS", "0".to_string())));- let cmd = remote_command("claude", vec!["-p".into(), "hi".into()], &env);- assert_eq!(cmd.first().map(String::as_str), Some("env"));- assert!(cmd.contains(&"CLAUDE_CODE_EFFORT_LEVEL=max".to_string()));- assert_eq!(cmd[cmd.len() - 3..], ["claude", "-p", "hi"]);- let line = crate::ssh::ssh_args("box", &cmd).pop().unwrap_or_default();- assert!(line.starts_with("env ") && line.contains("CLAUDE_CODE_EFFORT_LEVEL=max") && line.ends_with("claude -p hi"), "{line}");+ let line = remote_command("claude", vec!["-p".into(), "it's".into()], &env);+ assert!(line.starts_with("env ") && line.contains(" CLAUDE_CODE_EFFORT_LEVEL=max ") && line.ends_with(" claude -p 'it'\\''s'"), "{line}");+ assert_eq!(crate::ssh::ssh_line_args("box", line.clone()).pop(), Some(line));assert!(agent_env(false, None).contains(&("CLAUDE_CODE_EFFORT_LEVEL", "high".to_string())), "high unless chosen");}++ /// A folder under `~/` is in the other computer's home: its shell expands it, which it won't+ /// do for a quoted `~`. Anything else stays quoted.+ #[test]+ fn a_folder_over_ssh_is_in_the_other_computers_home() {+ let set = |v: &str| remote_command("claude", vec![], &[("CLAUDE_CONFIG_DIR", v.to_string())]);+ assert_eq!(set("~/.claude-work"), "env CLAUDE_CONFIG_DIR=\"$HOME\"/.claude-work claude");+ assert_eq!(set("~/Claude work"), "env CLAUDE_CONFIG_DIR=\"$HOME\"/'Claude work' claude");+ assert_eq!(set("~"), "env CLAUDE_CONFIG_DIR=\"$HOME\" claude");+ assert_eq!(set("/srv/claude/a b"), "env 'CLAUDE_CONFIG_DIR=/srv/claude/a b' claude");+ assert_eq!(set("/x/~/$(rm)"), "env 'CLAUDE_CONFIG_DIR=/x/~/$(rm)' claude");+ }++ /// A sign-in that stopped working is told apart from none by the account `.claude.json` still+ /// names; anything else there names none.+ #[test]+ fn claude_code_was_signed_in_when_its_settings_name_an_account() {+ let dir = tempfile::tempdir().unwrap();+ let file = dir.path().join(".claude.json");+ let names = |text: &[u8]| {+ std::fs::write(&file, text).unwrap();+ adapters::claude_names_account(&file)+ };+ assert!(names(br#"{"numStartups":3,"oauthAccount":{"accountUuid":"0000","emailAddress":"[email protected]"}}"#));+ for none in [&br#"{"numStartups":3}"#[..], br#"{"oauthAccount":null}"#, br#"{"oauthAccount":"x"}"#, b"not json", b"", b"[1,2]"] {+ assert!(!names(none), "{}", String::from_utf8_lossy(none));+ }+ assert!(!adapters::claude_names_account(&dir.path().join("missing.json")));+ assert!(!adapter_for("codex").signed_in_before());+ }++ /// Claude Code in a chosen folder runs, checks its sign-in and keeps its sessions there; an+ /// agent without such a folder is the same as before.+ #[test]+ fn claude_code_uses_the_folder_chosen_for_it() {+ let config = tempfile::tempdir().unwrap();+ let id = "0e4a6b1c-1111-4222-8333-944455556666";+ let folder = config.path().join("projects").join("-somewhere");+ std::fs::create_dir_all(&folder).unwrap();+ std::fs::write(folder.join(format!("{id}.jsonl")), "{}\n").unwrap();+ let options = crate::BackendOptions { config_dir: Some(config.path().display().to_string()), ..Default::default() };+ let claude = AgentAdapters::built_in().for_backend("claude-code", &options);+ assert_eq!(claude.session_file(id), Some(folder.join(format!("{id}.jsonl"))));+ assert!(claude.sign_in_fix().is_some_and(|f| f.contains(&config.path().display().to_string())), "signs in there");+ assert_eq!(claude.folder_var(), Some("CLAUDE_CONFIG_DIR"));+ assert!(!claude.signed_in_before(), "nothing there names an account");+ std::fs::write(config.path().join(".claude.json"), r#"{"oauthAccount":{"accountUuid":"0000"},"projects":{}}"#).unwrap();+ assert!(claude.signed_in_before(), "its own folder's .claude.json, not the usual one");+ let codex = AgentAdapters::built_in().for_backend("codex", &options);+ assert_eq!((codex.folder_var(), codex.ids()), (None, adapter_for("codex").ids()));+ assert_eq!(crate::config::config_dir_in("~/a/b", Some("/home/u".into())), Some(std::path::PathBuf::from("/home/u/a/b")));+ assert_eq!(crate::config::config_dir_in("~", Some("/home/u".into())), Some(std::path::PathBuf::from("/home/u")));+ assert_eq!(crate::config::config_dir_in("~/a", None), None, "no home to put it in");+ assert_eq!(crate::config::config_dir_in("/srv/c", None), Some(std::path::PathBuf::from("/srv/c")));+ }use crate::BackendKind;/// Explicit OpenCode picks cannot pass ACP preflight then run natively without our MCP server.diff --git a/crates/ai/src/config.rs b/crates/ai/src/config.rsindex 7cc4f1e6..7285110d 100644--- a/crates/ai/src/config.rs+++ b/crates/ai/src/config.rs@@ -113,6 +113,34 @@ pub struct BackendOptions {/// per conversation (on for Copilot, off for other agents unless set).#[serde(skip_serializing_if = "Option::is_none")]pub acp: Option<bool>,+ /// Agent CLIs that keep their sign-in, settings and sessions in a folder of their own (Claude+ /// Code's `CLAUDE_CONFIG_DIR`): the folder to use instead of their usual one, so each AI can be+ /// another account. `~/` is the home folder; over SSH it's a folder on that computer.+ #[serde(skip_serializing_if = "Option::is_none")]+ pub config_dir: Option<String>,+}++impl BackendOptions {+ /// [`config_dir`](BackendOptions::config_dir) as written, if any (for another computer).+ pub fn config_dir_text(&self) -> Option<&str> {+ self.config_dir.as_deref().map(str::trim).filter(|d| !d.is_empty())+ }++ /// [`config_dir`](BackendOptions::config_dir) on this computer, with `~` as the home folder.+ pub fn config_dir_here(&self) -> Option<std::path::PathBuf> {+ config_dir_in(self.config_dir_text()?, dirs::home_dir())+ }+}++/// `dir` with a leading `~` as `home`; `None` when it needs a home folder there isn't.+pub(crate) fn config_dir_in(dir: &str, home: Option<std::path::PathBuf>) -> Option<std::path::PathBuf> {+ if dir == "~" {+ return home;+ }+ match dir.strip_prefix("~/").or_else(|| dir.strip_prefix("~\\")) {+ Some(rest) => home.map(|h| h.join(rest)),+ None => Some(std::path::PathBuf::from(dir)),+ }}/// A provider's context tier, not a guessed token count. Copilot reports each model's limits.diff --git a/crates/ai/src/lib.rs b/crates/ai/src/lib.rsindex eab52251..08586712 100644--- a/crates/ai/src/lib.rs+++ b/crates/ai/src/lib.rs@@ -175,6 +175,13 @@ pub fn model_in_use(config: &BackendConfig, options: Option<&BackendOptions>) ->}}+/// The variable that moves an agent app's own folder (its sign-in, settings and sessions), when+/// it has one: Claude Code's `CLAUDE_CONFIG_DIR`. `None` for the others, which+/// [`BackendOptions::config_dir`] doesn't apply to.+pub fn folder_var(config: &BackendConfig) -> Option<&'static str> {+ (config.kind == BackendKind::AgentCli).then(|| cli_agents::adapter_for(&config.model).folder_var()).flatten()+}+/// The backend that builds when none is named: the Builder role's choice while it's on, else an/// agent app, else an API backend. The same rule as [`AiConfig::backend_for`] for/// [`Role::Builder`], for a client that holds only the list (the app decides "can it build?"@@ -522,6 +529,30 @@ impl AiHub {Ok(true)}+ /// The folder an agent app keeps its sign-in, settings and sessions in ([`folder_var`]), so+ /// each AI can be another account (`None` or empty: its usual one). A full path or one under+ /// `~/`; over SSH it's a folder on that computer. Returns false when there was no such backend.+ pub fn set_config_dir(&self, name: &str, dir: Option<&str>) -> Result<bool, ToolError> {+ let dir = dir.map(str::trim).filter(|d| !d.is_empty());+ let mut cfg = self.config_to_change()?;+ let Some(b) = cfg.backends.iter_mut().find(|b| b.config.name == name) else { return Ok(false) };+ if let Some(d) = dir {+ if folder_var(&b.config).is_none() {+ return Err(ToolError::invalid(format!("{name} doesn't keep a folder of its own.")).with_remediation("A folder is for Claude Code."));+ }+ // A relative folder would move with whatever folder the agent is started in.+ let remote = b.config.ssh_host.as_deref().is_some_and(|h| !h.trim().is_empty());+ let full = d == "~" || d.starts_with("~/") || if remote { d.starts_with('/') } else { std::path::Path::new(d).is_absolute() };+ if !full {+ return Err(ToolError::invalid(format!("{d:?} isn't a full path."))+ .with_remediation("Give the whole path, or one starting with ~/ for the home folder."));+ }+ }+ b.options.config_dir = dir.map(str::to_string);+ self.save_config(&cfg)?;+ Ok(true)+ }+/// Each backend's options (an agent app's program and model…), by name.pub fn options(&self) -> std::collections::BTreeMap<String, BackendOptions> {self.config().backends.into_iter().map(|b| (b.config.name, b.options)).collect()diff --git a/crates/ai/src/rebuild/mod.rs b/crates/ai/src/rebuild/mod.rsindex 132be733..1a0edecf 100644--- a/crates/ai/src/rebuild/mod.rs+++ b/crates/ai/src/rebuild/mod.rs@@ -611,12 +611,11 @@ impl Worker {// Fail before any work when the agent's tools are missing or it can't sign in.let remote = entry.config.ssh_host.as_deref().is_some_and(|h| !h.trim().is_empty());if !remote && api.is_none() {- let adapter = opts.adapters.for_agent(&entry.config.model);+ let adapter = opts.adapters.for_backend(&entry.config.model, &entry.options);crate::cli_agents::check_builder_tools(adapter.as_ref(), &entry.config.model, &entry.options, &self.stop)?;let program = entry.options.command.clone().unwrap_or_else(|| crate::cli_agents::program_for(&entry.config.model));if adapter.signed_in(&program) == Some(false) {- let who = crate::cli_agents::display_for(&entry.config.model);- return Err(ToolError::new(ErrorCode::BadSettings, format!("{who} isn't signed in on this computer."))+ return Err(ToolError::new(ErrorCode::BadSettings, not_signed_in(&entry.config.model, adapter.signed_in_before())).with_remediation(adapter.sign_in_fix().unwrap_or_default()));}}@@ -654,7 +653,7 @@ impl Worker {ws.save()?;}// A coding agent on this computer whose session the project keeps a copy of (#451).- let keeper = (!api_loop && !remote).then(|| opts.adapters.for_agent(&entry.config.model));+ let keeper = (!api_loop && !remote).then(|| opts.adapters.for_backend(&entry.config.model, &entry.options));if let Some(a) = &keeper {self.restore_session(ws, a.as_ref());}@@ -1135,6 +1134,13 @@ fn no_build_progress(ws: &Workspace) -> ToolError {.with_remediation("Send a new request with a concrete correction, or edit the app's files before trying again.")}+/// Why a coding agent can't build: never signed in, or signed in `before` with a sign-in that no+/// longer works (expired, or signed out), which the person may not expect.+fn not_signed_in(agent: &str, before: bool) -> String {+ let who = crate::cli_agents::display_for(agent);+ if before { format!("{who}'s sign-in on this computer has expired or was signed out.") } else { format!("{who} isn't signed in on this computer.") }+}+/// Largest builder session the project keeps a copy of.const MAX_KEPT_SESSION: u64 = 64_000_000;/// How much of a kept session a new one is handed when the old one isn't on this computer.diff --git a/crates/ai/src/rebuild/question.rs b/crates/ai/src/rebuild/question.rsindex a89e50af..c13c27b3 100644--- a/crates/ai/src/rebuild/question.rs+++ b/crates/ai/src/rebuild/question.rs@@ -151,7 +151,7 @@ fn bring_back_session(ws: &Workspace, entry: &crate::BackendEntry, id: &str) {return;}if let Some(saved) = super::kept_session_bytes(ws) {- let adapter = crate::cli_agents::AgentAdapters::default().for_agent(&entry.config.model);+ let adapter = crate::cli_agents::AgentAdapters::default().for_backend(&entry.config.model, &entry.options);let _ = adapter.restore_session(id, &saved, &ws.root);}}diff --git a/crates/ai/src/rebuild/tests.rs b/crates/ai/src/rebuild/tests.rsindex 044d76fc..9b55f35a 100644--- a/crates/ai/src/rebuild/tests.rs+++ b/crates/ai/src/rebuild/tests.rs@@ -2801,3 +2801,11 @@ fn the_builders_conversation_travels_with_the_project() {let said: Vec<String> = rx.try_iter().filter_map(|e| if let RunEvent::Agent(AgentEvent::Status { text }) = e { Some(text) } else { None }).collect();assert!(said.iter().any(|t| t.contains("Couldn't keep a copy")), "{said:?}");}++/// A coding agent that was signed in once and no longer is says so, rather than "isn't signed in",+/// which reads as if the person never did.+#[test]+fn a_sign_in_that_stopped_working_is_called_that() {+ assert_eq!(not_signed_in("claude-code", false), "Claude Code isn't signed in on this computer.");+ assert_eq!(not_signed_in("claude-code", true), "Claude Code's sign-in on this computer has expired or was signed out.");+}diff --git a/crates/ai/src/ssh.rs b/crates/ai/src/ssh.rsindex 5c0d5471..dc911790 100644--- a/crates/ai/src/ssh.rs+++ b/crates/ai/src/ssh.rs@@ -8,11 +8,16 @@ pub const SSH_OPTIONS: &[&str] = &["-o", "BatchMode=yes", "-o", "ConnectTimeout=/// `ssh` argv (without the program) that runs `remote` on `host`. Each remote argument is quoted/// for the remote POSIX shell.pub fn ssh_args(host: &str, remote: &[String]) -> Vec<String> {+ ssh_line_args(host, remote.iter().map(|a| shell_quote(a)).collect::<Vec<_>>().join(" "))+}++/// [`ssh_args`] for a command line already quoted for the remote shell.+pub fn ssh_line_args(host: &str, line: String) -> Vec<String> {let mut v: Vec<String> = SSH_OPTIONS.iter().map(|s| s.to_string()).collect();v.push("-T".into());v.push(host.to_string());v.push("--".into());- v.push(remote.iter().map(|a| shell_quote(a)).collect::<Vec<_>>().join(" "));+ v.push(line);v}diff --git a/crates/ai/src/tests.rs b/crates/ai/src/tests.rsindex 0a6d6bb1..466e7e1e 100644--- a/crates/ai/src/tests.rs+++ b/crates/ai/src/tests.rs@@ -304,6 +304,40 @@ fn an_agent_apps_program_is_set_and_cleared() {assert_eq!(program(&h), None, "blank finds it by its usual name again");}+/// Claude Code's folder (`CLAUDE_CONFIG_DIR`) is chosen per AI, so two can be two accounts; only+/// a full path, and only for an agent app that keeps one.+#[test]+fn claude_codes_folder_is_set_per_ai() {+ let (h, _d) = hub();+ let claude = |name: &str, ssh: Option<&str>| BackendConfig {+ name: name.into(),+ kind: BackendKind::AgentCli,+ model: "claude-code".into(),+ base_url: None,+ ssh_host: ssh.map(str::to_string),+ enabled: true,+ };+ h.add_backend(claude("Claude Code", None), None).unwrap();+ h.add_backend(claude("Claude Code 2", None), None).unwrap();+ h.add_backend(claude("Claude on box", Some("box")), None).unwrap();+ h.add_backend(BackendConfig { model: "codex".into(), ..claude("Codex", None) }, None).unwrap();+ let folder = |h: &AiHub, name: &str| h.options().get(name).and_then(|o| o.config_dir.clone());+ assert!(h.set_config_dir("Claude Code 2", Some(" ~/.claude-work ")).unwrap());+ assert_eq!((folder(&h, "Claude Code"), folder(&h, "Claude Code 2").as_deref()), (None, Some("~/.claude-work")));+ let here = if cfg!(windows) { r"C:\Claude\work" } else { "/Users/someone/Claude work" };+ assert!(h.set_config_dir("Claude Code", Some(here)).unwrap());+ assert_eq!(folder(&h, "Claude Code").as_deref(), Some(here));+ assert!(h.set_config_dir("Claude on box", Some("/home/someone/.claude-b")).unwrap(), "a path on that computer");+ assert!(h.set_config_dir("Claude Code", Some("claude-work")).unwrap_err().message.contains("isn't a full path"));+ assert!(h.set_config_dir("Codex", Some("/x")).unwrap_err().message.contains("doesn't keep a folder"));+ assert!(h.set_config_dir("Codex", None).unwrap(), "clearing is always fine");+ assert!(!h.set_config_dir("Nobody", Some("/x")).unwrap(), "only a configured backend");+ assert!(h.set_config_dir("Claude Code 2", Some(" ")).unwrap());+ assert_eq!(folder(&h, "Claude Code 2"), None, "blank is its usual folder again");+ assert_eq!(folder(&h, "Claude Code").as_deref(), Some(here), "each AI keeps its own");+ assert_eq!(crate::folder_var(&claude("x", None)), Some("CLAUDE_CONFIG_DIR"));+}+/// #123, #127: the model an AI uses is changed; Claude Code is offered Claude's models.#[test]fn an_ais_model_is_changed() {diff --git a/crates/ui-egui/src/builders.rs b/crates/ui-egui/src/builders.rsindex ef16d8fd..258e631b 100644--- a/crates/ui-egui/src/builders.rs+++ b/crates/ui-egui/src/builders.rs@@ -299,6 +299,16 @@ impl CraftApp {});}+ /// Keep an agent app's sign-in, settings and sessions in this folder, so the AI is another+ /// account (`None`: its usual folder again).+ pub fn set_agent_folder(&mut self, name: &str, folder: Option<String>) {+ let (hub, name) = (self.hub.clone(), name.to_string());+ self.jobs.spawn(tr("Set an AI's folder"), false, move |_| {+ hub.set_config_dir(&name, folder.as_deref()).map_err(|e| e.message)?;+ Ok(crate::backends(&hub))+ });+ }+/// Remove an AI and its stored key.pub fn remove_backend(&mut self, name: &str) {let (hub, name) = (self.hub.clone(), name.to_string());diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex c66d8c21..4959ae94 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -99,6 +99,8 @@ Add a folder… Přidat složku…Add a plugin Přidat pluginAdd an AI brain and I'll read this evidence for you, answer follow-up questions and point at the proof. Přidejte AI asistenta a já pro vás tyto důkazy přečtu, odpovím na doplňující otázky a odkážu na doklady.Add an AI by its address Přidat AI podle adresy+Add another Přidat další+Add it again, to choose another account's folder for it. Přidat ho znovu a vybrat pro něj složku jiného účtu.Add more info. The builder reads it at its next step. Doplňte informace. Sestavovací agent je přečte v dalším kroku.Add pictures Přidat obrázkyAdd pictures of the original Přidat obrázky originálu@@ -245,6 +247,7 @@ Choose what the builder's questions get Vybrat způsob odpovídání na otázkyChoose what to recreate, say what you want, then press Start. Vyberte, co chcete znovu vytvořit, popište své přání a stiskněte Spustit.Choose… Vybrat…Classes Třídy+Claude Code folder (CLAUDE_CONFIG_DIR) Složka Claude Code (CLAUDE_CONFIG_DIR)Clean room Čistá místnostClean room / Deep Čistá místnost / Hloubkový režimClean room never reads the original's code, files or page source. Deep mode reads them with every tool Craft Anything has. Režim Čistá místnost nikdy nečte kód, soubory ani zdrojový kód stránek originálu. Hloubkový režim je čte všemi nástroji, které Craft Anything nabízí.@@ -572,6 +575,7 @@ It's mine, or I'm allowed to look Patří mi nebo mám oprávnění jej zkoumatIts copy is deleted, with anything it saved there. The project itself stays as it is. Jeho kopie bude smazána včetně všeho, co se do ní uložilo. Samotný projekt zůstane beze změny.Its folder is deleted with everything in it: what was built, the checks and the conversation. Jeho složka bude smazána se vším, co obsahuje: výsledkem sestavení, kontrolami i konverzací.Its own code Vlastní kód+Its own sign-in, settings and conversations: another folder is another account. Empty: its usual folder. Vlastní přihlášení, nastavení a konverzace: jiná složka znamená jiný účet. Prázdné: jeho obvyklá složka.Java archive overview Přehled archivu JavaJava class Třída v JavěJava method bytecode and pseudo-Java Bajtkód metody v Javě a pseudokód Javy@@ -1006,6 +1010,7 @@ Send now Odeslat nyníServer address Adresa serveruSession status Stav relaceSet a project's asset budget Nastavit rozpočet podkladů projektu+Set an AI's folder Nastavit složku AISet an AI's program Nastavit program AISet model options Nastavit možnosti modeluSet one up Nastavitdiff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex 55925b4b..0bde36d1 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -99,6 +99,8 @@ Add a folder… Ordner hinzufügen …Add a plugin Plugin hinzufügenAdd an AI brain and I'll read this evidence for you, answer follow-up questions and point at the proof. Füge eine KI hinzu, dann lese ich diese Belege für dich, beantworte Anschlussfragen und zeige auf die Beweise.Add an AI by its address KI über ihre Adresse hinzufügen+Add another Noch einen hinzufügen+Add it again, to choose another account's folder for it. Füge ihn noch einmal hinzu, um für ihn den Ordner eines anderen Kontos zu wählen.Add more info. The builder reads it at its next step. Weitere Infos hinzufügen. Der Builder liest sie bei seinem nächsten Schritt.Add pictures Bilder hinzufügenAdd pictures of the original Bilder des Originals hinzufügen@@ -245,6 +247,7 @@ Choose what the builder's questions get Wähle, was mit den Fragen des BuildersChoose what to recreate, say what you want, then press Start. Wähle, was nachgebaut werden soll, sag, was du willst, und drücke dann Start.Choose… Auswählen …Classes Klassen+Claude Code folder (CLAUDE_CONFIG_DIR) Claude-Code-Ordner (CLAUDE_CONFIG_DIR)Clean room Clean RoomClean room / Deep Clean Room / DeepClean room never reads the original's code, files or page source. Deep mode reads them with every tool Craft Anything has. Clean Room liest nie den Code, die Dateien oder den Seitenquelltext des Originals. Der Deep-Modus liest sie mit allen Werkzeugen, die Craft Anything hat.@@ -572,6 +575,7 @@ It's mine, or I'm allowed to look Es gehört mir, oder ich darf hineinsehenIts copy is deleted, with anything it saved there. The project itself stays as it is. Seine Kopie wird gelöscht, samt allem, was es dort gespeichert hat. Das Projekt selbst bleibt unverändert.Its folder is deleted with everything in it: what was built, the checks and the conversation. Sein Ordner wird mit allem darin gelöscht: dem Gebauten, den Prüfungen und dem Gespräch.Its own code Sein eigener Code+Its own sign-in, settings and conversations: another folder is another account. Empty: its usual folder. Eigene Anmeldung, Einstellungen und Gespräche: Ein anderer Ordner ist ein anderes Konto. Leer: sein üblicher Ordner.Java archive overview Java-Archiv-ÜbersichtJava class Java-KlasseJava method bytecode and pseudo-Java Java-Methoden-Bytecode und Pseudo-Java@@ -1006,6 +1010,7 @@ Send now Jetzt sendenServer address ServeradresseSession status SitzungsstatusSet a project's asset budget Das Asset-Budget eines Projekts festlegen+Set an AI's folder Den Ordner einer KI festlegenSet an AI's program Das Programm einer KI festlegenSet model options Modelloptionen festlegenSet one up Eine einrichtendiff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex da80e40e..6db33edb 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -99,6 +99,8 @@ Add a folder… 폴더 추가…Add a plugin 플러그인 추가Add an AI brain and I'll read this evidence for you, answer follow-up questions and point at the proof. AI를 추가하면 이 근거를 대신 읽고, 이어지는 질문에 답하고, 증거가 있는 곳을 짚어 줍니다.Add an AI by its address 주소로 AI 추가+Add another 하나 더 추가+Add it again, to choose another account's folder for it. 다시 추가해서 다른 계정의 폴더를 지정합니다.Add more info. The builder reads it at its next step. 내용을 더 적으면 빌더가 다음 단계에서 읽습니다.Add pictures 그림 추가Add pictures of the original 원본 그림 추가@@ -245,6 +247,7 @@ Choose what the builder's questions get 빌더 질문 처리 방식 고르기Choose what to recreate, say what you want, then press Start. 다시 만들 것을 고르고 원하는 내용을 적은 뒤 시작을 누릅니다.Choose… 고르기…Classes 클래스+Claude Code folder (CLAUDE_CONFIG_DIR) Claude Code 폴더 (CLAUDE_CONFIG_DIR)Clean room 클린룸Clean room / Deep 클린룸 / 심층Clean room never reads the original's code, files or page source. Deep mode reads them with every tool Craft Anything has. 클린룸은 원본의 코드, 파일, 페이지 소스를 절대 읽지 않습니다. 심층 모드는 Craft Anything의 모든 도구로 읽습니다.@@ -572,6 +575,7 @@ It's mine, or I'm allowed to look 내 것이거나 볼 권한이 있음Its copy is deleted, with anything it saved there. The project itself stays as it is. 이 사본과 그 안에 저장된 것이 삭제됩니다. 프로젝트 자체는 그대로입니다.Its folder is deleted with everything in it: what was built, the checks and the conversation. 폴더와 그 안의 모든 것이 삭제됩니다: 만든 결과, 검사, 대화.Its own code 자체 코드+Its own sign-in, settings and conversations: another folder is another account. Empty: its usual folder. 자체 로그인, 설정, 대화가 들어 있습니다. 다른 폴더는 다른 계정입니다. 비워 두면 평소 폴더를 씁니다.Java archive overview Java 아카이브 개요Java class Java 클래스Java method bytecode and pseudo-Java Java 메서드 바이트코드와 의사 Java@@ -1006,6 +1010,7 @@ Send now 지금 보내기Server address 서버 주소Session status 세션 상태Set a project's asset budget 프로젝트 에셋 예산 정하기+Set an AI's folder AI 폴더 정하기Set an AI's program AI 프로그램 정하기Set model options 모델 옵션 설정Set one up 설정하기diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex ecbd1212..d3b6d671 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -85,6 +85,8 @@ Add a folder… Добавить папку…Add a plugin Добавить плагинAdd an AI brain and I'll read this evidence for you, answer follow-up questions and point at the proof. Добавьте «мозг» ИИ, и я прочитаю для вас эти доказательства, отвечу на дополнительные вопросы и укажу на доказательства.Add an AI by its address Добавить ИИ по адресу+Add another Добавить ещё+Add it again, to choose another account's folder for it. Добавить ещё раз, чтобы выбрать для него папку другой учётной записи.Add more info. The builder reads it at its next step. Добавьте больше информации. Конструктор прочитает её на следующем шаге.Add pictures Добавить изображенияAdd pictures of the original Добавить изображения оригинала@@ -233,6 +235,7 @@ Choose what the builder's questions get Выберите, что получаюChoose what to recreate, say what you want, then press Start. Выберите, что пересоздать, скажите, что хотите, затем нажмите «Старт».Choose… Выбрать…Classes Классы+Claude Code folder (CLAUDE_CONFIG_DIR) Папка Claude Code (CLAUDE_CONFIG_DIR)Clean room Чистая комнатаClean room / Deep Чистая комната / ГлубокийClean room never reads the original's code, files or page source. Deep mode reads them with every tool Craft Anything has. Режим «Чистая комната» никогда не читает код, файлы или исходник страницы оригинала. Режим «Глубокий» читает их всеми инструментами Craft Anything.@@ -560,6 +563,7 @@ It's mine, or I'm allowed to look Это моё, или мне разрешенIts copy is deleted, with anything it saved there. The project itself stays as it is. Его копия удалена вместе со всем, что там было сохранено. Сам проект остаётся как есть.Its folder is deleted with everything in it: what was built, the checks and the conversation. Его папка удалена со всем содержимым: тем, что было собрано, проверками и перепиской.Its own code Его собственный код+Its own sign-in, settings and conversations: another folder is another account. Empty: its usual folder. Свой вход, настройки и разговоры: другая папка — другая учётная запись. Пусто: обычная папка.Java archive overview Обзор архива JavaJava class Класс JavaJava method bytecode and pseudo-Java Байт-код метода Java и псевдо-Java@@ -1003,6 +1007,7 @@ Send now Отправить сейчасServer address Адрес сервераSession status Состояние сессииSet a project's asset budget Установить бюджет ресурсов проекта+Set an AI's folder Установить папку ИИSet an AI's program Установить программу ИИSet model options Задать параметры моделиSet one up Настроитьdiff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex f362a799..daae9832 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -99,6 +99,8 @@ Add a folder… 添加文件夹…Add a plugin 添加插件Add an AI brain and I'll read this evidence for you, answer follow-up questions and point at the proof. 添加 AI 助手后,我就能为你解读这些证据、回答后续问题,并指出依据。Add an AI by its address 按地址添加 AI+Add another 再添加一个+Add it again, to choose another account's folder for it. 再添加一次,以便为它选择另一个账号的文件夹。Add more info. The builder reads it at its next step. 补充更多信息。构建助手会在下一步读取。Add pictures 添加图片Add pictures of the original 添加原作图片@@ -245,6 +247,7 @@ Choose what the builder's questions get 选择如何处理构建助手的问题Choose what to recreate, say what you want, then press Start. 选择要重现的对象,描述你的需求,然后点击开始。Choose… 选择…Classes 类+Claude Code folder (CLAUDE_CONFIG_DIR) Claude Code 文件夹 (CLAUDE_CONFIG_DIR)Clean room 净室Clean room / Deep 净室 / 深度Clean room never reads the original's code, files or page source. Deep mode reads them with every tool Craft Anything has. 净室模式从不读取原作的代码、文件或页面源代码。深度模式会使用 Craft Anything 的全部工具读取它们。@@ -572,6 +575,7 @@ It's mine, or I'm allowed to look 这是我的,或我已获准查看Its copy is deleted, with anything it saved there. The project itself stays as it is. 将删除此副本及其保存的所有内容。项目本身保持不变。Its folder is deleted with everything in it: what was built, the checks and the conversation. 将删除其文件夹及其中的全部内容:构建成果、检查结果和对话。Its own code 自身代码+Its own sign-in, settings and conversations: another folder is another account. Empty: its usual folder. 它自己的登录信息、设置和对话:换一个文件夹就是换一个账号。留空:使用默认文件夹。Java archive overview Java 归档概览Java class Java 类Java method bytecode and pseudo-Java Java 方法字节码与伪 Java 代码@@ -1006,6 +1010,7 @@ Send now 立即发送Server address 服务器地址Session status 会话状态Set a project's asset budget 设置项目素材预算+Set an AI's folder 设置 AI 的文件夹Set an AI's program 设置 AI 的程序Set model options 设置模型选项Set one up 设置一个diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 26fc80ba..a4e5b2cf 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -99,6 +99,8 @@ Add a folder… 新增資料夾…Add a plugin 新增外掛Add an AI brain and I'll read this evidence for you, answer follow-up questions and point at the proof. 新增 AI 助手後,我就能為你解讀這些證據、回答後續問題,並指出依據。Add an AI by its address 依位址新增 AI+Add another 再新增一個+Add it again, to choose another account's folder for it. 再新增一次,以便為它選擇另一個帳號的資料夾。Add more info. The builder reads it at its next step. 補充更多資訊。建置助手會在下一步讀取。Add pictures 新增圖片Add pictures of the original 新增原作圖片@@ -245,6 +247,7 @@ Choose what the builder's questions get 選擇如何處理建置助手的問題Choose what to recreate, say what you want, then press Start. 選擇要重現的對象,描述你的需求,然後點選開始。Choose… 選擇…Classes 類別+Claude Code folder (CLAUDE_CONFIG_DIR) Claude Code 資料夾 (CLAUDE_CONFIG_DIR)Clean room 淨室Clean room / Deep 淨室 / 深度Clean room never reads the original's code, files or page source. Deep mode reads them with every tool Craft Anything has. 淨室模式從不讀取原作的程式碼、檔案或網頁原始碼。深度模式會使用 Craft Anything 的全部工具讀取它們。@@ -572,6 +575,7 @@ It's mine, or I'm allowed to look 這是我的,或我已獲准查看Its copy is deleted, with anything it saved there. The project itself stays as it is. 將刪除此副本及其儲存的所有內容。專案本身保持不變。Its folder is deleted with everything in it: what was built, the checks and the conversation. 將刪除其資料夾及其中的全部內容:建置成果、檢查結果和對話。Its own code 本身的程式碼+Its own sign-in, settings and conversations: another folder is another account. Empty: its usual folder. 它自己的登入資訊、設定和對話:換一個資料夾就是換一個帳號。留空:使用預設資料夾。Java archive overview Java 封存檔概觀Java class Java 類別Java method bytecode and pseudo-Java Java 方法位元組碼與虛擬 Java 程式碼@@ -1006,6 +1010,7 @@ Send now 立即傳送Server address 伺服器位址Session status 工作階段狀態Set a project's asset budget 設定專案素材預算+Set an AI's folder 設定 AI 的資料夾Set an AI's program 設定 AI 的程式Set model options 設定模型選項Set one up 設定一個diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 5f880a2d..e2f416b4 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -434,6 +434,8 @@ pub struct CraftApp {pub model_tuning: std::collections::BTreeMap<String, ModelTuningDraft>,/// The agent app whose program the file dialog is choosing.pub picking_program_for: Option<String>,+ /// Claude Code folders being typed in Settings → AI, by AI, until they're saved.+ pub folder_inputs: std::collections::BTreeMap<String, String>,/// The backend the person chose to build with (Settings → AI), if any.pub builder: Option<String>,/// The backend chosen to take a game's files out in Deep mode, if any.@@ -541,6 +543,7 @@ impl CraftApp {model_request: 0,model_tuning: Default::default(),picking_program_for: None,+ folder_inputs: Default::default(),builder: None,extractor: None,detected: None,@@ -1534,8 +1537,7 @@ impl CraftApp {if let Some(name) = self.picking_program_for.take() {self.set_agent_program(&name, Some(path.display().to_string()));}- }- // Several files: these come back as Done::Pictures / Done::ToAttach.+ } // Several files: these come back as Done::Pictures / Done::ToAttach.Pick::Pictures | Pick::Attach => {}}}diff --git a/crates/ui-egui/src/settings_ui.rs b/crates/ui-egui/src/settings_ui.rsindex 7d9850b2..d2e5908d 100644--- a/crates/ui-egui/src/settings_ui.rs+++ b/crates/ui-egui/src/settings_ui.rs@@ -331,6 +331,9 @@ fn ai(app: &mut CraftApp, ui: &mut Ui) {}let (mut pick, mut builds, mut extracts, mut toggle, mut remove) = (None, None, None, None, None);let (mut choose_program, mut usual_program) = (None, None);+ let mut save_folder = None;+ // Taken out while the rows borrow the app, and put back after them.+ let mut folder_drafts = std::mem::take(&mut app.folder_inputs);let (mut pick_model, mut chosen_model, mut close_picker) = (None, None, false);let mut chosen_effort = None;let (mut pick_agent_model, mut chosen_agent_model, mut remote_program) = (None, None, None);@@ -370,6 +373,41 @@ fn ai(app: &mut CraftApp, ui: &mut Ui) {}});}+ // The folder it keeps its sign-in in (Claude Code's CLAUDE_CONFIG_DIR), typed+ // so `~/` and hidden folders work, here or over SSH: another folder is another+ // account. Saved on Enter or when the field is left; empty is its usual one.+ if craft_anything_ai::folder_var(b).is_some() {+ let saved = app.backend_options.get(&b.name).and_then(|o| o.config_dir.clone()).unwrap_or_default();+ let id = egui::Id::new(("agent-folder", &b.name));+ // What was typed stays until it's saved (or refused, so it can be fixed).+ if folder_drafts.get(&b.name).is_some_and(|d| d.trim() == saved) && !ui.memory(|m| m.has_focus(id)) {+ folder_drafts.remove(&b.name);+ }+ let mut text = folder_drafts.get(&b.name).cloned().unwrap_or_else(|| saved.clone());+ ui.add_space(4.0);+ let label = ui.label(RichText::new(tr("Claude Code folder (CLAUDE_CONFIG_DIR)")).size(theme::CAPTION).color(t.text_dim));+ ui.label(+ RichText::new(tr("Its own sign-in, settings and conversations: another folder is another account. Empty: its usual folder."))+ .color(t.text_faint)+ .size(theme::CAPTION),+ );+ let r = ui+ .add(+ egui::TextEdit::singleline(&mut text)+ .id(id)+ .hint_text("~/.claude")+ .desired_width(260.0)+ .frame(widgets::text_field_frame_compact(&t)),+ )+ .labelled_by(label.id);+ if r.changed() {+ folder_drafts.insert(b.name.clone(), text.clone());+ }+ if r.lost_focus() && text.trim() != saved {+ save_folder = Some((b.name.clone(), text.trim().to_string()));+ }+ ui.add_space(4.0);+ }// How hard it thinks: the Claude API and Claude Code take every Claude level.let effort = craft_anything_ai::effort_in_use(b, app.backend_options.get(&b.name));if b.kind == BackendKind::AgentCli && b.ssh_host.as_deref().is_some_and(|h| !h.trim().is_empty()) {@@ -567,6 +605,10 @@ fn ai(app: &mut CraftApp, ui: &mut Ui) {if let Some(name) = usual_program {app.set_agent_program(&name, None);}+ app.folder_inputs = folder_drafts;+ if let Some((name, folder)) = save_folder {+ app.set_agent_folder(&name, Some(folder));+ }if let Some(name) = pick_model {app.pick_model(&name);}@@ -649,6 +691,15 @@ fn ai(app: &mut CraftApp, ui: &mut Ui) {ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {if configured {widgets::pill(ui, "Added", t.success, t.raised);+ // Claude Code once more, to give it another account's folder.+ if craft_anything_ai::folder_var(&d.suggestion).is_some()+ && widgets::link(ui, "Add another").on_hover_text(tr("Add it again, to choose another account's folder for it.")).clicked()+ {+ let taken = |n: &String| app.backends.iter().any(|b| &b.name == n);+ if let Some(name) = (2..100).map(|i| format!("{} {i}", d.suggestion.name)).find(|n| !taken(n)) {+ app.add_backend(craft_anything_ai::BackendConfig { name, ..d.suggestion.clone() }, None);+ }+ }} else if !d.needs_key && widgets::primary(ui, "Add").clicked() {app.add_backend(d.suggestion.clone(), None);}diff --git a/crates/ui-egui/tests/headless_parity.rs b/crates/ui-egui/tests/headless_parity.rsindex 53d59002..7e363f47 100644--- a/crates/ui-egui/tests/headless_parity.rs+++ b/crates/ui-egui/tests/headless_parity.rs@@ -49,6 +49,7 @@ const ACTIONS: &[Action] = &[a("set_backend_enabled", "turn an AI on or off", Cli("ai on <name> / ai off <name>")),a("remove_backend", "remove an AI and its key", Cli("ai remove <name>")),a("set_agent_program", "run an agent app from a program it isn't found as", Cli("ai program <name> <path>")),+ a("set_agent_folder", "keep Claude Code's sign-in in another folder (another account)", Cli("ai folder <name> <path>")),a("refresh_projects", "list the projects", Tool(&["project_list"])),a("remember_project", "keep a project in a picked folder in the list", Tool(&["rebuild_start"])),a("add_project_folder", "list projects from another folder too", Tool(&["settings_set"])),diff --git a/crates/ui-egui/tests/smoke.rs b/crates/ui-egui/tests/smoke.rsindex 8dd483c6..b2ff23f9 100644--- a/crates/ui-egui/tests/smoke.rs+++ b/crates/ui-egui/tests/smoke.rs@@ -1193,6 +1193,54 @@ fn opencode_picker_offers_only_the_selected_models_thinking_depths() {assert!(h.query_by_label("Xhigh").is_none());}+/// Claude Code's folder (its sign-in, so its account) is chosen in Settings → AI, and a second+/// Claude Code can be added for a second account.+#[test]+fn claude_codes_account_folder_is_set_in_settings() {+ use craft_anything_ai::{BackendConfig, BackendKind};+ let mut h = harness(|| {+ let mut a = demo::app(demo::engine(Mode::Experienced, true));+ let cfg = BackendConfig {+ name: "Claude Code".into(),+ kind: BackendKind::AgentCli,+ model: "claude-code".into(),+ base_url: None,+ ssh_host: None,+ enabled: true,+ };+ a.hub.add_backend(cfg, None).unwrap();+ a.detected = Some(demo::detected());+ a+ });+ h.state_mut().refresh_backends();+ assert!(wait(&mut h, |a| a.backends.iter().any(|b| b.name == "Claude Code")));+ h.state_mut().state.settings_open = true;+ h.state_mut().state.settings_tab = craft_anything_ui_egui::state::SettingsTab::Ai;+ h.run_steps(2);+ // Typed, `~/` and all, and saved on Enter.+ let field = "Claude Code folder (CLAUDE_CONFIG_DIR)";+ h.get_by_label(field).focus();+ h.run_steps(2);+ h.get_by_label(field).type_text("~/.claude-work");+ h.run_steps(2);+ h.key_press(egui::Key::Enter);+ let chosen = |a: &CraftApp| a.backend_options.get("Claude Code").and_then(|o| o.config_dir.clone());+ assert!(wait(&mut h, |a| chosen(a).as_deref() == Some("~/.claude-work")));+ h.run_steps(2);+ assert_eq!(h.get_by_label(field).value().as_deref(), Some("~/.claude-work"), "shows what's saved");+ assert!(h.state().folder_inputs.is_empty(), "nothing left being typed");+ // A relative folder is refused; the saved one stays.+ h.state_mut().set_agent_folder("Claude Code", Some("claude-work".into()));+ h.run_steps(4);+ assert_eq!(chosen(h.state()).as_deref(), Some("~/.claude-work"));+ // Emptied, it's the usual folder again.+ h.state_mut().set_agent_folder("Claude Code", Some(String::new()));+ assert!(wait(&mut h, |a| chosen(a).is_none()));+ // Added already, so it's offered again under the next free name.+ h.get_by_label("Add another").click();+ assert!(wait(&mut h, |a| a.backends.iter().any(|b| b.name == "Claude Code 2" && b.model == "claude-code")));+}+#[test]fn settings_window_tabs_draw() {let mut h = harness(|| {diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex 96a008fe..1c06aac9 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -594,6 +594,15 @@ Gaps found while using the app for real projects.refused and a folder that's already a project opens. Until now that was only reachablethrough "Choose a folder…" under Make's Start, on a screen that asks what to recreate— claimed: xerenon, branch feature/r2.9-work-on-my-project; PR #686+- [x] Choose Claude Code's folder (`CLAUDE_CONFIG_DIR`) per AI, so one computer can build with+ two Claude accounts; an app opened from the Dock never sees the shell's variable. Settings →+ AI (a typed folder, and Add another) and `ai folder`; live-checked from the CLI with an empty+ folder (not signed in, and the fix names the folder) overriding the shell's own variable,+ and by a build in the app with a typed `~/` folder. A sign-in that expired says so instead+ of "isn't signed in" (the folder's `.claude.json` still names the account)+ — claimed: Claude (Opus 5.5), branch feature/claude-config-dir+- [ ] A live build with two Claude Code AIs signed in to two accounts, and one over SSH with a+ `~/` folder (the remote line is unit-tested, not run on another computer)### R2.10 Pinned buildsOwner: maintainers · Status: in progressdiff --git a/docs/STATUS.md b/docs/STATUS.mdindex 28c78275..c08a721e 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -44,7 +44,7 @@ workspace clippy, layers, fmt and the secret scan of all history were clean. Chi| WebAssembly tag interfaces | `formats_wasm_compare` resolves retained imported and defined tag exports to their declared parameter types. Identical unresolved or invalid diagnostics may still count as unchanged; those counts do not establish interface compatibility, and invalid/partial limitations remain present | Synthetic core modules with tag changes and re-exports, mixed index spaces, import/tag limits, and missing or non-function type references; formats and engine tests. No real module corpus or WebAssembly execution was used for this correction || Questions and approvals | A file inbox per project; `core_person_ask`, `core_action_approve` and MCP consent requests become cards in the app | Cross-handle round-trip tests, a full approval round trip through the engine || Runtime assets in pinned builds | Frozen and light pins, size estimates and project copies keep runtime files in `obj` folders. An `obj` directory beside a regular C#, F# or Visual Basic project file is still recognised as compiler output; ambiguous folders are retained. New pins record the direct-launch program relative to the copy so a newer helper cannot replace it; older pins retain discovery behavior | Synthetic filesystem tests cover both pin modes, model bytes, compiler-output controls and project duplication. A Linux tool-level regression starts temporary scripts through `project_pin_open`, with a newer `Build/obj/helper`, and verifies the originally selected program and its output; a missing recorded program is refused. No real pinned application was launched for this correction |-| Desktop app | Simple mode: sidebar with New project and the project history (kept across restarts); New project makes something, works on a project the person already has (Work on my project: its folder's files are the app, edited in place without a question, and the project takes the folder's name), or just looks inside an app or file, a website or a game's files; a Game files screen (a game's archives; pictures from Unreal paks, Unity .assets files and Unity bundles saved as PNG after the person confirms they may unpack the game; uncompressed textures and the block formats DXT1, DXT5 and BC4–BC7), make prompt with picture attachments (picked, dropped, or pasted with Ctrl+V, shown as picture tiles) and, for anything recreated, a Clean room / Deep choice (also in the title bar; in Clean room, Just look inside, Game files, opening a file and the workbench ask for Deep mode instead), project screen (steps with the time spent and the AI cost and tokens of every build, saved in the project's usage.json by the run (a coding agent's figure is shown as an estimate at API prices, not the bill), what the build is on now and its activity as it arrives (kept in `build-activity.log`), pinned builder checklist, feed, question and approval cards, a Continue card when a build was paused or stopped part-way (the app or computer closed; the project shows Interrupted) that carries on the builder's own session instead of starting over, and "It's done" beside Continue or Try again to keep the build as it is (`project_build_finish`), checks with screenshots and the requirements not met yet, the builder's open questions, preview, play, folder, follow-ups while it builds, which Claude Code takes at its next step; Up in the prompt box takes back the last note still waiting). Projects can start in a folder the person picks, whose files are either the app, edited in place, or material to start from (asked, or the answer remembered in Settings), and are listed from any number of folders (`project_folders`, `project_list`, `rebuild --project-folder`). Make says which AI builds ("Built by": automatic, or any AI that can build, by name); a pick stays with the project and builds its later changes. With nothing to build with, Start offers the coding agents found on the computer. Settings → AI turns an AI off or removes it, and sets how hard the Claude API or Claude Code thinks (every Claude level, low to max; also `ai effort` in the CLI). In the prompt box, Up at the very start and Down at the very end go through earlier prompts when no note is waiting. Questions about a build ("Just ask" under the prompt box, or a message starting with `/btw`, the first slash command; `rebuild_question_ask`) are answered in the conversation, where each folds away and is kept in the project, without a build or a round and changing nothing: Claude Code answers from a read-only copy of the builder's own session. Under each project's prompt box, "Builder's questions: Ask me / Decide yourself" chooses whether the builder's questions come to the person as cards or are decided by the builder, which says what it chose (`project_questions_set`; the default is in Settings and follows Auto mode until picked). Projects can be renamed, duplicated and deleted (right-click in the sidebar, or the project's page; a delete keeps the person's own files). A build can be pinned (Pin this build on its page, or `project_pin_*` from the CLI and MCP): a frozen copy in the project's pinned/ folder (the default) or a light one that shares dependencies and media with the project through hard links (each one's size shown first), opened from the sidebar's collapsible Pinned section (icons with a running dot when folded); a pin or Play runs once per folder unless another copy is asked for, and a start that quits at once says so with its last output. Typed drafts survive a restart. In a narrow window the sidebar folds to icons and the project's details move above its feed; messages float over the screen and errors stay until dismissed. Advanced mode: workbench with every panel wired to real tools, as a screen beside the projects (builds and their questions stay a click away) | UI unit and smoke tests (egui_kittest), offscreen snapshots of every screen |+| Desktop app | Simple mode: sidebar with New project and the project history (kept across restarts); New project makes something, works on a project the person already has (Work on my project: its folder's files are the app, edited in place without a question, and the project takes the folder's name), or just looks inside an app or file, a website or a game's files; a Game files screen (a game's archives; pictures from Unreal paks, Unity .assets files and Unity bundles saved as PNG after the person confirms they may unpack the game; uncompressed textures and the block formats DXT1, DXT5 and BC4–BC7), make prompt with picture attachments (picked, dropped, or pasted with Ctrl+V, shown as picture tiles) and, for anything recreated, a Clean room / Deep choice (also in the title bar; in Clean room, Just look inside, Game files, opening a file and the workbench ask for Deep mode instead), project screen (steps with the time spent and the AI cost and tokens of every build, saved in the project's usage.json by the run (a coding agent's figure is shown as an estimate at API prices, not the bill), what the build is on now and its activity as it arrives (kept in `build-activity.log`), pinned builder checklist, feed, question and approval cards, a Continue card when a build was paused or stopped part-way (the app or computer closed; the project shows Interrupted) that carries on the builder's own session instead of starting over, and "It's done" beside Continue or Try again to keep the build as it is (`project_build_finish`), checks with screenshots and the requirements not met yet, the builder's open questions, preview, play, folder, follow-ups while it builds, which Claude Code takes at its next step; Up in the prompt box takes back the last note still waiting). Projects can start in a folder the person picks, whose files are either the app, edited in place, or material to start from (asked, or the answer remembered in Settings), and are listed from any number of folders (`project_folders`, `project_list`, `rebuild --project-folder`). Make says which AI builds ("Built by": automatic, or any AI that can build, by name); a pick stays with the project and builds its later changes. With nothing to build with, Start offers the coding agents found on the computer. Settings → AI turns an AI off or removes it, and sets how hard the Claude API or Claude Code thinks (every Claude level, low to max; also `ai effort` in the CLI). Each Claude Code AI can keep its sign-in in a folder of its own (its `CLAUDE_CONFIG_DIR`, so its own account; `ai folder` in the CLI, a folder on that computer over SSH), used for its runs, its sign-in check and its kept session, and Add another adds a second Claude Code for a second account. In the prompt box, Up at the very start and Down at the very end go through earlier prompts when no note is waiting. Questions about a build ("Just ask" under the prompt box, or a message starting with `/btw`, the first slash command; `rebuild_question_ask`) are answered in the conversation, where each folds away and is kept in the project, without a build or a round and changing nothing: Claude Code answers from a read-only copy of the builder's own session. Under each project's prompt box, "Builder's questions: Ask me / Decide yourself" chooses whether the builder's questions come to the person as cards or are decided by the builder, which says what it chose (`project_questions_set`; the default is in Settings and follows Auto mode until picked). Projects can be renamed, duplicated and deleted (right-click in the sidebar, or the project's page; a delete keeps the person's own files). A build can be pinned (Pin this build on its page, or `project_pin_*` from the CLI and MCP): a frozen copy in the project's pinned/ folder (the default) or a light one that shares dependencies and media with the project through hard links (each one's size shown first), opened from the sidebar's collapsible Pinned section (icons with a running dot when folded); a pin or Play runs once per folder unless another copy is asked for, and a start that quits at once says so with its last output. Typed drafts survive a restart. In a narrow window the sidebar folds to icons and the project's details move above its feed; messages float over the screen and errors stay until dismissed. Advanced mode: workbench with every panel wired to real tools, as a screen beside the projects (builds and their questions stay a click away) | UI unit and smoke tests (egui_kittest), offscreen snapshots of every screen || CLI | Every tool, `--deep` or `--clean-room` for one run (never saved), `rebuild` (including `--continue-in`, and `--resume` to carry on a stopped build), `mcp --inbox`, `ai`, `setup`, `doctor`, `report` | CLI integration tests || SQLite database files (`db_sqlite_show`) | A rowid alias column (`INTEGER PRIMARY KEY`, including the table-constraint form) shows the rowid; `DESC`, non-`INTEGER` and composite keys keep their stored values | Hand-built fixtures; generated files compared with the official SQLite library || SQLite WITHOUT ROWID tables | Read from the index b-tree, interior records and overflow included; rows in primary-key order, values in declaration order, `rowid` null | Hand-built fixtures; generated files compared with the official SQLite library |