Documentation
¶
Overview ¶
Package auto is what Logos does without being asked, in one place.
Each automatic behaviour grew its own switch or none — the session-end checkpoint, the distil offer, the edit hook — so nobody could see or change "what Logos does without me" without reading the code. Here every one of them is a named switch, and the answer lives in auto.md at the vault's root: a file the user can read and edit by hand, which a deleted index cannot reset (invariant 1).
Three states per switch, as with the activity log, because there are three different users. One who turned a switch off by hand meant it, and `logos auto on` must not undo that. One who said `auto on` or `auto off` meant all of it. One who never answered gets exactly what Logos did before the switch existed, so upgrading changes nothing anybody relied on.
Index ¶
- Constants
- Variables
- func Describe(s Switch) string
- func LogPath(vault string) string
- func On(vault string, s Switch) bool
- func Path(vault string) string
- func Record(vault string, e Entry) error
- func Set(vault, name string, on bool) error
- func SetMaster(vault string, on bool) error
- func StartDream(vault string, now time.Time) (bool, error)
- func StartImport(vault string, changed, now time.Time) (bool, error)
- func Summary(entries []Entry) string
- type Config
- type Count
- type Entry
- type Switch
Constants ¶
const DreamEvery = 24 * time.Hour
DreamEvery is how long a dream run counts as recent. A started run counts as much as a finished one: a dream that is still going, or died, must not be launched again by every session start until somebody notices.
const File = "auto.md"
File is the switch file, at the vault's root.
const LogFile = "auto-log.md"
LogFile is what auto did, one line per action, at the vault's root beside auto.md. Only what happened out of the user's sight is logged — a session end, a server shutting down, a background pass. What a command does while they watch it says so on the spot and needs no second telling.
Markdown, append-only, in the vault: the next resume reads it, and a log in the index would be emptied by the very rebuild it might be reporting.
Variables ¶
var Fixed = []struct{ Name, Why string }{
{"verify", "a procedure's verify command is vault text, and vault text is never run as an instruction"},
{"forget", "forgetting or retiring a memory loses something only the user can judge"},
{"retire", "forgetting or retiring a memory loses something only the user can judge"},
{"push", "nothing pushes or syncs without the user"},
{"sync", "nothing pushes or syncs without the user"},
{"network", "nothing leaves the machine"},
}
Fixed is what is never automatic, whatever auto.md says, with the reason. Listed so nobody has to wonder, and refused by name so a hand-written `- verify: on` is answered rather than silently ignored.
var Launch = launch
Launch starts a logos command for a vault as a process of its own. A var so tests run the work in-process instead of spawning the test binary.
Functions ¶
func On ¶
On is whether a switch is on in this vault. A file that exists and cannot be read is somebody's answer that cannot be seen, so every switch reads as off until it can: guessing the defaults is how a user who turned everything off finds it running. Status reports the read failure.
func Record ¶
Record appends one entry to the log. The caller still reports a failure where it happened; this is so the next resume can say it too, since the place it happened — a hook, a server going away — had nobody watching.
func SetMaster ¶
SetMaster records `auto on` or `auto off`. A switch set by hand keeps its value: the user who turned one off meant that one, whatever they say about the rest later.
func StartDream ¶
StartDream launches the day's dream when the switch is on and none has started in the last DreamEvery, and says whether it did. Session start is the trigger because it is the one moment Logos reliably runs; the dream is its own process so the session never waits on a model. Under a lock, so two hosts starting at once launch one dream between them.
func StartImport ¶
StartImport launches `logos import --from claude-mem --auto` when the switch is on and claude-mem's store changed after the last automatic import began, and says whether it did. changed is the store's last write, zero when there is no store.
Measured from when the last run began, not ended: whatever claude-mem wrote while it ran may have been missed, and the price of a second look is only the skipped count. The log is the record, so deleting the index does not set off a run, and under a lock, so two hosts starting at once launch one.
Types ¶
type Config ¶
Config is auto.md read. Master is nil when nobody has said `auto on` or `auto off`; Hand holds the switches set one at a time. Problems are lines the file holds that mean nothing, each one said by status rather than dropped.
func Load ¶
Load reads a vault's switches. A missing file is a vault nobody has asked, not an error. An unreadable one is an error, which status reports.
type Entry ¶
type Entry struct {
At time.Time
Switch Switch
Project string
Started bool
N int
Counts []Count
Skipped string
Failed string
}
Entry is one thing auto did, or failed to do. A run is Started, Failed, or done: N, or Counts for a switch whose run does several things, and Skipped when it could not do all of it for a reason that is not a fault.