]> git.giacomolli.uk - onechat/commit
Rebuild agent memory in date order
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Mon, 9 Nov 2026 20:29:43 +0000 (17:29 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Mon, 9 Nov 2026 20:29:43 +0000 (17:29 -0300)
commita606686934b4028c29dca8e9dae6b2e188cee9c5
treea3e171d52c1c70ceff006ec0c67914f1ac57f4fc
parent7c84ed87ef71088b880a3765b2653e1ded57bf14
Rebuild agent memory in date order

A rebuild merges new dated messages with the log of an agent in date
order, builds a new memory beside it with the real prompt and cache key,
and swaps the directories only when the whole tree is built. The old
directory stays as a timestamped backup, and a failed or stopped build
leaves it unchanged. Older history can so enter the chat before newer
decisions, which keeps the latest word on a thing the newest one.

The probe and the rebuild share one build runner with the call limit,
the quota stop, the waits before user messages, and the usage report.
Memory and the model client keep their own state behind methods. The log
takes an explicit date for a message and writes it to the day file of
that date.

Issue: b0b8bf9
14 files changed:
agent.go
build_run.go [new file with mode: 0644]
build_run_test.go [new file with mode: 0644]
log.go
memory.go
model.go
probe.go
probe_log_helper_test.go [new file with mode: 0644]
probe_test.go
prompt.go
prompt_test.go
rebuild.go [new file with mode: 0644]
rebuild_helper_test.go [new file with mode: 0644]
rebuild_test.go [new file with mode: 0644]