Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b5db5d3
feat(core): implement task tracker foundation and service (Phase 1)
anj-s Feb 18, 2026
f737126
feat(core,cli): implement task tracker tools and feature flag (Phase 2)
anj-s Feb 18, 2026
448af0a
chore(core): improve ID generation and add runtime task validation
anj-s Feb 18, 2026
2d6ee8f
fix: address code review comments from bot in trackerService.ts
anj-s Feb 18, 2026
9618f8f
Merge branch 'u/anj/task-tracker-phase-1' into u/anj/task-tracker-pha…
anj-s Feb 18, 2026
6a24077
docs: update implementation plan for Phase 2
anj-s Feb 19, 2026
ae96477
feat(tracker): move tracker storage to project temp directory
anj-s Feb 19, 2026
91e7881
Merge branch 'u/anj/task-tracker-phase-1' into u/anj/task-tracker-pha…
anj-s Feb 19, 2026
e6b68e7
feat(tracker): integrate dynamic storage path in Config and tools
anj-s Feb 19, 2026
ba73124
feat(tracker): simplify tracker storage path
anj-s Feb 19, 2026
e32d8a2
Merge branch 'u/anj/task-tracker-phase-1' into u/anj/task-tracker-pha…
anj-s Feb 19, 2026
1e743ea
feat(tracker): update config to use simplified tracker path
anj-s Feb 19, 2026
23194dd
feat(tracker): restore session-specific nested storage path
anj-s Feb 19, 2026
de0ce2c
Merge branch 'u/anj/task-tracker-phase-1' into u/anj/task-tracker-pha…
anj-s Feb 19, 2026
eed1ca6
feat(tracker): restore nested tracker path in Config
anj-s Feb 19, 2026
eb33db5
feat(tracker): simplify tracker storage path and flatten directory st…
anj-s Feb 19, 2026
daf9da2
fix(tracker): lazily initialize tracker directory
anj-s Feb 22, 2026
41cf395
chore(tracker): remove plans configuration directory from git tracking
anj-s Feb 22, 2026
fc298e3
remove .gitignore changes
anj-s Feb 22, 2026
30fe8ff
remove .gitignore changes
anj-s Feb 22, 2026
5d31761
si changes: task tracker prep implementation
anj-s Feb 22, 2026
53755c5
si changes
anj-s Feb 22, 2026
ed8a773
wip temp settings change
anj-s Feb 25, 2026
aa1803f
feat(core): trigger task tracker based on complexity rather than form…
anj-s Feb 25, 2026
f76d73e
lint fix
anj-s Mar 4, 2026
34788a7
prompt changes
anj-s Mar 5, 2026
3d89cc5
remove old tool name
anj-s Mar 5, 2026
f5b6028
wip
anj-s Mar 5, 2026
c1252b4
Merge branch 'main' into u/anj/task-tracker-phase-3
anj-s Mar 5, 2026
776c8aa
wip
anj-s Mar 5, 2026
273deb6
Merge branch 'main' into u/anj/task-tracker-phase-3
anj-s Mar 5, 2026
ed7ecde
revert svg files that should not be modified
anj-s Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions packages/core/src/core/__snapshots__/prompts.test.ts.snap

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions packages/core/src/core/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ describe('Core System Prompt (prompts.ts)', () => {
}),
getApprovalMode: vi.fn().mockReturnValue(ApprovalMode.DEFAULT),
getApprovedPlanPath: vi.fn().mockReturnValue(undefined),
isTrackerEnabled: vi.fn().mockReturnValue(false),
} as unknown as Config;
});

Expand Down Expand Up @@ -223,6 +224,17 @@ describe('Core System Prompt (prompts.ts)', () => {
expect(prompt).toMatchSnapshot();
});

it('should include the TASK MANAGEMENT PROTOCOL when task tracker is enabled', () => {
vi.mocked(mockConfig.getActiveModel).mockReturnValue(PREVIEW_GEMINI_MODEL);
vi.mocked(mockConfig.isTrackerEnabled).mockReturnValue(true);
const prompt = getCoreSystemPrompt(mockConfig);
expect(prompt).toContain('# TASK MANAGEMENT PROTOCOL');
expect(prompt).toContain(
'**PLAN MODE INTEGRATION**: If an approved plan exists, you MUST use the `tracker_create_task` tool to decompose it into discrete tasks before writing any code',
);
expect(prompt).toMatchSnapshot();
});

it('should use chatty system prompt for preview model', () => {
vi.mocked(mockConfig.getActiveModel).mockReturnValue(PREVIEW_GEMINI_MODEL);
const prompt = getCoreSystemPrompt(mockConfig);
Expand Down Expand Up @@ -400,6 +412,7 @@ describe('Core System Prompt (prompts.ts)', () => {
getSkills: vi.fn().mockReturnValue([]),
}),
getApprovedPlanPath: vi.fn().mockReturnValue(undefined),
isTrackerEnabled: vi.fn().mockReturnValue(false),
} as unknown as Config;

const prompt = getCoreSystemPrompt(testConfig);
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/prompts/promptProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('PromptProvider', () => {
}),
getApprovedPlanPath: vi.fn().mockReturnValue(undefined),
getApprovalMode: vi.fn(),
isTrackerEnabled: vi.fn().mockReturnValue(false),
} as unknown as Config;
});

Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/prompts/promptProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export class PromptProvider {
approvedPlan: approvedPlanPath
? { path: approvedPlanPath }
: undefined,
taskTracker: config.isTrackerEnabled(),
}),
!isPlanMode,
),
Expand All @@ -168,9 +169,11 @@ export class PromptProvider {
planModeToolsList,
plansDir: config.storage.getPlansDir(),
approvedPlanPath: config.getApprovedPlanPath(),
taskTracker: config.isTrackerEnabled(),
}),
isPlanMode,
),
taskTracker: config.isTrackerEnabled(),
operationalGuidelines: this.withSection(
'operationalGuidelines',
() => ({
Expand Down
29 changes: 29 additions & 0 deletions packages/core/src/prompts/snippets.ts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import {
READ_FILE_PARAM_END_LINE,
SHELL_PARAM_IS_BACKGROUND,
EDIT_PARAM_OLD_STRING,
TRACKER_CREATE_TASK_TOOL_NAME,
TRACKER_LIST_TASKS_TOOL_NAME,
TRACKER_UPDATE_TASK_TOOL_NAME,
} from '../tools/tool-names.js';
import type { HierarchicalMemory } from '../config/memory.js';
import { DEFAULT_CONTEXT_FILENAME } from '../tools/memoryTool.js';
Expand All @@ -41,6 +44,7 @@ export interface SystemPromptOptions {
hookContext?: boolean;
primaryWorkflows?: PrimaryWorkflowsOptions;
planningWorkflow?: PlanningWorkflowOptions;
taskTracker?: boolean;
operationalGuidelines?: OperationalGuidelinesOptions;
sandbox?: SandboxMode;
interactiveYoloMode?: boolean;
Expand All @@ -66,6 +70,7 @@ export interface PrimaryWorkflowsOptions {
enableGrep: boolean;
enableGlob: boolean;
approvedPlan?: { path: string };
taskTracker?: boolean;
}

export interface OperationalGuidelinesOptions {
Expand All @@ -83,6 +88,7 @@ export interface PlanningWorkflowOptions {
planModeToolsList: string;
plansDir: string;
approvedPlanPath?: string;
taskTracker?: boolean;
}

export interface AgentSkillOptions {
Expand Down Expand Up @@ -120,6 +126,8 @@ ${
: renderPrimaryWorkflows(options.primaryWorkflows)
}

${options.taskTracker ? renderTaskTracker() : ''}

${renderOperationalGuidelines(options.operationalGuidelines)}

${renderInteractiveYoloMode(options.interactiveYoloMode)}
Expand Down Expand Up @@ -464,6 +472,24 @@ ${trimmed}
return `\n---\n\n<loaded_context>\n${sections.join('\n')}\n</loaded_context>`;
}

export function renderTaskTracker(): string {
const trackerCreate = formatToolName(TRACKER_CREATE_TASK_TOOL_NAME);
const trackerList = formatToolName(TRACKER_LIST_TASKS_TOOL_NAME);
const trackerUpdate = formatToolName(TRACKER_UPDATE_TASK_TOOL_NAME);

return `
# TASK MANAGEMENT PROTOCOL
You are operating with a persistent file-based task tracking system located at \`.tracker/tasks/\`. You must adhere to the following rules:

1. **NO IN-MEMORY LISTS**: Do not maintain a mental list of tasks or write markdown checkboxes in the chat. Use the provided tools (${trackerCreate}, ${trackerList}, ${trackerUpdate}) for all state management.
2. **IMMEDIATE DECOMPOSITION**: Upon receiving a task, evaluate its functional complexity and scope. If the request involves more than a single atomic modification, or necessitates research before execution, you MUST immediately decompose it into discrete entries using ${trackerCreate}.
3. **IGNORE FORMATTING BIAS**: Trigger the protocol based on the **objective complexity** of the goal, regardless of whether the user provided a structured list or a single block of text/paragraph. "Paragraph-style" goals that imply multiple actions are multi-step projects and MUST be tracked.
4. **PLAN MODE INTEGRATION**: If an approved plan exists, you MUST use the ${trackerCreate} tool to decompose it into discrete tasks before writing any code. Maintain a bidirectional understanding between the plan document and the task graph.
5. **VERIFICATION**: Before marking a task as complete, verify the work is actually done (e.g., run the test, check the file existence).
6. **STATE OVER CHAT**: If the user says "I think we finished that," but the tool says it is 'pending', trust the tool--or verify explicitly before updating.
7. **DEPENDENCY MANAGEMENT**: Respect task topology. Never attempt to execute a task if its dependencies are not marked as 'closed'. If you are blocked, focus only on the leaf nodes of the task graph.`.trim();
}

export function renderPlanningWorkflow(
options?: PlanningWorkflowOptions,
): string {
Expand Down Expand Up @@ -583,6 +609,9 @@ function workflowStepStrategy(options: PrimaryWorkflowsOptions): string {
if (options.approvedPlan) {
return `2. **Strategy:** An approved plan is available for this task. Treat this file as your single source of truth. You MUST read this file before proceeding. If you discover new requirements or need to change the approach, confirm with the user and update this plan file to reflect the updated design decisions or discovered requirements. Once all implementation and verification steps are finished, provide a **final summary** of the work completed against the plan and offer clear **next steps** to the user (e.g., 'Open a pull request').`;
}
if (options.approvedPlan && options.taskTracker) {
return `2. **Strategy:** An approved plan is available for this task. Treat this file as your single source of truth and invoke the task tracker tool to create tasks for this plan. You MUST read this file before proceeding. If you discover new requirements or need to change the approach, confirm with the user and update this plan file to reflect the updated design decisions or discovered requirements. Make sure to update the tracker task list based on this updated plan. Once all implementation and verification steps are finished, provide a **final summary** of the work completed against the plan and offer clear **next steps** to the user (e.g., 'Open a pull request').`;
}
Comment on lines 609 to +614
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The new if (options.approvedPlan && options.taskTracker) block is unreachable because the preceding if (options.approvedPlan) block will always execute first and return, preventing the new logic from ever being evaluated. To fix this, the logic should be nested or reordered to check for the more specific condition first. Additionally, the suggested instruction for deviations from the approved plan explicitly tells the agent to confirm changes with the user, which aligns with repository guidelines.

Suggested change
if (options.approvedPlan) {
return `2. **Strategy:** An approved plan is available for this task. Treat this file as your single source of truth. You MUST read this file before proceeding. If you discover new requirements or need to change the approach, confirm with the user and update this plan file to reflect the updated design decisions or discovered requirements. Once all implementation and verification steps are finished, provide a **final summary** of the work completed against the plan and offer clear **next steps** to the user (e.g., 'Open a pull request').`;
}
if (options.approvedPlan && options.taskTracker) {
return `2. **Strategy:** An approved plan is available for this task. Treat this file as your single source of truth and invoke the task tracker tool to create tasks for this plan. You MUST read this file before proceeding. If you discover new requirements or need to change the approach, confirm with the user and update this plan file to reflect the updated design decisions or discovered requirements. Make sure to update the tracker task list based on this updated plan. Once all implementation and verification steps are finished, provide a **final summary** of the work completed against the plan and offer clear **next steps** to the user (e.g., 'Open a pull request').`;
}
if (options.approvedPlan) {
if (options.taskTracker) {
return `2. **Strategy:** An approved plan is available for this task. Treat this file as your single source of truth and invoke the task tracker tool to create tasks for this plan. You MUST read this file before proceeding. If you discover new requirements or need to change the approach, confirm with the user and update this plan file to reflect the updated design decisions or discovered requirements. Make sure to update the tracker task list based on this updated plan. Once all implementation and verification steps are finished, provide a **final summary** of the work completed against the plan and offer clear **next steps** to the user (e.g., 'Open a pull request').`;
}
return `2. **Strategy:** An approved plan is available for this task. Treat this file as your single source of truth. You MUST read this file before proceeding. If you discover new requirements or need to change the approach, confirm with the user and update this plan file to reflect the updated design decisions or discovered requirements. Once all implementation and verification steps are finished, provide a **final summary** of the work completed against the plan and offer clear **next steps** to the user (e.g., 'Open a pull request').`;
}
References
  1. When instructing an agent to follow an approved plan, if deviations are necessary, prefer explicitly telling the agent to confirm changes with the user rather than providing a general reminder to adhere to safety guidelines.


if (options.enableWriteTodosTool) {
return `2. **Strategy:** Formulate a grounded plan based on your research.${
Expand Down
19 changes: 12 additions & 7 deletions packages/core/src/tools/tool-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,18 @@ export const LS_TOOL_NAME_LEGACY = 'list_directory'; // Just to be safe if anyth

export const EDIT_TOOL_NAMES = new Set([EDIT_TOOL_NAME, WRITE_FILE_TOOL_NAME]);

export const TRACKER_CREATE_TASK_TOOL_NAME = 'tracker_create_task';
export const TRACKER_UPDATE_TASK_TOOL_NAME = 'tracker_update_task';
export const TRACKER_GET_TASK_TOOL_NAME = 'tracker_get_task';
export const TRACKER_LIST_TASKS_TOOL_NAME = 'tracker_list_tasks';
export const TRACKER_ADD_DEPENDENCY_TOOL_NAME = 'tracker_add_dependency';
export const TRACKER_VISUALIZE_TOOL_NAME = 'tracker_visualize';

// Tool Display Names
export const WRITE_FILE_DISPLAY_NAME = 'WriteFile';
export const EDIT_DISPLAY_NAME = 'Edit';
export const ASK_USER_DISPLAY_NAME = 'Ask User';
export const READ_FILE_DISPLAY_NAME = 'ReadFile';
export const GLOB_DISPLAY_NAME = 'FindFiles';
export const TRACKER_CREATE_TASK_TOOL_NAME = 'tracker_create_task';
export const TRACKER_UPDATE_TASK_TOOL_NAME = 'tracker_update_task';
export const TRACKER_GET_TASK_TOOL_NAME = 'tracker_get_task';
export const TRACKER_LIST_TASKS_TOOL_NAME = 'tracker_list_tasks';
export const TRACKER_ADD_DEPENDENCY_TOOL_NAME = 'tracker_add_dependency';
export const TRACKER_VISUALIZE_TOOL_NAME = 'tracker_visualize';

/**
* Mapping of legacy tool names to their current names.
Expand Down Expand Up @@ -229,6 +228,12 @@ export const ALL_BUILTIN_TOOL_NAMES = [
GET_INTERNAL_DOCS_TOOL_NAME,
ENTER_PLAN_MODE_TOOL_NAME,
EXIT_PLAN_MODE_TOOL_NAME,
TRACKER_CREATE_TASK_TOOL_NAME,
TRACKER_UPDATE_TASK_TOOL_NAME,
TRACKER_GET_TASK_TOOL_NAME,
TRACKER_LIST_TASKS_TOOL_NAME,
TRACKER_ADD_DEPENDENCY_TOOL_NAME,
TRACKER_VISUALIZE_TOOL_NAME,
Comment on lines +231 to +236
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The tracker-related tool names are duplicated in the ALL_BUILTIN_TOOL_NAMES array. They are already present on lines 222-227 and are being added again here. This duplication should be removed.

] as const;

/**
Expand Down
Loading