{"version":211,"agent":"autosettle","message":"Settled automatically, on the record and in the other agent's news (abso-core 23)\n\nThe client's re-push after settling by itself now ends its message with a fixed trailer, one line per file: 'Settled automatically (abso 19):' then '- <file>: kept <side>, confidence 0.81. <reason>' (or 'by a check in code'). autoTrailer writes it and autoSettledOf reads it back, both in worker/project/autosettle.ts. Publish and the merge queue put it on each settle record as settled[].auto {pick, by, confidence, reason}, so the website can mark the version. The other agent's news says 'X settled its collision with your version N in <file> automatically, as abso's model advised (confidence 0.81), pushing version V: ...' and still outlasts a sync.\n\nTests: autosettle.test.ts 9 (trailer round trip, news words), the client's settle/held tests 21, held-push, markers, project, same-line. Typecheck and server typecheck clean. Local open server under act: the trailer is written as above.","time":1792036574787,"timeIso":"2026-10-15T03:56:14.787Z","changes":8,"change":3517,"files":["client/src/publish-commands.ts","scripts/autosettle/STORIES.md","worker/project/autosettle.ts","worker/project/news.ts","worker/project/project-types.ts","worker/project/publish.ts","worker/project/queue.ts","worker/project/test/autosettle.test.ts"],"draft":null,"diff":[{"path":"client/src/publish-commands.ts","added":2,"removed":2,"diff":"--- a/client/src/publish-commands.ts\n+++ b/client/src/publish-commands.ts\n@@ -2,6 +2,7 @@\n \n import { existsSync, readFileSync } from \"node:fs\";\n import { join } from \"node:path\";\n+import { autoTrailer } from \"../../worker/project/autosettle.ts\";\n import { type Advice, type Api, ApiError, type Collision, type Settled } from \"./api.ts\";\n import { bool, type Parsed, str, UsageError } from \"./args.ts\";\n import { boxOf, knownPrep, runRun, shellWord } from \"./box-commands.ts\";\n@@ -501,14 +502,13 @@\n \t\t\t\t].join(\"\\n\"),\n \t\t\t\tjson: { collisions, advice, autosettle: { pulled: true, settled: done, left } },\n \t\t\t};\n-\t\tconst why = [...plan].map(([file, a]) => `${file}: kept ${a.pick} (${a.reason})`).join(\"; \");\n \t\tconst again = await publishSteps(\n \t\t\targs,\n \t\t\tenv,\n \t\t\troot,\n \t\t\tconfig,\n \t\t\tapi,\n-\t\t\t`${message}\\n\\nSettled automatically (abso 19): ${why}`,\n+\t\t\t`${message}\\n\\n${autoTrailer(plan)}`,\n \t\t\tchecked,\n \t\t\twaitSeconds,\n \t\t\tskippedCheck,"},{"path":"scripts/autosettle/STORIES.md","added":51,"removed":0,"diff":"--- /dev/null\n+++ b/scripts/autosettle/STORIES.md\n@@ -0,0 +1,51 @@\n+# Auto-settle: stories\n+\n+Christopher, 2026-10-14: \"we give it to everyone for free but we have a gate on it. The gate defaults to on but can be turned off with the runtime controls… on a given project… off - advice only - attempt auto-merge and maybe set the slider or something for confidence… The website especially needs affordances for this.\"\n+\n+What exists (abso-core 204, issue 19):\n+- On a held push, the server asks Clef which settle fits each collision: keep yours, keep theirs, keep both, or leave it to an agent. Code checks run before and after the model.\n+- Under advice, the held push's answer carries that advice, and the agent still settles.\n+- Under settle, the client pulls, settles the collisions advised a side, and pushes again, with \"Settled automatically\" in the message.\n+- Today one server-wide variable, `AUTOSETTLE`, picks off, `on` (advice) or `act` (settle).\n+\n+Words: hold (a push refused for colliding), settle, advice, confidence, auto-settle.\n+\n+## Gate (environment-wide)\n+- **G1** · Operator · Auto-settle is a runtime control beside CI and sign-ins. It is open unless stopped. Stopping it takes effect on the next push, everywhere, with a reason in the control's audit log.\n+- **G2** · Anyone · While the gate is stopped, held pushes look exactly as they do without auto-settle. A project's setting is kept, and the website says \"Stopped by abso for now\" beside it.\n+- **G3** · Operator · If the control can't be read, or the model fails or is slow, the push gets no advice rather than an error. A hold never gets worse because of auto-settle.\n+\n+## Project setting\n+- **P1** · Owner · Project Settings has an Auto-settle section with three choices: **Off**, **Advise**, **Settle**. New projects start on Advise. *(Pitch: Advise is free and changes nothing an agent does. Settle is opt-in per project.)*\n+- **P2** · Owner · Under Settle, a confidence slider sets how sure the model must be before abso settles (default 0.5). Below it, the hold stays with the agent, carrying the advice.\n+- **P3** · Owner · Beside the slider: \"At this setting, the last N holds would have gone: X settled, Y to an agent\". The figures come from the project's own past holds, so the slider shows its effect before I save.\n+- **P4** · Owner · The CLI matches: `abso autosettle [off|advise|settle] [--at 0.6]`. With no argument it shows the setting and who changed it last.\n+- **P5** · Writer, Reader · I see the setting read-only, and who set it.\n+- **P6** · Owner · A change to the setting is a line on the project's Now: \"Christopher set auto-settle to Settle at 0.6\".\n+\n+## Agent\n+- **A1** · Agent · When my push is held under Advise, the hold's text gives each collision's advice in one line: the pick, the confidence, and the reason.\n+- **A2** · Agent · Under Settle, a held push that abso can settle goes through as one push. The output says which files abso settled and how, and how to see or undo it.\n+- **A3** · Agent · If any collision in my push is left to an agent, nothing is settled for me, not even the rest. I get the hold as today, with advice on every collision.\n+- **A4** · Agent · `ABSO_AUTOSETTLE=off` on my machine means I always settle by hand, whatever the project says.\n+- **A5** · Other agent · When abso settles a hold against my work, my news says so, like any settle: \"abso settled X's collision with your version N in file: kept theirs (confidence 0.81: reason)\".\n+\n+## Record and undo\n+- **R1** · Anyone · A version abso settled is marked on Activity and on the version page: \"Settled automatically\", with each file's pick, confidence and reason. `abso why file:line` names it too.\n+- **R2** · Writer · On that version there's an **Undo** button: it drops the version (as `abso drop`) and gives the hold back to the agent who pushed it. If later versions build on it, it says so first.\n+- **R3** · Owner · Project Settings shows the last 30 days: holds advised, settled automatically, left to agents, and undone. Undos are the sign the slider is too low.\n+\n+## Cost\n+- **C1** · Anyone · Auto-settle is free on every project, public or private. It runs on abso's Workers AI.\n+- **C2** · Operator · Each project has a ceiling on model calls per hour. Past it, holds get no advice until the hour turns, and Settings says so. This keeps one busy project from spending everyone's share.\n+\n+## Tonight\n+In order, cut-first:\n+1. Gate as a runtime control (G1–G3) and the project setting stored on the project (P1, P2, P5), read on publish in place of the server-wide variable.\n+2. Website Settings section: the three choices and the slider (P1, P2, P5), plus the \"Stopped by abso\" line (G2).\n+3. \"Settled automatically\" on Activity and the version page (R1), and news to the other agent (A5).\n+4. Later: the slider preview (P3), Undo (R2), the 30-day figures (R3), the call ceiling (C2), and the CLI command (P4).\n+\n+## Open\n+- Does the server settle, or the client? Today the client settles, because a server-side settle moves the agent's base without its folder knowing. The client way works on every client at 204 or newer. Older clients only see advice.\n+- Default for new projects: Advise (pitched above), or Settle?"},{"path":"worker/project/autosettle.ts","added":43,"removed":0,"diff":"--- a/worker/project/autosettle.ts\n+++ b/worker/project/autosettle.ts\n@@ -3,6 +3,8 @@\n // Off unless AUTOSETTLE is \"on\" (advice) or \"act\" (the client settles) and the Worker has an AI binding. The model\n // picks one of four words; it never writes code.\n \n+import type { AutoSettled } from \"./project-types.ts\";\n+\n /** abso's settle choices, plus a hand edit by an agent. */\n export type Pick = \"yours\" | \"theirs\" | \"both\" | \"agent\";\n export const PICKS: readonly Pick[] = [\"yours\", \"theirs\", \"both\", \"agent\"];\n@@ -40,6 +42,47 @@\n \treadonly ms: number;\n }\n \n+/**\n+ * The heading a client puts over what it settled by itself, in the message of the push that follows (abso-core 19,\n+ * 23). One line per file under it: `- <file>: kept <side>, confidence 0.81. <reason>` or `…, by a check in code. …`.\n+ */\n+export const AUTO_HEADING = \"Settled automatically (abso 19):\";\n+\n+/** The lines a client adds to its message for the files it settled by itself. */\n+export function autoTrailer(\n+\tplan: Iterable<\n+\t\treadonly [\n+\t\t\tstring,\n+\t\t\t{ readonly pick: string; readonly by: string; readonly confidence: number; readonly reason: string },\n+\t\t]\n+\t>,\n+): string {\n+\tconst lines = [...plan].map(([file, a]) => {\n+\t\tconst how = a.by === \"rule\" ? \"by a check in code\" : `confidence ${a.confidence.toFixed(2)}`;\n+\t\treturn `- ${file}: kept ${a.pick}, ${how}. ${a.reason.replace(/\\s+/g, \" \").trim()}`;\n+\t});\n+\treturn [AUTO_HEADING, ...lines].join(\"\\n\");\n+}\n+\n+/** What a push's message says its abso settled by itself, by file; empty for a push that settled by hand. */\n+export function autoSettledOf(message: string): Map<string, AutoSettled> {\n+\tconst found = new Map<string, AutoSettled>();\n+\tconst lines = message.split(/\\r?\\n/);\n+\tconst at = lines.lastIndexOf(AUTO_HEADING);\n+\tif (at < 0) return found;\n+\tfor (const line of lines.slice(at + 1)) {\n+\t\tconst m = /^- (.+): kept (yours|theirs|both), (?:by a check in code|confidence ([01]\\.\\d\\d))\\. ?(.*)$/.exec(line);\n+\t\tif (!m) break;\n+\t\tfound.set(m[1]!, {\n+\t\t\tpick: m[2] as AutoSettled[\"pick\"],\n+\t\t\tby: m[3] === undefined ? \"rule\" : \"model\",\n+\t\t\tconfidence: m[3] === undefined ? 1 : Number(m[3]),\n+\t\t\treason: m[4] ?? \"\",\n+\t\t});\n+\t}\n+\treturn found;\n+}\n+\n export interface Ai {\n \trun(model: string, input: unknown): Promise<unknown>;\n }"},{"path":"worker/project/news.ts","added":9,"removed":1,"diff":"--- a/worker/project/news.ts\n+++ b/worker/project/news.ts\n@@ -170,11 +170,19 @@\n };\n \n /** The other author of a marked collision a publish settled (#11): what was kept, any lines lost, and the settler's held reason. */\n+/** \" automatically, as abso's model advised (confidence 0.81)\" for a settle the settler's abso made by itself (abso-core 23). */\n+function autoWords(s: Settled): string {\n+\tif (!s.auto) return \"\";\n+\treturn s.auto.by === \"rule\"\n+\t\t? \" automatically, by a check in code\"\n+\t\t: ` automatically, as abso's model advised (confidence ${s.auto.confidence.toFixed(2)})`;\n+}\n+\n export function settledItem(by: string, version: number, s: Settled): NewsItem {\n \treturn {\n \t\tkey: `settled ${by} ${version} ${s.file} ${s.theirs.version}`,\n \t\ttext:\n-\t\t\t`${by} settled its collision with your version ${s.theirs.version} in ${s.file}, pushing version ${version}: ${SETTLED_WHAT[s.kept]}.` +\n+\t\t\t`${by} settled its collision with your version ${s.theirs.version} in ${s.file}${autoWords(s)}, pushing version ${version}: ${SETTLED_WHAT[s.kept]}.` +\n \t\t\t(s.lost\n \t\t\t\t? ` It also lost ${s.lost.length === 1 ? \"a line\" : `${s.lost.length} lines`} you both still had: ${s.lost.map((l) => `\"${clip(l)}\"`).join(\", \")}.`\n \t\t\t\t: \"\") +"},{"path":"worker/project/project-types.ts","added":11,"removed":0,"diff":"--- a/worker/project/project-types.ts\n+++ b/worker/project/project-types.ts\n@@ -452,7 +452,18 @@\n \tlost?: string[];\n \t/** The message of the settler's push that was held for this collision: its side's reason. */\n \theld?: string;\n+\t/** The settler's abso settled it by itself, as the server advised (abso-core 19, 23): from the push's message. */\n+\tauto?: AutoSettled;\n }\n+\n+/** One file a client settled by itself (abso-core 23): the side kept, and the advice it followed. */\n+export interface AutoSettled {\n+\treadonly pick: \"yours\" | \"theirs\" | \"both\";\n+\t/** rule: a check in code decided; model: the model, this sure. */\n+\treadonly by: \"rule\" | \"model\";\n+\treadonly confidence: number;\n+\treadonly reason: string;\n+}\n /** A line both sides changed that a sync merged word by word (#37): check it. */\n export interface MergedLine {\n \tfile: string;"},{"path":"worker/project/publish.ts","added":4,"removed":0,"diff":"--- a/worker/project/publish.ts\n+++ b/worker/project/publish.ts\n@@ -3,6 +3,7 @@\n \n import { type AtomId, buildAtom, type Hunk, joinLines, type ReadView } from \"../../src/engine/index.ts\";\n import { differenceSet, unionOverlay } from \"../../src/engine/state-source.ts\";\n+import { autoSettledOf } from \"./autosettle.ts\";\n import type { Pair } from \"./collisions.ts\";\n import type { DefinitionCollision } from \"./definition-rule.ts\";\n import { heldMessage, keptOf, lostLines, settleLines } from \"./markers.ts\";\n@@ -169,18 +170,21 @@\n \t\t.map((p) => ({ version: p.version, agent: p.agent, message: p.message }));\n \t// What each marked collision kept, judged from the file as published (#11).\n \tconst view = host.agentView(agent);\n+\tconst auto = autoSettledOf(message);\n \tconst settled: Settled[] = agent.marked\n \t\t.filter((r) => r.space === space.name)\n \t\t.map((r) => {\n \t\t\tconst lines = view.hasFile(r.file) ? view.lines(r.file).map((l) => l.text) : [];\n \t\t\tconst lost = lostLines(lines, r);\n \t\t\tconst held = heldMessage(agent, r.file);\n+\t\t\tconst by = auto.get(r.file);\n \t\t\treturn {\n \t\t\t\tfile: r.file,\n \t\t\t\tkept: keptOf(lines, r),\n \t\t\t\ttheirs: { agent: r.agent, version: r.version },\n \t\t\t\t...(lost.length > 0 ? { lost } : {}),\n \t\t\t\t...(held ? { held } : {}),\n+\t\t\t\t...(by ? { auto: by } : {}),\n \t\t\t};\n \t\t});\n \tentries.push({"},{"path":"worker/project/queue.ts","added":4,"removed":0,"diff":"--- a/worker/project/queue.ts\n+++ b/worker/project/queue.ts\n@@ -3,6 +3,7 @@\n \n import { type AtomId, buildAtom, type Graph, type ReadView } from \"../../src/engine/index.ts\";\n import { unionOverlay } from \"../../src/engine/state-source.ts\";\n+import { autoSettledOf } from \"./autosettle.ts\";\n import type { Pair } from \"./collisions.ts\";\n import { definedTwice } from \"./definitions.ts\";\n import { heldMessage, keptOf, lostLines } from \"./markers.ts\";\n@@ -158,18 +159,21 @@\n \t\tif (collisions.length > 0) return host.refuse(agent, space, \"publish\", time, collisions, entries, message);\n \t}\n \tconst view = host.agentView(agent);\n+\tconst auto = autoSettledOf(message);\n \tconst settled: Settled[] = agent.marked\n \t\t.filter((r) => r.space === SHARED)\n \t\t.map((r) => {\n \t\t\tconst lines = view.hasFile(r.file) ? view.lines(r.file).map((l) => l.text) : [];\n \t\t\tconst lost = lostLines(lines, r);\n \t\t\tconst held = heldMessage(agent, r.file);\n+\t\t\tconst by = auto.get(r.file);\n \t\t\treturn {\n \t\t\t\tfile: r.file,\n \t\t\t\tkept: keptOf(lines, r),\n \t\t\t\ttheirs: { agent: r.agent, version: r.version },\n \t\t\t\t...(lost.length > 0 ? { lost } : {}),\n \t\t\t\t...(held ? { held } : {}),\n+\t\t\t\t...(by ? { auto: by } : {}),\n \t\t\t};\n \t\t});\n \tconst id = host.queuedId() + 1;"},{"path":"worker/project/test/autosettle.test.ts","added":49,"removed":1,"diff":"--- a/worker/project/test/autosettle.test.ts\n+++ b/worker/project/test/autosettle.test.ts\n@@ -1,6 +1,7 @@\n import assert from \"node:assert/strict\";\n import { test } from \"node:test\";\n-import { type Ai, adviseHeld, refused, ruled, withAdvice } from \"../autosettle.ts\";\n+import { type Ai, adviseHeld, autoSettledOf, autoTrailer, refused, ruled, withAdvice } from \"../autosettle.ts\";\n+import { outlastsSync, settledItem } from \"../news.ts\";\n \n /**\n  * A stand-in for Workers AI that always leans to `pick`: a System One answer for Clef (`top` on `pick`, the rest\n@@ -112,3 +113,50 @@\n \tconst ok = { ok: true, version: 4 };\n \tassert.equal(await withAdvice({ AUTOSETTLE: \"act\", AI: fakeAi(\"both\") }, \"publish\", \"me\", request, ok), ok);\n });\n+\n+test(\"the message trailer: the client writes what it settled by itself, and the server reads it back by file\", () => {\n+\tconst trailer = autoTrailer([\n+\t\t[\n+\t\t\t\"docs/start.md\",\n+\t\t\t{ pick: \"yours\", by: \"model\", confidence: 0.8125, reason: \"Both fixed the typo;\\nyours adds a line.\" },\n+\t\t],\n+\t\t[\n+\t\t\t\"src/network.ts\",\n+\t\t\t{ pick: \"theirs\", by: \"rule\", confidence: 1, reason: \"every line of yours is already in theirs\" },\n+\t\t],\n+\t]);\n+\tassert.equal(\n+\t\ttrailer,\n+\t\t[\n+\t\t\t\"Settled automatically (abso 19):\",\n+\t\t\t\"- docs/start.md: kept yours, confidence 0.81. Both fixed the typo; yours adds a line.\",\n+\t\t\t\"- src/network.ts: kept theirs, by a check in code. every line of yours is already in theirs\",\n+\t\t].join(\"\\n\"),\n+\t);\n+\tconst read = autoSettledOf(`Fix the jion typo\\n\\n${trailer}`);\n+\tassert.deepEqual(read.get(\"docs/start.md\"), {\n+\t\tpick: \"yours\",\n+\t\tby: \"model\",\n+\t\tconfidence: 0.81,\n+\t\treason: \"Both fixed the typo; yours adds a line.\",\n+\t});\n+\tassert.equal(read.get(\"src/network.ts\")?.by, \"rule\");\n+\tassert.equal(autoSettledOf(\"Settled the typo by hand\").size, 0);\n+});\n+\n+test(\"the other agent's news says the settle was automatic, and still outlasts a sync\", () => {\n+\tconst s = {\n+\t\tfile: \"docs/start.md\",\n+\t\tkept: \"yours\" as const,\n+\t\ttheirs: { agent: \"client\", version: 2 },\n+\t\tauto: { pick: \"yours\" as const, by: \"model\" as const, confidence: 0.81, reason: \"r\" },\n+\t};\n+\tconst item = settledItem(\"docs\", 3, s);\n+\tassert.equal(outlastsSync(item.text), true);\n+\tassert.match(\n+\t\titem.text,\n+\t\t/^docs settled its collision with your version 2 in docs\\/start\\.md automatically, as abso's model advised \\(confidence 0\\.81\\), pushing version 3:/,\n+\t);\n+\tconst byHand = settledItem(\"docs\", 3, { ...s, auto: undefined });\n+\tassert.match(byHand.text, /in docs\\/start\\.md, pushing version 3:/);\n+});"}],"ci":null}