consciousness/src/subconscious
Kent Overstreet d5e6f55da9 Fix context budgeting and compaction
- Budget now counts exact message tokens matching what assemble_api_messages
  sends, not raw string content. Eliminates undercounting from formatting
  overhead (journal headers, personality separators, working stack).

- Load journal before trimming so trim accounts for journal cost.

- Compact before every turn, not just after turn completion. Prevents
  agent_cycle surfaced memories from pushing context over budget.

- Move agent_cycle orchestration from Agent::turn to Mind::start_turn —
  surfaced memories and reflections now precede the user message.

- Move AgentCycleState from Agent to Mind — it's orchestration, not
  per-agent state. memory_scoring_in_flight and memory_scores stay on
  Agent where they belong.

- Tag DMN entries as ConversationEntry::Dmn — compaction evicts them
  first since they're ephemeral. Compaction also prefers evicting
  memories over conversation when memories exceed 50% of entry tokens.

- Kill /retry slash command.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-06 22:43:55 -04:00
..
agents replace hardcoded personal names with config values 2026-04-02 19:45:35 -04:00
api.rs Delete ui_channel.rs — relocate types, remove all UiMessage/UiSender plumbing 2026-04-05 22:34:48 -04:00
audit.rs agent: move oneshot execution from subconscious to agent module 2026-04-04 18:19:21 -04:00
consolidate.rs oneshot: simplify API surface 2026-04-04 18:19:21 -04:00
daemon.rs oneshot: simplify API surface 2026-04-04 18:19:21 -04:00
defs.rs remove dead transcript mining pipeline 2026-04-02 21:42:03 -04:00
digest.rs Revert to tokio::sync::Mutex, fix lock-across-await bugs, move input ownership to InteractScreen 2026-04-05 21:13:48 -04:00
learn.rs Delete ui_channel.rs — relocate types, remove all UiMessage/UiSender plumbing 2026-04-05 22:34:48 -04:00
mod.rs more reorg 2026-04-05 01:48:11 -04:00
prompts.rs delete dead load_prompt (orphaned by split_* removal) 2026-04-02 16:22:34 -04:00
subconscious.rs Fix context budgeting and compaction 2026-04-06 22:43:55 -04:00