Loading...
Loading...
One-time project onboarding for swain. Migrates existing CLAUDE.md content to AGENTS.md (with the @AGENTS.md include pattern), verifies vendored tk (ticket) for task tracking, configures pre-commit security hooks (gitleaks default), and offers to add swain governance rules. Run once when adopting swain in a new project — use swain-doctor for ongoing per-session health checks.
npx skill4agent add cristoslc/swain swain-init@AGENTS.mdcat CLAUDE.md 2>/dev/null; echo "---SEPARATOR---"; cat AGENTS.md 2>/dev/null| CLAUDE.md | AGENTS.md | State |
|---|---|---|
| Missing or empty | Missing or empty | Fresh — no migration needed |
Contains only | Any | Already migrated — skip to Phase 2 |
| Has real content | Missing or empty | Standard — migrate CLAUDE.md → AGENTS.md |
| Has real content | Has real content | Split — needs merge (ask user) |
# CLAUDE.md
@AGENTS.md# AGENTS.md
(empty — governance will be added in Phase 3)<!-- swain governance -->@AGENTS.mdMigrated your CLAUDE.md content to AGENTS.md and replaced CLAUDE.md with. Your existing instructions are preserved — Claude Code reads AGENTS.md via the include directive.@AGENTS.md
Both CLAUDE.md and AGENTS.md have content. How should I proceed?
- Merge — append CLAUDE.md content to the end of AGENTS.md, then replace CLAUDE.md with
@AGENTS.md- Keep AGENTS.md — discard CLAUDE.md content, replace CLAUDE.md with
@AGENTS.md- Abort — leave both files as-is, skip migration
<!-- swain governance -->@AGENTS.mdcommand -v uvcurl -LsSf https://astral.sh/uv/install.sh | shuv installation failed. You can install it manually (https://docs.astral.sh/uv/getting-started/installation/) — swain scripts require uv for Python execution.
TK_PATH="$(find . .claude .agents -path '*/swain-do/bin/tk' -print -quit 2>/dev/null)"
test -x "$TK_PATH" && echo "tk found at $TK_PATH" || echo "tk not found""$TK_PATH" help >/dev/null 2>&1 && echo "tk works" || echo "tk broken"The vendored tk script was not found at. This usually means the swain-do skill was not fully installed. Try runningskills/swain-do/bin/tkto reinstall skills./swain update
test -d .beads && echo "beads found" || echo "no beads".beads/ls .beads/backup/issues.jsonl 2>/dev/nullFound existingdata. Migrate tasks to tk? This will convert.beads/to.beads/backup/issues.jsonlmarkdown files..tickets/
TK_BIN="$(cd "$(dirname "$TK_PATH")" && pwd)"
export PATH="$TK_BIN:$PATH"
cp .beads/backup/issues.jsonl .beads/issues.jsonl 2>/dev/null # migrate-beads expects this location
ticket-migrate-beadsls .tickets/*.md 2>/dev/null | wc -l.beads/.beads/.tickets/tk create.pre-commit-config.yamltest -f .pre-commit-config.yaml && echo "exists" || echo "missing"Found existing. How should I proceed?.pre-commit-config.yaml
- Merge — add swain's gitleaks hook alongside your existing hooks
- Skip — leave pre-commit config unchanged
- Replace — overwrite with swain's default config (your existing hooks will be lost)
command -v pre-commit && pre-commit --versionpre-commituv tool install pre-commitpre-commit framework not available. You can install it manually (oruv tool install pre-commit). Skipping hook setup.pip install pre-commit
.pre-commit-config.yamlrepos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks--scanner - repo: https://github.com/trufflesecurity/trufflehog
rev: v3.88.1
hooks:
- id: trufflehog
args: ['--results=verified,unknown'] - repo: https://github.com/cebidhem/pre-commit-trivy
rev: v1.0.0
hooks:
- id: trivy-fs
args: ['--severity', 'HIGH,CRITICAL', '--scanners', 'vuln,license'] - repo: https://github.com/nicjohnson145/pre-commit-osv-scanner
rev: v0.0.1
hooks:
- id: osv-scannerrepos:pre-commit installswain.settings.jsonsync.scanners{
"sync": {
"scanners": {
"gitleaks": { "enabled": true },
"trufflehog": { "enabled": false },
"trivy": { "enabled": false, "scanners": ["vuln", "license"], "severity": "HIGH,CRITICAL" },
"osv-scanner": { "enabled": false }
}
}
}enabled: truePre-commit hooks configured with gitleaks (default). Scanner settings saved to. To enable additional scanners later, editswain.settings.jsonand re-runswain.settings.json./swain-init
obra/superpowersls .agents/skills/brainstorming/SKILL.md .claude/skills/brainstorming/SKILL.md 2>/dev/null | head -1Superpowers () is not installed. It provides TDD, brainstorming, plan writing, and verification skills that swain chains into during implementation and design work.obra/superpowersInstall superpowers now? (yes/no)
npx skills add obra/superpowersnpx skills add obra/superpowersSuperpowers installed. Brainstorming, TDD, plan writing, and verification skills are now available.
Superpowers installation failed. You can retry manually:npx skills add obra/superpowers
grep -l "swain governance" AGENTS.md CLAUDE.md 2>/dev/nullReady to add swain governance rules to AGENTS.md. These rules:
- Route artifact requests (specs, stories, ADRs, etc.) to swain-design
- Route task tracking to swain-do (using tk)
- Enforce the pre-implementation protocol (plan before code)
- Prefer swain skills over built-in alternatives
Add governance rules to AGENTS.md? (yes/no)
skills/swain-doctor/references/AGENTS.content.mdfind .claude/skills .agents/skills skills -path '*/swain-doctor/references/AGENTS.content.md' -print -quit 2>/dev/nullGovernance rules added to AGENTS.md. These ensure swain skills are routable and conventions are enforced. You can customize anything outside themarkers.<!-- swain governance -->
mkdir -p .agents.tickets/swain init complete.
- CLAUDE.md →
include pattern: [done/skipped/already set up]@AGENTS.md- tk (ticket) verified: [done/not found]
- Beads migration: [done/skipped/no beads found]
- Pre-commit security hooks: [done/skipped/already configured]
- Superpowers: [installed/skipped/already present]
- Swain governance in AGENTS.md: [done/skipped/already present]
/swain init<!-- swain governance --><!-- swain governance --><!-- end swain governance -->