Skip to content

fix(playbook_loader): load generated playbooks from styles/custom/ - #487

Open
hubooy wants to merge 1 commit into
calesthio:mainfrom
hubooy:fix/playbook-custom-fallback
Open

fix(playbook_loader): load generated playbooks from styles/custom/#487
hubooy wants to merge 1 commit into
calesthio:mainfrom
hubooy:fix/playbook-custom-fallback

Conversation

@hubooy

@hubooy hubooy commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Generated playbooks are invisible at render time.

lib/playbook_generator.save_playbook() writes them to styles/custom/ (:219-220), and the skills instruct agents to save them there — skills/meta/capability-extension.md:62, plus the animation and explainer proposal directors. But styles/playbook_loader.py globs only the styles/ root, and it is the loader tools/video/video_compose.py imports (:1234, :1728). So a playbook created through the documented path can never be loaded by the tool that needs it.

The two modules also disagree with each other: playbook_generator has its own load_playbook/list_playbooks that do search custom/, but nothing in the Python codebase imports that module — only the three skill docs point at it.

The practical result is that every custom playbook has to be hand-copied up one directory, leaving duplicated pairs in styles/ and styles/custom/.

Related issue

None — filing the fix directly.

Changes

  • load_playbook() falls back to <styles_dir>/custom/ when the name is not found in the root.
  • list_playbooks() merges both directories and dedupes.
  • Semantics match what lib/playbook_generator.py:32-49 already implements: a preset wins when both exist.
  • The styles_dir override parameter still works — the custom subdirectory is resolved relative to it, not hardcoded.
  • FileNotFoundError now names both directories searched, instead of only the last path tried.

Testing

  • python -m pytest tests/contracts/ -q — 630 passed, 7 skipped (includes the 14 playbook cases in test_phase3_contracts.py and test_taste_governance_contracts.py).
  • python tests/qa/test_07_playbook_intelligence.py — 56 passed, 0 failed.
  • Behavior verified against an isolated styles dir passed via the styles_dir override: a playbook present only in custom/ now loads; with the same name in both places the root preset wins; list_playbooks() dedupes the overlap; and a missing name reports both directories searched.

Checklist

  • The change is focused on a single logical concern.
  • I ran the relevant tests locally (make test-contracts / make test) where applicable.
  • I updated docs/README if behavior or usage changed. — no doc change needed; this makes the existing docs (capability-extension.md:62 and the proposal directors) true.
  • No unrelated files (build artifacts, local config) are included in the diff.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GYThSL15CujvBwD1wuUmr9

lib/playbook_generator.save_playbook() writes generated playbooks to
styles/custom/, and the skills tell agents to save them there
(skills/meta/capability-extension.md, the animation and explainer
proposal directors). But this loader globs only the styles/ root, and it
is the loader tools/video/video_compose.py imports — so every generated
playbook was invisible at render time. The only way to make one work was
to hand-copy it up one directory, which is why custom playbooks end up
duplicated in both places.

Search styles/custom/ as a fallback in load_playbook() and merge it into
list_playbooks(), matching the semantics lib/playbook_generator.py
already uses: a preset wins when both exist, and the listing is deduped.
The not-found error now names both directories it searched instead of
just the last path it tried.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYThSL15CujvBwD1wuUmr9
@hubooy
hubooy requested a review from calesthio as a code owner August 8, 2026 18:05
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