A code review system that learns from its own misses. Two layers work together:
No external dependencies. stdlib only. Python 3.9+.
Review a file:
text
python3 scar_code_review.py review path/to/file.py
Check a diff against past scars:
text
python3 scar_code_review.py check-diff path/to/changes.diff
Record a missed review finding:
text
python3 scar_code_review.py record-miss \
--what-missed "Missed SQL injection in user input handler" \
--pattern "execute.*format.*user" \
--severity critical
JSONL, compatible with tetra-scar:
json
{"id":"rscar_1234","what_missed":"...","pattern":"...","severity":"critical","created_at":"..."}
python
from scar_code_review import review, reflex_check, record_miss, load_review_scars
# Review a file
findings = review("app/views.py")
for f in findings:
print(f"{f['severity']} [{f['dimension']}] {f['message']} (line {f['line']})")
# Check diff against past scars
scars = load_review_scars()
blocks = reflex_check(diff_text, scars)
for b in blocks:
print(f"BLOCKED: {b}")
# Record a miss after an incident
record_miss(
what_missed="Missed unvalidated redirect",
pattern="redirect.*request\\.GET",
severity="high",
)