# Function chunkByDirectory

Agents exports - Agent framework, Orchestrator, Experts Split from index.ts for file size compliance (Issue #285)

- chunkByDirectory(files: readonly string[], basePath: string): WorkChunk[]

  Partition a list of file paths into directory-scoped chunks. Each chunk corresponds to a top-level directory within the base path.

  #### Parameters

  - files: readonly string[]

    Array of file paths

  - basePath: string

    Base path prefix to strip for grouping

  #### Returns WorkChunk[]

  Array of work chunks grouped by top-level directory

  - Defined in packages/nexus-agents/src/agents/wave-scheduler.ts:362