Datalad untrack

From nipreps/skills-comm · View interactive version

Datalad untrack is an AI agent skill from the GitHub repository nipreps/skills-comm. Auto-invoke inside a DataLad dataset (.datalad/ present) when the user wants to free disk space by dropping annexed content, remove a file from the dataset entirely, stop tracking a file, or unlock an annexed file for in-place editing. Trigger on "drop file content", "free disk space", "untrack file

How to use this skill

Skill file

Skill: datalad-untrack

Remove annexed content from local storage or remove a file from the dataset entirely.

These are two distinct operations with very different consequences. Load

${CLAUDE_PLUGIN_ROOT}/../references/annex-content-states.md to reason about annex state

before choosing the operation.

Steps

  1. Check if the user wants to edit (not drop/remove) — if the user wants to edit an

annexed file in place, use datalad unlock rather than drop or remove. Editing a

locked annex file without unlocking first corrupts the annex pointer. See the

Unlocking section below for the full workflow.

  1. Verify DataLad context — check for .datalad/ in the current directory or any

parent:

```bash

ls .datalad/ 2>/dev/null || git rev-parse --show-toplevel

```

  1. Identify the target files — read paths from $ARGUMENTS or conversation context.

If no paths are specified, ask the user to name the files before continuing.

  1. Check annex state for each target — run:

```bash

git annex whereis <path>

datalad status <path>

```

Report:

  1. Present the two-path choice — show the user a clear decision:

> Option A — Drop content (datalad drop):

> Frees local disk space. The file pointer stays in the dataset. Content can be

> restored later with datalad get IF a remote copy exists.

>

> Option B — Full remove (datalad remove + datalad save):

> Deletes the file pointer from the dataset history. Irreversible locally.

> The file will no longer appear in datalad status or git ls-files.

Ask the user which they want before proceeding.

  1. Warn about remote availability (Option A only) — if git annex whereis shows

the only copy is here (local), warn:

> "Warning: no remote copy of this content exists. Dropping will make the content

> unrecoverable unless you have a backup. Use --nocheck only if you accept

> permanent data loss. Proceed?"

Wait for explicit confirmation before continuing.

  1. Execute the chosen workflow:

Option A — Drop:

```bash

datalad drop <path>

```

Confirm with datalad status <path> that content is now absent (pointer remains).

Option B — Full remove:

```bash

datalad remove <path>

datalad save -m "remove <path>"

```

Confirm with datalad status that the file no longer appears.

  1. Report outcome — summarize what was done:

Unlocking annexed files for in-place editing (`datalad unlock`)

When the user wants to edit an annexed file in place (not drop or remove it):

  1. Explain what unlock does — annexed files are write-protected symlinks. `datalad

unlock` replaces the symlink with the actual file content, making it writable. After

editing, datalad save re-annexes the file.

  1. Check annex state — verify the file has content locally (otherwise unlock will

fail because there's nothing to materialize):

```bash

git annex whereis <path>

```

If content is absent, run datalad get <path> first.

  1. Unlock the file:

```bash

datalad unlock <path>

```

Or unlock multiple files: datalad unlock <path1> <path2> or datalad unlock .

to unlock everything in the current directory.

  1. Inform the user that the file is now writable. After they finish editing, remind

them to re-annex with:

```bash

datalad save -m "edit <path>"

```

This re-locks the file and records the change in history.

Constraints

Always use datalad drop or datalad remove.

is not recorded in history until saved.

which operation to use without asking.

file cannot be unlocked until datalad get retrieves the content.

are not re-annexed until saved.

what content states mean or when the user asks about annex concepts.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.