Generate 5-draft ecosystem family, fix formatter markdown stripping

Pipeline output:
- ABVP: Agent Behavior Verification Protocol (quality 3.0/5)
- AEM: Privacy-Preserving Agent Learning Protocol (quality 2.1/5)
- ATD: Agent Task DAG Framework (quality 2.5/5)
- HITL: Human-in-the-Loop Primitives (quality 2.4/5)
- AEPB: Real-Time Agent Rollback Protocol (quality 2.5/5)
- APAE: Agent Provenance Assurance Ecosystem (quality 2.5/5)

Quality gates: all pass novelty + references, format gate improved
with markdown stripping (_strip_markdown) and dynamic header padding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 01:42:30 +01:00
parent 7a1aa346b9
commit 404092b938
9 changed files with 5122 additions and 4 deletions

View File

@@ -2,10 +2,31 @@
from __future__ import annotations
import re
import textwrap
from datetime import datetime, timezone, timedelta
def _strip_markdown(text: str) -> str:
"""Remove markdown formatting that Claude may leak into output."""
# Bold/italic
text = re.sub(r'\*\*\*(.+?)\*\*\*', r'\1', text)
text = re.sub(r'\*\*(.+?)\*\*', r'\1', text)
text = re.sub(r'\*(.+?)\*', r'\1', text)
text = re.sub(r'___(.+?)___', r'\1', text)
text = re.sub(r'__(.+?)__', r'\1', text)
text = re.sub(r'_(.+?)_', r'\1', text)
# Markdown headers → plain text
text = re.sub(r'^#{1,6}\s+', '', text, flags=re.MULTILINE)
# Code fences
text = re.sub(r'```\w*\n?', '', text)
# Inline code
text = re.sub(r'`([^`]+)`', r'\1', text)
# Markdown links [text](url) → text
text = re.sub(r'\[([^\]]+)\]\([^)]+\)', r'\1', text)
return text
class DraftFormatter:
@staticmethod
def format_draft(outline: dict, sections: list[str], family_name: str = "") -> str:
@@ -18,7 +39,7 @@ class DraftFormatter:
parts.append("")
parts.append("Abstract")
parts.append("")
parts.append(DraftFormatter._wrap_text(outline.get("abstract", "")))
parts.append(DraftFormatter._wrap_text(_strip_markdown(outline.get("abstract", ""))))
parts.append("")
parts.append(DraftFormatter._status_memo(outline))
parts.append("")
@@ -48,7 +69,7 @@ class DraftFormatter:
stitle = section_info.get("title", f"Section {i}")
parts.append(f"{i}. {stitle}")
parts.append("")
parts.append(DraftFormatter._wrap_text(section_text))
parts.append(DraftFormatter._wrap_text(_strip_markdown(section_text)))
parts.append("")
# References section
@@ -87,8 +108,13 @@ class DraftFormatter:
title = outline["title"]
lines = []
lines.append(f"Internet-Draft{' ' * 45}{wg}")
lines.append(f"Intended status: {status:<44s}{date_str}")
# Right-align WG/date to col 72
id_label = "Internet-Draft"
pad = max(1, 72 - len(id_label) - len(wg))
lines.append(f"{id_label}{' ' * pad}{wg}")
is_label = f"Intended status: {status}"
pad2 = max(1, 72 - len(is_label) - len(date_str))
lines.append(f"{is_label}{' ' * pad2}{date_str}")
lines.append(f"Expires: {exp_str}")
lines.append("")
lines.append("")