RSI Phase 2: agentic Rashi/Tosafot translation task type - #54
Open
ronshapiro wants to merge 9 commits into
Open
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extending Error without Object.setPrototypeOf breaks instanceof at this project's (unset -> ES3-default) tsconfig target, which was silently turning the rate-limit stop path into skip-and-retry-forever under real ts-node execution (jest's babel target masked it). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ronshapiro
force-pushed
the
worktree-bridge-cse_013nvCXPadZwXNRyPP2mBoCF
branch
from
August 11, 2026 00:50
d0860a6 to
1c7d9d4
Compare
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sums cost across every generate/critique call (including rejected attempts), not just the accepted one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
headless_claude.ts now switches to --output-format stream-json to record every Read/Grep/Glob call Claude makes per request, logged to a new context_usage_log.jsonl — raw signal for eventually learning what context each task type actually needs, rather than a hand-picked commentary allowlist. Also fixes two real bugs found while validating this: the CLI's --limit was applied before freshness filtering (a small --limit could silently do nothing), and both triage_log.ts and context_usage_log.ts had their test's cleanup pointed at the real production log path, which would have deleted real accumulated data the first time either log had real content (it just did, for context_usage_log.jsonl, and was recovered from the git index before this commit). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
4 tasks
ronshapiro
added a commit
that referenced
this pull request
Aug 11, 2026
Context-provisioning, budget/scheduling, and review-surface redesign addressing real issues found in live runs (context wandering, no spend pacing, no review gate). Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
4 tasks
ronshapiro
added a commit
that referenced
this pull request
Aug 11, 2026
Brings in PR #54's work (staleness enum, headless_claude model pinning/rate-limit handling/tool-use capture, the translation task type, and the design retrospective from real runs) that was still unmerged upstream. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ronshapiro
added a commit
that referenced
this pull request
Aug 12, 2026
… routing) (#56) * RSI Phase 2: agentic Rashi/Tosafot translation task type Brings in PR #54's work (staleness enum, headless_claude model pinning/rate-limit handling/tool-use capture, the translation task type, and the design retrospective from real runs) that was still unmerged upstream. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * RSI redesign Phase 1: JIT ref-addressed context fetching Replaces raw Read/Grep/Glob access to the full cached page file with a narrow context_fetch_cli tool (get-refs/get-neighbors/get-prior-sugyot) plus a compact page skeleton and worked examples inlined in the prompt. Auto-populates generation records' dependsOn from what was actually fetched, instead of always []. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * RSI redesign: per-task-type model routing config Replaces the hardcoded MODEL constant with model_routing_config.json, read via model_routing.ts, so a future routing tuner can propose changes from logged outcomes instead of a hand-edited constant. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * RSI redesign: human-driven budget/schedule + status visibility Adds budget_config.json (hand-edited enable/caps/pause per task type, ships disabled by default), status_cli.ts for call-count/cost visibility against those caps, and schedule_runner.ts as the bounded per-tick cron/launchd entrypoint that honors the config. Folds per-call cost/model logging into context_usage_log.jsonl (added a `model` field) instead of a separate spend ledger, since the two would otherwise track nearly identical data. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Address PR review comments - parseRefLocation: replace the "on"-string heuristic and manual book-prefix loop with books.parse() over successive token suffixes — structural, not a hardcoded string convention. - getTaskModelConfig: throw when a task type has no config entry instead of silently falling back to a hardcoded default. - generationPrompt: throw if the page isn't cached instead of degrading to "(page not cached)" in the prompt text. - context_fetch_cli.ts: use yargs (consistent with the sibling CLI) instead of hand-rolled argv parsing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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
Phase 2 of
RecursiveSelfImprovingAgentPlan.md: the first content-generation task type, replacing the Gemini pipeline (precomputed/sugya_prompt_client.ts— left in place, unused, not deleted per instruction).rsi_orchestrator/rashi_tosafot_translation.ts— for a given book, finds Rashi/Tosafot comments missing a translation or gone stale (via Phase 1'sstaleness.ts/generation_record.ts), and for each: asks Claude to punctuate + translate it, pointing at where the page's cached data and sugya boundaries live in the repo rather than pre-assembling context — the model decides how much it needs to read, per the plan's "goal and tools, not a scripted context-assembly function." Runs a bounded self-critique loop (generate → critique → at most one retry with feedback → give up) before writing toprecomputed/ai_additions/<Book Page>.jsonand recording a generation record. Supports an optional[limit]CLI arg for bounded/smoke-test runs.precomputed/ai_edits.ts— addedwriteAiEdit(read-modify-write), matching the existingaiEditsForPageread path.rsi_orchestrator/headless_claude.ts— switched from--output-format textto--output-format json(probed the CLI's real output shape first) so it can report the actual model and cost per call — threaded through into each generation record, which Phase 4's model-routing learning depends on.Test plan
npx jest precomputed/rsi_state rsi_orchestrator— 40 tests passing, all Claude/GitHub calls mocked via DI (no real usage spent building/testing this)npx tsc --noEmit -p .— cleannpx eslinton all new/changed files — cleancache_all_api_requests.tsis populating the full local Sefaria cache in the background; will runrashi_tosafot_translation.ts <Book> <limit>against it once a book is available and report results)🤖 Generated with Claude Code