Skip to main content

Module autonomy

Module autonomy 

Source
Expand description

Full-autonomy loop — stacks on the Track A curator daemon (#278).

This module provides the four passes beyond auto-tag that are required to earn a defensible “100% autonomous” claim:

  1. Consolidation — find near-duplicate memories in the same namespace, LLM-summarise them into a single canonical memory, archive the originals. Uses db::consolidate for the DB work and AutonomyLlm::summarize_memories for the synthesis.
  2. Forgetting of superseded memories — when a memory carries metadata.confirmed_contradictions, demote or forget the older contradicted entry (the curator keeps the fresher one). Uses db::forget_count with a targeted id list.
  3. Priority feedback — nudge priority up for memories that are getting recalled, nudge it down for cold ones. Purely arithmetic; no LLM call.
  4. Rollback log + self-report — every autonomous action lands in a _curator/rollback/<ts> memory describing what happened and how to reverse it, and every cycle lands in _curator/reports/<ts> as a summary the operator (and other agents) can recall.

§Trait boundary — AutonomyLlm

The curator previously coupled directly to llm::OllamaClient, which blocked unit-testable end-to-end coverage. This module defines a narrow trait that both OllamaClient (in prod) and the [tests::StubLlm] (in tests) implement. The autonomy passes are generic over &dyn AutonomyLlm.

Structs§

AutonomyPassReport
Structured outcome of a single autonomy pass. Aggregated into the curator cycle’s CuratorReport and also written back as a self- report memory.

Enums§

RollbackEntry
Rollback-log entry stored as a memory in _curator/rollback/<rfc3339>.

Constants§

CONSOLIDATE_JACCARD_THRESHOLD
Minimum Jaccard-keyword overlap required to treat two memories as “near-duplicates” candidates for a consolidation cluster. Tuned loosely — actual merge decision is still gated by an LLM pass.
CONSOLIDATE_MAX_CLUSTER_SIZE
Cap on the number of memories in a single consolidation cluster — prevents pathological mega-merges that would destroy provenance.
CURATOR_NAMESPACE
Reserved namespace prefix the curator writes to. Excluded from further curator passes (the curator never acts on its own rollback / report memories).

Traits§

AutonomyLlm
LLM surface the autonomy passes use. Implemented for OllamaClient in prod and stubbed in tests. The auto_tag and detect_contradiction methods are here for completeness — the autonomy passes themselves currently only call summarize_memories, but exposing the three together keeps the trait a single, testable LLM boundary that the curator’s run_once path can switch to in a follow-up PR.

Functions§

persist_self_report
Write the cycle’s report as a memory in _curator/reports/<ts> so other agents can recall “what did the curator do”.
reverse_rollback_entry
Reverse a single rollback-log entry. Returns true if a reverse action was applied, false if the entry was already superseded (idempotent rollback).
run_autonomy_passes
Run all autonomy passes over the provided candidates in order: consolidate → forget superseded → priority feedback → record rollback log → write self-report. dry_run suppresses all writes.