vscode-ext-tmux-worktree AGENTS.md

vscode-ext-tmux-worktree AGENTS.md is an instructions file for Codex, OpenCode from kargnas/vscode-ext-tmux-worktree. It costs 4,021 tokens per session, scanned A, original, MIT.

Instructions for a VS Code extension and command-line tool that help developers manage AI-agent sessions with tmux and Git worktrees. A worktree is a separate working folder connected to the same Git repository.

In plain words
What is it for?
Developing and testing the VS Code extension, its Go command-line tool, tmux utilities, Git worktree features, and installations for VS Code, VS Code Insiders, and Antigravity.
Why use it?
Running several agents at once can require manual terminal, folder, and Git management. These instructions document the project layout, supported editors, and required testing workflow.

Instructions file for CodexOpenCode

Install

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.

agentmods
npx agentmods add instructions/kargnas/vscode-ext-tmux-worktree/agents-md
Clone the repo
git clone --depth 1 https://github.com/kargnas/vscode-ext-tmux-worktree

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for vscode-ext-tmux-worktree AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/kargnas/vscode-ext-tmux-worktree/agents-md.svg)](https://agentmods.dev/instructions/kargnas/vscode-ext-tmux-worktree/agents-md)
Your own site
<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>
Per session 4,021 This file is loaded in full into every session.
When invoked 4,021 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 5d ago against content hash 8ba71a2c7e7f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

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.

AGENTS.md · 132 lines

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 tmux CLI and git worktree commands.
  • 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 TmuxItem base 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 via realpath).
  • 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 .worktrees path 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 .hermes can 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 Task accepts arbitrary valid git branch names, including /. Sanitize / to - for tmux/worktree slugs, and never infer main-vs-task state from a task/ prefix.
  • Unpublished Task Branches: When creating a new task branch, do not preconfigure branch.<name>.remote / branch.<name>.merge before 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 only branch.<name>.vscode-merge-base with 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 to main only 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-catch in TS and check err != nil in Go. Fail gracefully and notify the user.
  • Async/Await: Use async/await for all I/O operations in TypeScript.
  • Terminal Creation: Use /bin/sh -c 'exec tmux attach ...' instead of shellPath: 'tmux'. Direct shellPath: 'tmux' causes VS Code to treat it as a non-standard shell, breaking mouse drag events (pane resize). The exec replaces sh with tmux (no extra process), and -c avoids sendText race conditions with other extensions.
  • Zellij Keybindings: Manage Zellij passthrough shortcuts from scripts/generate-zellij-keybindings.mjs; do not hand-edit the generated workbench.action.terminal.sendSequence entries in package.json. Add new passthroughs to the script's ZELLIJ_KEY_PASSTHROUGHS list, prefer VS Code scan-code key strings for layout independence, then run npm run generate:zellij-keybindings. Keep all generated entries scoped to terminalFocus && config.tmuxWorktree.multiplexer == 'zellij'. Apply VS Code terminal setting overrides from src/utils/zellijTerminalSettings.ts only 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_PASSTHROUGHS so 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.yml owns version bump, VSIX packaging, VS Code Marketplace publishing, and GitHub releases. Open VSX publishing lives in publish-open-vsx.yml and consumes the uploaded VSIX artifact from the successful marketplace workflow so both registries receive the same package. The workflow_run job has no checkout, so gh run download must pass --repo "$GITHUB_REPOSITORY"; without it gh tries to infer the repo from a local clone and dies with "not a git repository".

Read the full file on GitHub · 132 lines

Changes

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.

  1. 5d ago First seen · 132 lines · 4,021 tokens per session scan A 8ba71a2c7e7f

Subscribe to this mod's changes

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.

Related

Other instructions, from other repositories