Skip to content

[codex] seed manager thread templates - #21

Closed
SawyerHood wants to merge 3 commits into
mainfrom
bb/user-configurable-templates-for-new-manager-pref-thr_fdhzqyku4k
Closed

SawyerHood wants to merge 3 commits into
mainfrom
bb/user-configurable-templates-for-new-manager-pref-thr_fdhzqyku4k

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Summary

  • Added shared manager storage filename/template mapping for PREFERENCES.md, STATUS.md, and ASYNC.md.
  • Added server-owned manager template seed policy under <dataDir>/manager-templates/, and passed seed paths on manager thread.start commands.
  • Added a daemon pre-runtime copy step that seeds existing templates into new manager thread storage, while leaving absent templates absent for the existing welcome flow.
  • Updated the manager hatch prompt and bb guide overview to document seeded templates.

Investigation

  • Thread storage path resolver: apps/server/src/services/threads/thread-storage.ts:10-17 resolves manager storage from the active host session data dir as <dataDir>/thread-storage/<thread-id>.
  • Host daemon storage root resolver: apps/host-daemon/src/thread-storage-root.ts:4-13 creates <dataDir>/thread-storage.
  • Manager provisioning reaches the start handoff in apps/server/src/services/threads/thread-provisioning.ts:132-149, then apps/server/src/services/threads/thread-commands.ts:273-306 builds the thread.start command with threadStoragePath and seed template paths.
  • The right pre-agent filesystem hook is apps/host-daemon/src/command-handlers/thread.ts:92-107, which creates thread storage before staging prompt attachments and starting the runtime. The seed implementation is apps/host-daemon/src/command-handlers/thread.ts:58-90.
  • Canonical model-facing filenames remain PREFERENCES.md, STATUS.md, and ASYNC.md in packages/templates/src/templates/manager-agent-instructions.md:39-43; shared constants live in packages/domain/src/manager-storage.ts:3-19.

Template Location

Chose per-user templates in <bb data dir>/manager-templates/, which is usually ~/.bb/manager-templates/ in production and ~/.bb-dev/manager-templates/ in development. Supported inputs are:

  • PREFERENCES_TEMPLATE.md -> PREFERENCES.md
  • STATUS_TEMPLATE.md -> STATUS.md
  • ASYNC_TEMPLATE.md -> ASYNC.md

This matches the personalization use case and keeps setup simple across projects. The tradeoff is that this PR does not add a per-project override layer. I included ASYNC_TEMPLATE.md because it uses the same one-time copy semantics and existing canonical storage convention.

Prompt And Docs

  • packages/templates/src/templates/manager-agent-instructions.md:67-71 now branches the hatch flow: if PREFERENCES.md already exists, briefly confirm/refine and skip the full meet-and-greet; otherwise keep the current welcome behavior and create the file.
  • packages/templates/src/templates/bb-guide-overview.md:25-29 documents where to place templates and how missing templates preserve the existing flow.

Tests

  • apps/host-daemon/test/command/thread-dispatch.test.ts covers template-present seeding and template-absent fallback with no canonical files created.
  • apps/server/test/threads/thread-runtime-config.test.ts and apps/server/test/public/public-threads.manager-and-ownership.test.ts assert manager creation includes the expected seed template paths.

Validation

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

@SawyerHood
SawyerHood force-pushed the bb/user-configurable-templates-for-new-manager-pref-thr_fdhzqyku4k branch from 797dc49 to df15a9d Compare May 18, 2026 22:16
@SawyerHood

Copy link
Copy Markdown
Collaborator Author

Superseded by #24, which replaces the flat *_TEMPLATE.md layout with named template sets under manager-templates/<name>/ (plus a built-in default installed on server startup and a --template flag on bb manager hire). Closing in favor of #24.

@SawyerHood SawyerHood closed this May 18, 2026
SawyerHood added a commit that referenced this pull request May 19, 2026
…21) (#24)

* manager: add named template sets

* manager: clean template content names
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