{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package taskrun\n\nPackage taskrun is the durable ledger of autonomous task executions.\n\nA Run is IMMUTABLE HISTORY. It snapshots everything that decided what an execution meant — the definition's revision and full text, the resolved project, the trigger occurrence, the expanded authority, the chosen runtime, the limits — at the moment it is created. Nothing re-reads the YAML mid-run, so editing a task file while it executes cannot retroactively change what that run was authorized to do or why it did it.\n\nIt lives in its own database rather than the gateway's for two reasons: \\`memcode task run\\` has to work on a machine where the daemon has never started (gateway state.OpenShared refuses when there is no gateway.db), and the run ledger is an audit trail that must outlive the gateway's operational state, which is pruned.\n\n## Constants\n\n```go\nconst Fresh = 2 * time.Minute\n```\nFresh bounds what counts as \"this just happened\" rather than \"this was missed\". Generous relative to the poll interval so a slow tick is never mistaken for downtime.\n\n```go\nconst StaleAfter = 2 * time.Minute\n```\nStaleAfter is how long a running row may go without a heartbeat before Reconcile calls it dead. Generous relative to the heartbeat interval so a loaded machine is never mistaken for a crashed one.\n\n```go\nconst TriggerManual = \"manual\"\n```\nTriggerManual is the trigger kind for a run started by hand.\n\n## Variables\n\n```go\nvar ErrOccupied = fmt.Errorf(\"this occurrence already has a run\")\n```\nErrOccupied means this trigger occurrence already has a run. The caller must NOT execute: someone else owns it.\n\n## Functions\n\n```go\nfunc DBPath() (string, error)\n```\nDBPath is the ledger's location, alongside the rest of memcode's per-machine state.\n\n```go\nfunc LeaseKey(t task.Task, project string) string\n```\nLeaseKey is the resource a run needs exclusive use of.\n\nRead-only runs return \"\" and take no lease at all: they change nothing, so two of them in a repo cannot interfere, and serializing them would only make an audit task block a dependency upgrade for no reason.\n\nA mutating run keys on its RESOLVED PROJECT, so every mutating task in a repo serializes against the others. Worktree isolation may safely relax this later, but one mutating run per project is the conservative default and the right place to start.\n\n```go\nfunc LeaseKeys(t task.Task, project string) []string\n```\nLeaseKeys is every resource one run must hold exclusively.\n\nA cross-project run mutates several checkouts, and leasing only the one it was anchored in leaves the others open to a second run working in them at the same time — which is the failure the lease exists to prevent, just moved one project to the left. A custom concurrency key is one key by definition and stays one key.\n\n```go\nfunc NewID(now time.Time) string\n```\nNewID returns a sortable, unique run identity. Time-prefixed so a directory listing or an ORDER BY id reads chronologically without a join.\n\n```go\nfunc OccurrenceID(tr task.Trigger, at time.Time) string\n```\nOccurrenceID is the ledger identity of one firing of one trigger.\n\n```go\nfunc Spec(tr task.Trigger) occurrence.Spec\n```\nSpec converts a task trigger into the timing form the occurrence package understands.\n\n```go\nfunc Summarize(results []CheckResult) string\n```\nSummarize renders check results for a run record.\n\n```go\nfunc TriggerKey(tr task.Trigger) string\n```\nTriggerKey identifies the SCHEDULE, for storing its watermark.\n\n```go\nfunc Verify(ctx context.Context, dir string, commands []string, env ...string) ([]CheckResult, VerificationStatus)\n```\nVerify runs a task's checks in order, in dir. Every check runs even after one fails: \"which of the four broke\" is more useful than \"the first one broke\", and the cost is bounded by checkTimeout.\n\n## Types\n\n```go\ntype AuthSource func() runtimes.Authorizations\n```\nAuthorizations supplies the machine's recorded runtime permissions. Injectable so tests do not depend on whatever is installed on the developer's laptop, and so the daemon and the CLI read the same store.\n\n```go\ntype CheckResult struct {\n\tCommand  string\n\tExitCode int\n\tDuration time.Duration\n\t// Output is the tail of combined stdout/stderr, kept small: enough to see\n\t// what failed, not enough to bury the run record.\n\tOutput string\n\t// Err is set when the command could not be run at all, as distinct from\n\t// running and failing.\n\tErr string\n}\n```\nCheckResult is one verification command's outcome.\n\n```go\nfunc (c CheckResult) OK() bool\n```\nOK reports whether the command succeeded.\n\n```go\ntype Decision struct {\n\t// Fire are the logical occurrences to run, oldest first. Usually zero or one.\n\tFire []time.Time\n\t// Advance is the new watermark: the newest occurrence now accounted for,\n\t// whether it ran or was deliberately dropped. Persisting it is what stops a\n\t// dropped occurrence being rediscovered as missed on the next poll.\n\tAdvance time.Time\n\t// Dropped counts occurrences deliberately not run. Surfaced on the resulting\n\t// run so a collapsed backlog is visible rather than silently discarded.\n\tDropped int\n\t// Why explains a non-obvious decision, for the run record.\n\tWhy string\n}\n```\nDecision is what a poll concluded for one trigger.\n\n```go\nfunc Due(tr task.Trigger, last, now time.Time) (Decision, error)\n```\nDue computes what to run for one trigger, given the watermark of the last occurrence already accounted for.\n\nA zero \\`last\\` means the trigger has never been seen. It is then PLACED at its most recent past occurrence rather than treated as having missed everything since the epoch — adding a weekly task on a Friday must not immediately fire it for every Monday in history.\n\n```go\ntype ErrLeaseHeld struct{ Holder Lease }\n```\nErrLeaseHeld means someone else is working on this resource right now.\n\n```go\nfunc (e ErrLeaseHeld) Error() string\n```\n\n```go\ntype Escalation string\n```\nEscalation is what a run concluded about the task's future, as distinct from what it concluded about itself.\n\n```go\nconst (\n\t// EscalateNone: nothing to say. The default, and the common case.\n\tEscalateNone Escalation = \"\"\n\t// EscalateRetry: a transient condition — an upstream outage, a flaky\n\t// network. The task is fine; this run was unlucky. Never pauses, because a\n\t// temporary problem that suspends an automation forever is its own bug.\n\tEscalateRetry Escalation = \"retry_later\"\n\t// EscalateAttention: this run needs a human to look, but the next one is\n\t// still worth running.\n\tEscalateAttention Escalation = \"needs_attention\"\n\t// EscalatePause: the condition will recur until somebody decides something.\n\tEscalatePause Escalation = \"pause_task\"\n)\n```\n\n```go\nfunc ParseEscalation(out string) (Escalation, string)\n```\nParseEscalation reads the escalation line a run was asked to end with.\n\nThis is a DECLARED protocol, not error-string matching: the agent is told to state its conclusion in a fixed form and this reads that form. The judgement — is this transient, or does it need a person, or will it recur forever — is the model's, made with the whole situation in view. Guessing it from the shape of an error message is what this exists to avoid.\n\n```go\ntype ExecutionStatus string\n```\nExecutionStatus is whether the agent's half of the run completed.\n\n```go\nconst (\n\tExecCompleted   ExecutionStatus = \"completed\"\n\tExecFailed      ExecutionStatus = \"failed\"\n\tExecTimedOut    ExecutionStatus = \"timed_out\"\n\tExecInterrupted ExecutionStatus = \"interrupted\"\n\tExecBlocked     ExecutionStatus = \"blocked\"\n)\n```\n\n```go\ntype Lease struct {\n\tKey         string\n\tRunID       string\n\tTask        string\n\tHost        string\n\tPID         int\n\tAcquiredAt  time.Time\n\tHeartbeatAt time.Time\n}\n```\nLease is a held claim on a resource.\n\n```go\nfunc (l Lease) Expired(now time.Time, host string) bool\n```\nExpired reports whether a lease's owner looks gone, by the same rule Reconcile applies to runs.\n\n```go\ntype Outcome string\n```\nOutcome is what a finished run actually achieved. \"The agent stopped\" is never by itself \"the task succeeded\", which is the failure mode this distinction exists to prevent.\n\n```go\nconst (\n\tOutcomeSuccess Outcome = \"success\"\n\t// OutcomeNoChange is a successful run that found nothing to do. Worth its own\n\t// value: a weekly upgrade task reporting no_change is healthy, and collapsing\n\t// it into success hides whether the task is still finding anything.\n\tOutcomeNoChange Outcome = \"no_change\"\n\tOutcomeFailed   Outcome = \"failed\"\n\t// OutcomeNeedsAttention: the run completed correctly and decided a human must\n\t// choose. An ambiguous migration it declined to guess at is a SUCCESSFUL\n\t// execution and an incomplete task.\n\tOutcomeNeedsAttention Outcome = \"needs_attention\"\n\t// OutcomeBlocked: the run could not start its real work (lock held, project\n\t// missing, no authorized runtime).\n\tOutcomeBlocked Outcome = \"blocked\"\n\t// OutcomeInterrupted: the process vanished mid-run — killed, crashed, or the\n\t// machine went down. Deliberately NOT retried automatically; see Reconcile.\n\tOutcomeInterrupted Outcome = \"interrupted\"\n)\n```\n\n```go\nfunc Decide(exec ExecutionStatus, verify VerificationStatus, changed bool, agentNeedsAttention bool) Outcome\n```\nDecide derives the final outcome from FACTS, never from the agent's prose.\n\nThe precedence is deliberate and one-directional: a blocked run cannot be talked up to failed, a failed verification cannot be talked up to success, and an agent's needs\\_attention signal can only ever make the verdict more cautious. The agent participates in this decision at exactly one point — it may raise needs\\_attention — and has no path to lower it.\n\n```go\ntype Pause struct {\n\tTask    string\n\tProject string\n\tReason  string\n\tRunID   string\n\tSince   time.Time\n}\n```\nPause is a task's suspension, with the evidence needed to resolve it.\n\n```go\nfunc (p Pause) String() string\n```\nString renders a pause for a human deciding whether to deal with it now.\n\n```go\ntype PollResult struct {\n\tStarted []Run\n\t// Skipped counts occurrences deliberately not run, across all triggers.\n\tSkipped int\n\t// Errs holds per-task failures; one bad task never stops the others.\n\tErrs []error\n}\n```\nPollResult reports what one poll did.\n\n```go\ntype Result struct {\n\tOutcome      Outcome\n\tSummary      string\n\tDetail       string\n\tLogPath      string\n\tExecStatus   ExecutionStatus\n\tVerifyStatus VerificationStatus\n\tChecks       string\n\tWorktree     string\n\tBranch       string\n\tBaseRev      string\n\tResultRev    string\n\tChanged      bool\n\n\tRemote        string\n\tCommitSHA     string\n\tPRNumber      int\n\tPRURL         string\n\tCreatedBranch bool\n\tCreatedCommit bool\n\tCreatedPR     bool\n\n\t// Escalation is what the run concluded about FUTURE runs, as distinct from\n\t// this one. Not persisted on the run row: its consequence is a task pause,\n\t// which is its own durable record.\n\tEscalation    Escalation\n\tEscalationWhy string\n}\n```\nFinish closes a run. Terminal and idempotent: a run already done stays as it was, so a late finisher cannot overwrite an interrupted verdict. Result is everything a finished run records beyond its outcome.\n\n```go\nfunc (r Result) OKOutcome() bool\n```\nOKOutcome reports whether the result is one nobody needs to look at.\n\n```go\ntype Run struct {\n\tID   string\n\tTask string\n\n\t// Frozen definition. Revision identifies it; Definition is the full YAML, so\n\t// a run stays readable even after the file is deleted.\n\tRevision   string\n\tDefinition string\n\n\t// TriggerKind is manual/cron/every/at. TriggerID identifies the specific\n\t// OCCURRENCE and is the idempotency key: empty for manual runs (asking twice\n\t// means twice), unique per firing otherwise.\n\tTriggerKind string\n\tTriggerID   string\n\n\tProject    string\n\tGrants     []string\n\tTimeout    time.Duration\n\tMaxCostUSD float64\n\n\t// Where the inference ran. Requested and resolved are both frozen at\n\t// creation, so the choice stays explainable after the machine's state and\n\t// the user's authorizations have moved on.\n\tRuntimeRequested string\n\tRuntimeResolved  string\n\tModelRequested   string\n\tModelResolved    string\n\tCredSource       string\n\tAuthID           string\n\tAuthScope        string\n\n\tState   State\n\tOutcome Outcome\n\tSummary string\n\tDetail  string\n\tLogPath string\n\n\t// OccurredAt is the LOGICAL time this run stands for, which is not when it\n\t// started: a run_once recovery of Monday's occurrence executed on Wednesday\n\t// occurred-at Monday. That is what makes a recovered run explainable.\n\tOccurredAt time.Time\n\t// Backlog counts occurrences dropped when this one was created.\n\tBacklog int\n\n\t// Execution and verification, kept separable from Outcome.\n\tExecStatus   ExecutionStatus\n\tVerifyStatus VerificationStatus\n\tChecks       string\n\n\t// Where the work happened. BaseRev is resolved at EXECUTION time, so a\n\t// recovered occurrence is honest about building on today's HEAD rather than\n\t// implying the repository was frozen when it was due.\n\tWorktree  string\n\tBranch    string\n\tBaseRev   string\n\tResultRev string\n\tChanged   bool\n\n\t// What was published, and which artifacts this run created rather than\n\t// found already there.\n\tRemote        string\n\tCommitSHA     string\n\tPRNumber      int\n\tPRURL         string\n\tCreatedBranch bool\n\tCreatedCommit bool\n\tCreatedPR     bool\n\n\tHost string\n\tPID  int\n\n\tStartedAt   time.Time\n\tHeartbeatAt time.Time\n\tFinishedAt  time.Time\n\tSeen        Seen\n}\n```\nRun is one execution, with its inputs frozen at creation.\n\n```go\nfunc Freeze(t task.Task, root, triggerKind, triggerID string, now time.Time) (Run, error)\n```\nFreeze captures a task's execution inputs as a Run, resolving everything that could otherwise drift: the definition's revision AND full text, the absolute project path, the expanded authority, the runtime, the limits.\n\nNothing downstream reads the task file again. That is what makes a run mean one fixed thing forever, and it is why the definition is stored whole rather than by reference — a run stays readable after its file is edited or deleted.\n\n```go\nfunc FreezeAt(t task.Task, root, triggerKind, triggerID string, occurredAt, now time.Time, backlog int) (Run, error)\n```\nFreezeAt is Freeze with the LOGICAL occurrence this run stands for, and the size of the backlog collapsed into it. A run\\_once recovery of Monday's occurrence executed on Wednesday is occurredAt Monday: the ledger then says which firing was recovered, instead of only when someone got round to it.\n\n```go\nfunc FreezeWith(t task.Task, root, triggerKind, triggerID string, occurredAt, now time.Time,\n\tbacklog int, rt runtimes.Resolution,\n) (Run, error)\n```\nFreezeWith is FreezeAt plus the resolved runtime, frozen with everything else.\n\n```go\nfunc (r Run) OK() bool\n```\nOK reports whether a finished run did what it was supposed to. no\\_change is a success: the task ran correctly and there was nothing to do.\n\n```go\nfunc (r Run) Terminal() bool\n```\nTerminal reports whether the run has finished.\n\n```go\ntype Runner struct {\n\tStore *Store\n\t// Spawn runs the agent and blocks until it finishes. Injectable so tests\n\t// exercise the whole lifecycle — including crashes — without a model call.\n\tSpawn SpawnFunc\n\t// HeartbeatEvery bounds how stale a live run's heartbeat can get.\n\tHeartbeatEvery time.Duration\n\t// Auth and Available answer \"what is permitted\" and \"what is present\".\n\t// Injectable so a test's answer does not depend on the developer's laptop.\n\tAuth      AuthSource\n\tAvailable func() []string\n}\n```\nRunner turns a task definition into a durable, executed Run.\n\nThe order matters and is the point of the whole design:\n\n\tfreeze inputs -\u003e create the row (claims the occurrence) -\u003e claim the work\n\t-\u003e execute -\u003e persist the outcome\n\nThe row exists before any work starts, so a duplicate dispatch is rejected by the ledger rather than by hoping two executions do not overlap.\n\n```go\nfunc NewRunner(store *Store, auth AuthSource) *Runner\n```\nNewRunner builds a runner backed by real detached memcode processes.\n\n```go\nfunc (r *Runner) Execute(ctx context.Context, run Run, t task.Task) (Run, error)\n```\nExecute claims and runs an already-created run to completion, persisting the outcome. Safe to call only once per run; the conditional claim enforces that.\n\n```go\nfunc (r *Runner) Poll(ctx context.Context, tasks []task.Task, root string, now time.Time) PollResult\n```\nPoll fires everything due. It returns once every started run has finished, so a caller that wants concurrency across tasks runs Poll in a goroutine.\n\n```go\nfunc (r *Runner) Run(ctx context.Context, t task.Task, root, triggerKind, triggerID string) (Run, error)\n```\nRun is the whole loop: freeze, record, claim, execute, persist.// Run is the whole loop: freeze, record, claim, execute, persist.\n\n```go\nfunc (r *Runner) Start(ctx context.Context, t task.Task, root, triggerKind, triggerID string, now time.Time) (Run, error)\n```\nStart freezes, records and claims a run without executing it. Returns ErrOccupied when the occurrence already belongs to another run.\n\n```go\ntype Seen string\n```\nSeen tracks whether a human has dealt with a run's result. Three states, not a boolean: a needs\\_attention run that scrolled past in a session banner has been SEEN, not dealt with, and collapsing those loses the distinction exactly where it matters most.\n\n```go\nconst (\n\tSeenUnseen       Seen = \"unseen\"\n\tSeenSeen         Seen = \"seen\"\n\tSeenAcknowledged Seen = \"acknowledged\"\n)\n```\n\n```go\ntype SpawnFunc func(ctx context.Context, req SpawnRequest) (SpawnResult, error)\n```\nSpawnFunc executes a task's work and reports what happened.\n\n```go\ntype SpawnRequest struct {\n\tRunID string\n\t// Project is the repository that owns the run's bookkeeping — its job log\n\t// outlives a disposable worktree because of this.\n\tProject string\n\t// WorkDir is where the work actually happens: the isolated worktree, or the\n\t// project itself when there is nothing to isolate.\n\tWorkDir      string\n\tInstructions string\n\tMode         permissions.Mode\n\tReadOnly     bool\n\t// Env selects the resolved runtime for the child.\n\tEnv []string\n\t// DenyTools and DenyCommands are the capability ceiling, projected from the\n\t// task's grants. Both are real restrictions on the child.\n\tDenyTools    []string\n\tDenyCommands []string\n\tTimeout      time.Duration\n}\n```\nSpawnRequest is everything the executor needs, taken from the FROZEN run rather than from the task file, so a mid-run YAML edit cannot reach it.\n\n```go\ntype SpawnResult struct {\n\tText     string\n\tLogPath  string\n\tExitCode int\n}\n```\nSpawnResult is the executor's report.\n\n```go\ntype State string\n```\nState is where a run is in its lifecycle. Terminal state is always Done; what actually happened is the Outcome.\n\n```go\nconst (\n\t// StatePending: the row exists and owns its occurrence, but no process has\n\t// claimed the work yet. Creating the row before doing anything is what makes\n\t// at-least-once dispatch safe — the unique occurrence index rejects a second\n\t// row before a second execution can start.\n\tStatePending State = \"pending\"\n\t// StateRunning: a live process holds it, identified by host and pid and\n\t// proven by a heartbeat.\n\tStateRunning State = \"running\"\n\t// StateDone: terminal. Read Outcome.\n\tStateDone State = \"done\"\n)\n```\n\n```go\ntype Store struct {\n\t// contains filtered or unexported fields\n}\n```\nStore is the run ledger.\n\n```go\nfunc Open(ctx context.Context, path string) (*Store, error)\n```\nOpen creates or opens the ledger. There is deliberately NO exclusive lock: the CLI, the daemon and spawned children all touch this concurrently, and WAL plus a busy timeout is what makes that safe. The gateway's own singleton lock exists to keep one inbox worker, which is a different problem.\n\n```go\nfunc OpenDefault(ctx context.Context) (*Store, error)\n```\nOpenDefault opens the ledger at its standard location.\n\n```go\nfunc (s *Store) Acknowledge(ctx context.Context, id string) error\n```\nAcknowledge records that a human actually dealt with a run.\n\n```go\nfunc (s *Store) Acquire(ctx context.Context, key, runID, taskName string, now time.Time) error\n```\nAcquire takes a lease, stealing one whose owner is gone. An empty key is a no-op success: a read-only run needs no exclusivity.\n\n```go\nfunc (s *Store) Active(ctx context.Context, task string) ([]Run, error)\n```\nActive returns runs that are not finished, for one task.\n\n```go\nfunc (s *Store) Claim(ctx context.Context, id string, now time.Time) (bool, error)\n```\nClaim moves a pending run to running and stamps the owning process. The UPDATE is conditional on the row still being pending, so two processes racing for the same run cannot both win: the loser sees claimed=false.\n\n```go\nfunc (s *Store) Close() error\n```\n\n```go\nfunc (s *Store) Create(ctx context.Context, r Run) (Run, error)\n```\nCreate records a new run in StatePending, claiming its occurrence. It returns ErrOccupied when a triggered occurrence is already accounted for — that is the idempotency boundary doing its job, and the caller must treat it as \"someone else has this\", never as an error to retry through.\n\n```go\nfunc (s *Store) Finish(ctx context.Context, id string, outcome Outcome, summary, detail, logPath string, now time.Time) error\n```\n\n```go\nfunc (s *Store) FinishResult(ctx context.Context, id string, r Result, now time.Time) error\n```\nFinishResult closes a run with its full structured verdict.\n\n```go\nfunc (s *Store) Get(ctx context.Context, id string) (Run, error)\n```\nGet loads one run.\n\n```go\nfunc (s *Store) Heartbeat(ctx context.Context, id string, now time.Time) error\n```\nHeartbeat proves the owning process is still alive. Reconcile uses its absence to tell a crashed run from a slow one.\n\n```go\nfunc (s *Store) MarkSeen(ctx context.Context, ids []string) error\n```\nMarkSeen advances unseen runs to seen. It never touches an acknowledged run and never moves backwards: showing someone a banner is not the same as them dealing with it, which is the whole reason this is not a boolean.\n\n```go\nfunc (s *Store) Note(ctx context.Context, id, note string) error\n```\nNote records why a run exists — a recovered occurrence, a collapsed backlog — before it executes, so the explanation survives even if the run then crashes. Appends rather than replaces: a run may accumulate more than one note.\n\n```go\nfunc (s *Store) Pause(ctx context.Context, p Pause) error\n```\nPause suspends a task's unattended execution. Idempotent on the FIRST reason: re-pausing an already-paused task must not overwrite the original diagnosis with a later, vaguer one.\n\n```go\nfunc (s *Store) Paused(ctx context.Context) ([]Pause, error)\n```\nPaused lists every suspended task, oldest first: a responsibility memcode stopped fulfilling longest ago is the one most worth raising.\n\n```go\nfunc (s *Store) PausedTask(ctx context.Context, taskName, project string) (Pause, bool, error)\n```\nPausedTask reports a task's suspension, if it has one.\n\n```go\nfunc (s *Store) Recent(ctx context.Context, task string, limit int) ([]Run, error)\n```\nRecent returns the newest runs, optionally for one task.\n\n```go\nfunc (s *Store) Reconcile(ctx context.Context, now time.Time) (int, error)\n```\nReconcile settles runs left behind by a process that died — a killed daemon, a crash, a machine that went down mid-run.\n\nThe semantic is deliberate and narrow: such a run is FAILED as interrupted, never silently resumed and never silently re-run. A partially finished mutating run cannot be safely continued by a new process that did not see what the old one did, and re-running it automatically is exactly how at-least-once dispatch turns into duplicate side effects. If the work still needs doing, that is a NEW run with a new identity, which the ledger shows.\n\nA run is considered dead when its heartbeat is older than StaleAfter, or when it is owned by this host and its pid is gone (which is immediate and does not wait out the timeout).\n\n```go\nfunc (s *Store) Release(ctx context.Context, key, runID string) error\n```\nRelease drops a lease, but only if this run still holds it — a run that was already evicted as dead must not delete its successor's claim.\n\n```go\nfunc (s *Store) Renew(ctx context.Context, key, runID string, now time.Time) error\n```\nRenew keeps a held lease alive.\n\n```go\nfunc (s *Store) Resume(ctx context.Context, taskName, project string) (bool, error)\n```\nResume lifts a suspension. Reports whether one was actually there.\n\n```go\nfunc (s *Store) SetWatermark(ctx context.Context, taskName, triggerKey string, at, now time.Time) error\n```\nSetWatermark records an occurrence as accounted for — whether it ran or was deliberately dropped. Advancing on a drop is what stops a skipped occurrence being rediscovered as missed on the next poll, forever.\n\nIt never moves backwards, so an out-of-order poll cannot rewind the series.\n\n```go\nfunc (s *Store) Unseen(ctx context.Context, limit int) ([]Run, error)\n```\nUnseen returns finished runs a human has not looked at yet, oldest first so a session banner reads in the order things happened.\n\n```go\nfunc (s *Store) Watermark(ctx context.Context, taskName, triggerKey string) (time.Time, error)\n```\nWatermark returns the newest occurrence already accounted for on a trigger.\n\n```go\ntype VerificationStatus string\n```\nVerificationStatus is the verdict over all checks, kept separate from whether the agent's execution completed. A run whose agent finished cleanly and whose tests then failed is an execution success and a task failure, and collapsing those two into one enum is how that distinction gets lost.\n\n```go\nconst (\n\t// VerifyNone: the task declared no checks. Not a pass — an absence.\n\tVerifyNone VerificationStatus = \"none\"\n\tVerifyPass VerificationStatus = \"passed\"\n\tVerifyFail VerificationStatus = \"failed\"\n\t// VerifySkipped: the run never got far enough to verify.\n\tVerifySkipped VerificationStatus = \"skipped\"\n)\n```\n\n","path":"github.com/memcode-ai/memcode/internal/taskrun","name":"taskrun","synopsis":"Package taskrun is the durable ledger of autonomous task executions.","isRedistributable":true}
