heyquilt 0.3.168 → 0.3.171

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.
Files changed (61) hide show
  1. package/RELEASES.md +26 -0
  2. package/bin/quilt.js +16 -9
  3. package/package.json +2 -2
  4. package/src/agent-task-workflow.js +2 -9
  5. package/src/base-pick.js +91 -0
  6. package/src/boxes.js +6 -7
  7. package/src/catchup.js +1 -1
  8. package/src/chat-links.js +1 -3
  9. package/src/connection.js +24 -5
  10. package/src/control.js +27 -20
  11. package/src/duties.js +32 -56
  12. package/src/github-commit.js +1 -1
  13. package/src/held.js +323 -0
  14. package/src/hooks.js +27 -66
  15. package/src/identity.js +1 -1
  16. package/src/inbox.js +5 -4
  17. package/src/key-cli.js +1 -1
  18. package/src/live-merge.js +592 -0
  19. package/src/mcp.js +57 -102
  20. package/src/merge3.js +65 -1
  21. package/src/now-summary.js +4 -6
  22. package/src/pathrules.js +1 -1
  23. package/src/persona.js +1 -1
  24. package/src/presence.js +2 -0
  25. package/src/protocol.js +2 -2
  26. package/src/read-bases.js +123 -0
  27. package/src/relay-ask.js +2 -2
  28. package/src/relay-live-write.js +173 -0
  29. package/src/relay-mcp.js +173 -212
  30. package/src/relay-prune.js +2 -2
  31. package/src/relay-turn-sync.js +146 -142
  32. package/src/runner.js +0 -2
  33. package/src/server.js +253 -375
  34. package/src/session-follow.js +3 -1
  35. package/src/session-quilt.js +2 -21
  36. package/src/session-seam.js +35 -7
  37. package/src/session.js +674 -557
  38. package/src/setup.js +15 -25
  39. package/src/source-live/bring-in.js +5 -5
  40. package/src/source-live/land.js +20 -3
  41. package/src/source-live/live-block.js +391 -51
  42. package/src/status.js +8 -12
  43. package/src/textdiff.js +54 -0
  44. package/src/turn-sync-plan.js +6 -18
  45. package/src/turn-sync.js +28 -21
  46. package/src/ui/agent-guide.js +13 -13
  47. package/src/ui/app.css +19 -40
  48. package/src/ui/boxes.js +8 -16
  49. package/src/ui/common.js +1 -1
  50. package/src/ui/fileview.js +11 -15
  51. package/src/ui/loom-model.js +18 -16
  52. package/src/ui/loom.css +1 -2
  53. package/src/ui/loom.js +6 -6
  54. package/src/ui/rail-model.js +25 -64
  55. package/src/ui/rail.js +48 -60
  56. package/src/ui/seam-model.js +46 -6
  57. package/src/ui/session.js +36 -54
  58. package/src/ui/tree.js +22 -129
  59. package/src/ui-server.js +2 -6
  60. package/src/release-words.js +0 -18
  61. package/src/seam-claims.js +0 -53
package/RELEASES.md CHANGED
@@ -11,6 +11,32 @@ Format: `## <version> — <YYYY-MM-DD>`, an optional one-line summary, then bull
11
11
  Lead each bullet with a short bold phrase. Inline `code` and **bold** are rendered;
12
12
  nothing else is.
13
13
 
14
+ ## 0.3.171 — 2026-11-13
15
+
16
+ Nobody holds files any more, and when two edits change the same lines, the first one to land stays and the second waits to be resolved.
17
+
18
+ - **Nobody holds files any more.** Quilt no longer claims a file when you or your AI edit it, never refuses or undoes an edit because someone else is working on that file, and nobody waits in a file queue. Edits merge as they arrive. The lock pills and the file queue are gone from the app, and the Loom shows who wrote each file lately instead. AI tools that still call `quilt_claim`, `quilt_release`, `quilt_request_file`, `quilt_handoff` or `quilt_withdraw_request` are told "Quilt holds no files" and nothing changes.
19
+ - **The newer edit no longer wins.** When two people (or their AIs) change the same lines at once, the file keeps the version that landed first and the second writer's lines are held back, never overwritten and never written into the file as conflict markers. Changes to different lines still all go in. Two names added to the same import line are still combined by themselves; two different words changed on one line, or two blocks added at one spot, are held like any other clash. This holds everywhere a write lands: your folder, an agent's `quilt sync` at the end of its turn, and a cloud agent's `quilt_write_file`.
20
+ - **Cloud agents' writes merge with what they read.** `quilt_read_file` now ends with the version it read, and `quilt_write_file` takes it as `base`, so a write keeps whatever others changed since. Without a base, Quilt uses the version that agent last read.
21
+ - **Open conflicts are never unseen.** Every held conflict is listed at the top of every Quilt answer, to every AI in the session, in `quilt_status` and on a card in the app, until it's resolved. The writer is asked first, but any AI can take it with `quilt_resolve_merge` (`theirs` drops the held lines, `mine` puts them in, `edited` says the file is already fixed). Resolving one twice is harmless. Nothing holds the file meanwhile.
22
+ - **A held conflict doesn't land until it's resolved.** In a session in Seam, committing or merging leaves out a file with an open held conflict and says how to resolve it; everything else lands as usual.
23
+ - **A stale write can't wipe out a partner's new lines.** A write that removes lines someone else added in the last 15 minutes (a tool writing the whole file from an older read) keeps those lines and asks its writer to confirm; removing them again goes through. The session's owner can change the 15 minutes in Session settings → Version control, or with `quilt session stale-write <minutes>` (0 turns it off).
24
+ - **Removing a name other files still use gets a warning.** Delete or rename `makeEnemy` while `game.js:291` still calls it, and your AI is told where, without anything being blocked.
25
+ - **A merge that breaks a file is held.** If combining two edits would leave a `.json` file that no longer parses, or a plain `.js` file that no longer compiles, the second write is held for its writer instead.
26
+ - **A conflict left open doesn't stay unseen.** If nobody resolves a held conflict in 4 hours, Quilt writes to the person whose change was held (for an AI, the person it works for); after a day, to the session's owner too. If an AI's fix of a file is held again twice, the conflict becomes a task on the board for its person and every AI is told to leave it to them.
27
+ - **Edits follow a moved file.** When someone moves a file (deletes it and adds the same text elsewhere), a partner's later edit to the old path goes into the new one.
28
+ - **Saves never go missing, however many people write at once.** Your folder now sends each save to the session as a write, which is merged against the version your folder last had, one at a time per file, and put into the shared file in whole lines. Quilt also never writes a partner's change over a save it hasn't taken in yet, including one that lands in the same instant, or one an editor is still writing. In a test with eight writers saving the same file several times a second, no edit was lost (before this, about 2 in 100 were).
29
+ - **Two saves of the same line at once never come out mixed.** Saved within a moment of each other, the line keeps the one that landed first, letter for letter, and the other is held for its writer, instead of the two being spliced together into a line nobody wrote.
30
+ - **A whole file written from an older read can't quietly replace a partner's line.** When a tool saves the whole file from what it read before a partner's change reached it, and its version of that line merely looks like theirs, the partner's line stays and the save's line is held for its writer to resolve.
31
+ - **Cloud agents running many loops on one key no longer overwrite each other.** The session keeps many recent versions of every file, whoever read them, so each write is merged against the version it really started from. A version it no longer has is never swapped for the latest: the write is merged as a stale one, keeping every line anyone added in the last few minutes, the agent's own included, and the agent is told.
32
+ - **Fewer false warnings about removed names, and a new one.** Names only in comments or quoted strings no longer count, and adding a use of a name a partner just removed from another file now gets a warning too. Nothing is ever blocked.
33
+ - **Small fixes.** A cloud agent whose change is held is no longer told "your folder has it now" (it has no folder), and `quilt_status` counts the files in your square rather than the branch you left.
34
+ - **Apps from before this release still work**, but their edits go in as before, without these guarantees, until they update.
35
+
36
+ ## 0.3.170 — 2026-11-13
37
+
38
+ - **Your folder is in Seam by itself.** A new session's folder no longer shows "∅ has no square yet" with a button to press: Quilt opens its square on its own (and tries again every minute if it can't), so your edits reach everyone from the start. Only if that keeps failing does the session say why, with **Try again now**.
39
+
14
40
  ## 0.3.168 — 2026-11-13
15
41
 
16
42
  - **Sign up right in the app.** **Create an account** on Quilt's sign-in screen now asks for your name, email and a password, emails you a 6-digit code, and once you type it in you're signed in, with this computer linked to your new account. No browser needed. You can still sign up on heyquilt.com instead.
package/bin/quilt.js CHANGED
@@ -27,10 +27,10 @@ Usage:
27
27
  quilt join <invite-link> Join a partner's session in this folder
28
28
  quilt sync [--dir <folder>] Agents in a sandbox: sync this folder with the session once and exit
29
29
  (needs QUILT_AGENT_KEY; run it at the start and end of every turn).
30
- With the key, status, messages, say, tasks, task, history, claim,
31
- release, focus, tool and mcp work too
30
+ With the key, status, messages, say, tasks, task, history,
31
+ focus, tool and mcp work too
32
32
  quilt setup Connect Claude Code / Cursor / others via MCP
33
- quilt status Show collaborators, claims, activity, chat
33
+ quilt status Show collaborators, boxed work, activity, chat
34
34
  quilt history [path] [--by name] [--since 2h] [--task id] [--diff] [-n 30]
35
35
  Who changed what, when, and for which task
36
36
  quilt chat Live chat (messages, DMs, files) in this terminal
@@ -49,10 +49,10 @@ Usage:
49
49
  Quilt's vault; it never sees a value
50
50
  quilt commit <message> In a session that is a quilt: commit the square this folder follows
51
51
  quilt focus <what you're doing> Tell collaborators what you're working on
52
- quilt claim <path|glob> [reason] Mark files as yours for now
53
- quilt release <path|glob|*> Release a claim
54
52
  quilt chat-link [name] [--minutes N] Owner: a link for a chat-only AI (ChatGPT, claude.ai, Grok); 10 minutes
55
53
  quilt chat-link extend <name> <minutes> Owner: keep a chat link working for that long from now
54
+ quilt session stale-write [minutes] How long a write may not remove lines someone else added (default 15;
55
+ the owner sets it, 0 turns it off); no minutes: show it
56
56
  quilt invite Print this session's invite code
57
57
  quilt workspace list|files|get|put|write|mkdir|mv|rm The workspace library (quilt workspace for help)
58
58
  quilt stop Shut down everything quilt is running (relay, app, syncs)
@@ -113,9 +113,8 @@ async function main () {
113
113
  case 'git-pre-push': return gitPrePushLeftover()
114
114
  case 'chat': return chat()
115
115
  case 'focus': return simple('/focus', { text: argv.join(' ') }, () => 'focus updated')
116
- case 'claim': return simple('/claim', { pattern: argv[0], note: argv.slice(1).join(' ') }, (r) =>
117
- `claimed ${argv[0]}` + (r.overlapping?.length ? `\nwarning: overlaps ${r.overlapping.map((c) => `${c.by}'s ${c.pattern}`).join(', ')}` : ''))
118
- case 'release': { const { releaseWords } = await import('../src/release-words.js'); return simple('/release', { pattern: argv[0] || '*' }, (r) => releaseWords(r)) }
116
+ // Quilt holds no files (no-holds, 2026-11-13): kept for one release so scripts that call them don't fail.
117
+ case 'claim': case 'release': { const { NO_HOLDS } = await import('../src/duties.js'); console.log(NO_HOLDS); return }
119
118
  case 'chat-link': {
120
119
  if (argv[0] === 'extend') {
121
120
  if (!argv[1] || !Number(argv[2])) fail('usage: quilt chat-link extend <name> <minutes>')
@@ -589,11 +588,19 @@ async function doSetup () {
589
588
  // the session's files into its squares (layout 3); --back returns it to its branches. `follow <folder>`
590
589
  // then makes that folder follow this branch's square live (session-follow.js).
591
590
  async function sessionCmd () {
591
+ // stale_write_minutes (held.js): how long a write may not remove lines someone else added; the owner sets it, 0 turns it off.
592
+ if (argv[0] === 'stale-write') {
593
+ const say = (r) => r.minutes ? `A write that removes lines someone else added in the last ${r.minutes} minute${r.minutes === 1 ? '' : 's'} is held for its writer to confirm.` : 'The stale-write check is off: a write may remove any lines.'
594
+ if (argv[1] === undefined) return simple('/stale-write', undefined, say, 'GET')
595
+ const n = Number(argv[1])
596
+ if (!/^\d+$/.test(argv[1]) || n > 1440) fail('Usage: quilt session stale-write [minutes] (0 to 1440; 0 turns the check off)')
597
+ return simple('/stale-write', { minutes: n }, say)
598
+ }
592
599
  if (argv[0] === 'follow') {
593
600
  if (!argv[1]) fail('Usage: quilt session follow <folder>')
594
601
  return simple('/quilt-follow', { dir: path.resolve(argv[1]) }, (r) => r.text)
595
602
  }
596
- if (argv[0] !== 'migrate') fail('Usage: quilt session migrate [--dry-run | --link-only | --switch | --back [--carried <square,...>] | --shadow <quilt> | --unshadow] | quilt session follow <folder>')
603
+ if (argv[0] !== 'migrate') fail('Usage: quilt session migrate [--dry-run | --link-only | --switch | --back [--carried <square,...>] | --shadow <quilt> | --unshadow] | quilt session follow <folder> | quilt session stale-write [minutes]')
597
604
  if (argv.includes('--dry-run')) return simple('/quilt-plan', {}, (r) => r.text)
598
605
  if (argv.includes('--shadow')) {
599
606
  const q = argv[argv.indexOf('--shadow') + 1]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyquilt",
3
- "version": "0.3.168",
3
+ "version": "0.3.171",
4
4
  "description": "Real-time, tool-agnostic pair vibe coding: sync a project folder live between collaborators using any AI coding tool.",
5
5
  "author": {
6
6
  "name": "Daniel Carmichael",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@fontsource/ibm-plex-mono": "^5.3.0",
39
39
  "@fontsource/poppins": "^5.3.0",
40
- "@heyquilt/seam": "0.237.313",
40
+ "@heyquilt/seam": "0.237.359",
41
41
  "@modelcontextprotocol/sdk": "^1.30.1",
42
42
  "@noble/hashes": "^2.4.0",
43
43
  "@supabase/supabase-js": "^2.117.2",
@@ -88,17 +88,15 @@ function agoText (ts, now) {
88
88
 
89
89
  /**
90
90
  * What an agent gets when it moves a ticket to In progress: the ticket, its files,
91
- * recent changes to them (from the chronology), who holds claims on them, the
92
- * workflow and the project's checks.
91
+ * recent changes to them (from the chronology), the workflow and the project's checks.
93
92
  * @param {object} o
94
93
  * @param {{id:string,title:string,files?:string[]}} o.task
95
94
  * @param {Array<{by:string,path:string,kind:string,detail?:string,ts:number,task?:{title:string}|null}>} [o.history] oldest first
96
- * @param {Array<{by:string,pattern:string,note?:string}>} [o.claims]
97
95
  * @param {string} [o.checklist]
98
96
  * @param {string} [o.me]
99
97
  * @param {number} [o.now]
100
98
  */
101
- export function pickupBrief ({ task, history = [], claims = [], checklist = '', me = '', now = Date.now(), workflow = TASK_WORKFLOW }) {
99
+ export function pickupBrief ({ task, history = [], checklist = '', me = '', now = Date.now(), workflow = TASK_WORKFLOW }) {
102
100
  const files = task?.files || []
103
101
  const lines = [`Picked up "${task?.title || 'this ticket'}" [${task?.id || ''}].`]
104
102
  lines.push(files.length ? `Files: ${files.join(', ')}` : 'Files: none listed. Add them with quilt_assign_task once you know which you will touch.')
@@ -119,11 +117,6 @@ export function pickupBrief ({ task, history = [], claims = [], checklist = '',
119
117
  lines.push('', 'Comments on the task (latest last):')
120
118
  for (const c of comments) lines.push(`- ${c.by === me ? 'you' : c.by} [${agoText(c.ts, now)}]: ${String(c.text).replace(/\n/g, '\n ')}`)
121
119
  }
122
- const others = claims.filter((c) => c.by !== me)
123
- if (others.length) {
124
- lines.push('', 'Claims to respect (ask for the file with quilt_request_file instead of editing it):')
125
- for (const c of others) lines.push(`- ${c.pattern} by ${c.by}${c.note ? ` (${c.note})` : ''}`)
126
- }
127
120
  lines.push('', workflow, '', checklistBlock(checklist))
128
121
  return lines.join('\n')
129
122
  }
@@ -0,0 +1,91 @@
1
+ // Which version a save on disk was made from. A folder's last synced text is the usual base of a
2
+ // save, but an editor or AI that read the file a moment before a partner's change reached disk saves
3
+ // a whole file made from the older version: taken against the newer one, its line would replace the
4
+ // partner's line as if it were an edit of it (2026-11-14: two saves of one line within a second, the
5
+ // second silently kept). So a folder keeps, for each path, the texts a partner's change was lately
6
+ // written over on its disk (since its own last save there), and a save is merged against the one it
7
+ // differs from least: the last synced text, or an older one when the save is at least as near to it (a
8
+ // save that is the older text plus one change of the line the partner changed is a same-line clash,
9
+ // held for its writer, never taken over the partner's). The folder's own saves never make a candidate,
10
+ // so saving one line again and again is never held against itself.
11
+ // Choosing an older version than the save was made from loses nothing: what the save shares with the
12
+ // newer one is the same change on both sides of the merge.
13
+ import { diffLines as diffIndices } from './textdiff.js'
14
+
15
+ /** How long, and how many, texts a folder keeps per path as possible bases (as long as the stale-write window). */
16
+ export const RECENT_MS = 15 * 60 * 1000
17
+ export const RECENT_MAX = 6
18
+ /** Texts past this are not kept (the diff to tell them apart costs too much). */
19
+ export const RECENT_TEXT = 256 * 1024
20
+
21
+ const lines = (s) => String(s).split('\n')
22
+ const words = (ls) => new Set(ls.join(' ').match(/\w+/g) || [])
23
+
24
+ /** The lines `b` has where it differs from `a` (its side of each hunk). */
25
+ function changed (a, b) {
26
+ const out = []
27
+ for (const h of diffIndices(lines(a), lines(b))) out.push(...h.buffer2Content)
28
+ return out
29
+ }
30
+
31
+ /**
32
+ * Whether a save `text`, as near to the older text `older` as to `current`, was made from `current`: it
33
+ * keeps every word `current`'s changes brought in (a deliberate edit of the partner's line keeps what they
34
+ * wrote; a write from the older read never saw it, and two writers adding the same word is no proof).
35
+ */
36
+ export function madeFrom (older, current, text) {
37
+ const was = words(changed(current, older))
38
+ const novel = [...words(changed(older, current))].filter((w) => !was.has(w))
39
+ if (!novel.length) return false
40
+ const ws = words(changed(current, text))
41
+ // What the save left as the current text has is kept too.
42
+ const keep = (w) => ws.has(w) || !words(changed(text, current)).has(w)
43
+ return novel.every(keep)
44
+ }
45
+
46
+ /** How many lines `a` and `b` differ by (each changed, added or removed line counts once on each side). */
47
+ export function lineDistance (a, b) {
48
+ if (a === b) return 0
49
+ let n = 0
50
+ for (const h of diffIndices(lines(a), lines(b))) n += h.buffer1[1] + h.buffer2[1]
51
+ return n
52
+ }
53
+
54
+ export class RecentTexts {
55
+ constructor ({ ms = RECENT_MS, max = RECENT_MAX } = {}) {
56
+ this.ms = ms
57
+ this.max = max
58
+ this.map = new Map() // path -> [{ text, ts }], newest last
59
+ }
60
+
61
+ /** `text` was on disk at `p` when a partner's change was written over it. */
62
+ note (p, text, now = Date.now()) {
63
+ if (typeof text !== 'string' || text.length > RECENT_TEXT) { this.map.delete(p); return }
64
+ const list = (this.map.get(p) || []).filter((v) => now - v.ts <= this.ms && v.text !== text)
65
+ list.push({ text, ts: now })
66
+ this.map.set(p, list.slice(-this.max))
67
+ if (this.map.size > 2000) this.map.delete(this.map.keys().next().value)
68
+ }
69
+
70
+ /** A save of this folder's at `p` was taken in: the texts before it are no save's base any more. */
71
+ forget (p) { this.map.delete(p) }
72
+
73
+ /**
74
+ * The base to merge a save `text` of `p` against: `current` (the last synced text), or an older one
75
+ * this folder had lately that the save is at least as near to (see the top of this file).
76
+ */
77
+ pick (p, current, text, now = Date.now()) {
78
+ if (typeof current !== 'string' || typeof text !== 'string' || text.length > RECENT_TEXT || current.length > RECENT_TEXT) return current
79
+ const older = (this.map.get(p) || []).filter((v) => now - v.ts <= this.ms && v.text !== current)
80
+ if (!older.length) return current
81
+ let best = current
82
+ let d = lineDistance(current, text)
83
+ if (d === 0) return current
84
+ // Newest first, so on a tie the oldest as near wins, unless the save kept what the newer text brought in.
85
+ for (let i = older.length - 1; i >= 0; i--) {
86
+ const e = lineDistance(older[i].text, text)
87
+ if (e < d || (e === d && !madeFrom(older[i].text, best, text))) { best = older[i].text; d = e }
88
+ }
89
+ return best
90
+ }
91
+ }
package/src/boxes.js CHANGED
@@ -10,7 +10,7 @@ const textOf = (v) => (v == null || isBin(v) ? '' : String(v))
10
10
  * One box for the app. `before` and `after` are the file's text, null (no file) or { binary: true }.
11
11
  * The diff is capped as history's are; added and removed count every line all the same.
12
12
  */
13
- export function boxEntry ({ claim, mine = false, before = null, after = null }) {
13
+ export function boxEntry ({ box, mine = false, before = null, after = null }) {
14
14
  const kind = before == null && after != null ? 'new' : after == null && before != null ? 'deleted' : isBin(before) || isBin(after) ? 'binary' : 'edited'
15
15
  let added = 0
16
16
  let removed = 0
@@ -23,15 +23,14 @@ export function boxEntry ({ claim, mine = false, before = null, after = null })
23
23
  }
24
24
  }
25
25
  return {
26
- path: claim.pattern,
27
- by: claim.by,
28
- ...(claim.of ? { of: claim.of } : {}),
29
- ts: claim.ts || 0,
26
+ path: box.pattern,
27
+ by: box.by,
28
+ ...(box.of ? { of: box.of } : {}),
29
+ ts: box.ts || 0,
30
30
  mine: !!mine,
31
31
  kind,
32
32
  added,
33
33
  removed,
34
- diff,
35
- queue: Array.isArray(claim.queue) ? claim.queue.map((r) => ({ id: r.id, by: r.by })) : []
34
+ diff
36
35
  }
37
36
  }
package/src/catchup.js CHANGED
@@ -104,7 +104,7 @@ export function catchUpMarkdown (c, { ago = () => '' } = {}) {
104
104
  const m = c.mine || {}
105
105
  if (m.shared) out.push(`- Your ${plural(m.shared, 'change')} from while you were away went into the session.`)
106
106
  if (m.merged?.length) out.push(`- Combined with the session's changes: ${m.merged.map((p) => `\`${p}\``).join(', ')}.`)
107
- if (m.conflicts?.length) out.push(`- Held by someone else, so waiting: Quilt merges your changes in when they let go of ${m.conflicts.map((p) => `\`${p}\``).join(', ')}.`)
107
+ if (m.conflicts?.length) out.push(`- Could not be merged, so your copy was kept in .quilt/conflicts and the session's is on disk: ${m.conflicts.map((p) => `\`${p}\``).join(', ')}.`)
108
108
  if (c.backups?.length) out.push(`- Your copies of ${plural(c.backups.length, 'file')} differed from the session's and were replaced; they are kept: ${c.backups.map((b) => `\`${b.path}\` → \`${b.copy}\``).join(', ')}.`)
109
109
  out.push('Read quilt_history for the diffs before you change these files.')
110
110
  return out
package/src/chat-links.js CHANGED
@@ -25,7 +25,7 @@ import dns from 'node:dns'
25
25
  import https from 'node:https'
26
26
  import net from 'node:net'
27
27
  import * as Y from 'yjs'
28
- import { globMatcher, isSafeRelPath } from './pathrules.js'
28
+ import { isSafeRelPath } from './pathrules.js'
29
29
  import { readTasks, addTask, updateTask, formatTasks, columnName, COLUMNS, COLUMN_IDS, assignmentFields } from './tasks.js'
30
30
  import { readComments, addComment, withComments, formatTaskDetails, MAX_COMMENT } from './task-comments.js'
31
31
  import { qaNotesEnough, qaRefusal, verifiedEnough, doneRefusal, pickChecklist } from './agent-task-workflow.js'
@@ -880,8 +880,6 @@ class ChatPage {
880
880
  if (there) return { code: 409, body: `${rel} already exists, and chat links only add new files. Pick another name.` }
881
881
  const refusal = changeRefusal(this.access, rel)
882
882
  if (refusal) return { code: 403, body: `The session owner says ${refusal}.` }
883
- const claim = (this.room.claimList ? this.room.claimList(this.branch.key) : []).find((c) => c.by !== this.me && globMatcher(c.pattern)(rel))
884
- if (claim) return { code: 409, body: `${rel} is in ${claim.pattern}, which ${claim.by} has claimed${claim.note ? ` (${claim.note})` : ''}. Put it somewhere else, or ask them with the "say" link.` }
885
883
  if (this.writable()) return { code: 403, body: this.writable() }
886
884
  return this.branchFull() ? { code: 403, body: this.branchFull() } : null
887
885
  }
package/src/connection.js CHANGED
@@ -395,7 +395,9 @@ export class Connection extends EventEmitter {
395
395
  this.noteSynced()
396
396
  }
397
397
  } else if (type === MSG_BRANCHES) {
398
- const { branches, reply, pushed, quilt, shadow, readOnly, moving, force, importing } = JSON.parse(decoding.readVarString(dec))
398
+ const { branches, reply, pushed, quilt, shadow, readOnly, moving, force, importing, writes } = JSON.parse(decoding.readVarString(dec))
399
+ // The relay takes folders' live writes (relay-live-write.js): text edits go to it as writes, not as edits of the text.
400
+ if (Array.isArray(branches)) this.relayWrites = writes === 1
399
401
  // "Make this a quilt" on a session with a git remote: Seam imports it ({ slug, repo }), or null.
400
402
  const im = importing && typeof importing.repo === 'string' ? { slug: String(importing.slug || ''), repo: importing.repo } : null
401
403
  if (JSON.stringify(im) !== JSON.stringify(this.importing || null)) { this.importing = im; this.emit('importing', im) }
@@ -456,9 +458,10 @@ export class Connection extends EventEmitter {
456
458
  this.emit('members', msg)
457
459
  this.settle(msg.reply, 'request refused')
458
460
  } else if (type === MSG_CLAIMS) {
461
+ // The room's boxes (the field keeps its old name): Quilt holds no files, so only boxes come here.
459
462
  const { claims, reply } = JSON.parse(decoding.readVarString(dec))
460
- this.emit('claims', claims)
461
- this.settle(reply, 'claim refused')
463
+ this.emit('boxes', claims)
464
+ this.settle(reply, 'box refused')
462
465
  }
463
466
  }
464
467
 
@@ -515,6 +518,22 @@ export class Connection extends EventEmitter {
515
518
  /** Any other branch request (remove). */
516
519
  branchRequest (req, { timeoutMs = REQUEST_TIMEOUT_MS } = {}) { return this.request(MSG_BRANCH, req, 'branch changes', null, timeoutMs) }
517
520
 
521
+ /**
522
+ * A live write of one text file (relay-live-write.js): `{ path, base, baseText?, text, mode?, at?, trusted? }`
523
+ * on the branch this connection is on. Resolves with the relay's reply; asks again with the base's text
524
+ * (`baseOf()`, or `retry` when there is none) when the relay doesn't know the base.
525
+ */
526
+ async liveWrite (req, { baseOf = null, timeoutMs = REQUEST_TIMEOUT_MS } = {}) {
527
+ if (this.branchKey === null) throw new Error('not on a branch')
528
+ let r = await this.branchRequest({ op: 'live-write', branch: this.branchKey, ...req }, { timeoutMs })
529
+ if (r.needBase) {
530
+ const t = baseOf ? baseOf() : null
531
+ r = await this.branchRequest({ op: 'live-write', branch: this.branchKey, ...req, ...(typeof t === 'string' ? { baseText: t } : { retry: true }) }, { timeoutMs })
532
+ if (r.needBase) r = await this.branchRequest({ op: 'live-write', branch: this.branchKey, ...req, retry: true }, { timeoutMs })
533
+ }
534
+ return r
535
+ }
536
+
518
537
  waitForBranchSync () {
519
538
  if (this.branchSynced) return Promise.resolve()
520
539
  return new Promise((resolve, reject) => {
@@ -552,8 +571,8 @@ export class Connection extends EventEmitter {
552
571
  })
553
572
  }
554
573
 
555
- /** Asks the relay to claim or release; resolves with its reply. Claims need a live connection. */
556
- claimRequest (req) { return this.request(MSG_CLAIM, req, 'claims') }
574
+ /** Asks the relay to box or unbox a file; resolves with its reply. Needs a live connection. */
575
+ boxRequest (req) { return this.request(MSG_CLAIM, req, 'boxes') }
557
576
 
558
577
  /** Approve / deny / change / remove someone, or set who may admit (relay enforces who may). */
559
578
  adminRequest (req, { timeoutMs } = {}) { return this.request(MSG_ADMIN, req, 'changes to who is in the session', null, timeoutMs) }
package/src/control.js CHANGED
@@ -6,6 +6,7 @@ import fs from 'node:fs'
6
6
  import path from 'node:path'
7
7
  import crypto from 'node:crypto'
8
8
  import { renderStatus } from './status.js'
9
+ import { NO_HOLDS } from './duties.js'
9
10
  import { migrateDir } from './legacy.js'
10
11
  import { createRun, waitRun, endRun, secretNames, apiCall } from './secrets-client.js'
11
12
  import { runMailTool, MAIL_TOOLS } from './mail-tools.js'
@@ -78,10 +79,17 @@ export async function startControl (session, extras = {}) {
78
79
  shareWithPeople(c.client, q.id, square, session.members || []).catch(() => shared.delete(square))
79
80
  }
80
81
  const next = at ? async () => session.conn.branchRequest({ op: 'quilt-next', token: c.token, branch }, { timeoutMs: QUILT_MOVE_TIMEOUT_MS }) : null
81
- return runSessionSeamTool(String(b.tool || ''), b.args || {}, { client: c.client, quilt: q.id, square, live, next, branch })
82
+ // Open held conflicts (held.js) keep their paths from landing until they are resolved.
83
+ return runSessionSeamTool(String(b.tool || ''), b.args || {}, { client: c.client, quilt: q.id, square, live, next, branch, held: () => (session.heldList ? session.heldList() : []) })
82
84
  }
83
85
  // The app's square panel (ui-server.js) commits and merges through the same tools, as the same member.
84
86
  session.seamTool = seamTool
87
+ // Every open held conflict in the session (held.js), whoever's, first among the notices every MCP answer
88
+ // starts with (an older `quilt mcp` too), until someone resolves it. Not taken: said again each time.
89
+ const heldFirst = (b) => {
90
+ const text = session.heldNotice ? session.heldNotice(session.actorName ? session.actorName(b && b.via ? String(b.via) : null) : session.name) : ''
91
+ return text ? [text] : []
92
+ }
85
93
  const routes = {
86
94
  'GET /status': (b) => {
87
95
  // To one of the AI sessions working through this app, "you" is that session (persona.js).
@@ -113,31 +121,24 @@ export async function startControl (session, extras = {}) {
113
121
  else session.setFocus(b.text)
114
122
  return { ok: true }
115
123
  },
116
- 'POST /claim': (b) => session.claim(b.pattern, b.note, b.via),
124
+ // Quilt holds no files (no-holds, 2026-11-13): the claim routes an older `quilt mcp` or hook may still call answer that, and change nothing.
125
+ 'POST /claim': () => ({ ok: true, note: NO_HOLDS }),
117
126
  // What this person's AI should hear (an edit of its that Quilt undone); handed over once.
118
127
  'POST /notices': async (b) => {
119
128
  const notices = session.takeNotices(b && b.via ? String(b.via) : null)
120
129
  const remind = await wake.reminder()
121
- return { notices: remind ? [...notices, remind] : notices }
130
+ return { notices: [...heldFirst(b), ...notices, ...(remind ? [remind] : [])] }
122
131
  },
123
- 'POST /release': (b) => session.releaseReport(b.pattern, b.via),
132
+ 'POST /release': () => ({ released: 0, note: NO_HOLDS }),
124
133
  'POST /unpack': (b) => session.unpack(b.paths, b.via),
125
- // The file queue: ask for a file someone holds, hand one we hold to someone waiting, take a request back.
126
- 'POST /request-file': (b) => session.requestFile(b.path, { title: b.title, description: b.description, task: b.task, via: b.via }),
127
- 'POST /handoff': (b) => session.handoff(b.path, { to: b.to, context: b.context, via: b.via }),
128
- 'POST /withdraw-request': async (b) => ({ withdrawn: await session.withdrawRequest(b.request, b.via) }),
129
- // Who owns one path (the hooks ask before every edit). `shared` is false for paths Quilt doesn't sync.
130
- 'POST /claim-for': (b) => {
131
- const rel = String(b.path || '').replace(/\\/g, '/').replace(/^\.\//, '')
132
- const shared = session.syncable(rel)
133
- const c = shared ? session.claimFor(rel) : null
134
- const me = session.actorName(b.via)
135
- return { path: rel, shared, claim: c ? { by: c.by, pattern: c.pattern, note: c.note, queue: c.queue || [] } : null, mine: !!c && c.by === me, me, focus: session.focus || '' }
136
- },
137
- // Before an agent changes files (any tool): is each one ours to edit (free ones are claimed for
138
- // us), and what did people ask about them? See Session.prepareEdit and duties.js.
134
+ 'POST /request-file': () => ({ ok: true, note: NO_HOLDS }),
135
+ 'POST /handoff': () => ({ ok: true, note: NO_HOLDS }),
136
+ 'POST /withdraw-request': () => ({ withdrawn: 0, note: NO_HOLDS }),
137
+ 'POST /claim-for': (b) => ({ path: String(b.path || ''), shared: session.syncable(String(b.path || '').replace(/\\/g, '/').replace(/^\.\//, '')), claim: null, mine: false, me: session.actorName(b.via), focus: session.focus || '' }),
138
+ // Before an agent changes files (any tool): who else changed them lately, and what did people say
139
+ // about them? It never refuses (Session.prepareEdit, duties.js).
139
140
  'POST /before-edit': (b) => session.prepareEdit(Array.isArray(b.paths) ? b.paths.slice(0, 100) : [], b.via),
140
- // An agent finished a piece of work: let go of the claims that followed its edits.
141
+ // An agent finished a piece of work.
141
142
  'POST /finish': (b) => session.finishEditing(b.via),
142
143
  // Who is waiting for an answer from this member (or AI session): the MCP and the hooks refuse to move work on until there's none.
143
144
  'GET /duties': (b) => session.duties(b.via),
@@ -210,7 +211,7 @@ export async function startControl (session, extras = {}) {
210
211
  if (task && (b.column === 'doing' || b.column === 'done')) session.stitchClock(b.via, b.column === 'doing')
211
212
  return { task, tasks: session.taskList() }
212
213
  },
213
- // What an agent gets when it picks a task up: history for its files, claims, the project's checks.
214
+ // What an agent gets when it picks a task up: history for its files, the project's checks.
214
215
  'POST /tasks/brief': (b) => session.taskBrief(b.id),
215
216
  'POST /tasks/comment': (b) => {
216
217
  const r = session.commentTask(b)
@@ -220,6 +221,12 @@ export async function startControl (session, extras = {}) {
220
221
  },
221
222
  'POST /tasks/delete': (b) => { session.deleteTask(b.id); return { tasks: session.taskList() } },
222
223
  'GET /rules': () => ({ text: session.projectRulesText() }),
224
+ // Held conflicts (held.js): the list (quilt_resolve_merge without a how), and resolving one { ref, how } (any member, any conflict).
225
+ 'GET /held': () => ({ held: session.heldList ? session.heldList() : [] }),
226
+ 'POST /resolve-merge': (b) => session.resolveHeld({ ref: String(b.ref || ''), how: String(b.how || ''), via: b.via ? String(b.via) : null }),
227
+ // The session's stale_write_minutes (Seam's 07): { minutes }; only the owner sets it.
228
+ 'GET /stale-write': () => session.staleWrite(),
229
+ 'POST /stale-write': (b) => session.setStaleWrite(b.minutes),
223
230
  // Secrets (`quilt run`, quilt_secret_names): asked of the API as this session's own identity
224
231
  // (its person, or the agent it runs as). Run tokens and names only: never a value.
225
232
  'POST /secrets/run': async (b) => createRun(await secretsApi(), { room: session.room, label: String(b.label || '').slice(0, 200) }),
package/src/duties.js CHANGED
@@ -2,16 +2,15 @@
2
2
  // whatever tool it runs in. Pure checks shared by the local MCP, the hosted MCP and the
3
3
  // Claude Code hooks, so every agent gets the same rules:
4
4
  //
5
- // - before editing a file: who holds it (claims are what keep agents off each other's
6
- // files), and what was said about it in chat lately, as context;
7
- // - before moving work on (claims, tasks, commits, "done"): every direct message and
8
- // mention is answered (a message back to that person, or to everyone, after theirs);
9
- // - before finishing or letting go of a file: anyone waiting for it in its file queue is
10
- // handed it, with the holder's context (quilt_handoff). A file someone else holds is
11
- // asked for in its queue (quilt_request_file), not taken.
5
+ // - before editing a file: who wrote it lately (presence) and what was said about it in
6
+ // chat, as context. Nothing holds a file (no-holds, 2026-11-13): no claims, no file
7
+ // queue, no handoffs of files. Edits merge as they arrive; a clash on the same lines
8
+ // goes back to the writer to resolve;
9
+ // - before moving work on (tasks, commits, "done"): every direct message and mention is
10
+ // answered (a message back to that person, or to everyone, after theirs).
12
11
  //
13
- // Chat never blocks a file: Quilt can't tell "don't touch it" from "is it done?". A file
14
- // is held by a claim; a message about it is something the agent reads.
12
+ // Chat never blocks a file: Quilt can't tell "don't touch it" from "is it done?". A message
13
+ // about a file is something the agent reads.
15
14
  //
16
15
  // Messages are chat entries ({ id, by, to, text, ts }) the reader can see.
17
16
  import { mentionsMe, mentioned, ALL_AGENTS } from './inbox.js'
@@ -217,7 +216,7 @@ export function waitingOn (messages, me, { now = Date.now(), windowMs = REQUEST_
217
216
  for (const m of messages || []) {
218
217
  if (!m || !m.by || names.includes(m.by) || typeof m.text !== 'string' || (m.ts || 0) < now - windowMs) continue
219
218
  if (settled && settled.has(m.id)) continue // needs no reply (quilt_inbox no_reply)
220
- if (fileQueueMessage(m)) continue // a file queue request or a handoff: handled by handing off, not by a reply
219
+ if (fileQueueMessage(m)) continue // a note from Quilt, or an old file queue request or handoff: no reply needed
221
220
  if (m.kind === 'commit') continue // a commit request told to the owner: handled by committing (quilt_commit_request_done)
222
221
  if (needsNoReply(m.text)) continue // a goodnight, a greeting, thanks: asks nothing
223
222
  const kind = names.includes(m.to) ? 'dm' : !m.to && names.some((n) => mentionsMe(m.text, n, { agent })) ? 'mention' : null
@@ -227,8 +226,9 @@ export function waitingOn (messages, me, { now = Date.now(), windowMs = REQUEST_
227
226
  }
228
227
 
229
228
  /**
230
- * A message that needs no reply: one the relay wrote for the file queue (someone asking for a file,
231
- * or a file handed over), or a note that work someone asked to commit was committed (commit.js).
229
+ * A message that needs no reply: a note from Quilt (nudge), a note that work someone asked to commit
230
+ * was committed (commit.js), or one the relay wrote for the file queue before Quilt stopped holding
231
+ * files (queue, handoff: still in older chat).
232
232
  */
233
233
  export const fileQueueMessage = (m) => !!m && (m.kind === 'queue' || m.kind === 'handoff' || m.kind === 'commit' || m.kind === 'nudge')
234
234
 
@@ -237,30 +237,8 @@ export function unanswered (events, { messages = [], me } = {}) {
237
237
  return (events || []).filter((e) => e && (e.kind === 'dm' || e.kind === 'mention') && !e.queue && !e.commit && !e.nudge && e.by !== me && !needsNoReply(e.text) && !answered(messages, me, e.by, e.ts))
238
238
  }
239
239
 
240
- /**
241
- * Files `me` holds that someone is waiting for: [{ pattern, queue: [{ id, path, by, title,
242
- * description, task }] }], from the relay's claim list.
243
- */
244
- export function queuedFor (claims, me) {
245
- return (claims || []).filter((c) => c && c.by === me && Array.isArray(c.queue) && c.queue.length).map((c) => ({ pattern: c.pattern, queue: c.queue }))
246
- }
247
-
248
- const requestLine = (r) => `${r.by}${r.path ? ` (for ${r.path})` : ''}: "${quote(r.title)}"${r.description ? ` — ${quote(r.description)}` : ''}${r.task ? ` (task ${r.task})` : ''}`
249
-
250
- /** Who is waiting for the files `me` holds, as lines an agent reads with every answer; '' when nobody is. */
251
- export function renderQueueNotice (held) {
252
- if (!held || !held.length) return ''
253
- const lines = held.map((h) => `- ${h.pattern}: ${h.queue.map(requestLine).join('; then ')}`)
254
- return 'Waiting in the file queue for files you hold:\n' + lines.join('\n') + '\n' +
255
- 'Finish the change you are making to each, then hand it off with quilt_handoff (path, and context: what you changed, what is left, anything they should know). ' +
256
- 'You cannot finish or release these files until you do.'
257
- }
258
-
259
- /** Why an agent may not finish (or let go of files) yet: files it holds that someone is waiting for. '' when none. */
260
- export function renderQueued (held, then = 'finish again') {
261
- if (!held || !held.length) return ''
262
- return 'Not yet: ' + renderQueueNotice(held).replace(/^Waiting/, 'people are waiting') + ` Then ${then}.`
263
- }
240
+ /** What the claim tools (kept one release for older agents) answer: nothing is held, and they change nothing. */
241
+ export const NO_HOLDS = 'Quilt holds no files: nothing to claim. Edit any file you may change: edits merge as they arrive, and if your change clashes with someone\'s on the same lines, Quilt tells you and you resolve it.'
264
242
 
265
243
  const quote = (t) => {
266
244
  const s = String(t || '').replace(/\s+/g, ' ').trim()
@@ -282,9 +260,26 @@ export function renderChatAbout (said, { now = Date.now(), max = 8 } = {}) {
282
260
  'Take it into account: if they asked you to leave a file alone or to change it a certain way, do that, and reply to anyone you have not replied to with quilt_message.'
283
261
  }
284
262
 
263
+ /**
264
+ * Who else wrote the files an agent is about to change lately, and whose unfinished work is boxed on
265
+ * them (quilt_before_edit's `files`: [{ path, recent: [{ by, at }], box?: { by } }]). Presence, never a
266
+ * hold: '' when nobody.
267
+ */
268
+ export function renderRecent (files, { now = Date.now() } = {}) {
269
+ const lines = []
270
+ for (const f of files || []) {
271
+ if (!f || !f.path) continue
272
+ const who = (f.recent || []).filter((w) => w && w.by).map((w) => `${w.by} ${ago(w.at, now)}`)
273
+ if (who.length) lines.push(`- ${f.path}: changed lately by ${who.join(', ')}`)
274
+ if (f.box && f.box.by) lines.push(`- ${f.path}: ${f.box.by}'s unfinished work is boxed on it; your edit opens the box and merges with it`)
275
+ }
276
+ if (!lines.length) return ''
277
+ return 'Others working on these files (nobody holds files: edit them; changes merge as they arrive, and a clash on the same lines comes back to you to resolve):\n' + lines.join('\n')
278
+ }
279
+
285
280
  /**
286
281
  * Why an agent may not go on yet: the messages it still owes an answer, or '' when it owes none.
287
- * `then` says what to do once they're answered ("finish again", "call quilt_claim again").
282
+ * `then` says what to do once they're answered ("finish again", "move the task again").
288
283
  */
289
284
  export function renderUnanswered (events, then = 'finish again') {
290
285
  if (!events || !events.length) return ''
@@ -294,22 +289,3 @@ export function renderUnanswered (events, then = 'finish again') {
294
289
  `One that needs nothing back (thanks, a greeting, an FYI, a status report) gets no reply: settle it with quilt_inbox (no_reply: [its id]). Then ${then}. ` +
295
290
  'Reading, messaging and checking files work meanwhile.'
296
291
  }
297
-
298
- /** One refusal for an edit to a file someone else holds: who, and what to do instead of retrying. */
299
- export function heldRefusal (rel, claim, error) {
300
- const holder = claim ? claim.by : 'someone else'
301
- const why = claim ? (claim.note ? ` (${claim.note})` : '') : error ? ` (${error})` : ''
302
- // A box (docs/superpowers/specs/2026-10-16-git-boxes-design.md): their work isn't in this folder yet.
303
- if (claim && claim.box) return `${rel} is boxed by ${holder}${why}: their unfinished work, which isn't in your folder until they commit or unpack it. Quilt refuses edits to it and would undo them. ${askForIt(rel, claim)}`
304
- const covered = claim && claim.pattern && claim.pattern !== rel ? `, as part of their claim on ${claim.pattern}` : ''
305
- return `${rel} is claimed by ${holder}${why}${covered}, so Quilt refuses edits to it and would undo them. ${askForIt(rel, claim)}`
306
- }
307
-
308
- /** What to do about a file someone else holds: ask for it in its file queue, and carry on. */
309
- export function askForIt (rel, claim) {
310
- const holder = claim ? claim.by : 'its holder'
311
- const waiting = claim && Array.isArray(claim.queue) && claim.queue.length ? ` ${claim.queue.length} already waiting for it.` : ''
312
- return `Do not retry or work around it.${waiting} ` +
313
- `Ask for it in its file queue with quilt_request_file (path "${rel}", a title like "Working on <what> for <task>", and a description of up to 300 characters: what you plan to change and why). ` +
314
- `${holder} is told, and hands it to you with their context when they are done; you are woken when it is yours. Carry on with other work meanwhile.`
315
- }
@@ -1,4 +1,4 @@
1
- // R3 removed GitHub commits; only this pure helper stays, because test/unit/history.test.js (claimed in
1
+ // R3 removed GitHub commits; only this pure helper stays, because test/unit/history.test.js (in
2
2
  // another square, sq:09a100d0) still imports it from here. Delete this file with that test's import.
3
3
  import { blameChange } from './history.js'
4
4