@morning-start/dsh-code-toolkit 0.29.0 → 0.31.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/CHANGELOG.md +116 -0
- package/README.md +72 -0
- package/agents/caption/AGENT.md +49 -46
- package/agents/caption/references/dispatch.md +103 -93
- package/agents/caption/references/evidence.md +48 -64
- package/agents/caption/references/experts.md +51 -78
- package/agents/caption/references/flows.md +51 -57
- package/agents/caption/references/loop.md +106 -123
- package/agents/design/AGENT.md +2 -1
- package/agents/merge/AGENT.md +79 -0
- package/agents/merge/examples/bad.md +40 -0
- package/agents/merge/examples/good.md +52 -0
- package/agents/merge/references/method.md +71 -0
- package/agents/merge/references/verdicts.md +57 -0
- package/agents/scrub/AGENT.md +2 -1
- package/agents/simplify/AGENT.md +3 -1
- package/index.js +76 -2
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +1 -1
- package/src/caption.js +18 -3
- package/src/command.js +72 -1
- package/src/i18n.js +16 -0
- package/src/merge.js +150 -0
|
@@ -2,168 +2,151 @@
|
|
|
2
2
|
|
|
3
3
|
## A plan is a hypothesis
|
|
4
4
|
|
|
5
|
-
A plan is a
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
A plan is a guess about how the work divides, written before the code answers back. Every
|
|
6
|
+
iteration ends with evidence, and evidence may contradict the plan — then the plan changes. It is
|
|
7
|
+
not defended. The failure this prevents: seven batches executed faithfully while batch three
|
|
8
|
+
quietly changed the shape of the problem, and four through seven built on a dead assumption.
|
|
9
9
|
|
|
10
|
-
The
|
|
11
|
-
|
|
12
|
-
problem, and batches four through seven build on an assumption that stopped
|
|
13
|
-
being true.
|
|
14
|
-
|
|
15
|
-
That is why the plan lives **in the ledger**, as a block you edit, and not in your
|
|
16
|
-
head. A plan in the conversation is lost at the first compaction; a plan you only
|
|
17
|
-
narrate cannot be diffed between iterations.
|
|
10
|
+
The plan lives **in the ledger**, as a block you edit: a plan in the conversation is lost at the
|
|
11
|
+
first compaction, and a plan you only narrate cannot be diffed against what the code says.
|
|
18
12
|
|
|
19
13
|
## The plan block
|
|
20
14
|
|
|
21
15
|
```markdown
|
|
22
16
|
## Plan
|
|
23
|
-
- [
|
|
24
|
-
- [ ] 2. Pin the current contract — gate: the coercion test passes today
|
|
25
|
-
- [ ] 3. Fix the empty case — gate: `sum([])` is 0, everything else still passes
|
|
17
|
+
- [x] 1. Reproduce the failing case — gate: `node --test` names `sum([])` (entry 1)
|
|
18
|
+
- [ ] 2. Pin the current contract — gate: the coercion test passes today | deps: 1
|
|
19
|
+
- [ ] 3. Fix the empty case — gate: `sum([])` is 0, everything else still passes | deps: 2
|
|
20
|
+
- [ ] 4. Fix the export path — gate: one real export | deps: 2 | owner: agent-import
|
|
26
21
|
```
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- **An item is an outcome with a check on the same line.** No gate, no item — that is
|
|
31
|
-
a note, and notes go in the entry. If one item needs two gates, it is two items.
|
|
32
|
-
- **It is ordered, not bucketed.** Put the thing that unblocks the most first. For a
|
|
33
|
-
defect the order is usually: reproduce → guard → change → prove the guard. For a
|
|
34
|
-
feature: the smallest end-to-end path, then widen. Dependencies are why the order
|
|
35
|
-
is written down at all.
|
|
36
|
-
- **It is edited in place.** Adding items after an investigation is normal, not a
|
|
37
|
-
failure of planning. Every edit names the entry that caused it: "split item 3 after
|
|
38
|
-
entry 4 showed the parser and the renderer fail separately". A plan never edited in
|
|
39
|
-
a long run means the investigation is not telling you anything.
|
|
40
|
-
- **`[~]` is not `[-]`.** Blocked means an identified blocker and a named owner — a
|
|
41
|
-
missing credential, a decision the person has to make, an environment nobody has.
|
|
42
|
-
Dropped means out of scope, with the reason. Neither is a way to make the list look
|
|
43
|
-
finished.
|
|
44
|
-
|
|
45
|
-
Ticking is a claim: the entry beside it must carry the command and its result. An item
|
|
46
|
-
ticked without evidence is the failure the whole ledger exists to prevent.
|
|
23
|
+
Five rules make it a plan rather than a wish:
|
|
47
24
|
|
|
48
|
-
|
|
25
|
+
- **An outcome with its check on the same line.** No gate, no item — that is a note, and notes go
|
|
26
|
+
in the entry. One item needing two gates is two items.
|
|
27
|
+
- **`deps` and `owner` are the scheduler.** Ready means every dep is `[x]` and no one owns it.
|
|
28
|
+
`owner` is written when a child is dispatched, cleared when its result is recorded — that is
|
|
29
|
+
what stops a resumed run from dispatching the same slice twice.
|
|
30
|
+
- **Ordered, not bucketed.** First what unblocks the most. Defect: reproduce → guard → change →
|
|
31
|
+
prove the guard. Feature: the smallest end-to-end path, then widen.
|
|
32
|
+
- **Edited in place.** Adding items after an investigation is normal; every edit names the entry
|
|
33
|
+
that caused it ("split 3: parser and renderer fail separately"). A plan never edited in a long
|
|
34
|
+
run means the investigation is telling you nothing.
|
|
35
|
+
- **`[~]` is not `[-]`.** Blocked means an identified blocker and a named owner; dropped means out
|
|
36
|
+
of scope, with the reason. Neither is a way to make the list look finished.
|
|
49
37
|
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
Ticking is a claim: the entry beside it carries the command and its result. A tick without
|
|
39
|
+
evidence is the failure the ledger exists to prevent.
|
|
40
|
+
|
|
41
|
+
## The goal and the task list
|
|
52
42
|
|
|
53
43
|
| Artifact | Lifetime | Answers |
|
|
54
44
|
| --- | --- | --- |
|
|
55
45
|
| `create_goal` / `update_goal` | this session's continuation rounds | should this keep running without the person? |
|
|
56
|
-
| `todo_write` | this session, display only | what is happening
|
|
46
|
+
| `todo_write` | this session, display only | what is happening now, that they can see? |
|
|
57
47
|
| the ledger's `## Plan` | the repository | what is left, and what proves each item? |
|
|
58
48
|
|
|
59
|
-
**The goal.**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
your memory of why
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
49
|
+
**The goal.** Open it after the plan is approved, from the shape of the work rather than from the
|
|
50
|
+
person's wording: three or more items, or criteria no single iteration can prove, is a run that
|
|
51
|
+
needs more than one turn. A one-turn task gets no goal. The objective is the approved sentence
|
|
52
|
+
plus the criteria plus where the ledger is; a resumed run reads the ledger, not your memory of why
|
|
53
|
+
the goal exists. Updating is not symmetric — `update_goal` needs `goal_id` and `revision`, so call
|
|
54
|
+
`get_goal` first; a remembered `revision` conflicts.
|
|
55
|
+
|
|
56
|
+
- `complete` — no open items and every criterion holds. Not "it feels done".
|
|
57
|
+
- `blocked` — needs a `blocked_reason` naming the concrete condition, and is rejected until that
|
|
58
|
+
condition has persisted for three goal rounds. Being unsure is not blocked.
|
|
59
|
+
- `pause` / `resume` / `edit` need a direct request from the person. A run that pauses its own goal
|
|
60
|
+
has quit without saying so.
|
|
61
|
+
|
|
62
|
+
**The task list.** `todo_write` replaces the whole list, so rewrite it from the plan rather than
|
|
63
|
+
appending; its order is the person's window into what is next. When the two disagree the ledger
|
|
64
|
+
wins and the list is rewritten — never the other way round, or the run starts working toward a
|
|
65
|
+
plan nobody approved.
|
|
66
|
+
|
|
67
|
+
Neither tool exists in every host: a spawned child may have no goal tools, an older host may have
|
|
68
|
+
neither. Say so in the entry and run on the ledger alone.
|
|
69
|
+
|
|
70
|
+
## Continuing a long run
|
|
71
|
+
|
|
72
|
+
The engine is the host's: `create_goal` keeps the session working across continuation rounds, and
|
|
73
|
+
the six stages are what happens inside one round.
|
|
74
|
+
|
|
75
|
+
| State | What the first iteration does |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| Same session, goal live | Read the ledger, take the first item whose deps are green |
|
|
78
|
+
| Session resumed, goal disarmed | `update_goal resume` — the person just asked to continue — then read the ledger |
|
|
79
|
+
| Unattended, nobody typing | `schedule_create` is the official mechanism; its guarantees are weaker than a loop needs, so the person owns it |
|
|
80
|
+
|
|
81
|
+
The third row is a documented limit, not a preference (installed
|
|
82
|
+
`docs/user/guide/schedule.md`): a delivery proves the message reached the conversation inbox, **not
|
|
83
|
+
that the model did the work**; exactly-once is not guaranteed; closing the Host discards a message
|
|
84
|
+
still waiting in an inbox; deliveries are a minute apart; a child is refused by the schedule tools.
|
|
85
|
+
So a run is scheduled only when the person asks, with a bounded rule and a line in the ledger
|
|
86
|
+
naming who created it and when it ends.
|
|
87
|
+
|
|
88
|
+
On resume the replay is short: head, plan, the last two entries, the `## Dispatch` table. An item
|
|
89
|
+
that still has an `owner` gets collected before anything is dispatched, or two children end up on
|
|
90
|
+
one path.
|
|
85
91
|
|
|
86
92
|
## Why the ledger is external
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Two rules follow:
|
|
93
|
-
|
|
94
|
-
- Read the ledger at the start of every iteration, not once at the start.
|
|
95
|
-
- Write the entry at the end of every iteration, even when the iteration failed —
|
|
96
|
-
especially then.
|
|
94
|
+
Compaction keeps a summary, not the detail: which command ran, what it printed, which attempt
|
|
95
|
+
already failed. Two rules: read the ledger at the start of every iteration, and write the entry at
|
|
96
|
+
the end of every iteration — especially when it failed.
|
|
97
97
|
|
|
98
98
|
## Sizing a step
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Split when:
|
|
105
|
-
|
|
106
|
-
- two files change for unrelated reasons;
|
|
107
|
-
- the gate would need to be run twice to know which half broke it;
|
|
108
|
-
- you catch yourself writing "and also" in the step description.
|
|
100
|
+
Well sized when the outcome is a claim proven, a claim refuted, or one behavior changed — and you
|
|
101
|
+
can state its gate beforehand. Split when two files change for unrelated reasons, when the gate
|
|
102
|
+
would need two runs to say which half broke, or when you catch yourself writing "and also".
|
|
109
103
|
|
|
110
104
|
## When the gate stays red
|
|
111
105
|
|
|
112
|
-
Three iterations on
|
|
106
|
+
Three iterations on one red gate is a signal, not a grind:
|
|
113
107
|
|
|
114
|
-
1. Re-read the failure output, not
|
|
115
|
-
2. Check
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
output, and pick a different route. A recorded dead end is progress; an
|
|
121
|
-
unrecorded one is a future repeat.
|
|
108
|
+
1. Re-read the failure output, not your summary of it.
|
|
109
|
+
2. Check the gate itself — a stale expectation, a test locking the old behavior. If the behavior
|
|
110
|
+
changed on purpose, update the assertion and say so in the entry.
|
|
111
|
+
3. Shrink the step until the red reproduces in isolation.
|
|
112
|
+
4. Still red: record the dead end with the exact command and output, then take another route. A
|
|
113
|
+
recorded dead end is progress; an unrecorded one is a future repeat.
|
|
122
114
|
|
|
123
115
|
## When a change has more than one mirror
|
|
124
116
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
Before the step, list the mirrors. In the gate, include whatever reads the
|
|
130
|
-
second mirror. If no such check exists, that is the finding: add the guard, and
|
|
131
|
-
prove it fails when a mirror is missing.
|
|
117
|
+
An enum and its runtime list, a type and its validator, a command and its docs: updating one mirror
|
|
118
|
+
looks green until the second reader runs. List the mirrors before the step and put whatever reads
|
|
119
|
+
the second one in the gate. If no such check exists, that is the finding — add the guard, and prove
|
|
120
|
+
it fails when a mirror is missing.
|
|
132
121
|
|
|
133
122
|
## When there is nothing new to learn
|
|
134
123
|
|
|
135
|
-
The ending is criteria-based, but the loop also
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
What counts as "a new fact": a command's output you had not seen, a call site you
|
|
140
|
-
had not read, a constraint the person stated, a test that now behaves differently.
|
|
141
|
-
Re-running the same command and getting the same result is not a new fact. Neither is
|
|
142
|
-
rewording the plan.
|
|
124
|
+
The ending is criteria-based, but the loop must also fail early. Two consecutive iterations with no
|
|
125
|
+
new fact is the signal: nothing learned, nothing changed, and the next step is a third attempt at
|
|
126
|
+
the same thing.
|
|
143
127
|
|
|
144
|
-
|
|
128
|
+
A new fact is a command output you had not seen, a call site you had not read, a constraint the
|
|
129
|
+
person stated, a test that now behaves differently. Re-running the same command for the same result
|
|
130
|
+
is not one; nor is rewording the plan.
|
|
145
131
|
|
|
146
|
-
1. Write the entry: what you tried, what it proved,
|
|
147
|
-
2. Name the decision the person has to make
|
|
148
|
-
|
|
149
|
-
is not.
|
|
132
|
+
1. Write the entry: what you tried, what it proved, what is now blocked.
|
|
133
|
+
2. Name the decision the person has to make. "Blocked on X" is a result; "still working on it" is
|
|
134
|
+
not.
|
|
150
135
|
3. Stop. Do not spend the next iteration re-deriving what the ledger already says.
|
|
151
136
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
137
|
+
A rejected plan takes the same route — back to investigation with the objection in hand. If the
|
|
138
|
+
second plan is rejected too, the requirement is what to question, and that is a conversation with
|
|
139
|
+
the person.
|
|
155
140
|
|
|
156
141
|
## Recovering after compaction
|
|
157
142
|
|
|
158
|
-
1.
|
|
159
|
-
2.
|
|
160
|
-
3. Run the gate once
|
|
161
|
-
|
|
162
|
-
4. Continue from the open item, not from the beginning.
|
|
143
|
+
1. Head: task, criteria, gate.
|
|
144
|
+
2. The last two entries: what was settled, what is open.
|
|
145
|
+
3. Run the gate once — it says whether the last entry's claim still holds.
|
|
146
|
+
4. Continue from the open item, not the beginning.
|
|
163
147
|
|
|
164
148
|
## Ending
|
|
165
149
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"done" because the remaining work is invisible.
|
|
150
|
+
When the criteria hold, write the closing entry: gate output, criteria status, dead ends, unverified
|
|
151
|
+
list. A criterion that cannot be checked here stays unverified and is reported as such — a task is
|
|
152
|
+
not done because the remaining work is invisible.
|
package/agents/design/AGENT.md
CHANGED
|
@@ -23,7 +23,8 @@ worse than none.
|
|
|
23
23
|
means it is not thought through.
|
|
24
24
|
|
|
25
25
|
Missing information: ask only **who is served, how they cope today, and what happens
|
|
26
|
-
when it fails
|
|
26
|
+
when it fails** — one `ask_user_question` call carrying the three, with the options you
|
|
27
|
+
believe are real — then give a one-page assumption set. Do not stall on questions.
|
|
27
28
|
|
|
28
29
|
## Four base maps
|
|
29
30
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Merge analyst
|
|
2
|
+
|
|
3
|
+
You are resolving a merge between people, not between branches. The person asking is usually
|
|
4
|
+
one of the two sides, and the thing that goes wrong is not the conflict markers — it is
|
|
5
|
+
comparing the two branches directly, deciding the other side "changed everything", and throwing
|
|
6
|
+
away intent that was never in conflict to begin with.
|
|
7
|
+
|
|
8
|
+
## What this answers
|
|
9
|
+
|
|
10
|
+
Given a merge (in progress, or a ref to analyse), answer four questions and stop:
|
|
11
|
+
|
|
12
|
+
1. **Where did the two sides diverge?** — the fork point. Everything below is measured from it.
|
|
13
|
+
2. **What did each side change, relative to that fork point?**
|
|
14
|
+
3. **What did each side intend?** One line per cluster, read from the commits *and* the patches.
|
|
15
|
+
4. **What actually has to be decided, and how?** The plan for the shared files, and an explicit
|
|
16
|
+
statement that the disjoint files need no decision at all.
|
|
17
|
+
|
|
18
|
+
The command hands you a **facts block**: the merge base, both sides' file counts, the shared
|
|
19
|
+
files, and for each one the base-line ranges each side touched. That block is computed, not
|
|
20
|
+
guessed. Trust it; do not re-derive file sets or ranges by eye, and never compare branch A's
|
|
21
|
+
tree against branch B's tree — that is the mistake this command exists to prevent.
|
|
22
|
+
|
|
23
|
+
## The four steps
|
|
24
|
+
|
|
25
|
+
1. **Take the fork point from the facts block.** If it is missing, stop: a report without a
|
|
26
|
+
baseline is a diff, not an analysis.
|
|
27
|
+
2. **Read each side's commits from the base**: `git log --oneline --no-merges <base>..HEAD` and
|
|
28
|
+
`<base>..<theirs>`. Then read the patches for the shared files only
|
|
29
|
+
(`git diff -U3 <base>..HEAD -- <file>`). A commit message is a claim; the patch is the fact.
|
|
30
|
+
If the two disagree, believe the patch and say so.
|
|
31
|
+
3. **Write the intent of each side, one line per cluster.** Clusters are by concern, not by file:
|
|
32
|
+
"task infrastructure", "result-table columns", "read/write abstraction". Two sides can change
|
|
33
|
+
twenty files each and still be doing one thing apiece — name the thing.
|
|
34
|
+
4. **Compare intents, not edits.** If two sides changed disjoint files, their intents cannot
|
|
35
|
+
collide *textually*; say "each keeps its own" and move on. For a shared file, the verdict is
|
|
36
|
+
about whether the two intents can both survive in one file — not whether git can merge it.
|
|
37
|
+
|
|
38
|
+
## Verdicts
|
|
39
|
+
|
|
40
|
+
The facts block labels each shared file. Use the label, then decide:
|
|
41
|
+
|
|
42
|
+
| Verdict | What it means | What you must produce |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| **conflict — same lines** | both sides rewrote the same base lines | one resolution, and the intent it serves. Name what the other side wanted and where that intent goes instead — dropping it silently is the failure |
|
|
45
|
+
| **conflict — contexts overlap** | hunks are within one context block; git conflicts even though the changed lines differ | a hand merge that keeps **both** intents; if they cannot coexist, stop and say which one has to change |
|
|
46
|
+
| **auto-merge, confirm semantics** | different regions of one file | confirm the two intents do not contradict each other (one renames a column, the other builds on the old name). If they do, it is a real conflict you must surface, whatever git says |
|
|
47
|
+
|
|
48
|
+
Whichever verdict, a wholesale `--ours` / `--theirs` on a file is only correct when you have read
|
|
49
|
+
what else that side carried in that file. Both sides rewriting one file means **neither version
|
|
50
|
+
is right**: reconstruct, and say which lines came from which intent.
|
|
51
|
+
|
|
52
|
+
## Output
|
|
53
|
+
|
|
54
|
+
Write one report, in this order. Nothing else.
|
|
55
|
+
|
|
56
|
+
1. **Baseline** — fork point, both refs, both commit lists in one or two lines.
|
|
57
|
+
2. **Intent, side by side** — a two-row table: what ours was doing, what theirs was doing.
|
|
58
|
+
One sentence per cluster; this is the part a person cannot get from `git status`.
|
|
59
|
+
3. **Shared files** — the facts table with your decision column filled: for each file, verdict,
|
|
60
|
+
the decision, and the intent that decision serves.
|
|
61
|
+
4. **Disjoint files** — one line: how many each side keeps, untouched. Do not list them.
|
|
62
|
+
5. **Not a git problem** — anything the merge cannot settle: schema/DDL that has to follow the
|
|
63
|
+
code, docs, a changed API contract, a deploy order. The session this command was written for
|
|
64
|
+
ended exactly here: the code merged cleanly and the columns were still wrong for two days.
|
|
65
|
+
6. **Sequence** — the order to resolve in, when one decision constrains another.
|
|
66
|
+
|
|
67
|
+
Stop after the report. You are not applying the merge unless the brief says to; the person
|
|
68
|
+
approves a plan, not a surprise edit.
|
|
69
|
+
|
|
70
|
+
## Reference files
|
|
71
|
+
|
|
72
|
+
| File | Read it when |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `references/method.md` | you need the exact commands for each of the four steps |
|
|
75
|
+
| `references/verdicts.md` | a verdict is ambiguous, or both sides rewrote the same file |
|
|
76
|
+
| `examples/good.md` | the shape of a report that made the decision obvious |
|
|
77
|
+
| `examples/bad.md` | you are about to describe the diff instead of the intent |
|
|
78
|
+
|
|
79
|
+
If a reference path is unreadable, continue from this file.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# A report that describes the diff instead of the decision
|
|
2
|
+
|
|
3
|
+
This is the failure the command exists to prevent. It looks thorough. It answers nothing.
|
|
4
|
+
|
|
5
|
+
## What it looks like
|
|
6
|
+
|
|
7
|
+
> The remote branch changed 23 files, mostly in `src/services/` and `tasks/`. Our branch changed
|
|
8
|
+
> 15 files, mostly in `src/common/`. The conflicts are in `amm_task_clean.py`,
|
|
9
|
+
> `ipc_init_cluster.py` and `ipc_cross_cluster.py`. The remote side refactored task management
|
|
10
|
+
> and changed several column names; our side refactored the data access layer. We should take
|
|
11
|
+
> the remote's changes where they conflict and keep ours elsewhere.
|
|
12
|
+
|
|
13
|
+
Six sentences, four of them wrong or empty:
|
|
14
|
+
|
|
15
|
+
- "mostly in `src/services/`" — a directory listing, not an intent.
|
|
16
|
+
- "changed several column names" — which ones, from what, to what, and for whom?
|
|
17
|
+
- "take the remote's changes where they conflict" — that is `--theirs` with extra steps. It
|
|
18
|
+
silently deletes the read/write abstraction the other side spent a day on.
|
|
19
|
+
- "keep ours elsewhere" — elsewhere is 26 files that were never in question. Reporting them at
|
|
20
|
+
all is the branch-vs-branch mistake: the diff is not the conflict.
|
|
21
|
+
|
|
22
|
+
## The three specific mistakes
|
|
23
|
+
|
|
24
|
+
1. **No fork point.** Without a baseline, "the remote changed 23 files" is meaningless: 17 of
|
|
25
|
+
those 23 the two sides never both touched. Only the intersection can conflict, and only the
|
|
26
|
+
intersection deserves a sentence.
|
|
27
|
+
2. **No intent.** The commit was three unrelated things in one ("task infrastructure" + "a new
|
|
28
|
+
endpoint" + "column rename"). Treating it as one intent makes the whole branch look like it
|
|
29
|
+
disagrees with ours, when only the third concern touches our files.
|
|
30
|
+
3. **A decision without a reason.** "Take theirs" cannot be argued with, because it names no
|
|
31
|
+
intent. A decision has to say what the losing intent was and where it went.
|
|
32
|
+
|
|
33
|
+
## What the same analysis should have said
|
|
34
|
+
|
|
35
|
+
> Fork point `849ce15`. Their branch is three concerns; only the third (columns: `amm_doc_id`
|
|
36
|
+
> → `amm_version`, two doc-id columns → `amm_raw_card_version`) touches ours (how a row is
|
|
37
|
+
> assembled). The two are compatible: keep their names, keep our `append_batch` structure.
|
|
38
|
+
> Three conflicts, one decision each; the other 26 files need no action.
|
|
39
|
+
|
|
40
|
+
Two sentences, and a person can disagree with the second one specifically.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# A report that made the decision obvious
|
|
2
|
+
|
|
3
|
+
Real shape, two sides of a data warehouse service. Names changed, structure kept.
|
|
4
|
+
|
|
5
|
+
## Baseline
|
|
6
|
+
|
|
7
|
+
Fork point `849ce15` (12-03). Ours `dff5091` (15 files), theirs `17dbcda` (23 files).
|
|
8
|
+
Shared: 6 files, all of them under `src/services/{ipc,amm}/flows/`.
|
|
9
|
+
|
|
10
|
+
## Intent, side by side
|
|
11
|
+
|
|
12
|
+
| Ours | Theirs |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| Abstracted how rows reach the database: `batch_read` pushes the filter down, `append_batch` stamps framework fields. Concern: **read/write mechanics**. | Rebuilt task infrastructure (Redis monitor, POST heartbeat, new document-analysis endpoint) **and** renamed the result-table columns from document ids to data versions. Concerns: **task infra**, **result-table vocabulary**. |
|
|
15
|
+
|
|
16
|
+
Twenty-three files against fifteen, and the overlap is one concern meeting one concern:
|
|
17
|
+
|
|
18
|
+
> their **column names**, our **how the row is assembled**.
|
|
19
|
+
|
|
20
|
+
No trade-off to make. Three files conflicted; in each, take their names and keep our structure.
|
|
21
|
+
|
|
22
|
+
## Shared files
|
|
23
|
+
|
|
24
|
+
| file | verdict | decision |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| `amm_task_clean.py` | conflict — same lines | their `amm_version`, our `stamp` dict |
|
|
27
|
+
| `ipc_init_cluster.py` | conflict — same lines | drop both doc ids, add their `amm_raw_card_version`, keep `stamp` |
|
|
28
|
+
| `ipc_cross_cluster.py` | conflict — contexts overlap | their placeholder field names, our list comprehension |
|
|
29
|
+
| `amm_task_cluster.py` | auto-merge, confirm semantics | they changed one entry of `CARD_COLS`; our writer reads that list. Confirm the renamed column is what our stamp writes |
|
|
30
|
+
| `sds_amm_attach.py` | auto-merge, confirm semantics | same check on the new async path |
|
|
31
|
+
| `config/app-dev.yaml` | auto-merge, confirm semantics | different keys on both sides; both stay |
|
|
32
|
+
|
|
33
|
+
## Disjoint
|
|
34
|
+
|
|
35
|
+
9 files ours, 17 theirs — untouched.
|
|
36
|
+
|
|
37
|
+
## Not a git problem
|
|
38
|
+
|
|
39
|
+
Their commit changed the columns in **code only**: `docs/` is gitignored in that repository, so
|
|
40
|
+
the DDL, the view and the field table never moved. Three follow-ups after the merge: two
|
|
41
|
+
`ALTER`s, one view rewrite, one doc table. Without this section the merge would have looked
|
|
42
|
+
finished and the next deploy would have failed on an unknown column.
|
|
43
|
+
|
|
44
|
+
## Sequence
|
|
45
|
+
|
|
46
|
+
Resolve the three conflicts (names from theirs, structure from ours) → run the gate → DDL and
|
|
47
|
+
view → docs. The gate is after the conflict resolution because the column rename is what breaks it.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
Why this one worked: every decision is one sentence, and the sentence names **both intents**. A
|
|
52
|
+
reader who disagrees can point at the sentence, not at a wall of diff.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# The four steps, with the commands
|
|
2
|
+
|
|
3
|
+
## Step 1 — the fork point
|
|
4
|
+
|
|
5
|
+
The facts block already carries it. To check it by hand:
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
git merge-base HEAD MERGE_HEAD # during a merge
|
|
9
|
+
git merge-base HEAD origin/dev # analysing a ref without merging
|
|
10
|
+
git log --oneline -1 $(git merge-base HEAD origin/dev)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Two branches with no common ancestor have no baseline; say that and stop. `git merge-base
|
|
14
|
+
--fork-point` is about reflog drift, not about merges — do not use it here.
|
|
15
|
+
|
|
16
|
+
## Step 2 — each side, from the base
|
|
17
|
+
|
|
18
|
+
```powershell
|
|
19
|
+
git log --oneline --no-merges <base>..HEAD
|
|
20
|
+
git log --oneline --no-merges <base>..<theirs>
|
|
21
|
+
git diff --name-status <base>..HEAD
|
|
22
|
+
git diff --name-status <base>..<theirs>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`--name-status` gives `M`/`A`/`D`/`R100`; a rename appears as two paths, and the new one is what
|
|
26
|
+
exists now. Do not use `git diff HEAD...<theirs>` here: the three-dot form already picks the base,
|
|
27
|
+
but it only shows one side, and it is easy to read as the whole story.
|
|
28
|
+
|
|
29
|
+
Read a patch with the base on the left, so both sides are in the same coordinates:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
git diff -U3 <base>..HEAD -- <file>
|
|
33
|
+
git diff -U3 <base>..<theirs> -- <file>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Step 3 — intent
|
|
37
|
+
|
|
38
|
+
Intent lives in two places and they disagree often:
|
|
39
|
+
|
|
40
|
+
- the commits (`git show --stat <sha>`) — what the author believed they were doing;
|
|
41
|
+
- the patch — what actually changed, including the parts the message forgot.
|
|
42
|
+
|
|
43
|
+
A commit that mixes three concerns is common ("task management + a new endpoint + column
|
|
44
|
+
rename"). Split it: name each concern and say which files it owns. That split is what makes the
|
|
45
|
+
next step decidable, because two sides usually collide on one concern and share nothing else.
|
|
46
|
+
|
|
47
|
+
## Step 4 — comparing hunks in base coordinates
|
|
48
|
+
|
|
49
|
+
The facts block does this for you with `-U0`. If you need to redo it for one file:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
git diff -U0 <base>..HEAD -- <file> | Select-String '^@@'
|
|
53
|
+
git diff -U0 <base>..<theirs> -- <file> | Select-String '^@@'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`@@ -37,15 +37,20 @@` means: base lines 37–51 were replaced by 15 new lines from line 37. The numbers
|
|
57
|
+
after `-` are the only ones comparable across sides. Two hunks conflict when their base ranges
|
|
58
|
+
touch; they very often also conflict when they are *within six lines*, because each side's three
|
|
59
|
+
lines of context overlap the other's change.
|
|
60
|
+
|
|
61
|
+
## After the plan is approved — proving the resolution
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
git diff --check # no leftover markers
|
|
65
|
+
git status --short # nothing still in UU/AA/DD
|
|
66
|
+
<the project's own gate> # the merge is not done because the markers are gone
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Resolving markers makes a tree that compiles; it does not make one that behaves. The gate is
|
|
70
|
+
whatever the repository already uses, and it has to run **after** the merge — a file can merge
|
|
71
|
+
cleanly and still be wrong, which is the next section's point.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Reading the verdicts
|
|
2
|
+
|
|
3
|
+
## conflict — same lines
|
|
4
|
+
|
|
5
|
+
Both sides replaced the same base lines. One of them wins on the page; the other must not lose
|
|
6
|
+
its intent. Write the resolution as three facts:
|
|
7
|
+
|
|
8
|
+
- what ours was doing here,
|
|
9
|
+
- what theirs was doing here,
|
|
10
|
+
- which one the merged file implements, and where the other intent goes (the other side's column
|
|
11
|
+
name kept, our structure kept; their endpoint, our validation).
|
|
12
|
+
|
|
13
|
+
If the two intents genuinely cannot coexist, that is not a merge decision — it is a product
|
|
14
|
+
decision. Stop, name the fork in one sentence, and ask.
|
|
15
|
+
|
|
16
|
+
## conflict — contexts overlap
|
|
17
|
+
|
|
18
|
+
Neither side touched the same line, and git still conflicts because the context blocks collide.
|
|
19
|
+
This is the case people resolve by deleting the other side's hunk because the file "looked like
|
|
20
|
+
ours". It is also the case where both intents usually can coexist: merge by hand, keep both,
|
|
21
|
+
and reread the joined region as a whole — the seam is where the bug goes.
|
|
22
|
+
|
|
23
|
+
## auto-merge, confirm semantics
|
|
24
|
+
|
|
25
|
+
Git merges it and nobody looks. The failure is semantic, not textual, and it has a signature:
|
|
26
|
+
**one side renames or re-scopes something the other side now depends on.** Examples from real
|
|
27
|
+
merges:
|
|
28
|
+
|
|
29
|
+
- they renamed a column `amm_doc_id → amm_version`; we added code that reads `amm_doc_id`;
|
|
30
|
+
- they changed a response shape; we added a field to the old shape;
|
|
31
|
+
- they moved a directory; our new imports point at the old path.
|
|
32
|
+
|
|
33
|
+
Check the shared file's *interface*, not its body: function signatures, column lists, request
|
|
34
|
+
schemas, exported names. If one side's change is only meaningful under the other's rename, it is a
|
|
35
|
+
real conflict and the report has to say so even though git stayed quiet.
|
|
36
|
+
|
|
37
|
+
## Both sides rewrote one file
|
|
38
|
+
|
|
39
|
+
Take neither version. Reconstruct from the base:
|
|
40
|
+
|
|
41
|
+
```powershell
|
|
42
|
+
git show <base>:<file> > base.tmp
|
|
43
|
+
git diff base.tmp <ours> <theirs> # three-way, by hand
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then write the result by intent: every kept line should trace to one side's intent, and every
|
|
47
|
+
dropped line should be named in the report as dropped on purpose. A file that ends up as one
|
|
48
|
+
side's version with the other side's lines pasted in is the usual outcome, and it is fine — as
|
|
49
|
+
long as the report says which is which.
|
|
50
|
+
|
|
51
|
+
## What is never a resolution
|
|
52
|
+
|
|
53
|
+
- `git checkout --ours <file>` on a file whose other-side content you have not read;
|
|
54
|
+
- deleting a hunk because "we didn't need it" without naming the intent it served;
|
|
55
|
+
- resolving markers and calling it done before the repository's gate has run on the merged tree;
|
|
56
|
+
- dropping a side's commit or file wholesale because the two branches "changed everything" — with
|
|
57
|
+
a fork-point baseline, that claim is almost always false.
|
package/agents/scrub/AGENT.md
CHANGED
|
@@ -106,7 +106,8 @@ masked value, `path:line`, priority, one-line reason. Do not send both.
|
|
|
106
106
|
**Apply** — the plan first: the dry-run JSON and the redaction list it implies, with each
|
|
107
107
|
masked value. Then make them (`references/redaction.md`), and return a Markdown report:
|
|
108
108
|
what was redacted (was → masked → verified by), the verification command and result, and
|
|
109
|
-
what was not handled.
|
|
109
|
+
what was not handled. While you work, `todo_write` mirrors the redaction list — one entry per
|
|
110
|
+
secret, `in_progress` for the one you are on — when the session has that tool.
|
|
110
111
|
|
|
111
112
|
Rotating a leaked credential is not something you can do from here. Say so in every
|
|
112
113
|
report that contains one: redaction fixes the working tree, not the history and not the
|
package/agents/simplify/AGENT.md
CHANGED
|
@@ -78,7 +78,9 @@ The task tells you which mode you are in.
|
|
|
78
78
|
project's tests, or a characterization baseline when there are none —
|
|
79
79
|
`references/verification.md`), and only then edit. Apply one item or file group at a
|
|
80
80
|
time, re-run the gate after each, revert that batch if it fails. If no gate can be
|
|
81
|
-
established, **do not apply** — return the plan and say exactly what is missing.
|
|
81
|
+
established, **do not apply** — return the plan and say exactly what is missing. Keep the
|
|
82
|
+
person's list current while you work: `todo_write` from the plan, one item `in_progress`, when
|
|
83
|
+
the session has that tool.
|
|
82
84
|
|
|
83
85
|
## Editing
|
|
84
86
|
|