interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / docs / research / hermes-agent-prior-art.md

316 lines · 20505 bytes Raw Blame History Source

Research Note: Hermes Agent and AIEN

Written 2026-10-18 for Drake's question: *does the open-source Hermes Agent hold principles or mechanics that are unique and worth rewriting in our own language?* Source of truth for every claim: the Hermes tree pinned below, read on disk (not run). Claims are tagged [OBSERVED path] (read in the code), [DOCUMENTED path] (read in Hermes's own developer guide) or [INFERRED]. Nothing here was executed.

Source

ItemValue
Repositoryhttps://github.com/NousResearch/hermes-agent
Commit read548091836760a67e331b8f5643be8e5c08fae1e6 (2026-10-18)
LicenceMIT, Copyright (c) 2025 Nous Research. Rewrites are allowed; keep the credit line.
LanguagePython (9,836 files, about 2.4 M lines, 1.47 M of them tests)
My copy~/workspace/investigations/2026-10-18-hermes-agent/upstream on the Spark, with PINS and scout notes in notes/ beside it
Prior mentions on my sidenone outside the archived Odysseus fork (org-check receipt org:8d23a45c210a)

Hermes is a general chat and messaging agent harness: a loop around a hosted or local language model with tools, skills, memory files, a messaging gateway for about 27 platforms, a cron scheduler and a session database. It is the kind of thing AIEN's host runtime (sovereign core aien chat loop, aegis-runtime, Aien) is also becoming, which is why the comparison is worth making.

Method

Architecture and agent-loop guides read first-hand; the four large subsystems (agent core; memory, skills, learning; tools, approvals, delegation; gateway, cron, state) were each read by one scout against written questions, with file:line citations, and the judgment below is the orchestrator's. My own side was checked with org-check before any "I lack this" claim.

1. Context compression: the clearest lesson

Hermes keeps a conversation inside the model's window with two mechanisms [DOCUMENTED website/docs/developer-guide/context-compression-and-caching.md, micro-compaction.md; OBSERVED agent/context_compressor.py, agent/conversation_compression.py].

Batch compression fires at 50 % of the window before a call (85 % between gateway turns). It flushes memory to disk first, keeps the last 20 messages verbatim, never splits a tool call from its result, and writes a structured summary (goal, constraints, progress, decisions, files, next steps). Each compression starts a child session lineage.

Micro-compaction is the part I do not have. It is opt-in in Hermes (off by default, because each pass breaks the prompt-cache prefix). When on, after every normal turn it absorbs exactly one exchange (one assistant turn with its tool results) into a single rolling summary. Properties the code enforces:

Token accounting is anchored on evidence, not estimates [DOCUMENTED context-compression-and-caching.md "Token accounting"; OBSERVED agent/usage_anchor.py]: the provider's last reported prompt and completion counts, keyed by a content fingerprint and persisted on the session row, are the truth; local estimates cover only the messages appended since. An estimate over threshold, even one above the whole window, is not treated as proof that a request will fail; the gate waits one request for provider evidence. Image token cost is learned per model from the provider's reported usage, not from a vendor formula.

Failure handling is a persisted cooldown ladder (60 s, 300 s, 900 s) per session, with a deterministic fallback summary route when the summarizer stalls twice, and commits through a lease, fence and watermark so two compactions cannot interleave.

What I have today. The sovereign core already has a conversation compactor (crates/aien-cli/src/compaction.rs, issue 397 there): tool-aware groups, unsafe-boundary refusal, and durable originals with digests written before the list changes, with replay. Hermes does not have that last property. I lack: the one-exchange-per-turn bounded pass, the never-summarize-the-user rule, the transcript-recovered cursor, the rolling summary with defrag, the atomic store swap, and evidence-anchored token accounting. (org-check receipt org:461d52d75b01.)

2. Memory and skills: small, plain, and written by the agent itself

Findings from the scout note notes/scout-B-memory-skills-learning.md.

Memory is two plain-text files with hard character caps, MEMORY.md at 2,200 and USER.md at 1,375 characters [OBSERVED tools/memory_tool_store.py, agent/memory_manager.py]. A full store makes the write fail with a listing of current entries, so the model must free space in the same batch. The prompt snapshot of memory is frozen at session start; writes persist at once but are visible only after the next rebuild. There is no vector store in the core. External memory providers plug in behind one interface [OBSERVED agent/memory_provider.py]; two adapters are in-tree. External recall is not put in the system prompt: it is appended to the current user message as a fenced "reference data" block, and the harness prints a deterministic "recalled N memories" line so the model cannot silently ignore it.

Skills are folders with a SKILL.md plus optional references, templates and scripts. The system prompt carries only an index: name and a 60-character description, enforced by tests; the model loads a skill by calling a view tool and is told to load anything even partly relevant. There is no matcher and no embedding [OBSERVED tools/skills_tool.py, agent/prompt_builder.py].

The agent writes its own skills ("the agent that grows with you") [OBSERVED agent/background_review.py, agent/learn_prompt.py, tools/skill_manager_tool.py, tools/skill_ledger.py]:

What I have today. Cortex (omega) is an append-only lessons and sources memory with recall; the Skill Router and Capability Graph are host-side omega modules; skills on the Spark are Claude Code skills. I have no mechanism by which the agent itself distils a run into a skill under an editorial policy, no skill ledger with rollback, and no use-driven skill ageing.

3. The turn loop: persist before acting, plan the tool batch

Findings from notes/scout-A-agent-core.md [OBSERVED agent/conversation_loop.py, agent/turn_tool_round.py, agent/turn_context.py, agent/tool_executor.py, tools/tool_dispatch_helpers.py, agent/turn_retry_state.py, agent/turn_truncation.py, tools/budget_config.py].

What I have today. The sovereign core chat loop has hooks and the compactor; it has no persist-before-act rule, no batch planner with path reservations, and no one-shot recovery ledger (not checked by org-check; stated from the sc#397 inventory, which lists the loop's entry points).

4. Gateway, cron and state: guarantees chosen per path and written down

Findings from notes/scout-D-gateway-cron-state.md [OBSERVED gateway/delivery_ledger.py, gateway/session.py, cron/scheduler_tick.py, cron/occurrences.py, cron/scheduler_authority.py, cron/scheduler_liveness.py, cron/quota_hold.py, hermes_state.py, hermes_state_repair.py, pm/environments.py, hermes_platform/].

What I have today. aegis-runtime has a WebSocket gateway and a heartbeat scheduler but no delivery ledger and no at-most-once cron discipline (its README and source list neither). The hive's forge queue and lanes ledger are shell-level. Synapse has revisions and recovery for changesets, not for message delivery. The Aienux continuity commit path already does advance-before-act for its own store (ADR 0016).

5. Tools, approvals, delegation, checkpoints

Findings from notes/scout-C-tools-approvals-delegation.md [OBSERVED tools/approval_floors.py, tools/approval.py, tools/approval_smart.py, tools/delegate_tool_registry.py, tools/checkpoint_manager.py, tools/code_kernel.py, tools/budget_config.py, agent/tool_executor.py].

What I have today. Capability-bounded, receipt-producing effects are Omega doctrine (SMART is not TRUSTED), ARGUS is the defensive plane, and INTERPLANE holds an action for a person when untrusted content is in view. What I lack is the ordering rule as code (floors first, then modes, with the operator's deny list outranking everything) and a file rollback that keeps the agent's writes apart from the operator's.

6. Judgment: what is worth rewriting, in which language, and where

The principles below are the ones that are both unusual in Hermes and absent on my side. Each becomes one issue; the issue carries the credit line.

#Principle (Hermes mechanic)Why it is worth making mineLands in
1Bounded micro-compaction: never summarize the operator; one exchange per turn; transcript-recovered cursor; rolling summary with defrag; atomic store swap; evidence-anchored token accountingDirect fit with "no guessing": provider usage is a receipt, an estimate is not. Extends sc#397 instead of replacing itaien-sovereign-core (aien chat loop)
2Persist-before-act turn discipline; byte-identical replay sidecar; one-shot recovery flags; never run a truncated tool callSame idea as Aienux continuity commits (advance the record, then act), applied to the chat loopaien-sovereign-core
3Tool batch planning with reader/writer path reservations; result spill under three budgetsMy loop runs tools one at a time; this is the safe form of parallelismaien-sovereign-core
4Agent-written skills under an editorial policy: forked reviewer, lessons not logs, read-before-write enforced, unattended is add-only, content-addressed skill ledger with rollback, use-driven ageingMy Cortex records lessons but nothing distils runs into skills; the ledger is content-addressed, which is Omega's own ideaomega (Cortex, Skill Router)
5Delivery and scheduling guarantees stated per path: at-least-once reply ledger with content-hash obligation ids and a visible duplicate marker; at-most-once cron (advance before run, pause on uncertainty, liveness by silence since progress, pid plus start-time owner stamps, epoch fences)Aien's heartbeat and the hive's queue have no stated guarantee today; this is how "it ran once" becomes provableaegis-runtime (gateway, heartbeat)
6Approval floors ordered above every mode; agent-write ledger so rollback spares the operator's editsTurns ARGUS and capability doctrine into one ordering rule the loop cannot skipaien-sovereign-core (with aienos ARGUS as reviewer)

Language. Rust now, Omega as the destination (ADR 0024). Omega has no general compiler today (omega README, 2026-10-03), so "an Omega" is not an option for working code this month. The rule for each rewrite: the pure part (summary folding, token accounting, the delivery state machine, the skill ledger) is written as a content-addressed, effect-free module with a stated interface, so it can be carried into Omega as a semantic identity later; only the edges (SQLite, sockets, files) stay host Rust.

Not worth rewriting (ordinary, or already mine): the three API modes and provider adapters, the 27 messaging platforms, the Python package manager, the browser and computer-use stacks, the TUI, and the mixture-of-agents provider. The environment-generation idea in the package manager and the table-driven machine facts are good habits, noted here, not issues.

Licence and credit. MIT allows rewriting. No Hermes code is to be copied; mechanisms are re-implemented from the description above and from reading. Each issue and each resulting module header names Hermes Agent, Nous Research, the MIT licence and the commit read. If any text is carried over verbatim (for example a prompt rule), the MIT notice goes into that repository's NOTICE file.

7. If I move onto Hermes as the day-to-day harness

Drake raised a transfer to Hermes on 2026-10-18. What the tree says a transfer needs [DOCUMENTED README.md, website/docs/user-guide/which-file-does-what.md; OBSERVED agent/prompt_builder.py, tools/memory_tool_store.py]:

My asset todayHermes equivalentCaveat
~/.claude/CLAUDE.md, AGENTS.mdAGENTS.md and project files in the context tier; SOUL.md for identityproject files are capped per file; order is SOUL, guidance, pinned skills, then project files
Memory directory (over 100 files)MEMORY.md (2,200 characters) and USER.md (1,375)will not fit; needs an external memory provider, which is where my Cortex could plug in
Claude Code skillsskills/<name>/SKILL.md with a 60-character descriptionthe model, not a matcher, chooses skills from the index
Hooks (manual-guard, docs-guard, chat-size)gateway hooks and observer hooks, middlewarehooks are gateway-side; CLI-side enforcement is thinner
Subagentsthe delegate tool (in-process threads)defaults differ between docs and code
MCP serversoptional-mcps and the MCP toolOAuth sessions handled in the TUI gateway
Cron jobs on the SparkHermes cron (at-most-once, see section 4)jobs run as gateway sessions
Python ruleHermes is Python end to endit would be an outside tool I use, not part of the trusted base

8. Limits of this note

One commit read on one day. Scouts did not read: the micro-compaction body itself (documentation plus gating code only), the conversation-turn undo code, the docker egress and ownership modules, 26 of 27 platform adapters, the full scheduler, and the package-manager update path. No Hermes code was executed, so timings, cache savings and the vendor's cost claims are unverified. Whether Hermes's self-review improves outcomes is UNKNOWN from the tree: its evals do not test memory or skill quality.