journal

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package journal provides a per-task decision log with AI summarization. Entries are stored as JSONL (one JSON object per line) in .cloop/journal/<task-id>.jsonl for efficient append-only writes.

Index

Constants

This section is empty.

Variables

ValidTypes lists the accepted entry type values.

Functions

func Append

func Append(workDir string, entry Entry) error

Append writes a single entry to the task's journal file. The file is created if it does not exist. The directory is created on demand.

func IsValidType

func IsValidType(t EntryType) bool

IsValidType reports whether t is a recognised entry type.

func ListAll

func ListAll(workDir string) ([]string, error)

ListAll returns all task IDs that have journal files in the given workDir.

func Summarize

func Summarize(ctx context.Context, p provider.Provider, model string, entries []Entry) (string, error)

Summarize calls the AI provider to generate a narrative summary of a task's journal.

func SummarizePrompt

func SummarizePrompt(taskID string, entries []Entry) string

SummarizePrompt builds the AI prompt used by Summarize.

Types

type Entry

type Entry struct {
	Timestamp time.Time `json:"timestamp"`
	TaskID    string    `json:"task_id"`
	Author    string    `json:"author"`
	Type      EntryType `json:"type"`
	Body      string    `json:"body"`
}

Entry is a single journal record for a task.

func List

func List(workDir, taskID string) ([]Entry, error)

List reads all journal entries for the given task ID. Returns an empty slice (not an error) when the file does not exist.

type EntryType

type EntryType string

EntryType classifies a journal entry.

const (
	TypeDecision    EntryType = "decision"
	TypeObservation EntryType = "observation"
	TypeBlocker     EntryType = "blocker"
	TypeInsight     EntryType = "insight"
)

Jump to

Keyboard shortcuts

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