feat: deep runtime optimization — parser, gates, Layer 3, reflective log#13
Merged
VictorVVedtion merged 5 commits intomasterfrom Mar 15, 2026
Merged
feat: deep runtime optimization — parser, gates, Layer 3, reflective log#13VictorVVedtion merged 5 commits intomasterfrom
VictorVVedtion merged 5 commits intomasterfrom
Conversation
- Add parse_claude_md() with structured extraction + fallback for prose-style CLAUDE.md - Add RECALL gate (5th gate, was missing from program.md spec) - Add Layer 3 verification triggers (DANGER ZONE, consecutive RETRY, architectural complexity) - Add detect_complexity() routing (trivial/simple/complex/architectural) - Add three-layer reflective logging (WHAT/WHY/PATTERN) with JSONL persistence - Add detect_patterns() for behavioral pattern detection (stuck loop, velocity trend) - Fix DZ substring matching — now uses path-segment-aware matching - Fix velocity trend sensitivity — requires 6+ entries and 0.3 threshold - Fix overall=PASS when all gates WARN/SKIP — now correctly returns WARN - Add bound_defined refresh in run_verification() — init snapshot no longer stale - Extract shared BOUND constants (DRY), magic values, _get_claude_md_path() helper - Move Counter import to top, add try-except for TSV writes - Refactor prepare.py scan_project() into sub-functions (SRP) - prepare.py now imports shared constants from framework.py - danger_zones field in scan results now populated via parse_claude_md() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add momentum-gate.sh — tracks read/write ratio, warns on analysis paralysis - Register momentum-gate.sh in settings.json.template (PostToolUse) - Improve bound-guard.sh — recursive upward CLAUDE.md search (up to 5 levels) - Improve recall-gate.sh — recursive search + remove head -50 limit - Add ruff lint, ruff format, bandit security scan to CI - Add pytest-cov with --cov-fail-under=70 to CI - Add testpaths = ["tests"] to pyproject.toml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- test_new_features.py (49): parse_claude_md, detect_complexity, Layer 3, RECALL gate, prepare integration - test_reflective_log.py (45): three-layer log, pattern detection, JSONL persistence, print summary - test_coverage_gaps.py (54): all previously untested code paths from gap analysis - test_edge_case_fixes.py (19): DZ path-segment matching, velocity sensitivity, overall WARN, bound refresh - Update test_framework.py + test_framework_extra.py for bound_defined refresh behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HIGH: - bound-guard.sh: replace substring matching with path-segment-aware matching, consistent with Python-side _file_in_danger_zone() behavior - Rename misleading test_contains_match → test_file_zone_segment_match_in_nested_path MEDIUM: - CI: --cov=framework --cov=prepare instead of --cov=. (exclude test files from coverage) - Fix pseudo-assertion test_mild_variation_is_stable (was accepting two mutually exclusive results) - Cache parse_claude_md() result in run_verification() and pass to sub-functions (eliminates 3 redundant file I/O + regex parses per verify call) - Add shutil.move fallback for os.replace in write_reflective_log (handles cross-device mounts: Docker volumes, NFS) LOW: - Pin ruff version range in CI (>=0.8,<1.0) for reproducible builds Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HIGH: - save_state() now uses atomic write (tmp + os.replace + shutil.move fallback), matching write_reflective_log() pattern — prevents state corruption on crash MEDIUM: - Surface parse_source field in check_bound() output — no longer dead data - momentum-gate.sh: replace integer division with multiplication (READS >= WRITES*3 instead of READS/WRITES >= 3) to avoid truncation - Replace conditional assertion in test_fail_takes_priority_over_review with deterministic mock — test now reliably catches regressions Co-Authored-By: Claude Opus 4.6 (1M context) <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
parse_sourcefield for consumer trust decisionsauthmatchingunauthorized.py), velocity sensitivity (6+ entries required), overall WARN for unconfigured projects, bound_defined auto-refreshDogfood validation
Ran Ouro Loop on itself (scan → init → verify → log → reflect). Found:
parse_sourcefield lets consumers decide trust levelTest plan
python -m pytest tests/ -v— 415 passedruff check framework.py prepare.py— all checks passedruff format --check framework.py prepare.py— formattedframework.py verify .on own project — Layer 3, RECALL, fallback parser all functional🤖 Generated with Claude Code