chore: snapshot of work since 2026-10-05 (Stage 1 v.8, S2_00 v7.4/v7.5 handoff, S2_10 rewrite research v.2, 청구취지·요건사실 corpora)

Case_02_Comparison_Research
- Stage 1 v.8: Part 1~4 YAMLs with R1~R3 patches, F-1/F-2 fixes, 피고과식별방지 prompt
  (defendant_qualification), dated backups, 실행검사/실패분석 reports
- Stage 2 S2_00: v7.4 handoff (Task_S2_00_handoff, 경량화 전략서 + §2 개정) and
  v7.5 defendant qualification gate (피고관련작업_개정_S2_00.md), copies v.7/v.10/v.11,
  dated backups, 실행보고서/실패분석/결과물 리스트
- Stage 2 S2_10: v6/v7/v8 failure analyses, 재작성전략 10_06/10_08, case_kind_registry.json,
  연구조사보고서_S2_10_재작성용.md (v.1), _추가.md (multi-claim methodology) and
  merged _v.2.md (claims[] 1~4, join PRELIMINARY/SELECTIVE/INDEPENDENT, V1~V6),
  S2_10_Test run outputs, 실행검사 v.10/v.11
- Stage_2 MEMORY.md / CLAUDE.md / work-history notes, AGENTS.md and README_KO.md updates

Other corpora and tooling
- Default_Agent_청구취지기재방법: 청구취지 규칙문서 전체 모음(원문·사건종류별·raw) and tmp drafts
- 요건사실론: 사건종류별 문서(raw·filtered), plans, rf_draft
- 판례모음, STT_앱구성_연구, API Crowdness 조사, update_numbers.py

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 13:02:13 +09:00
co-authored by Claude Fable 5.1
parent 4d8c23863f
commit 5f9853e44b
5881 changed files with 6940615 additions and 1790 deletions
@@ -0,0 +1,33 @@
"""Read-only validation of document identity, source preservation and edit scope."""
import argparse,difflib,hashlib,json,re
from pathlib import Path
parser=argparse.ArgumentParser();parser.add_argument('batch',type=int,nargs='?');args=parser.parse_args()
rows=json.loads(Path('plans/section4_edit_137_manifest.json').read_text());results=[]
# Compact statute references such as 49조1호 are not court case numbers.
case_pattern=r'(?<!\d)(?:19|20)\d{2}(?!조)[가-힣]{1,4}\d+|(?<!\d)\d{2}(?!조)[가-힣]{1,4}\d+'
for r in rows:
if args.batch and r['batch']!=args.batch:continue
src=Path(r['source']);review=Path(r['review']);out=Path(r['output']);errors=[];warnings=[]
if hashlib.sha256(src.read_bytes()).hexdigest()!=r['source_sha256']:errors.append('SOURCE_CHANGED')
if hashlib.sha256(review.read_bytes()).hexdigest()!=r['review_sha256']:errors.append('REVIEW_CHANGED')
if not out.exists():results.append({'index':r['index'],'case':r['case'],'errors':errors+['OUTPUT_MISSING']});continue
s=src.read_text();t=out.read_text();v=review.read_text();section=v[v.index('## 4. 종합'):];section=re.split(r'\n## [^#]',section,maxsplit=1)[0]
if not t.strip():errors.append('EMPTY_OUTPUT')
h=re.search(r'^content_hash:\s*"(?:sha256:)?([a-f0-9]{64})"',t,re.M)
if h and h[1]!=hashlib.sha256(t.split('---',2)[2].lstrip('\n').encode()).hexdigest():errors.append('BODY_HASH_MISMATCH')
orig_h1=re.findall(r'^# .+$',s,re.M);out_h1=re.findall(r'^# .+$',t,re.M)
if orig_h1!=out_h1:errors.append('H1_CHANGED')
if s.count('```')!=t.count('```'):warnings.append('FENCE_COUNT_CHANGED')
a=s.splitlines();b=t.splitlines();ops=list(difflib.SequenceMatcher(None,a,b,autojunk=False).get_opcodes());changed=sum(max(j-i,l-k) for op,i,j,k,l in ops if op!='equal')
new_cases=sorted(set(re.findall(case_pattern,t))-set(re.findall(case_pattern,s+'\n'+section)))
if new_cases:warnings.append('NEW_CASES_NOT_IN_SECTION4:'+','.join(new_cases))
urls=lambda x:set(re.findall(r'https?://[^\s|)>]+',x))
if urls(t)-urls(s+'\n'+section):warnings.append('NEW_URLS_NOT_IN_SECTION4')
if changed/max(1,len(a))>.2:warnings.append('CHANGE_RATIO_OVER_20_PERCENT')
record=Path(f'plans/section4_edit_audit/{r["index"]:03d}.json')
if not record.exists():errors.append('AUDIT_RECORD_MISSING')
else:
try:json.loads(record.read_text())
except Exception:errors.append('AUDIT_RECORD_INVALID_JSON')
results.append({'index':r['index'],'case':r['case'],'errors':errors,'warnings':warnings,'changed_lines':changed,'source_lines':len(a),'output_sha256':hashlib.sha256(out.read_bytes()).hexdigest()})
print(json.dumps(results,ensure_ascii=False,indent=2))