Skip to content

DOJ-4835: optional per-module fan-out orchestration for workbook-generate#29

Merged
dbejarano820 merged 2 commits into
mainfrom
daniel/doj-4835-workbook-fanout-orchestration
Jun 2, 2026
Merged

DOJ-4835: optional per-module fan-out orchestration for workbook-generate#29
dbejarano820 merged 2 commits into
mainfrom
daniel/doj-4835-workbook-fanout-orchestration

Conversation

@dbejarano820
Copy link
Copy Markdown
Contributor

Summary

Follow-up to DOJ-4798. workbook-generate is 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-module fragment + manifest (no global chrome, m{N}- ID namespace, design-token-only, voice-neutral). 20th agent.
  • commands/workbook-generate.mdPhase 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 (shared instruction-bundle-spec.yaml as 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

  • The Workflow tool / "workflow" keyword (portability — explicitly unused).
  • workbook-base.html (template/runtime) and the invariants — unchanged.

Test plan

  • CI lint green (frontmatter / agent-references / json-schemas) — the command's ${CLAUDE_PLUGIN_ROOT}/agents/workbook-module-composer.md reference resolves
  • git grep confirms zero Workflow-tool reference
  • No workbook-base.html change

Closes DOJ-4835

Created by Claude Code on behalf of @dbejarano820

🤖 Generated with Claude Code

…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>
@dbejarano820
Copy link
Copy Markdown
Contributor Author

@dojo-code-reviewer review

Copy link
Copy Markdown

@dojo-code-reviewer dojo-code-reviewer Bot left a comment

Choose a reason for hiding this comment

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

✅ 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 their name or for attributes are not uniquely namespaced. Namespacing them with m{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 their name or for attributes are not uniquely namespaced. Namespacing them with m{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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[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>
Copy link
Copy Markdown

@dojo-code-reviewer dojo-code-reviewer Bot left a comment

Choose a reason for hiding this comment

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

✅ Approved

Approved — no findings. Confidence: 5/5.

@dbejarano820 dbejarano820 merged commit 487cb4f into main Jun 2, 2026
1 check passed
@dbejarano820 dbejarano820 deleted the daniel/doj-4835-workbook-fanout-orchestration branch June 2, 2026 19:27
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