Skip to content
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Claudiu is a native desktop app, written in Rust with [GPUI](https://gpui.rs), t

Each session is your own `claude` process in a real pseudo-terminal, so Claude Code's keys, mouse and paste work unchanged. Claudiu has no API keys and never calls the Anthropic API. Sign-in stays with Claude Code. The first launch opens a setup window that checks for `claude` (required) and `gh` (optional), links to their install pages and installs nothing. Settings has a Check setup button to open it again. A sidebar lists your projects and sessions. Ended sessions resume through `claude --resume`, and sessions that were running come back at the next start.

Around the terminal, Claudiu adds an editor mode (Ctrl+Shift+E) with files, tabs, search, Git change marks and language-server diagnostics, definitions and completion. It also adds usage and context meters, a GitHub pane for issues and pull requests through your `gh` login, defaults for the model, effort and permission mode of new sessions, and extra Claude accounts that share one configuration. Settings lists the rest.
Around the terminal, Claudiu adds an editor mode (Ctrl+Shift+E) with files, tabs, search, Git change marks and language-server diagnostics, definitions and completion. It also adds usage and context meters, a GitHub pane for issues and pull requests through your `gh` login, defaults for the model, effort and permission mode of new sessions, and extra Claude accounts that share one configuration. A session can move between git worktrees the way it switches branches, so several agents work on separate branches at once: the worktree button in the top bar switches the shown session into another worktree, or into a new one that Claudiu makes on a branch you name, and its conversation continues there. Its hover x removes a worktree, the branch button's x deletes a local branch after telling you which commits would be lost, and ending the last session in a worktree offers to remove it. Claudiu keeps the worktrees it makes in its own data folder, outside your repositories, so they never show up in `git status`; Settings has a Worktrees page that lists them to show in the file manager or remove. Settings lists the rest.

Ctrl+Shift (Cmd+Shift on macOS) plus a letter drives the app. Everything else reaches Claude Code. Editor mode finds `rust-analyzer`, `tsc --lsp` and `gleam` on your PATH and installs nothing.

## What it touches

Claudiu never deletes a transcript. It writes to Claude Code's own data only to change the settings you switch in Claudiu, as `/config` does, and to sync shared files between accounts. Nothing is uploaded and terminal contents are never logged. The only network use is GitHub: the update check (off with `"settings": { "update_url": "" }` in `state.json`) and the GitHub pane. State lives in `%LOCALAPPDATA%\m4rocks\Claudiu\data` on Windows, `~/Library/Application Support/Claudiu` on macOS and `~/.local/share/claudiu` on Linux, and crashes go to `crash.log` there.
Claudiu never deletes a transcript. It writes to Claude Code's own data only to change the settings you switch in Claudiu, as `/config` does, to sync shared files between accounts, and to append one line to a transcript when a session that `claude --worktree` put in a worktree moves to another folder, so Claude Code knows it has left that worktree. Nothing is uploaded and terminal contents are never logged. The only network use is GitHub: the update check (off with `"settings": { "update_url": "" }` in `state.json`) and the GitHub pane. State lives in `%LOCALAPPDATA%\m4rocks\Claudiu\data` on Windows, `~/Library/Application Support/Claudiu` on macOS and `~/.local/share/claudiu` on Linux, and crashes go to `crash.log` there.

## Known gaps

Expand Down
77 changes: 58 additions & 19 deletions src/app/background.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

use super::*;

/// What a Claude session's row shows, given what Claude Code says it is doing, what the row showed before, and
/// whether the user is looking at it. A question is shown even to someone looking at it, since only they can answer;
/// a finished turn is shown only to someone who was elsewhere and clears once they look.
fn next_activity(working: bool, waiting: bool, before: Option<Activity>, viewing: bool) -> Option<Activity> {
match (working, waiting, before) {
(true, _, _) => Some(Activity::Working),
(false, true, _) => Some(Activity::Waiting),
(false, false, Some(Activity::Working | Activity::Attention)) if !viewing => Some(Activity::Attention),
_ => None,
}
}

impl Workspace {
/// Startup reconciliation: scan Claude Code's records off the UI thread, then merge.
pub fn start_scan(&mut self, cx: &mut Context<Self>) {
Expand Down Expand Up @@ -46,21 +58,21 @@ impl Workspace {
.detach();
}

/// While a session works, its sidebar dot pulses: the session list is redrawn a few times a second (with the
/// While a session works, its sidebar icon spins: the session list is redrawn many times a second (with the
/// window's top level, which reuses the other cached parts). It stops once nothing works.
fn start_pulse(&mut self, cx: &mut Context<Self>) {
if self.pulsing {
fn start_spin(&mut self, cx: &mut Context<Self>) {
if self.spinning {
return;
}
self.pulsing = true;
self.spinning = true;
cx.spawn(async move |this, cx| {
loop {
cx.background_executor().timer(crate::panels::sidebar::PULSE_STEP).await;
cx.background_executor().timer(crate::panels::status_icon::SPIN_STEP).await;
let working = this.update(cx, |ws, cx| {
let working = ws.activity.values().any(|a| *a == Activity::Working);
match &ws.session_list {
Some(list) if working => list.update(cx, |_, cx| cx.notify()),
_ => ws.pulsing = working,
_ => ws.spinning = working,
}
working
});
Expand Down Expand Up @@ -118,26 +130,20 @@ impl Workspace {
let viewing = window_active && shown.as_deref() == Some(l.id.as_str());
let status = self.store.session(&l.id).and_then(|r| statuses.get(r.claude_id()?));
let working = status.map_or_else(|| view.is_working(), |s| s == "busy");
match (working, self.activity.get(&l.id)) {
(true, _) => {
next.insert(l.id.clone(), Activity::Working);
}
(false, Some(Activity::Working)) if !viewing => {
flash |= !window_active;
next.insert(l.id.clone(), Activity::Attention);
}
(false, Some(Activity::Attention)) if !viewing => {
next.insert(l.id.clone(), Activity::Attention);
}
_ => {}
let waiting = status.is_some_and(|s| s == "waiting");
let before = self.activity.get(&l.id).copied();
let now = next_activity(working, waiting, before, viewing);
flash |= !window_active && before == Some(Activity::Working) && matches!(now, Some(Activity::Attention | Activity::Waiting));
if let Some(now) = now {
next.insert(l.id.clone(), now);
}
}
if next != self.activity {
self.activity = next;
cx.notify();
}
if self.activity.values().any(|a| *a == Activity::Working) {
self.start_pulse(cx);
self.start_spin(cx);
}
if flash {
platform::request_attention(window);
Expand Down Expand Up @@ -287,3 +293,36 @@ impl Workspace {
crate::updater::check(self, cx);
}
}

#[cfg(test)]
mod tests {
use super::{Activity, next_activity};

#[test]
fn busy_is_working_whatever_came_before() {
for before in [None, Some(Activity::Working), Some(Activity::Waiting), Some(Activity::Attention)] {
assert_eq!(next_activity(true, false, before, true), Some(Activity::Working));
assert_eq!(next_activity(true, false, before, false), Some(Activity::Working));
}
}

#[test]
fn a_question_shows_even_to_someone_looking_at_the_session() {
assert_eq!(next_activity(false, true, Some(Activity::Working), true), Some(Activity::Waiting));
assert_eq!(next_activity(false, true, None, false), Some(Activity::Waiting));
}

#[test]
fn a_finished_turn_waits_to_be_seen_and_clears_once_looked_at() {
assert_eq!(next_activity(false, false, Some(Activity::Working), false), Some(Activity::Attention));
assert_eq!(next_activity(false, false, Some(Activity::Attention), false), Some(Activity::Attention));
assert_eq!(next_activity(false, false, Some(Activity::Working), true), None);
assert_eq!(next_activity(false, false, Some(Activity::Attention), true), None);
}

#[test]
fn an_idle_session_nobody_is_owed_news_from_shows_nothing() {
assert_eq!(next_activity(false, false, None, false), None);
assert_eq!(next_activity(false, false, Some(Activity::Waiting), false), None);
}
}
11 changes: 10 additions & 1 deletion src/app/editor_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ impl Workspace {
/// List the shown session's folder again (files Claude added, changed marks), off the UI thread.
pub(super) fn refresh_files(&mut self, cx: &mut Context<Self>) {
let Some(id) = self.active_id().filter(|_| self.editor_mode).cloned() else { return };
let Some(root) = self.store.session(&id).map(|s| s.cwd.clone()) else { return };
// A worktree that Claude Code is still making has no folder to list yet.
let Some(root) = self.store.session(&id).map(|s| s.cwd.clone()).filter(|root| root.is_dir()) else { return };
let Some(pane) = self.panes.get_mut(&id) else { return };
if pane.listing {
pane.relist = true;
Expand All @@ -257,6 +258,7 @@ impl Workspace {
let relist = std::mem::take(&mut pane.relist);
pane.changed = std::sync::Arc::new(listing.changed);
pane.truncated = listing.truncated;
let moved = !pane.root.as_os_str().is_empty() && pane.root != listing.root;
pane.root = listing.root;
if pane.nodes != listing.nodes {
let items = tree_items(&listing.nodes, &pane.expanded);
Expand All @@ -273,6 +275,13 @@ impl Workspace {
pane.files = std::sync::Arc::new(all);
pane.nodes = listing.nodes;
}
if moved {
// The session went to another folder: the old watcher watches the wrong one.
if let Some(pane) = ws.panes.get_mut(&id) {
pane.watcher = None;
}
ws.watch_folder(&id, cx);
}
if relist {
ws.refresh_files(cx);
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Workspace {
let to_name = self.store.active_account().map_or_else(|| "the active account".into(), |a| a.name());
let since = Instant::now();
self.handoffs.insert(id.into(), Handoff { asked: crate::store::now(), compacted: false, since });
self.set_handover(id, Some(Handover { to: to_name, since }), cx);
self.set_handover(id, Some(Handover { message: format!("Handing over to {to_name}…"), since }), cx);
usage::send_ctl(&usage::ctl_file(id), "compact", serde_json::json!(true));
}

Expand Down Expand Up @@ -106,11 +106,11 @@ impl Workspace {
}
self.restart_session(id, window, cx);
let to_name = self.store.active_account().map_or_else(|| "the active account".into(), |a| a.name());
self.set_handover(id, Some(Handover { to: to_name, since }), cx);
self.set_handover(id, Some(Handover { message: format!("Handing over to {to_name}…"), since }), cx);
}

/// The skeleton says "Handing over to …" while this is set; the new process clears it once its prompt is ready.
fn set_handover(&self, id: &str, handover: Option<Handover>, cx: &mut App) {
pub(super) fn set_handover(&self, id: &str, handover: Option<Handover>, cx: &mut App) {
if let Some(view) = self.live_view(id) {
view.update(cx, |v, cx| {
v.handover = handover;
Expand Down
Loading
Loading