mirror of
https://github.com/azaion/detections.git
synced 2026-04-25 23:06:31 +00:00
34 lines
1.3 KiB
Markdown
34 lines
1.3 KiB
Markdown
# Batching Algorithm Reference
|
|
|
|
## Topological Sort with Batch Grouping
|
|
|
|
The `/implement` skill uses a topological sort to determine execution order,
|
|
then groups tasks into batches for code review and commit. Execution within a
|
|
batch is **sequential** — see `.cursor/rules/no-subagents.mdc`.
|
|
|
|
## Algorithm
|
|
|
|
1. Build adjacency list from `_dependencies_table.md`
|
|
2. Compute in-degree for each task node
|
|
3. Initialize the ready set with all nodes that have in-degree 0
|
|
4. For each batch:
|
|
a. Select up to 4 tasks from the ready set (default batch size cap)
|
|
b. Implement the selected tasks one at a time in topological order
|
|
c. When all tasks in the batch complete, remove them from the graph and
|
|
decrement in-degrees of dependents
|
|
d. Add newly zero-in-degree nodes to the ready set
|
|
5. Repeat until the graph is empty
|
|
|
|
## Ordering Inside a Batch
|
|
|
|
Tasks inside a batch are executed in topological order — a task is only
|
|
started after every task it depends on (inside the batch or in a previous
|
|
batch) is done. When two tasks have the same topological rank, prefer the
|
|
lower-numbered (more foundational) task first.
|
|
|
|
## Complexity Budget
|
|
|
|
Each batch should not exceed 20 total complexity points.
|
|
If it does, split the batch and let the user choose which tasks to include.
|
|
The budget exists to keep the per-batch code review scope reviewable.
|