Connect all points with a line to the `n` nearest points with the same attribute value, where `n` is the number of points you want to aggregate to a group. You can use different values for `n` for different attribute values (like based on your example n=6 for value=12).

Then create the convex hull of these lines, dissolve the result and convertt multipart to single part geometries. To do this, proceed as follows:

1. Use Geometry by expression with this expression:

   ```
	convex_hull( 
		with_variable (
			'no',
			case
			when value = 12 then 8  -- define here how many points you want to cluster together for each value
			when value = 8 then 6
			when value = 2 then 4
			end,
			collect_geometries (
				array_foreach (
					with_variable(
						'val',
						value,
						eval ('
							overlay_nearest (
								''points'',  -- adapt the name of your points layer
								$geometry,
								filter:=value='  || @val  || ',
								limit:=@no-1
							)'
						)
					),
					make_line (
						$geometry, 
						@element
					)
				)
			)
		)
	)
   ```

2. Apply `Menu Vector > Geoprocessing tools > Dissolve` to the result

3. Apply `Menu Vector > Geometry tools > Multipart to Singleparts` to the output.

*Result: Points with value 2 are grouped to groups of 4 , value 8 to groups of 6, value 12 to groups of 8:*
[![enter image description here][1]][1]

*Result after step 1 with geometry generator:*

[![enter image description here][2]][2]


  [1]: https://i.sstatic.net/Ilf4X.png
  [2]: https://i.sstatic.net/W6c04.png