SpecPilot: Command for Claude Code

.claude/commands/specpilot-archive.md

specpilot-archive is a command for Claude Code from girishr/SpecPilot. It costs 21 tokens per session (1,291 once invoked), scanned A, original, MIT.

A command for screening stocks with EODHD using financial, market, and technical filters, including exchange-specific currency handling.

In plain words
What is it for?
Use it to invoke an EODHD stock screen with criteria such as market value, P/E, dividend yield, sector, exchange, or trading signals.
Why use it?
It helps avoid malformed screening requests and misleading money thresholds when listings report values in their local currencies.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

This is girishr/SpecPilot's own configuration. It tells Claude Code how to work on SpecPilot 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 SpecPilot configures →

Reuse

Borrowing it

Nothing to install: this file belongs to girishr/SpecPilot. 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/girishr/SpecPilot/main/.claude/commands/specpilot-archive.md
Clone the repo
git clone --depth 1 https://github.com/girishr/SpecPilot

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 specpilot-archive

README.md
[![agentmods](https://agentmods.dev/badge/commands/girishr/specpilot/specpilot-archive.svg)](https://agentmods.dev/commands/girishr/specpilot/specpilot-archive)
Your own site
<a href="https://agentmods.dev/commands/girishr/specpilot/specpilot-archive"><img src="https://agentmods.dev/badge/commands/girishr/specpilot/specpilot-archive.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 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,291 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.00021 $0.01291
Opus 5 $0.00010 $0.00646
Sonnet 5 $0.00004 $0.00258
Haiku 4.5 $0.00002 $0.00129

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

Security

Grade A, and why

specpilot-archive 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 8d 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.

.claude/commands/specpilot-archive.md · 104 lines

How it starts

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

Archive oversized .specs/ files: .specs/planning/tasks.md's ## Completed section beyond 25 lines, and .specs/development/prompts.md beyond 100 total lines.

Run the script below — it computes thresholds and moves lines deterministically. Do not hand-count lines or decide what to move yourself; the script's arithmetic is the source of truth.

cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"

PROMPTS_LINE_LIMIT=100
PROMPTS_KEEP_LINES=80
COMPLETED_LINE_LIMIT=25
COMPLETED_KEEP_ENTRIES=20

branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
if [ -n "$branch" ] && [ "$branch" != "main" ] && [ "$branch" != "master" ]; then
  echo "WARNING: on branch '$branch'. Archive is recommended only on the default branch after merging."
  read -p "Continue? [y/N] " confirm
  if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
    echo "Archive cancelled."
    exit 0
  fi
fi

timestamp() { date -u +"%Y-%m-%d %H:%M:%S"; }

archive_prompts() {
  local file=".specs/development/prompts.md"
  local archive=".specs/development/prompts-archive.md"
  [ -f "$file" ] || return 0
  local total
  total=$(wc -l < "$file")
  if [ "$total" -le "$PROMPTS_LINE_LIMIT" ]; then return 0; fi

  # Anchor on "## Latest Entries" so boilerplate (Re-Anchor Prompt, etc.) is never
  # mistaken for archivable log content; fall back to front-matter close, then line 0.
  local anchor_line
  anchor_line=$(grep -n '^## Latest Entries' "$file" | head -1 | cut -d: -f1)
  if [ -z "$anchor_line" ]; then
    if [ "$(sed -n '1p' "$file")" = "---" ]; then
      anchor_line=$(awk 'NR>1 && $0=="---" {print NR; exit}' "$file")
    else
      anchor_line=0
    fi
  fi
  local body_start=$((anchor_line + 1))
  local body_lines=$((total - anchor_line))
  local keep=$((PROMPTS_KEEP_LINES - anchor_line))
  if [ "$keep" -lt 50 ]; then keep=50; fi
  if [ "$body_lines" -le "$keep" ]; then return 0; fi

  local archive_count=$((body_lines - keep))
  local archive_end=$((body_start + archive_count - 1))

  { echo "## Archived on $(timestamp)"; echo; sed -n "${body_start},${archive_end}p" "$file"; echo; echo "---"; echo; } >> "$archive"
  { sed -n "1,${anchor_line}p" "$file"; sed -n "$((archive_end + 1)),\$p" "$file"; } > "$file.tmp"
  mv "$file.tmp" "$file"
  echo "Moved $archive_count lines from $file -> $archive"
}

archive_tasks() {
  local file=".specs/planning/tasks.md"
  local archive=".specs/planning/tasks-archive.md"
  [ -f "$file" ] || return 0
  local total
  total=$(wc -l < "$file")
  local completed_line
  completed_line=$(grep -n '^## Completed$' "$file" | head -1 | cut -d: -f1)
  [ -n "$completed_line" ] || return 0

  local section_size=$((total - completed_line + 1))
  if [ "$section_size" -le "$COMPLETED_LINE_LIMIT" ]; then return 0; fi

  local entry_start=$((completed_line + 1))
  while [ "$entry_start" -le "$total" ] && ! sed -n "${entry_start}p" "$file" | grep -qE '^[0-9]+\.'; do
    entry_start=$((entry_start + 1))
  done
  if [ "$entry_start" -gt "$total" ]; then return 0; fi

  local entry_count=$((total - entry_start + 1))
  if [ "$entry_count" -le "$COMPLETED_KEEP_ENTRIES" ]; then return 0; fi

  local archive_count=$((entry_count - COMPLETED_KEEP_ENTRIES))
  local archive_end=$((entry_start + archive_count - 1))

  { echo "## Archived on $(timestamp)"; echo; sed -n "${entry_start},${archive_end}p" "$file"; echo; echo "---"; echo; } >> "$archive"
  { sed -n "1,$((entry_start - 1))p" "$file"; sed -n "$((archive_end + 1)),\$p" "$file"; } > "$file.tmp"
  mv "$file.tmp" "$file"
  echo "Moved $archive_count entries from $file -> $archive"
}

archive_prompts
archive_tasks

After running it:

  1. Report what the script moved (file, line/entry count, archive destination) using its own output — do not recompute or second-guess the numbers.
  2. If nothing exceeded the threshold, say so plainly: "Nothing to archive."
  3. IDs are preserved automatically since content is moved verbatim into the archive file, never rewritten or renumbered.

This mirrors CLI specpilot archive --dry-run --force (REQ-002.A.8); the branch guard mirrors ARCH-004.19 (warns and requires y confirmation when not on main/master).

Read the full file on GitHub · 104 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. 8d ago First seen · 104 lines · 21 tokens per session scan A 3f3e121a9da5

Subscribe to this mod's changes

specpilot-archive is a command published in the GitHub repository girishr/SpecPilot (37 stars, last pushed 1mo ago), licensed MIT. It adds 21 tokens to every session and 1,291 once invoked, about $0.0001 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.