AI/agent terminal sessions pollute PSReadLine history
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start by locating PSReadLine initialization and the AddToHistoryHandler/history persistence path, including the text and SQLite modes mentioned in the issue. Confirm that PSREADLINE_HISTORY_SAVE=0 selects MemoryOnly before history writes, preserves current-session recall, and avoids persistent saves regardless of profile loading.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When AI agents (e.g., GitHub Copilot, VS Code terminal agents) execute commands in PowerShell terminals, those commands are saved to PSReadLine history indistinguishably from user-typed commands. This pollutes history recall with commands the user never typed, inflates frequency counts, and degrades the usefulness of history recall.
Problem
AI coding assistants routinely run commands like Get-ChildItem, dotnet build, git status, etc. in integrated terminals. These get recorded to PSReadLine history (both text file and SQLite modes) as if the user typed them. Over time this means:
- History recall is noisy — Up arrow surfaces agent commands the user didn't type
- Frequency-based ranking is skewed — location-aware recall ranks agent-repeated commands higher than user favorites
HistoryNoDuplicatesdoesn't help — the commands are real commands, just not user-initiated
Current Workaround
Users can add this to their $PROFILE:
# Requires the agent to set this env var before launching pwsh
if ($env:PSREADLINE_HISTORY_SAVE -eq '0') {
Set-PSReadLineOption -AddToHistoryHandler { [Microsoft.PowerShell.AddToHistoryOption]::MemoryOnly }
}
But this is fragile because:
- The agent must set the env var — requires cooperation from VS Code / Copilot
- Agents that use
pwsh -NoProfilebypass the check entirely - Users must manually add the snippet
Proposal
Add a built-in environment variable check in PSReadLine's initialization, so that agent-spawned terminals can opt out of persistent history without requiring profile configuration:
// During PSReadLine init, before any history writes
if (Environment.GetEnvironmentVariable("PSREADLINE_HISTORY_SAVE") == "0")
{
Options.AddToHistoryHandler = _ => AddToHistoryOption.MemoryOnly;
}
This way:
- Any agent framework just sets
PSREADLINE_HISTORY_SAVE=0as a process environment variable before launching pwsh - Works regardless of
-NoProfile - No user configuration needed
- Commands still available in the current session's memory (Up arrow works), just not persisted to disk
Environment
- VS Code with GitHub Copilot agent terminals
- Ngôn ngữ chính
- C#
- Star
- 4.4k
- Fork
- 341
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PowerShell/PSReadLine
-
Needs-Triage :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PowerShell/PSReadLine#5205 ·
-
Needs-Triage :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PowerShell/PSReadLine#5121 ·
-
Needs-Triage :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
PowerShell/PSReadLine#5045 ·
-
Area-CommandHelp Issue-Enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
PowerShell/PSReadLine#3470 · 3 reaction ·
Tất cả issue của PowerShell/PSReadLine
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
azurenoops/spin_agent#975 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SubtitleEdit/subtitleedit#15108 · 1 bình luận ·