Skip to content

feat: display current directory in terminal title#1519

Closed
Br1an67 wants to merge 1 commit into
MoonshotAI:mainfrom
Br1an67:feat/terminal-title-cwd
Closed

feat: display current directory in terminal title#1519
Br1an67 wants to merge 1 commit into
MoonshotAI:mainfrom
Br1an67:feat/terminal-title-cwd

Conversation

@Br1an67

@Br1an67 Br1an67 commented Mar 20, 2026

Copy link
Copy Markdown

Related Issue

Resolve #1475

Description

Since v1.15.0 (#1254), the terminal window/tab title is set to a static "Kimi Code" string. This makes it difficult to distinguish between multiple kimi sessions in different projects when working with multiple terminal tabs or windows.

Changes:

  • Updated proctitle.py to include the current working directory in the terminal title
  • Format: Kimi Code — ~/path/to/project (home directory abbreviated with ~)
  • Added update_terminal_title_with_cwd() function that can be called when the cwd changes
  • Hooked into the session lifecycle in app.py so the title updates when entering/leaving a session's working directory

Before: Terminal title shows Kimi Code (cannot tell which project)
After: Terminal title shows Kimi Code — ~/projects/myrepo (each tab identifiable)

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

Include the current working directory in the terminal window/tab title
so users can identify which project each kimi session belongs to when
working with multiple terminal windows or tabs.

Format: 'Kimi Code — ~/path/to/project'

The title updates both at startup and when entering/leaving a session's
working directory, keeping it always in sync.

Closes MoonshotAI#1475

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fea964c474

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/kimi_cli/app.py

original_cwd = KaosPath.cwd()
await kaos.chdir(self._runtime.session.work_dir)
update_terminal_title_with_cwd(str(self._runtime.session.work_dir))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Send cwd title updates through the original TTY stderr

In the normal kimi startup path we call redirect_stderr_to_logger() before entering _env() (src/kimi_cli/cli/__init__.py:546-548), and StderrRedirector.install() replaces fd 2 with a pipe (src/kimi_cli/utils/logging.py:38-45). Because set_terminal_title() bails out when sys.stderr.isatty() is false, the new _env() updates are a no-op for shell/print/ACP/wire runs, so the terminal tab keeps the startup title instead of the session directory this feature is meant to show.

Useful? React with 👍 / 👎.

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.

Feature Request: Option to display current directory in prompt or window title (regression from v1.15.0)

2 participants