Skip to content

feat: add batch task creation to TaskCreate tool#24

Draft
v2nic wants to merge 3 commits into
tintinweb:masterfrom
v2nic:feat/batch-taskcreate
Draft

feat: add batch task creation to TaskCreate tool#24
v2nic wants to merge 3 commits into
tintinweb:masterfrom
v2nic:feat/batch-taskcreate

Conversation

@v2nic

@v2nic v2nic commented May 26, 2026

Copy link
Copy Markdown

Summary

Extend TaskCreate to support batch creation via an optional batch array parameter. The existing subject/description scalar parameters remain fully backward-compatible. Creates multiple tasks in a single atomic tool call — no new tool definition added to the LLM's context window.

Motivation

When an LLM needs to create several tasks upfront, calling TaskCreate N times means N sequential tool-use round-trips, wasting context and time. A batch primitive solves this — Claude Code ships batch creation for exactly this reason.

Rather than adding a new TaskCreateMany tool (which would bloat the context with an 8th tool definition), this PR adds a batch array parameter to the existing TaskCreate tool. The LLM only needs one tool for creating tasks, regardless of count.

See PR #18 (separate TaskCreateMany tool, open) and PR #16 (batch mutations, closed without merge) for prior approaches. No maintainer comments on either.

Changes

  • src/task-store.ts — Add createMany(items) method: creates multiple tasks inside a single withLock call, assigning sequential IDs
  • src/index.ts — Add batch array parameter to TaskCreate (mutually exclusive with subject/description). Make subject and description optional. Add prompt guideline for batch preference. Add validation for mixed-mode and missing-field errors.
  • README.md — Updated TaskCreate section with expanded parameter tables for single and batch modes, example JSON, and output format
  • test/task-store.test.ts — 6 new tests for createMany (sequential IDs, pending status, metadata, ID counter continuation, empty array, file persistence)
  • test/subagent-integration.test.ts — 10 new tests for TaskCreate batch mode (batch creation, TaskList integration, agentType, backward compat, mixed-mode rejection, missing-field rejection, singular wording, atomic appearance)

Design decisions

  1. Modify existing tool vs. add new tool — Modifying TaskCreate avoids adding an 8th tool definition to the LLM's context window. The tool description already says "create a structured task list" which naturally encompasses batch creation.

  2. batch instead of tasks — The parameter is named batch rather than tasks for discoverability and searchability. tasks is too generic and easy to confuse with the concept of tasks; batch clearly signals the batch-creation feature.

  3. Mutual exclusivity — Using both batch and subject/description together returns an error. This keeps the schema unambiguous.

  4. Atomic creation — Batch tasks are created inside a single withLock call, ensuring consistency in file-backed mode (no partial writes when multiple sessions create tasks concurrently).

  5. No dependency wiring in create — Dependencies should be wired up via TaskUpdate after creation. Keeping TaskCreate focused on creation only keeps the tool schema simple.

Extend TaskCreate to accept an optional  array parameter for
creating multiple tasks in a single atomic call. The existing scalar
/ parameters remain fully backward-compatible.

Key changes:
- Add  for atomic batch creation within a single lock
- Add  array parameter to TaskCreate tool (mutually exclusive with scalar params)
- Add validation: reject mixing  with /
- Add validation: require + when not using
- 6 new unit tests for createMany (IDs, persistence, metadata, empty array)
- 10 new integration tests for TaskCreate batch mode
- Updated README with batch usage docs and parameter tables

This approach modifies the existing tool rather than adding a new one,
avoiding context bloat from an additional tool definition while keeping
the API surface minimal.
@v2nic

v2nic commented May 26, 2026

Copy link
Copy Markdown
Author

👋 CI shows action_required — this is the default GitHub policy for first-time external contributors. Could you approve the workflow run so CI can execute? All checks pass locally (164 tests, typecheck, lint clean).

v2nic added 2 commits May 26, 2026 12:14
The parameter descriptions and prompt guidelines already convey
the distinction. The extra section was redundant and added context
bloat for the LLM.
Rename the TaskCreate batch array parameter from `tasks` to `batch`
to make it more distinctive and searchable. Update all references in
source, tests, and README accordingly.
@tintinweb

Copy link
Copy Markdown
Owner

starting a discussion here: #25 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants