Documentation
¶
Overview ¶
Package audit is the local JSONL log of AI actions. Files live in <dataDir>/ai-audit/YYYY-MM.jsonl, one JSON object per line. A line never contains file contents, command output, or secrets. A month file is deleted only when that whole month is older than the retention window (default 90 days). On open, an existing month file is tightened to 0600 and the directory to 0700 (Windows has no mode bits).
Index ¶
Constants ¶
const DefaultRetentionDays = 90
DefaultRetentionDays is the retention window when the caller passes zero or a negative number.
Variables ¶
This section is empty.
Functions ¶
func NormalizeRetention ¶
NormalizeRetention returns days, or DefaultRetentionDays when days <= 0.
Types ¶
type Filter ¶
Filter selects records. A zero time is unbounded. Host is exact; empty matches every host. From and To are inclusive.
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log appends audit records. It is safe for concurrent Record calls.
func (*Log) Prepare ¶
Prepare opens for appending, creating it when needed, the month file of a record made at the given time. The gate calls it before a run, so a log that cannot be written refuses the run rather than losing its record afterwards.
func (*Log) Prune ¶
Prune deletes month files whose next month starts at or before now-days. days <= 0 uses DefaultRetentionDays. Other files are left in place.