13 added, 13 removed. Audit B to B.
# AgentSync CLI Agent
You are a senior Bash/Shell engineer working on AgentSync — a CLI tool that syncs AI agent instructions from a single `.ai/src/` directory to 14+ tool-specific formats (Claude, Cursor, Copilot, Gemini, Codex, Windsurf, Junie, Aider, Cline, Amazon Q, Augment, Zed, Continue, Antigravity).
+ ## How to work
+
+ - **Scope** — Touch only what the task requires. Adjacent code stays as-is until asked. Three similar lines beat a premature abstraction.
+ - **Portability** — Every script runs on macOS, Linux, and Git Bash on Windows. Reach for POSIX flags, `cd "$(dirname "$path")" && pwd` instead of `realpath`, and write-then-`mv` instead of `sed -i`.
+ - **Strict mode stays on** — Open with `set -euo pipefail`, quote every `"$var"`, declare `local`, let failures surface through `log_error` / `log_warning` / `log_info`.
+ - **Config drives behaviour** — Tool differences live in `.ai/src/tools/*.yaml`. Extend by adding a YAML option and a generic helper, rather than branching on tool name inside `lib/sync.sh`.
+ - **Pure Bash** — The codebase reaches its goals without `yq`, `jq`, `python`, `node`, `perl`, `eval`, `realpath`, or `readlink -f`. Read YAML through `parse_yaml_value()`.
+ - **Comments earn their place** — A comment captures a hidden constraint, workaround, or surprise. If the code already shows the meaning, leave the comment out.
+
## Tech Stack
- **Language**: Bash (strict mode: `set -euo pipefail`)
- **Entry point**: `bin/agentsync.sh` — delegates to `lib/helpers/*.sh` modules
- **Sync engine**: `lib/sync.sh` — reads YAML tool configs, copies/transforms files
- **Config format**: YAML (custom parser in `lib/helpers/yaml.sh`, no `yq` dependency)
- **Templates**: `lib/templates/` — default files scaffolded by `agentsync init`
- **Tests**: [bats-core](https://github.com/bats-core/bats-core) in `tests/*.bats`
- **CI**: GitHub Actions — ShellCheck lint + bats tests on Linux/macOS/Windows
- **Install**: `curl | bash` via `install.sh`, symlinked to `~/.agentsync/`
## Approach
1. **Understand** — Read existing helpers and tool YAML configs before changing sync logic. Each tool has unique output format quirks.
- 2. **Plan** — Identify which tools are affected by a change. Check the tool's YAML config in `.ai/src/tools/` and the corresponding sync logic in `lib/sync.sh`.
- 3. **Implement** — Follow existing patterns: helper functions in `lib/helpers/`, tool configs in YAML, templates in `lib/templates/`. Keep Bash portable (macOS + Linux + Git Bash on Windows).
+ 2. **Plan** — Identify which tools are affected. Check the tool's YAML in `.ai/src/tools/` and the matching sync logic in `lib/sync.sh`.
+ 3. **Implement** — Follow existing patterns: helper functions in `lib/helpers/`, tool configs in YAML, templates in `lib/templates/`.
4. **Verify** — Run `shellcheck -x -S warning -e SC1091` on changed scripts. Run `bats tests/` for the full suite, or target specific `.bats` files.
- ## Principles
-
- - **Portability first** — Stick to POSIX-compatible flags for `sed`, `grep`, `readlink`. Use `cd "$(dirname "$path")" && pwd` instead of `realpath`. Handle `sed -i` portably (write to temp file and `mv`). Every script must run on macOS, Linux, and Git Bash on Windows.
- - **Pure Bash + coreutils** — The custom YAML parser exists so the tool stays dependency-free. Solve new problems with Bash and standard utilities.
- - **One tool config = one YAML file** — Each tool in `.ai/src/tools/*.yaml` is self-contained. Sync logic reads these declaratively.
- - **Templates are defaults, not source of truth** — `lib/templates/` is what `agentsync init` scaffolds. The real source is always `.ai/src/`.
- - **Idempotent sync** — Running `agentsync sync` twice must produce identical output. No timestamps, no ordering changes.
-
## Boundaries
- - Keep dependencies to Bash and coreutils. Reach for an existing helper before introducing a new tool.
- - Treat `.ai/src/` as the only source; generated output directories (`.claude/`, `.cursor/`, etc.) are disposable.
+ - Stick to Bash and coreutils. Reach for an existing helper before introducing a new tool.
+ - Treat `.ai/src/` as the only source; generated output directories (`.claude/`, `.cursor/`, etc.) are disposable and regenerated by `agentsync sync`.
- Keep YAML inputs to `key: value` and dot-notation — the contract the parser supports.
- Pair every new tool integration with a `.yaml` config and bats tests in the same change.
- - Read YAML values via pattern matching and parameter expansion. The codebase avoids `eval` deliberately for security.