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 3: tool batch planning with reader/writer path reservations and result spill budgets

Closed · #666 · open 2026-10-18 19:11 UTC · closed 2026-11-05 01:55 UTC (reason completed)

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

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

Hermes source: tools/tool_dispatch_helpers.py, agent/tool_executor.py, tools/budget_config.py.

Mechanics to implement:

  • A batch of tool calls is planned into ordered parallel and sequential segments using path-overlap reservations: readers share, writers exclude; a bounded start-order gate with a deadline that excludes human approval wait (Hermes: 420 s, 8 workers).
  • Tool results spill to files under three budgets (per result, per turn, window-scaled), largest first; the kept part is head 40 percent and tail 60 percent with one marker; file reads are exempt to avoid persist-read loops.

Our loop runs tools one at a time today; this is the safe form of parallelism.

Acceptance: two writers on one path never run together; two readers do; a 1 MB tool result leaves the transcript under budget with the spill file addressable.

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:25 UTC

Progress (Hermes agent, 2026-10-18): branch feat/666-tool-batches at 2539fb5, stacked on feat/664-operator-words-kept and feat/665-persist-before-act.

Built, in crates/aien-cli:

  • src/tool_plan.rs (pure): one reply's tool calls are planned into ordered steps.
    • Readers (view_file, list_dir, grep_search, find) share a step, up to 8 at once.
    • A writer (write_to_file, replace_file_content, create_dir) never shares a step with a call on an overlapping path.
    • Shell commands, unknown tools, calls with no path, and any call the safety engine would ask the operator about are barriers. They run alone, so approval prompts never interleave.
    • Conflicting pairs keep their order. Paths are compared lexically, so symlink aliases are not detected.
  • src/tool_batch.rs: every request of a step is written to the #665 journal before any of them runs. Then the step runs on scoped threads, each handed the tokio runtime handle. Results are journaled and added in call order. A panicking tool becomes an error result, and the others are kept.
  • src/tool_spill.rs: three budgets, all window-scaled at 4 characters per token.
    • Per result: 15 percent of the window (floor 8,000, cap 100,000).
    • Per reply: 30 percent (floor 16,000, cap 200,000), spilling the largest first.
    • A spilled result is written whole to basecamp/sessions/<id>-spill/<digest>.txt (0600, content-addressed, string fields with real line breaks so view_file can page it). The conversation gets a 40/60 head-and-tail preview of 1,500 characters, the path, and any top-level status. view_file results are never spilled. If the file can't be written, the preview is kept with a note.

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

  • two readers of one path run together;
  • two writers on one path never do;
  • a shell command never runs beside anything;
  • all requests of a step are on disk before any runs;
  • results come back in call order whatever finishes first;
  • a 1 MB result leaves the transcript under the per-result budget, with the spill file holding the whole output;
  • the real dispatch_tool, run side by side inside a real multi-threaded runtime.

The timing-based tests passed 5 runs out of 5. Mutation check: overlapping writers allowed, nothing parallel, requests recorded while running, file reads spilled, no per-turn budget, and no runtime handle in tool threads (panics at tools.rs:103) each fail at least one test. Clippy -D warnings and fmt are clean; crumb verify OK.

Not done or not tested:

  • no per-step deadline yet (a hung tool holds its step; our tools are synchronous and cannot be cancelled);
  • the start-order gate is not needed, since steps hold only reads and non-overlapping writes and approval calls run alone;
  • goal auto still runs tools one at a time;
  • not run against a live model.

did:key:z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd wrote on 2026-11-18 17:39 UTC

Recovered GitHub comment. Original issue #666 · posting receipt b236ed2cbab26021f847969974dd8458d43681d2bd2c7dbbd5fd92a48f930c8c

Closing: acceptance holds on main 2ef3e06c (merged via #670). nice -n 19 taskset -c 0-9,15-19 cargo test --offline --locked -p aien-cli rc=0, every suite ok. Named acceptance tests pass: tool_batch::tests::two_writers_on_one_path_never_run_together, tool_batch::tests::two_readers_of_one_path_run_together, tool_batch::tests::a_one_megabyte_result_spills_and_the_file_is_addressable (also tool_plan::tests::two_writers_on_one_path_never_share_a_segment). tool_batch.rs/tool_plan.rs headers credit Hermes Agent (Nous Research, MIT, commit 5480918). Org issue sweep P-DRA-9, lane I3.

Sign in to comment