Skip to content

Commit fb62916

Browse files
committed
Feature: Enhanced Status Footer (v2.1) - More engaging and informative
Added comprehensive status footer with 8 real-time metrics: 1. Activity count (operations performed) 2. Codebase map status (freshness indicator) 3. Context status (memory bank active) 4. Behavior profile (current AI mode) 5. Session duration (time elapsed) 6. Current focus (extracted from activeContext) 7. Memory health (session update count) 8. Last sync time (memory bank freshness) 9. Tool usage breakdown (top 3 tools) Changes: - .claude/hooks/conversation-capture-user-prompt.sh: Enhanced footer generation - .claude/hooks/intelligent-status-notification.sh: Enhanced footer for session end - .claude/hooks/session-start.sh: Added session-start-time and profile tracking - CLAUDE.md: Updated status footer documentation - docs/V2.1-STATUS-FOOTER.md (NEW): Complete status footer guide Status Footer Format: 🧠 MINI-CODER-BRAIN STATUS 📊 Activity: X ops | 🗺️ Map: Status | ⚡ Context: Active 🎭 Profile: default | ⏱️ 15m | 🎯 Focus: Current work 💾 Memory: Healthy | 🔄 Last sync: 10m ago | 🔧 Tools: Read(5) Edit(3) Benefits: ✅ Transparency: See what Mini-CoderBrain is doing ✅ Engagement: Feel AI working behind the scenes ✅ Proactive: Early warning for memory bloat ✅ Informative: 9 metrics vs 3 previously (3x more info) v2.1 Status Footer: COMPLETE
1 parent b88149b commit fb62916

File tree

5 files changed

+407
-16
lines changed

5 files changed

+407
-16
lines changed

.claude/hooks/conversation-capture-user-prompt.sh

Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,98 @@ if [ "$activity_count" -gt 50 ]; then
112112
fi
113113
fi
114114

115-
# Build status line with notifications
116-
status_line="🧠 Context: Active | Activity: ${activity_count} ops | Map: ${map_status}"
115+
# === BUILD ENHANCED STATUS FOOTER ===
116+
117+
# Get session duration
118+
session_start_file="$CLAUDE_TMP/session-start-time"
119+
session_duration="0m"
120+
if [ -f "$session_start_file" ]; then
121+
start_time=$(cat "$session_start_file" 2>/dev/null || echo "0")
122+
current_time=$(date +%s)
123+
duration_seconds=$((current_time - start_time))
124+
duration_minutes=$((duration_seconds / 60))
125+
if [ "$duration_minutes" -lt 60 ]; then
126+
session_duration="${duration_minutes}m"
127+
else
128+
duration_hours=$((duration_minutes / 60))
129+
remaining_minutes=$((duration_minutes % 60))
130+
session_duration="${duration_hours}h ${remaining_minutes}m"
131+
fi
132+
fi
133+
134+
# Get current profile
135+
profile="default"
136+
profile_file="$CLAUDE_TMP/current-profile"
137+
if [ -f "$profile_file" ]; then
138+
profile=$(cat "$profile_file" 2>/dev/null || echo "default")
139+
fi
140+
141+
# Get current focus from activeContext.md
142+
current_focus="Development"
143+
if [ -f "$MB/activeContext.md" ]; then
144+
# Extract first line after "## 🎯 Current Focus"
145+
focus_line=$(grep -A 1 "^## 🎯 Current Focus" "$MB/activeContext.md" 2>/dev/null | tail -1 | sed 's/^[[:space:]]*//' || echo "")
146+
if [ -n "$focus_line" ] && [ "$focus_line" != "## 🎯 Current Focus" ]; then
147+
# Truncate to 50 chars max
148+
current_focus=$(echo "$focus_line" | cut -c 1-50)
149+
if [ ${#focus_line} -gt 50 ]; then
150+
current_focus="${current_focus}..."
151+
fi
152+
fi
153+
fi
154+
155+
# Get memory health indicator
156+
memory_health="Healthy"
157+
if [ -f "$MB/activeContext.md" ]; then
158+
session_count=$(grep "^## .* Session Update" "$MB/activeContext.md" 2>/dev/null | wc -l 2>/dev/null || echo "0")
159+
session_count=${session_count// /}
160+
if [ "${session_count:-0}" -gt 15 ] 2>/dev/null; then
161+
memory_health="Needs Cleanup"
162+
elif [ "${session_count:-0}" -gt 10 ] 2>/dev/null; then
163+
memory_health="Monitor"
164+
fi
165+
fi
166+
167+
# Get last sync time
168+
last_sync="Never"
169+
last_sync_file="$CLAUDE_TMP/last-memory-sync"
170+
if [ -f "$last_sync_file" ]; then
171+
last_sync_time=$(cat "$last_sync_file" 2>/dev/null || echo "0")
172+
current_time=$(date +%s)
173+
minutes_ago=$(( (current_time - last_sync_time) / 60 ))
174+
if [ "$minutes_ago" -lt 60 ]; then
175+
last_sync="${minutes_ago}m ago"
176+
else
177+
hours_ago=$((minutes_ago / 60))
178+
last_sync="${hours_ago}h ago"
179+
fi
180+
fi
181+
182+
# Get tool usage breakdown (top 3 tools)
183+
tool_breakdown="None"
184+
if [ -f "$tools_log" ]; then
185+
# Get unique tool names with counts
186+
tool_stats=$(awk '{print $NF}' "$tools_log" 2>/dev/null | sort | uniq -c | sort -rn | head -3)
187+
if [ -n "$tool_stats" ]; then
188+
tool_array=()
189+
while IFS= read -r line; do
190+
count=$(echo "$line" | awk '{print $1}')
191+
tool=$(echo "$line" | awk '{print $2}')
192+
tool_array+=("${tool}(${count})")
193+
done <<< "$tool_stats"
194+
tool_breakdown=$(IFS=' '; echo "${tool_array[*]}")
195+
fi
196+
fi
197+
198+
# Build enhanced status footer
199+
status_line="🧠 MINI-CODER-BRAIN STATUS\n"
200+
status_line="${status_line}📊 Activity: ${activity_count} ops | 🗺️ Map: ${map_status} | ⚡ Context: Active\n"
201+
status_line="${status_line}🎭 Profile: ${profile} | ⏱️ ${session_duration} | 🎯 Focus: ${current_focus}\n"
202+
status_line="${status_line}💾 Memory: ${memory_health} | 🔄 Last sync: ${last_sync} | 🔧 Tools: ${tool_breakdown}"
203+
117204
if [ -n "$notifications" ]; then
118-
# Add notifications on new line
119-
full_status="${status_line}\n\n${notifications}"
205+
# Add notifications on new line with separator
206+
full_status="${status_line}\n\n💡 ${notifications}"
120207
else
121208
full_status="${status_line}"
122209
fi

.claude/hooks/intelligent-status-notification.sh

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ detect_high_activity() {
121121

122122
activity_notification=$(detect_high_activity)
123123

124-
# === BUILD STATUS FOOTER (Minimal, Every Response) ===
124+
# === BUILD ENHANCED STATUS FOOTER ===
125125
build_status_footer() {
126126
local map_status="None"
127127
local map_age=""
@@ -133,19 +133,81 @@ build_status_footer() {
133133
local age_hours=$(( (current_time - file_time) / 3600 ))
134134

135135
if [ "$age_hours" -lt 4 ]; then
136-
map_status="Fresh"
137-
map_age="${age_hours}h"
136+
map_status="Fresh (${age_hours}h)"
138137
elif [ "$age_hours" -lt 24 ]; then
139-
map_status="OK"
140-
map_age="${age_hours}h"
138+
map_status="OK (${age_hours}h)"
141139
else
142-
map_status="Stale"
143-
map_age="${age_hours}h"
140+
map_status="Stale (${age_hours}h)"
144141
fi
145142
fi
146143

147-
# Build minimal footer: 🧠 Context: Active | Activity: 12 ops | Map: Fresh (2h)
148-
echo "🧠 Context: Active | Activity: ${activity_count} ops | Map: ${map_status}$([ -n "$map_age" ] && echo " (${map_age})" || echo "")"
144+
# Get session duration
145+
local session_duration="0m"
146+
local session_start_file="$CLAUDE_TMP/session-start-time"
147+
if [ -f "$session_start_file" ]; then
148+
local start_time=$(cat "$session_start_file" 2>/dev/null || echo "0")
149+
local current_time=$(date +%s)
150+
local duration_seconds=$((current_time - start_time))
151+
local duration_minutes=$((duration_seconds / 60))
152+
if [ "$duration_minutes" -lt 60 ]; then
153+
session_duration="${duration_minutes}m"
154+
else
155+
local duration_hours=$((duration_minutes / 60))
156+
local remaining_minutes=$((duration_minutes % 60))
157+
session_duration="${duration_hours}h ${remaining_minutes}m"
158+
fi
159+
fi
160+
161+
# Get current profile
162+
local profile="default"
163+
local profile_file="$CLAUDE_TMP/current-profile"
164+
if [ -f "$profile_file" ]; then
165+
profile=$(cat "$profile_file" 2>/dev/null || echo "default")
166+
fi
167+
168+
# Get current focus from activeContext.md
169+
local current_focus="Development"
170+
if [ -f "$MB/activeContext.md" ]; then
171+
local focus_line=$(grep -A 1 "^## 🎯 Current Focus" "$MB/activeContext.md" 2>/dev/null | tail -1 | sed 's/^[[:space:]]*//' || echo "")
172+
if [ -n "$focus_line" ] && [ "$focus_line" != "## 🎯 Current Focus" ]; then
173+
current_focus=$(echo "$focus_line" | cut -c 1-50)
174+
if [ ${#focus_line} -gt 50 ]; then
175+
current_focus="${current_focus}..."
176+
fi
177+
fi
178+
fi
179+
180+
# Get memory health
181+
local memory_health="Healthy"
182+
if [ -f "$MB/activeContext.md" ]; then
183+
local session_count=$(grep "^## 📊 Session Update" "$MB/activeContext.md" 2>/dev/null | wc -l)
184+
if [ "${session_count:-0}" -gt 15 ]; then
185+
memory_health="Needs Cleanup"
186+
elif [ "${session_count:-0}" -gt 10 ]; then
187+
memory_health="Monitor"
188+
fi
189+
fi
190+
191+
# Get last sync time
192+
local last_sync="Never"
193+
local last_sync_file="$CLAUDE_TMP/last-memory-sync"
194+
if [ -f "$last_sync_file" ]; then
195+
local last_sync_time=$(cat "$last_sync_file" 2>/dev/null || echo "0")
196+
local current_time=$(date +%s)
197+
local minutes_ago=$(( (current_time - last_sync_time) / 60 ))
198+
if [ "$minutes_ago" -lt 60 ]; then
199+
last_sync="${minutes_ago}m ago"
200+
else
201+
local hours_ago=$((minutes_ago / 60))
202+
last_sync="${hours_ago}h ago"
203+
fi
204+
fi
205+
206+
# Build enhanced footer
207+
echo "🧠 MINI-CODER-BRAIN STATUS"
208+
echo "📊 Activity: ${activity_count} ops | 🗺️ Map: ${map_status} | ⚡ Context: Active"
209+
echo "🎭 Profile: ${profile} | ⏱️ ${session_duration} | 🎯 Focus: ${current_focus}"
210+
echo "💾 Memory: ${memory_health} | 🔄 Last sync: ${last_sync}"
149211
}
150212

151213
status_footer=$(build_status_footer)

.claude/hooks/session-start.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ CLAUDE_TMP="$ROOT/.claude/tmp"
1212
session_id="sessionstart-$(date +%s)"
1313
context_flag="$CLAUDE_TMP/context-loaded.flag"
1414

15+
# Store session start time for duration tracking
16+
echo "$(date +%s)" > "$CLAUDE_TMP/session-start-time"
17+
1518
# === LIGHTWEIGHT CLEANUP (background) ===
1619
{
1720
find "$CLAUDE_TMP" -name "micro-context*.md" -type f -mmin +60 -delete 2>/dev/null || true
@@ -100,6 +103,9 @@ if [ -f "$ROOT/CLAUDE.md" ]; then
100103
fi
101104
fi
102105

106+
# Store current profile for status footer
107+
echo "$behavior_profile" > "$CLAUDE_TMP/current-profile"
108+
103109
# === OUTPUT SESSION STATUS ===
104110
# Extract project name and current focus
105111
project_name=$(grep -m1 "^# Product Context — " "$MB/productContext.md" 2>/dev/null | sed 's/^# Product Context — //' || \

CLAUDE.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,25 @@ On SESSION START (when session-start hook displays boot status), do the followin
7575

7676
3) Prefix EVERY response with: `[MINI-CODER-BRAIN: ACTIVE]`.
7777

78-
4) **Status Footer Display** (MANDATORY - NEVER SKIP):
79-
- The UserPromptSubmit hook injects a status line in `additionalContext`
78+
4) **Enhanced Status Footer** (MANDATORY - NEVER SKIP - v2.1):
79+
- The UserPromptSubmit hook injects an enhanced status footer in `additionalContext`
8080
- You MUST display this status footer at the END of EVERY response
8181
- **Always display it** - even for short responses, errors, or questions
82-
- Format the status footer cleanly:
82+
- Enhanced footer format (4 lines):
8383
```
8484
8585
🧠 MINI-CODER-BRAIN STATUS
8686
📊 Activity: X ops | 🗺️ Map: Status | ⚡ Context: Active
87+
🎭 Profile: default | ⏱️ 15m | 🎯 Focus: Current work description
88+
💾 Memory: Healthy | 🔄 Last sync: 10m ago | 🔧 Tools: Read(5) Edit(3)
8789
8890
💡 [Notifications if any - only show if notifications exist]
8991
9092
```
9193
- Clean, simple, no separator lines
94+
- Shows: Activity count, Map status, Profile, Session duration, Focus, Memory health, Last sync, Tool usage
9295
- Notifications section only shown when there are actual notifications
96+
- See: @.claude/docs/V2.1-STATUS-FOOTER.md for full details
9397

9498
> If `.claude/memory/` is missing: ask to create & initialize with default templates, then stop until done.
9599

0 commit comments

Comments
 (0)