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#340 (code only)

closed derived 49a762f9c23191fb #340

Imported from GitHub aien-dev/aien-sovereign-core-mv#340 (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 67f66a7a6e6e371c9c3d7092c93ada00c94f7319 · Head 4bbe83e69cefb020a928236a4d55fa42540070f0

Fetch it

A git bundle of the pull request's head, 10900 bytes.

curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/49a762f9c23191fb.bundle -o 49a762f9c23191fb.bundle
git fetch 49a762f9c23191fb.bundle refs/pull/340/head

Raw bundle · 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
340
4bbe83e69cefb020a928236a4d55fa42540070f0
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":340,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/340","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:51Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 3f9e1009..7c194842 100644
--- a/.crumb
+++ b/.crumb
@@ -77,14 +77,14 @@
         }
       ],
       "children_root": "sha256:285ca7eafbe46d808ebe5e4fb533e464bfdf0fedaf3eef486ac2e2c8826baf6f",
-      "compiled_at": "2026-10-08T16:42:18Z",
+      "compiled_at": "2026-10-08T17:10:56Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:c19d4e1d63d69c2db8abf7a01ea690a85518b7edde8bb342641daf6a9e6c5124",
+      "digest": "sha256:6ccb598103b020ee3061a3998c4c033e3a85dec4a9c4fdd8d101f5cd07148596",
       "evidence_files": 187,
       "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280",
-      "files": 1606,
-      "generated_at_commit": "e6f78ef2d84b8580dac343ff4a1cc48d3ba103b0",
-      "source_tree": "sha256:d55884db02ccd2b18ddfa4cc3c99ebecfd06358282b52f4c1521a5dc04229e29"
+      "files": 1607,
+      "generated_at_commit": "0d778066b180ca6e6e9309c98aabf1a93f6ddc65",
+      "source_tree": "sha256:523400168fdd2bebcc29a30140a7523b82cd275e002085b4fdd2c7b12f573300"
     }
   },
   "history": [],
diff --git a/crates/aien-runtime/src/requirements.rs b/crates/aien-runtime/src/requirements.rs
index 5cb8e718..a28d16ec 100644
--- a/crates/aien-runtime/src/requirements.rs
+++ b/crates/aien-runtime/src/requirements.rs
@@ -106,6 +106,12 @@ pub enum Requirement {
     MinWords(usize),
     MaxWords(usize),
     MinItems(ItemKind, usize),
+    /// At least `n` lines (outside fenced code, leading whitespace ignored) that
+    /// start with exactly `prefix`, e.g. the `- [ ]` of a checklist.
+    MinPrefixedLines {
+        prefix: String,
+        n: usize,
+    },
     /// Case-insensitive substrings of the document.
     RequiredPhrases(Vec<String>),
     /// Whole words, case-insensitive.
@@ -161,6 +167,9 @@ impl Requirement {
             Requirement::MinWords(n) => format!("at least {n} words"),
             Requirement::MaxWords(n) => format!("at most {n} words"),
             Requirement::MinItems(k, n) => format!("at least {n} {}", k.noun()),
+            Requirement::MinPrefixedLines { prefix, n } => {
+                format!("at least {n} lines starting with \"{prefix}\"")
+            }
             Requirement::RequiredPhrases(p) => format!("the phrase {}", quoted(p)),
             Requirement::RequiredWords(p) => format!("the words {}", quoted(p)),
             Requirement::RequiredHeadings(p) => format!("the headings {}", quoted(p)),
@@ -216,6 +225,13 @@ impl Requirement {
                 let c = count_items(*k, content);
                 (c < *n).then(|| format!("{label}, found {c}"))
             }
+            Requirement::MinPrefixedLines { prefix, n } => {
+                let c = prose_lines(content)
+                    .into_iter()
+                    .filter(|l| l.trim_start().starts_with(prefix.as_str()))
+                    .count();
+                (c < *n).then(|| format!("{label}, found {c}"))
+            }
             Requirement::RequiredPhrases(p) => {
                 let low = content.to_lowercase();
                 let missing: Vec<String> = p
diff --git a/crates/aien-runtime/src/requirements_extract.rs b/crates/aien-runtime/src/requirements_extract.rs
index 8cdfbd47..75b340a3 100644
--- a/crates/aien-runtime/src/requirements_extract.rs
+++ b/crates/aien-runtime/src/requirements_extract.rs
@@ -27,6 +27,7 @@
 //! | `N level-two|level-2|second-level|h2 sections titled A, B and C` | `LevelHeadings` (those headings at that level; extra headings of the level are allowed) |
 //! | `start|begin|open with a [markdown] [level-N] heading [line]`, then the end of the clause or `that begins|starts with "# "` (quoted, 1 to 6 `#` and one space) | `FirstLineHeading` (the first line of the file is that heading; a marker fixes the level). Negated, emphasised, qualified or unquoted forms, and any other heading wording after `start with a`, are UNCERTAIN |
 //! | `include|add|put|provide N [separate] fenced code examples|blocks`, or a bound cue before N | `MinItems(CodeBlocks)` |
+//! | `<min bound> N of them|these|those [items|lines|entries]` right after `lines [that] starting|beginning|starts|begins with "P"` in the same sentence (exactly one quoted prefix; singular `line` only after `every|each`; at most four joining words such as `and I want` between the quote and the bound) | `MinPrefixedLines` (at least N lines, outside fenced code, whose text after any indentation starts with exactly `P`). Without that referent, with a negator or a per-section word (`per section heading chapter part`) earlier in the sentence, with another condition after the quote (`and ending with ...`), an upper bound, or no bound cue, the count is UNCERTAIN; so is `N or more of them` |
 //!
 //! Bare line counts. The VERB decides the reading, no task wording is built in. An
 //! edit (the goal names an existing file) is judged on the diff between that file
@@ -725,6 +726,119 @@ fn section_scope_before(goal: &str, toks: &[Tok], s: usize) -> Option<Option<Str
     None
 }
 
+/// Words that may stand between the quoted line prefix and the count cue
+/// ("... starting with "- [ ]" and I want at least 12 of those items").
+const OF_LINE_JOINERS: [&str; 11] = [
+    "and", "then", "also", "so", "i", "we", "want", "need", "include", "add", "write",
+];
+
+/// "<bound> N of them|these|those [items|lines|entries]" (`j` is the `of`): the
+/// count reads only when the same sentence (a line break also ends one), just
+/// before the cue, defines the
+/// counted lines as `lines starting|beginning|starts|begins with "P"` (singular
+/// `line` only after `every` or `each`, as in "every item on its own line"),
+/// with exactly one quoted prefix and at most four joining words
+/// (`OF_LINE_JOINERS`) between the closing quote and the cue. A negator or a
+/// per-section word (`per section heading chapter part`) anywhere in the
+/// sentence before the cue rejects it. Returns the last token of the count and
+/// the prefix as quoted (leading blanks dropped, a trailing space kept).
+fn of_line_prefix(goal: &str, toks: &[Tok], s: usize, j: usize) -> Option<(usize, String)> {
+    let w = |i: usize| toks.get(i).map(|t| t.word.as_str());
+    if !matches!(w(j + 1), Some("them" | "these" | "those")) {
+        return None;
+    }
+    let mut end = j + 1;
+    if !ends_clause(&toks[end].raw)
+        && matches!(w(end + 1), Some("items" | "item" | "lines" | "entries"))
+    {
+        end += 1;
+    }
+    if !qualifier_ok(toks, end) {
+        return None;
+    }
+    // (index of `with`, index of `line(s)`), and the first token of the sentence.
+    let mut found: Option<(usize, usize)> = None;
+    let mut first = 0;
+    let mut m = s;
+    while m > 0 {
+        m -= 1;
+        // A sentence ends at closing punctuation or at a line break.
+        if toks[m].raw.ends_with(['.', '!', '?'])
+            || goal[toks[m].end..toks[m + 1].start].contains('\n')
+        {
+            first = m + 1;
+            break;
+        }
+        let x = w(m).unwrap_or("");
+        if NEGATORS.contains(&x)
+            || matches!(
+                x,
+                "per"
+                    | "section"
+                    | "sections"
+                    | "heading"
+                    | "headings"
+                    | "chapter"
+                    | "chapters"
+                    | "part"
+                    | "parts"
+            )
+        {
+            return None;
+        }
+        if x == "with"
+            && m >= 2
+            && matches!(
+                w(m - 1),
+                Some("starting" | "beginning" | "starts" | "begins" | "start" | "begin")
+            )
+        {
+            let mut l = m - 2;
+            if w(l) == Some("that") && l >= 1 {
+                l -= 1;
+            }
+            if matches!(w(l), Some("line" | "lines")) {
+                if found.is_some() {
+                    return None;
+                }
+                found = Some((m, l));
+            }
+        }
+    }
+    let (with, line) = found?;
+    if w(line) == Some("line")
+        && !toks[first..line]
+            .iter()
+            .any(|t| matches!(t.word.as_str(), "every" | "each"))
+    {
+        return None;
+    }
+    let rest = &goal[toks[with].end..];
+    if leading_quoted_items(rest).0.len() != 1 {
+        return None;
+    }
+    let t = rest.trim_start();
+    let open = t.chars().next()?.len_utf8();
+    let body = &t[open..];
+    let close = body.find(['"', '\u{201D}'])?;
+    let prefix = body[..close].trim_start();
+    if prefix.trim().is_empty() {
+        return None;
+    }
+    // Only joining words between the closing quote and the cue.
+    let closer = body[close..].chars().next().map_or(1, char::len_utf8);
+    let after = toks[with].end + (rest.len() - t.len()) + open + close + closer;
+    let between: Vec<&Tok> = toks[..s].iter().filter(|t| t.start >= after).collect();
+    if between.len() > 4
+        || !between
+            .iter()
+            .all(|t| OF_LINE_JOINERS.contains(&t.word.as_str()))
+    {
+        return None;
+    }
+    Some((end, prefix.to_string()))
+}
+
 /// The heading level an adjective names: `level-two`, `level-2`, `second-level`, `h2`.
 fn level_adj(w: &str) -> Option<usize> {
     let lv = |v: usize| (1..=6).contains(&v).then_some(v);
@@ -774,7 +888,8 @@ fn leading_quoted_items(region: &str) -> (Vec<String>, usize) {
         if !item.is_empty() {
             out.push(item.to_string());
         }
-        at = region.len() - body.len() + close + 1;
+        let closer = body[close..].chars().next().map_or(1, char::len_utf8);
+        at = region.len() - body.len() + close + closer;
     }
     (out, at)
 }
@@ -922,6 +1037,23 @@ pub fn analyze(goal: &str) -> Extraction {
         let Some(noun) = toks.get(j).map(|t| t.word.as_str()) else {
             continue;
         };
+        // "at least twelve of them", the lines named earlier in the sentence (sc#334).
+        if noun == "of" {
+            if let Some((end, prefix)) = of_line_prefix(goal, &toks, s, j) {
+                let v = v as i64 + adj;
+                if dir == Dir::Min && v >= 1 && !negated_before(&toks, s) {
+                    add(
+                        &mut counts,
+                        Requirement::MinPrefixedLines {
+                            prefix,
+                            n: v as usize,
+                        },
+                    );
+                    handled.extend(s..=end);
+                }
+            }
+            continue;
+        }
         if !NOUNS.contains(&noun) || negated_before(&toks, s) {
             continue;
         }
@@ -1514,10 +1646,17 @@ pub fn analyze(goal: &str) -> Extraction {
                         | "day"
                         | "time"
                 );
-            // "twelve of them": a count of items the goal does not name.
+            // "twelve of them", "12 or more of them": a count of items the goal does not name.
+            let of_at = if nm(i + 1) == Some("or")
+                && matches!(nm(i + 2), Some("more" | "fewer" | "less"))
+            {
+                i + 3
+            } else {
+                i + 1
+            };
             if w != "one"
-                && nm(i + 1) == Some("of")
-                && matches!(nm(i + 2), Some("them" | "these" | "those"))
+                && nm(of_at) == Some("of")
+                && matches!(nm(of_at + 1), Some("them" | "these" | "those"))
                 && !handled.contains(&i)
             {
                 bad(&mut unsure, i, true);
diff --git a/crates/aien-runtime/tests/requirements_of_them_test.rs b/crates/aien-runtime/tests/requirements_of_them_test.rs
new file mode 100644
index 00000000..ec27e716
--- /dev/null
+++ b/crates/aien-runtime/tests/requirements_of_them_test.rs
@@ -0,0 +1,151 @@
+//! sc#334: an item count that points back at a line prefix the same sentence
+//! defines ("Write every item as a line starting with "- [ ]" and include at
+//! least twelve of them.") was refused as uncertain before any model call. It
+//! is now read as `MinPrefixedLines`: at least N lines that start with exactly
+//! that quoted prefix. Without such a referent the count stays UNCERTAIN.
+use aien_runtime::requirements::{analyze, refusal_reason, Requirement};
+
+use Requirement::*;
+
+/// tasks-oq3-v4 W5, verbatim.
+const V4_W5: &str = "Make a new file called docs/CAMPING-LIST.md, a packing checklist for a weekend camping trip. It should run to a minimum of 16 lines and no more than 45 lines. Write every item as a line starting with \"- [ ]\" and include at least twelve of them. Use sections titled \"Shelter\", \"Food and water\" and \"Safety\", and use the exact words headlamp and first-aid somewhere in the list.";
+
+/// tasks-oq3-v5 D5, the sentence under test (the rest of D5 is sc#331 and sc#333).
+const V5_D5: &str = "Make me a carry-on packing checklist in docs/packing-carry-on.md. Every item must be its own line starting with \"- [ ]\" and I want at least 12 of those items.";
+
+fn prefixed(n: usize) -> Requirement {
+    MinPrefixedLines {
+        prefix: "- [ ]".into(),
+        n,
+    }
+}
+
+#[test]
+fn the_v4_w5_goal_reads_the_item_count() {
+    let ex = analyze(V4_W5);
+    assert!(ex.uncertain.is_empty(), "uncertain: {:?}", ex.uncertain);
+    assert!(ex.requirements.contains(&prefixed(12)), "{ex:?}");
+    assert!(ex.requirements.contains(&MinLines(16)));
+    assert!(ex.requirements.contains(&MaxLines(45)));
+}
+
+#[test]
+fn the_v5_d5_sentence_reads_the_item_count() {
+    let ex = analyze(V5_D5);
+    assert!(ex.uncertain.is_empty(), "uncertain: {:?}", ex.uncertain);
+    assert_eq!(ex.requirements, [prefixed(12)]);
+}
+
+#[test]
+fn other_referents_and_wordings_read_the_same_way() {
+    for (goal, n) in [
+        (
+            "Put each task on a line beginning with \"TODO:\" and write at least 5 of them.",
+            5,
+        ),
+        (
+            "Each entry is a line that starts with \"* \"; add no fewer than three of these.",
+            3,
+        ),
+        (
+            "Every step is its own line starting with \"- \" and I want more than 4 of them.",
+            5,
+        ),
+        // curly quotes (sc#340 review: a curly closing quote panicked the reader)
+        (
+            "Write every item as a line starting with \u{201C}- [ ]\u{201D} and include at least 4 of them.",
+            4,
+        ),
+        (
+            "Write lines starting with \u{201C}- [ ]\u{201D} and include at least 6 of those lines.",
+            6,
+        ),
+    ] {
+        let ex = analyze(goal);
+        assert!(ex.uncertain.is_empty(), "{goal}: {:?}", ex.uncertain);
+        assert_eq!(ex.requirements.len(), 1, "{goal}: {ex:?}");
+        assert!(
+            matches!(&ex.requirements[0], MinPrefixedLines { n: m, .. } if *m == n),
+            "{goal}: {ex:?}"
+        );
+    }
+}
+
+#[test]
+fn a_trailing_description_after_the_count_is_not_a_count() {
+    // "each with a date" is not measurable; the prefix count is what is checked.
+    let ex = analyze(
+        "Write every item as a line starting with \"- [ ]\" and include at least 4 of them, each with a date.",
+    );
+    assert!(ex.uncertain.is_empty(), "{:?}", ex.uncertain);
+    assert_eq!(ex.requirements, [prefixed(4)]);
+}
+
+#[test]
+fn only_lines_with_the_exact_prefix_count() {
+    let r = prefixed(3);
+    let good = "## Shelter\n- [ ] tent\n- [ ] pegs\n  - [ ] mallet\n";
+    assert!(refusal_reason(std::slice::from_ref(&r), good).is_none());
+    // Plain list lines, checked boxes and fenced lines are not "- [ ]" lines.
+    let bad =
+        "- tent\n- [x] pegs\n* [ ] stove\n```\n- [ ] in code\n```\n- [ ] mallet\n- [ ] rope\n";
+    let why = refusal_reason(std::slice::from_ref(&r), bad).expect("unmet");
+    assert!(
+        why.contains("at least 3 lines starting with \"- [ ]\", found 2"),
+        "{why}"
+    );
+}
+
+#[test]
+fn a_count_without_a_stated_referent_stays_uncertain() {
+    for goal in [
+        // no prefix in the sentence
+        "Write a packing list and include at least twelve of them.",
+        // the prefix is in an earlier sentence
+        "Every item starts with \"- [ ]\". Include at least twelve of them.",
+        // the prefix is not a line prefix
+        "Use the word \"tent\" and include at least twelve of them.",
+        // an upper bound is not read
+        "Write every item as a line starting with \"- [ ]\" and include at most twelve of them.",
+        // no bound cue
+        "Write every item as a line starting with \"- [ ]\" and include twelve of them.",
+        // a count that qualifies the referent further
+        "Write every item as a line starting with \"- [ ]\" and include at least twelve of them per section.",
+        // negated
+        "Write every item as a line starting with \"- [ ]\" but do not include at least twelve of them.",
+        // two prefixes: which one is meant is unclear
+        "Write each item as a line starting with \"- [ ]\" or \"* [ ]\" and include at least twelve of them.",
+        // sc#340 review cases: a curly quote with another clause before the count
+        "Each line starting with \u{201C}- [ ]\u{201D} counts; include at least 4 of them.",
+        // a negator before the referent
+        "Avoid lines starting with \"- [ ]\" and include at least five of them.",
+        "Do not write any line starting with \"TODO\" and include at least five of them.",
+        // a single line, not every item
+        "Start the file with a line starting with \"# Title\" and include at least 5 of those items.",
+        // a per-section intent
+        "Each section has lines starting with \"- [ ]\", and include at least 3 of them.",
+        // another condition on the lines
+        "Write lines starting with \"- \" and ending with \"!\" and include at least 4 of them.",
+        // the referent is too far from the count
+        "Write lines starting with \"- \" for the shopping, the cleaning, the garden and the car, and include at least 4 of them.",
+        // a count the bound cue does not lead
+        "Write lines starting with \"- [ ]\" and include 12 or more of them.",
+        // round 2: a line break ends the sentence
+        "Write lines starting with \"- [ ]\"\nInclude at least 12 of them.",
+        // round 2: only the listed joining words
+        "Write lines starting with \"- [ ]\" and make at least 12 of them.",
+    ] {
+        let ex = analyze(goal);
+        assert!(
+            !ex.uncertain.is_empty(),
+            "{goal:?} should stay uncertain, got {:?}",
+            ex.requirements
+        );
+        assert!(
+            !ex.requirements
+                .iter()
+                .any(|r| matches!(r, MinPrefixedLines { .. })),
+            "{goal:?}: {ex:?}"
+        );
+    }
+}
diff --git a/crates/aien-runtime/tests/requirements_usability_test.rs b/crates/aien-runtime/tests/requirements_usability_test.rs
index 77c518fb..c956e9bf 100644
--- a/crates/aien-runtime/tests/requirements_usability_test.rs
+++ b/crates/aien-runtime/tests/requirements_usability_test.rs
@@ -268,7 +268,7 @@ const SILENT: [&str; 12] = [
 ];
 
 /// Goals whose explicit requirements are all read and enforced.
-const RECOGNIZED: [&str; 15] = [
+const RECOGNIZED: [&str; 16] = [
     "dryrun-tasks-v2/N1",
     "tasks-oq3-v3/N1",
     "tasks-oq3-v4/N1",
@@ -281,13 +281,15 @@ const RECOGNIZED: [&str; 15] = [
     "tasks-oq3-v4/W1",
     "tasks-oq3-v4/W2",
     "tasks-oq3-v4/W4",
+    // sc#334: "at least twelve of them" after `a line starting with "- [ ]"`.
+    "tasks-oq3-v4/W5",
     "tasks-v5/T2",
     "tasks-v8/D3",
     "tasks-v8/D4",
 ];
 
 /// Goals still refused as uncertain, each with the span that is reported and why.
-const REFUSED: [(&str, &str, &str); 9] = [
+const REFUSED: [(&str, &str, &str); 8] = [
     (
         "dryrun-tasks-v2/T6",
         "one section per symptom",
@@ -323,11 +325,6 @@ const REFUSED: [(&str, &str, &str); 9] = [
         "three topics",
         "a topic list after a colon cannot be checked mechanically",
     ),
-    (
-        "tasks-oq3-v4/W5",
-        "twelve of them",
-        "a count of items the goal does not name",
-    ),
     (
         "tasks-v8/D5",
         "10 frequently asked questions and answers",