Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

isa-utils extractCriteriaSection stops at the first claim-bearing H2, so `## Bridge Criteria` and `## Anti-claims` claims are dropped and ISASync logs a false progressMismatch

Open Bowlerjim opened this issue 2 months ago • 2 comments

Observed on 7.54.0.

What

extractCriteriaSection() finds the first claim-bearing H2 and stops at the next H2:

// hooks/lib/isa-utils.ts:186
export const CRITERIA_HEADING_RE =
  /^(?:##\s+(?:ISC\s+)?Criteria\b[^\n]*|##\s+Claims\b[^\n]*|##\s+IDEAL\s+STATE\s+CRITERIA\b[^\n]*|###\s+Criteria\b[^\n]*|##\s+Features\b[^\n]*)$/im;

// hooks/lib/isa-utils.ts:196
const headingMatch = CRITERIA_HEADING_RE.exec(content);
...
const endMatch = rest.match(/\n##\s+(?!#)|\n---\s*\n/);

Two sections the format spec defines as claim-bearing are missing from that alternation:

  • ISAFormat.md section table, row 11: ## Bridge Criteria holds - [ ] ISC-N: Bridge: <what must hold across the seam>, conditional-required for any ISA with a parent:/children: relationship.
  • ISAFormat.md: "## Anti-claims, ## Bridge Criteria, ## Not yet specified remain their own H2 sections in both modes."

Since both sit below ## Claims and both are H2, their checkboxes are cut off by the "stop at the next H2" rule.

Repro

A spec-conformant hierarchical ISA (parent: set, progress: 1/4, four claims spread across ## Claims, ## Bridge Criteria and ## Anti-claims), driven through the real hook:

bun hooks/ISASync.hook.ts < payload.json

Observed:

[ISASync] progressMismatch slug=<slug> frontmatter=1/4 body=1/2 … frontmatter and body disagree — one is stale

and in MEMORY/STATE/work.json: {"progress":"1/4","criteria":["C1/completed","C2/pending"]} — the bridge ISC and the anti-claim are absent. A row is also appended to MEMORY/OBSERVABILITY/isa-progress-mismatch.jsonl.

Expected

All four claims parsed, and no mismatch logged, since neither the frontmatter nor the body is stale.

Why it matters

The omission alone would be tolerable. The false alarm is not: progressMismatch is the signal the operator is told means "one of these is stale", and here it fires precisely when everything is correct. A hierarchical ISA — the case the Bridge Criteria section exists for — can never be clean.

Fix sketch

Make CRITERIA_HEADING_RE a global matcher, iterate it with matchAll, and union the checkbox lines across every claim-bearing H2 (Claims | Criteria | ISC Criteria | IDEAL STATE CRITERIA | Features | Bridge Criteria | Anti-claims), keeping the "stop at the next H2" rule per section so ### F<n> feature blocks still nest correctly.

One design question for the maintainer, which is why this is an issue rather than a PR: should ## Anti-claims entries count toward progress, or only ## Bridge Criteria? Either answer fixes the false mismatch; they differ in what the denominator means.

Bowlerjim avatar Sep 21 '26 03:09 Bowlerjim

Thanks @Bowlerjim. Confirmed: criteria under ## Bridge Criteria were cut off by the stop-at-next-H2 rule, so the count was short and the progress-mismatch alarm was false. Both ISA parsers now count the criteria section plus every Bridge Criteria section, with tests. Anti-criteria stay out of the count by design, so a fixture whose progress: includes an anti-criterion will still read as a mismatch. This goes out in the next public release (8.3.0).

danielmiessler avatar Sep 29 '26 02:09 danielmiessler

Closing this out. I checked the fix described above in source: both ISA parsers count ## Bridge Criteria, and anti-criteria stay out of the count. Next release carries it.

danielmiessler avatar Oct 03 '26 04:10 danielmiessler