Borrowing it
Nothing to install: this file belongs to kargnas/vscode-ext-tmux-worktree. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/kargnas/vscode-ext-tmux-worktree/main/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/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<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="Reviewed on agentmods" width="80" 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.04158 | $0.04158 |
| Opus 5.5 | $0.01663 | $0.01663 |
| Sonnet 5.5 | $0.00832 | $0.00832 |
| Haiku 4.5 | $0.00416 | $0.00416 |
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 — 133 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 Changed · +19 tokens per session 6156178a06cc
- 6d ago Changed · +1 lines · +118 tokens per session d67846d9dc1a
- 1mo 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 (40 stars, last pushed 6d ago), licensed MIT. It adds 4,158 tokens to every session, about $0.0166 per session on Opus 5.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
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
vscode model-prompts.instructions.md
Model-specific prompt authoring and registry guidelines.