dagster: Command for Claude Code

.claude/commands/erk/diag-lock-error.md

diag-lock-error is a command for Claude Code from dagster-io/dagster. It costs 11 tokens per session (1,665 once invoked), scanned D, original, Apache-2.0.

A diagnostic command for Git errors caused by a leftover index.lock file, which Git uses to prevent two operations from changing a repository at once. It collects information from the current context and uploads a report as a GitHub gist.

In plain words
What is it for?
Use it after a Git index.lock error, including errors in linked worktrees. It can also collect system information proactively when no current lock error is found.
Why use it?
It helps investigate why Git is blocked when an index.lock file already exists. The report gathers the error details and system information in one place for analysis.

Command for Claude Code

Written for Claude Code: ${CLAUDE_SESSION_ID} variable. Also seen: reads .claude/ paths; mentions Claude Code.

This is dagster-io/dagster's own configuration. It tells Claude Code how to work on dagster itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything dagster configures →

About the project

Dagster is a platform for developing, running, and observing data assets, such as datasets and the processes that produce them. It is used to organize and automate data workflows.

dagster-io/dagster · 16,122 stars · on GitHub · dagster.io

Reuse

Borrowing it

Nothing to install: this file belongs to dagster-io/dagster. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/dagster-io/dagster/master/.claude/commands/erk/diag-lock-error.md
Clone the repo
git clone --depth 1 https://github.com/dagster-io/dagster

Made for: Claude Code.

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 diag-lock-error

README.md
[![agentmods](https://agentmods.dev/badge/commands/dagster-io/dagster/diag-lock-error/github.svg)](https://agentmods.dev/commands/dagster-io/dagster/diag-lock-error)
Your own site
<a href="https://agentmods.dev/commands/dagster-io/dagster/diag-lock-error"><img src="https://agentmods.dev/badge/commands/dagster-io/dagster/diag-lock-error/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.

agentmods 80×15 button for diag-lock-error

Your own site · 80×15
<a href="https://agentmods.dev/commands/dagster-io/dagster/diag-lock-error"><img src="https://agentmods.dev/badge/commands/dagster-io/dagster/diag-lock-error.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,665 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00011 $0.01665
Opus 5 $0.00005 $0.00833
Sonnet 5 $0.00002 $0.00333
Haiku 4.5 $0.00001 $0.00167

Measured 9d ago against content hash 88b2b9620179, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade D, and why

diag-lock-error scanned grade D with 2 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 9d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

SESSION_FILE=$(find ~/.claude/projects -name "${CLAUDE_SESSION_ID}.jsonl" 2>/dev/null | head -1)

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf "$DIAG_DIR"
.claude/commands/erk/diag-lock-error.md · 218 lines

How it starts

The opening of the file, as written. The whole thing — 218 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Diagnostic Report: Git Lock Error

When a git operation fails with fatal: Unable to create '.../.git/index.lock': File exists, this command collects diagnostic information and uploads it as a GitHub gist for analysis.

Usage

Run this command when you encounter a git index.lock error:

/erk:diag-lock-error

Implementation

Step 1: Identify the Lock Error in Context

Search the current conversation context for the git index.lock error. Look for:

  • Tool results containing fatal: Unable to create and index.lock
  • The specific repository path where the error occurred (extract the full lock file path)
  • The command that triggered the error

Extract the lock file path from the error message. Examples:

  • Regular repo: .git/index.lock
  • Worktree: /path/to/.git/worktrees/<name>/index.lock

Save this path for Step 2c.

If no lock error is found in the recent context, ask the user: "No git index.lock error found. Run diagnostic anyway to capture system state?" If yes, proceed with data collection (error context will note "proactive collection - no current error").

Step 2: Collect Diagnostic Data

Create a temporary directory and collect all diagnostic files:

DIAG_DIR=$(mktemp -d)
echo "Collecting diagnostics in $DIAG_DIR"
2a. Error Context

Write the error details from the conversation to a file. Include:

  • The exact command that failed (e.g., erk exec quick-submit, git add -A)
  • The full error message including the lock file path
  • Timestamp if visible
  • Whether the lock was removed and how (manual rm, or still present)
cat > "$DIAG_DIR/01-error-context.txt" << 'EOF'
# Error Context

Command: <command that triggered the error>
Time: <timestamp if known>
Repository: <working directory path>
Lock file path: <full path from error message>

Error output:
<full error message>

Resolution: <how it was resolved, or "still investigating">
EOF
2b. Git Status
git status > "$DIAG_DIR/02-git-status.txt" 2>&1

Read the full file on GitHub · 218 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. 9d ago First seen · 218 lines · 11 tokens per session scan D 88b2b9620179

Subscribe to this mod's changes

diag-lock-error is a command published in the GitHub repository dagster-io/dagster (16,122 stars, last pushed 3d ago), licensed Apache-2.0. It adds 11 tokens to every session and 1,665 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it D with 2 findings (reads agent configuration directories, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other commands, from other repositories

context

A project-context command that manages a .context directory containing decision notes, session logs, and history. It helps keep a record of why changes were made across Git branches and commits.

fengshao1227/ccg-workflow · 23 tokens

doctor

Diagnosticar y reparar problemas del framework Don Cheli, git y entorno. Usa cuando el usuario dice "doctor", "problemas del framework", "don cheli no funciona", "repair Don Cheli", "debug setup", "setup broken", "framework broken", "reparar entorno". Detecta y repara issues de configuración, git y dependencias…

doncheli/don-cheli-sdd · 76 tokens

analyze-git

Perform a comprehensive analysis of the git repository to identify branches and worktrees that can be cleaned up. This is a READ-ONLY analysis - no deletions will be performed.

bengous/claude-code-plugins · 0 tokens

hotfix

Ship a fast branch-based P0 hotfix — diagnose, implement, open a ready-for-review PR, then verify + review after (deferred by design).

lugassawan/swe-workbench · 32 tokens

Diagnose

Run a 20-point health check across the plugin install, project config, PM/notification reachability, docs freshness, board consistency, and git state. Read-only — never changes state. Reports each check as PASS/WARN/FAIL/SKIP with an actionable fix. Target under 15 seconds end-to-end. Use before demos, after a plugin…

Evyasys-Software-Solutions/EvyaGovernance · 81 tokens

checkout

Smart branch creation and switching with conventional naming.

GoogilyBoogily/googilyboogily-claude-power-tools · 8 tokens