From 6f410661a18fefb6768fe37f5f6ffc599204eb10 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 09:19:25 +0000 Subject: code-modernization: choose rule-extraction depth and approve a number of agents Add --depth standard|thorough. Standard, the default, keeps the previous extraction wording; Thorough writes one rule per decision and costs more. Every run shows the estimate for both and never starts more agents than were approved. Spread batches over the system and size them by the densest shards seen, so dense code that comes late is not extracted and left unrefereed. Keep same-named rules whose citations a referee swaps or moves. Merge follow-up runs with a script that never drops a confirmed rule because a re-run failed. --- plugins/code-modernization/scripts/render_rules.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'plugins/code-modernization/scripts/render_rules.py') diff --git a/plugins/code-modernization/scripts/render_rules.py b/plugins/code-modernization/scripts/render_rules.py index 6f04e0c1..d04e1d6f 100644 --- a/plugins/code-modernization/scripts/render_rules.py +++ b/plugins/code-modernization/scripts/render_rules.py @@ -116,7 +116,9 @@ def main(argv): f"At extraction: {len(rules)} confirmed rules ({sum(1 for r in rules if r.get('priority') == 'P0')} P0); " f"later steps may add or correct rules below. " f"Each citation was checked by a second agent that read the cited lines; " - f"{len(result.get('rejectedRules') or [])} candidate rules were refuted and left out.", '', + f"{len(result.get('rejectedRules') or [])} candidate rules were refuted and left out." + + (f" Extraction depth: {one_line(stats['depth'], 40)}; {stats.get('agents')} agents." if stats.get('depth') else '') + + (f" Estimated before the run: {one_line(stats['estimate'], 400)}." if stats.get('estimate') else ''), '', '| ID | Name | Category | Priority | Source | Confidence |', '|---|---|---|---|---|---|'] for n, r in numbered: doc.append(f"| RULE-{n:03d} | {one_line(r.get('name'), 80)} | {one_line(r.get('category'), 20)} | " @@ -156,17 +158,17 @@ def main(argv): doc.append(f'- … and {len(folded) - 100} more') doc.append('') - gaps = [('never attempted (token budget or agent cap)', stats.get('skippedModules')), + gaps = [('never attempted (token budget or agent limit)', stats.get('skippedModules')), ('extractor returned nothing', stats.get('failedModules')), ('malformed entries, fix by hand', stats.get('droppedModules')), ('phases cut short', stats.get('skippedPhases')), ('candidate rules no referee judged (not in the catalog)', [f"{one_line(u.get('name'), 80)} ({one_line(u.get('source'), 80)})" for u in (result.get('unverifiedRules') or [])])] gaps = [(label, items) for label, items in gaps if items] - if gaps: + if gaps or result.get('rerunModules'): doc += ['## Coverage gaps', '', 'These parts were NOT fully mined:', ''] for label, items in gaps: - doc.append(f"- **{len(items)} {label}:** " + ', '.join(one_line(i, 100) for i in items[:30]) + (' …' if len(items) > 30 else '')) + doc.append(f"- **{len(items)} {label}:** " + ', '.join(one_line(i, 250) for i in items[:30]) + (' …' if len(items) > 30 else '')) if result.get('rerunModules'): doc.append(f"\nA follow-up run for the {len(result['rerunModules'])} affected shard(s) covers them.") doc.append('') -- cgit