Documentation
¶
Overview ¶
Package tasks implements a file-authoritative task ledger for TinyMem.
The task system follows these principles: 1. tinyTasks.md is the sole source of truth for task state 2. TinyMem never infers task completion 3. Memory entries are fully rebuildable from the file 4. If file and memory disagree, file wins 5. Memory never stores subtask text or implementation detail
The system supports: - Top-level checkbox tasks with nested subtasks - Stable task identification based on section and position - One-way sync from file to memory - Drift detection and recovery
Index ¶
- func CreateInertTaskFile(projectPath string) error
- func ShouldAutoCreateTaskFile(input string) bool
- type Service
- func (s *Service) CanActOnTask(taskID string, query string) (bool, error)
- func (s *Service) CanCreateNewTask(query string) bool
- func (s *Service) CreateOrUpdateTask(task *Task) error
- func (s *Service) DeleteTask(key string) error
- func (s *Service) DetectAndRecoverDrift(filePath string) error
- func (s *Service) GetAllTasks() ([]*memory.Memory, error)
- func (s *Service) GetTaskByKey(key string) (*memory.Memory, error)
- func (s *Service) GetTaskStatus(projectPath string) (map[string]interface{}, error)
- func (s *Service) HasExplicitTaskContinuationIntent(query string) bool
- func (s *Service) SyncTasks(projectPath string) error
- func (s *Service) SyncTasksFromFile(filePath string) error
- type SubtaskSpec
- type Task
- type TaskDefinition
- type TaskDocument
- type TaskManager
- func (tm *TaskManager) AddTask(def TaskDefinition) (*Task, error)
- func (tm *TaskManager) Complete(taskID string) (*Task, error)
- func (tm *TaskManager) CreateInertFile() error
- func (tm *TaskManager) Exists() (bool, error)
- func (tm *TaskManager) Hash() (string, error)
- func (tm *TaskManager) List() ([]*Task, error)
- func (tm *TaskManager) Load() (*TaskDocument, error)
- func (tm *TaskManager) Path() string
- func (tm *TaskManager) UpdateTask(taskID string, update TaskUpdate) (*Task, error)
- type TaskMode
- type TaskRange
- type TaskSafetyEnforcer
- type TaskState
- type TaskUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateInertTaskFile ¶ added in v0.5.2
CreateInertTaskFile creates the canonical inert tinyTasks.md template This file is intentionally non-authorizing - humans must edit it to add tasks
func ShouldAutoCreateTaskFile ¶ added in v0.5.2
ShouldAutoCreateTaskFile detects if a request implies multi-step work
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles task operations
func NewService ¶
func NewService(db *storage.DB, memoryService *memory.Service, projectID string, manager *TaskManager) *Service
NewService creates a new task service
func (*Service) CanActOnTask ¶ added in v0.1.23
CanActOnTask checks if an action can be performed on a task based on safety rules
func (*Service) CanCreateNewTask ¶ added in v0.1.23
CanCreateNewTask checks if a new task can be created based on the query
func (*Service) CreateOrUpdateTask ¶
CreateOrUpdateTask creates or updates a task in memory
func (*Service) DeleteTask ¶
DeleteTask removes a task from memory
func (*Service) DetectAndRecoverDrift ¶
DetectAndRecoverDrift checks for differences between file and memory and recovers if needed
func (*Service) GetAllTasks ¶
GetAllTasks retrieves all task memories for the project
func (*Service) GetTaskByKey ¶
GetTaskByKey retrieves a task by its key
func (*Service) GetTaskStatus ¶
GetTaskStatus returns a summary of task status
func (*Service) HasExplicitTaskContinuationIntent ¶ added in v0.1.23
HasExplicitTaskContinuationIntent checks if the query explicitly requests task continuation
func (*Service) SyncTasksFromFile ¶
SyncTasksFromFile synchronizes tasks from the tinyTasks.md file to memory
type SubtaskSpec ¶ added in v0.8.0
SubtaskSpec describes a single subtask line.
type Task ¶
type Task struct {
ID string `json:"id"`
Title string `json:"title"`
Section string `json:"section"`
Index int `json:"index"`
StepsTotal int `json:"steps_total"`
StepsDone int `json:"steps_done"`
Completed bool `json:"completed"`
State TaskState `json:"state"`
Mode TaskMode `json:"mode"`
LastSeenHash string `json:"last_seen_hash"`
FilePath string `json:"file_path"`
LastUpdated string `json:"last_updated"`
ExtraFields map[string]string `json:"extra_fields,omitempty"` // For future extensibility
}
Task represents a parsed task from tinyTasks.md
type TaskDefinition ¶ added in v0.8.0
type TaskDefinition struct {
Section string
Title string
Subtasks []SubtaskSpec
}
TaskDefinition describes a task the manager will add to the file.
type TaskDocument ¶ added in v0.8.0
type TaskDocument struct {
Lines []string
HasTrailingNewline bool
TaskOrder []*TaskRange
Ranges map[string]*TaskRange
SectionEnds map[string]int
SectionHeaders map[string]int
SectionCounts map[string]int
}
TaskDocument represents the parsed structure of tinyTasks.md.
func (*TaskDocument) CloneLines ¶ added in v0.8.0
func (doc *TaskDocument) CloneLines() []string
func (*TaskDocument) HasSection ¶ added in v0.8.0
func (doc *TaskDocument) HasSection(name string) bool
func (*TaskDocument) TaskRangeByID ¶ added in v0.8.0
func (doc *TaskDocument) TaskRangeByID(id string) (*TaskRange, bool)
func (*TaskDocument) Tasks ¶ added in v0.8.0
func (doc *TaskDocument) Tasks() []*Task
type TaskManager ¶ added in v0.8.0
type TaskManager struct {
// contains filtered or unexported fields
}
TaskManager centralizes every interaction with tinyTasks.md so that the server can treat the file as the single source of truth without letting other modules read or mutate it directly.
func NewTaskManager ¶ added in v0.8.0
func NewTaskManager(path string) *TaskManager
NewTaskManager returns a manager bound to the provided tinyTasks.md path.
func (*TaskManager) AddTask ¶ added in v0.8.0
func (tm *TaskManager) AddTask(def TaskDefinition) (*Task, error)
AddTask appends a new task to the file. If the file does not exist, it is created with the canonical inert template before the addition.
func (*TaskManager) Complete ¶ added in v0.8.0
func (tm *TaskManager) Complete(taskID string) (*Task, error)
Complete marks every checkbox within a task as finished.
func (*TaskManager) CreateInertFile ¶ added in v0.8.0
func (tm *TaskManager) CreateInertFile() error
CreateInertFile writes the canonical inert tinyTasks.md template.
func (*TaskManager) Exists ¶ added in v0.8.0
func (tm *TaskManager) Exists() (bool, error)
Exists reports whether the task file is present.
func (*TaskManager) Hash ¶ added in v0.8.0
func (tm *TaskManager) Hash() (string, error)
Hash returns the SHA256 hash of the task file.
func (*TaskManager) List ¶ added in v0.8.0
func (tm *TaskManager) List() ([]*Task, error)
List returns the tasks in file order.
func (*TaskManager) Load ¶ added in v0.8.0
func (tm *TaskManager) Load() (*TaskDocument, error)
Load parses the task file into a document structure.
func (*TaskManager) Path ¶ added in v0.8.0
func (tm *TaskManager) Path() string
Path returns the configured file path.
func (*TaskManager) UpdateTask ¶ added in v0.8.0
func (tm *TaskManager) UpdateTask(taskID string, update TaskUpdate) (*Task, error)
UpdateTask mutates the title or subtasks for a given task.
type TaskMode ¶ added in v0.1.23
type TaskMode string
TaskMode represents how the task should be treated
type TaskSafetyEnforcer ¶ added in v0.1.23
type TaskSafetyEnforcer struct {
// contains filtered or unexported fields
}
TaskSafetyEnforcer enforces the safety rules for task operations
func NewTaskSafetyEnforcer ¶ added in v0.1.23
func NewTaskSafetyEnforcer() *TaskSafetyEnforcer
NewTaskSafetyEnforcer creates a new safety enforcer
func (*TaskSafetyEnforcer) CanActOnTask ¶ added in v0.1.23
func (e *TaskSafetyEnforcer) CanActOnTask(task *Task, query string) bool
CanActOnTask determines if an action can be performed on a task
func (*TaskSafetyEnforcer) CanCreateNewTask ¶ added in v0.1.23
func (e *TaskSafetyEnforcer) CanCreateNewTask(query string) bool
CanCreateNewTask determines if a new task can be created without affecting existing tasks
func (*TaskSafetyEnforcer) HasExplicitTaskContinuationIntent ¶ added in v0.1.23
func (e *TaskSafetyEnforcer) HasExplicitTaskContinuationIntent(query string) bool
HasExplicitTaskContinuationIntent checks if the user explicitly requested to continue tasks
type TaskUpdate ¶ added in v0.8.0
type TaskUpdate struct {
Title *string
Subtasks *[]SubtaskSpec
}
TaskUpdate describes a mutation to an existing task.