Skip to content

Generate every harness adapter from .agents/ with as-needed detection - #3

Merged
GoatInAHat merged 3 commits into
mainfrom
claude/template-repo-structure-pqwwwq
Aug 28, 2026
Merged

GoatInAHat merged 3 commits into
mainfrom
claude/template-repo-structure-pqwwwq

Conversation

@GoatInAHat

@GoatInAHat GoatInAHat commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

What this does

One canonical .agents/ folder; every harness-specific file is either a tiny committed
seed (only when a harness reads it straight from the clone, before any script can run) or
generated on demand and gitignored. One bootstrap entrypoint serves every dev environment.

Why it looks like this: what the gsd installer actually does

Running get-shit-done-cc --all --local in a sandbox writes 15 harness directories
(claude, opencode, gemini, codex, copilot, kilo, antigravity, cursor, windsurf, augment,
trae, qwen, hermes, codebuddy, cline), each a ~5 MB near-copy of the same payload
(~70 MB total), rendered per harness (markdown+frontmatter commands for Claude, TOML for
Gemini, skill-wrappers for Cursor, config.toml+hooks.json for Codex) — with absolute
machine paths baked in. That confirms the direction: adapters are per-machine renders that
belong in a generator, not in git. The newer gsd-pi (@opengsd/gsd-pi) is a standalone
agent that routes through harness CLIs and reads project .agents/skills/ natively.

The three tiers

  • Canonical (committed): AGENTS.md, .agents/{skills/,mcp/servers.json,scripts/},
    skills-lock.json, .devcontainer/.
  • Seeds (committed, minimal): CLAUDE.md, .claude/settings.json (+ SessionStart
    hook script), .gemini/settings.json (context.fileName + one managed key),
    .cursor/environment.json, .github/workflows/copilot-setup-steps.yml,
    .agents/setup (Amp), .github/copilot-instructions.md.
  • Generated (gitignored): everything else, rendered by the new
    .agents/scripts/sync.py — replaces link-skills.sh + sync-mcp.sh with one
    declarative HARNESSES table (detection probe, skills dir, MCP renderer per harness).

As-needed generation

sync.py renders only for harnesses it detects on the machine (CLI on PATH, config dir,
env var); --all in CI; list prints the table; check guards the two managed keys in
committed seeds. Most harnesses need nothing: Codex, Cursor, Copilot coding agent,
OpenCode, Amp, Factory, Goose, Zed, Crush, Kilo, Antigravity, Cline, dsh (DeepSeek
Harness)
, and gsd all read AGENTS.md + .agents/skills/ natively. Rendered MCP
adapters cover Claude Code, Cursor, Codex (trusted projects), VS Code/Copilot local,
OpenCode, Kilo, Factory, Qwen, Amp; skill symlinks cover only Claude Code and CodeBuddy —
adversarial review against current vendor docs confirmed Windsurf, Hermes, Trae, and
Augment all scan .agents/skills/ natively, so they need nothing. dsh has no
project-level MCP surface (user-level $DSH_HOME config only) — documented rather than
faked.

Unified dev environments

Every environment calls the same bootstrap.sh through its native hook:

Environment Hook
Claude Code cloud SessionStart hook (now always exits 0 — a failed bootstrap degrades instead of killing the session)
Codespaces / devcontainers / Ona postCreateCommand
Copilot coding agent copilot-setup-steps.yml (it does not honor devcontainers)
Cursor cloud agents .cursor/environment.json install
Amp orbs .agents/setup
Codex cloud / Jules / Devin / Factory no in-repo hook exists — the UI setup field takes the same one-liner (documented)

.codex/environments/environment.toml is deleted: Codex cloud reads no in-repo setup
file; that file was a dead surface.

Enforcement

CI regenerates everything (--all) and fails if a bootstrap run leaves any file
untracked — .gitignore and the generator can't drift apart. sync.py check (also in
pre-commit) guards the managed keys in the two committed settings seeds; the skills
lockfile check is unchanged.

Verification

  • sync.py exercised in all modes (detected/named/--all/check/list/install-codex
    idempotency/unknown-harness error) plus a fresh-clone CI simulation: clean
    git status after --all bootstrap, no broken symlinks, all rendered files parse.
  • Harness facts (adapter formats, native AGENTS.md/.agents/skills support, cloud
    hooks) verified against official docs and by running the gsd installers and the
    skills CLI; adapter dialects cross-checked per vendor docs.
  • A multi-lens adversarial review (correctness, external facts, over-engineering, docs
    coherence, each finding independently refuted-or-confirmed) produced 8 confirmed
    findings, all fixed in the follow-up commit.

Also in this PR

AGENTS.md's model-mix dispatch rule is now enforced, not just stated: a committed
PreToolUse hook (.claude/hooks/workflow-model-mix.py) blocks multi-agent Workflow
scripts that assign no model tiers and carry no // single-tier: <reason> justification.
Repos created from this template inherit the enforcement.

🤖 Generated with Claude Code

https://claude.ai/code/session_019vB3bUsXcLptQySBnJz2aG

claude added 3 commits August 27, 2026 23:34
Replace link-skills.sh + sync-mcp.sh with one declarative generator,
.agents/scripts/sync.py: a HARNESSES table mapping each harness to a
detection probe (env var, CLI on PATH, config dir), a skills directory
for the few tools that do not read .agents/skills/ natively, and an MCP
renderer for tools with a project-level MCP file. By default it renders
only for harnesses detected on the machine; --all covers everything
(CI default), `list` prints the table, `check` verifies the managed
keys in the two committed seed files, and install-codex keeps its old
behavior.

Coverage now spans the classic gsd installer's 15 runtimes plus dsh and
friends. Most of them cost nothing: Codex, Cursor, Copilot's coding
agent, OpenCode, Amp, Factory, Goose, Zed, Crush, Kilo, Antigravity,
Cline, and dsh all read AGENTS.md and .agents/skills/ natively. Rendered
adapters: .mcp.json + .claude/skills/ (Claude Code), .cursor/mcp.json,
.codex/config.toml (trusted projects), .vscode/mcp.json (servers key),
opencode.json / kilo.jsonc (local/remote dialect), .factory/mcp.json,
.qwen/settings.json (httpUrl + contextFileName), .amp/settings.json,
and per-skill symlink dirs for Windsurf, Hermes, Trae, Augment, and
CodeBuddy. All generated output is gitignored; CI now fails if a
bootstrap run leaves anything untracked, which keeps .gitignore and the
generator in lockstep.

Unify the environment story around the same bootstrap entrypoint:
- .github/workflows/copilot-setup-steps.yml (Copilot's coding agent
  does not honor devcontainers)
- .cursor/environment.json install hook for Cursor cloud agents
- .agents/setup shim for Amp orbs
- delete .codex/environments/environment.toml — Codex cloud reads no
  in-repo setup file; its UI Setup script field takes the bootstrap
  one-liner, now documented with the Jules/Devin/Factory equivalents
- session-start.sh now always exits 0 so a failed bootstrap degrades
  instead of killing the Claude cloud session

Cursor skill symlinks are gone rather than moved: Cursor reads
.agents/skills/ natively, so the adapter was pure noise.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019vB3bUsXcLptQySBnJz2aG
AGENTS.md already tells agents to balance model tiers when work fans
out, but a rule that relies on the agent remembering it at authoring
time gets skipped — the harness default is to omit model: and inherit
the session's strongest tier for every step. Add a PreToolUse hook on
the Workflow tool that blocks a script spawning two or more agent()
calls when none of them sets model: and no `// single-tier: <reason>`
comment claims the exception, feeding the rule back as the block
reason. Resumes, named workflows, and single-agent scripts pass
through untouched.

The hook ships as a committed seed in .claude/settings.json, so every
repo created from this template inherits the enforcement; the
Dispatching work section now documents the mechanism and the opt-out.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019vB3bUsXcLptQySBnJz2aG
Confirmed against current vendor docs: Windsurf, Hermes, Trae, and
Augment all scan .agents/skills/ natively alongside their own dirs, so
their symlink adapters were the same noise this branch already deleted
for Cursor. Their rows collapse into the native list; only CodeBuddy
keeps a generated skills dir.

Verified code fixes:
- sync_skills no longer crashes when .agents/skills/ is absent
- atomic_write preserves an existing file's permissions (install-codex
  was resetting a possibly-600 ~/.codex/config.toml to 644) and gives
  new files a plain 644 instead of the umask dance
- an explicitly named harness now beats the GITHUB_ACTIONS implicit
  --all, which silently rendered everything in any Actions job
- .vscode/mcp.json keeps an explicit canonical transport (sse) instead
  of overwriting it with http
- detection no longer probes project paths sync.py itself creates, so
  one --all run can't make a harness permanently "detected"
- servers.json entries must carry a url or a command — every renderer
  depends on one of the two
- render_gemini, an empty renderer kept only to occupy the registry,
  becomes a `note` on the gemini row; dead bool branch in toml_value
  dropped

Docs: resolve the "need no adapter at all" wording that contradicted
the MCP renderer table, trim the Agent configuration section to what
sync.py list doesn't already say, and label .github/ honestly (seeds
plus CI enforcement).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019vB3bUsXcLptQySBnJz2aG
@GoatInAHat
GoatInAHat marked this pull request as ready for review August 28, 2026 01:46
@GoatInAHat
GoatInAHat merged commit 22339f4 into main Aug 28, 2026
2 checks passed
@GoatInAHat
GoatInAHat deleted the claude/template-repo-structure-pqwwwq branch August 28, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants