Agent skill

Knowledge Shell Process And Worktree

by echoVic in echoVic/blade-code

Covers Bash 前后台执行、stdin/终止、输出有界化、进程树与持久租约、Workspace 写沙箱,以及托管 Git worktree 的隔离和交付。

MITAuto-check passedDevelopment

Install Knowledge Shell Process And Worktree

skills CLI
$ npx skills add echoVic/blade-code --skill knowledge-shell-process-and-worktree -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install echoVic/blade-code knowledge-shell-process-and-worktree --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/echoVic/blade-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.trae/knowledges/tool-and-automation-platform/shell-process-and-worktree .claude/skills/knowledge-shell-process-and-worktree && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
knowledge-shell-process-and-worktree
GitHub stars
180
Token cost
~1.7k tokens
SKILL.md length
361 words
Files
1
Skills in repo
38
Repo updated
First seen
Licence
MIT

At a glance

Covers Bash 前后台执行、stdin/终止、输出有界化、进程树与持久租约、Workspace 写沙箱,以及托管 Git worktree 的隔离和交付。

  • Tasks that involve Git worktrees
  • SKILL.md covers Module Structure, Gotchas, Architecture and Decisions, plus 2 more sections
  • Calls git

What it does

Knowledge Shell Process And Worktree is an agent skill from echoVic/blade-code. Covers Bash 前后台执行、stdin/终止、输出有界化、进程树与持久租约、Workspace 写沙箱,以及托管 Git worktree 的隔离和交付。 Navigate when: 排查命令超时/取消/残留进程、后台 Shell、输出截断、ACP terminal、审计沙箱、worktree 创建/恢复/应用/清理。 Excludes: 通用工具权限和 scheduler(见 ../tool-execution-pipeline/)、文件补丁事务(见 ../filesystem-search-and-atomic-patching/)。 Keywords: Bash, WriteStdin, KillShell, BackgroundShellManager, DurableProcessLeaseStore, OwnedProcessTree, WorkspaceWriteSandbox, WorktreeManager, foreground handoff.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Git worktrees. It works with Bash and Git. The repository describes itself as: AI-powered CLI coding agent with 20+ built-in tools, MCP support, and multi-model providers. The licence is MIT.

When your agent uses it

  • Tasks that involve Git worktrees

Example prompts

  • “Use the knowledge-shell-process-and-worktree skill to cover Bash 前后台执行、stdin/终止、输出有界化、进程树与持久租约、Workspace 写沙箱,以及托管 Git worktree 的隔离和交付”
  • “/knowledge-shell-process-and-worktree”

What it can do on your machine

Read from SKILL.md and the folder at commit 30f8684. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Knowledge Shell Process And Worktree loads about 1.7k tokens when it runs. Until then it costs about 120 tokens; SKILL.md has 361 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~120
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from echoVic/blade-code at commit 30f8684, republished under its MIT licence (© echoVic). 361 words, ~1,688 tokens.

Download SKILL.mdSave it as .claude/skills/knowledge-shell-process-and-worktree/SKILL.md (or your agent's skills folder).
name
knowledge-shell-process-and-worktree
description
Covers Bash 前后台执行、stdin/终止、输出有界化、进程树与持久租约、Workspace 写沙箱,以及托管 Git worktree 的隔离和交付。 Navigate when: 排查命令超时/取消/残留进程、后台 Shell、输出截断、ACP terminal、审计沙箱、worktree 创建/恢复/应用/清理。 Excludes: 通用工具权限和 scheduler(见 ../tool-execution-pipeline/)、文件补丁事务(见 ../filesystem-search-and-atomic-patching/)。 Keywords: Bash, WriteStdin, KillShell, BackgroundShellManager, DurableProcessLeaseStore, OwnedProcessTree, WorkspaceWriteSandbox, WorktreeManager, foreground handoff.

Module Structure

该节点连接命令执行与 workspace 隔离。Bash 可走本地、ACP 或沙箱路径,并把长前台 命令原进程移交为后台任务;worktree 管理器则将 Session 映射到独立 Git 工作目录并 在交付前验证源工作区没有漂移。

Directory Layout
  • packages/cli/src/tools/builtin/shell/ — Bash、后台管理、stdin、终止与输出捕获
  • packages/cli/src/context/storage/DurableForegroundProcess.ts — 前台命令租约与 handoff
  • packages/cli/src/context/storage/DurableProcessLeaseStore.ts — 可恢复的进程身份租约
  • packages/cli/src/utils/process/ — 启动闸门、进程组拥有权和跨平台终止
  • packages/cli/src/utils/shell/ — 命令归一化、只读审计和验证命令识别
  • packages/cli/src/worktree/WorktreeManager.ts — worktree 生命周期、diff 制品和变更交付
  • packages/cli/src/tools/builtin/worktree/worktreeTools.ts — Agent 可调用的进入/退出适配器
Key Entry Points
  • bashTool in packages/cli/src/tools/builtin/shell/bash.ts — 本地、ACP、后台与自动 handoff 分流
  • BackgroundShellManager in packages/cli/src/tools/builtin/shell/BackgroundShellManager.ts — Session-owned Shell 生命周期
  • prepareForegroundProcess() in packages/cli/src/context/storage/DurableForegroundProcess.ts — 先持久登记再释放命令启动闸门
  • WorktreeManager.enter() / apply() / exit() in packages/cli/src/worktree/WorktreeManager.ts — 隔离、交付和离开工作树

Gotchas

  • Bash 明确是 isRetrySafe=false;即使抛出 EBUSY/EAGAIN 也不能自动重放,因为命令可能已经产生外部副作用 (packages/cli/src/tools/builtin/shell/bash.ts, packages/cli/tests/unit/tooling/tools/builtin/bash.test.ts)
  • Bash 的 isConcurrencySafe=false 但显式 parallelism='shared':独立命令可同批进入,仍受 execute bucket 限流;由于没有 file_path,通用 FileLockManager 不会替 Shell 串行工作区写入 (packages/cli/src/tools/builtin/shell/bash.ts, packages/cli/src/tools/execution/ToolExecutor.ts)
  • ACP terminal 执行设置 allowLocalFallback=false;远端终端失败必须原样失败,不能在宿主机悄悄重跑同一命令 (packages/cli/src/tools/builtin/shell/bash.ts, git:27f9df37)
  • WriteStdin 会产生外部可见输入且默认不可重放,最多接受 64 KiB;ACP 后台终端当前不支持 stdin 写入 (packages/cli/src/tools/builtin/shell/writeStdin.ts, packages/cli/tests/unit/tooling/tools/builtin/write-stdin.test.ts)
  • 前台自动转后台复用原进程,不重启命令;只有存在 Session、超时大于 handoff budget、非只读审计代理且首个命令不是 sleep 时才有资格 (packages/cli/src/tools/builtin/shell/ForegroundCommandHandoff.ts, packages/cli/src/tools/builtin/shell/bash.ts)
  • foreground → background 租约提交失败时,前台 owner 仍保持权威并继续等待;不能同时把两个 lease 当作有效所有者 (packages/cli/src/context/storage/DurableForegroundProcess.ts, packages/cli/src/tools/builtin/shell/bash.ts)
  • 后台 Shell ID 绑定 Session;TaskOutput、WriteStdin、KillShell 用其他 Session ID 查询时都按不存在处理,不能跨会话接管 (packages/cli/src/tools/builtin/shell/BackgroundShellManager.ts, packages/cli/src/tools/builtin/task/taskOutput.ts)
  • 本地前后台输出各流只保留最后 1 MiB,随后还会按命令类型二次投影;stdout_total_bytes/omitted_bytes 才能区分“命令没输出”和“早期输出已丢弃” (packages/cli/src/tools/builtin/shell/BoundedOutputBuffer.ts, packages/cli/src/tools/builtin/shell/ShellOutputProjection.ts)
  • worktree 从 committed HEAD 创建,原工作区未提交改动不会复制;返回的 sourceHadChanges 是警告,不代表新 worktree 包含这些内容 (packages/cli/src/worktree/WorktreeManager.ts, packages/cli/src/tools/builtin/worktree/worktreeTools.ts)
  • worktree 交付要求源仓库 HEAD 和创建时工作状态指纹都未变化;只检查 patch 可应用而忽略源状态会覆盖任务期间的用户改动 (packages/cli/src/worktree/WorktreeManager.ts)
  • ExitWorktree(action='remove') 在无法验证状态或存在未提交文件/未合并 commit 时拒绝,只有用户明确允许 discard_changes=true 才强制删除 (packages/cli/src/worktree/WorktreeManager.ts, packages/cli/src/tools/builtin/worktree/worktreeTools.ts)
  • stale worktree GC 只删除符合托管命名、足够旧、Git 身份一致且无脏文件/未推送 commit 的目录;异常目录和活跃 Session 均保留 (packages/cli/src/worktree/WorktreeManager.ts)

Architecture

  • 命令启动经过独立 Node admission gate:目标子进程仅在 lease 持久化后收到启动字节,owner 消失时 gate 负责终止进程组,关闭了“进程已启动但尚未登记”的崩溃窗口 (packages/cli/src/utils/process/CommandAdmissionGate.ts, packages/cli/src/context/storage/DurableForegroundProcess.ts)
  • DurableProcessLeaseStore 同时记录 owner 与 root PID 的平台指纹;恢复时先识别活 owner,再验证 PID 未复用,POSIX leader 已退出但进程组仍活跃时单独清理 leaderless group (packages/cli/src/context/storage/DurableProcessLeaseStore.ts, packages/cli/src/utils/process/ProcessIdentity.ts)
  • BackgroundShellManager 统一管理本地后台、自动 handoff 和 ACP 外部前台候选,默认最多 16 个全局活动进程、每 Session 4 个 (packages/cli/src/tools/builtin/shell/BackgroundShellManager.ts)
  • worktree manager 以 Session keyed mutex 串行生命周期操作,目录位于按仓库路径哈希隔离的 managed root,分支名同时包含逻辑名称和 Session 哈希 (packages/cli/src/worktree/WorktreeManager.ts)
  • 任务交付使用临时 Git index 收集 tracked/untracked 变更,生成 binary patch,先 git apply --check 再应用到源工作区,不通过 merge 或复制目录 (packages/cli/src/worktree/WorktreeManager.ts)
Show full SKILL.md (127 more words)Show less

Decisions

  • managed worktree 同时服务显式 Enter/Exit 工具和子代理任务隔离;工具层只负责用户交互,实际恢复、差异和交付语义集中在 WorktreeManager (packages/cli/src/tools/builtin/worktree/worktreeTools.ts, packages/cli/src/agent/subagents/SubagentWorktreeLifecycle.ts, git:c80db2c1)
  • 后台与前台命令都升级为持久 lease 和 owned process tree,以便 Session 恢复时回收 orphan,而不是只依赖当前 Node 子进程句柄 (packages/cli/src/context/storage/DurableProcessLeaseStore.ts, git:c012135e, git:cbe0e8ed)
  • 输出限制分为 capture 上限和模型/UI projection 上限,既限制常驻内存又保留完整计数事实,避免单纯截断字符串后无法判断损失量 (packages/cli/src/tools/builtin/shell/ShellOutputCapture.ts, packages/cli/src/tools/builtin/shell/OutputTruncator.ts, git:81a9acc9)

Patterns

  • 本地 POSIX 子进程作为 detached group leader 启动,终止先发 SIGTERM 再在 grace period 后发 SIGKILL;Windows 使用 taskkill /T 并保留直接 child fallback (packages/cli/src/utils/process/OwnedProcessTree.ts)
  • workspace-required 或只读审计 Bash 会先生成沙箱命令;cwd 在 lexical 与 realpath 两层都必须位于 workspace,沙箱启动失败按 permission denied fail closed (packages/cli/src/tools/builtin/shell/WorkspaceWriteSandbox.ts, packages/cli/src/tools/builtin/shell/bash.ts)
  • 只读审计沙箱不继承任意进程环境、禁止网络和 workspace 写入,只允许专用临时目录写入及受信任 PATH 中的运行时;普通 worktree 沙箱允许 workspace 写入 (packages/cli/src/tools/builtin/shell/WorkspaceWriteSandbox.ts)
  • SessionRuntime 启动时先回收 foreground/background orphan,关闭时主动 kill 本 Session 后台进程并释放 worktree 内存绑定 (packages/cli/src/agent/runtime/SessionRuntime.ts)

Resource Bounds

  • 后台与前台 capture 分别为 stdout/stderr 各 1 MiB,并最多保留 32 个 chunk;超大 chunk 从 UTF-8 边界保留尾部 (packages/cli/src/tools/builtin/shell/BoundedOutputBuffer.ts)
  • worktree diff 最多 100 个文件、单文件 1 MiB、总计 2 MiB;真正交付的 binary patch 上限为 50 MiB,展示截断不改变交付内容 (packages/cli/src/worktree/WorktreeManager.ts)
  • 后台容量耗尽返回 RESOURCE_EXHAUSTED/background_shell_busy 且可稍后重试,不会排队等待并额外占用内存 (packages/cli/src/tools/builtin/shell/BackgroundShellManager.ts, packages/cli/src/tools/builtin/shell/bash.ts)

© echoVic, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .trae/knowledges/tool-and-automation-platform/shell-process-and-worktree of echoVic/blade-code.

Open the folder on GitHubat commit 30f8684

Compare with similar skills

Knowledge Shell Process And Worktree next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Knowledge Shell Process And Worktree compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Knowledge Shell Process And Worktree this skillechoVic/blade-code180—~1.7kAutomated safety check: PassMIT
Cursor Composer Task DelegateChachamaru127/claude-code-harness3.2k—~4.4kAutomated safety check: NotesMIT
Worktree Cleanupvchelaru/FlatRedBall578—~810Automated safety check: PassMIT
Git Worktree IsolationjnMetaCode/superpowers-zh8.3k1 repos~982Automated safety check: PassMIT
WorktreeAgentsMesh/AgentsMesh2.4k—~553Automated safety check: NotesCustom licence
Git Worktree Setupk8zdev/k8z155—~930Automated safety check: PassNone

Similar skills

  • Cursor Composer Task Delegate

    Chachamaru127/claude-code-harness

    Hands one implementation task to Cursor Composer in an isolated git worktree, then reviews its diff and cherry-picks the result into the main branch.

    3.2k GitHub stars~4.4k tokensUpdated 2 days ago
    DevelopmentAuto-check: notes
  • Worktree Cleanup

    vchelaru/FlatRedBall

    Remove a subagent's .claude/worktrees/agent-<id dir after its PR merges.

    578 GitHub stars~810 tokensUpdated 5 days ago
    DevelopmentAuto-check passed
  • Git Worktree Isolation

    jnMetaCode/superpowers-zh

    Sets up an isolated workspace before feature work or plan execution, preferring native worktree tools and falling back to git worktree, with instructions in Chinese.

    8.3k GitHub starsUsed in 1 repo~982 tokens
    DevelopmentAuto-check passed
  • Worktree

    AgentsMesh/AgentsMesh

    Creates or reuses an isolated AgentsMesh Git worktree from a verified base branch, preserves existing changes, and optionally starts the worktree-scoped development environment.

    2.4k GitHub stars~553 tokensUpdated 14 days ago
    DevelopmentAuto-check: notes
  • Automate git worktree creation and copy private files (not tracked in git) to new workdirs.

    155 GitHub stars~930 tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • New Feature

    michaelshimeles/skills

    Start a new task in an isolated Git worktree branched from origin/main so multiple agents can work on the same repo in parallel without conflicts.

    1.3k GitHub starsUsed in 1 repo~699 tokens
    DevelopmentAuto-check passed

More from echoVic/blade-code

All 38 skills in this repo
  • Base64 Parser

    echoVic/blade-code

    Base64 编解码工具,支持编码/解码文本、JSON、二进制文件,自动检测格式,支持批量处理. An agent skill from echoVic/blade-code.

    180 GitHub stars~545 tokensUpdated 10 days ago
    Auto-check: notes
  • Code Review

    echoVic/blade-code

    Review frontend code for best practices, bugs, and improvements.

    180 GitHub stars~377 tokensUpdated 10 days ago
    Auto-check: notes
  • GitHub Explorer

    echoVic/blade-code

    Explore and summarize popular GitHub projects. An agent skill from echoVic/blade-code.

    180 GitHub stars~434 tokensUpdated 10 days ago
    Auto-check passed
  • 覆盖 Session 级 LSP 配置快照、stdio 进程、文档同步、语义查询、诊断回注、崩溃恢复 和子 Session 继承。进入条件:新增语言服务器、修改 LSP 工具、排查诊断缺失/重复、 处理 worktree 或 ACP 差异、修复进程泄漏或 transport 代际问题。不包含:VS Code 扩展桥接(见…

    180 GitHub stars~1.9k tokensUpdated 10 days ago
    Auto-check passed
  • 覆盖 SkillRegistry、SKILL.md 延迟加载、自定义命令 Markdown 解析、来源覆盖、插件 命名空间、Session 快照和模型/用户调用入口。进入条件:新增 Skill 或命令字段、调整 发现优先级、调试 /command 或 Skill 工具、修改 Prompt 元数据或消费者集成。不包含: 插件安装生命周期(见…

    180 GitHub stars~2.1k tokensUpdated 10 days ago
    Auto-check passed
  • Covers 领域能力如何包装成内置工具、getBuiltinTools 的 Session 依赖注入、ToolSearch 延迟激活,以及 Goal/Task/Team/Plan/Skill/LSP/MCP/Web/Config/Worktree 适配边界。

    180 GitHub stars~2.1k tokensUpdated 10 days ago
    Auto-check passed

Works with

Questions about Knowledge Shell Process And Worktree

What does Knowledge Shell Process And Worktree do?

Covers Bash 前后台执行、stdin/终止、输出有界化、进程树与持久租约、Workspace 写沙箱,以及托管 Git worktree 的隔离和交付。. Knowledge Shell Process And Worktree is an agent skill from echoVic/blade-code./filesystem-search-and-atomic-patching/)。 Keywords: Bash, WriteStdin, KillShell, BackgroundShellManager, DurableProcessLeaseStore, OwnedProcessTree, WorkspaceWriteSandbox, WorktreeManager, foreground handoff.

When should I use Knowledge Shell Process And Worktree?

Knowledge Shell Process And Worktree fits situations like: tasks that involve Git worktrees.

How do I install Knowledge Shell Process And Worktree in Claude Code?

Run `npx skills add echoVic/blade-code --skill knowledge-shell-process-and-worktree -a claude-code`. Or copy the skill folder (.trae/knowledges/tool-and-automation-platform/shell-process-and-worktree in echoVic/blade-code) into .claude/skills/knowledge-shell-process-and-worktree in your project. Claude Code loads it when a task matches its description.

How do I install Knowledge Shell Process And Worktree in Codex?

Run `npx skills add echoVic/blade-code --skill knowledge-shell-process-and-worktree -a codex`. Or copy the skill folder (.trae/knowledges/tool-and-automation-platform/shell-process-and-worktree in echoVic/blade-code) into .agents/skills/knowledge-shell-process-and-worktree in your project. Codex loads it when a task matches its description.

Can I use Knowledge Shell Process And Worktree in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add echoVic/blade-code --skill knowledge-shell-process-and-worktree -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/knowledge-shell-process-and-worktree, .gemini/skills/knowledge-shell-process-and-worktree, .github/skills/knowledge-shell-process-and-worktree and .opencode/skills/knowledge-shell-process-and-worktree in your project.

What does Knowledge Shell Process And Worktree need to run?

Going by SKILL.md and its folder, Knowledge Shell Process And Worktree needs the command-line tools its instructions call (git).

Does Knowledge Shell Process And Worktree access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Knowledge Shell Process And Worktree safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Knowledge Shell Process And Worktree use?

Knowledge Shell Process And Worktree is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Knowledge Shell Process And Worktree use?

About 1.7k tokens (SKILL.md is roughly 6.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Knowledge Shell Process And Worktree?

Skills that share tags, products or a category with Knowledge Shell Process And Worktree: Cursor Composer Task Delegate (Chachamaru127/claude-code-harness, 3.2k stars), Worktree Cleanup (vchelaru/FlatRedBall, 578 stars), Git Worktree Isolation (jnMetaCode/superpowers-zh, 8.3k stars) and Worktree (AgentsMesh/AgentsMesh, 2.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Knowledge Shell Process And Worktree?

echoVic (a GitHub user) maintains it in echoVic/blade-code, which has 180 GitHub stars. The repository holds 38 skills in this directory. The repository was last updated on September 27, 2026.

Source: echoVic/blade-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.