Skip to content

feat(playbooks): add workspace library and authoring flow - #250

Merged
BastiHu merged 6 commits into
codex/agent-led-pb-02-runsfrom
codex/agent-led-pb-03-authoring
Sep 24, 2026
Merged

BastiHu merged 6 commits into
codex/agent-led-pb-02-runsfrom
codex/agent-led-pb-03-authoring

Conversation

@BastiHu

@BastiHu BastiHu commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

What Changed

Settings → Personas now includes a Playbooks library for project and thread worktree definitions. Users can import, rename, and delete YAML definitions or start a Playbook Author conversation in the selected workspace and Squadron.

Part 3 of 4 for #194. Base: codex/agent-led-pb-02-runs.

Review Follow-up

The library observes only workspace fields, so thread status updates do not repaint the settings panel. Import and server reads share the name pattern and 256 KiB limit from J5 contracts. Playbook Author instructions are the single source for authoring guidance; the checkout-only skill and obsolete model references are gone. The J5 launch assertion lives in the J5 test file. The library mounts in the existing Personas settings surface, leaving upstream settings navigation and search files unchanged.

Web and mobile now use the same Playbook Author launch with explicit workspace and Squadron ownership; the mobile change is in #251. Prepared start drafts still preserve existing text and attachments.

Validation

62 focused playbook, import, and server tests passed across three files after restacking on #249. Web and client-runtime typechecks passed after restacking; server typecheck, formatting, and diff checks passed for the review change.

UI Evidence

  • Before/after screenshots
  • Integrated browser/device verification

UI evidence remains pending at the developer's direction.

Created with GPT-6 in Codex.

Summary by CodeRabbit

  • New Features
    • Added a Playbook library to Settings, where you can browse playbooks in project and thread workspaces, view their definitions and issues, and rename or delete them.
    • Create playbooks with Playbook Author, choose an authoring Squadron when available, and import YAML files. You’ll be asked to confirm before an import replaces an existing playbook.
  • Documentation
    • Updated the Playbook guide with instructions for authoring, importing, and managing playbooks, including how changes affect runs and when a playbook can be deleted.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XL 500-999 effective changed lines (test files excluded in mixed PRs). labels Sep 22, 2026
@BastiHu
BastiHu added this pull request to stack #253 September 22, 2026 18:13
@BastiHu
BastiHu force-pushed the codex/agent-led-pb-03-authoring branch from 4a0db7b to 2379f30 Compare September 23, 2026 15:14
@BastiHu
BastiHu force-pushed the codex/agent-led-pb-03-authoring branch from 2379f30 to 18c8410 Compare September 23, 2026 16:07
@BastiHu
BastiHu marked this pull request as ready for review September 23, 2026 16:07

@bryantderosier bryantderosier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of the library and authoring flow. No correctness defects turned up; the inline comments are about quality, duplicated sources of truth, and fork placement.

Open question I want settled before merge: web and mobile have two different create-playbook flows. Web launches the Playbook Author persona, while mobile (#251) opens a plain draft with CREATE_PLAYBOOK_PROMPT, which web never uses. I lean toward one flow on both surfaces. If the split is intentional, say why in the body.

The before/after screenshots are still needed here as well. SettingsSidebarNav.tsx and settingsSearch.ts also need FORK.md ledger rows.


export function PlaybookLibrarySettings() {
const { environments } = useEnvironments();
const workspaces = playbookWorkspaces(useProjects(), useThreadShells());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

playbookWorkspaces(useProjects(), useThreadShells()) isn't memoized and subscribes to every thread shell, so any agent activity (status or updatedAt changes) re-renders the whole settings page. Please useMemo it and select only the worktree fields it needs.

@@ -0,0 +1,20 @@
export const PLAYBOOK_IMPORT_MAX_BYTES = 262144;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a second copy of the server's size limit and name pattern. Please import both from packages/contracts/src/j5/playbook.ts (see my comment on PlaybookStore.ts in #248).

Comment thread .agents/skills/j5-new-playbook/SKILL.md Outdated
reordering existing steps: active runs track identity by ID. Use 1–100 steps, YAML
1.2 without aliases, and a file no larger than 256 KiB. Express tasks as prompts
for the same agent. This format has ordered steps; executable phases, personas,
transition graphs, and the older `t3-playbook/v1` schema belong to a different engine.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This skill is contributor tooling, since it only exists inside a j5code checkout. A user's workspace never has it, so the author prompt's "use the j5-new-playbook skill if available" always falls back to PLAYBOOK_AUTHOR_INSTRUCTIONS. That leaves two copies of the format rules to drift apart (the limits are already worded differently). This line also references an "older t3-playbook/v1 schema" and a "different engine" that don't exist on j5/main.

Please drop the skill and the prompt reference and keep the persona instructions as the single source, or ship it as product content. Also remove it from the FORK case 38 integration list.

title: Report
prompt: Summarize findings, checks performed, and remaining uncertainty.

Each prompt tells the same agent what work to do, what evidence to retain, and when to advance. Use this flat step format; phases, edges, executable commands, and per-step persona assignments belong to a different playbook model.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"phases, edges, executable commands, and per-step persona assignments belong to a different playbook model". No such model exists on j5/main, so this confuses the agent more than it helps. Please remove it. The same goes for "phases" at lines 23 and 38: the format has steps, not phases.

import type { EnvironmentProject, EnvironmentThreadShell } from "../state/shell.ts";

export const CREATE_PLAYBOOK_PROMPT =
"Help me create an agent-led playbook in this workspace. Use the j5-new-playbook skill if available; otherwise follow your playbook authoring instructions. Ask what I want to accomplish, write .j5/playbooks/<name>.yaml, and validate it with playbook_list. Create the definition without starting a run.";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This references the contributor-only j5-new-playbook skill (see the SKILL.md comment), and the prompt is only used by mobile, while web launches Playbook Author. Please drop the skill reference, and make this match whichever single create flow we keep.

@@ -136,6 +137,71 @@ const makeSupervisor = Effect.fn("TestEnvironmentCommands.makeSupervisor")(funct
});

describe("V2 environment commands", () => {
it.effect(
"launches Playbook Author with its Squadron and exact workspace in the wire request",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This J5 case lands in an upstream-owned test file. The persona stack's precedent keeps J5 cases in J5 test files and leaves the upstream test untouched. Please move it to packages/client-runtime/src/j5/playbooks.test.ts.

@@ -76,6 +77,7 @@ const SETTINGS_SECTION_ICONS: Readonly<
"/settings/appearance": PaletteIcon,
"/settings/keybindings": KeyboardIcon,
"/settings/personas": UsersRoundIcon,
"/settings/playbooks": BookOpenIcon,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a new Settings section in upstream files: a route, this nav entry, and settingsSearch.ts paths and items. Per my fork rule, please mount the playbook library inside an existing J5-owned surface instead. A Playbooks panel in Settings → Personas fits, since that already hosts the Playbook Author persona. That drops the upstream settings edits to zero. If a separate section is really the right call, argue for it in the PR body so we can sign off explicitly.

Comment thread docs/user/playbooks.md Outdated
Choose its **Authoring Squadron** when several Squadrons use the same project.
The persona is added to that environment on first use; customize its instructions
and model in **Settings → Personas**. It currently requires an authenticated Codex
provider because authoring needs Workspace write authority. Return to the library and refresh after

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user doc walks through buttons ("Create playbook", "Prepare playbook chat", "Import YAML", "refresh after creation") and uses internal jargon ("Workspace write authority"). The Codex-only limit is real, so please keep it but phrase it as "Playbook Author runs on Codex", and cut the button tour down to what the user needs to decide.

@BastiHu
BastiHu force-pushed the codex/agent-led-pb-03-authoring branch from e443a7c to f16891c Compare September 23, 2026 18:15
@BastiHu
BastiHu force-pushed the codex/agent-led-pb-03-authoring branch from 90b605c to a77df7f Compare September 24, 2026 10:48
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

  • Run on-demand review

This review includes 10 billable files and costs up to $2.50.

Or wait 59 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: Jacksondr5/j5code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a6b06f79-442c-4b0f-b5ba-433532205ffe

📥 Commits

Reviewing files that changed from the base of the PR and between a77df7f4cb8423e8542be3f6db68d409e397bbd7 and fdefe34.

📒 Files selected for processing (10)
  • FORK.md
  • apps/web/src/j5/agents/AgentLibrarySettings.tsx
  • apps/web/src/j5/playbooks/PlaybookLibrarySettings.tsx
  • apps/web/src/j5/playbooks/importPlaybookFile.test.ts
  • apps/web/src/j5/playbooks/importPlaybookFile.ts
  • apps/web/src/j5/playbooks/openPlaybookDraft.test.ts
  • apps/web/src/j5/playbooks/openPlaybookDraft.ts
  • docs/user/playbooks.md
  • packages/client-runtime/src/j5/playbooks.test.ts
  • packages/client-runtime/src/j5/playbooks.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: Jacksondr5/j5code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: e9eebd2c-6e04-4fab-b2ad-f0138e113601

📥 Commits

Reviewing files that changed from the base of the PR and between bf941d467d58ecb2c4e758a0c999440bad086f77 and a77df7f4cb8423e8542be3f6db68d409e397bbd7.

📒 Files selected for processing (10)
  • FORK.md
  • apps/web/src/j5/agents/AgentLibrarySettings.tsx
  • apps/web/src/j5/playbooks/PlaybookLibrarySettings.tsx
  • apps/web/src/j5/playbooks/importPlaybookFile.test.ts
  • apps/web/src/j5/playbooks/importPlaybookFile.ts
  • apps/web/src/j5/playbooks/openPlaybookDraft.test.ts
  • apps/web/src/j5/playbooks/openPlaybookDraft.ts
  • docs/user/playbooks.md
  • packages/client-runtime/src/j5/playbooks.test.ts
  • packages/client-runtime/src/j5/playbooks.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Adds a Playbook library to the Personas settings page. The library selects project or thread workspaces, launches Playbook Author with a workspace-matched Squadron, imports and manages YAML definitions, and prepares playbook chats without replacing existing draft text.

Changes

Playbook library and authoring

Layer / File(s) Summary
Workspace scoping and author runtime
packages/client-runtime/src/j5/playbooks.ts, packages/client-runtime/src/j5/playbooks.test.ts
Adds project and thread workspace mapping, Squadron filtering, Playbook Author setup, and workspace-bound launch construction. Tests cover environment scoping, author availability and policy, provider selection, and recovery after concurrent creation.
Settings entry and author launch
apps/web/src/j5/playbooks/PlaybookLibrarySettings.tsx, apps/web/src/j5/agents/AgentLibrarySettings.tsx, FORK.md
Adds workspace and Squadron controls to the library, starts author turns, and navigates after the created thread becomes visible. Mounts the library in the Personas settings page.
YAML import and playbook management
apps/web/src/j5/playbooks/importPlaybookFile.ts, apps/web/src/j5/playbooks/importPlaybookFile.test.ts, apps/web/src/j5/playbooks/PlaybookLibrarySettings.tsx, docs/user/playbooks.md
Validates YAML filenames and file sizes. Adds import with replacement confirmation, rename and delete actions, library status and issue display, and documentation for authoring and managing definitions.
Playbook chat draft preparation
apps/web/src/j5/playbooks/openPlaybookDraft.ts, apps/web/src/j5/playbooks/openPlaybookDraft.test.ts, apps/web/src/j5/playbooks/PlaybookLibrarySettings.tsx
Opens a draft in the selected workspace. Tests cover workspace details, cancellation, and preservation of text entered while draft opening is in progress.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PlaybookLibrarySettings
  participant playbookAuthorLaunch
  participant StartThreadTurn
  participant WorkspaceThreadList
  User->>PlaybookLibrarySettings: Select workspace and Squadron
  PlaybookLibrarySettings->>playbookAuthorLaunch: Build workspace-bound launch
  playbookAuthorLaunch-->>PlaybookLibrarySettings: Return launch input
  PlaybookLibrarySettings->>StartThreadTurn: Start author turn
  WorkspaceThreadList-->>PlaybookLibrarySettings: Show created thread
  PlaybookLibrarySettings->>User: Navigate to thread
Loading

Suggested reviewers: bryantderosier

Merge Risk: ⚪ Minimal · up to a77df

No confirmed issue currently blocks the Playbook library change. Normal validation can proceed before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 8 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a Playbooks workspace library and authoring flow.
Description check ✅ Passed The description is detailed, on-topic, and covers the changes, rationale context, validation, and UI impact. The explicit Why section and required UI evidence remain incomplete, but the overall descri…
Full details: Docstring Coverage

Explanation

Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 8 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@BastiHu
BastiHu force-pushed the codex/agent-led-pb-03-authoring branch from a77df7f to 75517aa Compare September 24, 2026 12:42
@BastiHu
BastiHu force-pushed the codex/agent-led-pb-03-authoring branch from a80421c to 0b12045 Compare September 24, 2026 18:04
@BastiHu
BastiHu force-pushed the codex/agent-led-pb-03-authoring branch from 0b12045 to fdefe34 Compare September 24, 2026 19:10
@BastiHu
BastiHu merged commit 785db54 into j5/main Sep 24, 2026
41 of 49 checks passed
@BastiHu
BastiHu deleted the codex/agent-led-pb-03-authoring branch September 24, 2026 19:20
Jacksondr5 added a commit that referenced this pull request Sep 24, 2026
Carried from j5/main 785db54 onto the upstream V2 candidate.

Conflict: FORK.md only; case 45 takes the PR's library/authoring sentence and step-board wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Jacksondr5 added a commit that referenced this pull request Sep 25, 2026
Joins fork head 2cf4ad7 (j5/main, including #247, #241, #244, #242,
#214, #215, #216, #248, #249, #250, #251) with the reviewed candidate
(j5/upstream-sync-20260924-candidate), which descends from frozen upstream
67a2be0. Upstream force-rewrote history,
so per FORK.md's rewrite runbook the candidate was built from the upstream
tree with pin 62aef85 as the content base, then carried each j5/main
PR since 8f56083 onto it and adapted it to upstream V2. This merge's
tree equals the candidate tree exactly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants