Spaces:
Sleeping

vajeeda Claude Sonnet 4.6 commited on
Commit
41ea373
·
1 Parent(s): 5fcd0ee

feat(phase1): OpenEnv scaffold + R1/R2 rewards — PHASE 1 GATE PASS

Browse files

- environment/actions.py: ActionType enum + ArbitratorAction model
- environment/observations.py: RewardComponents (weighted, normalised), DebateRound, Observation
- environment/episode_state.py: mutable episode state dataclass
- environment/env.py: ViralScriptEnv — Gymnasium-compatible reset/step/state, difficulty tiers, anti-gaming wired
- rewards/r1_hook_strength.py: 5-check rule-based hook scorer (promise, curiosity, specificity, front-load, anti-filler)
- rewards/r2_coherence.py: sentence-transformers cosine similarity with 4-range score mapping + embedding cache
- rewards/reward_aggregator.py: catastrophic-drop (>0.2) + action-diversity anti-gaming rules
- agents/rewriter.py: RewriterAgent wrapping LLMBackend with unified diff output
- scripts/run_dummy_episode.py: demo runner with rich output and gate check
- tests/test_rewards.py: 10 tests — R1 (5), R2 (2), aggregator (3)
- tests/test_environment.py: 6 tests — all LLM calls mocked via golden fixtures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

14 files changed +897
Files changed (14)
viral_script_engine/agents/rewriter.pyAdded+44
viral_script_engine/environment/__init__.pyAdded
Empty file
viral_script_engine/environment/actions.pyAdded+17
viral_script_engine/environment/env.pyAdded+151
viral_script_engine/environment/episode_state.pyAdded+48
viral_script_engine/environment/observations.pyAdded+60
viral_script_engine/rewards/__init__.pyAdded
Empty file
viral_script_engine/rewards/base.pyAdded+7
viral_script_engine/rewards/r1_hook_strength.pyAdded+107
viral_script_engine/rewards/r2_coherence.pyAdded+48
viral_script_engine/rewards/reward_aggregator.pyAdded+42
viral_script_engine/scripts/run_dummy_episode.pyAdded+149
viral_script_engine/tests/test_environment.pyAdded+107
viral_script_engine/tests/test_rewards.pyAdded+117