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

GitHub aien-dev/aien-sovereign-core-mv#459 (code only)

closed derived d36790bd7f6e282d #459

Imported from GitHub aien-dev/aien-sovereign-core-mv#459 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 1a4c810c57ea6370e6fd45bd417660a6ae674f7e · Head fc3bbf3178340f29f53e00ab878b9c3e0b47d746

Apply it

git checkout -b patch-d36790bd7f6e282d 1a4c810c57ea6370e6fd45bd417660a6ae674f7e
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/d36790bd7f6e282d.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
459
fc3bbf3178340f29f53e00ab878b9c3e0b47d746
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":459,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/459","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:15Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index d12de081..911b9a79 100644
--- a/.crumb
+++ b/.crumb
@@ -119,14 +119,14 @@
         }
       ],
       "children_root": "sha256:a99206c1ace0afb823facb1b5490dc9130965e4d4b57a95e83977aa4a4862be0",
-      "compiled_at": "2026-10-12T01:45:39Z",
+      "compiled_at": "2026-10-12T02:06:41Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:4501383d4c5a365808942300646b9c6502b4140a57ba0f3212d1a33d1f069658",
+      "digest": "sha256:4894366ce04d8c27992fa287eeb68f24589eeb8c8bcbf7ab5e189c15f8b1f2cd",
       "evidence_files": 187,
       "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280",
-      "files": 4032,
-      "generated_at_commit": "bb9f2b24fce4cf8b33dd9f4fafbbaa14faab3eab",
-      "source_tree": "sha256:c61d486f2a532a96f636fddd57a021dfe0e4bf78d28b856ed1a2f2c4c295ccb3"
+      "files": 4034,
+      "generated_at_commit": "0b8a1008773ddb47bbf4bdb68fcbe88b1507a493",
+      "source_tree": "sha256:cb5b5619eed1659298027ff111ddb4ebc1f410bcad54138cfde8bd1ba6d71d0e"
     }
   },
   "history": [],
diff --git a/crates/aien-runtime/examples/np1_reference.rs b/crates/aien-runtime/examples/np1_reference.rs
index fede8447..4df4dcf6 100644
--- a/crates/aien-runtime/examples/np1_reference.rs
+++ b/crates/aien-runtime/examples/np1_reference.rs
@@ -104,6 +104,8 @@ async fn main() {
         Some(why) => aien_runtime::spine::retry_prompt(&base, why),
         None => base,
     };
+    let allen = std::env::var("NP1_REFERENCE_ALLEN").unwrap_or_else(|_| "none".into());
+    let prompt = allen_prompt(&prompt, &allen);
     let msgs = vec![aien_runtime::ChatTurn {
         role: "user".into(),
         content: prompt.clone(),
@@ -131,7 +133,7 @@ async fn main() {
     println!(
         "{}",
         serde_json::json!({
-            "backend": aien_inference_abi::TensorBackend::name(tb.as_ref()),
+            "backend": aien_inference_abi::TensorBackend::name(tb.as_ref()), "allen": allen,
             "model_dir": dir, "model_id": config.model_id, "template": tok.template().name(),
             "stop_ids": stop, "warm_up_ids": w, "mode": mode, "retry_reason": retry, "goal": goal, "workspace": ws,
             "prompt_sha256": hex(prompt.as_bytes()),
@@ -232,3 +234,90 @@ mod tests {
         assert_eq!(reference_prompt("task", goal, &ws), want);
     }
 }
+
+/// The model-visible prompt with the ALLEN context the product adds in front of
+/// the task prompt (sc#384, v7 row R1-P): `NP1_REFERENCE_ALLEN=default` repeats
+/// `spine` exactly, `persona::prefix_prompt` with `PersonaContext::defaults()`
+/// (an engaged subject with no saved profile: persona state "default", revision
+/// 0, as the campaign's fixture subject reports). `none` (the default) adds
+/// nothing, the v6 prompt. Any other value is refused: a replay must say what
+/// it replays. A saved profile (state "applied") is not replayed by this tool.
+fn allen_prompt(prompt: &str, allen: &str) -> String {
+    match allen {
+        "none" => prompt.to_string(),
+        "default" => aien_runtime::persona::prefix_prompt(
+            prompt,
+            Some(&aien_allen_profile::PersonaContext::defaults()),
+        ),
+        other => {
+            eprintln!("NP1_REFERENCE_ALLEN={other}: only \"none\" or \"default\" is replayed");
+            std::process::exit(2);
+        }
+    }
+}
+
+#[cfg(test)]
+mod allen_tests {
+    use super::{allen_prompt, reference_prompt};
+    use aien_allen_profile::PersonaContext;
+
+    const R1_GOAL: &str = "Save a one-sentence reminder about stretching the shoulders before swimming into notes/swim-tip.txt.";
+
+    // The default ALLEN block goes in front of the whole task prompt, as the
+    // product does it (persona::prefix_prompt after the plan is built), not
+    // in front of the goal inside the "Goal:" line. v7 R1-P failed because the
+    // replay carried no block at all.
+    #[test]
+    fn default_allen_block_prefixes_the_whole_task_prompt() {
+        let t = tempfile::tempdir().unwrap();
+        let ws = std::fs::canonicalize(t.path()).unwrap();
+        let base = reference_prompt("new", R1_GOAL, &ws);
+        let got = allen_prompt(&base, "default");
+        let want = aien_runtime::persona::prefix_prompt(&base, Some(&PersonaContext::defaults()));
+        assert_eq!(got, want);
+        assert!(
+            got.starts_with("[ALLEN style preferences saved by the user]\n"),
+            "{got}"
+        );
+        assert!(
+            got.contains("[end of style preferences]\n\nGoal: Save a one-sentence"),
+            "{got}"
+        );
+        assert_eq!(allen_prompt(&base, "none"), base);
+    }
+
+    // Deterministic replay check against the v7 GB10 run (evidence-v7/run/
+    // s3-reports/s3-report-R1.json, attempt 1: prompt_tokens 164,
+    // prompt_ids_sha256 eee4e094...): the bytes this tool sends for R1 with
+    // the default block, through the product's template and assistant prefix,
+    // tokenize to exactly those ids. Needs the Qwen3-8B tokenizer:
+    // AIEN_QWEN3_MODEL_DIR=<folder with tokenizer.json>; skipped otherwise.
+    #[test]
+    fn v7_r1_prompt_ids_are_reproduced_exactly() {
+        let Ok(dir) = std::env::var("AIEN_QWEN3_MODEL_DIR") else {
+            eprintln!("AIEN_QWEN3_MODEL_DIR not set: v7 R1 replay check skipped");
+            return;
+        };
+        let tok =
+            aien_inference_abi::ChatTokenizer::from_model_dir(std::path::Path::new(&dir), None)
+                .expect("tokenizer");
+        let t = tempfile::tempdir().unwrap();
+        let ws = std::fs::canonicalize(t.path()).unwrap();
+        let prompt = allen_prompt(&reference_prompt("new", R1_GOAL, &ws), "default");
+        let msgs = vec![aien_runtime::ChatTurn {
+            role: "user".into(),
+            content: prompt,
+        }];
+        let text = format!(
+            "{}{}",
+            aien_runtime::format_chat(tok.template(), &msgs).expect("chat"),
+            aien_runtime::spine::COMPOSE_ASSISTANT_PREFIX
+        );
+        let ids = tok.encode(&text).expect("encode");
+        assert_eq!(ids.len(), 164, "prompt tokens");
+        assert_eq!(
+            aien_runtime::spine::token_ids_sha256(&ids),
+            "eee4e094335087285f3c4ff52fda6f9ecc946c3f145abbe9fbbccf403a6adfe6"
+        );
+    }
+}
diff --git a/docs/campaigns/open-model-qwen3/evidence-v8/r1p-replay-README.md b/docs/campaigns/open-model-qwen3/evidence-v8/r1p-replay-README.md
new file mode 100644
index 00000000..60d5541a
--- /dev/null
+++ b/docs/campaigns/open-model-qwen3/evidence-v8/r1p-replay-README.md
@@ -0,0 +1,16 @@
+# v8 step 1: R1-P CPU replay repaired (exact token identity)
+
+`r1p-replay-cpu.json`: `np1_reference` built from this branch, `NP1_REFERENCE_ALLEN=default`, Qwen3-8B
+(`~/models/qwen3-8b`, model_sha256 17bc3688...), goal of task R1, mode `new`, 96 tokens, CPU only, no chip hold,
+2026-10-12T01:35:10Z to 01:38:52Z, exit 0.
+
+| | v7 GB10 run (s3-report-R1.json, attempt 1) | v7 CPU replay (R1.reference.json) | this replay |
+|---|---|---|---|
+| prompt tokens | 164 | 99 | 164 |
+| prompt_ids_sha256 | eee4e094...adfe6 | 335c249b...27ff | eee4e094...adfe6 |
+| output tokens | 26 | 26 | 26 |
+| reply sha256 | bf760bf2...a812 | bf760bf2...a812 | bf760bf2...a812 |
+
+The model-visible token sequence now equals the GB10 prompt exactly, ALLEN context included. The v7 record and its
+R1-P FAIL are unchanged (RESULT-v7.md); this is the repaired tool a later campaign uses. Unit check:
+`AIEN_QWEN3_MODEL_DIR=<qwen3-8b> cargo test -p aien-runtime --example np1_reference v7_r1` (tokenizer only, no model run).
diff --git a/docs/campaigns/open-model-qwen3/evidence-v8/r1p-replay-cpu.json b/docs/campaigns/open-model-qwen3/evidence-v8/r1p-replay-cpu.json
new file mode 100644
index 00000000..9f7e7bfa
--- /dev/null
+++ b/docs/campaigns/open-model-qwen3/evidence-v8/r1p-replay-cpu.json
@@ -0,0 +1,209 @@
+{
+  "allen": "default",
+  "backend": "ReferenceCpuBackend",
+  "model_id": "qwen3-8b",
+  "template": "chatml-qwen3-nothink (Qwen3-8B, thinking off)",
+  "goal": "Save a one-sentence reminder about stretching the shoulders before swimming into notes/swim-tip.txt.",
+  "mode": "new",
+  "max_tokens": 96,
+  "prompt_tokens": 164,
+  "prompt_ids_sha256": "eee4e094335087285f3c4ff52fda6f9ecc946c3f145abbe9fbbccf403a6adfe6",
+  "prompt_ids": [
+    151644,
+    872,
+    198,
+    58,
+    969,
+    25317,
+    1707,
+    19322,
+    6781,
+    553,
+    279,
+    1196,
+    921,
+    9485,
+    525,
+    1707,
+    11454,
+    1172,
+    13,
+    2379,
+    13198,
+    902,
+    7882,
+    323,
+    2581,
+    2297,
+    1128,
+    279,
+    3383,
+    17064,
+    369,
+    13,
+    1416,
+    279,
+    3383,
+    3685,
+    25800,
+    448,
+    1105,
+    11,
+    1795,
+    279,
+    3383,
+    624,
+    606,
+    25,
+    330,
+    969,
+    25317,
+    698,
+    57929,
+    25,
+    20628,
+    198,
+    65210,
+    25,
+    4622,
+    198,
+    20772,
+    29021,
+    25,
+    902,
+    198,
+    57208,
+    315,
+    1707,
+    19322,
+    2533,
+    39992,
+    25,
+    10255,
+    264,
+    825,
+    1331,
+    18380,
+    26528,
+    911,
+    41849,
+    279,
+    26906,
+    1573,
+    23380,
+    1119,
+    8388,
+    42934,
+    318,
+    83229,
+    3909,
+    624,
+    60454,
+    27514,
+    25,
+    27514,
+    198,
+    2008,
+    960,
+    6896,
+    825,
+    1034,
+    2297,
+    4766,
+    279,
+    27514,
+    624,
+    16141,
+    304,
+    6896,
+    419,
+    3561,
+    323,
+    4302,
+    770,
+    510,
+    8404,
+    25,
+    366,
+    20432,
+    1815,
+    397,
+    27,
+    1782,
+    4583,
+    501,
+    1034,
+    2213,
+    397,
+    7985,
+    279,
+    501,
+    1034,
+    8388,
+    42934,
+    318,
+    83229,
+    3909,
+    13,
+    576,
+    3899,
+    1555,
+    315,
+    697,
+    4226,
+    1969,
+    387,
+    6896,
+    25,
+    3899,
+    25,
+    8388,
+    42934,
+    318,
+    83229,
+    3909,
+    151645,
+    198,
+    151644,
+    77091,
+    198,
+    151667,
+    271,
+    151668,
+    271,
+    8404,
+    25
+  ],
+  "n_out": 26,
+  "output_ids": [
+    8388,
+    42934,
+    318,
+    83229,
+    3909,
+    198,
+    10227,
+    23380,
+    11,
+    1896,
+    264,
+    4445,
+    311,
+    14501,
+    697,
+    26906,
+    311,
+    7269,
+    24177,
+    323,
+    7949,
+    279,
+    5214,
+    315,
+    10895,
+    13
+  ],
+  "reply_sha256": "bf760bf265b38d48a454315892ec3c30419b0458a9ea671939602a7f887aa812",
+  "finish": "eos",
+  "ms": 107609.6737
+}