MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _compose_with_plan

Method _compose_with_plan

src/server/agent_server.py:624–639  ·  view source on GitHub ↗

Append the active /plan as a system-prompt section so the agent follows it. No plan → returns base unchanged (regression-safe).

(self, base: Any)

Source from the content-addressed store, hash-verified

622 self._reply(request_id, {"ok": False, "error": str(exc)})
623
624 def _compose_with_plan(self, base: Any) -> Any:
625 """Append the active /plan as a system-prompt section so the agent follows
626 it. No plan → returns base unchanged (regression-safe)."""
627 try:
628 from src.plan import get_plan
629
630 plan = get_plan(self.cwd)
631 if plan and isinstance(base, list):
632 base = base + [{"type": "text", "text": f"# Current Plan\nFollow this plan set by the user:\n\n{plan}"}]
633 except Exception: # noqa: BLE001
634 logger.debug("[agent-server] plan compose failed", exc_info=True)
635 # Response language (the original's LanguagePicker, §6).
636 lang = getattr(self, "_language", None)
637 if lang and isinstance(base, list):
638 base = base + [{"type": "text", "text": f"# Response Language\nRespond in {lang} unless the user writes in another language."}]
639 return base
640
641 def _do_set_mcp_enabled(self, request_id: object, server: object, enabled: object) -> None:
642 """Enable/disable an MCP server's tools (MCPServerMultiselectDialog). The

Callers 5

_do_set_languageMethod · 0.95
_do_planMethod · 0.95
_do_set_output_styleMethod · 0.95
_build_runtimeFunction · 0.80

Calls 1

get_planFunction · 0.90