persistence

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package persistence tracks edit counter state for persistence nudge timing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PersistenceNudgeNeeded

func PersistenceNudgeNeeded(count, sinceNudge int) bool

PersistenceNudgeNeeded determines whether a persistence nudge should fire based on prompt count and the number of prompts since the last nudge.

Parameters:

  • count: total prompt count for the session
  • sinceNudge: number of prompts since the last nudge or context update

Returns:

  • bool: true if a nudge should be emitted

func WritePersistenceState

func WritePersistenceState(path string, s State)

WritePersistenceState writes the persistence state to the given file.

Parameters:

  • path: absolute path to the state file
  • s: state to persist

Types

type State

type State struct {
	Count     int
	LastNudge int
	LastMtime int64
}

State holds the counter state for persistence nudging.

func ReadPersistenceState

func ReadPersistenceState(path string) (State, bool)

ReadPersistenceState reads a persistence state file and returns the parsed state. Returns ok=false if the file does not exist or cannot be read.

Parameters:

  • path: absolute path to the state file

Returns:

  • PersistenceState: parsed counter state
  • bool: true if the file was read successfully

Jump to

Keyboard shortcuts

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