@zhixuan92/multi-model-agent 4.9.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/mmagent.mjs +47 -0
- package/package.json +19 -57
- package/postinstall.mjs +8 -0
- package/LICENSE +0 -21
- package/README.md +0 -306
- package/dist/cli/index.d.ts +0 -62
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -345
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/info.d.ts +0 -22
- package/dist/cli/info.d.ts.map +0 -1
- package/dist/cli/info.js +0 -100
- package/dist/cli/info.js.map +0 -1
- package/dist/cli/logs.d.ts +0 -15
- package/dist/cli/logs.d.ts.map +0 -1
- package/dist/cli/logs.js +0 -102
- package/dist/cli/logs.js.map +0 -1
- package/dist/cli/print-token.d.ts +0 -18
- package/dist/cli/print-token.d.ts.map +0 -1
- package/dist/cli/print-token.js +0 -60
- package/dist/cli/print-token.js.map +0 -1
- package/dist/cli/serve.d.ts +0 -28
- package/dist/cli/serve.d.ts.map +0 -1
- package/dist/cli/serve.js +0 -405
- package/dist/cli/serve.js.map +0 -1
- package/dist/cli/status.d.ts +0 -49
- package/dist/cli/status.d.ts.map +0 -1
- package/dist/cli/status.js +0 -155
- package/dist/cli/status.js.map +0 -1
- package/dist/cli/sync-skills.d.ts +0 -58
- package/dist/cli/sync-skills.d.ts.map +0 -1
- package/dist/cli/sync-skills.js +0 -266
- package/dist/cli/sync-skills.js.map +0 -1
- package/dist/cli/telemetry.d.ts +0 -10
- package/dist/cli/telemetry.d.ts.map +0 -1
- package/dist/cli/telemetry.js +0 -161
- package/dist/cli/telemetry.js.map +0 -1
- package/dist/cli/toggle.d.ts +0 -26
- package/dist/cli/toggle.d.ts.map +0 -1
- package/dist/cli/toggle.js +0 -185
- package/dist/cli/toggle.js.map +0 -1
- package/dist/http/async-dispatch.d.ts +0 -44
- package/dist/http/async-dispatch.d.ts.map +0 -1
- package/dist/http/async-dispatch.js +0 -175
- package/dist/http/async-dispatch.js.map +0 -1
- package/dist/http/auth.d.ts +0 -20
- package/dist/http/auth.d.ts.map +0 -1
- package/dist/http/auth.js +0 -56
- package/dist/http/auth.js.map +0 -1
- package/dist/http/canonicalize-file-paths.d.ts +0 -8
- package/dist/http/canonicalize-file-paths.d.ts.map +0 -1
- package/dist/http/canonicalize-file-paths.js +0 -43
- package/dist/http/canonicalize-file-paths.js.map +0 -1
- package/dist/http/cwd-validator.d.ts +0 -11
- package/dist/http/cwd-validator.d.ts.map +0 -1
- package/dist/http/cwd-validator.js +0 -130
- package/dist/http/cwd-validator.js.map +0 -1
- package/dist/http/errors.d.ts +0 -4
- package/dist/http/errors.d.ts.map +0 -1
- package/dist/http/errors.js +0 -9
- package/dist/http/errors.js.map +0 -1
- package/dist/http/execution-context.d.ts +0 -18
- package/dist/http/execution-context.d.ts.map +0 -1
- package/dist/http/execution-context.js +0 -61
- package/dist/http/execution-context.js.map +0 -1
- package/dist/http/handler-deps.d.ts +0 -19
- package/dist/http/handler-deps.d.ts.map +0 -1
- package/dist/http/handler-deps.js +0 -2
- package/dist/http/handler-deps.js.map +0 -1
- package/dist/http/handlers/control/batch-slice.d.ts +0 -4
- package/dist/http/handlers/control/batch-slice.d.ts.map +0 -1
- package/dist/http/handlers/control/batch-slice.js +0 -40
- package/dist/http/handlers/control/batch-slice.js.map +0 -1
- package/dist/http/handlers/control/batch.d.ts +0 -23
- package/dist/http/handlers/control/batch.d.ts.map +0 -1
- package/dist/http/handlers/control/batch.js +0 -332
- package/dist/http/handlers/control/batch.js.map +0 -1
- package/dist/http/handlers/control/context-blocks.d.ts +0 -22
- package/dist/http/handlers/control/context-blocks.d.ts.map +0 -1
- package/dist/http/handlers/control/context-blocks.js +0 -111
- package/dist/http/handlers/control/context-blocks.js.map +0 -1
- package/dist/http/handlers/introspection/health.d.ts +0 -20
- package/dist/http/handlers/introspection/health.d.ts.map +0 -1
- package/dist/http/handlers/introspection/health.js +0 -18
- package/dist/http/handlers/introspection/health.js.map +0 -1
- package/dist/http/handlers/introspection/status.d.ts +0 -26
- package/dist/http/handlers/introspection/status.d.ts.map +0 -1
- package/dist/http/handlers/introspection/status.js +0 -136
- package/dist/http/handlers/introspection/status.js.map +0 -1
- package/dist/http/handlers/tools/audit.d.ts +0 -4
- package/dist/http/handlers/tools/audit.d.ts.map +0 -1
- package/dist/http/handlers/tools/audit.js +0 -43
- package/dist/http/handlers/tools/audit.js.map +0 -1
- package/dist/http/handlers/tools/debug.d.ts +0 -4
- package/dist/http/handlers/tools/debug.d.ts.map +0 -1
- package/dist/http/handlers/tools/debug.js +0 -43
- package/dist/http/handlers/tools/debug.js.map +0 -1
- package/dist/http/handlers/tools/delegate.d.ts +0 -4
- package/dist/http/handlers/tools/delegate.d.ts.map +0 -1
- package/dist/http/handlers/tools/delegate.js +0 -43
- package/dist/http/handlers/tools/delegate.js.map +0 -1
- package/dist/http/handlers/tools/execute-plan.d.ts +0 -4
- package/dist/http/handlers/tools/execute-plan.d.ts.map +0 -1
- package/dist/http/handlers/tools/execute-plan.js +0 -45
- package/dist/http/handlers/tools/execute-plan.js.map +0 -1
- package/dist/http/handlers/tools/investigate.d.ts +0 -4
- package/dist/http/handlers/tools/investigate.d.ts.map +0 -1
- package/dist/http/handlers/tools/investigate.js +0 -64
- package/dist/http/handlers/tools/investigate.js.map +0 -1
- package/dist/http/handlers/tools/journal-recall.d.ts +0 -4
- package/dist/http/handlers/tools/journal-recall.d.ts.map +0 -1
- package/dist/http/handlers/tools/journal-recall.js +0 -40
- package/dist/http/handlers/tools/journal-recall.js.map +0 -1
- package/dist/http/handlers/tools/journal-record.d.ts +0 -4
- package/dist/http/handlers/tools/journal-record.d.ts.map +0 -1
- package/dist/http/handlers/tools/journal-record.js +0 -35
- package/dist/http/handlers/tools/journal-record.js.map +0 -1
- package/dist/http/handlers/tools/research.d.ts +0 -4
- package/dist/http/handlers/tools/research.d.ts.map +0 -1
- package/dist/http/handlers/tools/research.js +0 -64
- package/dist/http/handlers/tools/research.js.map +0 -1
- package/dist/http/handlers/tools/retry.d.ts +0 -4
- package/dist/http/handlers/tools/retry.d.ts.map +0 -1
- package/dist/http/handlers/tools/retry.js +0 -73
- package/dist/http/handlers/tools/retry.js.map +0 -1
- package/dist/http/handlers/tools/review.d.ts +0 -4
- package/dist/http/handlers/tools/review.d.ts.map +0 -1
- package/dist/http/handlers/tools/review.js +0 -43
- package/dist/http/handlers/tools/review.js.map +0 -1
- package/dist/http/middleware/body-reader.d.ts +0 -16
- package/dist/http/middleware/body-reader.d.ts.map +0 -1
- package/dist/http/middleware/body-reader.js +0 -44
- package/dist/http/middleware/body-reader.js.map +0 -1
- package/dist/http/middleware/caller-identity.d.ts +0 -16
- package/dist/http/middleware/caller-identity.d.ts.map +0 -1
- package/dist/http/middleware/caller-identity.js +0 -16
- package/dist/http/middleware/caller-identity.js.map +0 -1
- package/dist/http/middleware/decompress.d.ts +0 -14
- package/dist/http/middleware/decompress.d.ts.map +0 -1
- package/dist/http/middleware/decompress.js +0 -51
- package/dist/http/middleware/decompress.js.map +0 -1
- package/dist/http/project-registry.d.ts +0 -54
- package/dist/http/project-registry.d.ts.map +0 -1
- package/dist/http/project-registry.js +0 -130
- package/dist/http/project-registry.js.map +0 -1
- package/dist/http/request-observability.d.ts +0 -8
- package/dist/http/request-observability.d.ts.map +0 -1
- package/dist/http/request-observability.js +0 -20
- package/dist/http/request-observability.js.map +0 -1
- package/dist/http/request-pipeline.d.ts +0 -16
- package/dist/http/request-pipeline.d.ts.map +0 -1
- package/dist/http/request-pipeline.js +0 -144
- package/dist/http/request-pipeline.js.map +0 -1
- package/dist/http/server.d.ts +0 -17
- package/dist/http/server.d.ts.map +0 -1
- package/dist/http/server.js +0 -300
- package/dist/http/server.js.map +0 -1
- package/dist/http/types.d.ts +0 -20
- package/dist/http/types.d.ts.map +0 -1
- package/dist/http/types.js +0 -2
- package/dist/http/types.js.map +0 -1
- package/dist/skill-install/disabled-state.d.ts +0 -35
- package/dist/skill-install/disabled-state.d.ts.map +0 -1
- package/dist/skill-install/disabled-state.js +0 -96
- package/dist/skill-install/disabled-state.js.map +0 -1
- package/dist/skill-install/discover.d.ts +0 -29
- package/dist/skill-install/discover.d.ts.map +0 -1
- package/dist/skill-install/discover.js +0 -104
- package/dist/skill-install/discover.js.map +0 -1
- package/dist/skill-install/include-utils.d.ts +0 -27
- package/dist/skill-install/include-utils.d.ts.map +0 -1
- package/dist/skill-install/include-utils.js +0 -90
- package/dist/skill-install/include-utils.js.map +0 -1
- package/dist/skill-install/manifest.d.ts +0 -82
- package/dist/skill-install/manifest.d.ts.map +0 -1
- package/dist/skill-install/manifest.js +0 -215
- package/dist/skill-install/manifest.js.map +0 -1
- package/dist/skill-install/skill-installer-common.d.ts +0 -26
- package/dist/skill-install/skill-installer-common.d.ts.map +0 -1
- package/dist/skill-install/skill-installer-common.js +0 -139
- package/dist/skill-install/skill-installer-common.js.map +0 -1
- package/dist/skill-install/skill-installers/claude-code.d.ts +0 -43
- package/dist/skill-install/skill-installers/claude-code.d.ts.map +0 -1
- package/dist/skill-install/skill-installers/claude-code.js +0 -65
- package/dist/skill-install/skill-installers/claude-code.js.map +0 -1
- package/dist/skill-install/skill-installers/codex-cli.d.ts +0 -27
- package/dist/skill-install/skill-installers/codex-cli.d.ts.map +0 -1
- package/dist/skill-install/skill-installers/codex-cli.js +0 -84
- package/dist/skill-install/skill-installers/codex-cli.js.map +0 -1
- package/dist/skill-install/skill-installers/cursor.d.ts +0 -72
- package/dist/skill-install/skill-installers/cursor.d.ts.map +0 -1
- package/dist/skill-install/skill-installers/cursor.js +0 -81
- package/dist/skill-install/skill-installers/cursor.js.map +0 -1
- package/dist/skill-install/skill-installers/gemini-cli.d.ts +0 -50
- package/dist/skill-install/skill-installers/gemini-cli.d.ts.map +0 -1
- package/dist/skill-install/skill-installers/gemini-cli.js +0 -72
- package/dist/skill-install/skill-installers/gemini-cli.js.map +0 -1
- package/dist/skill-install/skill-manifest-sync.d.ts +0 -11
- package/dist/skill-install/skill-manifest-sync.d.ts.map +0 -1
- package/dist/skill-install/skill-manifest-sync.js +0 -65
- package/dist/skill-install/skill-manifest-sync.js.map +0 -1
- package/dist/skills/_shared/auth.md +0 -41
- package/dist/skills/_shared/error-handling.md +0 -31
- package/dist/skills/_shared/polling.md +0 -88
- package/dist/skills/_shared/response-shape.md +0 -55
- package/dist/skills/_shared/review-policy.md +0 -15
- package/dist/skills/mma-audit/SKILL.md +0 -270
- package/dist/skills/mma-context-blocks/SKILL.md +0 -148
- package/dist/skills/mma-debug/SKILL.md +0 -208
- package/dist/skills/mma-delegate/SKILL.md +0 -216
- package/dist/skills/mma-execute-plan/SKILL.md +0 -214
- package/dist/skills/mma-explore/SKILL.md +0 -190
- package/dist/skills/mma-investigate/SKILL.md +0 -258
- package/dist/skills/mma-journal-recall/SKILL.md +0 -242
- package/dist/skills/mma-journal-record/SKILL.md +0 -189
- package/dist/skills/mma-research/SKILL.md +0 -223
- package/dist/skills/mma-retry/SKILL.md +0 -221
- package/dist/skills/mma-review/SKILL.md +0 -209
- package/dist/skills/multi-model-agent/SKILL.md +0 -206
- package/dist/telemetry/consent.d.ts +0 -4
- package/dist/telemetry/consent.d.ts.map +0 -1
- package/dist/telemetry/consent.js +0 -40
- package/dist/telemetry/consent.js.map +0 -1
- package/dist/telemetry/flusher.d.ts +0 -19
- package/dist/telemetry/flusher.d.ts.map +0 -1
- package/dist/telemetry/flusher.js +0 -277
- package/dist/telemetry/flusher.js.map +0 -1
- package/dist/telemetry/generation.d.ts +0 -9
- package/dist/telemetry/generation.d.ts.map +0 -1
- package/dist/telemetry/generation.js +0 -33
- package/dist/telemetry/generation.js.map +0 -1
- package/dist/telemetry/identity.d.ts +0 -9
- package/dist/telemetry/identity.d.ts.map +0 -1
- package/dist/telemetry/identity.js +0 -35
- package/dist/telemetry/identity.js.map +0 -1
- package/dist/telemetry/install-id.d.ts +0 -13
- package/dist/telemetry/install-id.d.ts.map +0 -1
- package/dist/telemetry/install-id.js +0 -49
- package/dist/telemetry/install-id.js.map +0 -1
- package/dist/telemetry/install-meta.d.ts +0 -10
- package/dist/telemetry/install-meta.d.ts.map +0 -1
- package/dist/telemetry/install-meta.js +0 -15
- package/dist/telemetry/install-meta.js.map +0 -1
- package/dist/telemetry/queue.d.ts +0 -35
- package/dist/telemetry/queue.d.ts.map +0 -1
- package/dist/telemetry/queue.js +0 -287
- package/dist/telemetry/queue.js.map +0 -1
- package/dist/telemetry/recorder.d.ts +0 -39
- package/dist/telemetry/recorder.d.ts.map +0 -1
- package/dist/telemetry/recorder.js +0 -173
- package/dist/telemetry/recorder.js.map +0 -1
- package/scripts/postinstall.js +0 -36
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mma-journal-record
|
|
3
|
-
description: >-
|
|
4
|
-
Use when you've abandoned an approach, hit a constraint, or concluded
|
|
5
|
-
something worth remembering — record it to the persistent journal as a
|
|
6
|
-
fire-and-forget decision audit trail for future sessions.
|
|
7
|
-
when_to_use: >-
|
|
8
|
-
You've completed analysis and want to log the outcome — abandoned an approach,
|
|
9
|
-
hit a blocking constraint, or reached a conclusion worth remembering. NOT for
|
|
10
|
-
recall/investigate/delegate; those are read routes. Journal stores conclusions
|
|
11
|
-
for cross-session reference.
|
|
12
|
-
version: 4.9.0
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# mma-journal-record
|
|
16
|
-
|
|
17
|
-
## Overview
|
|
18
|
-
|
|
19
|
-
Record a learning, constraint, or decision outcome to the persistent journal via a fire-and-forget mmagent worker. The worker stores the entry and returns immediately; you continue on your main context.
|
|
20
|
-
|
|
21
|
-
**Core principle:** Journal is an audit trail of what you've decided, discovered, or abandoned. Record it once per session; don't re-investigate.
|
|
22
|
-
|
|
23
|
-
## When to Use
|
|
24
|
-
|
|
25
|
-
**Use when:**
|
|
26
|
-
- You've abandoned an approach and want to log why
|
|
27
|
-
- You've hit a blocking constraint worth remembering
|
|
28
|
-
- You've reached a conclusion (e.g., "Pattern X doesn't work in this codebase")
|
|
29
|
-
- You've decided not to pursue a direction and want to avoid repeating that decision next session
|
|
30
|
-
|
|
31
|
-
**Don't use when:**
|
|
32
|
-
- You're asking a question → `mma-investigate`
|
|
33
|
-
- You're dispatching work → `mma-delegate`
|
|
34
|
-
- You want to retrieve past entries → journal is append-only, not searchable; use `git log` or `.mmagent/journal/` files directly
|
|
35
|
-
- You're mid-task and want to pause → that's what `blockedBy` is for; journal is for conclusions, not temporary blockers
|
|
36
|
-
|
|
37
|
-
## Endpoint
|
|
38
|
-
|
|
39
|
-
`POST /journal-record?cwd=<abs-path>`
|
|
40
|
-
|
|
41
|
-
@include _shared/auth.md
|
|
42
|
-
|
|
43
|
-
## Request body
|
|
44
|
-
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"learning": "Tried worker self-report for grouped-dispatch cancellation; dropped it — git diff is the source of truth. Lesson: use getRealFilesChanged.",
|
|
48
|
-
"tagHints": ["dispatch", "cancellation"]
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
| Field | Type | Required | Notes |
|
|
53
|
-
|---|---|---|---|
|
|
54
|
-
| `learning` | string | yes | Natural-language entry: what you decided, why, or what you learned. Keep it concrete. |
|
|
55
|
-
| `tagHints` | string[] | no | Optional tags for later cross-reference (e.g. `["perf", "refactor"]`). Tags are advisory; the journal system may group or index them. |
|
|
56
|
-
|
|
57
|
-
**What gets stored & where:**
|
|
58
|
-
|
|
59
|
-
Entries are integrated into a graph-structured journal store at `.mmagent/journal/`:
|
|
60
|
-
- `nodes/` — individual learning entries (keyed by unique node ID)
|
|
61
|
-
- `index.md` — searchable index of all entries, tags, and cross-references
|
|
62
|
-
- `log.md` — append-only event log of create/refine/supersede/merge operations
|
|
63
|
-
|
|
64
|
-
The worker creates, refines, or supersedes nodes in the graph (never appends blindly). You can query the index or log directly to track learning history. Writes are confined to the project's `.mmagent/` directory (no traversal).
|
|
65
|
-
|
|
66
|
-
## Full example
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
BATCH=$(curl -f --show-error -s -X POST \
|
|
70
|
-
-H "X-MMA-Client: $MMA_CLIENT" \
|
|
71
|
-
-H "X-MMA-Main-Model: $MMA_MAIN_MODEL" \
|
|
72
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
73
|
-
-H "Content-Type: application/json" \
|
|
74
|
-
-d '{
|
|
75
|
-
"learning": "Tried worker self-report for grouped-dispatch cancellation; dropped it — git diff is the source of truth. Lesson: use getRealFilesChanged.",
|
|
76
|
-
"tagHints": ["dispatch", "cancellation"]
|
|
77
|
-
}' \
|
|
78
|
-
"http://localhost:$PORT/journal-record?cwd=/project")
|
|
79
|
-
BATCH_ID=$(echo "$BATCH" | jq -r '.batchId')
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
@include _shared/polling.md
|
|
83
|
-
|
|
84
|
-
@include _shared/response-shape.md
|
|
85
|
-
|
|
86
|
-
## Per-task report shape
|
|
87
|
-
|
|
88
|
-
Each task carries a structured report containing the graph operation metadata:
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"summary": "created 0012; superseded 0009",
|
|
93
|
-
"filesChanged": [".mmagent/journal/nodes/0012.md", ".mmagent/journal/index.md", ".mmagent/journal/log.md"],
|
|
94
|
-
"op": "create"
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
The authoritative success signal is `completed` + the presence of `filesChanged`. See "v5 wire shape" below for the full envelope.
|
|
99
|
-
|
|
100
|
-
## v5 wire shape (reviewed write route)
|
|
101
|
-
|
|
102
|
-
Every task result is a `ComposePayload` — seven main-agent fields plus a telemetry block.
|
|
103
|
-
The main-agent fields are authoritative; the telemetry block is diagnostics.
|
|
104
|
-
|
|
105
|
-
```json
|
|
106
|
-
{
|
|
107
|
-
"completed": true,
|
|
108
|
-
"message": "Journal entry created (node 0012); superseded prior learning (node 0009)",
|
|
109
|
-
"findings": [],
|
|
110
|
-
"summary": "created 0012; superseded 0009",
|
|
111
|
-
"filesChanged": [".mmagent/journal/nodes/0012.md", ".mmagent/journal/index.md", ".mmagent/journal/log.md"],
|
|
112
|
-
"commitSha": null,
|
|
113
|
-
"blockId": null,
|
|
114
|
-
"telemetry": {
|
|
115
|
-
"totalDurationMs": 5400,
|
|
116
|
-
"totalCostUSD": 0.04,
|
|
117
|
-
"workerSelfAssessment": "done",
|
|
118
|
-
"reviewVerdict": "approved",
|
|
119
|
-
"commitOutcome": "not_applicable",
|
|
120
|
-
"stopReason": "normal",
|
|
121
|
-
"haltedStage": null,
|
|
122
|
-
"stages": [
|
|
123
|
-
{ "name": "prepare", "outcome": "advance", "durationMs": 2, "costUSD": 0 },
|
|
124
|
-
{ "name": "register-block", "outcome": "skip", "comment": "register-block does not apply to route=journal", "durationMs": 0, "costUSD": 0 },
|
|
125
|
-
{ "name": "implement", "outcome": "advance", "durationMs": 3200, "costUSD": 0.02 },
|
|
126
|
-
{ "name": "review", "outcome": "advance", "durationMs": 1800, "costUSD": 0.01 },
|
|
127
|
-
{ "name": "rework", "outcome": "skip", "comment": "rework skipped because review approved", "durationMs": 0, "costUSD": 0 },
|
|
128
|
-
{ "name": "commit", "outcome": "skip", "comment": "commit does not apply to non-git routes", "durationMs": 0, "costUSD": 0 },
|
|
129
|
-
{ "name": "annotate", "outcome": "advance", "durationMs": 340, "costUSD": 0.01 },
|
|
130
|
-
{ "name": "compose", "outcome": "advance", "durationMs": 56, "costUSD": 0 },
|
|
131
|
-
{ "name": "terminal", "outcome": "advance", "durationMs": 2, "costUSD": 0 }
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Key fields
|
|
138
|
-
|
|
139
|
-
| Field | When populated | Notes |
|
|
140
|
-
|---|---|---|
|
|
141
|
-
| `completed` | always | `true` when entry is created/refined/superseded and approved; `false` on review rejection, path traversal, or write failure |
|
|
142
|
-
| `message` | always | human-readable summary (e.g., "created 0012; superseded 0009"); read on failure for diagnostic |
|
|
143
|
-
| `findings` | always | issues surfaced by the reviewer (e.g., unclear learning, duplicate with 0009). Empty if approved as-is. |
|
|
144
|
-
| `filesChanged` | always | graph journal paths modified: `nodes/`, `index.md`, `log.md` (relative to `cwd`) |
|
|
145
|
-
| `workerSelfAssessment` | always | `'done'` or `'failed'` — worker's assessment of completeness |
|
|
146
|
-
| `blockId` | always `null` | journal is a task route, not register-context-block |
|
|
147
|
-
| `commitSha` | always `null` | journal entries are graph mutations, not git commits |
|
|
148
|
-
| `reviewVerdict` | via telemetry | `'approved'` \| `'rejected_with_rework'` \| `'rejected'` — reviewer's verdict on the learned entry |
|
|
149
|
-
|
|
150
|
-
### Reviewed write lifecycle
|
|
151
|
-
|
|
152
|
-
Unlike read routes (audit/investigate/debug), journal runs a full review cycle: **implement** → **review** → [optional **rework**] → **commit** (skipped for non-git routes) → **annotate**. If the reviewer finds issues (e.g., the learning is ambiguous, the node supersedes multiple prior entries), a rework round applies targeted edits before finalization.
|
|
153
|
-
|
|
154
|
-
### `completed: false` — what it means
|
|
155
|
-
|
|
156
|
-
Path traversal detected, write permission denied, or directory creation failed. The `message` names the blocking issue.
|
|
157
|
-
|
|
158
|
-
## Best practices
|
|
159
|
-
|
|
160
|
-
**One entry per decision, not per turn.**
|
|
161
|
-
Log once when you decide not to pursue a direction; don't log "just checked X" on every iteration.
|
|
162
|
-
|
|
163
|
-
**Keep entries concrete.**
|
|
164
|
-
❌ "Didn't work"
|
|
165
|
-
✅ "Tried multicast-style dispatch with worker dedup; git diff is the source of truth, workers can't track cancellations atomically. Use getRealFilesChanged instead."
|
|
166
|
-
|
|
167
|
-
**Use tags to build searchable structure.**
|
|
168
|
-
```bash
|
|
169
|
-
# Later, grep your journal for all perf decisions:
|
|
170
|
-
grep -r "^" .mmagent/journal/ | grep -i "perf:"
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Common pitfalls
|
|
174
|
-
|
|
175
|
-
❌ **Using journal as a scratchpad**
|
|
176
|
-
> "Thinking about X. Maybe Y? Need to check Z."
|
|
177
|
-
|
|
178
|
-
Journal is for **conclusions**, not work-in-progress. Keep notes in a separate working file if you need to brainstorm.
|
|
179
|
-
|
|
180
|
-
❌ **Logging without context**
|
|
181
|
-
> "Doesn't work."
|
|
182
|
-
|
|
183
|
-
Future-you (or a teammate) won't remember what "doesn't work" means. Always include the decision frame: what did you try, why did you try it, what was the outcome, and what will you do instead?
|
|
184
|
-
|
|
185
|
-
## Context blocks
|
|
186
|
-
|
|
187
|
-
Write-route tasks (delegate / execute-plan / journal / retry) do **not** register terminal context blocks. Their artifact is the filesystem mutation (git commit for delegate; graph mutations for journal). Read-route tasks (audit / review / debug / investigate / research) auto-register blocks containing their findings.
|
|
188
|
-
|
|
189
|
-
@include _shared/error-handling.md
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mma-research
|
|
3
|
-
description: >-
|
|
4
|
-
Use when you need external multi-source research with citations — arxiv,
|
|
5
|
-
semantic_scholar, github_search, brave-with-site:-filters — for a focused
|
|
6
|
-
question. Worker is bibliographic, not opinionated. Pair with mma-investigate
|
|
7
|
-
(internal) under mma-explore for divergent landscape scans.
|
|
8
|
-
when_to_use: >-
|
|
9
|
-
An external-research question has surfaced (state of the art, prior art, what
|
|
10
|
-
others do, what published methods exist) AND mmagent is running. Delegate the
|
|
11
|
-
multi-source web/adapter research to a worker so the main context stays on
|
|
12
|
-
judgment. NOT for codebase questions — those are mma-investigate.
|
|
13
|
-
version: 4.9.0
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# mma-research
|
|
17
|
-
|
|
18
|
-
## Overview
|
|
19
|
-
|
|
20
|
-
Run external multi-source research via a single mmagent worker. The worker
|
|
21
|
-
consults configured adapters (arxiv, semantic_scholar, github_search) and
|
|
22
|
-
— when Brave keys are configured — escalates to Brave web search with `site:`
|
|
23
|
-
filters. The worker is bibliographic: it returns a numbered narrative with a
|
|
24
|
-
`## Sources used` table. It does not opinion or rank.
|
|
25
|
-
|
|
26
|
-
**Core principle:** External research is labor (search, fetch, summarise).
|
|
27
|
-
Delegate it. The main agent stays on judgment — deciding what the citations
|
|
28
|
-
mean and which directions to pursue.
|
|
29
|
-
|
|
30
|
-
## When to Use
|
|
31
|
-
|
|
32
|
-
**Use when:**
|
|
33
|
-
- "What's the state of the art for X?"
|
|
34
|
-
- "Who has published on Y?"
|
|
35
|
-
- "What's prior art for Z?"
|
|
36
|
-
- The question is external (web, papers, github topics) — not your codebase.
|
|
37
|
-
|
|
38
|
-
**Don't use when:**
|
|
39
|
-
- The question is about THIS codebase → `mma-investigate`
|
|
40
|
-
- You need divergent ideation across both internal and external (multiple
|
|
41
|
-
directions with synthesis) → `mma-explore` (orchestrates mma-investigate + mma-research)
|
|
42
|
-
- A single web fetch is all you need → `WebFetch` inline
|
|
43
|
-
|
|
44
|
-
## Endpoint
|
|
45
|
-
|
|
46
|
-
`POST /research?cwd=<abs-path>`
|
|
47
|
-
|
|
48
|
-
@include _shared/auth.md
|
|
49
|
-
|
|
50
|
-
## Configuration prerequisites
|
|
51
|
-
|
|
52
|
-
The `mma-research` worker integrates with Semantic Scholar to search academic papers. This adapter is optional but recommended for comprehensive peer-reviewed source coverage.
|
|
53
|
-
|
|
54
|
-
**Required environment variable:**
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
export SEMANTIC_SCHOLAR_API_KEY="your-key-from-semanticscholar.org"
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Obtain a free API key from [Semantic Scholar API](https://www.semanticscholar.org/product/api).
|
|
61
|
-
|
|
62
|
-
**Degraded behavior:**
|
|
63
|
-
|
|
64
|
-
If the Semantic Scholar API key is not configured:
|
|
65
|
-
- The worker continues with available adapters (arxiv, github_search, brave-search)
|
|
66
|
-
- Semantic Scholar queries are skipped without errors
|
|
67
|
-
- Research completes successfully but may lack academic-paper coverage
|
|
68
|
-
- No failure occurs; graceful fallback is automatic
|
|
69
|
-
|
|
70
|
-
## Request body
|
|
71
|
-
|
|
72
|
-
```json
|
|
73
|
-
{
|
|
74
|
-
"researchQuestion": "What approaches exist for streaming JSON parsing under 100KB?",
|
|
75
|
-
"background": "We currently use a single-pass push parser; we want to evaluate alternatives.",
|
|
76
|
-
"subtype": "default",
|
|
77
|
-
"contextBlockIds": []
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
| Field | Type | Required | Notes |
|
|
82
|
-
|---|---|---|---|
|
|
83
|
-
| `researchQuestion` | string | yes | 20–8000 chars |
|
|
84
|
-
| `background` | string | yes | 20–8000 chars; what you already know / are trying to do |
|
|
85
|
-
| `subtype` | `'default'` | no (defaults to `'default'`) | Reserved for future criteria sets; only `default` is wired today. |
|
|
86
|
-
| `contextBlockIds` | string[] | no | IDs from `mma-context-blocks` |
|
|
87
|
-
|
|
88
|
-
> Worker tier is hardcoded `complex`. Sending `agentType` or `tools` is rejected with HTTP 400.
|
|
89
|
-
|
|
90
|
-
The `default` subtype's criteria target primary-source preference, practitioner consensus, recency, counter-perspectives, and cross-domain analogues — the worker is bibliographic, not opinionated.
|
|
91
|
-
|
|
92
|
-
## Full example
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
BATCH=$(curl -f -sS -X POST \
|
|
96
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
97
|
-
-H "X-MMA-Client: $MMA_CLIENT" \
|
|
98
|
-
-H "X-MMA-Main-Model: $MMA_MAIN_MODEL" \
|
|
99
|
-
-H "Content-Type: application/json" \
|
|
100
|
-
-d '{
|
|
101
|
-
"researchQuestion": "State-of-the-art SIMD JSON parsers under 100KB?",
|
|
102
|
-
"background": "We use a single-pass push parser; want SIMD alternatives."
|
|
103
|
-
}' \
|
|
104
|
-
"http://localhost:$PORT/research?cwd=/project")
|
|
105
|
-
BATCH_ID=$(echo "$BATCH" | jq -r '.batchId')
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
@include _shared/polling.md
|
|
109
|
-
|
|
110
|
-
@include _shared/response-shape.md
|
|
111
|
-
|
|
112
|
-
## Per-task report shape (v5 envelope)
|
|
113
|
-
|
|
114
|
-
Each `results[N]` is the v5 `ComposePayload`:
|
|
115
|
-
|
|
116
|
-
```json
|
|
117
|
-
{
|
|
118
|
-
"completed": true,
|
|
119
|
-
"message": "Research complete; 4 sources synthesised.",
|
|
120
|
-
"findings": [
|
|
121
|
-
{
|
|
122
|
-
"id": "F1",
|
|
123
|
-
"severity": "medium",
|
|
124
|
-
"category": "evidence",
|
|
125
|
-
"claim": "Pattern X is the canonical approach as of 2026 per upstream RFC.",
|
|
126
|
-
"evidence": "https://example.org/rfc/...",
|
|
127
|
-
"source": "implementer"
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
"summary": "Pattern X dominates; pattern Y is a 2024 fork.",
|
|
131
|
-
"filesChanged": [],
|
|
132
|
-
"commitSha": null,
|
|
133
|
-
"blockId": null,
|
|
134
|
-
"telemetry": {
|
|
135
|
-
"totalDurationMs": 12400,
|
|
136
|
-
"totalCostUSD": 0.06,
|
|
137
|
-
"workerSelfAssessment": "done",
|
|
138
|
-
"reviewVerdict": null,
|
|
139
|
-
"commitOutcome": "not_applicable",
|
|
140
|
-
"stopReason": "normal",
|
|
141
|
-
"haltedStage": null,
|
|
142
|
-
"stages": [
|
|
143
|
-
{ "name": "prepare", "outcome": "advance" },
|
|
144
|
-
{ "name": "implement", "outcome": "advance" },
|
|
145
|
-
{ "name": "annotate", "outcome": "advance" },
|
|
146
|
-
{ "name": "compose", "outcome": "advance" },
|
|
147
|
-
{ "name": "terminal", "outcome": "advance" }
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
| Field | Notes |
|
|
154
|
-
|---|---|
|
|
155
|
-
| `completed: true` | At least one criterion succeeded; sources synthesised. |
|
|
156
|
-
| `completed: false` | Annotator transport failure OR worker self-assessed as `failed`. `message` names the blocking gate. |
|
|
157
|
-
| `findings` | The deliverable. `source: 'implementer'`. Empty `findings` on a research route means "no signal found" — still a valid completion. |
|
|
158
|
-
| `workerSelfAssessment` | `'done'` or `'failed'` — never `done_with_concerns`. |
|
|
159
|
-
| `blockId` | Always `null` — research is a task route, not register-context-block. |
|
|
160
|
-
| `contextBlockId` | The terminal context block id for this read-route task (its report as a reusable block). Pass it into a later call's `contextBlockIds` for delta follow-ups. |
|
|
161
|
-
|
|
162
|
-
Legacy aliases (still emitted for back-compat):
|
|
163
|
-
|
|
164
|
-
```
|
|
165
|
-
results[0].structuredReport.findings[] // mirror of findings above
|
|
166
|
-
results[0].structuredReport.sourcesUsed[] // table of sources tried
|
|
167
|
-
results[0].output // raw narrative report
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## Terminal context block
|
|
171
|
-
|
|
172
|
-
Every completed **read-route** task (audit / review / debug / investigate / research) auto-registers a reusable terminal context block containing its report (headline + findings). The block id is returned on each per-task result as **`contextBlockId`**. Write routes (delegate / execute-plan / retry) return `contextBlockId: null` — their record is the commit, not a block. This block is immutable, lives for the session duration, and counts against the project's `maxEntries` quota (default 500).
|
|
173
|
-
|
|
174
|
-
Use it for delta follow-ups — feed prior results' block ids into a later call's `contextBlockIds`, filtering out nulls:
|
|
175
|
-
|
|
176
|
-
contextBlockIds: priorResults.map(r => r.contextBlockId).filter((id) => id !== null)
|
|
177
|
-
|
|
178
|
-
## Best practices
|
|
179
|
-
|
|
180
|
-
- Keep `researchQuestion` topical (keywords, not full sentences).
|
|
181
|
-
- Use `background` to give the worker context that helps it phrase queries.
|
|
182
|
-
- For multi-round research, register the previous round's findings via
|
|
183
|
-
`mma-context-blocks` and pass `contextBlockIds`.
|
|
184
|
-
|
|
185
|
-
## Common pitfalls
|
|
186
|
-
|
|
187
|
-
❌ **Asking a codebase question here.** External adapters can't grep your repo. **Fix:** use `mma-investigate`.
|
|
188
|
-
|
|
189
|
-
❌ **Inlining the user's full question verbatim.** Multi-sentence excerpts produce poor adapter queries. **Fix:** the worker re-phrases internally; you just pass the question and let it work.
|
|
190
|
-
|
|
191
|
-
❌ **Expecting opinionated output.** This worker reports what's out there with citations. Ranking and synthesis happen elsewhere — in `mma-explore` or in your own judgment. **Fix:** if you need ranked options, use `mma-explore`.
|
|
192
|
-
|
|
193
|
-
## Outcome semantics
|
|
194
|
-
|
|
195
|
-
Every task result carries outcome fields that describe the research investigation's conclusion status:
|
|
196
|
-
|
|
197
|
-
| Field | Type | Meaning |
|
|
198
|
-
|---|---|---|
|
|
199
|
-
| `findingsOutcome` | `'found' \| 'clean' \| 'not_applicable'` | Answers the question: did the research produce candidate sources and insights? |
|
|
200
|
-
| `findingsOutcomeReason` | `string \| null` | When `findingsOutcome` is set, this explains why (e.g. "3 primary sources identified across arxiv and semantic_scholar" or "No sources found matching the research criteria"). |
|
|
201
|
-
| `outcomeInferred` | `boolean` | `true` if the system inferred the outcome from findings count; `false` if the researcher explicitly stated it. |
|
|
202
|
-
| `outcomeMalformed` | `boolean` | `true` if the outcome line was malformed and had to be repaired; `false` otherwise. |
|
|
203
|
-
|
|
204
|
-
### Enum values
|
|
205
|
-
|
|
206
|
-
- **`found`** — the research identified one or more candidate sources or insights (findings) across one or more search criteria. This indicates the question has published material or prior art available.
|
|
207
|
-
- **`clean`** — the research completed but produced zero findings. This is valid for out-of-scope or nascent topics and indicates "no signal found."
|
|
208
|
-
- **`not_applicable`** — the research could not proceed (e.g., question was out of scope, search system unavailable, or preconditions failed). This is the "cannot research" state.
|
|
209
|
-
|
|
210
|
-
### Empty findings ≠ failure
|
|
211
|
-
|
|
212
|
-
A crucial semantic: **empty findings does NOT mean `completed: false` or a failed research task.** Research that proceeds thoroughly and produces zero sources is a valid `completed: true` outcome; it answers the question "I searched widely and found nothing," which is valuable information. An empty-findings result often surfaces a `not_applicable` outcome (topic too new, domain too narrow) but zero findings is still a success.
|
|
213
|
-
|
|
214
|
-
### Per-route legal outcomes
|
|
215
|
-
|
|
216
|
-
The legal outcomes for this route are: `['found', 'not_applicable']`
|
|
217
|
-
|
|
218
|
-
- **`found`** — one or more candidate sources or insights were identified via the research criteria.
|
|
219
|
-
- **`not_applicable`** — the research could not proceed or the question was out of scope.
|
|
220
|
-
|
|
221
|
-
The outcome `clean` (zero findings + success) is not legal for `mma-research` because a research task always either identifies sources or indicates the topic is inaccessible.
|
|
222
|
-
|
|
223
|
-
@include _shared/error-handling.md
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mma-retry
|
|
3
|
-
description: >-
|
|
4
|
-
Use when a previous mma-* batch returned partial results (some tasks failed or
|
|
5
|
-
came back incomplete) and you want to re-run JUST the failed indices without
|
|
6
|
-
re-dispatching the whole batch
|
|
7
|
-
when_to_use: >-
|
|
8
|
-
A previous mma-delegate / mma-execute-plan / mma-audit / mma-review /
|
|
9
|
-
mma-debug / mma-investigate batch returned partial results AND you want to
|
|
10
|
-
re-try the failed indices only. Prefer this over re-dispatching the whole
|
|
11
|
-
batch or inline-retrying — it's idempotent and preserves the original batch's
|
|
12
|
-
diagnostics.
|
|
13
|
-
version: 4.9.0
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# mma-retry
|
|
17
|
-
|
|
18
|
-
## Overview
|
|
19
|
-
|
|
20
|
-
Re-run selected tasks from a completed or failed batch. Specify the original `batchId` and the zero-based indices of the tasks to re-run. The retry runs those tasks fresh with the same configuration as the original batch and produces a new `batchId`.
|
|
21
|
-
|
|
22
|
-
**Core principle:** A batch is the unit of dispatch, but a TASK is the unit of failure. Retry at the task level so successful tasks aren't re-charged.
|
|
23
|
-
|
|
24
|
-
## When to Use
|
|
25
|
-
|
|
26
|
-
```dot
|
|
27
|
-
digraph when_to_use {
|
|
28
|
-
"Batch returned terminal?" [shape=diamond];
|
|
29
|
-
"Some tasks failed/incomplete?" [shape=diamond];
|
|
30
|
-
"All tasks failed?" [shape=diamond];
|
|
31
|
-
"mma-retry (selected indices)" [shape=box];
|
|
32
|
-
"Re-dispatch the whole batch" [shape=box];
|
|
33
|
-
"Investigate first (mma-debug)" [shape=box];
|
|
34
|
-
|
|
35
|
-
"Batch returned terminal?" -> "Some tasks failed/incomplete?";
|
|
36
|
-
"Some tasks failed/incomplete?" -> "All tasks failed?" [label="yes"];
|
|
37
|
-
"Some tasks failed/incomplete?" -> "Done — read results" [label="no"];
|
|
38
|
-
"All tasks failed?" -> "Investigate first (mma-debug)" [label="yes"];
|
|
39
|
-
"All tasks failed?" -> "mma-retry (selected indices)" [label="no — partial"];
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
**Use when:**
|
|
44
|
-
- A previous batch's terminal envelope shows mixed `completed: true` / `completed: false`
|
|
45
|
-
- 1–N tasks (but not all) need a re-run with the same config
|
|
46
|
-
- You want to keep the original batch's diagnostics intact for comparison
|
|
47
|
-
|
|
48
|
-
**Don't use when:**
|
|
49
|
-
- All tasks failed → investigate the systemic cause first (`mma-debug`); retrying won't help
|
|
50
|
-
- The original batch is `expired` (TTL elapsed) → re-dispatch fresh
|
|
51
|
-
- You want to change the prompt → re-dispatch with the new prompt; retry preserves the original
|
|
52
|
-
|
|
53
|
-
## Endpoint
|
|
54
|
-
|
|
55
|
-
`POST /retry?cwd=<abs-path>`
|
|
56
|
-
|
|
57
|
-
@include _shared/auth.md
|
|
58
|
-
|
|
59
|
-
## Request body
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"batchId": "550e8400-e29b-41d4-a716-446655440000",
|
|
64
|
-
"taskIndices": [1, 3]
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
| Field | Type | Required | Notes |
|
|
69
|
-
|---|---|---|---|
|
|
70
|
-
| `batchId` | string (UUID) | yes | Batch ID from a previous dispatch (not yet expired) |
|
|
71
|
-
| `taskIndices` | number[] | yes | Zero-based indices to re-run; must be non-negative integers |
|
|
72
|
-
|
|
73
|
-
To re-run all tasks: pass `[0, 1, ..., tasks.length - 1]`. (But consider: if all failed, debug instead of retrying.)
|
|
74
|
-
|
|
75
|
-
## Full example
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
# Original batch had 4 tasks; re-run tasks at index 1 and 3
|
|
79
|
-
BATCH=$(curl -f --show-error -s -X POST \
|
|
80
|
-
-H "X-MMA-Client: $MMA_CLIENT" \
|
|
81
|
-
-H "X-MMA-Main-Model: $MMA_MAIN_MODEL" \
|
|
82
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
83
|
-
-H "Content-Type: application/json" \
|
|
84
|
-
-d '{"batchId":"550e8400-e29b-41d4-a716-446655440000","taskIndices":[1,3]}' \
|
|
85
|
-
"http://localhost:$PORT/retry?cwd=/project")
|
|
86
|
-
BATCH_ID=$(echo "$BATCH" | jq -r '.batchId') # NEW batchId — not the original
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
@include _shared/polling.md
|
|
90
|
-
|
|
91
|
-
## Response shapes
|
|
92
|
-
|
|
93
|
-
### POST /retry?cwd=<abs> — dispatch response (202)
|
|
94
|
-
|
|
95
|
-
```json
|
|
96
|
-
{ "batchId": "<uuid>", "statusUrl": "/batch/<uuid>" }
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Use `batchId` to poll. `statusUrl` is a convenience pointer. **This is a new batchId** — polling the original batch returns its terminal state.
|
|
100
|
-
|
|
101
|
-
### GET /batch/:id — polling response
|
|
102
|
-
|
|
103
|
-
The HTTP status is the state discriminator:
|
|
104
|
-
|
|
105
|
-
| Status | Meaning |
|
|
106
|
-
|---|---|
|
|
107
|
-
| `202 text/plain` | Still pending — body is the running headline string |
|
|
108
|
-
| `200 application/json` | Terminal — body is the batch envelope below |
|
|
109
|
-
| `404` / `401` / `5xx` | Error — see Error response below; stop polling |
|
|
110
|
-
|
|
111
|
-
### GET /batch/:id?taskIndex=N — single task slice
|
|
112
|
-
|
|
113
|
-
Same envelope. `results` contains exactly the task at index `N`. Returns `404 unknown_task_index` if `N` is out of range.
|
|
114
|
-
|
|
115
|
-
### Reading the task result
|
|
116
|
-
|
|
117
|
-
Each task result is the per-task wire object (`ComposePayload`):
|
|
118
|
-
|
|
119
|
-
```json
|
|
120
|
-
{
|
|
121
|
-
"completed": true,
|
|
122
|
-
"message": "Task completed; tests passed; one file changed.",
|
|
123
|
-
"findings": [
|
|
124
|
-
{
|
|
125
|
-
"id": "F1",
|
|
126
|
-
"severity": "high",
|
|
127
|
-
"category": "correctness",
|
|
128
|
-
"claim": "The function does not handle empty input",
|
|
129
|
-
"evidence": "function foo() { ... } // no null check",
|
|
130
|
-
"suggestion": "Add an explicit null guard at the top",
|
|
131
|
-
"source": "reviewer"
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
"summary": "Refactored utils.ts — removed 3 dead branches, added JSDoc",
|
|
135
|
-
"filesChanged": ["/project/src/utils.ts"],
|
|
136
|
-
"commitSha": "abc123def",
|
|
137
|
-
"blockId": null,
|
|
138
|
-
"telemetry": {
|
|
139
|
-
"totalDurationMs": 12400,
|
|
140
|
-
"totalCostUSD": 0.08,
|
|
141
|
-
"workerSelfAssessment": "done",
|
|
142
|
-
"reviewVerdict": "approved",
|
|
143
|
-
"commitOutcome": "committed",
|
|
144
|
-
"stopReason": "normal",
|
|
145
|
-
"haltedStage": null,
|
|
146
|
-
"stages": [
|
|
147
|
-
{ "name": "prepare", "outcome": "advance", "durationMs": 2, "costUSD": 0 },
|
|
148
|
-
{ "name": "register-block", "outcome": "skip", "comment": "register-block does not apply to route=delegate", "durationMs": 0, "costUSD": 0 },
|
|
149
|
-
{ "name": "implement", "outcome": "advance", "durationMs": 8900, "costUSD": 0.05 },
|
|
150
|
-
{ "name": "review", "outcome": "advance", "durationMs": 2100, "costUSD": 0.02 },
|
|
151
|
-
{ "name": "rework", "outcome": "skip", "comment": "rework skipped because review approved", "durationMs": 0, "costUSD": 0 },
|
|
152
|
-
{ "name": "commit", "outcome": "advance", "durationMs": 340, "costUSD": 0 },
|
|
153
|
-
{ "name": "annotate", "outcome": "advance", "durationMs": 890, "costUSD": 0.01 },
|
|
154
|
-
{ "name": "compose", "outcome": "advance", "durationMs": 68, "costUSD": 0 },
|
|
155
|
-
{ "name": "terminal", "outcome": "advance", "durationMs": 100, "costUSD": 0 }
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
**Top-level fields to read for the main-agent verdict:**
|
|
162
|
-
|
|
163
|
-
| Field | When `true` / populated |
|
|
164
|
-
|---|---|
|
|
165
|
-
| `completed: true` | Task succeeded. `message` is the summary; `findings` are post-review issues (if any). |
|
|
166
|
-
| `completed: false` | Task did not complete. `message` names the blocking gate or finding; `findings` carry any discovered issues. |
|
|
167
|
-
| `findings` | Issues surfaced by the worker or reviewer. `severity` = `critical` \| `high` \| `medium` \| `low`. `source` = `implementer` \| `reviewer`. |
|
|
168
|
-
| `filesChanged` | File paths modified (empty for read-only routes). |
|
|
169
|
-
| `commitSha` | Git SHA of the committed diff; `null` for read-only routes or when commit was skipped. |
|
|
170
|
-
| `blockId` | Always `null` (retry replays write tasks; `contextBlockId` is `null` too — no terminal block). |
|
|
171
|
-
|
|
172
|
-
**The stages array** (always 9 rows) is the canonical telemetry log. `outcome` is one of:
|
|
173
|
-
- `advance` — stage ran and produced its payload
|
|
174
|
-
- `skip` — stage did not run; `comment` explains why
|
|
175
|
-
- `halt` — stage stopped the chain; `comment` is the failure message
|
|
176
|
-
- `not_run` — stage was not reached because a prior stage halted
|
|
177
|
-
|
|
178
|
-
Use `telemetry.haltedStage` to find the first halt; `telemetry.stopReason` to find why.
|
|
179
|
-
|
|
180
|
-
### Error response (4xx / 5xx)
|
|
181
|
-
|
|
182
|
-
```json
|
|
183
|
-
{
|
|
184
|
-
"error": "<code>",
|
|
185
|
-
"message": "<human-readable>",
|
|
186
|
-
"details": { /* optional structured context, e.g. fieldErrors for 400 */ }
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
`details` is optional and present only when the server has structured additional context.
|
|
191
|
-
|
|
192
|
-
## Best practices
|
|
193
|
-
|
|
194
|
-
This skill is one step in the larger flow described in `multi-model-agent` → "Best practices". Recipes that involve `mma-retry`:
|
|
195
|
-
|
|
196
|
-
- **Recipe C — Investigate-plan-execute (last step).** After `mma-execute-plan` returns mixed results, retry the failed indices to close the loop.
|
|
197
|
-
- **Recipe D — Plan-execute-retry.** Pass the **original `batchId`** as input, specify the failed indices, keep the same configuration. `mma-retry` produces a NEW `batchId` in its response — poll that one for terminal state. Any `contextBlockIds` from the original carry forward.
|
|
198
|
-
|
|
199
|
-
Anti-pattern alert: **`full-batch-redispatch`** (AP4). Re-dispatching the entire batch re-charges every successful task. Always retry by index.
|
|
200
|
-
|
|
201
|
-
## Common pitfalls
|
|
202
|
-
|
|
203
|
-
❌ **Retrying after the batch expired**
|
|
204
|
-
TTL elapsed → original task specs are gone. **Fix:** re-dispatch fresh; the retry endpoint returns 404.
|
|
205
|
-
|
|
206
|
-
❌ **Retrying without addressing the root cause**
|
|
207
|
-
A flaky task that failed once will likely fail again. **Fix:** investigate (`mma-debug` or read the original `result.error.message`), then retry — or escalate `agentType` to `complex` by re-dispatching.
|
|
208
|
-
|
|
209
|
-
❌ **Confusing the new and original `batchId`**
|
|
210
|
-
Retry produces a NEW batchId; polling the original returns the old terminal state. **Fix:** save the retry's `batchId` and poll that one.
|
|
211
|
-
|
|
212
|
-
❌ **Using retry to change task config**
|
|
213
|
-
Retry preserves the ORIGINAL config (prompt, agentType, filePaths, reviewPolicy). **Fix:** if you want different config, re-dispatch with `mma-delegate` / `mma-execute-plan`.
|
|
214
|
-
|
|
215
|
-
## Terminal context block
|
|
216
|
-
|
|
217
|
-
Write-route tasks (delegate / execute-plan / retry) do NOT register a terminal context block — their durable record is the commit (`commitSha` + changed files). The per-task result's `contextBlockId` is always `null` for these routes. Read routes (audit / review / debug / investigate / research) return a non-null `contextBlockId`; see those skills for the delta-follow-up recipe.
|
|
218
|
-
|
|
219
|
-
Note: a re-run **read-route** task registers its own terminal context block (`contextBlockId`); re-run write tasks register none. Original-batch blocks remain intact and are not overwritten.
|
|
220
|
-
|
|
221
|
-
@include _shared/error-handling.md
|