Skip to content

feat(prompt): Platform Capabilities preamble at top of system prompt (#2332 item 1) - #2340

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
auto/issue-2332-capabilities-preamble
Apr 30, 2026
Merged

HongmingWang-Rabbit merged 1 commit into
stagingfrom
auto/issue-2332-capabilities-preamble

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Closes #2332 item 1.

Why

Dogfooding session finding: agents don't use `delegate_task`, `commit_memory`, `send_message_to_user`, etc. The tools ARE in the system prompt — but only in sections 8 (Inter-Agent Communication) and 9 (Hierarchical Memory). By the time agents read those, they've already committed to a plan based on earlier sections.

What

Tight inventory at section 1.5 (immediately after Platform Instructions, before role-specific prompt files) — every tool's `name` + `short` description in one bulleted block. Detailed `when_to_use` docs in sections 8/9 stay; this is the elevator pitch.

```

Platform Capabilities

You have native access to these platform tools. Use them proactively...

Inter-agent collaboration (A2A):

  • `delegate_task` — Delegate a task to a peer workspace via A2A and WAIT...
  • `delegate_task_async` — Send a task to a peer and return immediately...
  • `check_task_status` — Poll the status of a task started with...
  • `list_peers` — Discover available peer workspaces.
  • `get_workspace_info` — Get your own workspace details.
  • `send_message_to_user` — Surface a message to the user.

Persistent memory (HMA):

  • `commit_memory` — Save context for future sessions and teammates.
  • `recall_memory` — Recall previously-committed memory.
    ```

How

  • New `get_capabilities_preamble(mcp: bool)` in `executor_helpers.py` — mirrors the existing `get_a2a_instructions` / `get_hma_instructions` pattern
  • Generated from `platform_tools.registry` — adding/renaming a tool in registry.py auto-flows through here
  • CLI-runtime agents (`mcp=False`) get empty string — they have their own hand-written `_A2A_INSTRUCTIONS_CLI` block; mixing MCP tool names there would create a two-vocabulary problem

Tests

4 new cases in `test_prompt.py` (40/40 prompt + platform_tools tests pass):

  • `test_capabilities_preamble_appears_in_mcp_prompt` — header present
  • `test_capabilities_preamble_lists_every_registry_tool` — every `a2a_tools()` + `memory_tools()` entry shows up. Drift catches automatically when registry changes.
  • `test_capabilities_preamble_precedes_prompt_files` — ordering invariant
  • `test_capabilities_preamble_skipped_for_cli_runtime` — empty for `mcp=False`

What this does NOT change

Closes

#2332 item 1 — leave issue open for items 2 + 3.

🤖 Generated with Claude Code

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.
@HongmingWang-Rabbit
HongmingWang-Rabbit added this pull request to the merge queue Apr 30, 2026
Merged via the queue into staging with commit 21ed74c Apr 30, 2026
19 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the auto/issue-2332-capabilities-preamble branch April 30, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspace awareness: agents don't surface platform capabilities up front; CLI-runtime adapters can't message the user

1 participant