DOJ-4835: optional per-module fan-out orchestration for workbook-generate#29
Conversation
…rate
Size-gated subagent orchestration (discover -> map per module -> assemble) so
per-course workbooks scale without exhausting one context window. Portable: uses
the standard Task/Agent tool, NOT the session-specific Workflow tool.
- agents/workbook-module-composer.md (NEW): composes ONE module into a
namespaced .wb-module fragment + manifest (no global chrome; m{N}- ID
namespace; design-token-only; voice-neutral).
- commands/workbook-generate.md: Phase 2.5 execution-strategy gate (small ->
linear; large -> fan out per module); Phase 4 assembly builds TOC/nav/
progress/footers from manifests and dedupes namespaced IDs.
- skills/workbook-generate/SKILL.md: documents the map->reduce orchestration,
the fragment contract, and the consistency safeguards (shared spec + assembly
normalization pass).
- CLAUDE.md: corrected stale surface counts to match disk (commands 27->30,
agents 19->20, skills 18->20) — drive-by accuracy fix.
No workbook-base.html / invariant change. Voice-neutral. CI lint green.
Created by Claude Code on behalf of @daniel
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@dojo-code-reviewer review |
There was a problem hiding this comment.
✅ Approved
Approved — 0 blockers, 1 P3. Confidence: 4/5. NITs: 2 (shown).
🔵 P3 — Minor
agents/workbook-module-composer.md:87— 🔵 P3 (minor) — Form controls (such as<input type="radio">or<input type="checkbox">) and their corresponding<label>elements will conflict across modules if theirnameorforattributes are not uniquely namespaced. Namespacing them withm{N}-prevents broken interactive states and incorrect label associations when the fragments are assembled.
- **ID and Attribute namespacing:** every `id`, `aria-controls`, `aria-labelledby`, label `for`, and input `name` attribute you emit is prefixed/namespaced with `m{N}-` (e.g., `m3-acc-1-panel`). This guarantees global uniqueness and prevents broken form element state or label associations when fragments are concatenated. The module wrapper id is `mod-{N}`.
⚪ P4 — Nitpicks
-
skills/workbook-generate/SKILL.md:269— [NIT] ⚪ P4 (nit) — Escaped quotes (\"wb-module\") are used in the markdown backticks, which will render literally with backslashes on some markdown parsers. Removing the backslashes improves formatting readability. -
commands/workbook-generate.md:151— [NIT] ⚪ P4 (nit) — Escaped quotes (\"Module N of M\") are used within the parentheses, which will display the backslashes literally in markdown editors. Standard quotes can be used directly here.
Total findings: 1 business context, 2 nit (3 total)
ℹ️ The findings below could not be anchored to a diff line (line not part of any hunk); they are listed here instead.
agents/workbook-module-composer.md:87— 🔵 P3 (minor) — Form controls (such as<input type="radio">or<input type="checkbox">) and their corresponding<label>elements will conflict across modules if theirnameorforattributes are not uniquely namespaced. Namespacing them withm{N}-prevents broken interactive states and incorrect label associations when the fragments are assembled.
- **ID and Attribute namespacing:** every `id`, `aria-controls`, `aria-labelledby`, label `for`, and input `name` attribute you emit is prefixed/namespaced with `m{N}-` (e.g., `m3-acc-1-panel`). This guarantees global uniqueness and prevents broken form element state or label associations when fragments are concatenated. The module wrapper id is `mod-{N}`.
| the "I already used a chart, reuse it" monotony a single pass can fall into. | ||
|
|
||
| ### The fragment contract (what binds it together) | ||
|
|
There was a problem hiding this comment.
[NIT] ⚪ P4 (nit) — Escaped quotes (\"wb-module\") are used in the markdown backticks, which will render literally with backslashes on some markdown parsers. Removing the backslashes improves formatting readability.
| composed module chapters, steps, and components from Phase 3. | ||
| composed module chunks, in module order. **If you fanned out (Phase 2.5):** | ||
| drop in each composer's `FRAGMENT` verbatim, ordered by `module_index`; | ||
| verify every `id` is `m{N}-`-namespaced and **globally unique** across |
There was a problem hiding this comment.
[NIT] ⚪ P4 (nit) — Escaped quotes (\"Module N of M\") are used within the parentheses, which will display the backslashes literally in markdown editors. Standard quotes can be used directly here.
Expand the fragment-contract namespacing rule (agent + skill) so each composer
also prefixes label `for` and form-control `name` (radio/checkbox groups) with
`m{N}-`, not just id/aria-* — prevents broken label associations and
cross-module radio-group bleed when fragments are concatenated.
(The 2 P4 nits about escaped quotes do not apply — the source uses clean quotes
inside backticks; the backslashes appeared only in the diff JSON.)
CI lint green.
Created by Claude Code on behalf of @daniel
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Follow-up to DOJ-4798.
workbook-generateis per-course — many modules × text classes, the scale where one linear pass risks context exhaustion + quality drop. This adds optional, size-gated subagent orchestration:discover → map (one subagent per module) → assemble.Portable by design — no Workflow-tool dependency. A plugin command runs in arbitrary consumer sessions, so it cannot assume the session-specific Workflow orchestration tool (opt-in, billed). This uses the standard Task/Agent tool (already the IDTK pattern). It also complements DOJ-4810: independent per-module composition naturally varies visualizations (anti-monotony).
Changes
agents/workbook-module-composer.md(NEW) — composes ONE module into a namespaced.wb-modulefragment + manifest (no global chrome,m{N}-ID namespace, design-token-only, voice-neutral). 20th agent.commands/workbook-generate.md— Phase 2.5 execution-strategy gate (≤2 modules → linear; larger → fan out per module via Task/Agent); Phase 4 assembly builds the TOC/nav/progress/footers from the manifests and dedupes the namespaced IDs (the composers omit all global chrome, incl. the footer, so the "Module N of M" arc stays correct at assembly).skills/workbook-generate/SKILL.md— documents the map→reduce orchestration, the fragment contract, and the consistency safeguards (sharedinstruction-bundle-spec.yamlas the binding contract + an assembler normalization/variety pass).CLAUDE.md— drive-by: corrected stale surface counts to match disk (commands 27→30, agents 19→20, skills 18→20; drift from prior PRs).Consistency (no stitched-together feel)
Every composer gets the shared spec (brand/a11y/kit) → uniform by construction. The assembler then normalizes (allowed components, globally-unique namespaced IDs, a11y roles) and runs the DOJ-4810 variety/fit check on the assembled whole.
Out of scope
workbook-base.html(template/runtime) and the invariants — unchanged.Test plan
${CLAUDE_PLUGIN_ROOT}/agents/workbook-module-composer.mdreference resolvesgit grepconfirms zero Workflow-tool referenceworkbook-base.htmlchangeCloses DOJ-4835
Created by Claude Code on behalf of @dbejarano820
🤖 Generated with Claude Code