Token导航 LogoToken导航TokenDH.com
Auto Kill Terminal logo
开发工具未说明官方级别未说明来源级核验

Auto Kill Terminal

MCP Server

自动终止AI代理在Codespaces中遗留的僵尸终端,提升开发效率。

工具数

0

提示词数

0

GitHub Stars

18

资源数

0
开发工具ShellClaudeClaudeCursorVS Code

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

nirholas

提供方

nirholas

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

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

💀 Stop AI agents from leaving zombie terminals in your Codespace

问题 · 修复 · 快速开始 · 设置 · 原理 · 常见问题解答

______________________________________________________________________

问题

AI编码代理(GitHub Copilot、Claude Code、Gemini、Cursor等)每次运行命令时都会生成终端会话。 他们几乎从不清理自己。

在GitHub Codespace中,这是灾难性的:

症状原因
🧟 幽灵终端前台终端被重用——过时的会话会持续存在,并默默地阻止新的会话
👻 无形的积累代码空间中的背景端子未显示在UI面板中
🔄 无限次重试特工们会重复同样的死会话,而不是杀死它并重新开始
🆔 丢失终端ID没有 isBackground: true,不返回终端ID——无法清理

结果: 您的代码空间充满了孤立的终端→ 命令超时→ 代理人感到困惑→ 你在重试时浪费了令牌。

修复

将终端管理规则添加到代理指令文件中。这些 五个要点 你需要的都是:

## Terminal Management

- **Always use background terminals** (`isBackground: true`) for every command so a terminal ID is returned
- **Always kill the terminal** after the command completes, whether it succeeds or fails — never leave terminals open
- Do not reuse foreground shell sessions — stale sessions block future terminal operations in Codespaces
- In GitHub Codespaces, agent-spawned terminals may be hidden — they still work. Do not assume a terminal is broken if you cannot see it
- If a terminal appears unresponsive, kill it and create a new one rather than retrying in the same terminal
就这样 将这5行复制到您使用的任何代理指令文件中。

快速开始

# Option 1: Clone and copy what you need
git clone https://github.com/nirholas/auto-kill-terminal.git
cp auto-kill-terminal/.github/copilot-instructions.md your-project/.github/

# Option 2: Just copy the 5 bullet points from "The Fix" into your existing instruction file

由代理设置

🤖 GitHub Copilot — copilot-instructions.md

## Terminal Management
- **Always use background terminals** (`isBackground: true`) for every command so a terminal ID is returned
- **Always kill the terminal** after the command completes, whether it succeeds or fails — never leave terminals open
- Do not reuse foreground shell sessions — stale sessions block future terminal operations in Codespaces
- In GitHub Codespaces, agent-spawned terminals may be hidden — they still work. Do not assume a terminal is broken if you cannot see it
- If a terminal appears unresponsive, kill it and create a new one rather than retrying in the same terminal

🧠 Claude Code — CLAUDE.md

### Terminal Management
- **Always use background terminals** (`isBackground: true`) for every command so a terminal ID is returned
- **Always kill the terminal** after the command completes, whether it succeeds or fails — never leave terminals open
- Do not reuse foreground shell sessions — stale sessions block future terminal operations in Codespaces
- In GitHub Codespaces, agent-spawned terminals may be hidden — they still work. Do not assume a terminal is broken if you cannot see it
- If a terminal appears unresponsive, kill it and create a new one rather than retrying in the same terminal

💎 Gemini — GEMINI.md

### Terminal Management
- **Always use background terminals** (`isBackground: true`) for every command so a terminal ID is returned
- **Always kill the terminal** after the command completes, whether it succeeds or fails — never leave terminals open
- Do not reuse foreground shell sessions — stale sessions block future terminal operations in Codespaces
- In GitHub Codespaces, agent-spawned terminals may be hidden — they still work. Do not assume a terminal is broken if you cannot see it
- If a terminal appears unresponsive, kill it and create a new one rather than retrying in the same terminal

🔮 Cursor / AGENTS.md — Multi-agent projects

### Terminal Management
- **Always use background terminals** (`isBackground: true`) for every command so a terminal ID is returned
- **Always kill the terminal** after the command completes, whether it succeeds or fails — never leave terminals open
- Do not reuse foreground shell sessions — stale sessions block future terminal operations in Codespaces
- In GitHub Codespaces, agent-spawned terminals may be hidden — they still work. Do not assume a terminal is broken if you cannot see it
- If a terminal appears unresponsive, kill it and create a new one rather than retrying in the same terminal

⚡ One-liners — For inline prompt space

短:

**Terminal rules:** Always use `isBackground: true` for every terminal command, then kill the terminal after.

两条线:

**Terminal management**: Always use background terminals (`isBackground: true`). Always kill terminals after use.

为什么是后台终端?

方法返回终端ID吗?可以被杀死吗?挡壳?
isBackground: false
isBackground: true✅ (kill_terminal)

后台终端返回代理可以传递的ID kill_terminal (或 await_terminalkill_terminal).没有那个身份证,就没有办法清理。

  Agent                                Terminal
    |                                      |
    |-- run_in_terminal -----------------> | (isBackground: true)
    |    | (wait for completion)
    |    | x_x
    |                                      X
    |
    |-- (clean slate for next command)

支持的环境

环境状态
GitHub代码空间
VS代码(本地)
VS代码(远程SSH)
VS代码(WSL)
任何VS代码终端API消费者

Supported Agents

代理指令文件状态
GitHub副本copilot-instructions.md
克劳德代码CLAUDE.md
双子座GEMINI.md
光标AGENTS.md / .cursorrules
风帆冲浪AGENTS.md
助手.aider.conf.yml
任何使用VS Code终端的代理任何指令文件

常见问题解答

Do I need to install anything?

不是的。这只是复制粘贴文本,将其放入您的代理指令文件中。没有包,没有扩展,没有配置。

Does this work outside Codespaces?

对。终端管理规则适用于使用VS Code的终端API的任何地方。它们在代码空间中最为关键,因为鬼终端在那里是不可见的,但它们在任何地方都有帮助。

What if my agent doesn't support instruction files?

您可以直接在提示中包含规则。使用上面“一个衬垫”部分中的一个衬垫。

Will this break my agent's workflow?

否。带背景的终端 isBackground: true 其行为与前台终端相同,只是它们不会阻塞shell,并且会返回一个ID进行清理。代理的命令仍然正常执行。

贡献

欢迎投稿!如果您发现了其他代理或环境的终端管理技巧,请打开PR。

  1. 分叉回购
  2. 创建您的分支: git checkout -b feat/my-improvement
  3. 承诺: git commit -m "✨ feat: add support for X agent"
  4. 推: git push origin feat/my-improvement
  5. 打开拉取请求

许可证

MIT© nirholas

______________________________________________________________________

Stop wasting tokens on zombie terminals.

Made with 💀 for the AI agent community

⭐ Found this useful? Star the repo! ⭐

It helps others discover this project and keeps development active

目录标签

目录标签

开发工具ShellClaude本地部署终端管理AI工具开发效率Codespaces

支持客户端

ClaudeCursorVS Code

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP