memtrace 0.5.15 → 0.6.10
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/hooks/userprompt-claude.sh +12 -6
- package/install.js +0 -19
- package/installer/dist/commands/rail-install.d.ts +7 -0
- package/installer/dist/commands/rail-install.js +37 -0
- package/installer/dist/index.js +20 -1
- package/installer/dist/rail-install.d.ts +20 -0
- package/installer/dist/rail-install.js +183 -0
- package/installer/dist/transformers/claude.d.ts +21 -0
- package/installer/dist/transformers/claude.js +118 -3
- package/installer/dist/transformers/codex.js +17 -0
- package/installer/dist/transformers/cursor.js +23 -1
- package/installer/dist/transformers/gemini.d.ts +3 -0
- package/installer/dist/transformers/gemini.js +78 -0
- package/installer/dist/transformers/index.d.ts +2 -1
- package/installer/dist/transformers/index.js +3 -1
- package/installer/dist/transformers/opencode.js +31 -0
- package/installer/dist/transformers/rail-hooks.d.ts +56 -0
- package/installer/dist/transformers/rail-hooks.js +303 -0
- package/installer/dist/transformers/shared.js +5 -6
- package/installer/dist/transformers/types.d.ts +1 -1
- package/installer/skills/commands/memtrace-fleet-publish-intent.md +51 -0
- package/installer/skills/commands/memtrace-fleet-record-episode.md +48 -0
- package/installer/skills/commands/memtrace-fleet-resolve.md +59 -0
- package/installer/skills/workflows/memtrace-code-review.md +6 -0
- package/installer/skills/workflows/memtrace-first.md +2 -0
- package/installer/skills/workflows/memtrace-fleet-coordination.md +87 -0
- package/installer/skills/workflows/memtrace-fleet-first.md +132 -0
- package/installer/skills/workflows/memtrace-style-fingerprint.md +111 -0
- package/lib/claude-integration.js +6 -0
- package/package.json +6 -6
- package/skills/commands/memtrace-fleet-publish-intent.md +51 -0
- package/skills/commands/memtrace-fleet-record-episode.md +48 -0
- package/skills/commands/memtrace-fleet-resolve.md +59 -0
- package/skills/workflows/memtrace-fleet-coordination.md +87 -0
- package/skills/workflows/memtrace-fleet-first.md +132 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memtrace-fleet-coordination
|
|
3
|
+
description: "Use when you need to understand or act on fleet conflict resolution: what conflict class A/B/C means, how a Class C destructive overlap gets decided (by an agent judge or a human), how to be the judge (fleet_submit_verdict), how to read your directive after a decision, and how branch-scoping isolates fleets. Triggered by: 'two agents are changing the same thing', 'resolve this conflict', 'who should proceed', 'a decision is waiting', acting as a mediator between agents."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- mcp__memtrace__fleet_record_episode
|
|
6
|
+
- mcp__memtrace__fleet_submit_verdict
|
|
7
|
+
- mcp__memtrace__fleet_get_escalation
|
|
8
|
+
- mcp__memtrace__fleet_list_escalations
|
|
9
|
+
- mcp__memtrace__fleet_resolve_escalation
|
|
10
|
+
- mcp__memtrace__fleet_get_node_state
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Fleet Coordination
|
|
14
|
+
|
|
15
|
+
How the fleet turns overlapping edits into a safe decision. Read
|
|
16
|
+
`memtrace-fleet-first` for the publish→edit→record protocol; this skill is the
|
|
17
|
+
*conflict resolution* half.
|
|
18
|
+
|
|
19
|
+
## Conflict classes (what `fleet_record_episode` returns)
|
|
20
|
+
|
|
21
|
+
| Class | Meaning | What to do |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| **A** | Additive, order-independent | Proceed. |
|
|
24
|
+
| **B** | Non-destructive overlap with another agent's work | Re-read the shared symbols, then proceed. |
|
|
25
|
+
| **C** | A **destructive** change (signature change / move / dead-code removal) overlaps another agent's work | A decision is needed — it does NOT auto-resolve. |
|
|
26
|
+
|
|
27
|
+
Class is computed **only against agents on your branch** (`(repo, branch)`).
|
|
28
|
+
Agents on other branches are never conflict peers.
|
|
29
|
+
|
|
30
|
+
## The Class C decision loop
|
|
31
|
+
|
|
32
|
+
When `fleet_record_episode` returns class C it also returns an `escalation_id` and
|
|
33
|
+
(when mediation is on) a `mediation_request`. The decision is made by an **agent
|
|
34
|
+
judge**, a **human**, or — only when provably safe — the **deterministic referee**.
|
|
35
|
+
|
|
36
|
+
### Being the judge (the user's own agent does the judging — no API keys)
|
|
37
|
+
|
|
38
|
+
The `mediation_request` bundles **every agent's `assignment`** plus the contested
|
|
39
|
+
symbols. Read the *other* agent's task and decide on merit (including against your
|
|
40
|
+
own change). Submit:
|
|
41
|
+
|
|
42
|
+
```jsonc
|
|
43
|
+
fleet_submit_verdict({
|
|
44
|
+
escalation_id: "01J…",
|
|
45
|
+
agent_id: "agent-a",
|
|
46
|
+
verdict: { "kind": "recommend", "winner": "agent-b",
|
|
47
|
+
"rationale": "the signature change is the wider contract; rebase the fix onto it",
|
|
48
|
+
"confidence": 0.8 }
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Verdict kinds: `reconcile {merge_plan}` · `recommend {winner, rationale, confidence}`
|
|
53
|
+
· `defer_to_human {question}`.
|
|
54
|
+
|
|
55
|
+
The referee then decides the outcome:
|
|
56
|
+
- **Auto-apply** only when safe: the clear machine case, or ≥2 independent agents
|
|
57
|
+
agree — and **never** for a destructive *removal* (delete/move), which always
|
|
58
|
+
needs a human.
|
|
59
|
+
- **Human confirm** — a recommendation is surfaced for one-click confirmation.
|
|
60
|
+
- **Human required** — both sides destructive, agents disagree, or an agent
|
|
61
|
+
deferred → a person decides.
|
|
62
|
+
|
|
63
|
+
### Reading your directive
|
|
64
|
+
|
|
65
|
+
Poll `fleet_get_escalation({escalation_id, agent_id})` until `your_directive` ≠
|
|
66
|
+
`wait`: `proceed` (you continue), `defer` (stand down / rebase onto the winner),
|
|
67
|
+
`review` (read `resolution`).
|
|
68
|
+
|
|
69
|
+
### Resolving as a human (or on a human's behalf via the dashboard)
|
|
70
|
+
|
|
71
|
+
`fleet_resolve_escalation({escalation_id, resolution, winner})` records a human
|
|
72
|
+
decision and clears the queue. Prefer the agent-judge path; use this for the
|
|
73
|
+
genuine human-decision cases. `fleet_list_escalations({repo_id})` shows the
|
|
74
|
+
"needs human" queue.
|
|
75
|
+
|
|
76
|
+
## Why branch-scoping matters here
|
|
77
|
+
|
|
78
|
+
A "winner / defer" only makes sense on a shared surface. Across branches, the
|
|
79
|
+
loser can't defer (its branch needs the change too), so the fleet never escalates
|
|
80
|
+
cross-branch — that's a merge-time concern git already owns. Keep your fleet to
|
|
81
|
+
one session branch and conflicts stay real and resolvable.
|
|
82
|
+
|
|
83
|
+
## Inspecting state
|
|
84
|
+
|
|
85
|
+
`fleet_get_node_state({repo_id, node})` — recent episodes, active intents, dominant
|
|
86
|
+
intent, and conflict density for one symbol. Use it to understand pressure on a
|
|
87
|
+
hot symbol before you pile on.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memtrace-fleet-first
|
|
3
|
+
description: "Always use FIRST when more than one coding agent works the same repo+branch at once (a 'fleet'), before reading code, planning a refactor, or making an edit. Triggered by: 'I'm about to edit X', 'rename Y across the codebase', joining a running fleet/session branch, coordinating with other agents, prose hand-offs. Do not grep for 'who else is touching this' and do not skip fleet_publish_intent because 'it's a small change'. Fleet coordination is branch-scoped: pass your session branch so your fleet coordinates and stays isolated from agents on other branches. Skip ONLY for genuinely solo sessions or pure docs-only edits where coordination has zero value."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- mcp__memtrace__fleet_status
|
|
6
|
+
- mcp__memtrace__fleet_preflight
|
|
7
|
+
- mcp__memtrace__fleet_publish_intent
|
|
8
|
+
- mcp__memtrace__fleet_record_episode
|
|
9
|
+
- mcp__memtrace__fleet_get_escalation
|
|
10
|
+
- mcp__memtrace__fleet_submit_verdict
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Fleet First
|
|
14
|
+
|
|
15
|
+
The coordination layer for **fleets of coding agents** working the same repo at the
|
|
16
|
+
same time. It stops agents from silently clobbering each other's edits, and turns
|
|
17
|
+
unsafe overlaps into a clear decision instead of a merge-time surprise.
|
|
18
|
+
|
|
19
|
+
## The Iron Law
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
IN A FLEET → FLEET TOOLS BEFORE EDITS. NO EXCEPTIONS.
|
|
23
|
+
1. fleet_publish_intent (declare what you'll touch; get blast radius + conflicts)
|
|
24
|
+
2. edit (your normal edit loop)
|
|
25
|
+
3. fleet_record_episode (classify A/B/C; if C, the loop resolves it)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
A typed intent serializes to ~20 tokens; a prose "I'm going to change X" averages
|
|
29
|
+
200+. A 10-agent fleet × 100 edits = tens of thousands of tokens saved per
|
|
30
|
+
fleet-turn — and zero silent overwrites — when the protocol is followed.
|
|
31
|
+
|
|
32
|
+
## A fleet = agents on ONE branch (always pass it)
|
|
33
|
+
|
|
34
|
+
**Coordination is branch-scoped.** Two agents only coordinate when they're on the
|
|
35
|
+
**same `(repo, branch)`**. The branch name is the fleet identifier: a *session
|
|
36
|
+
branch* is how a group of agents opts into one coordinating fleet.
|
|
37
|
+
|
|
38
|
+
- Working a session branch (`session/auth-revamp`)? Pass `branch` on **every**
|
|
39
|
+
fleet call. Your fleet coordinates together and stays isolated from agents on
|
|
40
|
+
other branches.
|
|
41
|
+
- Omit `branch` only for the shared default pool (single, unnamed fleet).
|
|
42
|
+
- Agents on **different** branches never conflict — git already isolates them, and
|
|
43
|
+
whether branches merge isn't guaranteed, so the fleet never reasons across them.
|
|
44
|
+
|
|
45
|
+
```jsonc
|
|
46
|
+
{ "repo_id": "myrepo", "branch": "session/auth-revamp",
|
|
47
|
+
"agent_id": "agent-a", "touched": ["auth::verify_token"],
|
|
48
|
+
"intent": {"refactor": {"pattern": "change_signature"}},
|
|
49
|
+
"assignment": "widen verify_token signature for pagination" }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Always include **`assignment`** — your natural-language task. When a conflict
|
|
53
|
+
happens, that's what the judge (another agent) or a human reads to reconcile.
|
|
54
|
+
|
|
55
|
+
## Check the fleet first (once per session)
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
fleet_status() → live_intents, active_agents, pending_escalations, mediator_mode
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If it responds, fleet coordination is active — follow this skill for every edit.
|
|
62
|
+
An empty fleet is **not** permission to skip: it just means you're the first agent
|
|
63
|
+
in this window.
|
|
64
|
+
|
|
65
|
+
## The protocol, step by step
|
|
66
|
+
|
|
67
|
+
1. **Before editing** — `fleet_preflight({repo_id, branch, agent_id, touched, intent})`
|
|
68
|
+
(read-only) or go straight to `fleet_publish_intent(...)`. You get the blast
|
|
69
|
+
radius, any overlapping live intents on your branch, and a `coordination` block
|
|
70
|
+
that may already suggest who owns a contested symbol.
|
|
71
|
+
2. **Edit** — your normal loop.
|
|
72
|
+
3. **After editing** — `fleet_record_episode({repo_id, branch, agent_id, touched, intent})`.
|
|
73
|
+
It returns a `conflict_class`:
|
|
74
|
+
- **A — proceed.** Additive, order-independent. Nothing to do.
|
|
75
|
+
- **B — re-read, then proceed.** You overlap non-destructively; re-read the
|
|
76
|
+
shared symbols so you build on current state.
|
|
77
|
+
- **C — a decision is needed.** A destructive change overlaps another agent's
|
|
78
|
+
work. This does **not** auto-resolve — see below.
|
|
79
|
+
|
|
80
|
+
## Class C: the decision loop (read this)
|
|
81
|
+
|
|
82
|
+
A Class C means two edit paths can't both land safely. `fleet_record_episode`
|
|
83
|
+
returns an `escalation_id` and a `mediation_request` (when mediation is enabled).
|
|
84
|
+
What happens next depends on who judges:
|
|
85
|
+
|
|
86
|
+
- **You may be asked to judge.** The `mediation_request` carries **every agent's
|
|
87
|
+
assignment** — including the other side's. Read them and submit a verdict with
|
|
88
|
+
`fleet_submit_verdict({escalation_id, agent_id, verdict})`, where `verdict` is one
|
|
89
|
+
of:
|
|
90
|
+
- `{"kind":"reconcile","merge_plan":"…"}` — the changes combine; here's how.
|
|
91
|
+
- `{"kind":"recommend","winner":"<agent_id>","rationale":"…","confidence":0.0-1.0}` —
|
|
92
|
+
one path should continue.
|
|
93
|
+
- `{"kind":"defer_to_human","question":"…"}` — a real product call; ask a human.
|
|
94
|
+
- **A human may decide** in the Fleet dashboard. Either way the outcome flows back
|
|
95
|
+
to you.
|
|
96
|
+
- **Close YOUR loop**: poll `fleet_get_escalation({escalation_id, agent_id})` until
|
|
97
|
+
`your_directive` is no longer `wait`:
|
|
98
|
+
- `proceed` — you were chosen; continue.
|
|
99
|
+
- `defer` — another path won; stand down and rebase your work onto it.
|
|
100
|
+
- `review` — read the free-text `resolution`.
|
|
101
|
+
|
|
102
|
+
The daemon is a deterministic referee: it never auto-applies a destructive
|
|
103
|
+
*removal* (delete/move) without a human, and only auto-applies when it's safe (a
|
|
104
|
+
clear machine case, or independent agent consensus). So the judge being wrong
|
|
105
|
+
degrades to "a human reviews a suggestion," never a silent bad merge.
|
|
106
|
+
|
|
107
|
+
## Routing — what do you need?
|
|
108
|
+
|
|
109
|
+
| You're about to… | Do this |
|
|
110
|
+
|---|---|
|
|
111
|
+
| Start any edit in a fleet | `fleet_publish_intent` (declare it) — never skip |
|
|
112
|
+
| Check before declaring | `fleet_preflight` (read-only "is the coast clear?") |
|
|
113
|
+
| Finish an edit | `fleet_record_episode` (get A/B/C) |
|
|
114
|
+
| Got a Class C as the judge | `fleet_submit_verdict` (reconcile/recommend/defer) |
|
|
115
|
+
| Blocked on a Class C | poll `fleet_get_escalation` until `your_directive ≠ wait` |
|
|
116
|
+
| See who's in the fleet | `fleet_status` (active_agents, pending decisions) |
|
|
117
|
+
| Inspect a symbol's coordination state | `fleet_get_node_state` |
|
|
118
|
+
|
|
119
|
+
## Parameter notes
|
|
120
|
+
|
|
121
|
+
- Pass `intent` as JSON (externally-tagged, snake_case):
|
|
122
|
+
`{"refactor":{"pattern":"rename_symbol"}}`, `{"bug_fix":{"defect":"logic_error"}}`.
|
|
123
|
+
Destructive kinds: `refactor/change_signature`, `refactor/move_symbol`,
|
|
124
|
+
`cleanup/dead_code` — these are what trigger Class C over shared symbols.
|
|
125
|
+
- `touched` is a list of qualified symbol identities (e.g. `"module::Symbol"`).
|
|
126
|
+
- Always include `branch` (your session branch) and `assignment` (your task).
|
|
127
|
+
|
|
128
|
+
## When to skip
|
|
129
|
+
|
|
130
|
+
Skip the protocol only for a genuinely **solo** session (you're the only agent and
|
|
131
|
+
no one else shares your branch) or **pure docs-only** edits where coordination has
|
|
132
|
+
zero value. Everything else in a fleet goes through the protocol.
|