Skip to content

Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.

feat(claude): per-subagent statusline row + clickable graft node refs

Shrish Dwivedifc079168dd7a
diff --git a/.claude/settings.json b/.claude/settings.json
index cdba9c98..bc94c3e6 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -3,6 +3,11 @@
"type": "command",
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-statusline.cjs\""
},
+ "subagentStatusLine": {
+ "type": "command",
+ "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-statusline.cjs\""
+ },
+ "footerLinksRegexes": ["graft/[\\w./-]+\\.md"],
"hooks": {
"PostToolUse": [
{
diff --git a/src/claude/format.ts b/src/claude/format.ts
index 9ba2cd22..4d58e20d 100644
--- a/src/claude/format.ts
+++ b/src/claude/format.ts
@@ -91,3 +91,9 @@ export function formatRetrieval(ask: AskJson, cap = 5): string | null {
export function formatOrientation(indexMd: string, budgetBytes = 1500): string {
return `[graft] repo map (graft/INDEX.md):\n${indexMd.slice(0, budgetBytes)}`;
}
+
+export function renderSubagent(agentName: string, session: SessionState | null): string {
+ const q = session?.perAgentQuery?.[agentName];
+ const tail = q ? SEP + C.muted('graft: ') + C.text(q) : '';
+ return C.muted('◤ ') + C.indigo(agentName) + tail;
+}
diff --git a/src/claude/statusline.ts b/src/claude/statusline.ts
index 06c44b31..0f5bbca7 100644
--- a/src/claude/statusline.ts
+++ b/src/claude/statusline.ts
@@ -1,13 +1,15 @@
import { readFileSync } from 'node:fs';
-import { renderStatusline } from './format.js';
+import { renderStatusline, renderSubagent } from './format.js';
import { readStats, readSession } from './state.js';
export function main(): void {
let input: any = {};
try { input = JSON.parse(readFileSync(0, 'utf8')); } catch { /* no/invalid stdin */ }
const dir = process.env.CLAUDE_PROJECT_DIR || input.cwd || process.cwd();
- const stats = readStats(dir);
const session = readSession(dir, input.session_id || 'default');
+ const agent = input?.agent?.name;
+ if (agent) { process.stdout.write(renderSubagent(agent, session)); return; }
+ const stats = readStats(dir);
const raw = input?.context_window?.used_percentage;
const ctxPct = typeof raw === 'number' ? Math.round(raw) : null;
process.stdout.write(renderStatusline(stats, session, { ctxPct }).join('\n'));
diff --git a/test/claude-format.test.ts b/test/claude-format.test.ts
index 49c4d185..7d938b87 100644
--- a/test/claude-format.test.ts
+++ b/test/claude-format.test.ts
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { renderStatusline, enrichedSegment, incomingEdges, formatBlastRadius, formatRetrieval, formatOrientation } from '../src/claude/format.js';
+import { renderStatusline, enrichedSegment, incomingEdges, formatBlastRadius, formatRetrieval, formatOrientation, renderSubagent } from '../src/claude/format.js';
import { emptyStats } from '../src/claude/state.js';
const strip = (s: string) => s.replace(/\x1b\[[0-9;]*m/g, '');
@@ -83,3 +83,14 @@ test('formatOrientation labels and truncates to budget', () => {
assert.match(out, /repo map/);
assert.ok(out.length < 1600, 'trimmed to budget + short header');
});
+
+test('renderSubagent shows agent name and its last query', () => {
+ const out = strip(renderSubagent('Explore', { lastQuery: null, perAgentQuery: { Explore: 'pkce flow' }, graftReads: 0, sourceReads: 0 }));
+ assert.match(out, /Explore/);
+ assert.match(out, /pkce flow/);
+});
+
+test('renderSubagent without a query still shows the agent', () => {
+ const out = strip(renderSubagent('Plan', null));
+ assert.match(out, /Plan/);
+});