Shared Agents

sa sync · pull team repo

Adapters

Adapters

Adapters wire Shared Agents into each AI tool: session hooks, skill symlinks, rule symlinks, and merged instruction files.

Configuration is driven by adapters/manifest.json.

CommandPurpose
sa installConfigure detected tools (first time or new tool)
sa syncRefresh symlinks and AGENTS.md / CLAUDE.md blocks
sa checkInstalled vs configured matrix
sa doctor --fixRepair broken rule symlinks

Installed ≠ configured. sa install only touches tools detected as installed.


Supported tools

ToolAdapter IDRules deliveryDetails
Cursor IDEcursor~/.cursor/rules/ symlinkscursor/README
Claude Codeclaude-code~/.claude/CLAUDE.md markerclaude-code/README
Zedzed~/.config/zed/AGENTS.mdzed/README
Pipi~/.pi/agent/AGENTS.mdpi/README
OpenAI Codex CLIcodex~/.codex/AGENTS.mdcodex/README
OpenCodeopencode~/.config/opencode/AGENTS.mdopencode/README
Gemini CLIgemini~/.gemini/GEMINI.mdgemini/README
Windsurfwindsurf~/.codeium/windsurf/AGENTS.mdwindsurf/README
Continue.devcontinue~/.continue/AGENTS.mdcontinue/README
GitHub CopilotcopilotCopilot AGENTS.md pathscopilot/README
Aideraider~/.aider/AGENTS.mdaider/README
Grok Buildgrok~/.grok/AGENTS.mdgrok/README
OpenClaw / headlessopenclawReads $SHARED_AGENTS_HOMEopenclaw/README
Generic / manualgenericCopy-paste instructionsgeneric/README

What sa sync does per tool

  1. Skill symlinks — Core + team skills → ~/.agents/skills, ~/.claude/skills, etc.
  2. Cursor rule symlinks — Core + team .mdc → ~/.cursor/rules/
  3. Team-rules blocks — Injected between markers in each tool’s global agents file

Session hooks (where configured) run sa sync quietly at session start.


Cursor

  • Hook: sessionStart → shared-agents-sync.sh
  • Rules: symlinked .mdc files
  • If a rule path is a regular file, sa doctor --fix backs it up and relinks

Claude Code, Zed, Codex, …

  • Merged blocks in CLAUDE.md / AGENTS.md / GEMINI.md
  • Base block: <!-- shared-agents:begin --> (sync + learnings hints)
  • Team rules block: <!-- shared-agents:team-rules:begin/end -->

Zed and Pi have no session hook — agents should run sync as an early step when needed. Pi already discovers ~/.agents/skills, so sync does not add a second skill directory.


Grok Build

  • Hook: ~/.grok/hooks/shared-agents.json → SessionStart (timeout 60s, because Grok's default is 5s)
  • Rules: merged into ~/.grok/AGENTS.md
  • Skills: ~/.agents/skills (Grok reads that directory; no ~/.grok/skills copy)
  • Does not change [compat.claude]. Grok keeps reading ~/.claude/CLAUDE.md and <repo>/.claude/CLAUDE.md. sa install also writes the same team-rules block into ~/.grok/AGENTS.md, so that block can show up twice.

Details: adapters/grok/README.md.


Adding a new tool (contributors)

  1. Add entry to adapters/manifest.json (detect, detect_bins, agents_md, sync, …)
  2. Add adapters/<tool-id>/README.md
  3. Run sa install --dry-run, sa install, sa check
  4. Open a PR with sample sa check output

See Contributing.


Generic fallback

If your CLI is not in the manifest, copy adapters/generic/instructions.md into your global agent config and set $SHARED_AGENTS_HOME.


See also