Skip to content

manager: named template sets in manager-templates/<name>/ (supersedes #21) - #24

Merged
SawyerHood merged 2 commits into
mainfrom
bb/manager-templates-v2-named-template-sets-in-mana-thr_4rueguy265
May 19, 2026
Merged

SawyerHood merged 2 commits into
mainfrom
bb/manager-templates-v2-named-template-sets-in-mana-thr_4rueguy265

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Summary

Supersedes #21 by replacing the single flat manager-templates/*_TEMPLATE.md layout with named template sets:

  • <dataDir>/manager-templates/<name>/PREFERENCES.md
  • <dataDir>/manager-templates/<name>/STATUS.md or STATUS.html
  • <dataDir>/manager-templates/<name>/ASYNC.md

The seed step copies every regular file from the resolved named template directory into the new manager thread storage directory, preserving filenames and using no-overwrite copy semantics. Missing template directories log a warning and no-op so the normal manager welcome flow continues.

Comparison With #21

#21 added a daemon-side pre-runtime copy hook on its branch in apps/host-daemon/src/command-handlers/thread.ts:58-90, then invoked it before runtime.startThread in apps/host-daemon/src/command-handlers/thread.ts:96-105. This PR keeps the same pre-runtime timing, but replaces the flat PREFERENCES_TEMPLATE.md / STATUS_TEMPLATE.md / ASYNC_TEMPLATE.md model with server-resolved named sets and server-side seeding at apps/server/src/services/threads/thread-commands.ts:276-291.

Design Notes

  • Active template pointer: <dataDir>/manager-templates/active, a single-line file containing the template name. Missing, blank, or invalid active pointers fall back to default (apps/server/src/services/threads/manager-storage-templates.ts:210-247).
  • Built-in install: server startup calls ensureBuiltInManagerTemplatesInstalled at apps/server/src/index.ts:59-62; the installer creates active and installs absent built-in directories without overwriting existing directories (apps/server/src/services/threads/manager-storage-templates.ts:177-207).
  • Built-ins shipped: only default, with short starter PREFERENCES.md, STATUS.md, and ASYNC.md. I did not add a second example to keep the first-run surface small.
  • Canonical filenames confirmed in manager instructions: PREFERENCES.md, STATUS.md, STATUS.html, and ASYNC.md at packages/templates/src/templates/manager-agent-instructions.md:39-43.

--template Wiring

  • CLI flag and request payload: apps/cli/src/commands/manager.ts:69-72 and apps/cli/src/commands/manager.ts:103-112.
  • Public contract field: packages/server-contract/src/api-types.ts:547-557.
  • Manager route passes it into thread creation: apps/server/src/routes/projects.ts:488-530.
  • Thread creation request stores explicit managerTemplateName: apps/server/src/services/threads/thread-create-request.ts:8-22.
  • Provisioning payload preserves it across async environment readiness: apps/server/src/services/threads/thread-provisioning-context.ts:45-52 and apps/server/src/services/threads/thread-provisioning.ts:140-152.
  • Pre-runtime seed resolves and copies just before thread.start is queued: apps/server/src/services/threads/thread-commands.ts:276-291 and apps/server/src/services/threads/manager-storage-templates.ts:250-320.

Tests Added

  • Server route tests for default template copy, active pointer selection, explicit per-spawn override, missing-template no-op, and copying STATUS.html as a regular template file.
  • Server template installer tests for built-in default install and no-overwrite behavior when default/ already exists.
  • CLI test for bb manager hire --template <name> payload and help output.
  • Template prompt test covering the starter/no-preferences wording.

Future Work

A bb manager-templates CLI for listing/showing/editing/setting templates is intentionally deferred.

Validation

  • pnpm exec turbo run typecheck --filter=@bb/domain --filter=@bb/server-contract --filter=@bb/templates --filter=@bb/server --filter=@bb/cli
  • pnpm exec turbo run test --filter=@bb/domain --filter=@bb/server-contract --filter=@bb/templates --filter=@bb/server --filter=@bb/cli
  • git diff --check

@SawyerHood
SawyerHood force-pushed the bb/manager-templates-v2-named-template-sets-in-mana-thr_4rueguy265 branch from cbc3961 to ac42ae2 Compare May 18, 2026 23:54
@SawyerHood
SawyerHood merged commit 20d2479 into main May 19, 2026
10 checks passed
SawyerHood added a commit that referenced this pull request May 19, 2026
….md + STATUS.html)

Replaces the deliberately minimal starter content shipped by #24 with
two richer files reflecting the manager flow that prompted this work:

- PREFERENCES.md captures the delegator workflow and the canonical
  `STATUS.html` convention; worker defaults (provider / reasoning level
  / permission mode / model) are deliberately left as an open question
  for the user to answer, not prescribed by the template. The default
  PR-opening behaviour is `gh pr create --draft`; the user can flip to
  non-draft at any time.
- STATUS.html is the canonical status surface (no STATUS.md): a styled
  zero-state dashboard with an inlined snippet library so a populating
  manager has the section/row/pill patterns to hand. Tokens mirror the
  bb app theme; see `bb guide styling`.

ASYNC.md is intentionally not part of the default seed — a manager can
write its own `ASYNC.md` from the meet-and-greet when it wants
schedules.

Files live alongside the source as real files and are read at module
init via `import.meta.url`; the prod build copies them next to
`dist/index.js` (mirroring the drizzle migrations pattern). The
install/seeding logic from #24 is unchanged — existing
`<dataDir>/manager-templates/default/` directories are still not
overwritten.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
SawyerHood added a commit that referenced this pull request May 19, 2026
….md + STATUS.html)

Replaces the deliberately minimal starter content shipped by #24 with
two richer files reflecting the manager flow that prompted this work:

- PREFERENCES.md captures the delegator workflow and the STATUS.html
  conventions. Worker defaults (provider / reasoning level / permission
  mode / model) are an open question for the user, not prescribed by
  the template. The Workflow section also stays neutral about how
  changes land: a `Landing changes` bullet describes two common modes
  (PRs, with `gh pr create --draft` by default; or local merge with
  push-on-request) and tells the manager to ask once and record the
  choice in the file itself. STATUS.html mode and refresh triggers
  follow from that recorded choice.
- STATUS.html is the canonical status surface (no STATUS.md): a styled
  zero-state dashboard. The HTML comment block at the bottom is a
  snippet library covering PR-mode patterns (PR row, active worker
  row, optional sections) and a clearly-marked no-PR-mode group with
  `In progress` and `Ready for review` section patterns. Tokens mirror
  the bb app theme; see `bb guide styling`.

ASYNC.md is intentionally not part of the default seed — a manager can
write its own `ASYNC.md` from the meet-and-greet when it wants
schedules.

Files live alongside the source as real files and are read at module
init via `import.meta.url`; the prod build copies them next to
`dist/index.js` (mirroring the drizzle migrations pattern). The
install/seeding logic from #24 is unchanged — existing
`<dataDir>/manager-templates/default/` directories are still not
overwritten.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
SawyerHood added a commit that referenced this pull request May 19, 2026
….md + STATUS.html) (#25)

Replaces the deliberately minimal starter content shipped by #24 with
two richer files reflecting the manager flow that prompted this work:

- PREFERENCES.md captures the delegator workflow and the STATUS.html
  conventions. Worker defaults (provider / reasoning level / permission
  mode / model) are an open question for the user, not prescribed by
  the template. The Workflow section also stays neutral about how
  changes land: a `Landing changes` bullet describes two common modes
  (PRs, with `gh pr create --draft` by default; or local merge with
  push-on-request) and tells the manager to ask once and record the
  choice in the file itself. STATUS.html mode and refresh triggers
  follow from that recorded choice.
- STATUS.html is the canonical status surface (no STATUS.md): a styled
  zero-state dashboard. The HTML comment block at the bottom is a
  snippet library covering PR-mode patterns (PR row, active worker
  row, optional sections) and a clearly-marked no-PR-mode group with
  `In progress` and `Ready for review` section patterns. Tokens mirror
  the bb app theme; see `bb guide styling`.

ASYNC.md is intentionally not part of the default seed — a manager can
write its own `ASYNC.md` from the meet-and-greet when it wants
schedules.

Files live alongside the source as real files and are read at module
init via `import.meta.url`; the prod build copies them next to
`dist/index.js` (mirroring the drizzle migrations pattern). The
install/seeding logic from #24 is unchanged — existing
`<dataDir>/manager-templates/default/` directories are still not
overwritten.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
brsbl added a commit that referenced this pull request Aug 13, 2026
…1474)

Ships two BB official plugins in the catalog: **Thread Hover Cards** and
**Prompt Improver**, installable from Extensions → Browse. Timeline
Comments remains in the bb-plugins source stack but is intentionally
excluded from the official BB catalog for now.

- Both plugins install from the brsbl/bb-plugins repo at pinned,
reviewed commits: Thread Hover Cards at 30f91fd977ba and Prompt Improver
at 1c6bb2e8ad35. The Prompt Improver ref was regenerated from the green
SDK 0.5 source integration in bb-plugins PR #24.
- **Install-id enforcement**: a git catalog install aborts if the
fetched manifest id differs from the catalog entry id — a repo cannot
swap one plugin for another underneath a pin.
- **Quiet update signals**: available updates surface with short commit
hashes instead of noisy banners.
- **Sidebar hover-target integration** that Thread Hover Cards builds
on, formerly PR #1349 and now folded in here.
- Install surfaces describe git-catalog installs truthfully: builtin
plugins say bundled with BB; git-catalog entries say they install from
their pinned source, in both the Add-plugin dialog and CLI preamble.

BB-Thread-ID: thr_kuixkqt8n2

> AGENT GENERATED: by GPT-5
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.

1 participant