MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _build_role_bootstrap_summary

Function _build_role_bootstrap_summary

agents/coldstart-agent/main.py:297–317  ·  view source on GitHub ↗

Build a reusable bootstrap summary for future cold starts.

(
    profile: Dict[str, Any],
    *,
    explicit_text: Optional[str] = None,
    seed_directions: Optional[List[Dict[str, Any]]] = None,
)

Source from the content-addressed store, hash-verified

295 )
296 return result
297
298
299def _build_role_bootstrap_summary(
300 profile: Dict[str, Any],
301 *,
302 explicit_text: Optional[str] = None,
303 seed_directions: Optional[List[Dict[str, Any]]] = None,
304) -> str:
305 """Build a reusable bootstrap summary for future cold starts."""
306 cleaned_explicit = re.sub(r"\s+", " ", str(explicit_text or "")).strip()
307 if cleaned_explicit and cleaned_explicit.lower() not in COLD_START_COMMAND_HINTS:
308 return cleaned_explicit
309
310 directions = seed_directions or _build_seed_directions(profile)
311 try:
312 direction_lexicon = importlib.import_module("config.direction_lexicon")
313 phrases = [str(entry.get("canonical_name") or "").strip() for entry in directions if entry.get("canonical_name")]
314 return direction_lexicon.build_bootstrap_summary(phrases, prefer_chinese=False, limit=6)
315 except Exception:
316 phrases = [str(entry.get("bootstrap_phrase") or "").strip() for entry in directions if entry.get("bootstrap_phrase")]
317 if not phrases:
318 return ""
319 return f"direction: {', '.join(phrases[:6])}"
320

Callers 1

Calls 2

_build_seed_directionsFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected