gsd:thread

gsd:thread is a command for Claude Code from mrboups/xbrain. It costs 13 tokens per session (1,873 once invoked), scanned A, a copy of gsd:thread, MIT.

A context-thread command for listing, resuming, checking, and closing persistent work threads across sessions.

In plain words
What is it for?
Use it to track open and resolved work threads and return to an existing line of work.
Why use it?
It keeps ongoing work visible when a coding task continues later or across multiple conversations.

Command for Claude Code

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 commands/mrboups/xbrain/thread
Clone the repo
git clone --depth 1 https://github.com/mrboups/xbrain

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 gsd:thread

README.md
[![agentmods](https://agentmods.dev/badge/commands/mrboups/xbrain/thread.svg)](https://agentmods.dev/commands/mrboups/xbrain/thread)
Your own site
<a href="https://agentmods.dev/commands/mrboups/xbrain/thread"><img src="https://agentmods.dev/badge/commands/mrboups/xbrain/thread.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 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,873 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 98% copy Near-identical to another mod 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 $0.00013 $0.01873
Opus 5 $0.00006 $0.00937
Sonnet 5 $0.00003 $0.00375
Haiku 4.5 $0.00001 $0.00187

Measured yesterday against content hash 43f2c6758075, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gsd:thread 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 yesterday.

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.

Origin

This is a copy

98% identical to gsd:thread — 20 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/commands/gsd/thread.md · 228 lines

How it starts

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

Parse $ARGUMENTS to determine mode:

  • "list" or "" (empty) → LIST mode (show all, default)
  • "list --open" → LIST-OPEN mode (filter to open/in_progress only)
  • "list --resolved" → LIST-RESOLVED mode (resolved only)
  • "close <slug>" → CLOSE mode; extract SLUG = remainder after "close " (sanitize)
  • "status <slug>" → STATUS mode; extract SLUG = remainder after "status " (sanitize)
  • matches existing filename (.planning/threads/{arg}.md exists) → RESUME mode (existing behavior)
  • anything else (new description) → CREATE mode (existing behavior)

Slug sanitization (for close and status): Strip any characters not matching [a-z0-9-]. Reject slugs longer than 60 chars or containing .. or /. If invalid, output "Invalid thread slug." and stop.

<mode_list> LIST / LIST-OPEN / LIST-RESOLVED mode:

ls .planning/threads/*.md 2>/dev/null

For each thread file found:

  • Read frontmatter status field via:
    gsd-sdk query frontmatter.get .planning/threads/{file} status
    
  • If frontmatter status field is missing, fall back to reading markdown heading ## Status: OPEN (or IN PROGRESS / RESOLVED) from the file body
  • Read frontmatter updated field for the last-updated date
  • Read frontmatter title field (or fall back to first # Thread: heading) for the title

SECURITY: File names read from filesystem. Before constructing any file path, sanitize the filename: strip non-printable characters, ANSI escape sequences, and path separators. Never pass raw filenames to shell commands via string interpolation.

Apply filter for LIST-OPEN (show only status=open or status=in_progress) or LIST-RESOLVED (show only status=resolved).

Display:

Context Threads
─────────────────────────────────────────────────────────
slug                      status        updated      title
auth-decision             open          2026-04-09   OAuth vs Session tokens
db-schema-v2              in_progress   2026-04-07   Connection pool sizing
frontend-build-tools      resolved      2026-04-01   Vite vs webpack
─────────────────────────────────────────────────────────
3 threads (2 open/in_progress, 1 resolved)

If no threads exist (or none match the filter):

No threads found. Create one with: /gsd-thread <description>

STOP after displaying. Do NOT proceed to further steps. </mode_list>

<mode_close> CLOSE mode:

When SUBCMD=close and SLUG is set (already sanitized):

  1. Verify .planning/threads/{SLUG}.md exists. If not, print No thread found with slug: {SLUG} and stop.

  2. Update the thread file's frontmatter status field to resolved and updated to today's ISO date:

    gsd-sdk query frontmatter.set .planning/threads/{SLUG}.md status resolved
    gsd-sdk query frontmatter.set .planning/threads/{SLUG}.md updated YYYY-MM-DD
    
  3. Commit:

    gsd-sdk query commit "docs: resolve thread — {SLUG}" --files ".planning/threads/{SLUG}.md"
    
  4. Print:

    Thread resolved: {SLUG}
    File: .planning/threads/{SLUG}.md
    

STOP after committing. Do NOT proceed to further steps. </mode_close>

<mode_status> STATUS mode:

When SUBCMD=status and SLUG is set (already sanitized):

  1. Verify .planning/threads/{SLUG}.md exists. If not, print No thread found with slug: {SLUG} and stop.

  2. Read the file and display a summary:

    Thread: {SLUG}
    ─────────────────────────────────────
    Title:   {title from frontmatter or # heading}
    Status:  {status from frontmatter or ## Status heading}
    Updated: {updated from frontmatter}
    Created: {created from frontmatter}
    
    Goal:
    {content of ## Goal section}
    
    Next Steps:
    {content of ## Next Steps section}
    ─────────────────────────────────────
    Resume with: /gsd-thread {SLUG}
    Close with:  /gsd-thread close {SLUG}
    

Read the full file on GitHub · 228 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. yesterday First seen · 228 lines · 13 tokens per session scan A 43f2c6758075

Subscribe to this mod's changes

gsd:thread is a command published in the GitHub repository mrboups/xbrain (2 stars, last pushed 20d ago), licensed MIT. It adds 13 tokens to every session and 1,873 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 98% identical to gsd:thread, differing in 20 lines, and is treated as a copy.