Feat/cli personality#5
Merged
Merged
Conversation
…ning, 87 tests RL implementation for adaptive extractor profile selection: Core additions: - EnsembleAgent: Thompson Sampling meta-agent over UCB + REINFORCE sub-agents Maintains Beta(α,β) beliefs per sub-agent; selects via argmax of sampled θᵢ - Closed reward loop: RewardEngine now accepts depth_multipliers from the active profile — section coverage and diversity are profile-weighted so reward varies with action choice even for identical DNA (no DNAExtractor changes required) - Online learning: saar extract --rl now computes reward + updates policy after every real extraction; persists updated policy atomically to ~/.saar/rl/ Statistical validation: - eval_comparison.py: 2000-sample bootstrap 95% CI + Welch's t-test vs random - Ensemble, UCB, and REINFORCE all p < 0.001 vs random baseline - Bar chart with CI error bars + learning curve plots generated by training scripts New files: - saar/rl/agents/ensemble.py — Thompson Sampling two-level RL hierarchy - tests/test_rl/test_ensemble.py — 20 tests for EnsembleAgent - tests/test_rl/test_policy_store.py — 11 tests for PolicyStore (roundtrip, atomic write, versioning) - tests/test_rl/test_simulator.py — 12 tests for SaarSimulator (oracle, reproducibility, distributions) - tests/test_rl/test_action_space.py — 11 tests for action space (profiles, multiplier ranges) - docs/rl_technical_report.md — comprehensive technical report with Mermaid architecture diagram, full mathematical formulation (UCB1, REINFORCE, Thompson Sampling), experimental design, statistical results, ethical considerations, and reproducibility instructions Modified: - saar/rl/reward.py — profile-weighted _section_coverage and _diversity_score - saar/rl/environment.py — passes depth_multipliers to RewardEngine.compute() - saar/rl/policy_store.py — adds EnsembleAgent save/load_ensemble/stats - saar/commands/extract.py — full online learning loop in _apply_rl_profile() - saar/commands/rl_commands.py — builds + saves ensemble after training both - experiments/train_ucb.py — learning curve data + matplotlib PNG - experiments/train_reinforce.py — reward + baseline convergence curves - README.md — RL module section with architecture diagram, profile table, quickstart Test count: 593 passing (548 original + 45 new RL tests) Ruff: zero violations Made-with: Cursor
Auto-updated AGENTS.md, CLAUDE.md, and .cursorrules to reflect the new RL module (saar/rl/, 87 tests, EnsembleAgent, online learning). Generated by running `saar extract . --no-interview` on the repo itself. Made-with: Cursor
- docs/rl_technical_report.md — full report source (Mermaid diagrams, math formulations, results tables, ethical considerations) - docs/rl_technical_report.html — print-to-PDF ready, styled with cover page, syntax-highlighted code blocks, architecture diagram - docs/generate_pdf.py — regenerates HTML from markdown (no deps) To produce the final PDF: open rl_technical_report.html in Chrome → Cmd+P → Save as PDF Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What does this PR do?
Why?
Type of change
Module affected
saar/commands/— CLI command logicsaar/extractors/— Pattern extractionsaar/formatters/— Output generationsaar/linter.py— AGENTS.md quality rulessaar/scorer.py— Quality scoringsaar/models.py—Verification
Checklist
ruff check saar/ tests/passes (no E/F violations)pytest tests/ -q→ 548 passedsaar extract . --no-interviewruns clean (no stale fact warnings)saar/models.pywithout discussionpyproject.toml+saar/__init__.py(if shipping a release)