tma1-peer · diff
git:20260622.f3727bc to git:20260828.e19040d
70 added, 68 removed. Audit A to A.
---
name: tma1-peer
- description: "Pull recent session content from peer coding agents (Codex, OpenClaw, Copilot CLI) that worked on the same project. Invoke when the user wants you to read another agent's review feedback, see what someone else tried, or act on cross-agent context. Trigger phrases: \"what did codex do\", \"what did openclaw do\", \"what did copilot do\", \"peer sessions\", \"cross-agent context\", \"/tma1-peer\"."
- argument-hint: "[agent] [count] [messages]"
- allowed-tools: ["mcp__tma1__get_peer_sessions"]
+ description: "List recent sessions on this project by agent — peer agents (Codex, OpenClaw, Copilot CLI) or your own past sessions. Invoke when the user wants you to read another agent's review feedback, see what someone else tried, act on cross-agent context, or recall your own earlier work here. Trigger phrases: \"what did codex do\", \"what did openclaw do\", \"what did copilot do\", \"peer sessions\", \"cross-agent context\", \"what did I do earlier\", \"我之前在这个项目做了什么\", \"/tma1-peer\"."
+ argument-hint: "[agent] [--full|--summary] [--limit N] [--since 2h]"
+ allowed-tools: ["mcp__tma1__get_peer_sessions", "mcp__tma1__get_session_transcript"]
---
# TMA1 Peer-Agent Lens
- You're being invoked because the user wants to see what a peer coding agent
- left on this project — typically because they used another agent to review
- or run something and now want you to act on that work without
- copy-pasting it manually.
+ Lists recent sessions on the current project, newest first. Default is
+ peer agents — the ones that aren't you — because the usual reason to
+ call this is "another agent reviewed something, act on it without me
+ copy-pasting between terminals". Naming yourself is also allowed.
## Syntax
```
- /tma1-peer # all peers, latest 1 session each, 10 messages
- /tma1-peer codex # codex, latest 1 session
- /tma1-peer codex 3 # codex, latest 3 sessions
- /tma1-peer codex 3 30 # codex, latest 3 sessions, 30 messages each
- /tma1-peer openclaw # openclaw, latest 1
- /tma1-peer copilot 2 # copilot_cli (alias), latest 2
- /tma1-peer all 2 # all peers, 2 each
+ /tma1-peer # all peers, latest session each
+ /tma1-peer codex # codex only
+ /tma1-peer codex --full # codex, with full conversation content
+ /tma1-peer self # your own recent sessions on this project
+ /tma1-peer codex --limit 3 # codex, latest 3 sessions
+ /tma1-peer --summary --limit 5 # all peers, headers only, 5 each
+ /tma1-peer codex --since 6h # widen the time window
```
- ## How to handle the invocation
+ Agent names: `codex`, `openclaw`, `copilot` (= `copilot_cli`), `claude`
+ (= `claude_code`), `self` (= you), `all` / omitted (= every peer but you).
+ Anything else: reply `unknown agent "<X>"; available: codex, openclaw, copilot, claude, self, all`
+ and STOP — do not call the tool with an unrecognised name.
- 1. **Parse the user's arguments** after `/tma1-peer`:
- - First token (optional): agent name.
- - **If the first token is a bare integer** (e.g. `/tma1-peer 3`), there's no
- agent token: it is the count, and the next integer (if any) is messages
- per session — use `agent_source: ""` (all peers). Do NOT reject it as an
- unknown agent. E.g. `/tma1-peer 3 30` → count 3, 30 messages.
- - Count (first integer, after the agent token when present): integer 1-5, default 1.
- - Messages per session (the integer after count): integer 1-100, default 10.
- 2. **Normalize the agent name**:
- - `codex` → `codex`
- - `openclaw` → `openclaw`
- - `copilot` or `copilot_cli` → `copilot_cli`
- - `all`, `*`, or empty → `""` (means all peers, excludes Claude Code)
- - a bare integer → treat as count (see step 1), `agent_source: ""`
- - **Anything else** → reply to the user: `unknown peer agent "<X>"; available: codex, openclaw, copilot, all` and STOP — do not call the tool with an unrecognized name.
- 3. **Call the MCP tool `mcp__tma1__get_peer_sessions`** with:
- - `agent_source`: parsed agent (or empty string)
- - `limit`: the parsed count. **When the user gave a count, you MUST pass it**
- — do not silently fall back to 1. Omit only when no count was supplied
- (server default 1, clamp to [1, 5]). E.g. `codex 3` → `{agent_source: "codex", limit: 3}`.
- - `message_limit`: the parsed third token if supplied (clamp to [1, 100]),
- otherwise `10`. E.g. `codex 3 30` → `{agent_source: "codex", limit: 3, message_limit: 30}`.
- 4. **Read the returned conversation messages** and use them as direct input
- for your next reasoning step. **Do not paraphrase** — when acting on
- peer feedback, quote the specific points the peer made so the user can
- verify you got it right.
+ ## Flags
- ## What the tool returns
+ | Flag | Maps to | Default |
+ | --- | --- | --- |
+ | `--summary` | `detail: "summary"` — header, tools, files; no messages | |
+ | (none) | `detail: "preview"` — 3 recent messages per session | default |
+ | `--full` | `detail: "full"` — 40 recent messages per session | |
+ | `--limit N` | `limit` — sessions per agent, 1-5 | 1 |
+ | `--since 2h` / `--since 90m` | `since_min` in minutes | 1440 (24h) |
- A JSON payload with two top-level fields worth knowing about:
+ Legacy positional form still works: `/tma1-peer codex 3 30` means agent
+ `codex`, `limit: 3`, `message_limit: 30`. A bare leading integer is the
+ limit, not an agent (`/tma1-peer 3` → all peers, `limit: 3`). Prefer the
+ flags above when writing new invocations.
- - **`sessions`** — array, each entry has:
- - `session_id`, `agent_source`, `started_at`, `last_activity_at`, `last_activity_ago`, `duration_minutes`
- - `tool_call_count`, `tokens_input`, `tokens_output`, `cwd`
- - `messages`: chronological list of user / assistant / thinking messages
- - `recent_tool_names`: top 5 tools the peer agent used
- - `files_touched`: distinct file paths the peer Read / Edited
- - **`most_recent_session`** — shortcut to the freshest peer's `agent_source` +
- `last_activity_at` + `last_activity_ago`. Use this for your first-line
- summary so the user instantly knows whether the peer work is current.
- - **`partial_failures`** — map of `agent → error_message`. Present **only**
- when one or more per-agent queries failed in the all-peers fan-out
- (`agent_source: ""`). **Read this before treating empty `sessions` as
- "no peer activity"** — a non-empty map means the result is incomplete;
- tell the user which peer(s) couldn't be reached rather than asserting
- silence.
+ ## Call the tool
- Empty `sessions` with **no** `partial_failures` means no peer activity
- found in the time window — tell the user "no recent <agent> sessions on
- this project" rather than fabricating context.
+ `mcp__tma1__get_peer_sessions` with the parsed `agent_source`, `detail`,
+ `limit`, `since_min`. Pass every value the user actually supplied — do
+ not silently fall back to the defaults.
+ ## Use the response
+
+ - `sessions[]` — `session_id`, `agent_source`, `last_activity_ago`,
+ `duration_minutes`, `tool_call_count`, `messages`, `recent_tool_names`,
+ `files_touched`, `cwd`. On a `self` lookup, `is_latest_for_cwd` marks
+ the session that is almost certainly the one you're in right now —
+ don't report your own current work back to the user as news.
+ - `most_recent_session` — freshest session's agent + age. Lead with it so
+ the user knows immediately whether the peer work is current.
+ - `partial_failures` — `agent → error`. Present only when the all-peers
+ fan-out had a failure. **Read it before calling empty results silence.**
+ - `note` — present only when `sessions` is empty and nothing failed.
+
+ Rules:
+
+ - **Quote what the peer actually said.** Do not paraphrase. Reading the
+ peer's exact words is the point of this command.
+ - Messages are capped per `detail`; a cut message carries `truncated: true`.
+ Need the rest? `mcp__tma1__get_session_transcript` with that `session_id`.
+ - Empty `sessions`, no `partial_failures` → say `no recent <agent> sessions
+ on this project in the window` and stop. Don't fabricate.
+ - Empty `sessions` with `partial_failures` → name the peers that failed and
+ quote the error instead of asserting silence.
+
+ ## Related
+
+ - Looking for a session by keyword rather than by agent? Use `/tma1-search`.
+ - Already have a `session_id`? Go straight to `get_session_transcript`.
+
## Examples
- User: `/tma1-peer codex`
- You: (call tool with `agent_source: "codex", limit: 1, message_limit: 10`)
+ User: `/tma1-peer codex --full`
+ You: (call with `agent_source: "codex", detail: "full", limit: 1`)
You: "Codex reviewed `auth.go` 12 min ago and left three concrete issues:
1. ... 2. ... 3. ... Want me to address all three or pick one?"
- User: `/tma1-peer`
- You: (call tool with `agent_source: "", limit: 1`)
- You: "Two peers active recently — Codex (5 min ago, reviewing auth.go) and
- Copilot CLI (20 min ago, deployed staging). Which do you want me
- to dig into?"
+ User: `/tma1-peer self --limit 3`
+ You: (call with `agent_source: "self", limit: 3`)
+ You: "Three of your sessions here today. The current one aside, the 14:20
+ session landed the retry fix and the 11:05 one was the failed
+ migration attempt."