feat: add TaskCreateMany tool for batch task creation#18
Closed
danieldisu wants to merge 1 commit into
Closed
Conversation
danieldisu
marked this pull request as ready for review
May 1, 2026 14:15
pe200012
added a commit
to pe200012/pi-tasks
that referenced
this pull request
May 16, 2026
Owner
|
starting a discussion here: #25 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclosure
This patch was AI-generated (Claude) at my request, motivated by a noticeable inefficiency when an LLM needs to create several tasks upfront: it was forced to call
TaskCreaterepeatedly in sequential turns, wasting round-trips and token budget.TaskCreateManyeliminates that by accepting an array in a single call.QA level: light. Unit tests pass, TypeScript compiles clean, and Biome reports no lint issues.
Motivation
When an LLM plans a multi-step effort and knows all tasks upfront, calling
TaskCreateN times means N sequential tool-use round-trips. This is slow and burns context. A batch primitive is the obvious fix — Claude Code itself shipsTaskCreateManyfor exactly this reason.Changes
src/task-store.ts: AddedcreateMany(items)method — iterates the input array inside a singlewithLockcall, assigns sequential IDs, and returns all createdTaskobjects.src/index.ts: RegisteredTaskCreateManyas Tool 2 (renumbered subsequent tools 3–8). Tool description mirrors Claude Code's spec — includes when-to-use, when-not-to-use, field documentation, and tips. AddedTaskCreateManytoTASK_TOOL_NAMESso it resets the reminder interval.README.md: Updated tool count (7 → 8), addedTaskCreateManyto the tool table with parameter docs and example output.test/task-store.test.ts: 6 new unit tests covering sequential IDs, pending status,activeForm/metadatapreservation, empty array, single item, and interleaving withcreate.test/subagent-integration.test.ts: 5 new integration tests covering tool registration, multi-task summary output, field preservation, single-task input, and empty-array rejection.What I actually verified
tsc --noEmitbiome check src/ test/vitest runDiffstat:
5 files changed, +290, -9.