- Add optional globalDir parameter to resolveProject(), getDefaultProject(), setDefaultProject(), and clearDefaultProject() for test isolation - Remove ESLint suppression by using void operator for intentionally unused var - Update all tests to use isolated globalDir parameter - Complete tests for default project resolution
6.8 KiB
Task: KB-040 - Add Toggle to Break Tasks into Subtasks During Creation
Created: 2026-03-30 Size: M
Review Level: 2 (Plan and Code)
Assessment: This feature touches multiple packages (core types, dashboard UI/API, engine triage) and requires coordinated changes across the stack. The changes are localized but need to be consistent. Score: 5/8 — Blast radius: 2, Pattern novelty: 1, Security: 1, Reversibility: 1
Mission
Add a toggle option on the dashboard during new task creation that allows users to request the AI triage agent to break the task into subtasks. When enabled, the triage agent will analyze the task and, if appropriate, create child tasks instead of a single large specification. This helps users who have large, complex work items that would benefit from being split into smaller, more manageable pieces.
Dependencies
- None
Context to Read First
packages/core/src/types.ts— Task types and TaskCreateInput interfacepackages/dashboard/app/components/InlineCreateCard.tsx— Task creation UI componentpackages/dashboard/app/api.ts— Frontend API client for task creationpackages/dashboard/src/routes.ts— Backend API route for task creationpackages/engine/src/triage.ts— Triage agent and specification promptpackages/core/src/store.ts— TaskStore.createTask methodpackages/dashboard/app/components/__tests__/InlineCreateCard.test.tsx— Existing tests for reference
File Scope
packages/core/src/types.ts— AddbreakIntoSubtasksto TaskCreateInputpackages/core/src/store.ts— Store the flag on task (optional for tracking)packages/dashboard/app/components/InlineCreateCard.tsx— Add toggle UIpackages/dashboard/app/api.ts— Update createTask API signaturepackages/dashboard/src/routes.ts— Accept and pass the new fieldpackages/engine/src/triage.ts— Update system prompt and buildSpecificationPromptpackages/dashboard/app/components/__tests__/InlineCreateCard.test.tsx— Add tests for toggle
Steps
Step 1: Update Core Types and Store
- Add optional
breakIntoSubtasks?: booleanfield toTaskCreateInputinterface inpackages/core/src/types.ts - Add optional
breakIntoSubtasks?: booleanfield toTaskinterface to persist the flag - Update
TaskStore.createTask()inpackages/core/src/store.tsto accept and store the flag - Run core package tests:
pnpm --filter @kb/core test
Artifacts:
packages/core/src/types.ts(modified)packages/core/src/store.ts(modified)
Step 2: Update Dashboard Backend API
- Update POST
/api/tasksroute inpackages/dashboard/src/routes.tsto acceptbreakIntoSubtasksfrom request body - Pass the flag to
store.createTask() - Add test for the new parameter in
packages/dashboard/src/routes.test.ts(create if doesn't exist, or add to existing) - Run dashboard server tests:
pnpm --filter @kb/dashboard test
Artifacts:
packages/dashboard/src/routes.ts(modified)packages/dashboard/src/routes.test.ts(modified or created)
Step 3: Add Toggle to InlineCreateCard UI
- Add state for
breakIntoSubtaskstoggle inInlineCreateCardcomponent - Add checkbox/toggle UI element in the footer area (near the Deps button)
- Update
handleKeyDownsubmit handler to include the flag in the submit payload - Style the toggle to match existing UI patterns (use existing CSS classes where possible)
- Ensure the toggle is only visible/active when not submitting
Artifacts:
packages/dashboard/app/components/InlineCreateCard.tsx(modified)
Step 4: Update Frontend API Client
- Update
createTaskfunction inpackages/dashboard/app/api.tsto accept and passbreakIntoSubtasksparameter - Ensure the parameter flows through to the fetch call
Artifacts:
packages/dashboard/app/api.ts(modified)
Step 5: Update Triage Agent to Handle Subtask Breakdown
- Update
TRIAGE_SYSTEM_PROMPTinpackages/engine/src/triage.tsto include instructions about breaking tasks into subtasks - Add guidance: when the task has
breakIntoSubtasksflag, the agent should analyze if the task is complex enough to warrant splitting, and if so, use thetask_createtool to create child tasks instead of writing a single PROMPT.md - Update
buildSpecificationPrompt()to include the subtask request flag in the prompt when enabled - Ensure the agent knows to set up proper dependencies between child tasks
Artifacts:
packages/engine/src/triage.ts(modified)
Step 6: Testing & Verification
ZERO test failures allowed. Full test suite as quality gate.
- Run full test suite:
pnpm test - Fix all failures
- Build passes:
pnpm build - Add specific tests in
InlineCreateCard.test.tsx:- Test that toggle appears and can be clicked
- Test that toggle state is passed to onSubmit
- Test that toggle defaults to false/off
Artifacts:
packages/dashboard/app/components/__tests__/InlineCreateCard.test.tsx(modified)
Step 7: Documentation & Delivery
- Update dashboard README or UI help text if there's documentation about task creation
- Create changeset file for the feature (minor bump for @dustinbyrne/kb)
- Verify the toggle appears correctly in the UI and the flag flows through the entire system
- Out-of-scope findings: If the triage agent needs better tools for creating subtasks, create a follow-up task
Artifacts:
.changeset/add-subtask-toggle.md(new)
Documentation Requirements
Must Update:
- None (UI is self-documenting via toggle label)
Check If Affected:
packages/dashboard/README.md— Add note about subtask creation feature if it exists
Completion Criteria
- All steps complete
- All tests passing (
pnpm test) - Build passes (
pnpm build) - Toggle appears in task creation UI
- Toggle state flows through API to task creation
- Triage agent receives and respects the flag
- Changeset created for the feature
Git Commit Convention
Commits at step boundaries. All commits include the task ID:
- Step completion:
feat(KB-040): complete Step N — description - Bug fixes:
fix(KB-040): description - Tests:
test(KB-040): description
Example commits:
feat(KB-040): complete Step 1 — add breakIntoSubtasks to core typesfeat(KB-040): complete Step 3 — add toggle UI to InlineCreateCardtest(KB-040): add tests for subtask toggle
Do NOT
- Expand scope to auto-detect when tasks should be broken down (user must explicitly request)
- Change the default behavior (toggle defaults to off)
- Modify the task card display to show subtask relationships (out of scope)
- Add a separate "planning mode" UI (KB-032 covers this)
- Skip tests for the new functionality
- Modify files outside the File Scope without good reason
- Commit without the task ID prefix