Skip to content

Layer 2 cleanups: samskara-health split and chat module consolidation#384

Merged
sysread merged 3 commits into
mainfrom
claude/so-tech-debt-audit-8zr2gf
Jul 3, 2026
Merged

Layer 2 cleanups: samskara-health split and chat module consolidation#384
sysread merged 3 commits into
mainfrom
claude/so-tech-debt-audit-8zr2gf

Conversation

@sysread

@sysread sysread commented Jul 3, 2026

Copy link
Copy Markdown
Owner

SYNOPSIS

Two remaining audit items below the god-module layer: split the Health panel's primitives out of samskara-browse.ts, and consolidate the chat modules under src/lib/chat/ with names that stop colliding. Plus the comment retargets QA flagged.

PURPOSE

samskara-browse.ts mixed two features' toolkits (browse/detail vs the Health panel's severity machinery). Separately, chat-loop.ts / chat-prompt.ts sat flat in src/lib while their siblings lived in src/lib/chat/, and chat-prompt vs chat/prompt-assembly were near-synonymous names - a reader could not tell which owned what without opening both.

DESCRIPTION

  • src/lib/ui/samskara-health.ts (new): severity classification + thresholds, compound-regen status, panel headline, verdict breakdown, count labels; tests split to tests/samskara-health.test.ts. Two deliberate seams documented in both preambles: the Health panel reads relativeTime from browse, and verdictBreakdown returns browse's VerdictCount shape so both verdict lists render identically.
  • src/lib/chat/loop.ts and src/lib/chat/system-prompt.ts: the loop and the baseline-system-prompt module move in with prompt-assembly / stream-events / types. system-prompt names what it owns (baseline prose blocks + toolbox catalog renderer) as distinct from prompt-assembly's per-turn wire building. Only three real import sites changed; ~30 files of comment/doc path references retargeted, including schema.sql and the moved files' own preambles (the QA-flagged stragglers).

Notes:

  • pure refactor, zero behavior change; QA ran gate + Playwright smoke (boot, sign-in, chat streaming, health panel) clean before the final comment fixes
  • verdictBreakdown vs verdictCountList living in different modules is intentional - one is the Health panel's rates view, the other the detail pane's lifetime view; the shared row shape is the documented seam

Generated by Claude Code

claude added 3 commits July 3, 2026 20:20
samskara-browse.ts mixed two features' toolkits: the Corpus browse
list / detail pane primitives and the Health panel's severity
classification, regen-status derivation, and count labels. The
health half now lives in samskara-health.ts with its own test file.
The shared seams are deliberate and documented in both preambles:
the Health panel still reads relativeTime from the browse module,
and verdictBreakdown returns the VerdictCount shape owned by the
browse module so the two verdict lists render identically.
chat-loop.ts and chat-prompt.ts sat flat in src/lib while their
siblings (prompt-assembly, stream-events, types) lived in
src/lib/chat, and chat-prompt vs chat/prompt-assembly were
near-synonymous names for adjacent concerns - a reader could not
tell which owned what without opening both. The loop moves to
chat/loop.ts; chat-prompt becomes chat/system-prompt.ts, naming what
it actually owns (the baseline system-prompt prose blocks and the
toolbox catalog renderer) as distinct from prompt-assembly's
per-turn wire building. Import paths, the test filename, and every
path reference in code comments and the doc tree are retargeted;
prose references to 'the chat-loop' as a concept are untouched.
The rename sweep for chat/loop.ts and chat/system-prompt.ts covered
.ts/.svelte/.md files but skipped schema.sql, the moved loop's own
re-export comment, and the health panel's delegation note (stale
since the samskara-health split). All three now name the modules
that actually hold the code, and the prompt-augmentation table row
for the metadata block points at prompt-assembly, which is where
buildMetadataSystemMessage is actually exported from.
@sysread sysread merged commit 860202f into main Jul 3, 2026
1 check passed
@sysread sysread deleted the claude/so-tech-debt-audit-8zr2gf branch July 3, 2026 20:22
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.

2 participants