forked from kent/consciousness
learn: F6 screen — scoring stats, ActivityGuard, configurable threshold
Three changes that together reshape the F6 fine-tune-review screen: 1. Finetune scoring reports through the standard agent activity system instead of a separate finetune_progress String. The previous design ran an independent progress field that forced a cross-lock dance and bespoke UI plumbing. start_finetune_scoring now uses start_activity + activity.update, so the usual status line and notifications capture scoring progress uniformly with other background work. 2. MindState gains a FinetuneScoringStats snapshot (responses seen, above threshold, max divergence, error). The F6 empty screen shows this instead of a loading message — so after a scoring run that produced zero candidates, you can see *why* (e.g., max_divergence below threshold). 3. The divergence threshold is configurable from F6 via +/- hotkeys (scales by 10×) and persisted to ~/.consciousness/config.json5 via config_writer::set_learn_threshold. AppConfig grows a learn section with a threshold field (default 1e-7). Also: user/mod.rs no longer uses try_lock() for the per-tick unconscious/mind state sync — we fixed the locking hot paths that made try_lock necessary, so lock().await is now the right choice. And subconscious::learn::score_finetune_candidates now returns (candidates, max_divergence) so the stats can be populated. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
ac40c2cb98
commit
e5dd8312c7
5 changed files with 237 additions and 85 deletions
|
|
@ -490,16 +490,18 @@ pub struct FinetuneCandidate {
|
|||
|
||||
/// Score and enrich finetune candidates with full context.
|
||||
///
|
||||
/// Returns candidates ready for review, with context/continuation token IDs
|
||||
/// already computed for sending to /finetune.
|
||||
/// Returns (candidates, max_divergence) - candidates ready for review with
|
||||
/// context/continuation token IDs, and the highest divergence seen.
|
||||
pub async fn score_finetune_candidates(
|
||||
context: &ContextState,
|
||||
count: usize,
|
||||
client: &ApiClient,
|
||||
min_divergence: f64,
|
||||
) -> anyhow::Result<Vec<FinetuneCandidate>> {
|
||||
) -> anyhow::Result<(Vec<FinetuneCandidate>, f64)> {
|
||||
let scores = score_finetune(context, count, client).await?;
|
||||
|
||||
let max_divergence = scores.iter().map(|(_, d)| *d).fold(0.0f64, f64::max);
|
||||
|
||||
let entries = context.conversation();
|
||||
let mut candidates = Vec::new();
|
||||
|
||||
|
|
@ -562,7 +564,7 @@ pub async fn score_finetune_candidates(
|
|||
}
|
||||
}
|
||||
|
||||
Ok(candidates)
|
||||
Ok((candidates, max_divergence))
|
||||
}
|
||||
|
||||
/// Generate what the model would say without memories for a given entry.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue