Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/kargnas/vscode-ext-tmux-worktree/agents-mdgit clone --depth 1 https://github.com/kargnas/vscode-ext-tmux-worktreeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/kargnas/vscode-ext-tmux-worktree/agents-md)<a href="https://agentmods.dev/instructions/kargnas/vscode-ext-tmux-worktree/agents-md"><img src="https://agentmods.dev/badge/instructions/kargnas/vscode-ext-tmux-worktree/agents-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.04021 | $0.04021 |
| Opus 5 | $0.02011 | $0.02011 |
| Sonnet 5 | $0.00804 | $0.00804 |
| Haiku 4.5 | $0.00402 | $0.00402 |
Grade A, and why
vscode-ext-tmux-worktree AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AI Agent Guidelines
This document serves as the primary rule file for AI Agents working on this project. ALWAYS update this file when you discover new patterns or finish significant tasks.
Instruction
- After every task and changes, install the compiled extension to
code,code-insiders,antigravity. DO NOT INCREASE version. (It will be automatically increased when publish, and we don't want to increase it for testing)
Tested VS Code
code(VS Code)antigravity(Google Antigraity)cursor(Cursor)
1. Codebase Understanding
Project Structure
.
├── src/ # VS Code Extension Source (TypeScript)
│ ├── extension.ts # Extension Entry Point
│ ├── commands/ # Command Implementations
│ ├── providers/ # Tree Data Providers (Sidebar)
│ └── utils/ # Utilities (tmux, git, execution)
├── cli/ # CLI Tool Source (Go)
│ ├── main.go # CLI Entry Point
│ ├── internal/ui/ # TUI Implementation (Bubble Tea)
│ └── pkg/ # Shared Packages
├── out/ # Compiled Extension Output
├── .vscode/ # Editor Configuration
└── resources/ # Icons and Assets
Key Components
- VS Code Extension: Manages the "TMUX Worktrees" view in the Activity Bar. It interacts with the
tmuxCLI andgit worktreecommands. - CLI (
twt): A terminal user interface (TUI) for managing sessions/worktrees outside of VS Code, built with Bubble Tea.
2. Coding Patterns & Best Practices
- Polymorphism: Commands must handle
TmuxItembase class and variants (TmuxSessionItem,InactiveWorktreeItem, etc.). - Path Handling: Use
getWorktreePath(item)helper. - Canonical Path Matching: For path equality/deduplication/current-workspace checks, normalize to absolute paths with
~expansion before comparison (do not collapse symlink aliases viarealpath). - Managed Worktree Location: Create extension-managed worktrees under
~/.tmux-worktrees/<repo-name-hash>/by default. Reuse shared helpers for path checks and orphan cleanup instead of hardcoding repo-local.worktreespath fragments. - Session Namespace: Build tmux session prefixes from primary-worktree identity (basename + short path hash), not the current VS Code workspace folder or display repo name alone, to avoid collisions and linked-worktree drift. Use the shared async identity helpers instead of calling
getRepoRoot()directly for namespace or managed-dir names. - Zellij Leading-Dash Session Names: Repo basenames such as
.hermescan produce session names beginning with-. When passing those names to Zellij as positional arguments, insert--; shell quoting alone does not stop Zellij from parsing them as CLI flags. - Legacy Session Compatibility Isolation: Keep legacy session-prefix compatibility logic centralized in
src/utils/sessionCompatibility.ts; call helpers from commands/providers instead of duplicating fallback checks. - Root Detection: Determine the primary worktree by comparing worktree path to the primary worktree path derived from
git rev-parse --git-common-dir, not by branch naming, folder basename, or the current workspace folder. - Current Workspace Indicator: Highlight the active VS Code workspace by comparing worktree/session paths against the current workspace folder (not the primary worktree path). Current items should sort to the top and display a
👆marker in the label. - External Worktrees: If the worktree folder name matches the repo name, derive a unique slug/label from the parent directory.
- Slug Collision Handling: Worktree session slugs must be unique by sanitized tmux name. Start with basename-based slug, then disambiguate with parent directory, and finally append a short path hash when collisions remain.
- Free-Form Task Branches:
TMUX: New Taskaccepts arbitrary valid git branch names, including/. Sanitize/to-for tmux/worktree slugs, and never infer main-vs-task state from atask/prefix. - Unpublished Task Branches: When creating a new task branch, do not preconfigure
branch.<name>.remote/branch.<name>.mergebefore the first push. VS Code SCM treats that as an upstream and may try to sync against a remote branch that does not exist yet. Store onlybranch.<name>.vscode-merge-basewith the chosen base branch so SCM diffs stay anchored while Publish Branch remains available. - Primary Worktree Slug Follows Its Current Branch: The primary worktree's slug is its current branch name (e.g.
master,develop), falling back tomainonly when no branch can be resolved (detached HEAD / empty repo). Reserve that slug during slug collision resolution so no non-primary worktree or task branch can reuse the primary session name. The default branch for base-branch detection (getBaseBranch) is likewise the primary worktree's current branch (checked before origin/HEAD symref). - Tree Context Menu: Use a single TreeItem
contextValue(tmuxItem) for levels 2/3/4 so the same context menu always appears. - Error Handling: Use
try-catchin TS and checkerr != nilin Go. Fail gracefully and notify the user. - Async/Await: Use
async/awaitfor all I/O operations in TypeScript. - Terminal Creation: Use
/bin/sh -c 'exec tmux attach ...'instead ofshellPath: 'tmux'. DirectshellPath: 'tmux'causes VS Code to treat it as a non-standard shell, breaking mouse drag events (pane resize). Theexecreplaces sh with tmux (no extra process), and-cavoids sendText race conditions with other extensions. - Zellij Keybindings: Manage Zellij passthrough shortcuts from
scripts/generate-zellij-keybindings.mjs; do not hand-edit the generatedworkbench.action.terminal.sendSequenceentries inpackage.json. Add new passthroughs to the script'sZELLIJ_KEY_PASSTHROUGHSlist, prefer VS Code scan-code key strings for layout independence, then runnpm run generate:zellij-keybindings. Keep all generated entries scoped toterminalFocus && config.tmuxWorktree.multiplexer == 'zellij'. Apply VS Code terminal setting overrides fromsrc/utils/zellijTerminalSettings.tsonly while the Zellij backend is active, then restore extension-applied global values when switching away. - Zellij Control-Key Passthroughs: Use literal control/escape sequences in
ZELLIJ_KEY_PASSTHROUGHSso VS Code forwards the intended byte to the terminal. Prefer scan-code key strings for control and Alt shortcuts so Korean IME/layout variants map to the intended physical key without duplicate Hangul-specific bindings. - No-Git Workspace Labeling: If the workspace is not a git worktree, the tree must still show one primary item labeled
current project (no git)mapped to the current workspace path. - Package Hygiene: Keep local orchestration/runtime state such as
.omx/out of VSIX packages via.vscodeignore; git excludes alone do not affect packaging. - Marketplace Publishing:
publish.ymlowns version bump, VSIX packaging, VS Code Marketplace publishing, and GitHub releases. Open VSX publishing lives inpublish-open-vsx.ymland consumes the uploaded VSIX artifact from the successful marketplace workflow so both registries receive the same package. Theworkflow_runjob has no checkout, sogh run downloadmust pass--repo "$GITHUB_REPOSITORY"; without it gh tries to infer the repo from a local clone and dies with "not a git repository".
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 132 lines · 4,021 tokens per session scan A 8ba71a2c7e7f
vscode-ext-tmux-worktree AGENTS.md is an instructions file published in the GitHub repository kargnas/vscode-ext-tmux-worktree (39 stars, last pushed 4d ago), licensed MIT. It adds 4,021 tokens to every session, about $0.0201 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
agent-of-empires AGENTS.md
AGENTS.md instructions for agent-of-empires/agent-of-empires, covering repository guidelines, where to look, commands, code rules and tests.
CommandMate CLAUDE.md
Claude Code instructions for Kewton/CommandMate, covering claude.md, ⚠️ 重要: モジュール詳細を claude.md に書かないこと, プロジェクト概要, 基本情報 and 技術スタック.
CommandMate AGENTS.md
AGENTS.md instructions for Kewton/CommandMate, covering agents.md, scope, project context, working principles and coding rules.
crow CLAUDE.md
Claude Code instructions for corveil/crow, covering crow — manager context, naming this manager session, architecture decision records, crow cli reference and session commands.
agent-of-empires CLAUDE.md
Claude Code instructions for agent-of-empires/agent-of-empires, a project described as: Manage multiple Claude Code, OpenCode agents from either TUI or Web for easy access on mobile. Also supports Mistral Vibe, Codex CLI, Gemini CLI, Pi.dev, Copilot CLI, Factory Droid Coding.
AgentDock AGENTS.md
Instructions for ACCSCI/AgentDock, covering agents, 架构现状, 单实例架构(0.1.x 当前状态), dev 模式 userdata 隔离 and 测试隔离流水线.