Wire V2 amendments into live compiler (activates 2d198f6)#50
Closed
anantham wants to merge 3 commits into
Closed
Conversation
…mpt builders Activates the v2 prompt overlay shipped in 2d198f6. Until now the overlay was a standalone module imported nowhere — protocol learnings codified but not delivered to the LLM at compile time. This commit appends the 6 amendment blocks to the three passes that produce structured semantic content: - buildAnatomistPrompt — receives ARROW_EARNING_RULE + TOOLTIP_REGISTER + ANCHOR (relations / tooltips / isAnchor) - buildLexicographerPrompt — receives SENSE_METADATA + TRANSLATOR_DEBATE (epistemicBasis / sourceCitationIds / confidence / multi-sense curatorial pattern) - buildPhasePrompt — receives the full overlay (comprehensive pass) The amendments are injected AFTER the v1 pass-specific context and BEFORE the per-phase state envelope, so the LLM sees: base → v1 pass guidance → v2 amendments (the new learnings) → current phase state → task. Skeleton / Weaver / Morphology / Typesetter passes are NOT amended — their concerns (phase grouping, English↔Pāli mapping, morph hints, layout blocks) don't intersect with the V2 protocol additions. The amendments are baked in unconditionally (no feature flag). They codify protocol the curation logs have already ratified — they're not experimental. If a future regression is detected, revert this commit or comment out the import. Target file note: Wired into services/suttaStudioPassPrompts.ts (the LIVE prompt builder, called by services/suttaStudioPassRunners.ts). Prior planning docs referenced services/compiler/prompts.ts but that file has zero imports — appears to be orphaned. Tracked as a follow-up cleanup task. Verification: - No existing tests cover these builders directly (they're pure string builders); the real test is A2 — run the compiler on phase-2 and diff against expected hand-curation. See COMPILER_STRATEGY.md §5. - Type safety: import path matches the existing v1 context import; the V2 module is shipped in 2d198f6 and exports SUTTA_STUDIO_V2_AMENDMENTS. Companion to: - 2d198f6 (the V2 overlay module — staged previously, now active) - docs/sutta-studio/COMPILER_STRATEGY.md §2 (pipeline-vs-hand matrix) - PR #49 (batch-4 — where the overlay was first shipped) Next: phase-2 compile run to empirically test v2 quality (~$1-3 API). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ndments Tracks the v2-amendments wiring (b99828e) in the benchmark-comparison version key. Future quality-scorer runs against benchmark fixtures will distinguish v10 (pre-amendment) vs v11 (post-amendment) outputs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The prior commit (b99828e) wired V2 into services/suttaStudioPassPrompts.ts on the assumption that services/compiler/prompts.ts was dead code (its direct grep on "compiler/prompts" returned no hits). That assumption was wrong. The actual architecture: Production UI compile path: SuttaStudioApp.tsx:395 → services/suttaStudioCompiler.ts (re-export) → services/compiler/index.ts (compileSuttaStudioPacket) → services/compiler/prompts.ts (buildAnatomistPrompt, etc.) ← THIS FILE — the one users actually hit. Benchmark CLI path: scripts/sutta-studio/benchmark.ts → services/suttaStudioPassRunners.ts → services/suttaStudioPassPrompts.ts ← The file b99828e wired V2 into. Used by benchmarks only. Without this commit, clicking "compile" in the UI would still use the v10 prompts. Only benchmark runs would see v11. This commit closes that gap by also injecting SUTTA_STUDIO_V2_AMENDMENTS into the production builder (buildAnatomistPrompt, buildLexicographerPrompt, buildPhasePrompt in services/compiler/prompts.ts). Architectural finding worth flagging (tracked as a follow-up): The two prompt builders have DIVERGED. Benchmark has additional anatomist examples (B + REFRAIN) and a lexico ripple example that production lacks. This means benchmark quality scores may overstate what production users actually see. Consolidate into a single source-of-truth in a follow-up — too out-of-scope for this PR. Verification path unchanged: A2 runs the compiler on phase-2 (via either UI or benchmark CLI) and compares output against hand-curation. With this commit, both paths receive v11 prompts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
anantham
added a commit
that referenced
this pull request
May 13, 2026
…o services/sutta-studio/prompts/ Per CONSOLIDATION.md (dc57a63). The two parallel compiler stacks (services/compiler/ and services/suttaStudio*) had drifted: each had its own prompt builders that diverged on examples, parameters, and which features were supported. As of PR #50 they were briefly aligned on V2 amendments — this commit locks in the alignment by establishing a SINGLE SOURCE OF TRUTH. NEW canonical location: services/sutta-studio/prompts/ skeleton.ts — buildSkeletonPrompt anatomist.ts — buildAnatomistPrompt (3 examples, V2 amendments) lexicographer.ts — buildLexicographerPrompt (DPD context + ripples + V2) weaver.ts — buildWeaverPrompt (with ANTI_PATTERN guard) typesetter.ts — buildTypesetterPrompt (optional logger injection) morphology.ts — buildMorphologyPrompt phase.ts — buildPhasePrompt (full V2 overlay) index.ts — barrel Merge decisions (best-of-both for each pass): Anatomist: take benchmark's 3 examples (PHASE_A + PHASE_B + REFRAIN) rather than production's single example. The phase-b morph-data example and the refrain-formula example are pedagogically critical. Lexicographer: KEEP production's DPD context + renderDpdBlock helper AND benchmark's RIPPLES instruction block + ripple example. Neither stack had both. Merged here. Weaver: take benchmark's version with DUPLICATE-MAPPING rule + the SUTTA_STUDIO_WEAVER_ANTI_PATTERN reference. Production lacked these. Typesetter: take benchmark's optional logger param (vs production's inline log() spamming every call). Defaults to no-op. Skeleton / Morphology / Phase: byte-identical between stacks; no merge needed beyond moving. V2 amendments wired into THREE passes (Anatomist, Lexicographer, Phase) — one place, not two. Future protocol amendments land in one place. OLD files become re-export shims: services/compiler/prompts.ts 382L → 24L re-export shim services/suttaStudioPassPrompts.ts 725L → 528L (schemas/types/parseJsonResponse kept inline pending Phase 2; only the 7 builder functions removed, replaced by re-exports from the new canonical path) Consumers don't change: - services/compiler/index.ts continues to import from './prompts' - services/suttaStudioPassRunners.ts continues to import from './suttaStudioPassPrompts' - scripts/sutta-studio/benchmark.ts continues to import from suttaStudioPassPrompts All those imports now resolve through the shims to the canonical builders. Verification: - npx tsc --noEmit -p . — ZERO errors in the touched files (all reported errors are pre-existing TS strictness issues in unrelated files: AboutThisText.tsx React namespace, build-dpd.ts better-sqlite3 type, smoke-real-fojin.ts playwright export, etc.) - npx vitest run — 1332 passed, 16 skipped, 0 functional failures. Single failure is build-dpd.test.ts because main's node_modules (symlinked for the test run) lacks better-sqlite3 — that package was added on the not-yet-merged batch-3 branch. Unrelated to refactor. What this commit does NOT do (deferred per CONSOLIDATION.md): - DOES NOT consolidate schemas. compiler/schemas.ts and the schemas in suttaStudioPassPrompts.ts still differ on skeleton.wordRange and anatomist.refrainId fields (Phase 2). - DOES NOT consolidate the duplicated buildPhaseStateEnvelope or buildBoundaryContext functions (still byte-identical duplicates, Phase 2 cleans up alongside pass runner consolidation). - DOES NOT consolidate the parseJsonResponse helper (also duplicated; Phase 2). - DOES NOT change LLM-visible prompt content. The V2-amended Anatomist / Lexicographer / Phase prompts produce the exact same string as PR #50 (currently paused) would. Benchmark output should be byte-identical pre/post this commit. - DOES NOT bump SUTTA_STUDIO_PROMPT_VERSION. Content unchanged means no benchmark cache invalidation. Phase 4 will bump if needed. Companion to: - docs/sutta-studio/CONSOLIDATION.md (dc57a63) — full design doc - PR #50 paused — its V2-wire commits become redundant once this lands Next: Phase 2 — canonical pass functions in services/sutta-studio/passes/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
Owner
Author
|
Closing — the goal of this PR (V2 amendments active in the production compiler) is now achieved transitively through PR #51 (compiler consolidation). The canonical prompt builders at |
5 tasks
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.
Summary
Activates the V2 prompt overlay shipped in 2d198f6 (PR #49). Until this PR, the v2 amendments were a standalone module imported nowhere — protocol learnings codified but not delivered to the LLM at compile time.
Base note: Stacked on #49 (batch-4). GitHub will auto-rebase to main as #48 → #49 → this merge.
Commits
b99828e— Wire SUTTA_STUDIO_V2_AMENDMENTS into 3 passesInjected after v1 pass-specific context, before per-phase state envelope. Skeleton/Weaver/Morphology/Typesetter unchanged — their concerns don't intersect with V2 additions. Unconditional wiring (no feature flag); amendments codify ratified protocol, not experiments.
d0b6b06— Bump SUTTA_STUDIO_PROMPT_VERSION → v11-mn10-amendmentsTracks the wiring in benchmark-comparison version key. v10 vs v11 outputs in the leaderboard will surface quality deltas attributable to the amendments.
Target file note
Wired into
services/suttaStudioPassPrompts.ts(LIVE prompt builder, called bysuttaStudioPassRunners.ts). Prior planning docs referencedservices/compiler/prompts.tsbut that file has zero imports — appears orphaned. Dead-code cleanup tracked as a follow-up.What this PR does NOT do
Test plan
sattānaṁ visuddhiyā). Compare output to the v1 baseline and to the projected hand-curation diff documented in COMPILER_STRATEGY.md §2.References
🤖 Generated with Claude Code