molecule-core/workspace/tests
Hongming Wang 4299475746 feat(prompt): Platform Capabilities preamble at top of system prompt
Closes #2332 item 1 (workspace awareness — agents don't surface
platform-native tools up front).

The dogfooding session surfaced that agents weren't using A2A
delegation, persistent memory, or send_message_to_user. The tools
were registered AND documented in the system prompt — but only in
sections #8 (Inter-Agent Communication) and #9 (Hierarchical Memory),
which agents read AFTER they've already started reasoning about a
plan from earlier sections.

This adds a tight inventory at section #1.5 (immediately after
Platform Instructions, before role-specific prompt files) — every
tool name + its short description in a bulleted block. Detailed
when_to_use docs in sections #8/#9 stay; this preamble is the
elevator pitch ("you have these"), the later sections are the
manual ("here's when and how").

Generated from `platform_tools.registry` ToolSpecs — every tool's
`name` + `short` flow through automatically, no manual sync. A new
`get_capabilities_preamble(mcp: bool)` helper in executor_helpers
mirrors the existing get_a2a_instructions / get_hma_instructions
pattern.

CLI-runtime agents (mcp=False) get an empty preamble — they see
_A2A_INSTRUCTIONS_CLI's hand-written subcommand vocabulary further
down, and the registry's MCP tool names would conflict.

Tests:
  - test_capabilities_preamble_appears_in_mcp_prompt: header present
  - test_capabilities_preamble_lists_every_registry_tool: every
    a2a + memory tool from registry shows up (drift catches at test
    time — adding a new tool to registry surfaces here automatically)
  - test_capabilities_preamble_precedes_prompt_files: ordering
    invariant (toolkit before role docs)
  - test_capabilities_preamble_skipped_for_cli_runtime: empty when
    mcp=False

All 40 prompt + platform_tools tests pass.
2026-04-29 21:31:13 -07:00
..
adapters
snapshots
__init__.py
conftest.py
test_a2a_cli.py
test_a2a_client.py
test_a2a_executor.py
test_a2a_mcp_server.py
test_a2a_tools_impl.py
test_a2a_tools_module.py
test_agent_card_well_known_path.py
test_agent.py
test_agents_md.py
test_approval.py
test_audit_ledger.py
test_audit.py
test_awareness_client_full.py
test_compliance.py
test_config.py
test_consolidation.py
test_coordinator_parent.py
test_coordinator_routing.py
test_delegation.py
test_events.py
test_executor_helpers.py
test_gh_wrapper.sh
test_governance.py
test_heartbeat_runtime_metadata.py
test_heartbeat.py
test_hitl.py
test_internal_chat_uploads.py
test_internal_file_read.py feat(chat_files): rewrite Download as HTTP-forward (RFC #2312, PR-D) 2026-04-29 15:19:02 -07:00
test_jsonrpc_wire_role_format.py
test_main_initial_prompt.py
test_mcp_memory.py
test_memory.py
test_molecule_ai_status.py
test_namespaces.py
test_openclaw_adapter.py
test_platform_auth.py
test_platform_inbound_auth.py
test_platform_tools.py
test_plugins_builtins.py
test_plugins_registry.py
test_plugins.py
test_pre_stop.py
test_preflight.py
test_prompt.py feat(prompt): Platform Capabilities preamble at top of system prompt 2026-04-29 21:31:13 -07:00
test_routing_policy.py
test_runtime_capabilities.py
test_runtime_wedge.py
test_safe_env.py
test_sandbox.py
test_secret_redact.py
test_security_scan.py
test_shared_runtime_peer_summary.py
test_skills_loader.py
test_skills_watcher.py
test_snapshot_scrub.py
test_telemetry.py
test_temporal_workflow.py
test_transcript_auth.py
test_watcher.py