Feature: Goal & Task Tracking
Relevant source files
The following files were used as context for generating this wiki page:
The Goal and Task Tracking feature is a cornerstone of the Pointron application, which is described as "Your focus haven, a tool for tracking goals and managing your time." This system allows users to define, organize, and monitor their objectives with a high degree of granularity. Users can create deeply nested goals and associate them with atomic-level tasks, providing a structured approach to personal productivity and focus management.
This functionality is part of the larger Nucleus "super app," which combines various productivity tools. The goal and task system is designed to be powerful, enabling features like advanced focus sessions, analytics, and calendar views to help users track their progress effectively.
Sources: README.md:16-18, client/landing/routes/+page.server.ts:601-606
Core Data Models
The feature is built upon two primary data models: Goal and Task. These models are defined through a series of TypeScript interfaces that describe their structure, properties, and relationships.
Goal Data Model
A Goal is a complex entity that can be hierarchical, having parent and child goals. It includes properties for defining its scope, duration, status, and visual representation. The core structure is defined in IGoalBase, with the full IGoal type extending it with resource-specific properties.
Sources: client/components/goals/goal.type.ts
The diagram below illustrates the composition of the IGoal type from various base and resource interfaces.
IGoalBase Properties
This interface defines the fundamental properties of a goal.
| Property | Type | Description |
|---|---|---|
type | GoalType | The type of the goal (e.g., INDEFINITE, DEFINITE). |
description | IMarkdown | A detailed description of the goal in Markdown format. |
startDate | Date | The planned start date of the goal. |
endDate | Date | The planned end date of the goal. |
spanScale | TimeScale | The time scale associated with the goal's span (e.g., day, week). |
subGoalsLayout | SubGoalsLayout | Defines the UI layout for displaying sub-goals. |
status | GoalStatus | The current status of the goal (e.g., NOT_STARTED). |
color | number | A color code for UI representation. |
isPinnedForQuickFocus | boolean | If true, the goal is pinned for quick access in focus sessions. |
uiState | object | Stores UI-specific state, like tab order and visibility of completed items. |
Sources: client/components/goals/goal.type.ts:29-47
Task Data Model
A Task is a more granular action item that can be associated with a Goal. It has its own status, type, and properties for time tracking.
ITask Properties
| Property | Type | Description |
|---|---|---|
id | IRecordId | Unique identifier for the task. |
label | string | The name or title of the task. |
status | TaskStatus | The current status of the task (e.g., TODO, DONE). |
type | TaskType | The type of the task (e.g., DEFAULT, APPROVAL). |
goal | IRecordId[] | An array of IRecordIds linking the task to its parent goal(s). |
description | IMarkdown | A detailed description of the task. |
dueDate | Date | The date the task is due. |
timeEstimate | number | Estimated time in minutes to complete the task. |
timeSpent | number | Actual time in minutes spent on the task. |
Sources: client/components/tasks/task.type.ts:18-32
Entity Relationships
Goals and Tasks are interconnected. A Goal can have multiple sub-goals (a recursive relationship) and multiple associated Tasks. A Task is typically linked to one or more parent Goals.
This Entity-Relationship diagram shows the connections between Goals and Tasks.
State and Status Enums
The system uses several enums to define the possible states and types for Goals and Tasks, ensuring consistency across the application.
Goal Enums
| Enum | Member | Description |
|---|---|---|
GoalType | INDEFINITE | A goal with no specific end date. |
DEFINITE | A goal with a defined start and end date. | |
ROUTINE | Deprecated. Handled by todos now. | |
GoalStatus | NOT_STARTED | The goal has not been started. |
IN_PROGRESS | The goal is currently being worked on. | |
COMPLETED | The goal has been completed. | |
SubGoalsLayout | DEFAULT | Standard layout for sub-goals. |
TREE | Hierarchical tree view. | |
STEPS | Sequential step-by-step view. | |
TABS | Sub-goals displayed in tabs. | |
BOARDS | Kanban-style board view. |
Sources: client/components/goals/goal.type.ts:13-28, client/components/goals/goal.type.ts:71-75
The lifecycle of a Goal can be visualized with the following state diagram based on GoalStatus.
Task Enums
| Enum | Member | Description |
|---|---|---|
TaskStatus | TODO | The task is yet to be done. |
IN_PROGRESS | The task is being worked on. | |
DONE | The task is completed. | |
WONT_DO | The task will not be completed. | |
DUPLICATE | The task is a duplicate of another. | |
TaskType | DEFAULT | A standard task. |
APPROVAL | A task that requires approval. |
Sources: client/components/tasks/task.type.ts:5-13
State Management (Svelte Stores)
Client-side state for goals and tasks is managed using Svelte stores. These stores provide reactive data handling and a centralized API for creating, updating, and deleting entities.
Goal Store (goal.store.ts)
This store manages the state of all goals. It provides writable stores for the list of all goals (goals) and the currently active goal (activeGoal), along with functions to manipulate them.
| Store | Type | Description |
|---|---|---|
goals | writable<IGoal[]> | An array containing all goal objects. |
activeGoal | writable<IActiveGoal> | The goal currently being viewed or edited by the user. |
isGoalStoreLoading | writable<boolean> | A flag indicating if the goal store is performing an operation. |
Sources: client/components/goals/goal.store.ts:25-27
Key functions in the goal store include:
createGoal(goal: IGoalCapture): Creates a new goal.updateGoal(goal: Partial<IGoal>): Updates an existing goal.deleteGoal(id: IRecordId): Deletes a goal.setActiveGoal(id: IRecordId): Sets the active goal by its ID.
Sources: client/components/goals/goal.store.ts:33-100
The flow for creating a new goal is illustrated below.
Task Store (task.store.ts)
Similarly, the task.store.ts file manages the state for all tasks. It provides stores for the list of tasks and the currently active task.
| Store | Type | Description |
|---|---|---|
tasks | writable<ITask[]> | An array containing all task objects. |
activeTask | writable<IActiveTask> | The task currently being viewed or edited. |
isTaskStoreLoading | writable<boolean> | A flag indicating if the task store is busy. |
Sources: client/components/tasks/task.store.ts:16-18
Key functions in the task store include:
createTask(task: ITaskCapture): Creates a new task.updateTask(task: Partial<ITask>): Updates an existing task.deleteTask(id: IRecordId): Deletes a task.
Sources: client/components/tasks/task.store.ts:24-74
Conclusion
The Goal & Task Tracking feature in Pointron is a well-structured system built on clear data models, state enums, and reactive Svelte stores. The hierarchical nature of goals, combined with granular tasks, provides a flexible framework for users to manage their objectives. The separation of data types (goal.type.ts, task.type.ts) from state logic (goal.store.ts, task.store.ts) creates a maintainable and scalable architecture for this core productivity feature.