Documentation
¶
Overview ¶
Package secretary tracks the open loops an agent or a person has left open — "I'll send the deck", "waiting on the vendor" — so they can be surfaced again without depending on anyone remembering to check.
This package used to also compose an ambient daily briefing over captured calendar and activity events; that half was cut in 0.3.0 along with the rest of the ambient-capture tier. What remains is event-independent: a commitment is added, extracted, or closed, never mined from something observed in the background.
Index ¶
- Constants
- func Add(db *sql.DB, c *Commitment) (bool, error)
- func Import(db *sql.DB, dir string) (restored, rescued int, err error)
- func Init(db *sql.DB) error
- func LoopsPath(dir string) string
- func OpenCount(db *sql.DB) (int, error)
- func Reconcile(db *sql.DB) (restored, removed int, err error)
- func SetStatus(db *sql.DB, id int64, s Status) error
- func SetVault(db *sql.DB, dir string)
- func Unflushed(db *sql.DB) (int, error)
- type Commitment
- type Status
Constants ¶
const LoopsFile = "loops.md"
LoopsFile is the loop list's name at the vault root.
const Schema = `` /* 597-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func Import ¶
Import restores loops from the vault, and is what makes deleting the cache survivable for commitments.
dir is the caller's rather than vaultFor's: `logos index` imports a vault it has not bound to a store yet.
Returns how many loops it had to put back — a row already in the cache was never lost and is not announced as recovered — and how many it rescued the other way, out of a cache that was their only copy and into the file.
func LoopsPath ¶
LoopsPath is where the loop list lives inside dir. Exported because index.Sync has to know the one file in the vault root it must not index.
func Reconcile ¶ added in v0.5.1
Reconcile adopts hand edits to loops.md now, and reports how many loops the file put back and how many it forgot.
Exported for the commands that read or change the list. Only writes used to reconcile, so `logos loop` listed a loop the user had deleted from the file — at exactly the moment they ran it to check that the deletion took — and a write that did adopt the edit said nothing about it. A file we wrote is one read and a hash compare, so calling this before every list is cheap.
Types ¶
type Commitment ¶
type Commitment struct {
ID int64
Text string
Who string // person it involves, if any
Created int64
DueHint string // free text: "friday", "eod", "" if none
Status Status
// SourceRef points at where it came from (a daily note slug, an event id),
// so a surfaced loop can always be traced back — same discipline as
// proposal evidence.
SourceRef string
// ResolvedAt is when the loop was closed (done or dropped), 0 while open.
ResolvedAt int64
}
A Commitment is something you said you would do that is not yet done. The core secretary primitive — an archive does not care what you promised, a secretary tracks exactly that.
func Extract ¶
func Extract(rt *router.Router, text, sourceRef string) ([]Commitment, error)
Extract pulls open loops out of a chunk of text — a daily note, a captured message draft. Constrained decoding, T1, one narrow job.
The prompt is tight on purpose: a secretary that invents commitments you never made is worse than one that misses a few, because you learn to distrust it. Recall is sacrificed for precision here deliberately.
func ResolvedSince ¶
func ResolvedSince(db *sql.DB, since, until int64) ([]Commitment, error)
ResolvedSince lists commitments marked done in [since, until], newest first — the accomplishments half of the weekly review.
func (Commitment) Age ¶
func (c Commitment) Age() time.Duration
Age is how long a loop has been open, for surfacing the stalest first.