Watch
1
0
Fork
You've already forked souveraine
0

two swipes, one progress; home is zone 0; pocket is a belief

This commit is contained in:
Fimeg 2026-08-05 19:16:41 -04:00
commit d7965a57fd
188 changed files with 9258 additions and 3970 deletions

View file

@ -86,10 +86,7 @@ impl SynthesisReport {
pub fn summary_line(&self) -> String {
format!(
"synthesized {} journal entries ({} → {}) into {}",
self.entries_compressed,
self.date_range.0,
self.date_range.1,
self.output_label,
self.entries_compressed, self.date_range.0, self.date_range.1, self.output_label,
)
}
}
@ -160,8 +157,9 @@ impl ArchivistEngine {
return Ok(None);
}
let interval_due =
turn_count > 0 && self.config.interval > 0 && turn_count.is_multiple_of(self.config.interval);
let interval_due = turn_count > 0
&& self.config.interval > 0
&& turn_count.is_multiple_of(self.config.interval);
let pressure_due = pressure >= self.config.threshold;
if !interval_due && !pressure_due {
return Ok(None);
@ -222,13 +220,7 @@ impl ArchivistEngine {
.await?;
let output_label = format!("{SYNTHESIS_DIR}/{end_date}");
let body = render_synthesis(
&synthesis,
start_date,
end_date,
entries.len(),
&model,
);
let body = render_synthesis(&synthesis, start_date, end_date, entries.len(), &model);
repo.write(&output_label, &body).await?;
let report = SynthesisReport {
@ -276,7 +268,8 @@ impl ArchivistEngine {
let (response, strain) = llm.chat_completion_with_strain(request).await?;
for event in &strain {
if let crate::bridge::bifrost::InferenceStrain::Transient { status, model, .. } = event {
if let crate::bridge::bifrost::InferenceStrain::Transient { status, model, .. } = event
{
tracing::info!("archivist felt inference strain: {} on {}", status, model);
if *status == 429 {
let current = self.rate_delay.load(Ordering::Relaxed);
@ -407,7 +400,12 @@ async fn collect_journal_entries(
fn format_journal_input(entries: &[JournalEntry]) -> String {
let mut out = String::new();
for entry in entries {
let chunk = format!("=== {} ({}) ===\n{}\n\n", entry.date, entry.label, entry.body.trim());
let chunk = format!(
"=== {} ({}) ===\n{}\n\n",
entry.date,
entry.label,
entry.body.trim()
);
// Always keep at least the first (oldest) entry, even if it alone
// exceeds the cap — truncate it rather than emit nothing.
if out.is_empty() {
@ -458,30 +456,18 @@ fn render_synthesis(
/// Map a configured synthesis element to its prompt line (label + budget).
fn element_spec(el: &SynthesisElement) -> (&'static str, &'static str) {
match el {
SynthesisElement::Themes => (
"Themes",
"[3-5 recurring topics, ~10 words each]",
),
SynthesisElement::Emotions => (
"Emotional Tone",
"[dominant felt sense, ~20 words]",
),
SynthesisElement::Themes => ("Themes", "[3-5 recurring topics, ~10 words each]"),
SynthesisElement::Emotions => ("Emotional Tone", "[dominant felt sense, ~20 words]"),
SynthesisElement::Tensions => (
"Unresolved Tensions",
"[threads that still need attention, ~30 words]",
),
SynthesisElement::Anchors => (
"Anchors",
"[stable reference points, ~20 words]",
),
SynthesisElement::Anchors => ("Anchors", "[stable reference points, ~20 words]"),
SynthesisElement::Evolution => (
"Evolution",
"[how perspectives shifted this period, ~40 words]",
),
SynthesisElement::Patterns => (
"Patterns",
"[recurring behaviors, ~30 words]",
),
SynthesisElement::Patterns => ("Patterns", "[recurring behaviors, ~30 words]"),
}
}
@ -531,10 +517,7 @@ mod tests {
fn parse_covers_end_reads_marker() {
let body = "<!-- archivist: covers 2026-04-02..2026-04-14, 7 entries, \
synthesized 2026-05-15T10:00:00Z via openai/glm-5.1 -->\n\n# Synthesis";
assert_eq!(
parse_covers_end(body),
NaiveDate::from_ymd_opt(2026, 4, 14),
);
assert_eq!(parse_covers_end(body), NaiveDate::from_ymd_opt(2026, 4, 14),);
}
#[test]
@ -573,7 +556,8 @@ mod tests {
#[test]
fn prompt_includes_only_configured_elements() {
let prompt = archivist_system_prompt(&[SynthesisElement::Themes, SynthesisElement::Anchors]);
let prompt =
archivist_system_prompt(&[SynthesisElement::Themes, SynthesisElement::Anchors]);
assert!(prompt.contains("- Themes:"));
assert!(prompt.contains("- Anchors:"));
assert!(!prompt.contains("- Evolution:"));