Skip to content

Playbooks and personas: make them available across workspaces and environments #613

Closed

Description

@bryantderosier

Problem

Playbooks and personas keep getting stuck where they were made, and we keep running into it.

Playbooks are per workspace, and really per worktree. They're only read from <thread worktree or project root>/.j5/playbooks/*.yaml (apps/server/src/j5/playbooks/workspace.ts, workspaceRoot.ts). So:

  • a playbook in project A doesn't exist in project B
  • a thread in a worktree only sees the worktree's copy. If I write a playbook in the main checkout and don't commit it, no worktree thread can see it. I've got two of those sitting untracked in my checkout right now.

Personas are per environment. They already show up in every project on an environment: imported copies plus the source folders listed in <stateDir>/agent-personas.json (default personas/). But each environment is its own server with its own filesystem, so a persona I make on one machine isn't on the others. Right now the only ways across are Copy to environment (a one-time copy) or pointing every environment's config at the same folder by hand.

Proposal

  1. An environment playbook library, set up like the persona one. Read <stateDir>/playbooks/ by default plus any folders configured the same way as agent-personas.json, and merge them with the workspace's .j5/playbooks/. Runs already store an absolute definition path and read the YAML live, so the run engine shouldn't change. The work is listing and lookup: PlaybookStore, playbook_list / playbook_read, the Settings playbook library, and an origin badge (workspace vs environment).
  2. Cross-environment = one shared folder, not a sync engine. Put personas/ and playbooks/ in one git repo, clone it on each machine, and list that path in each environment's config. Personas can already do this. Playbooks get it from (1). That's the "one library location, configurable" direction in the Roles doc, with git commit/push/pull. Automatic syncing between environments would mean conflict handling and state we'd have to keep consistent, and I don't think it's worth building.
  3. A promote action, so agents don't have to write outside the workspace. Agents make playbooks with file tools in the workspace, and a sandboxed agent (Codex workspace-write, for example) probably can't write to the state dir. Add Move to environment library in Settings and Copy to environment for playbooks, matching personas. The YAML export from feat/playbook-yaml-export covers part of this.

I'd ship (1) and the folder config first, then (3) in a follow-up.

This is all J5-owned code (apps/server/src/j5/playbooks, J5 Settings, packages/contracts/src/j5), so no upstream divergence. Hit-every-surface stuff to cover: Settings on web, desktop, and mobile; the @playbook: mention picker; and remote connections, since the library lives on the server's filesystem, not the client's.

Open questions

  • Name collisions. If a workspace playbook and an environment playbook have the same name, does the workspace one win (my lean, shown with a badge), or does listing fail like duplicate persona ids do?
  • Worktree fallback. Should a worktree thread also see the project root's .j5/playbooks/? That fixes the uncommitted-playbook case on its own, even before the environment library exists.
  • Docs. docs/j5/product/features/playbooks.md and docs/user/playbooks.md both say playbooks live in the workspace, so they need rewriting once this lands.

Alternatives considered

  • Keep it as is and commit playbooks to every repo. That works inside one repo, but nothing gets shared across projects, and every playbook edit turns into a commit.
  • Automatic sync between environments. Covered above. It's too much machinery for what it gets us.
  • Only Copy to environment / export-import. Fine for one-off sharing, but the copies drift apart right away.

Activity

  1. added
    enhancement
    on Oct 14, 2026
  2. bryantderosier commented on Oct 17, 2026

    @bryantderosier
    CollaboratorAuthor

    The revised feature is ready for review in PR #621 at ae5237d571.

    Playbooks belong only to the environment. Project/worktree-local discovery and overrides are removed. Existing workspace YAML stays on disk for one-time manual import; existing runs and retries retain their recorded files.

    Settings has one compact list, shares the Personas page's environment selection, and uses standard dialogs for importing, viewing steps, renaming, and placing conversations. A project's only role is where a conversation opens.

    243 focused tests across 23 files and all five scoped typechecks passed. Changed-file lint, formatting, and diff checks passed. Final-head macOS web UI verification passed, including local-file ignoring, file/paste import, duplicate/invalid rejection, source/reverse actions, unsent draft placement/preservation, dialog layout, and restart persistence. Updated before/after screenshots and a short import video are attached to the PR.

    No live data or agent turns were used; isolated test servers are stopped. Live MCP/Crew/stock-author/legacy-run upgrade, native mobile/Electron, cross-environment and remote/tunnel checks remain unrun and are documented in the PR. No merge or deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions