@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,258 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mma-investigate
|
|
3
|
-
description: >-
|
|
4
|
-
Use when you need to answer a question about the codebase ("how does X work",
|
|
5
|
-
"where is Y called", "what does this directory do") and reading + grepping the
|
|
6
|
-
codebase yourself would consume main-context tokens
|
|
7
|
-
when_to_use: >-
|
|
8
|
-
A question about THIS codebase has surfaced — from the user, from a
|
|
9
|
-
methodology skill, or from your own next-step planning — AND mmagent is
|
|
10
|
-
running. Delegate the read/grep/synthesis to a worker so the main context
|
|
11
|
-
stays on judgment. Codebase only — does not perform web research or
|
|
12
|
-
git-history queries. OR you are about to read 3+ files / run any grep in main
|
|
13
|
-
context — that's the inline-labor-leakage anti-pattern (AP2); delegate to this
|
|
14
|
-
skill instead.
|
|
15
|
-
version: 4.9.0
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
# mma-investigate
|
|
19
|
-
|
|
20
|
-
## Overview
|
|
21
|
-
|
|
22
|
-
Answer a codebase question via a read-only mmagent worker. The worker greps and reads on its cheap budget; you read its synthesis on yours.
|
|
23
|
-
|
|
24
|
-
**Core principle:** Investigation is labor (read, grep, synthesize). Delegate it. The main agent stays on judgment — deciding what the answer means and what to do with it.
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
```dot
|
|
29
|
-
digraph when_to_use {
|
|
30
|
-
"Question about codebase?" [shape=diamond];
|
|
31
|
-
"About web / git history?" [shape=diamond];
|
|
32
|
-
"Already have the file in context?" [shape=diamond];
|
|
33
|
-
"mma-investigate" [shape=box];
|
|
34
|
-
"Read inline (1–2 reads)" [shape=box];
|
|
35
|
-
"WebSearch / git log" [shape=box];
|
|
36
|
-
|
|
37
|
-
"Question about codebase?" -> "About web / git history?";
|
|
38
|
-
"About web / git history?" -> "WebSearch / git log" [label="yes"];
|
|
39
|
-
"About web / git history?" -> "Already have the file in context?" [label="no"];
|
|
40
|
-
"Already have the file in context?" -> "Read inline (1–2 reads)" [label="yes"];
|
|
41
|
-
"Already have the file in context?" -> "mma-investigate" [label="no"];
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Use when:**
|
|
46
|
-
- "How does X work in this codebase?"
|
|
47
|
-
- "Where is Y called from?"
|
|
48
|
-
- "What does this directory do?"
|
|
49
|
-
- The answer requires reading 3+ files or grepping
|
|
50
|
-
- Cross-cutting investigations (auth flow across modules, data lineage)
|
|
51
|
-
|
|
52
|
-
**Don't use when:**
|
|
53
|
-
- The answer is in 1–2 files you already have in context → just `Read`
|
|
54
|
-
- It's about web docs / external APIs → `WebSearch` / `WebFetch`
|
|
55
|
-
- It's about git history → `git log` / `git blame`
|
|
56
|
-
- You need to MODIFY code based on the finding → `mma-delegate` (research + edit)
|
|
57
|
-
- You want to consider multiple distinct directions, not converge on one answer → `mma-explore` (divergent ideation, codebase + web)
|
|
58
|
-
|
|
59
|
-
## Endpoint
|
|
60
|
-
|
|
61
|
-
`POST /investigate?cwd=<abs-path>`
|
|
62
|
-
|
|
63
|
-
@include _shared/auth.md
|
|
64
|
-
|
|
65
|
-
## Request body
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"question": "How does the auth middleware handle token refresh?",
|
|
70
|
-
"subtype": "default",
|
|
71
|
-
"filePaths": ["/project/src/auth/"],
|
|
72
|
-
"contextBlockIds": []
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
| Field | Type | Required | Notes |
|
|
77
|
-
|---|---|---|---|
|
|
78
|
-
| `question` | string | yes | Natural-language investigation question |
|
|
79
|
-
| `subtype` | `'default'` | no (defaults to `'default'`) | Reserved for future criteria sets; only `default` is wired today. |
|
|
80
|
-
| `filePaths` | string[] | no | Anchor paths the worker starts from. Worker may grep beyond. |
|
|
81
|
-
| `contextBlockIds` | string[] | no | IDs from `mma-context-blocks` — enables follow-up / delta investigation |
|
|
82
|
-
| `tools` | `'none' \| 'readonly'` | no | Default `'readonly'`. `'no-shell'` and `'full'` are rejected — investigation is read-only |
|
|
83
|
-
|
|
84
|
-
> Worker tier for `mma-investigate` is hardcoded to `complex` and is not caller-configurable. Sending `agentType` is rejected with HTTP 400.
|
|
85
|
-
|
|
86
|
-
**Anchor narrow questions with `filePaths`:**
|
|
87
|
-
|
|
88
|
-
❌ `{ "question": "Where is parseConfig called?" }` — searches the whole repo
|
|
89
|
-
✅ `{ "question": "Where is parseConfig called?", "filePaths": ["src/"] }` — bounded
|
|
90
|
-
|
|
91
|
-
**Why:** the worker greps and reads under a turn and wall-clock budget. Without anchors, broad questions exhaust those budgets before they finish.
|
|
92
|
-
|
|
93
|
-
## Full example
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
BATCH=$(curl -f --show-error -s -X POST \
|
|
97
|
-
-H "X-MMA-Client: $MMA_CLIENT" \
|
|
98
|
-
-H "X-MMA-Main-Model: $MMA_MAIN_MODEL" \
|
|
99
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
100
|
-
-H "Content-Type: application/json" \
|
|
101
|
-
-d '{"question":"How does the auth middleware handle token refresh?"}' \
|
|
102
|
-
"http://localhost:$PORT/investigate?cwd=/project")
|
|
103
|
-
BATCH_ID=$(echo "$BATCH" | jq -r '.batchId')
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
@include _shared/polling.md
|
|
107
|
-
|
|
108
|
-
@include _shared/response-shape.md
|
|
109
|
-
|
|
110
|
-
## Per-task report shape
|
|
111
|
-
|
|
112
|
-
Each task carries an `investigation` field on its per-task report:
|
|
113
|
-
|
|
114
|
-
```json
|
|
115
|
-
{
|
|
116
|
-
"investigation": {
|
|
117
|
-
"citations": [
|
|
118
|
-
{ "file": "src/auth/refresh.ts", "lines": "45-72", "claim": "Refresh handler reads bearer." }
|
|
119
|
-
],
|
|
120
|
-
"confidence": { "level": "high", "rationale": "All claims directly cited." },
|
|
121
|
-
"diagnostics": {
|
|
122
|
-
"malformedCitationLines": 0,
|
|
123
|
-
"missingRequiredSections": [],
|
|
124
|
-
"invalidRequiredSections": []
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
The authoritative success signals are `completed`, `message`, and `findings`. See "v5 wire shape" above for the full envelope.
|
|
131
|
-
|
|
132
|
-
## v5 wire shape (read route)
|
|
133
|
-
|
|
134
|
-
Every task result is a `ComposePayload` — seven main-agent fields plus a telemetry block.
|
|
135
|
-
The main-agent fields are authoritative; the telemetry block is diagnostics.
|
|
136
|
-
|
|
137
|
-
```json
|
|
138
|
-
{
|
|
139
|
-
"completed": true,
|
|
140
|
-
"message": "Investigation complete; 3 files analysed.",
|
|
141
|
-
"findings": [
|
|
142
|
-
{
|
|
143
|
-
"id": "F1",
|
|
144
|
-
"severity": "high",
|
|
145
|
-
"category": "correctness",
|
|
146
|
-
"claim": "The refresh handler reads bearer from Authorization header unconditionally.",
|
|
147
|
-
"evidence": "src/auth/refresh.ts:45-72 — verbatim substring from worker output.",
|
|
148
|
-
"suggestion": "Add a guard to handle missing Authorization header gracefully.",
|
|
149
|
-
"source": "implementer"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"summary": "...",
|
|
153
|
-
"filesChanged": [],
|
|
154
|
-
"commitSha": null,
|
|
155
|
-
"blockId": null,
|
|
156
|
-
"telemetry": {
|
|
157
|
-
"totalDurationMs": 1234,
|
|
158
|
-
"totalCostUSD": 0.08,
|
|
159
|
-
"workerSelfAssessment": "done",
|
|
160
|
-
"reviewVerdict": null,
|
|
161
|
-
"commitOutcome": "not_applicable",
|
|
162
|
-
"stopReason": "normal",
|
|
163
|
-
"haltedStage": null,
|
|
164
|
-
"stages": [...]
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Key fields
|
|
170
|
-
|
|
171
|
-
| Field | When populated | Notes |
|
|
172
|
-
|---|---|---|
|
|
173
|
-
| `completed` | always | `true` when at least one criterion succeeded; `false` on annotator transport failure OR unmet annotate preconditions (e.g. non-`done` worker self-assessment on a read route) |
|
|
174
|
-
| `message` | always | human-readable summary; names blocking gates or finding IDs on failure |
|
|
175
|
-
| `findings` | always | `source: 'implementer'` for investigate; findings are the deliverable on read routes |
|
|
176
|
-
| `workerSelfAssessment` | always | `'done'` or `'failed'` — never `done_with_concerns` |
|
|
177
|
-
| `blockId` | always `null` | investigate is a task route, not register-context-block |
|
|
178
|
-
|
|
179
|
-
### No second review
|
|
180
|
-
|
|
181
|
-
The LLM-judge stage (`annotate`) runs once, after the worker's output. Its preconditions for read-route `completed: true`:
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
gates.implement.outcome === 'advance'
|
|
185
|
-
&& gates.implement.payload.workerSelfAssessment === 'done'
|
|
186
|
-
&& (criteriaSucceeded.length > 0 || criteriaErrors.length === 0)
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Findings are the deliverable — a task that surfaces 5 issues is `completed: true`. Finding nothing wrong is also a valid completion.
|
|
190
|
-
|
|
191
|
-
### `completed: false` — what it means
|
|
192
|
-
|
|
193
|
-
Only on annotator transport failure. The `message` names the blocking gate. Re-dispatch with tighter `filePaths` if the worker's citations were unusable.
|
|
194
|
-
|
|
195
|
-
## Best practices
|
|
196
|
-
|
|
197
|
-
This skill is one step in the larger flow described in `multi-model-agent` → "Best practices". Recipes that involve `mma-investigate`:
|
|
198
|
-
|
|
199
|
-
- **Recipe C — Investigate-plan-execute.** `mma-investigate` → write the plan → `mma-execute-plan` → `mma-retry`. The investigation produces the synthesis you need to write the plan; the plan becomes a context block for execute-plan.
|
|
200
|
-
|
|
201
|
-
Anti-pattern alert: **`inline-labor-leakage`** (AP2). If you find yourself reading 3+ files or running any grep in main context, that's the trigger to delegate here instead. Main-context tokens cost ~10× more than worker tokens, and you only need the synthesis, not the raw reads.
|
|
202
|
-
|
|
203
|
-
## Common pitfalls
|
|
204
|
-
|
|
205
|
-
❌ **Asking for a fix instead of an answer**
|
|
206
|
-
> question: "Refactor the auth middleware to use JWT"
|
|
207
|
-
|
|
208
|
-
The investigator can't write — `tools: 'readonly'`. **Fix:** use `mma-delegate` for research-then-edit, or split: investigate first, then dispatch the edit.
|
|
209
|
-
|
|
210
|
-
❌ **Inline-reading instead of delegating**
|
|
211
|
-
About to `Read` 3+ files just to answer one question? That's the wrong tradeoff — the worker reads on its cheap budget; you read its synthesis on yours.
|
|
212
|
-
|
|
213
|
-
## Terminal context block
|
|
214
|
-
|
|
215
|
-
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).
|
|
216
|
-
|
|
217
|
-
Use it for delta follow-ups — feed prior results' block ids into a later call's `contextBlockIds`, filtering out nulls:
|
|
218
|
-
|
|
219
|
-
contextBlockIds: priorResults.map(r => r.contextBlockId).filter((id) => id !== null)
|
|
220
|
-
|
|
221
|
-
**Use cases:**
|
|
222
|
-
- Pass investigation results to a downstream planning step
|
|
223
|
-
- Feed codebase findings into `mma-execute-plan` as shared context
|
|
224
|
-
- Carry investigation context forward through the investigate → plan → execute chain
|
|
225
|
-
|
|
226
|
-
The block is registered server-side at task completion; no caller action is needed to create it. Delete it explicitly via `DELETE /context-blocks/:id` when no longer needed, or let it expire on session teardown.
|
|
227
|
-
|
|
228
|
-
## Outcome semantics
|
|
229
|
-
|
|
230
|
-
Every task result carries outcome fields that describe the investigation's conclusion status:
|
|
231
|
-
|
|
232
|
-
| Field | Type | Meaning |
|
|
233
|
-
|---|---|---|
|
|
234
|
-
| `findingsOutcome` | `'found' \| 'clean' \| 'not_applicable'` | Answers the question: did the investigation produce a substantive result? |
|
|
235
|
-
| `findingsOutcomeReason` | `string \| null` | When `findingsOutcome` is set, this explains why (e.g. "No candidate answers found after perspective 5" or "One clear path identified at high confidence"). |
|
|
236
|
-
| `outcomeInferred` | `boolean` | `true` if the system inferred the outcome from findings count; `false` if the worker explicitly stated it. |
|
|
237
|
-
| `outcomeMalformed` | `boolean` | `true` if the outcome line was malformed and had to be repaired; `false` otherwise. |
|
|
238
|
-
|
|
239
|
-
### Enum values
|
|
240
|
-
|
|
241
|
-
- **`found`** — the investigation produced one or more candidate answers (findings) across one or more criteria. This is the success state for a question-answering route.
|
|
242
|
-
- **`clean`** — the investigation completed but produced zero findings. This is valid for issue-hunting routes but unusual for `mma-investigate`, where answering a question always produces at least one candidate.
|
|
243
|
-
- **`not_applicable`** — the investigation could not proceed (e.g., the question was out of scope, the codebase provided no data to work with, or the request preconditions failed). This is the "no answer possible" state.
|
|
244
|
-
|
|
245
|
-
### Empty findings ≠ failure
|
|
246
|
-
|
|
247
|
-
A crucial semantic: **empty findings does NOT mean `completed: false` or a failed task.** The presence or absence of findings is orthogonal to task success. An investigation that searches thoroughly and produces zero candidate answers is a valid `completed: true` outcome; it simply answers the question with "I found no evidence for that in the codebase."
|
|
248
|
-
|
|
249
|
-
### Per-route legal outcomes
|
|
250
|
-
|
|
251
|
-
The legal outcomes for this route are: `['found', 'not_applicable']`
|
|
252
|
-
|
|
253
|
-
- **`found`** — one or more candidate answers surfaced via the investigation criteria.
|
|
254
|
-
- **`not_applicable`** — the question was out of scope, unanswerable, or the codebase provided insufficient data.
|
|
255
|
-
|
|
256
|
-
The outcome `clean` (zero findings + success) is not legal for `mma-investigate` because an investigation answer is always produced in the `found` state or the task is `not_applicable`.
|
|
257
|
-
|
|
258
|
-
@include _shared/error-handling.md
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mma-journal-recall
|
|
3
|
-
description: >-
|
|
4
|
-
Use when you're about to design or attempt something and want to know what
|
|
5
|
-
THIS project already learned — ask a vague conceptual question (no tags or
|
|
6
|
-
keywords needed); a read-only worker searches the learnings graph and returns
|
|
7
|
-
the relevant prior lessons + how they relate. Fire before re-treading ground
|
|
8
|
-
that may already have been explored. NOT for recording a new learning
|
|
9
|
-
(mma-journal-record), codebase questions (mma-investigate), or external
|
|
10
|
-
research (mma-research).
|
|
11
|
-
when_to_use: >-
|
|
12
|
-
A question about THIS project's learnings, before attempting or designing
|
|
13
|
-
something — ask a vague conceptual question; skip if recording a new learning,
|
|
14
|
-
asking the codebase, or researching external docs.
|
|
15
|
-
version: 4.9.0
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
# mma-journal-recall
|
|
19
|
-
|
|
20
|
-
## Overview
|
|
21
|
-
|
|
22
|
-
Recall relevant project learnings from the journal via a read-only mmagent worker. The worker reads the learnings graph at `.mmagent/journal/` and synthesizes answers to vague conceptual queries.
|
|
23
|
-
|
|
24
|
-
**Core principle:** Recall is retrieval (read, traverse graph, synthesize). Delegate it. The main agent stays on using the results — deciding what to do with the prior lessons.
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
**Use when:**
|
|
29
|
-
- Before attempting something, ask "what have we learned about this?".
|
|
30
|
-
- The query is a conceptual question ("dispatch cancellation reliability?", "rate-limiting patterns?"), not exact tags or keywords.
|
|
31
|
-
- You want prior learnings + their relationships, not isolated chunks.
|
|
32
|
-
- The project has an active journal (started with `mma-journal-record`).
|
|
33
|
-
|
|
34
|
-
**Don't use when:**
|
|
35
|
-
- You're recording a new learning → `mma-journal-record` (write route).
|
|
36
|
-
- You're asking about the codebase structure → `mma-investigate` (read codebase).
|
|
37
|
-
- You're researching external docs/web → `mma-research` / `WebSearch`.
|
|
38
|
-
- The journal is empty or not yet initialized.
|
|
39
|
-
|
|
40
|
-
## Endpoint
|
|
41
|
-
|
|
42
|
-
`POST /journal-recall?cwd=<abs-path>`
|
|
43
|
-
|
|
44
|
-
@include _shared/auth.md
|
|
45
|
-
|
|
46
|
-
## Request body
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"query": "what have we learned about dispatch cancellation reliability?",
|
|
51
|
-
"contextBlockIds": []
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
| Field | Type | Required | Notes |
|
|
56
|
-
|---|---|---|---|
|
|
57
|
-
| `query` | string | yes | A vague conceptual question about prior learnings. No tags or keywords needed. |
|
|
58
|
-
| `contextBlockIds` | string[] | no | IDs from `mma-context-blocks` — enables follow-up / delta recall |
|
|
59
|
-
| `tools` | `'none' \| 'readonly'` | no | Default `'readonly'`. `'full'` and `'no-shell'` are rejected — recall is read-only |
|
|
60
|
-
|
|
61
|
-
> Worker tier for `mma-journal-recall` is hardcoded to `complex` and is not caller-configurable. Sending `agentType` is rejected with HTTP 400.
|
|
62
|
-
|
|
63
|
-
**Why `query` is vague, not keyword-filtered:**
|
|
64
|
-
|
|
65
|
-
❌ `{ "query": "dispatch" }` — too narrow, might miss "cancellation reliability" nodes that don't mention the word "dispatch" in title.
|
|
66
|
-
✅ `{ "query": "what have we learned about dispatch cancellation reliability?" }` — the worker understands the concept and finds related nodes.
|
|
67
|
-
|
|
68
|
-
**Why:** the worker traverses the journal's typed graph (supersedes, refines, contradicts, depends-on) and synthesizes across related nodes. Semantic matching is the LLM's job, just like `mma-investigate`.
|
|
69
|
-
|
|
70
|
-
## Full example
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
BATCH=$(curl -f --show-error -s -X POST \
|
|
74
|
-
-H "X-MMA-Client: $MMA_CLIENT" \
|
|
75
|
-
-H "X-MMA-Main-Model: $MMA_MAIN_MODEL" \
|
|
76
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
77
|
-
-H "Content-Type: application/json" \
|
|
78
|
-
-d '{"query":"what have we learned about dispatch cancellation reliability?"}' \
|
|
79
|
-
"http://localhost:$PORT/journal-recall?cwd=/project")
|
|
80
|
-
BATCH_ID=$(echo "$BATCH" | jq -r '.batchId')
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
@include _shared/polling.md
|
|
84
|
-
|
|
85
|
-
@include _shared/response-shape.md
|
|
86
|
-
|
|
87
|
-
## Per-task report shape
|
|
88
|
-
|
|
89
|
-
Each task carries a `investigation` field on its per-task report (same shape as `mma-investigate`):
|
|
90
|
-
|
|
91
|
-
```json
|
|
92
|
-
{
|
|
93
|
-
"investigation": {
|
|
94
|
-
"citations": [
|
|
95
|
-
{ "file": "nodes/0012-dispatch-cancellation-lifecycle.md", "lines": "1-50", "claim": "Cancellation handlers must check context before writing." }
|
|
96
|
-
],
|
|
97
|
-
"confidence": { "level": "high", "rationale": "Direct citations from journal nodes." },
|
|
98
|
-
"diagnostics": {
|
|
99
|
-
"malformedCitationLines": 0,
|
|
100
|
-
"missingRequiredSections": [],
|
|
101
|
-
"invalidRequiredSections": []
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
The authoritative success signals are `completed`, `message`, and `findings`. See "v5 wire shape" below for the full envelope.
|
|
108
|
-
|
|
109
|
-
## v5 wire shape (read route)
|
|
110
|
-
|
|
111
|
-
Every task result is a `ComposePayload` — seven main-agent fields plus a telemetry block.
|
|
112
|
-
The main-agent fields are authoritative; the telemetry block is diagnostics.
|
|
113
|
-
|
|
114
|
-
```json
|
|
115
|
-
{
|
|
116
|
-
"completed": true,
|
|
117
|
-
"message": "Recall complete; 4 relevant learnings found.",
|
|
118
|
-
"findings": [
|
|
119
|
-
{
|
|
120
|
-
"id": "F1",
|
|
121
|
-
"severity": "critical",
|
|
122
|
-
"category": "correctness",
|
|
123
|
-
"claim": "Cancellation handlers must check context before writing to avoid corruption.",
|
|
124
|
-
"evidence": "nodes/0012-dispatch-cancellation-lifecycle.md:20-35 — verbatim substring from journal node.",
|
|
125
|
-
"suggestion": null,
|
|
126
|
-
"source": "implementer"
|
|
127
|
-
}
|
|
128
|
-
],
|
|
129
|
-
"summary": "The project learned that dispatch cancellation must synchronize context reads (node 0012) and never write without checking. Related node 0008 (refines) adds that timeout-based cancellation has race conditions under high load.",
|
|
130
|
-
"filesChanged": [],
|
|
131
|
-
"commitSha": null,
|
|
132
|
-
"blockId": null,
|
|
133
|
-
"telemetry": {
|
|
134
|
-
"totalDurationMs": 1234,
|
|
135
|
-
"totalCostUSD": 0.08,
|
|
136
|
-
"workerSelfAssessment": "done",
|
|
137
|
-
"reviewVerdict": null,
|
|
138
|
-
"commitOutcome": "not_applicable",
|
|
139
|
-
"stopReason": "normal",
|
|
140
|
-
"haltedStage": null,
|
|
141
|
-
"stages": [...]
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Key fields
|
|
147
|
-
|
|
148
|
-
| Field | When populated | Notes |
|
|
149
|
-
|---|---|---|
|
|
150
|
-
| `completed` | always | `true` when at least one criterion succeeded; `false` on annotator transport failure OR unmet annotate preconditions |
|
|
151
|
-
| `message` | always | human-readable summary; names blocking gates or finding IDs on failure |
|
|
152
|
-
| `findings` | always | `source: 'implementer'` for recall; findings are the deliverable on read routes |
|
|
153
|
-
| `workerSelfAssessment` | always | `'done'` or `'failed'` — never `done_with_concerns` |
|
|
154
|
-
| `blockId` | always `null` (for write routes); string (for read routes) | recall is a read route, so `blockId` is a string — a reusable context block for delta follow-up |
|
|
155
|
-
|
|
156
|
-
### No second review
|
|
157
|
-
|
|
158
|
-
The LLM-judge stage (`annotate`) runs once, after the worker's output. Its preconditions for read-route `completed: true`:
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
gates.implement.outcome === 'advance'
|
|
162
|
-
&& gates.implement.payload.workerSelfAssessment === 'done'
|
|
163
|
-
&& (criteriaSucceeded.length > 0 || criteriaErrors.length === 0)
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Findings are the deliverable — a recall that surfaces 5 relevant lessons is `completed: true`. Finding nothing relevant is also a valid completion (returns `findings: []`).
|
|
167
|
-
|
|
168
|
-
### `completed: false` — what it means
|
|
169
|
-
|
|
170
|
-
Only on annotator transport failure, or if the journal is inaccessible/corrupted. The `message` names the blocking gate. Re-dispatch with a broader `query` if the worker's findings were too narrow.
|
|
171
|
-
|
|
172
|
-
## Best practices
|
|
173
|
-
|
|
174
|
-
This skill is one step in a larger flow described in `multi-model-agent` → "Best practices". Recipes that involve `mma-journal-recall`:
|
|
175
|
-
|
|
176
|
-
- **Recipe A — Recall before attempting.** Call `mma-journal-recall` with your question before running `mma-delegate` / `mma-execute-plan` to avoid re-treading prior dead ends.
|
|
177
|
-
- **Recipe B — Recall → plan → execute.** `mma-journal-recall` → write a plan based on the learnings → `mma-execute-plan`.
|
|
178
|
-
- **Recipe C — Delta follow-up recall.** Feed a prior recall's `contextBlockId` into a follow-up call to dig deeper: `contextBlockIds: [priorResult.contextBlockId]`.
|
|
179
|
-
|
|
180
|
-
Anti-pattern alert: **Misusing recall as codebase search.** Recall is for the *project's learnings graph*, not the codebase. If you want to search code → `mma-investigate`. If you want to ask the journal → `mma-journal-recall`.
|
|
181
|
-
|
|
182
|
-
## Common pitfalls
|
|
183
|
-
|
|
184
|
-
❌ **Using exact tags instead of a conceptual question**
|
|
185
|
-
> query: "dispatch cancellation"
|
|
186
|
-
|
|
187
|
-
The worker expects a sentence with context, not keywords. **Fix:** phrase it as a question:
|
|
188
|
-
> query: "what have we learned about dispatch cancellation and how it interacts with timeouts?"
|
|
189
|
-
|
|
190
|
-
❌ **Asking about the codebase instead of the journal**
|
|
191
|
-
> query: "where is DispatchCanceller called?"
|
|
192
|
-
|
|
193
|
-
That's a codebase question. Use `mma-investigate` instead. Journal recall is for *learnings* stored in `.mmagent/journal/`, not code.
|
|
194
|
-
|
|
195
|
-
❌ **Assuming the journal exists**
|
|
196
|
-
> query: "what do we know about X?"
|
|
197
|
-
|
|
198
|
-
If the project hasn't used `mma-journal-record`, the journal is empty. The worker will return `not_applicable`. **Fix:** check whether the journal is active in the project first, or start recording learnings with `mma-journal-record`.
|
|
199
|
-
|
|
200
|
-
## Terminal context block
|
|
201
|
-
|
|
202
|
-
Every completed **read-route** task (audit / review / debug / investigate / recall / 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 / journal-record) 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).
|
|
203
|
-
|
|
204
|
-
Use it for delta follow-ups — feed prior results' block ids into a later call's `contextBlockIds`, filtering out nulls:
|
|
205
|
-
|
|
206
|
-
contextBlockIds: priorResults.map(r => r.contextBlockId).filter((id) => id !== null)
|
|
207
|
-
|
|
208
|
-
**Use cases:**
|
|
209
|
-
- Recall round 2: pass round 1's block into round 2's `contextBlockIds` to dig deeper on a specific thread.
|
|
210
|
-
- Recall → plan → execute chain: feed recall findings as a context block into `mma-execute-plan` as shared prior context.
|
|
211
|
-
- Multi-agent follow-up: capture a recall's block and hand it to another tool chain.
|
|
212
|
-
|
|
213
|
-
The block is registered server-side at task completion; no caller action is needed to create it. Delete it explicitly via `DELETE /context-blocks/:id` when no longer needed, or let it expire on session teardown.
|
|
214
|
-
|
|
215
|
-
## Outcome semantics
|
|
216
|
-
|
|
217
|
-
Every task result carries outcome fields that describe the recall's conclusion status:
|
|
218
|
-
|
|
219
|
-
| Field | Type | Meaning |
|
|
220
|
-
|---|---|---|
|
|
221
|
-
| `findingsOutcome` | `'found' \| 'not_applicable'` | Answers the question: did the recall produce substantive learnings? |
|
|
222
|
-
| `findingsOutcomeReason` | `string \| null` | When `findingsOutcome` is set, this explains why (e.g. "No relevant journal nodes found for the query" or "Journal is empty"). |
|
|
223
|
-
| `outcomeInferred` | `boolean` | `true` if the system inferred the outcome from findings count; `false` if the worker explicitly stated it. |
|
|
224
|
-
| `outcomeMalformed` | `boolean` | `true` if the outcome line was malformed and had to be repaired; `false` otherwise. |
|
|
225
|
-
|
|
226
|
-
### Enum values
|
|
227
|
-
|
|
228
|
-
- **`found`** — the recall produced one or more relevant prior learnings (findings) across one or more journal nodes.
|
|
229
|
-
- **`not_applicable`** — the recall could not proceed (the journal is empty, inaccessible, or nothing in it answers the query).
|
|
230
|
-
|
|
231
|
-
### Empty journal ≠ failure
|
|
232
|
-
|
|
233
|
-
A recall that searches the journal and finds nothing relevant is a valid `completed: true` outcome; it simply answers "no prior learnings match that question" — which is useful information before attempting something new.
|
|
234
|
-
|
|
235
|
-
### Per-route legal outcomes
|
|
236
|
-
|
|
237
|
-
The legal outcomes for this route are: `['found', 'not_applicable']`
|
|
238
|
-
|
|
239
|
-
- **`found`** — one or more prior learnings surfaced from the journal.
|
|
240
|
-
- **`not_applicable`** — the journal is empty, inaccessible, or no learnings match the query.
|
|
241
|
-
|
|
242
|
-
@include _shared/error-handling.md
|