agentleFS
netgrade-digitalnetgrade-digital/shared-agents/skills/sa-cli/SKILL.md

sa-cli

Skill5 starsChanged 5 months agoMITView on GitHub

Complete guide to the shared-agents shell CLI (sa). Use when the user asks how to run sa, sa help, install, sync, review, pending, unapprove, learning, check, uninstall, status, or any shared-agents terminal command. Also use when explaining setup, wizard, or troubleshooting the CLI after sa install.

  • Pipes a download into a shell
  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Canonical live help: run sa or sa help — prefer that over memorizing flags.

    line 12
  2. Very specific:

    After edit: commit/push team repo → teammates sa sync (links skills + rules automatically).

    line 238
  3. Very specific:

    Create/remove ends with commit + push to the team repo (default: yes — Enter or y).

    line 273
  4. Very specific:

    After push: teammates run sa sync.

    line 275
  5. Distinctive:

    After bootstrap or when debugging team layout:

    line 365
  6. Very specific:

    If ~/.shared-agents/learnings/ still exists (pre Core/team split):

    line 379
  7. Distinctive:

    When the user needs CLI help:

    line 405
  8. Very specific:

    Run sa help (live text from scripts/sa_ui.py).

    line 407
  9. Distinctive:

    Use this skill for workflows — do not invent a parallel command list.

    line 408

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

shared-agents CLI (sa)

Canonical live help: run sa or sa help — prefer that over memorizing flags.

sa                  # help overview (default)
sa help             # same
shared-agents …     # alias
sharedagents …      # alias

Without shell aliases (agents, CI, fresh shell):

"${SHARED_AGENTS_HOME:-$HOME/.shared-agents}/scripts/sa" help

Repo root (dev checkout): ./sa · ./sa install

Env: SHARED_AGENTS_HOME (default ~/.shared-agents) · Version: sa version


First-time setup

Recommended (Core + private team repo + adapters):

curl -fsSL https://raw.githubusercontent.com/netgrade-digital/shared-agents/refs/heads/main/scripts/bootstrap.sh | bash
# Piped curl uses /dev/tty for the wizard when possible (TUI or text prompts).
# Force auto-install only: SA_BOOTSTRAP_NON_INTERACTIVE=1 curl … | bash
# or after clone: ./scripts/bootstrap.sh  ·  sa bootstrap
source ~/.bashrc   # fish: source ~/.config/fish/config.fish
sa check
sa team verify    # optional but useful after bootstrap

Classic (Core only, then wizard — team repo optional in wizard):

git clone git@bitbucket.org:netgrade/shared-agents.git ~/.shared-agents
cd ~/.shared-agents
./sa install
source ~/.bashrc   # fish: source ~/.config/fish/config.fish

From dev checkout without ~/.shared-agents yet: ./sa install — wizard runs before clone; cancel leaves no ~/.shared-agents.

New AI tool installed? → run sa install again.


Commands (overview)

AreaCommandSummary
Infosa · sa helpAll commands
Infosa versionCLI version + HOME
Setupsa bootstrapFull first-time setup (Core + team + adapters)
Setupsa installSetup wizard (default in TTY)
Setupsa install --non-interactiveAll detected tools, no prompts
Setupsa install --wizardWizard explicitly
Setupsa checkTool installed vs configured (+ team warnings)
Setupsa syncPull Core + team; link skills + rules
Setupsa statusOpen items: review, skills, adapters, team
Setupsa doctorDiagnose symlink / rule link issues
Setupsa doctor --fixRepair (backup + relink blocking rule files)
Setupsa team verifyDeep team repo validation
Setupsa team migrateLegacy learnings/ → team/learnings/
Setupsa uninstallUninstall (y/N)
Learningssa reviewInteractive: pending → approved
Learningssa review listPending list
Learningssa review dry [file]Dry-run
Learningssa pending push [file]Commit + push pending
Learningssa pending path [slug]Canonical pending path
Learningssa unapprove [id|file]Remove from approved
Learningssa unapprove listApproved list
Learningssa learning report --id <id> --event <e>Buffer usage event (no git, no review)
Learningssa learning pushFlush buffer → usage.yaml (+ commit/push; also sa sync)
Learningssa learning status [--json]Usage metrics + flags (rule candidates, orphans, unresolved)
Learningssa learning events <id>Raw events for one learning
Learningssa learning migrateOne-time: flat approved/*.md → <id>/learning.md + usage.yaml
Team contentsa skill newWizard: team/skills/<name>/SKILL.md
Team contentsa skill rm [name]Remove team skill
Team contentsa skill listList team skills
Team contentsa skill edit [name]Edit team skill (opens $EDITOR)
Team contentsa rule newWizard: team/rules/<slug>.mdc
Team contentsa rule rm [slug]Remove team rule
Team contentsa rule listList team rules
Team contentsa rule edit [slug]Edit team rule (opens $EDITOR)

Alias: sa install = sa setup


Status — sa status

Shows easy-to-forget work:

CheckMeaningAction
Pending learningsteam/learnings/pending/ (team repo)sa review list · sa review
Not pushed yetLocal pending changessa pending push
Team setupConfig / legacy layoutsa team verify · sa team migrate
Skill symlinksNew skill not linkedsa sync · sa doctor --fix
Rule symlinksMissing link or local file blocks symlinksa doctor --fix · sa sync
AdaptersTool present, not configuredsa install
sa status              # full list (or “all clear ✓”)
sa status --brief      # one line
sa status --quiet      # print only when action needed (exit 1)
sa status --json       # CI / scripts

After sa sync (non-quiet): runs sa status --quiet for a short terminal hint.

Rule-Link(s) in brief status often means a Cursor rule exists as a regular file — sa doctor --fix backs it up and relinks.

sa check vs sa team verify: check uses quick check_team_setup() warnings; sa team verify is stricter (folders, index, origin, --strict).


Doctor — sa doctor

sa doctor              # diagnose (same sources as sa status)
sa doctor --fix        # backup blocking rule files + run sync-links
sa doctor --fix -y     # no prompts (default yes on --fix)
sa doctor --fix --dry-run

Backups: $SHARED_AGENTS_HOME/.doctor-backups/. Does not replace learnings workflow or run full sa install.


Setup — sa install

Calls install.sh (manifest-driven, idempotent).

Wizard (recommended, TTY)

sa install
StepControls
Install pathType path · Enter
Agents↑↓ · Space toggle · a all · d detected · Enter
Team repo URLOptional private remote for learnings
Shell CLI←→ / ↑↓ Yes/No · Enter
Summary↑↓ Run/Cancel · Enter (default: Cancel)
  • Cursor / VS Code terminal: often plain text wizard (SA_WIZARD_PLAIN=1)
  • foot / alacritty: TUI with arrow keys

Quick / CI

sa install --non-interactive
sa install --non-interactive --tools cursor,claude-code
sa install --dry-run
sa install --dry-run --wizard

Install flags (passed through to install.sh)

FlagMeaning
--home DIRTarget path (default: ~/.shared-agents)
--source DIRSource repo (dev checkout)
--shell-rc FILEOne shell rc for sa (default: login shell, plus fish when installed)
--tools IDSComma-separated adapter IDs only
--checkStatus instead of install (sa check)
--check --jsonJSON for CI
--dry-runPreview, no writes

Low-level: ./install.sh at repo root — same options.


Check — sa check

sa check
sa check --json
sa install --check    # same
STATUSMeaning
okTool present + shared-agents configured
missing_toolCLI/config not found
not_configuredTool present, adapter missing → sa install
availablegeneric fallback

Team warnings appear under Team data: when relevant.


Sync — sa sync

sa sync
# = scripts/sync.sh pull
#   1) git pull  ~/.shared-agents        (Core — tools, adapters, OSS skills)
#   2) git pull  ~/.shared-agents/team/  (Team — learnings, team skills, team rules)
#   3) sync-links — skill symlinks, rule symlinks, team-rules AGENTS.md/CLAUDE.md blocks
  • Both repos ff-only
  • Without team/ / without team.remote: Core only (solo fallback under core/learnings/)
  • Agents: session start via hook (session-sync.sh → sync.sh pull --quiet; links refresh quietly)
  • Manual: after offline, before review, when a teammate pushed new skills/rules

Learnings workflow

Agent writes pending/  →  sa pending push  →  sa review  →  approved/

Rules (like skills — no review CLI)

Team rules: $SHARED_AGENTS_HOME/team/rules/*.mdc (flat). Core: $SHARED_AGENTS_HOME/rules/.

After edit: commit/push team repo → teammates sa sync (links skills + rules automatically).

  • Cursor: symlinks → ~/.cursor/rules/ (local non-symlink files preserved)
  • Zed, Pi (~/.pi/agent/AGENTS.md), Codex, Claude Code (~/.claude/CLAUDE.md), Grok Build (~/.grok/AGENTS.md), Gemini, Windsurf, …: merged <!-- shared-agents:team-rules:begin/end --> block in each tool's agents file

Optional frontmatter: targets: [zed, claude-code] — omit for all adapters.

Team skills & rules — sa skill · sa rule

Interactive wizards scaffold files in the team repo (private team/). No pending/review workflow — commit/push like any team file.

sa skill new                 # create: slug, title, description, sections
sa skill rm [name]           # remove (picker if name omitted)
sa skill list
sa skill edit [name]         # edit in $EDITOR (picker if name omitted)

sa rule new                  # create: slug, title, description, targets, body
sa rule rm [slug]            # remove (picker if slug omitted)
sa rule list
sa rule edit [slug]          # edit in $EDITOR (picker if slug omitted)

# Aliases: rm = delete = remove · list = ls

# Non-interactive (CI / scripts):
sa skill new --name my-skill --description "When user asks about …"
sa skill rm my-skill -y
sa skill edit my-skill --push
sa rule new --name my-rule --description "…" --targets cursor,zed
sa rule rm my-rule --no-git
sa rule edit my-rule --push

# Flags: --dry-run --force (new only) --no-git --push -y

Create/remove ends with commit + push to the team repo (default: yes — Enter or y). Skip git with n on the push prompt or --no-git.

After push: teammates run sa sync. Optional --push / -y: skip prompts.

Publish pending — sa pending push

sa pending push 2026-06-02-my-slug.md
sa pending push              # unstaged pending/*.md
# flags: --all --dry-run --no-git

Commits/pushes team repo only when team mode is active.

Review — sa review

sa review list
sa review dry 2026-06-02-my-slug.md
sa review                    # interactive file picker
sa review 2026-06-02-my-slug.md
FlagMeaning
--domain DOMAINTarget under approved/by-domain/
--dry-runShow only
--no-gitNo commit/push
-y / --yesApprove without confirmation
--rejectDelete pending file, commit + push (no prompt)

Prompt: [y] approve (move to approved/, update index.yaml, commit + push) · [r] reject (delete pending file, commit + push) · [n] cancel (file stays in pending/). Team repo only when team mode is active. -y still means approve.

Resolve path — sa pending path

sa pending path 2026-06-02-my-slug
# → …/team/learnings/pending/2026-06-02-my-slug.md  (with team repo)

Unapprove — sa unapprove

sa unapprove list
sa unapprove fantasy-2026-06-dragon-cache
# wizard: [1] Delete  [2] Move to pending/  [q] Cancel
FlagMeaning
--to-pendingMove to pending/ (non-interactive)
--deleteDelete file (non-interactive)
--dry-run · --no-git · -ysame as review

Alias: sa unapprove = sa rm (remove learning, not uninstall repo)

Learning usage — sa learning (machine tracking, no review)

Each approved learning is a folder: learning.md (human-gated) + usage.yaml (machine-written events). Two report domains: opened/used/not_used/outdated = knowledge quality · read = agent telemetry (never mixed).

sa learning report --id crm-2026-07-ci-pre-commit-checks --event used --project crm-system --task t4821 --agent pi
sa learning report --id <id> --event outdated --note "ddev 1.23 changed behavior"
# events buffer in learnings/.usage-local.yaml; flushed by sa sync / sa learning push
sa learning status          # metrics + flags: OUTDATED · LOW-FIT · RULE-CANDIDATE · UNRESOLVED
sa learning events <id>     # raw events (remote + buffered)
sa learning migrate         # one-time folder migration (idempotent)
  • outdated requires --note. Secrets in --note/--task are blocked.
  • opened dedupes per (learning, task). Conflicts auto-resolve (union + eid dedup).
  • Events for removed learnings → usage-orphan.yaml (quarantine, shown in sa learning status).

Uninstall — sa uninstall

sa uninstall
sa uninstall -y
sa uninstall --keep-repo     # adapters only; keep core + team/
sa uninstall --dry-run

Removes hooks and skill symlinks (Core and team skills). Without --keep-repo: deletes $SHARED_AGENTS_HOME including team/ and config.local.yaml.

Then open a new terminal, or source the updated rc (~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish). Fresh setup: sa bootstrap.


Team repo — sa team verify

After bootstrap or when debugging team layout:

sa team verify
sa team verify --json
sa team verify --strict      # exit 1 on warnings

Checks: team/.git, origin vs config.local.yaml, learnings/index.yaml, pending/ / approved/, legacy ~/shared-agents/learnings/.


Migration — sa team migrate

If ~/.shared-agents/learnings/ still exists (pre Core/team split):

sa team migrate --dry-run
sa team migrate

See $SHARED_AGENTS_HOME/docs/migration-team-data.md.


Troubleshooting

ProblemFix
sa: command not foundsource the shell rc (~/.bashrc, ~/.zshrc, fish ~/.config/fish/config.fish) or "$SHARED_AGENTS_HOME/scripts/sa" help
shared-agents not installedsa bootstrap or sa install / ./sa install
Tool not_configuredsa install
Stale learningssa sync · check hooks / sa check
Team layout / legacy pathssa team verify · sa team migrate
Wizard cancelled, half setuprm -rf ~/.shared-agents · sa bootstrap again

Agent instruction

When the user needs CLI help:

  1. Run sa help (live text from scripts/sa_ui.py).
  2. Use this skill for workflows — do not invent a parallel command list.
  3. Paths: $SHARED_AGENTS_HOME — see skills shared-agents-knowledge and capture-learning.

More docs: $SHARED_AGENTS_HOME/README.md · docs/canonical-paths.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.