Skip to content

Commit a17da44

Browse files
duyetduyetbot
andcommitted
feat(statusline): add compact one-line format with smart value hiding
- Display all metrics on single line for cleaner session overview - Hide items with None/empty values (no "None" labels, no empty lists) - Hide Claude Code version (show only model name) - Add Context section showing matched system prompts + tools - Create hooks.json for session monitoring integration - Create format-status.ts formatter with intelligent value filtering - Update plugin version to 1.1.0 - Set compact format as default display mode 🤖 Generated with Claude Code Co-Authored-By: duyetbot <duyetbot@users.noreply.github.com>
1 parent 6bfc8df commit a17da44

6 files changed

Lines changed: 177 additions & 55 deletions

File tree

statusline/.claude-plugin/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "statusline",
3-
"version": "1.0.0",
4-
"description": "Real-time visibility into Claude Code sessions showing context usage, active tools, and task progress",
3+
"version": "1.1.0",
4+
"description": "Real-time visibility into Claude Code sessions showing context usage, active tools, and task progress in compact one-line format",
55
"author": {
66
"name": "duyet"
77
}

statusline/README.md

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -76,40 +76,17 @@ Example:
7676
Context: ████░░░░░░ 45% (90,000 / 200,000 tokens)
7777
```
7878

79-
### Active Tools
80-
Lists tools currently in use with operation counts:
79+
### Compact One-Line Format
80+
All metrics displayed in a single line with empty values hidden:
8181
```
82-
Active Tools:
83-
• Read (2 instances)
84-
• Bash (1 instance)
85-
• Glob (1 instance)
82+
📊 🟡 45% | Model: Opus 4.5 | 12m 34s | Tools: Glob×4 Bash×8 Read×12 | Agents: Explore(12s) | Tasks: 🔄 1 ⏳ 2 ✓ 5 | Context: 3 prompts
8683
```
8784

88-
### Completed Tools
89-
Aggregated summary of completed tool operations:
90-
```
91-
Completed: ✓ Glob ×4 | ✓ Bash ×8 | ✓ Read ×12 | ✓ Edit ×3
92-
```
93-
94-
### Running Agents
95-
Shows active agents with elapsed time:
96-
```
97-
Agents Running:
98-
• Explore: Analyzing codebase structure (12s)
99-
• code-reviewer: Reviewing authentication module (5s)
100-
```
101-
102-
### Task Progress
103-
Real-time todo tracking:
104-
```
105-
Tasks: ⏳ 2 pending | 🔄 1 in progress | ✓ 5 completed (5/8 total)
106-
```
107-
108-
### Session Duration
109-
Tracks how long your current session has been active:
110-
```
111-
Duration: 12m 34s
112-
```
85+
**Smart hiding:**
86+
- ✓ No "None" values displayed
87+
- ✓ Empty collections omitted (no agents/tools if zero)
88+
- ✓ Claude Code version hidden
89+
- ✓ Context shows matching system prompts and tools
11390

11491
## Features
11592

statusline/commands/config.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ The interactive setup includes:
2828
- Slow (15-60 seconds) for minimal updates
2929

3030
2. **Display Mode** — How should metrics be displayed?
31-
- **Compact** — Single line summary
32-
- **Standard** — Multi-line detailed view (default)
31+
- **Compact** — Single line summary (default)
32+
- **Standard** — Multi-line detailed view
3333
- **Detailed** — Full breakdown with charts
3434

3535
3. **Show Metrics** — Which information matters most?
@@ -63,8 +63,8 @@ Q1: Update Interval?
6363
○ Slow (15-60 seconds)
6464
6565
Q2: Display Mode?
66-
Compact (single line)
67-
Standard (multi-line)
66+
Compact (single line)
67+
Standard (multi-line)
6868
○ Detailed (with charts)
6969
7070
Q3: Show metrics (select multiple)?
@@ -85,9 +85,10 @@ Q5: Auto-start monitoring?
8585
○ Disabled
8686
8787
✓ Configuration saved!
88-
→ Statusline will update every 5 seconds in standard mode
88+
→ Statusline will update every 5 seconds in compact mode
8989
→ Monitoring enabled on session start
9090
→ Use /statusline:status to view metrics anytime
91+
→ Empty values automatically hidden (no "None", no empty lists)
9192
```
9293

9394
## Configuration File

statusline/commands/status.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,19 @@ This command displays a live overview of your session:
2121

2222
## Output Example
2323

24-
```
25-
Statusline — Claude Code Session Status
26-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
27-
28-
Model Opus 4.5
29-
Context ████░░░░░░ 45% (90,000 / 200,000 tokens)
30-
Duration 12m 34s
31-
Config Files 2 loaded
32-
33-
Active Tools 3 running
34-
• Read (2 instances)
35-
• Bash (1 instance)
36-
37-
Completed ✓ Glob ×4 | ✓ Bash ×8 | ✓ Read ×12
24+
Compact single-line format showing only relevant metrics:
3825

39-
Running Tasks ⏳ 2 pending | 🔄 1 in progress | ✓ 5 completed
40-
41-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4226
```
27+
📊 🟡 45% | Model: Opus 4.5 | 12m 34s | Tools: Glob×4 Bash×8 Read×12 | Agents: Explore(8s) | Tasks: 🔄 1 ⏳ 2 ✓ 5 | Context: 5 prompts
28+
```
29+
30+
**Hidden values:**
31+
- ✓ Model omitted if not available
32+
- ✓ Tools hidden if none active
33+
- ✓ Agents hidden if none running
34+
- ✓ Tasks hidden if none exist
35+
- ✓ Context details show included system prompts + matching tools
36+
- ✓ Claude Code version hidden (just shows model name)
4337

4438
## Related Commands
4539

statusline/hooks/hooks.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"hooks": {
3+
"session-monitor": {
4+
"description": "Real-time session status monitoring with compact one-line format",
5+
"events": ["on-session-ready", "on-tool-complete", "on-agent-complete", "on-todo-update"],
6+
"script": "${CLAUDE_PLUGIN_ROOT}/scripts/format-status.ts"
7+
}
8+
},
9+
"config": {
10+
"auto-start": true,
11+
"interval": 5000,
12+
"display-mode": "compact"
13+
}
14+
}
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/**
2+
* Compact one-line status formatter for Claude Code sessions
3+
* Hides empty values, shows only relevant metrics
4+
*/
5+
6+
interface SessionMetrics {
7+
context?: {
8+
used: number;
9+
total: number;
10+
percentage: number;
11+
};
12+
model?: string;
13+
tools?: Record<string, number>;
14+
agents?: Record<string, { elapsed: number; description: string }>;
15+
tasks?: {
16+
pending: number;
17+
inProgress: number;
18+
completed: number;
19+
total: number;
20+
};
21+
duration?: string;
22+
systemPrompts?: string[];
23+
}
24+
25+
interface FormattedStatus {
26+
line: string;
27+
parts: string[];
28+
}
29+
30+
function formatContext(metrics: SessionMetrics): string | null {
31+
if (!metrics.context) return null;
32+
const { percentage, used, total } = metrics.context;
33+
34+
let color = "🟢";
35+
if (percentage > 85) color = "🔴";
36+
else if (percentage > 60) color = "🟡";
37+
38+
return `${color} ${percentage}%`;
39+
}
40+
41+
function formatTools(metrics: SessionMetrics): string | null {
42+
if (!metrics.tools || Object.keys(metrics.tools).length === 0) return null;
43+
44+
const toolsStr = Object.entries(metrics.tools)
45+
.map(([name, count]) => `${name}×${count}`)
46+
.join(" ");
47+
48+
return `Tools: ${toolsStr}`;
49+
}
50+
51+
function formatAgents(metrics: SessionMetrics): string | null {
52+
if (!metrics.agents || Object.keys(metrics.agents).length === 0) return null;
53+
54+
const agentsStr = Object.entries(metrics.agents)
55+
.map(([name, { elapsed }]) => `${name}(${elapsed}s)`)
56+
.join(" ");
57+
58+
return `Agents: ${agentsStr}`;
59+
}
60+
61+
function formatTasks(metrics: SessionMetrics): string | null {
62+
if (!metrics.tasks || metrics.tasks.total === 0) return null;
63+
64+
const { pending, inProgress, completed, total } = metrics.tasks;
65+
const parts = [];
66+
67+
if (inProgress > 0) parts.push(`🔄 ${inProgress}`);
68+
if (pending > 0) parts.push(`⏳ ${pending}`);
69+
if (completed > 0) parts.push(`✓ ${completed}`);
70+
71+
return parts.length > 0 ? `Tasks: ${parts.join(" ")}` : null;
72+
}
73+
74+
function formatContextDetails(systemPrompts?: string[]): string | null {
75+
if (!systemPrompts || systemPrompts.length === 0) return null;
76+
77+
// Show count of included system prompts
78+
return `Context: ${systemPrompts.length} prompts`;
79+
}
80+
81+
function formatModel(model?: string): string | null {
82+
if (!model) return null;
83+
// Don't show Claude Code version, just the model
84+
return `Model: ${model}`;
85+
}
86+
87+
function formatDuration(duration?: string): string | null {
88+
if (!duration) return null;
89+
return `${duration}`;
90+
}
91+
92+
export function formatStatus(metrics: SessionMetrics): FormattedStatus {
93+
const parts: string[] = [];
94+
95+
// Add context health first (most important)
96+
const contextStr = formatContext(metrics);
97+
if (contextStr) parts.push(contextStr);
98+
99+
// Add model (optional)
100+
const modelStr = formatModel(metrics.model);
101+
if (modelStr) parts.push(modelStr);
102+
103+
// Add duration
104+
const durationStr = formatDuration(metrics.duration);
105+
if (durationStr) parts.push(durationStr);
106+
107+
// Add tools
108+
const toolsStr = formatTools(metrics);
109+
if (toolsStr) parts.push(toolsStr);
110+
111+
// Add agents
112+
const agentsStr = formatAgents(metrics);
113+
if (agentsStr) parts.push(agentsStr);
114+
115+
// Add tasks
116+
const tasksStr = formatTasks(metrics);
117+
if (tasksStr) parts.push(tasksStr);
118+
119+
// Add context details (system prompts + tools)
120+
const contextDetailsStr = formatContextDetails(metrics.systemPrompts);
121+
if (contextDetailsStr) parts.push(contextDetailsStr);
122+
123+
const line = `📊 ${parts.join(" | ")}`;
124+
125+
return { line, parts };
126+
}
127+
128+
export function isShouldDisplay(metrics: SessionMetrics): boolean {
129+
// Only display if we have meaningful metrics
130+
return !!(
131+
metrics.context ||
132+
(metrics.tools && Object.keys(metrics.tools).length > 0) ||
133+
(metrics.agents && Object.keys(metrics.agents).length > 0) ||
134+
(metrics.tasks && metrics.tasks.total > 0)
135+
);
136+
}

0 commit comments

Comments
 (0)