# Function decomposeSpec

- decomposeSpec(
  spec: {
  title: string;
  overview: string;
  requirements: string[];
  acceptanceCriteria: string[];
  constraints: string[];
  issueReferences: { number: number; raw: string }[];
  fileReferences: { path: string; line?: number }[];
  missingSections: string[];
  rawMarkdown: string;
  techStack?: {
  language?: string;
  framework?: string;
  packageManager?: string;
  };
  },
  ): Result<
  {
  nodes: {
  id: string;
  description: string;
  type: "code"
  | "test"
  | "refactor"
  | "config"
  | "docs";
  complexity: "complex" | "simple" | "moderate" | "expert";
  capabilities: string[];
  dependsOn: string[];
  sourceRequirement?: string;
  }[];
  edges: { from: string; to: string }[];
  roots: string[];
  totalComplexity: "complex" | "simple" | "moderate" | "expert";
  specTitle: string;
  },
  DecomposeError,
  >

  Decomposes a parsed spec into a dependency DAG of typed subtasks.

  #### Parameters

  - spec: {
    title: string;
    overview: string;
    requirements: string[];
    acceptanceCriteria: string[];
    constraints: string[];
    issueReferences: { number: number; raw: string }[];
    fileReferences: { path: string; line?: number }[];
    missingSections: string[];
    rawMarkdown: string;
    techStack?: {
    language?: string;
    framework?: string;
    packageManager?: string;
    };
    }

    - ##### title: string

      Spec title (from first H1 or H2 heading)

    - ##### overview: string

      Overview/description text

    - ##### requirements: string[]

      List of requirements

    - ##### acceptanceCriteria: string[]

      Acceptance criteria (checklist items)

    - ##### constraints: string[]

      Constraints or limitations

    - ##### issueReferences: { number: number; raw: string }[]

      Issue/PR references found in the spec

    - ##### fileReferences: { path: string; line?: number }[]

      File path references found in the spec

    - ##### missingSections: string[]

      Sections that were missing from the spec

    - ##### rawMarkdown: string

      Raw markdown source

    - ##### `Optional` techStack?: { language?: string; framework?: string; packageManager?: string }

      Inferred technology stack

      - ##### `Optional` language?: string

        Programming language

      - ##### `Optional` framework?: string

        Framework or library

      - ##### `Optional` packageManager?: string

        Package manager

  #### Returns Result<
  {
  nodes: {
  id: string;
  description: string;
  type: "code"
  | "test"
  | "refactor"
  | "config"
  | "docs";
  complexity: "complex" | "simple" | "moderate" | "expert";
  capabilities: string[];
  dependsOn: string[];
  sourceRequirement?: string;
  }[];
  edges: { from: string; to: string }[];
  roots: string[];
  totalComplexity: "complex" | "simple" | "moderate" | "expert";
  specTitle: string;
  },
  DecomposeError,
  >

  - Defined in packages/nexus-agents/src/orchestration/spec-decomposer.ts:43