docs(agent): bb-driven per-workspace convention discovery (#25)#20
Conversation
…25 part B) Part B of #25 — the upstream-template + README half (Part A populated the local ~/.claude/agents/bitbucket.md from bb discovery; that's machine-local and not in this repo). agents/bitbucket.md (generic template): - Rename "Project-specific conventions" → "Per-workspace conventions" and restructure from a single flat block to a per-workspace template (one block per workspace slug + a top-level default for repo-less commands), matching the multi-workspace resolution model shipped in v1.2.0. - Add the read-only `bb` discovery survey (workspaces / repo / pipelines / branches / vars / pr) that derives every field, so populating the section is a mechanical survey, not a from-memory guess. - New operating principle #6 "Populating conventions from bb": when delegated work in a workspace with no block yet, the agent runs the survey and proposes a filled-in block for confirmation rather than interrogating the user. Real values → local copy only, never upstream. README (agent-install section): - Step 2 now shows the bb discovery commands to populate the per-workspace blocks instead of "fill in from memory". - Renamed all "Project-specific conventions" references to "Per-workspace conventions"; updated the with-agent comparison-table row to "reads or bb-discovers and proposes" the block. No code changes — docs only. 388 pytest tests still pass.
|
Claude finished @daniel-pittman's task in 3m 56s —— View job Code Review — PR #20 (
|
| Doc claim | Verified against bb |
|---|---|
bb workspaces enumerates workspaces |
cmd_workspaces exists (bb:1243, case workspaces|ws) |
bb -w <ws> repos |
global -w/--workspace flag parsed pre-dispatch (bb:1589-1609) + cmd_repos (bb:1312) |
bb repos shows recency |
sorts -updated_on, UPDATED column (bb:1318-1320) — "(+ recency)" accurate |
bb repo → "Main branch" field |
literal label " Main branch: " (bb:1349) ✅ |
bb pipelines → TRIGGER column |
TRIGGER header (bb:355); value is selector.pattern // trigger.name — "filter out plain branch names" caveat is correct |
bb branches → branch naming |
cmd_branches exists (bb:1145) |
bb vars → SECURED=true rows |
SECURED column renders .secured | tostring → true/false (bb:1407-1418) ✅ |
bb pr <id> → reviewers / author |
cmd_pr_view prints Author, Reviewers, Approvals (bb:828, 840-845) ✅ |
No real workspace data. Only generic placeholders appear (acme/widget-service, deploy-prod, <slug>, <ws>, <repo>). The "real values → local copy only" guardrail is reinforced in both files.
The restructure into per-workspace blocks + the new operating principle #6 are internally consistent (the cross-reference "see 'Populating conventions from bb' under Operating principles" matches the new ### 6. heading).
Minor findings (terminology drift — non-blocking)
The PR renames "Project-specific conventions" → "Per-workspace conventions" everywhere except two spots in README.md that the rename missed:
-
README.md:322— still reads "…and the project-conventions checklist for tracking per-workspace defaults." This line is doubly stale: the section is no longer a flat checklist (it's now a per-workspace template), and the name no longer matches. Consider: "…and the per-workspace conventions block for tracking each workspace's defaults."
Fix this → -
README.md:365— the comparison-table row label is still**Project conventions**though its value cell was updated to reference the "Per-workspace conventions" block. Minor; arguably fine as a generic category name, but inconsistent with the PR's rename intent.
Neither is a correctness bug — both are cosmetic consistency nits. The substance (commands, labels, guardrails) is accurate and ships-ready.
Note:
--commentwas requested, but inline PR-review comments aren't available in this mode (I can only update this single comment), so findings are consolidated here.
Two spots the rename missed (cosmetic terminology drift): - README:322 — "project-conventions checklist for tracking per-workspace defaults" → "per-workspace conventions block for tracking each workspace's defaults" (no longer a flat checklist; it's a per-workspace template now). - README comparison-table row label "Project conventions" → "Per-workspace conventions" (its value cell was already updated). Docs-only, no code touched.
|
Claude finished @daniel-pittman's task in 3m 7s —— View job Code Review — PR #20 (
|
| Doc claim | Verified |
|---|---|
bb workspaces enumerates workspaces |
cmd_workspaces (bb:1243), case workspaces|ws (bb:1652) |
bb -w <ws> repos |
-w/--workspace parsed pre-dispatch (bb:1591-1595); cmd_repos (bb:1312) |
bb repos "(+ recency)" |
sorts sort=-updated_on, UPDATED column (bb:1318-1320) |
bb repo → "Main branch" |
literal label (bb:1349) |
bb pipelines → TRIGGER col |
header (bb:355); value .target.selector.pattern // .trigger.name // "-" (bb:365) — "filter out plain branch names" caveat is correct |
bb branches → naming convention |
cmd_branches prints BRANCH sorted -target.date (bb:1145-1167) |
bb vars → SECURED=true rows |
SECURED column (bb:1407) |
bb pr <ws>/<repo> <id> → reviewers/author |
cmd_pr_view prints Reviewers/Approvals (bb:811, 840, 852), case pr|pr-view (bb:1638) |
Prior findings — resolved by cfcd6da ✅
README.md:322now reads "…the per-workspace conventions block for tracking each workspace's defaults."README.md:365table row relabeled toPer-workspace conventions.grepforProject-specific/Project conventionsacross both files returns zero hits — rename is complete.
No real workspace data ✅
Only generic placeholders (acme/widget-service, deploy-prod, <slug>, <ws>, <repo>). The "real values → local copy only" guardrail is reinforced in both files. Operating principle #6 is numbered correctly after 1–5 (agents/bitbucket.md:145) and its cross-reference at line 274 matches the heading.
Minor (non-blocking)
-
"Main branch = default destination branch" is imperfect for GitFlow repos.
bb reposurfaces the repo'smainbranch(bb:1349), but a GitFlow workspace — like this very repo, where PRs targetdevelopwhilemainbranchismain— takes PRs against a different branch than the survey would suggest. The template field is a placeholder hint and principle Phase 4.5: git_ops — git-context wrappers for the MCP agent #6 is propose-and-confirm, so this self-corrects in practice; consider a one-line caveat (e.g. "verify against the team's PR base — GitFlow repos often targetdevelop, notmainbranch").
Fix this → -
Survey list differs slightly between the two locations. The conventions-section survey (
agents/bitbucket.md:258-266) includesbb -w <ws> repos, but principle Phase 4.5: git_ops — git-context wrappers for the MCP agent #6 (bb:147-153) omits it. Harmless — Phase 4.5: git_ops — git-context wrappers for the MCP agent #6 is about deriving fields, not enumerating repos — but worth aligning if you want them identical.
Neither affects correctness. Substance (commands, labels, guardrails, rename) is accurate and ship-ready.
Note on
--comment: inline PR-review comments aren't available in this mode — I can only update this single comment, so findings are consolidated here.
1. The "Main branch = default destination branch" survey hint is imperfect for GitFlow repos — bb repo surfaces mainbranch, but a GitFlow workspace (including this repo: mainbranch=main, PRs target develop) takes PRs against a different branch. Added a one-line "verify the PR base — GitFlow repos target develop" caveat in the conventions-section survey, operating-principle #6, and the README install step. 2. Aligned operating-principle #6's survey list with the conventions-section list (added the missing `bb -w <ws> repos` step). Docs-only; non-blocking polish on an already-ship-ready PR.
|
Claude finished @daniel-pittman's task in 3m 15s —— View job Code Review — PR #20 (
|
| Doc claim | Verified |
|---|---|
bb repo → "Main branch" field |
literal label " Main branch: " → .mainbranch.name (bb:1349) |
bb pipelines → TRIGGER column |
header (bb:355); value .target.selector.pattern // .trigger.name // "-" (bb:365) — "filter out plain branch names" caveat correct (branch is the separate BRANCH/ref_name column) |
bb vars → SECURED=true rows |
SECURED column → .secured | tostring (bb:1407,1414) |
bb workspaces / bb -w <ws> repos / bb branches / bb pr <ws>/<repo> <id> |
confirmed in the two prior reviews; unchanged by this commit |
Internal consistency ✅
Principle #6 is numbered correctly after 1–5 (bb:145); its cross-reference (bb:276-277, "see 'Populating conventions from bb' under Operating principles") matches the heading. README round-1 nits stay resolved (README:322 reads "per-workspace conventions block…"; comparison-table row relabeled).
No real workspace data ✅
Placeholders only (acme/widget-service, deploy-prod, v*, feature/TICKET-NNN-…, <slug>, <ws>, <repo>). The "real values → local copy only" guardrail is reinforced in both files.
Minor (non-blocking, optional)
-
The GitFlow caveat doesn't travel with the copy-per-workspace template. The template field that users actually paste (
agents/bitbucket.md:285) still reads "Default destination branch: (frombb repo→ Main branch)" — i.e. it reintroduces the exactmainbranch= destination-branch conflation that the caveat at:268-269/ principle Phase 4.5: git_ops — git-context wrappers for the MCP agent #6 just warned against. A reader who copies only the template block loses the warning. Consider appending "— but confirm the actual PR base" to that field so it's self-contained.
Fix this → -
The "copy per workspace" block bundles a once-only field. The block at
agents/bitbucket.md:281-291is introduced as "Template — copy per workspace" but begins with the top-level**Default workspace**line (:282), which is not per-workspace. Copying the block verbatim for each workspace would produce N duplicate "Default workspace" lines. Minor — splitting the top-level default out of the per-workspace### Workspace:block would make the "copy per workspace" instruction literally correct.
Fix this →
Neither affects correctness. The substance — commands, output labels, GitFlow caveat, survey alignment, rename, guardrails — is accurate and ship-ready.
Note on
--comment: inline PR-review comments aren't available in this mode, so findings are consolidated in this single comment rather than posted inline.
Completes the round-2 nit fix — the prior commit applied the caveat to agents/bitbucket.md but the README edit raced a concurrent file change and was dropped. Mirrors the same 'verify PR base; GitFlow repos target develop' note in the README install step.
Two spots the rename missed (cosmetic terminology drift): - README:322 — "project-conventions checklist for tracking per-workspace defaults" → "per-workspace conventions block for tracking each workspace's defaults" (no longer a flat checklist; it's a per-workspace template now). - README comparison-table row label "Project conventions" → "Per-workspace conventions" (its value cell was already updated). Docs-only, no code touched.
1. The "Main branch = default destination branch" survey hint is imperfect for GitFlow repos — bb repo surfaces mainbranch, but a GitFlow workspace (including this repo: mainbranch=main, PRs target develop) takes PRs against a different branch. Added a one-line "verify the PR base — GitFlow repos target develop" caveat in the conventions-section survey, operating-principle #6, and the README install step. 2. Aligned operating-principle #6's survey list with the conventions-section list (added the missing `bb -w <ws> repos` step). Docs-only; non-blocking polish on an already-ship-ready PR.
|
Claude finished @daniel-pittman's task in 3m 27s —— View job Code Review — PR #20 (
|
| Doc claim | Verified against bb |
|---|---|
bb workspaces enumerates workspaces |
cmd_workspaces (bb:1243), case workspaces|ws (bb:1652) |
bb -w <ws> repos |
-w/--workspace parsed pre-dispatch (bb:1591) |
bb repo → "Main branch" |
literal label " Main branch: " + (.mainbranch.name // "n/a") (bb:1349) |
bb pipelines → TRIGGER col |
header (bb:355); value .target.selector.pattern // .trigger.name // "-" (bb:365) — "filter out plain branch names" caveat is correct (branch-triggered runs surface the branch name here) |
bb branches → naming convention |
cmd_branches (bb:1145), case branches|br (bb:1648) |
bb vars → SECURED=true rows |
SECURED column (bb:1407) |
bb pr <ws>/<repo> <id> → reviewers/author |
cmd_pr_view prints Author/Reviewers/Approvals (bb:828, 840, 852), case pr|pr-view (bb:1638) |
Prior review findings — all resolved ✅
-
GitFlow "Main branch" caveat (round-2 finding Add OSS hardening: CI, Claude reviews, CODEOWNERS, SECURITY, CONTRIBUTING #1) — now present in all three survey locations:
agents/bitbucket.md:153(principle Phase 4.5: git_ops — git-context wrappers for the MCP agent #6) and:268-269(conventions section): "verify the actual PR base; GitFlow repos take PRs againstdevelop, not themainbranch"README.md:337(this PR's new commit1ca1bd8): "Main branch (verify PR base; GitFlow repos target develop)"
The caveat is well-motivated and self-referential: this very repo surfaces
mainbranch=mainviabb repo(bb:1349) yet takes PRs againstdevelop. Combined with principle Phase 4.5: git_ops — git-context wrappers for the MCP agent #6 being propose-and-confirm, the placeholder hint self-corrects in practice. -
Survey-list alignment (round-2 finding Phase 4.1: bb_api.py + Python test infrastructure (MCP foundation) #2) — principle Phase 4.5: git_ops — git-context wrappers for the MCP agent #6 (
agents/bitbucket.md:151-157) and the conventions section (:266-273) now list the same seven commands, includingbb -w <ws> reposandbb pr. Aligned. -
Cross-reference at
agents/bitbucket.md:276("see 'Populating conventions frombb' under Operating principles") matches the### 6.heading at:145. ✅
No real workspace data ✅
Only generic placeholders (acme/widget-service, deploy-prod, <slug>, <ws>, <repo>). The "real values → local ~/.claude/agents/ copy only, never upstream" guardrail is reinforced in both files (agents/bitbucket.md:293-296, README.md:324).
Minor (non-blocking, already merged)
- README install survey omits
bb pr. The condensed survey inREADME.md:333-342stops atbb varsand doesn't listbb pr <ws>/<repo> <id>, whereas the agent file's two surveys both include it. This is defensible — the README step explicitly defers to "the template at the bottom of the agent file" — but since round 2 aligned the two in-agent lists, you may want the README to match for consistency. Purely cosmetic; the substance is complete.
Substance — commands, output labels, guardrails, the rename, and the GitFlow caveat — is accurate and consistent. Clean docs-only change; nothing blocking.
Note on
--comment: inline PR-review comments aren't available in this mode, so findings are consolidated in this single comment.
Two spots the rename missed (cosmetic terminology drift): - README:322 — "project-conventions checklist for tracking per-workspace defaults" → "per-workspace conventions block for tracking each workspace's defaults" (no longer a flat checklist; it's a per-workspace template now). - README comparison-table row label "Project conventions" → "Per-workspace conventions" (its value cell was already updated). Docs-only, no code touched.
1. The "Main branch = default destination branch" survey hint is imperfect for GitFlow repos — bb repo surfaces mainbranch, but a GitFlow workspace (including this repo: mainbranch=main, PRs target develop) takes PRs against a different branch. Added a one-line "verify the PR base — GitFlow repos target develop" caveat in the conventions-section survey, operating-principle #6, and the README install step. 2. Aligned operating-principle #6's survey list with the conventions-section list (added the missing `bb -w <ws> repos` step). Docs-only; non-blocking polish on an already-ship-ready PR.
Summary
Part B of #25 — documents the pattern for populating the agent's per-workspace conventions using
bbitself. (Part A — populating the maintainer's local~/.claude/agents/bitbucket.mdfrom real workspace discovery — is machine-local and not in this repo.)Now that v1.2.0 ships
bb workspaces+ workspace auto-detect, the agent's conventions section can be a mechanical bb-driven survey instead of a from-memory guess.agents/bitbucket.md(generic template)bb workspaces/bb repo/bb pipelines/bb branches/bb vars/bb pr) that derives every field, with a copy-per-workspace markdown template.bb": when delegated work in a workspace with no block yet, the agent runs the survey and proposes a filled-in block for confirmation rather than interrogating the user. Real values → local copy only.README.md(agent-install section)bbdiscovery commands to populate the per-workspace blocks.Stays fully generic — placeholders only, with the standard "real values belong in your local
~/.claude/agents/copy, never upstream" guardrail reinforced.Test plan
pytest— 388 tests pass (docs-only; no code touched)Closes #25.