interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

Hermes prior art 1: bounded micro-compaction and evidence-anchored token accounting (extends #397)

Open · #664 · open 2026-10-18 19:11 UTC

Imported from GitHub aien-dev/aien-sovereign-core-mv#664, by drakestapleton

drakestapleton wrote on 2026-10-18 19:11 UTC

Extend the sc#397 compactor (crates/aien-cli/src/compaction.rs) with the parts Hermes has and we lack. Hermes source: website/docs/developer-guide/micro-compaction.md, agent/usage_anchor.py, agent/conversation_compression.py.

Mechanics to implement:

  • The operator's own messages are never summarized; only the agent's derived material (tool results, narration) is compacted. Head (system prompt, opening messages) and a token-budgeted tail stay verbatim.
  • One exchange (one assistant turn with its tool results) absorbed per turn into a single rolling summary, so cost per turn is bounded. Opt-in, because each pass changes the prompt prefix.
  • The transcript is the source of truth for the cursor: a resumed process finds the last summary marker and continues after it; nothing is summarized twice.
  • Only the newest summary marker is kept; past 2,000 tokens the summary itself is re-summarized (defrag) without touching messages.
  • The store step is an atomic archive-and-insert so a resume never loads both the summary and the rows it replaced. Keep sc#397's durable originals with digests (Hermes lacks that; we keep it).
  • A failing exchange is skipped after three failures; a persisted cooldown ladder (60 s, 300 s, 900 s) paces summarizer failures; a deterministic fallback summary route exists.
  • Token accounting anchored on the provider's reported prompt and completion counts, keyed by a content fingerprint and persisted with the session; local estimates cover only appended messages. An estimate over threshold is not proof a request will fail: wait one request for provider evidence.

Acceptance: a test transcript where the operator's lines survive byte-identical through 50 compaction passes; resume after kill does not double-load; one bad exchange cannot stall every turn; an estimate above the window alone never triggers compaction.

Parent: aien-dev/aien-architecture#267. Research note: aien-architecture docs/research/hermes-agent-prior-art.md. Prior art: Hermes Agent, Nous Research, MIT, commit 5480918 (2026-10-18). No Hermes code is copied; the mechanism is re-implemented from reading. The module header credits Hermes Agent, Nous Research, the MIT licence and the commit. Rust now, pure part effect-free and content-addressed so it can move to Omega (ADR 0024). No Python.

🤖 Generated with Claude Code

drakestapleton wrote on 2026-10-18 20:12 UTC

Progress (Hermes agent, 2026-10-18): first cut on branch feat/664-operator-words-kept at a738477, stacked on feat/665-persist-before-act (it uses the #665 journal).

Built, in crates/aien-cli/src/compaction.rs and the chat loop:

  • The operator's words are never summarized. The #397 compactor used to fold operator messages into 80-character recap lines. Now every operator message stays word for word, in order, and only the agent's own material (replies, tool calls, tool output, earlier recaps) is folded into one recap placed after them. A short marker line in the recap shows where each operator message came.
  • One rolling recap. Only the newest recap is kept. Past 2,000 tokens, its oldest lines are dropped (defrag); messages are never touched. Every original stays in the compaction records (record version 2; version 1 records still rebuild).
  • Recorded at once. Every applied compaction is written to the session journal immediately (one whole line), so a resumed session never loads both a recap and the messages it replaced.
  • Per-turn folding, opt-in (AIEN_MICRO_COMPACT=1): one exchange per turn. The cursor is the last recap in the transcript, so a resumed session carries on and never folds an exchange twice, and each pass only rewrites the old recap plus one exchange.

Tests (cargo test -p aien-cli --bin aien-cli): 114 pass, including:

  • operator lines byte-identical through 50 compaction passes, with one recap at most, the recap bounded, and the records rebuilding the full transcript;
  • per-turn folding: one exchange per pass, a fresh compactor after a reload does not fold exchange 0 again, and the protected tail is never touched;
  • defrag bound;
  • version 1 record compatibility;
  • resume after a compaction loads it once.

Mutation check: folding operator messages, ignoring the cursor, disabling defrag, or not journaling the compaction each fail at least one test. Clippy -D warnings and fmt are clean. crumb verify OK (pinned tool 94fffbc).

Changed test: mixed_content_counts_toward_budget only fit its budget by summarizing large operator messages. It now puts the large content in agent replies and checks the documented trade-off: large operator messages stay, and the report says still_over_budget.

Not in this cut (next): model-written summaries with failure pacing (skip after 3 failures; cooldown 60/300/900 s), and token counts anchored on the model server's reported usage (an estimate alone never triggers compaction). Not run against a live model.

Sign in to comment