init

A project setup command that creates or refreshes SpecSwarm guide files describing a project's rules, technologies, quality standards, references, and coding conventions.

In plain words
What is it for?
Use it when starting a project or sprint, or when checking whether existing project documentation has drifted from the current code and tooling.
Why use it?
It keeps written project guidance aligned with the codebase and preserves developer additions and backups when guidance changes.

Command

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/martybonacci/specswarm/init
Clone the repo
git clone --depth 1 https://github.com/MartyBonacci/specswarm
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 27,587 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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 $0.00012 $0.27587
Opus 5 $0.00006 $0.13794
Sonnet 5 $0.00002 $0.05517
Haiku 4.5 $0.00001 $0.02759

Measured 2d ago against content hash 7e36a7591f5f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

init scanned grade B with 1 finding 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 2d 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 MCP configurationmediumAgent snooping

mcp.json carries server URLs and auth tokens; reading it lets a mod discover and abuse other integrations.

EXISTING_MCP=$(cat "$REPO_ROOT/.mcp.json")
plugins/ss/commands/init.md · 2,371 lines

How it starts

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

User Input

$ARGUMENTS

Goal

Establish or refresh the SpecSwarm guides under .specswarm/:

  1. constitution.md - Project governance and coding principles
  2. tech-stack.md - Approved technologies and prohibited patterns
  3. quality-standards.md - Quality gates and performance budgets
  4. references.md - External authoritative sources (spec corpus, reference codebases, memory dirs)
  5. conventions.md - Detected code style and patterns

/ss:init is designed to run at two points in a project's life:

  • At project / sprint kickoff — to create the guides from scratch by detecting the tech stack, discovering external references, and proposing principles from memory.
  • Mid-development, any time — to reconcile the guides against project reality. On re-run, the command reads both (a) the existing guide files and (b) current project state (package.json, CI, memory dirs, …), surfaces drift between the two, and only updates a guide after the developer accepts the proposed delta. Developer-authored content inside <!-- ss:user-additions --> blocks is always preserved verbatim. A full backup of all .specswarm/*.md is taken on every run as a safety net.

Pass --reset if you want to discard existing guides and regenerate from scratch (the backup is still taken; nothing is permanently lost).


Execution Steps

Step 1: Snapshot existing guides (unconditional)

Always back up every .specswarm/*.md file present at the start of the run. This is cheap, always safe, and protects the developer against any reconciliation bug downstream. No "Update / Backup / Cancel" prompt — re-running /ss:init is meant to be safe.

echo "🔍 Snapshotting existing SpecSwarm guides..."
echo ""

REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
BACKUP_TS="$(date +%Y%m%d-%H%M%S)"
BACKUP_DIR="$REPO_ROOT/.specswarm/.backup/$BACKUP_TS"

EXISTING_FILES=()
if [ -d "$REPO_ROOT/.specswarm" ]; then
  shopt -s nullglob
  for f in "$REPO_ROOT/.specswarm"/*.md; do
    EXISTING_FILES+=("$(basename "$f")")
  done
  shopt -u nullglob
fi

# Detect --reset flag from $ARGUMENTS
RESET_MODE=false
if echo "$ARGUMENTS" | grep -q -- '--reset'; then
  RESET_MODE=true
fi

# v7.0.0: Detect --full-scan and --include-user-memory flags
FULL_SCAN_FLAG=false
if echo "$ARGUMENTS" | grep -q -- '--full-scan'; then
  FULL_SCAN_FLAG=true
fi

INCLUDE_USER_MEMORY_FLAG=false
if echo "$ARGUMENTS" | grep -q -- '--include-user-memory'; then
  INCLUDE_USER_MEMORY_FLAG=true
fi

# Detect --minimal flag (referenced by v7.0.0 Steps 3.0 / 4.0 / 4.1 / 4.2 for short-circuit)
MINIMAL_MODE=false
if echo "$ARGUMENTS" | grep -q -- '--minimal'; then
  MINIMAL_MODE=true
fi

if [ ${#EXISTING_FILES[@]} -gt 0 ]; then
  mkdir -p "$BACKUP_DIR"
  for file in "${EXISTING_FILES[@]}"; do
    cp "$REPO_ROOT/.specswarm/$file" "$BACKUP_DIR/$file"
  done

  echo "📦 Backed up ${#EXISTING_FILES[@]} existing guide(s) to:"
  echo "   .specswarm/.backup/$BACKUP_TS/"
  for file in "${EXISTING_FILES[@]}"; do
    echo "     - $file"
  done
  echo ""

  if [ "$RESET_MODE" = true ]; then
    echo "⚠️  --reset flag detected — existing guides will be discarded."
    echo "   Backup above is your recovery path if you change your mind."
    echo ""
  else
    echo "♻️  Reconciliation mode — existing guides will be merged with current project state."
    echo "   Developer-authored content in <!-- ss:user-additions --> blocks is preserved verbatim."
    echo "   You will be prompted to resolve any drift between declared and detected values."
    echo ""
  fi
fi

Read the full file on GitHub · 2,371 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. 2d ago First seen · 2,371 lines · 12 tokens per session scan B 7e36a7591f5f

Subscribe to this mod's changes

init is a command published in the GitHub repository MartyBonacci/specswarm (65 stars, last pushed 1mo ago), licensed MIT. It adds 12 tokens to every session and 27,587 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads mcp configuration). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.