tasks

package
v0.11.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Overview

Package tasks — cross-session task graph (§8.3 Phase 5 #2).

The agent tracks user requests that span sessions: "fix the auth bug" from Tuesday, "add CSRF protection" from yesterday. Each request becomes a Task with a status (open / shipped / abandoned) and a list of linked commits. At session open the agent reads the open threads and surfaces them — "you asked me to fix X 3 days ago, that shipped (abc123)".

Storage: one JSON file per task at ~/.overkill/tasks/<id>.json. Atomic temp+rename so a crash mid-write leaves the prior state intact. Single-file-per-task is simpler than JSONL when we need to mutate status / link commits — no fold-from-zero on every read.

Linking: tasks are linked to commits via two paths:

  • Trailer match: the agent inserts `Overkill-Task: <id>` in commit messages. The boot scan reads `git log --grep` for the trailer.
  • Keyword scan: the agent can call LinkCommit explicitly with a known SHA when it recognizes the work that just shipped.

Either path is best-effort. The git surface lives outside this package — keeps internal/tasks portable + testable without git.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatOpenerSummary

func FormatOpenerSummary(open []*Task) string

FormatOpenerSummary renders the boot-time message the agent surfaces when there are stale open tasks. Empty when nothing qualifies. Caller decides the age threshold via OpenOlderThan.

Types

type Status

type Status string

Status is the current lifecycle position of a Task.

const (
	// StatusOpen: user asked, agent hasn't shipped yet.
	StatusOpen Status = "open"
	// StatusInProgress: agent is actively working on it.
	StatusInProgress Status = "in_progress"
	// StatusShipped: agent considers it done. Commits attached.
	StatusShipped Status = "shipped"
	// StatusAbandoned: user / agent decided not to do it.
	StatusAbandoned Status = "abandoned"
)

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store wraps the on-disk tasks directory.

func NewStore

func NewStore(dir string) *Store

NewStore wires the store to dir. Lazy-creates the directory on the first write.

func (*Store) All

func (s *Store) All() ([]*Task, error)

All returns every persisted task, newest-first by CreatedAt.

func (*Store) AppendNote

func (s *Store) AppendNote(id, note string) (*Task, error)

AppendNote attaches a one-line update to the task's Notes field. Multiple notes are separated by " | " so the field stays a single JSON string (no schema churn). Returns an error for empty input (B116).

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete removes a task file by ID. No-op when the task doesn't exist (idempotent — delete what isn't there is still success).

func (*Store) ExportJSONL

func (s *Store) ExportJSONL(w *bufio.Writer) error

ExportJSONL writes every persisted task as one JSONL line per task to w. Used by sync / backup. Newest-first.

func (*Store) Get

func (s *Store) Get(id string) (*Task, error)

Get returns the task by ID, or (nil, nil) when not found.

func (*Store) LinkCommit

func (s *Store) LinkCommit(id, sha string) (*Task, error)

LinkCommit attaches a commit SHA to the task. Idempotent — re-linking the same SHA is a no-op. Does NOT auto-transition to shipped; the caller decides whether one linked commit is enough.

func (*Store) Open

func (s *Store) Open(sessionID, intent string) (*Task, error)

Open creates a new task in StatusOpen. Returns the task with its assigned ID. Empty intent is rejected (a task without a distilled intent isn't useful).

func (*Store) OpenOlderThan

func (s *Store) OpenOlderThan(age time.Duration) ([]*Task, error)

OpenOlderThan returns non-terminal tasks created more than `age` ago. The session-open surface uses this to filter out things the user just asked about (no point reminding them about a request from 5 minutes ago).

func (*Store) OpenTasks

func (s *Store) OpenTasks() ([]*Task, error)

Open returns tasks in StatusOpen or StatusInProgress, newest-first. Used at session open to surface unfinished threads.

func (*Store) Search

func (s *Store) Search(query string) ([]*Task, error)

Search substring-matches across Intent / Notes / Tags case-insensitively. Empty query returns empty.

func (*Store) SetStatus

func (s *Store) SetStatus(id string, status Status) (*Task, error)

SetStatus transitions the task. Idempotent. Pass shipped → also stamps ResolvedAt.

func (*Store) UpdateIntent

func (s *Store) UpdateIntent(id, sessionID, intent string) (*Task, error)

UpdateIntent edits a task in its owning session without changing lifecycle, linked commits, or creation metadata.

type Task

type Task struct {
	ID         string    `json:"id"`
	SessionID  string    `json:"session_id"`
	Intent     string    `json:"intent"`
	Status     Status    `json:"status"`
	Commits    []string  `json:"commits,omitempty"`
	Tags       []string  `json:"tags,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	ResolvedAt time.Time `json:"resolved_at,omitempty"`
	// Notes is free-form prose the agent attaches mid-flight:
	// "tried X, it failed because Y; switching to Z". Useful for
	// the session-open surface even before commits land.
	Notes string `json:"notes,omitempty"`
}

Task is one cross-session task record.

func (*Task) IsTerminal

func (t *Task) IsTerminal() bool

IsTerminal reports whether the task is in a final state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL