Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(gauge): also zero the gauge on directly-typed /clear

Chaitanya Giri2e2b3f24bc92
diff --git a/src/renderer/src/components/AgentDetailPanel.tsx b/src/renderer/src/components/AgentDetailPanel.tsx
index 9ded2e6f..1ec224bb 100644
--- a/src/renderer/src/components/AgentDetailPanel.tsx
+++ b/src/renderer/src/components/AgentDetailPanel.tsx
@@ -162,6 +162,9 @@ export function AgentDetailPanel({ agent }: AgentDetailPanelProps) {
onStreamData={onPtyStream}
onUserPrompt={(t) => {
updateAgent(agent.id, { lastPrompt: t });
+ if (t.trim().toLowerCase() === '/clear') {
+ updateAgent(agent.id, { contextTokens: 0, contextLimit: undefined, progress: 0 });
+ }
void window.cth.historyAdd({ agentId: agent.id, cwd: agent.cwd, text: t });
}}
onToggleFullscreen={() => setFullscreen(agent.id)}
diff --git a/src/renderer/src/components/CommandCenterPanel.tsx b/src/renderer/src/components/CommandCenterPanel.tsx
index 22ce9ae1..55cd421b 100644
--- a/src/renderer/src/components/CommandCenterPanel.tsx
+++ b/src/renderer/src/components/CommandCenterPanel.tsx
@@ -167,6 +167,9 @@ export function CommandCenterPanel({ agent }: { agent: Agent }) {
onStreamData={onPtyStream}
onUserPrompt={(t) => {
updateAgent(agent.id, { lastPrompt: t });
+ if (t.trim().toLowerCase() === '/clear') {
+ updateAgent(agent.id, { contextTokens: 0, contextLimit: undefined, progress: 0 });
+ }
void window.cth.historyAdd({ agentId: agent.id, cwd: agent.cwd, text: t });
}}
onToggleFullscreen={() => setFullscreen(agent.id)}
diff --git a/src/renderer/src/components/FullscreenTerminal.tsx b/src/renderer/src/components/FullscreenTerminal.tsx
index d7fc54bb..735af524 100644
--- a/src/renderer/src/components/FullscreenTerminal.tsx
+++ b/src/renderer/src/components/FullscreenTerminal.tsx
@@ -138,6 +138,9 @@ export function FullscreenTerminal() {
onStreamData={parser}
onUserPrompt={(t) => {
updateAgent(agent.id, { lastPrompt: t });
+ if (t.trim().toLowerCase() === '/clear') {
+ updateAgent(agent.id, { contextTokens: 0, contextLimit: undefined, progress: 0 });
+ }
void window.cth.historyAdd({ agentId: agent.id, cwd: agent.cwd, text: t });
}}
onToggleFullscreen={() => setFullscreen(null)}
diff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.ts
index 31db41ec..a7aa14d5 100644
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@ -451,7 +451,7 @@ export function useHive(config: HarnessConfig | null): void {
// Zero the gauge instantly on /clear — the new session's context isn't
// known until statusLine fires after the first post-clear response, so
// leaving it at the old value shows a stale-full bar during that window.
- if (next.text.trimStart().startsWith('/clear')) {
+ if (next.text.trim().toLowerCase() === '/clear') {
useStore.getState().updateAgent(target.id, { contextTokens: 0, contextLimit: undefined, progress: 0 });
}
submitToPty(target.ptyId, wrap ? wrap(next.text) : next.text).catch(() => { /* pty may have died */ });