Skip to content

Fix /clear-chat to restore the welcome banner#26

Merged
Payel-git-ol merged 3 commits into
Payel-git-ol:masterfrom
konard:issue-25-5cb73df41791
May 30, 2026
Merged

Fix /clear-chat to restore the welcome banner#26
Payel-git-ol merged 3 commits into
Payel-git-ol:masterfrom
konard:issue-25-5cb73df41791

Conversation

@konard

@konard konard commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #25.

The /clear-chat command cleared the transcript by resetting the history to an empty array (setHistory([])). That dropped the startup banner and the "getting started" tips panel, leaving an awkward, near-empty screen with only the input prompt (the "after" state shown in the issue).

Root cause

In src/cli/App.tsx, the /clear-chat handler did:

} else if (name === 'clear-chat') {
  setHistory([]);
  chatService.current.reset();
}

The initial transcript always starts with a banner item. Resetting to [] removed it.

Fix

Reset the transcript to a single fresh banner item — identical to a freshly-launched session — so the post-clear screen shows the wordmark, the version line, and the tips panel, matching the desired result in the issue.

} else if (name === 'clear-chat') {
  setHistory([
    { id: nextId.current++, kind: 'banner', version, driver: app.driver, model: app.config.model },
  ]);
  chatService.current.reset();
}

Reproduction & verification

  • How to reproduce: launch the CLI, run any command (e.g. /help), then run /clear-chat. Before the fix the screen went blank except for the prompt; after the fix the welcome banner + tips return.
  • Automated test: tests/cli.test.tsx"restores the banner and getting-started tips after /clear-chat" runs /help to produce output, then /clear-chat, and asserts the tips panel returns while the prior Commands: output is gone. The test fails against the old setHistory([]) code and passes with the fix.
  • experiments/clear-chat-frame.tsx renders the before/after terminal frames for manual inspection.

Rendered result after /clear-chat (matches the issue's "ideal" screenshot)

████████╗██████╗  █████╗ ██████╗ ███████╗███████╗  ██╗   ███████╗████████╗
╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔════╝ ████╗  ██╔════╝╚══██╔══╝
   ██║   ██████╔╝███████║██║  ██║█████╗  █████╗  ██╔██╗  ███████╗   ██║
   ██║   ██╔══██╗██╔══██║██║  ██║██╔══╝  ██╔══╝  ██╝╚██╗ ╚════██║   ██║
   ██║   ██║  ██║██║  ██║██████╔╝███████╗██║     ██╗ ╚██╗███████║   ██║
   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚══════╝╚═╝     ╚═╝  ╚═╝╚══════╝   ╚═╝

Tradefast v0.4.1 · disciplined trading analytics · db: pglite · ai: claude-4.7-opus · api: ...

╭────────────────────────────────────────────────────────────────────────╮
│ Tips for getting started:                                                │
│ 1. /start runs a full analysis (clears prior run data, keeps the ...).   │
│ 2. /update re-analyses and writes only what changed.                     │
│ 3. /clear prunes outdated runs; the general search table is preserved.   │
│ 4. /help lists every command; /strategies lists the strategies.          │
╰────────────────────────────────────────────────────────────────────────╯

> type a command, e.g. /start  (/help for all)

Changes

  • src/cli/App.tsx — reset /clear-chat to a fresh banner item (+ version added to the run callback deps).
  • tests/cli.test.tsx — regression test.
  • README.md — clarify the /clear-chat description.
  • package.json / package-lock.json — bump version to 0.4.1.
  • experiments/clear-chat-frame.tsx — before/after frame renderer.

All 103 tests pass; typecheck and build are green.

konard added 3 commits May 29, 2026 16:30
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: Payel-git-ol#25
… screen

The /clear-chat handler reset the transcript to an empty array, dropping
the startup banner and the getting-started tips panel and leaving an
awkward, near-empty view (Payel-git-ol#25). Reset to a fresh banner item instead so
the post-clear screen matches a freshly-launched session.

- Add a regression test that runs /clear-chat after producing output and
  asserts the banner/tips return while prior output is gone.
- Update README description and bump version to 0.4.1.
@konard konard changed the title [WIP] fix clear chat Fix /clear-chat to restore the welcome banner May 29, 2026
@konard konard marked this pull request as ready for review May 29, 2026 16:36
@konard

konard commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

CI passes (build-and-test: pass). The work is complete.

Summary

I fixed issue #25: the /clear-chat command was clearing the screen awkwardly, leaving only a bare input prompt.

Root cause — In src/cli/App.tsx, the /clear-chat handler did setHistory([]), which dropped the startup banner and the "getting started" tips panel that the transcript always begins with.

Fix — Reset the transcript to a single fresh banner item, so the post-clear screen looks exactly like a freshly-launched session (wordmark + version line + tips panel) — matching the "ideal" screenshot in the issue.

Changes:

  • src/cli/App.tsx/clear-chat now restores the banner instead of blanking the screen (and version added to the run callback deps).
  • tests/cli.test.tsx — regression test that runs /help to populate output, then /clear-chat, asserting the tips panel returns while prior output is gone. Verified it fails on the old code and passes on the fix.
  • README.md — clarified the /clear-chat description.
  • package.json / package-lock.json — version bumped to 0.4.1.
  • experiments/clear-chat-frame.tsx — before/after frame renderer used to visually confirm the result.
  • Removed the auto-generated .gitkeep placeholder.

Verification — All 103 tests pass locally; typecheck and build are green; CI on the PR passed (build-and-test: pass). The PR is updated and marked ready for review.

PR: #26


This summary was automatically extracted from the AI working session output.

@konard

konard commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $2.634369

📊 Context and tokens usage:

  • 93.1K / 1M (9%) input tokens, 18.5K / 128K (14%) output tokens

Total: (3.2K new + 78.8K cache writes + 3.3M cache reads) input tokens, 18.5K output tokens, $2.634369 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.8 (claude-opus-4-8)

📎 Log file uploaded as Gist (1706KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@Payel-git-ol Payel-git-ol merged commit 6e02394 into Payel-git-ol:master May 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix clear chat

2 participants