Layer 2 cleanups: samskara-health split and chat module consolidation#384
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 undersrc/lib/chat/with names that stop colliding. Plus the comment retargets QA flagged.PURPOSE
samskara-browse.tsmixed two features' toolkits (browse/detail vs the Health panel's severity machinery). Separately,chat-loop.ts/chat-prompt.tssat flat insrc/libwhile their siblings lived insrc/lib/chat/, andchat-promptvschat/prompt-assemblywere 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 totests/samskara-health.test.ts. Two deliberate seams documented in both preambles: the Health panel readsrelativeTimefrom browse, andverdictBreakdownreturns browse'sVerdictCountshape so both verdict lists render identically.src/lib/chat/loop.tsandsrc/lib/chat/system-prompt.ts: the loop and the baseline-system-prompt module move in withprompt-assembly/stream-events/types.system-promptnames what it owns (baseline prose blocks + toolbox catalog renderer) as distinct fromprompt-assembly's per-turn wire building. Only three real import sites changed; ~30 files of comment/doc path references retargeted, includingschema.sqland the moved files' own preambles (the QA-flagged stragglers).Notes:
verdictBreakdownvsverdictCountListliving 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 seamGenerated by Claude Code