buddy-agent-harness 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/.cursor-plugin/plugin.json +1 -1
  4. package/CHANGELOG.md +19 -0
  5. package/dist/cli.mjs +86 -9
  6. package/dist/index.d.mts +10 -3
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +92 -8
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/skill-scripts/doctor.mjs +27 -27
  11. package/dist/skill-scripts/init.mjs +27 -27
  12. package/dist/skill-scripts/mcp.mjs +27 -27
  13. package/llms.txt +6 -5
  14. package/package.json +2 -1
  15. package/plugin.json +1 -1
  16. package/skills/doctor-buddy-agent-harness/README.md +1 -1
  17. package/skills/doctor-buddy-agent-harness/SKILL.md +9 -2
  18. package/skills/doctor-buddy-agent-harness/references/worktrees.md +17 -0
  19. package/skills/doctor-buddy-agent-harness/scripts/doctor.mjs +27 -27
  20. package/skills/enhance/SKILL.md +18 -10
  21. package/skills/enhance/references/agent-worktrees.md +59 -0
  22. package/skills/enhance/references/references-as-links.history.md +9 -0
  23. package/skills/enhance/references/references-as-links.md +76 -0
  24. package/skills/enhance/scripts/doctor.mjs +27 -27
  25. package/skills/init-buddy-agent-harness/SKILL.md +8 -5
  26. package/skills/init-buddy-agent-harness/references/agent-worktrees.md +59 -0
  27. package/skills/init-buddy-agent-harness/scripts/doctor.mjs +27 -27
  28. package/skills/init-buddy-agent-harness/scripts/init.mjs +27 -27
  29. package/skills/repair/README.md +2 -2
  30. package/skills/repair/SKILL.md +3 -3
  31. package/skills/repair/scripts/doctor.mjs +27 -27
  32. package/skills/repair/scripts/mcp.mjs +27 -27
  33. package/src/diagnose-bridges/doctor-guidance.ts +66 -1
  34. package/src/diagnose-bridges/doctor.command.ts +2 -0
  35. package/src/diagnose-bridges/git-bridge-state.ts +5 -0
  36. package/src/diagnose-worktrees/diagnose-worktrees.ts +69 -0
  37. package/src/index.ts +1 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: enhance
3
- description: Use this skill when a repository already has an AGENTS.md and you want to add guidance it is missing, or to refresh a vetted section it carries in an outdated form — offering each one at a time and writing only what the user approves. Runs on its own or straight after init.
3
+ description: Adds guidance missing from a repository's existing AGENTS.md, or refreshes a vetted section it carries in an outdated form — offering each one at a time and writing only what the user approves. Runs on its own or straight after init.
4
4
  argument-hint: '[--root <dir>]'
5
5
  ---
6
6
 
@@ -12,13 +12,15 @@ The split matters: initialization has to run everywhere and invent nothing, so i
12
12
 
13
13
  Every addition is **offered, never written on sight**. An addition asserts something about how the repository is worked in — it stays true whether or not this tool ever ran — so it is material under the rule in `references/agents-md.md`, and material content needs approval. Nothing here goes inside the `buddy-agent-harness` managed region; that region is for the tool's own bookkeeping.
14
14
 
15
- Three additions ship today: `references/delegation.md`, `references/list-identifiers.md`, and `references/session-scope.md`. Classify, offer, and report each one on its own; the owner's answer to one decides nothing about the others. Each addition's reference file carries the text to offer, a `## Covered when` criterion for the subject already being present, a `## Stale when` section naming the history file its stale check reads and what else that check needs for this addition, and a `## Where it belongs` recommendation naming which instruction file the text should go in. The retired wordings themselves are kept beside it — `references/<addition>.history.md` — and are what a present section is compared against.
15
+ Four additions ship today: `references/delegation.md`, `references/list-identifiers.md`, `references/session-scope.md`, and `references/references-as-links.md`. Classify, offer, and report each one on its own; the owner's answer to one decides nothing about the others. Each addition's reference file carries the text to offer, a `## Covered when` criterion for the subject already being present, a `## Stale when` section naming the history file its stale check reads and what else that check needs for this addition, and a `## Where it belongs` recommendation naming which instruction file the text should go in. The retired wordings themselves are kept beside it — `references/<addition>.history.md` — and are what a present section is compared against.
16
+
17
+ Beside the additions, it offers the two **agent-worktree settings** in `references/agent-worktrees.md`: lines in `.gitignore`, a tool config, and `.claude/settings.json` rather than prose in `AGENTS.md`. Step 6 is theirs, and they are the only writes this skill makes outside the root `AGENTS.md`.
16
18
 
17
19
  ## 1. Find the instruction file
18
20
 
19
21
  Where the invocation names `--root <dir>`, that directory is the repository: read and write inside it only. Otherwise locate the Git repository root. The target is the root `AGENTS.md`.
20
22
 
21
- If there is no root `AGENTS.md`, stop and say so. This skill adds to an existing file; creating one is `init`'s job, so point there and write nothing. Still report in full as step 6 says — what you read, that nothing was written — with **not judged** as each addition's verdict.
23
+ If there is no root `AGENTS.md`, stop and say so. This skill adds to an existing file; creating one is `init`'s job, so point there and write nothing. Still report in full as step 7 says — what you read, that nothing was written — with **not judged** as each addition's verdict.
22
24
 
23
25
  A nested `AGENTS.md` is never a target. It governs its own subtree, and none of these additions are subtree-scoped.
24
26
 
@@ -108,7 +110,7 @@ A section from a retired wording in a file that is **not** the root `AGENTS.md`
108
110
 
109
111
  Where an addition is **absent**, show its text **verbatim** — the whole thing, not a summary — say where it would go, and ask.
110
112
 
111
- **Where it goes is part of the offer, and the addition decides it.** Read its `## Where it belongs` and lead with what that section recommends. An addition whose subject is the repository belongs in the repository's `AGENTS.md`; one whose subject is how the agent works belongs in the owner's own global instruction file, because it holds in every repository they open and a copy per repository is a copy per repository to keep in step. Delegation, list identifiers, and session scope are all the second kind, and their references recommend the global file.
113
+ **Where it goes is part of the offer, and the addition decides it.** Read its `## Where it belongs` and lead with what that section recommends. An addition whose subject is the repository belongs in the repository's `AGENTS.md`; one whose subject is how the agent works belongs in the owner's own global instruction file, because it holds in every repository they open and a copy per repository is a copy per repository to keep in step. Delegation, list identifiers, session scope, and references as links are all the second kind, and their references recommend the global file.
112
114
 
113
115
  The global file is `~/.agents/AGENTS.md`, the user-scope counterpart of the root `AGENTS.md`. No harness reads it by itself; a harness reads it only where a user-scope instruction file of its own loads it. **Say whether the harness in use does**, and do not judge that yourself — `doctor` owns the check:
114
116
 
@@ -116,7 +118,7 @@ The global file is `~/.agents/AGENTS.md`, the user-scope counterpart of the root
116
118
  node scripts/doctor.mjs
117
119
  ```
118
120
 
119
- That path is relative to this skill's own directory; fall back to `npx -y buddy-agent-harness@1.1.0 doctor` when it is missing or cannot be run. Read the `globalInstructions` row for the harness you are running in:
121
+ That path is relative to this skill's own directory; fall back to `npx -y buddy-agent-harness@1.2.0 doctor` when it is missing or cannot be run. Read the `globalInstructions` row for the harness you are running in:
120
122
 
121
123
  - **`ok`** — say that this harness loads `~/.agents/AGENTS.md`, through the file the row names.
122
124
  - **`missing` or `unbridged`** — say that it does not yet, so the text would reach no session of this harness until it does. Name the file the row gives, and hand over the step that bridges it beside the text: `references/global-instructions.md` names it per harness, and where `doctor` reported a finding for that file, its `help` row carries the same step. Where the row is `unbridged` and the step is a symlink, say that what the file holds moves into `~/.agents/AGENTS.md` first.
@@ -144,7 +146,7 @@ Where you **cannot tell**, say that first, in those words. Then show three texts
144
146
 
145
147
  Put the third every time the repository can actually do it, because the owner may not remember either, and the question they care about is not where the section came from but **which wording serves them better**. Provenance is a stand-in for that; when the stand-in fails, ask the real question.
146
148
 
147
- Measurement means running each wording against a set of real tasks and comparing how the agent behaves — whatever harness this repository has for that addition's wording. In this package's own repository `eval-delegation` scores Delegation's and `eval-list-identifiers` scores List identifiers'; Session scope has none, and a consumer repository will have its own or none. **Look before you offer it.** Where the repository has no harness for that addition, say the third answer would need one it does not have, and put the other two.
149
+ Measurement means running each wording against a set of real tasks and comparing how the agent behaves — whatever harness this repository has for that addition's wording. In this package's own repository `eval-delegation` scores Delegation's and `eval-list-identifiers` scores List identifiers'; Session scope and References as links have none, and a consumer repository will have its own or none. **Look before you offer it.** Where the repository has no harness for that addition, say the third answer would need one it does not have, and put the other two.
148
150
 
149
151
  **Ask before running it, and never run it unasked** — it is many model runs, and the owner is the one paying for them.
150
152
 
@@ -169,9 +171,15 @@ On approval of a **removal**, remove that one section — from its heading throu
169
171
 
170
172
  On a decline, write nothing. A declined replacement leaves the section exactly where it stands, and so does an unanswered question.
171
173
 
172
- ## 6. Report
174
+ ## 6. Offer the agent-worktree settings
175
+
176
+ Where Claude Code is in use — a `.claude/` directory exists — read `references/agent-worktrees.md` and judge **P1**, ignoring `.claude/worktrees/`, and **P2**, setting `worktree.baseRef` to `"head"`, against the files that page names. Each is covered, or offered on its own, one line per file, with P2's trade-off explained before you ask. On approval, write exactly the line approved into that file and leave every other byte of it as it was: change the one key or array element, keep key order, indentation, and comments. On a decline, write nothing.
177
+
178
+ These are settings, not additions. They have no history file, no global destination, and no `prose-update` comparison: a line is there or it is not. Where no `AGENTS.md` exists the run stops at step 1 and offers neither; `init`, which it points to, offers both.
179
+
180
+ ## 7. Report
173
181
 
174
- Report every run, whichever way it went: what you read, the verdict for each addition and why — already global, already current, absent, the owner's own, from a retired wording, undecidable, or not judged — what you offered, which destination you recommended, and what was written. For an already-current addition your instructions from outside the repository also carry, say the owner reads it twice. Wherever those instructions cover an addition's subject, name that copy and its verdict. A hand-off for the owner to place globally is an outcome, not a decline; say so. A run that offers nothing still reports — that is the only way the user can tell "already covered" from "did not look".
182
+ Report every run, whichever way it went: what you read, the verdict for each addition and why — already global, already current, absent, the owner's own, from a retired wording, undecidable, or not judged — what you offered, which destination you recommended, and what was written. For an already-current addition your instructions from outside the repository also carry, say the owner reads it twice. Wherever those instructions cover an addition's subject, name that copy and its verdict. A hand-off for the owner to place globally is an outcome, not a decline; say so. Report each agent-worktree offer as written, declined, or already covered, naming the file. A run that offers nothing still reports — that is the only way the user can tell "already covered" from "did not look".
175
183
 
176
184
  ## Rules
177
185
 
@@ -182,5 +190,5 @@ Report every run, whichever way it went: what you read, the verdict for each add
182
190
  - **Never run an evaluation unasked.** It costs the owner many model runs. Offer it; wait.
183
191
  - **Never edit an addition to fit a repository.** The wording is fixed. Offer it as written or not at all.
184
192
  - **Name `~/.agents/AGENTS.md` as the global file.** Name a harness's own user-scope file only where that harness documents it.
185
- - **Never touch the managed region**, a nested `AGENTS.md`, or any file other than the root `AGENTS.md`.
186
- - Local agent configuration only. Do not change workflows, repository settings, or unrelated project files.
193
+ - **Never touch the managed region**, a nested `AGENTS.md`, or any file other than the root `AGENTS.md` — except the agent-worktree lines in step 6, as approved.
194
+ - Local agent configuration only. Do not change workflows, repository settings, or unrelated project files; the agent-worktree lines are the one exception.
@@ -0,0 +1,59 @@
1
+ # Agent worktrees
2
+
3
+ Claude Code runs a session started with `--worktree`, and a subagent isolated in a worktree, in a git worktree under `.claude/worktrees/<name>/` at the repository root, on a branch named `worktree-<name>`. The place is by design: no setting moves it, and only a `WorktreeCreate` hook, which replaces Claude Code's git logic outright, can put worktrees elsewhere. That is rarely worth it, so do not offer it.
4
+
5
+ Each worktree is a whole checkout inside the repository, config files included. A repository that does not account for that pays three ways:
6
+
7
+ - **`git status` lists `.claude/worktrees/` as untracked.** Claude Code does not ignore the directory itself; its documentation tells users to.
8
+ - **Tools that walk the tree find each worktree's config.** Biome stops with "Found a nested root configuration, but there's already a root configuration", and a pre-commit hook running it fails every commit until the worktrees are gone. ESLint, Prettier, knip, and a tsconfig `include` walk the same tree.
9
+ - **Agent worktrees branch from the default branch.** Unless `worktree.baseRef` is `"head"`, a subagent asked to build on a feature branch starts from `main` without that branch's commits, and its work comes back as merge conflicts.
10
+
11
+ Two offers follow. Make them only where Claude Code is in use: a `.claude/` directory exists, or the owner enabled Claude Code in this run. Each is offered on its own, and the owner's answer to one decides nothing about the other.
12
+
13
+ ## P1: ignore the worktree directory
14
+
15
+ **Covered when** `git check-ignore -q .claude/worktrees/` succeeds, and each tool config listed below that the repository has already excludes `.claude/worktrees`. A rule on a parent directory counts. Where that rule is `.claude/` whole, it also ignores `.claude/skills`, which `doctor` reports as `ignored-bridge`; that is `repair`'s, not this offer's.
16
+
17
+ Offer each missing line as its own item, naming the file and showing the line:
18
+
19
+ | File | Line to add |
20
+ | --- | --- |
21
+ | `.gitignore` | `.claude/worktrees/` |
22
+ | `biome.json` or `biome.jsonc` | `"!**/.claude/worktrees"` as an element of `files.includes`; where `files.includes` is absent, `"files": { "includes": ["**", "!**/.claude/worktrees"] }` |
23
+ | `.eslintignore` | `**/.claude/worktrees` |
24
+ | `eslint.config.*` (flat config) | `"**/.claude/worktrees/**"` in a global `ignores` entry |
25
+ | `.prettierignore` | `**/.claude/worktrees` |
26
+ | `knip.json` or `knip.jsonc` | `"**/.claude/worktrees/**"` in `ignore` |
27
+ | `tsconfig.json` whose `include` reaches the repository root | `"**/.claude/worktrees"` in `exclude` |
28
+
29
+ Look for each file; offer only for the files that exist. Biome is the confirmed failure, so lead with it where it is present. A tool set to read `.gitignore`, such as Biome with `vcs.useIgnoreFile`, is still offered its own line: whether it then skips a nested config in an ignored directory is not documented. Say so.
30
+
31
+ A tsconfig whose `include` names only `src` never reaches `.claude/`, so it is covered and needs nothing.
32
+
33
+ **A tsconfig `exclude` replaces the default.** With no `exclude`, TypeScript excludes `node_modules` and the `outDir` by default, and writing an `exclude` drops that default. Where the file has none, offer `["node_modules", "**/.claude/worktrees"]` and name the trade, rather than a one-element list.
34
+
35
+ ## P2: set `worktree.baseRef` to `"head"`
36
+
37
+ **Covered when** the project's `.claude/settings.json` sets `worktree.baseRef` to either value. An explicit `"fresh"` is the owner's answer; offer nothing and say so.
38
+
39
+ Explain the trade-off before asking, in about these words:
40
+
41
+ > Claude Code branches every agent worktree from the repository's default branch on the remote unless `worktree.baseRef` is `"head"`. The default suits agents given tasks unrelated to what you are working on: each starts from a clean tree. It surprises anyone working on a feature branch: an agent asked to build on it starts from `main`, misses its commits, and its work comes back in conflict. `"head"` branches from your current `HEAD` instead, unpushed commits included.
42
+
43
+ Then offer the setting, merged into `.claude/settings.json`:
44
+
45
+ ```json
46
+ {
47
+ "worktree": {
48
+ "baseRef": "head"
49
+ }
50
+ }
51
+ ```
52
+
53
+ The setting accepts only those two values, not a branch name. Write it in the project's `.claude/settings.json`, which is committed, so everyone who clones the repository gets the same base. Where the owner wants it for themselves only, name `.claude/settings.local.json` instead and write there on their approval.
54
+
55
+ ## Writing
56
+
57
+ Edit each file in place, as the rule in the skill says: add the one line, element, or key, and leave every other byte as it was. Create `.gitignore` or `.claude/settings.json` when it is missing; that is still an approved write, so it is offered first like any other.
58
+
59
+ A decline writes nothing. `doctor` reports what is still missing as `worktrees-untracked`, `worktrees-scanned`, and `worktree-base-unset`, so the owner can come back to it.
@@ -0,0 +1,9 @@
1
+ # Superseded wordings: References as links
2
+
3
+ Every wording this addition has retired, newest first, each exactly as it was offered. Read this
4
+ file when a `## References as links` section is already present and reads as covered; it is what
5
+ the section in front of you is compared against.
6
+
7
+ Nothing here is ever offered. The text to offer is in `references-as-links.md`.
8
+
9
+ None yet. This addition still offers its first wording.
@@ -0,0 +1,76 @@
1
+ # Addition: References as links
2
+
3
+ ## Covered when
4
+
5
+ The merged view already tells the agent **to write an issue, pull request, or commit it mentions as
6
+ a link the user can follow, not as a bare number**. Any of these counts:
7
+
8
+ - a rule to write references to issues, pull requests, or commits as Markdown links or full URLs, under any heading
9
+ - a rule that a reference the agent puts to the user names its repository and links to the item's page
10
+
11
+ A convention for commit messages or pull request bodies — "close the issue with `Closes #12`" — is
12
+ not coverage: it governs text GitHub renders, not what the agent puts to the user. Neither is a rule
13
+ to qualify a number with its repository alone, such as `owner/repo#12`, which still leads nowhere
14
+ in a terminal. Neither is a rule that appears only in a skill body — this addition is for the
15
+ always-loaded file.
16
+
17
+ ## Stale when
18
+
19
+ Compare the `## References as links` section already in the file against
20
+ `references-as-links.history.md` by the procedure in step 3 of the skill, with the text below as the
21
+ current text.
22
+
23
+ `references-as-links.history.md` holds no retired wording yet. Until it does, a section that is not
24
+ already current is compared against the text below, standing in for a retired wording: both answers
25
+ yes is this text edited, and gets the replacement offer; both no is the owner's own; a disagreement
26
+ you cannot tell. The paragraphs a replacement would remove are the ones the text below does not
27
+ contain.
28
+
29
+ A section whose example link names a different repository or item is still this text edited when
30
+ its sentences survive: the example is part of the wording, not the owner's own content.
31
+
32
+ Where you cannot tell, the third answer needs a harness that scores this addition's wording, and none
33
+ does: `eval-delegation` scores Delegation's and `eval-list-identifiers` scores List identifiers', and
34
+ neither covers this one. Put two answers, not three, and say settling it by measurement would need a
35
+ harness that does not exist yet.
36
+
37
+ ## Offer this text verbatim
38
+
39
+ ```markdown
40
+ ## References as links
41
+
42
+ Write each issue, pull request, or commit you mention as a Markdown link to its page, such as
43
+ [cyber-agentkit#222](https://github.com/cyber-uni/cyber-agentkit/pull/222), not a bare `#222`. A bare
44
+ number is a link only on GitHub itself; in a terminal or a chat it leads nowhere, and across
45
+ repositories it names the wrong one.
46
+ ```
47
+
48
+ ## Where it belongs
49
+
50
+ **Recommend the owner's own global instruction file, not this repository's `AGENTS.md`.**
51
+
52
+ The text says how to present a reference to the user, which holds in every repository the owner
53
+ opens, so the global file, `~/.agents/AGENTS.md`, is its one home.
54
+
55
+ Offer this repository's `AGENTS.md` as the alternative, and name what each one buys:
56
+
57
+ | Destination | Reaches | Costs |
58
+ | --- | --- | --- |
59
+ | the owner's global file | every repository they open, themselves only | one copy, and nothing to keep in step |
60
+ | this repository's `AGENTS.md` | everyone who clones it, and any agent CI runs | a copy per repository, and a second copy in context for anyone who already has it globally |
61
+
62
+ A global placement is **handed over, not made**: give the text and the path, say it goes at the end
63
+ of that file, and stop there.
64
+
65
+ ## Do not edit it
66
+
67
+ The wording is fixed. In particular, do not swap the example link for one in this repository — the
68
+ section has to hold in every repository it is read in, and an example naming one of them reads as a
69
+ rule about that one. Offer it as written or not at all.
70
+
71
+ If the text is ever revised, the same change must do two things:
72
+
73
+ - append the outgoing wording to `references-as-links.history.md`, newest first, exactly as it was offered;
74
+ - add scenarios for the **shape of that revision** and pass the gate against the new pair.
75
+
76
+ Where the owner picks this repository over their global file, place it at the end of their prose, outside the `buddy-agent-harness` managed region.