openclaw - 💡(How to fix) Fix Feature Request: Context usage bar above chat input in Control UI [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#50071Fetched 2026-04-08 00:59:30
View on GitHub
Comments
2
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
commented ×2

Add a context window usage bar (progress bar) directly above the chat input field in the Control UI webchat.

Root Cause

Add a context window usage bar (progress bar) directly above the chat input field in the Control UI webchat.

RAW_BUFFERClick to expand / collapse

Feature Request

Description

Add a context window usage bar (progress bar) directly above the chat input field in the Control UI webchat.

Motivation

When chatting with OpenClaw through the Control UI, there's no visual indicator of how much of the context window has been consumed. Users currently need to type /status to check usage, which breaks the flow.

Proposed UX

  • A thin, subtle progress bar positioned just above the chat input textarea
  • Shows the percentage of context tokens used vs. the model's context window limit
  • Color-coded: green (< 50%), yellow (50-80%), red (> 80%)
  • Hover/click could show exact numbers (e.g. 42,000 / 200,000 tokens)
  • Updates in real-time as messages are sent/received

Reference

Similar to how Claude.ai and ChatGPT show context usage indicators in their interfaces.

Environment

  • OpenClaw version: 2026.3.2
  • Control UI (Lit + Vite SPA)
  • Channel: webchat

extent analysis

Fix Plan

To implement the context window usage bar, we will modify the Control UI webchat component.

Step-by-Step Solution

  • Add a new ContextWindowUsageBar component to display the progress bar.
  • Update the ChatInput component to include the ContextWindowUsageBar component above the input field.
  • Use the OpenClaw API to fetch the context window usage data and update the progress bar in real-time.

Example Code

// ContextWindowUsageBar.js
import { useState, useEffect } from 'react';

const ContextWindowUsageBar = () => {
  const [usage, setUsage] = useState(0);
  const [limit, setLimit] = useState(200000);

  useEffect(() => {
    const fetchUsage = async () => {
      const response = await fetch('/api/context-usage');
      const data = await response.json();
      setUsage(data.usage);
    };
    fetchUsage();
  }, []);

  const percentage = (usage / limit) * 100;
  const color = percentage < 50 ? 'green' : percentage < 80 ? 'yellow' : 'red';

  return (
    <div style={{ backgroundColor: color, height: 5, width: `${percentage}%` }}>
      <span style={{ fontSize: 12, color: 'black' }}>
        {usage} / {limit} tokens
      </span>
    </div>
  );
};

export default ContextWindowUsageBar;
// ChatInput.js
import React from 'react';
import ContextWindowUsageBar from './ContextWindowUsageBar';

const ChatInput = () => {
  return (
    <div>
      <ContextWindowUsageBar />
      <textarea placeholder="Type a message..." />
    </div>
  );
};

export default ChatInput;

Verification

To verify that the fix worked, check the Control UI webchat interface for the presence of the context window usage bar above the chat input field. The bar should update in real-time as messages are sent and received.

Extra Tips

  • Ensure that the OpenClaw API endpoint /api/context-usage is properly configured to return the context window usage data.
  • Adjust the styles and colors of the ContextWindowUsageBar component to match the existing UI design.
  • Consider adding a tooltip or hover effect to display the exact numbers when the user hovers over the progress bar.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feature Request: Context usage bar above chat input in Control UI [2 comments, 2 participants]