Skip to content

Commit 4b8687c

Browse files
committed
refactor(agents): migrate universal skills from opencode to ~/.agents
Move tool-agnostic skills (memory, git-commit-push, dotfiles, retrospective, create-skill) to home/dot_agents/ so OpenCode, Claude Code, Cursor, and pi all discover them from ~/.agents/skills/. OpenCode AGENTS.md slimmed to OC-specific rules (subagents, context-mode) with a pointer to ~/.agents/AGENTS.md. Added ~/.claude/CLAUDE.md with @-import for Claude Code integration.
1 parent 093705c commit 4b8687c

9 files changed

Lines changed: 93 additions & 86 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ Deleting a file from the chezmoi source does **not** remove it from the target (
115115

116116
## Repo-specific conventions
117117

118+
- **Universal agent definitions**`home/dot_agents/` (→ `~/.agents/`). Cross-tool agent rules and skills shared by OpenCode, Claude Code, Cursor, and pi. Universal rules live in `home/dot_agents/AGENTS.md`; universal skills in `home/dot_agents/skills/`. Edit the chezmoi source, not the deployed files.
118119
- **Repo-local skills** – Shared project skills live under `.agents/skills/`.
119120
- **MCP server updates** – Load `.agents/skills/update-mcp-servers/SKILL.md` before changing `home/.chezmoidata/mcps/*.yaml`, `home/dot_cursor/mcp.json.tmpl`, or `home/dot_config/opencode/opencode.jsonc.tmpl`.
120121
- **Agent permission updates** – Load `.agents/skills/update-agent-permissions/SKILL.md` before changing `home/.chezmoidata/agent-permissions/*.yaml`, `schemas/agent-permissions.schema.json`, or OpenCode permission template rendering.
121122
- **Homebrew updates** – Load `.agents/skills/homebrew-management/SKILL.md` before changing `home/Brewfile.tmpl`, `home/Brewfile.ignore`, brew overlay data, brew-related chezmoiscripts, or `home/dot_scripts/executable_brew-review`.
122123
- **Zsh** – Primary config under `home/dot_config/zsh/`: `dot_zshrc`, `dot_zshenv`, `dot_zprofile`, `dot_zplugins`, `dot_zshrc.d/`, `dot_zfunctions/`, `dot_p10k.zsh`. Top-level `home/dot_zshenv` and `home/dot_profile` set `ZDOTDIR` / `XDG_CONFIG_HOME` and are sourced by the shell.
123124
- **Neovim**`home/dot_config/nvim/` (LazyVim-style: `init.lua`, `lua/config/`, `lua/plugins/`).
124125
- **OpenCode**`home/dot_config/opencode/opencode.jsonc.tmpl` (→ `~/.config/opencode/opencode.jsonc`). This is the global OpenCode config: model, MCP servers, permissions, etc. It is a chezmoi template (uses `.chezmoi.homeDir` for the Obsidian vault path). Edit the source here when updating OpenCode settings.
125-
- **OpenCode global agent rules**`home/dot_config/opencode/AGENTS.md` (→ `~/.config/opencode/AGENTS.md`). Universal agent rules that apply across all OpenCode sessions and projects. Edit the source here and run `chezmoi apply`. Never edit `~/.config/opencode/AGENTS.md` directly.
126+
- **OpenCode-specific agent rules**`home/dot_config/opencode/AGENTS.md` (→ `~/.config/opencode/AGENTS.md`). OpenCode-specific rules (context-mode routing, subagents, custom commands) that extend the universal rules in `~/.agents/AGENTS.md`. Edit the source here and run `chezmoi apply`. Never edit `~/.config/opencode/AGENTS.md` directly.
126127
- **mcpproxy**`home/private_dot_mcpproxy/modify_mcp_config.json` (→ `~/.mcpproxy/mcp_config.json`). Renders the [smart-mcp-proxy/mcpproxy-go](https://github.com/smart-mcp-proxy/mcpproxy-go) config from `home/.chezmoidata/mcps/*.yaml` (same source of truth as Cursor and OpenCode). Installed via Homebrew tap `smart-mcp-proxy/mcpproxy` on macOS/Linux and via pinned GitHub release installer on private Windows systems. Use the `update-mcp-servers` skill when changing servers.
127128
- **pi MCP servers**`home/dot_pi/agent/mcp.json.tmpl` (→ `~/.pi/agent/mcp.json`). Renders pi-facing MCP servers from the same `home/.chezmoidata/mcps/*.yaml` source of truth. Pi has no built-in MCP support, so the `pi` target is opt-in: only servers with `targets.pi.enabled: true` are emitted. Use the `update-mcp-servers` skill when changing servers.
128129
- **mise tools** – Declared in `home/dot_config/mise/config.toml.tmpl`. `home/.chezmoiscripts/run_onchange_after_mise_install.sh.tmpl` runs `mise install` whenever that config changes (hash-pinned via `include`/`sha256sum`), so adding/removing/repinning mise tools reconciles on `chezmoi apply` without re-running the full bootstrap. The bootstrap script still runs `mise install` on first provisioning; this onchange handles ongoing changes.

home/dot_agents/AGENTS.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Global agent rules
2+
3+
These rules apply to every coding session, across every project.
4+
5+
---
6+
7+
## Always active
8+
9+
These constraints are unconditional. Apply them without being asked.
10+
11+
- **No em dashes.** Use commas, colons, or restructure the sentence. Never generate ``, `---`, or `—`.
12+
- **Never guess schemas or APIs.** Read the authoritative source first (Go structs, official docs, or the project's own examples). Blog posts and AI-generated examples are not acceptable. If docs don't render, clone the repo and read the struct tags directly.
13+
- **Clone repos to read source.** Never curl GitHub API endpoints or fetch raw URLs. `git clone` first, then read.
14+
- **All Python through mise.** Never invoke `python`, `pip`, `uv`, or `uvx` directly. Use `mise x -- <command>` for all Python toolchain work.
15+
- **Never accept a limitation without investigating.** Keep working until the problem is actually solved. Suggesting workarounds as a final answer is not acceptable.
16+
- **Don't say "Docker containers."** Docker is a brand name, not a container type. Write "containers" or "OCI images" in prose. Action references like `docker/login-action` are fine as-is.
17+
18+
---
19+
20+
## Session close: mandatory
21+
22+
After every non-trivial task, load the `retrospective` skill and follow it before closing out.
23+
24+
---
25+
26+
## Memory
27+
28+
Global memory is `~/.agents/AGENTS.md` (source: `~/.local/share/chezmoi/home/dot_agents/AGENTS.md`).
29+
Local memory is the `AGENTS.md` in the current project root (or nearest ancestor).
30+
31+
Never edit `~/.agents/AGENTS.md` directly; it is chezmoi-managed. Load the `memory` skill for all writes.
32+
33+
For rules specific to the chezmoi dotfiles repo itself, the target is `~/.local/share/chezmoi/AGENTS.md`.
34+
35+
When updating any memory file: review nearby rules for contradictions, duplication, and scope conflicts; reconcile in the same edit. Keep cross-cutting rules in global memory; keep project-specific rules in local memory.
36+
37+
---
38+
39+
## Git and commits
40+
41+
- Load `git-commit-push` for commit or push operations.
42+
- Before committing, run `git diff --staged` and confirm the change is atomic and in-scope. Do not commit unrelated modifications.
43+
- Commit message format: `type(scope): description`. Types: `feat`, `fix`, `chore`. Check `git log --oneline` to match repo style.
44+
45+
---
46+
47+
## Shell discipline
48+
49+
- Prefer the smallest atomic command that completes the immediate next step. Do not chain concerns across policy boundaries.
50+
- Keep source edits, `chezmoi apply`, and git operations as separate commands unless a later step strictly depends on the previous one within the same concern.
51+
- Destructive or policy-sensitive actions should be isolated so intent is easy to inspect.
52+
- Do not check whether a directory exists before using it. Attempt the operation; create the directory if it fails.
53+
- On Windows, when admin rights are required, launch elevated commands with `Start-Process -Verb RunAs` instead of failing back to manual instructions.
54+
55+
---
56+
57+
## Toolchain
58+
59+
- When a CLI can be managed by `mise`, run it through `mise x -- <command>`. Do not invoke managed tools directly.
60+
- When `chezmoi apply` triggers a brew bundle run (via an onchange script), treat it as fire-and-forget once the apply succeeds.
61+
- If `chezmoi apply` fails because an unrelated template needs a secret (e.g. Bitwarden locked), apply only the file you need with `chezmoi apply <target-path>` to bypass the failing template.

home/dot_config/opencode/skills/create-opencode-skill/SKILL.md renamed to home/dot_agents/skills/create-skill/SKILL.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
name: create-opencode-skill
3-
description: Author and maintain OpenCode skills with valid frontmatter, correct placement, and global-memory integration. Use when asked to create, update, or document a skill workflow.
2+
name: create-skill
3+
description: Author and maintain agent skills with valid frontmatter, correct placement, and global-memory integration. Use when asked to create, update, or document a skill workflow.
44
---
55

66
## Purpose
77

8-
Create high-quality OpenCode skills that are discoverable, accurate, and maintainable.
8+
Create high-quality agent skills that are discoverable, accurate, and maintainable.
99

1010
## Canonical references
1111

1212
Before writing or changing a skill, verify format and behavior from official docs:
1313

1414
- <https://opencode.ai/docs/skills/>
15-
- Use existing local skills in `~/.config/opencode/skills/*/SKILL.md` as style references.
15+
- Use existing skills in `~/.agents/skills/*/SKILL.md` as style references.
1616

1717
Do not invent frontmatter fields or naming rules.
1818

@@ -40,14 +40,13 @@ Description constraints:
4040
## Authoring workflow
4141

4242
1. Identify target location:
43-
- Global skills: `~/.local/share/chezmoi/home/dot_config/opencode/skills/`
43+
- Universal skills (shared across all coding agents): `~/.local/share/chezmoi/home/dot_agents/skills/`
44+
- Tool-specific skills (e.g. OpenCode-only): `~/.local/share/chezmoi/home/dot_config/<tool>/skills/`
4445
2. Create skill directory and `SKILL.md`.
4546
3. Write concise instructions with concrete command patterns and guardrails.
4647
4. Include a self-improvement loop section so the skill is updated when better steps are found.
47-
5. If introducing a new recurring workflow skill, update global memory in `~/.local/share/chezmoi/home/dot_config/opencode/AGENTS.md`:
48-
- Add row in the skills table.
49-
- Add a short trigger line in the relevant section.
50-
6. Verify deployed files under `~/.config/opencode/...` after `chezmoi apply`.
48+
5. If the skill introduces rules that belong in global memory, update `~/.local/share/chezmoi/home/dot_agents/AGENTS.md`.
49+
6. Verify deployed files after `chezmoi apply`.
5150

5251
## Content quality checklist
5352

@@ -60,9 +59,9 @@ Description constraints:
6059
## Guardrails
6160

6261
- For AGENTS.md edits, load and follow the `memory` skill first.
63-
- Do not edit `~/.config/opencode/AGENTS.md` directly, update chezmoi source and apply.
62+
- Do not edit deployed files directly, update chezmoi source and apply.
6463
- Do not remove existing memory rules unless explicitly requested.
6564

6665
## Self-improvement loop
6766

68-
After each skill-authoring task, capture any improvements in structure, validation, or memory-integration steps by updating this file: `home/dot_config/opencode/skills/create-opencode-skill/SKILL.md`.
67+
After each skill-authoring task, capture any improvements in structure, validation, or memory-integration steps by updating this file: `home/dot_agents/skills/create-skill/SKILL.md`.

home/dot_config/opencode/skills/dotfiles/SKILL.md renamed to home/dot_agents/skills/dotfiles/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ Use this skill as a dispatcher:
3131

3232
- **Zsh:** `home/dot_config/zsh/``dot_zshrc`, `dot_zshenv`, `dot_zprofile`, `dot_zplugins`, `dot_zshrc.d/`, `dot_zfunctions/`, `dot_p10k.zsh`. Top-level `home/dot_zshenv` and `home/dot_profile` set `ZDOTDIR`/`XDG_CONFIG_HOME`.
3333
- **Neovim:** `home/dot_config/nvim/` (LazyVim-style).
34+
- **Universal agent rules:** `home/dot_agents/AGENTS.md` — edit here, not at `~/.agents/AGENTS.md`.
35+
- **Universal agent skills:** `home/dot_agents/skills/` — shared across all coding agents.
3436
- **OpenCode config:** `home/dot_config/opencode/opencode.jsonc.tmpl`.
35-
- **OpenCode global rules:** `home/dot_config/opencode/AGENTS.md`edit here, not at `~/.config/opencode/AGENTS.md`.
37+
- **OpenCode-specific rules:** `home/dot_config/opencode/AGENTS.md`OpenCode-only rules and context-mode routing.
3638
- **OpenCode data overlays:** `home/.chezmoidata/agent-permissions/` and `home/.chezmoidata/mcps/`.
3739
- **WezTerm:** `home/dot_config/wezterm/wezterm.lua` — Windows only (ignored on non-Windows).
3840
- **Scripts:** `home/dot_scripts/` — deployed to `~/.scripts/` which is on PATH.

home/dot_config/opencode/skills/git-commit-push/SKILL.md renamed to home/dot_agents/skills/git-commit-push/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,6 @@ After each use, run this loop before ending the task:
111111
- Credential-helper failures (`gh: command not found`, helper not executable in shell).
112112
- Rebase/push branches not handled by the current instructions.
113113
2. If a pattern appears, update this skill in chezmoi source:
114-
- `home/dot_config/opencode/skills/git-commit-push/SKILL.md`
114+
- `home/dot_agents/skills/git-commit-push/SKILL.md`
115115
3. Keep updates concrete, command-level, and minimal.
116116
4. Re-run the failing step once to validate the skill update.

home/dot_config/opencode/skills/memory/SKILL.md renamed to home/dot_agents/skills/memory/SKILL.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
name: memory
3-
description: Persist rules, conventions, or lessons into AGENTS.md files so future sessions benefit. Load this skill before writing to global memory (~/.config/opencode/AGENTS.md) or any project AGENTS.md.
3+
description: Persist rules, conventions, or lessons into AGENTS.md files so future sessions benefit. Load this skill before writing to global memory (~/.agents/AGENTS.md) or any project AGENTS.md.
44
---
55

66
## The two memory targets
77

8-
**Global memory** (`~/.config/opencode/AGENTS.md`) — rules that apply to every OpenCode session across every project.
9-
Source: `~/.local/share/chezmoi/home/dot_config/opencode/AGENTS.md`
8+
**Global memory** (`~/.agents/AGENTS.md`) — rules that apply to every coding session across every project.
9+
Source: `~/.local/share/chezmoi/home/dot_agents/AGENTS.md`
1010

1111
**Local memory** (`AGENTS.md` in the current project root or nearest ancestor) — rules specific to that codebase.
1212
Source: edit that file directly; it is not managed by chezmoi.
@@ -15,14 +15,14 @@ For rules specific to the chezmoi dotfiles repo itself, use `~/.local/share/chez
1515

1616
## Updating global memory
1717

18-
1. Read `~/.local/share/chezmoi/home/dot_config/opencode/AGENTS.md`.
18+
1. Read `~/.local/share/chezmoi/home/dot_agents/AGENTS.md`.
1919
2. Edit it with the Edit tool. Never write from scratch; always preserve existing content.
2020
3. Run `chezmoi apply` to deploy.
2121
4. Commit and push:
2222

2323
```sh
24-
git -C ~/.local/share/chezmoi add home/dot_config/opencode/AGENTS.md
25-
git -C ~/.local/share/chezmoi commit -m "chore(opencode): <description>"
24+
git -C ~/.local/share/chezmoi add home/dot_agents/AGENTS.md
25+
git -C ~/.local/share/chezmoi commit -m "chore(agents): <description>"
2626
git -C ~/.local/share/chezmoi pull --rebase
2727
git -C ~/.local/share/chezmoi push
2828
```
@@ -35,7 +35,7 @@ For rules specific to the chezmoi dotfiles repo itself, use `~/.local/share/chez
3535

3636
## Quality rules
3737

38-
- Never edit `~/.config/opencode/AGENTS.md` directly; it is managed by chezmoi.
38+
- Never edit `~/.agents/AGENTS.md` directly; it is managed by chezmoi.
3939
- Never remove existing rules unless explicitly instructed.
4040
- Review nearby rules for contradictions, duplication, and scope conflicts; reconcile in the same edit.
4141
- Keep rules at the narrowest correct scope: cross-cutting rules in global memory, project-specific rules in local memory.
File renamed without changes.

home/dot_claude/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@~/.agents/AGENTS.md

0 commit comments

Comments
 (0)