Skip to content

feat(hypothesis-map): pure model + assembler (26 H.1)#170

Closed
bryanmatthewsimonson wants to merge 2 commits into
claude/phase-26-h0-design-docsfrom
claude/phase-26-h1-hypothesis-map
Closed

feat(hypothesis-map): pure model + assembler (26 H.1)#170
bryanmatthewsimonson wants to merge 2 commits into
claude/phase-26-h0-design-docsfrom
claude/phase-26-h1-hypothesis-map

Conversation

@bryanmatthewsimonson

Copy link
Copy Markdown
Owner

Summary

Phase-26 slice H.1 (HYPOTHESIS_MAP_DESIGN.md §2–§3). Stacked on #169 — merge that first; this PR retargets to main automatically.

New modules

  • src/shared/hypothesis-model.js — two chrome.storage.local stores on the EvidenceLinker pattern: case_hypotheses (label-derived deterministic ids — label is identity) and hypothesis_edges (claim→hypothesis, role supports/undermines, canonical claim refs with drift-tolerant matching, idempotent create, immutable structural fields, suggested_by provenance). The role vocabulary is local to the module — undermines deliberately stays out of CLAIM_RELATIONSHIPS. No wire-publish fields until H.5 is a decision.
  • src/shared/hypothesis-map.js — the case-dossier split: storage-aware collector + pure buildHypothesisMap, generatedAt injected, no clock reads. Seeds hypotheses from the synthesis brief's positions (duplicate-normalizing labels union; blank labels disclosed via coverage.unlabeled_positions), merges persisted records by normalized label, groups edges by role with neutral per-section counts, detects shared/opposing-edge crux claims (never netted), stamps verdict chain-head chips as context, and discloses dangling edges (P6).

Integration

  • Reader claim-delete cascades hypothesis edges (dependents-first order) with blast-radius disclosure.
  • WORKSPACE_CLEAR_KEYS extended with both new stores (+ pin test). Backups need no change.
  • JOURNAL entry on the two second-guessable choices (label-as-identity; case delete does not cascade the map).

Constitution guards

  • Grep-guard tests at both layers (stored records walked recursively, assembled map walked with no allowlist): no weight/score/probability/confidence/strength key anywhere.
  • Determinism: same inputs → deepEqual.

Review

A 4-dimension multi-agent adversarial review ran against this diff; all 12 confirmed findings are fixed in the second commit (workspace-key gap, duplicate-label drop, cascade write order, crux null-shadow, and seven test-coverage gaps).

Tests: 1,752 green (33 new) · build clean · web-ext lint 0 errors.

Next

H.2 (side-by-side render on the case dashboard) follows in its own PR.

🤖 Generated with Claude Code

bryanmatthewsimonson and others added 2 commits July 16, 2026 09:14
Phase 26 slice H.1 (docs/HYPOTHESIS_MAP_DESIGN.md §2–§3):

- src/shared/hypothesis-model.js — two chrome.storage.local maps
  (case_hypotheses, hypothesis_edges) on the EvidenceLinker pattern:
  canonical claim refs with drift-tolerant matching, deterministic
  content-hashed ids (label is hypothesis identity), idempotent
  create, immutable structural fields, suggested_by provenance
  (user/llm/nostr), supports|undermines role vocabulary local to the
  module (undermines deliberately NOT in CLAIM_RELATIONSHIPS), no
  wire-publish fields until H.5 is a decision.
- src/shared/hypothesis-map.js — the case-dossier split: storage-aware
  collector + pure buildHypothesisMap, generatedAt injected. Seeds
  hypotheses from brief positions (article-hash holders carried as
  provenance), merges persisted records by normalized label, groups
  edges by role with per-section counts, detects shared/opposing-edge
  crux claims (never netted), stamps verdict chain-head chips as
  context, and discloses dangling edges (P6). Scope question reads
  authored_fields.scope_question directly (dossier.scope is never
  populated — substrate note C1).
- Reader claim-delete cascades hypothesis edges beside the
  EvidenceLinker hook, with blast-radius disclosure.
- 27 tests incl. the §6 grep guard (no weight/score/probability/
  confidence/strength key anywhere in the assembled map, no allowlist)
  and a determinism deepEqual.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Confirmed findings from the multi-agent review of the H.1 diff:

- WORKSPACE_CLEAR_KEYS gains case_hypotheses + hypothesis_edges —
  authored structure, same class as evidence_links (the list's own
  contract: extend it when a new content store ships). Pin test
  updated. Backups need no change (backup.js carries all of
  storage.local minus exclusions).
- Seed loop: two brief positions whose labels normalize equal now
  UNION into one hypothesis (holders deduped by hash, first
  core_argument kept) instead of silently dropping the later one;
  blank-label positions are disclosed via
  coverage.unlabeled_positions (P6).
- Cascade deletes write dependents FIRST (edges, then the hypothesis
  record — the confirmDeleteClaim order), so a death between writes
  leaves a visible re-deletable state, never invisible orphan edges.
- shared_claims keeps the first RESOLVABLE claim view — a null view
  from a snapshot-less edge no longer shadows a sibling's snapshot.
- Tests: model grep guard now walks nested keys (claim_snapshot);
  getForCase order actually asserted (distinct created stamps);
  HypothesisEdgeModel.getForCase cross-case exclusion covered;
  duplicate/blank position labels covered; null-shadow covered;
  assembleHypothesisMap composition covered; the live stored-brief
  read covered via fake-indexeddb.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bryanmatthewsimonson

Copy link
Copy Markdown
Owner Author

Landed on main via the #183 consolidation merge — this PR was auto-closed by the base-branch deletion cascade, but its commits are all in main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant