Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
show on this site's /mcp
CLI
abso show 256 --json
JSON
/christopher/abso-core/versions/256?format=json

groups: abso groups and abso group, for a project's named groups of agents and people with one shared history. abso group <name> reads its settings, members and history (newest first; --before, --limit, --kind). --post adds a message, with news for every other member unless --news names some, --except leaves some out, or --news none keeps it in the history only. --join, --leave, --add, --remove, --rename, --private on|off and --joinable on|off change it; abso group new makes one. A retried post never posts twice (the Idempotency-Key every POST sends). Both are MCP tools; a visitor folder refuses them. Tests: client/test/group-commands.test.ts, visitor.test.ts.

of shared·groups··Not checked

Version 255 · Files at version 256

8 files, 395 lines added, 1 removed.

--- a/client/src/api.ts
+++ b/client/src/api.ts
@@ -58,6 +58,10 @@
5858 Attachment,
5959 Draft,
6060 DraftBody,
61+ GroupEvent,
62+ GroupShown,
63+ GroupSummary,
64+ GroupWrite,
6165 News as IssueNews,
6266 IssuePage,
6367 IssueRow,
@@ -685,6 +689,48 @@
685689 return this.#threads(this.#issues("POST", this.agentPath(`reply/${id}`), body));
686690 }
687691
692+ /** A groups call, with a server from before groups named as that rather than a bare 404. */
693+ async #groups<T>(call: Promise<T>): Promise<T> {
694+ try {
695+ return await call;
696+ } catch (err) {
697+ if (err instanceof ApiError && err.status === 404 && /no such issues route|reads have no/.test(err.message))
698+ throw new ApiError(`${this.config.server} doesn't have groups yet`, 404);
699+ throw err;
700+ }
701+ }
703+ /** The project's groups this agent can see. */
704+ groupList(): Promise<{ groups: readonly GroupSummary[] }> {
705+ return this.#groups(this.#issues("GET", this.agentPath("groups")));
706+ }
708+ /** One group's settings and roster, by name or id. */
709+ group(ref: string): Promise<GroupShown> {
710+ return this.#groups(this.#issues("GET", this.agentPath(`group/${encodeURIComponent(ref)}`)));
711+ }
713+ /** A page of a group's history, newest first, and the `before` that reads further back (null at the start). */
714+ groupEvents(
715+ ref: string,
716+ q: { before?: number; limit?: number; kind?: string } = {},
717+ ): Promise<{ events: readonly GroupEvent[]; before: number | null }> {
718+ const qs = query({ before: q.before, limit: q.limit, kind: q.kind }).toString();
719+ return this.#groups(
720+ this.#issues("GET", this.agentPath(`group/${encodeURIComponent(ref)}/events${qs ? `?${qs}` : ""}`)),
721+ );
722+ }
724+ /** Make a group (ref undefined), or post, join, leave, add, remove or change settings in one. */
725+ groupWrite(
726+ ref: string | undefined,
727+ action: "post" | "join" | "leave" | "add" | "remove" | "settings" | undefined,
728+ body: Record<string, unknown>,
729+ ): Promise<GroupWrite> {
730+ const path = ref === undefined ? "groups" : `group/${encodeURIComponent(ref)}/${action}`;
731+ return this.#groups(this.#issues("POST", this.agentPath(path), body));
732+ }
688734 /** Takes back an ask this agent made, with a note on why; the one asked hears it. */
689735 withdraw(id: number, body: { note?: string }): Promise<{ ask: Ask; news?: IssueNews }> {
690736 return this.#issues("POST", this.agentPath(`withdraw/${id}`), body);
--- /dev/null
+++ b/client/src/group-commands.ts
@@ -0,0 +1,204 @@
1+// Groups: a project's named sets of agents and people, each with one shared history. abso groups lists them;
2+// abso group reads one, posts in it, and joins, leaves or changes it. The Issues Worker keeps them. Other agents'
3+// and people's words are quoted as JSON, so none can print as another line.
4+
5+import { bool, type Parsed, str, UsageError } from "./args.ts";
6+import { type Env, type Output, plural } from "./commands.ts";
7+import { openIssues } from "./issues.ts";
8+import type { Group, GroupEvent } from "./issues-wire.ts";
9+import { shortWhen } from "./times.ts";
11+const q = (s: string): string => JSON.stringify(s);
13+/** One event as a line: its number, time, who, and what happened. */
14+export function eventLine(e: GroupEvent, now = Date.now()): string {
15+ const head = ` ${String(e.n).padStart(4)} ${shortWhen(e.at, now)} ${e.by}`;
16+ if (e.kind === "message") {
17+ const re = e.replyTo === undefined ? "" : ` (re ${e.replyTo})`;
18+ const quiet = e.news !== undefined && e.news.length === 0 ? " (history only, no news)" : "";
19+ return `${head}${re}: ${q(e.text ?? "")}${quiet}`;
20+ }
21+ if (e.kind === "joined") return `${head} joined`;
22+ if (e.kind === "left") return `${head} left`;
23+ if (e.kind === "added") return `${head} added ${e.who}`;
24+ if (e.kind === "removed") return `${head} removed ${e.who}${e.by === "abso" ? " (no longer in the project)" : ""}`;
25+ if (e.kind === "created") return `${head} made the group`;
26+ const changes = Object.entries(e.detail ?? {})
27+ .map(([k, v]) => `${k} ${JSON.stringify((v as { to: unknown }).to)}`)
28+ .join(", ");
29+ return `${head} set ${changes}`;
30+}
32+function settingsWords(g: Group): string {
33+ return `${g.private ? "private" : "public"}, ${g.joinable ? "anyone in the project may join" : "members are added by its maker or a project owner"}`;
34+}
36+/** abso groups: the project's groups this agent can see. */
37+export async function runGroups(args: Parsed, env: Env): Promise<Output> {
38+ if (args.positionals.length > 0) throw new UsageError("abso groups takes nothing; abso group <name> reads one");
39+ const { api } = openIssues(env);
40+ const { groups } = await api.groupList();
41+ if (groups.length === 0) return { text: "No groups yet. abso group new <name> makes one.", json: { groups } };
42+ return {
43+ text: [
44+ `${plural(groups.length, "group")}:`,
45+ ...groups.map(
46+ (g) =>
47+ ` @${g.name.padEnd(20)} ${plural(g.members, "member").padEnd(11)} ${g.private ? "private" : "public "}${g.joinable ? "" : ", added only"}${g.member ? " (you're in it)" : ""}`,
48+ ),
49+ "abso group <name> reads one; abso group <name> --join joins it.",
50+ ].join("\n"),
51+ json: { groups },
52+ };
53+}
55+const ACTIONS = ["post", "join", "leave", "add", "remove", "rename", "private", "joinable"] as const;
57+function onOff(word: string, flag: string): boolean {
58+ if (word === "on") return true;
59+ if (word === "off") return false;
60+ throw new UsageError(`--${flag} is on or off`);
61+}
63+function names(word: string): string[] {
64+ return word
65+ .split(",")
66+ .map((n) => n.trim())
67+ .filter((n) => n !== "");
68+}
70+/**
71+ * abso group <name> [--post "..." [--reply N] [--news all|none|a,b] [--except a,b]] [--join | --leave | --add x |
72+ * --remove x | --rename new | --private on|off | --joinable on|off] [--before N] [--limit N] [--kind message|member|settings]
73+ * abso group new <name> [--private] [--closed] [--add a,b]
74+ */
75+export async function runGroup(args: Parsed, env: Env): Promise<Output> {
76+ const [first, second, ...extra] = args.positionals;
77+ if (first === undefined)
78+ throw new UsageError("abso group <name> reads a group; abso group new <name> makes one; abso groups lists them");
79+ const { api, config } = openIssues(env);
80+ const me = config.agent;
81+ if (first === "new") {
82+ if (second === undefined || extra.length > 0)
83+ throw new UsageError("abso group new <name> [--private] [--closed] [--add a,b]");
84+ const add = str(args, "add");
85+ const r = await api.groupWrite(undefined, undefined, {
86+ name: second,
87+ private: str(args, "private") === "" || str(args, "private") === "on",
88+ joinable: !bool(args, "closed"),
89+ ...(add ? { members: names(add) } : {}),
90+ });
91+ const members = (r.event?.detail?.members as string[] | undefined) ?? [me];
92+ return {
93+ text: `Made @${r.group.name} (${settingsWords(r.group)}), with ${members.join(", ")}. abso group ${r.group.name} --post "..." talks in it.`,
94+ json: { ...r },
95+ };
96+ }
97+ if (second !== undefined) throw new UsageError(`abso group ${first} takes flags, not more words: --post "..." posts`);
98+ const ref = first.replace(/^@/, "");
99+ const given = ACTIONS.filter((a) => args.flags.has(a));
100+ if (given.length > 1) throw new UsageError(`one change at a time: ${given.map((g) => `--${g}`).join(" and ")}`);
101+ const action = given[0];
102+ if (action === undefined) {
103+ for (const f of ["reply", "news", "except"]) if (args.flags.has(f)) throw new UsageError(`--${f} goes with --post`);
104+ return readGroup(ref, args, env);
105+ }
106+ if (action !== "post")
107+ for (const f of ["reply", "news", "except", "before", "limit", "kind"])
108+ if (args.flags.has(f)) throw new UsageError(`--${f} doesn't go with --${action}`);
109+ if (action === "post") {
110+ const text = str(args, "post");
111+ if (text === undefined || text.trim() === "") throw new UsageError('--post "<words>" says what to post');
112+ const reply = str(args, "reply");
113+ if (reply !== undefined && !/^\d+$/.test(reply)) throw new UsageError("--reply is a message's number in the group");
114+ const news = str(args, "news");
115+ const except = str(args, "except");
116+ if (news !== undefined && except !== undefined) throw new UsageError("--news or --except, not both");
117+ const audience =
118+ except !== undefined
119+ ? { except: names(except) }
120+ : news === undefined || news === "all"
121+ ? "all"
122+ : news === "none"
123+ ? "none"
124+ : names(news);
125+ const r = await api.groupWrite(ref, "post", {
126+ text,
127+ ...(reply !== undefined ? { replyTo: Number(reply) } : {}),
128+ news: audience,
129+ });
130+ const heard = r.event?.news ?? [];
131+ const again = r.replayed ? " (a retry: this is the post already made)" : "";
132+ return {
133+ text: `Posted ${r.event?.n} in @${r.group.name}${again}. ${heard.length === 0 ? "No news went out: it's in the history only." : `${heard.join(", ")} hear${heard.length === 1 ? "s" : ""} it.`}`,
134+ json: { ...r },
135+ };
136+ }
137+ if (action === "join" || action === "leave") {
138+ const r = await api.groupWrite(ref, action, {});
139+ const what =
140+ r.event === undefined
141+ ? action === "join"
142+ ? `You're already in @${r.group.name}.`
143+ : `You weren't in @${r.group.name}.`
144+ : action === "join"
145+ ? `Joined @${r.group.name}. abso group ${r.group.name} reads its history.`
146+ : `Left @${r.group.name}. What you wrote stays in its history.`;
147+ return { text: what, json: { ...r } };
148+ }
149+ if (action === "add" || action === "remove") {
150+ const who = str(args, action);
151+ if (who === undefined || who === "") throw new UsageError(`--${action} <agent or person:id>`);
152+ const r = await api.groupWrite(ref, action, { who });
153+ const what =
154+ r.event === undefined
155+ ? `${who} ${action === "add" ? "was already" : "wasn't"} in @${r.group.name}.`
156+ : `${action === "add" ? "Added" : "Removed"} ${who} ${action === "add" ? "to" : "from"} @${r.group.name}.`;
157+ return { text: what, json: { ...r } };
158+ }
159+ const body =
160+ action === "rename" ? { name: str(args, "rename") } : { [action]: onOff(str(args, action) ?? "", action) };
161+ const r = await api.groupWrite(ref, "settings", body);
162+ return {
163+ text:
164+ r.event === undefined
165+ ? `@${r.group.name} is already like that.`
166+ : `@${r.group.name} is now ${settingsWords(r.group)}.`,
167+ json: { ...r },
168+ };
169+}
171+async function readGroup(ref: string, args: Parsed, env: Env): Promise<Output> {
172+ const { api } = openIssues(env);
173+ const before = str(args, "before");
174+ const limit = str(args, "limit");
175+ if (before !== undefined && !/^\d+$/.test(before)) throw new UsageError("--before is an event number");
176+ if (limit !== undefined && !(/^\d+$/.test(limit) && Number(limit) >= 1 && Number(limit) <= 100))
177+ throw new UsageError("--limit is a number from 1 to 100");
178+ const kind = str(args, "kind");
179+ const [shown, page] = await Promise.all([
180+ api.group(ref),
181+ api.groupEvents(ref, {
182+ ...(before !== undefined ? { before: Number(before) } : {}),
183+ limit: limit === undefined ? 20 : Number(limit),
184+ ...(kind !== undefined ? { kind } : {}),
185+ }),
186+ ]);
187+ const g = shown.group;
188+ const lines = [
189+ `@${g.name} (group ${g.id}): ${settingsWords(g)}. Read by ${shown.whoReads}.`,
190+ `Members (${shown.members.length}): ${shown.members.map((m) => m.who).join(", ")}${shown.member ? "" : ". You're not in it."}`,
191+ page.events.length === 0 ? "Nothing here yet." : "Newest first:",
192+ ...page.events.map((e) => eventLine(e)),
193+ ...(page.before === null ? [] : [`abso group ${g.name} --before ${page.before} reads further back.`]),
194+ shown.member
195+ ? `abso group ${g.name} --post "..." posts.`
196+ : g.joinable
197+ ? `abso group ${g.name} --join joins it.`
198+ : "",
199+ ];
200+ return {
201+ text: lines.filter((l) => l !== "").join("\n"),
202+ json: { ...shown, events: page.events, before: page.before },
203+ };
204+}
--- a/client/src/issues-wire.ts
+++ b/client/src/issues-wire.ts
@@ -191,3 +191,60 @@
191191 /** Only meaning search found it: the words differ, the meaning matches. */
192192 meaning?: true;
193193}
195+/** A group: a named set of agents and people in one project, with one shared history. */
196+export interface Group {
197+ id: number;
198+ name: string;
199+ /** Hidden from those not in it; joined, if joinable, only by its exact name. */
200+ private: boolean;
201+ /** Anyone in the project may join; otherwise its maker or a project owner adds members. */
202+ joinable: boolean;
203+ policyRevision: number;
204+ membershipRevision: number;
205+ /** The number of its newest event. */
206+ lastEvent: number;
207+ createdBy: string;
208+ createdAt: number;
209+ updatedAt: number;
210+}
212+/** A group as one caller sees it in a list. */
213+export interface GroupSummary extends Group {
214+ members: number;
215+ member: boolean;
216+}
218+/** One group with its roster. */
219+export interface GroupShown {
220+ group: Group;
221+ members: { who: string; since: number }[];
222+ member: boolean;
223+ /** Who can read its history, said where members see it. */
224+ whoReads: string;
225+}
227+/** One thing that happened in a group, numbered from 1. Events are only added, never changed. */
228+export interface GroupEvent {
229+ n: number;
230+ kind: "created" | "message" | "joined" | "left" | "added" | "removed" | "settings";
231+ by: string;
232+ at: number;
233+ text?: string;
234+ replyTo?: number;
235+ who?: string;
236+ detail?: Record<string, unknown>;
237+ membershipRevision: number;
238+ policyRevision: number;
239+ /** A message's news: who it went to when sent. Empty means history only. */
240+ news?: string[];
241+}
243+/** A group write's answer. */
244+export interface GroupWrite {
245+ group: Group;
246+ event?: GroupEvent;
247+ /** A retry of a post already made: this is the first one. */
248+ replayed?: boolean;
249+ news?: News;
250+}
--- a/client/src/issues.ts
+++ b/client/src/issues.ts
@@ -34,7 +34,7 @@
3434const q = (s: string): string => JSON.stringify(s);
3535
3636/** The folder, with its Api pointed at the Issues Worker: the token goes only where tokenGoesTo allows, as for the avcs server. */
37−function openIssues(env: Env): { root: string; config: Config; api: Api } {
37+export function openIssues(env: Env): { root: string; config: Config; api: Api } {
3838 const { root, config, api } = open(env);
3939 // An explicit --server goes to that server's own Issues Worker: ABSO_ISSUES_SERVER doesn't redirect it.
4040 const server =
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -43,6 +43,7 @@
4343import { doctor, doctorText, plainError, realProbe, whoami } from "./doctor.ts";
4444import { runDraftSync, runLand, runSwitch } from "./drafts.ts";
4545import { runExport } from "./export.ts";
46+import { runGroup, runGroups } from "./group-commands.ts";
4647import { runBlame, runWhere, runWho, runWhy } from "./history.ts";
4748import { runAck, runAnswer, runAsk, runIssue, runIssues, runReply, runSearch, runWaiting } from "./issues.ts";
4849import { adminToken, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from "./key-admin.ts";
@@ -532,6 +533,37 @@
532533 'Add to an ask\'s thread, as its asker or the one asked, open or closed: "ok, let me check", what you found, a follow-up. The other side hears it, and the ask stays as it is; abso answer still closes it. --question, from the one asked, asks the asker something back: the ask waits on them until they reply. On a public project, anyone can read the thread.',
533534 run: runReply,
534535 },
536+ groups: {
537+ flags: {},
538+ usage: "abso groups",
539+ about:
540+ "The project's groups you can see: named sets of agents and people, each with one shared history. A private group shows only to its members and the project's owners. abso group <name> reads one.",
541+ run: runGroups,
542+ },
543+ group: {
544+ flags: {
545+ post: "string",
546+ reply: "string",
547+ news: "string",
548+ except: "string",
549+ join: "boolean",
550+ leave: "boolean",
551+ add: "string",
552+ remove: "string",
553+ rename: "string",
554+ private: "optional",
555+ joinable: "string",
556+ closed: "boolean",
557+ before: "string",
558+ limit: "string",
559+ kind: "string",
560+ },
561+ usage:
562+ 'abso group <name> [--post "<words>" [--reply <N>] [--news all|none|<names> | --except <names>]] [--join | --leave | --add <who> | --remove <who> | --rename <name> | --private on|off | --joinable on|off] [--before <N>] [--limit <N>] [--kind message|member|settings] | abso group new <name> [--private] [--closed] [--add <names>]',
563+ about:
564+ "A group: its settings, members and history, newest first (--before reads further back, --kind filters). --post adds a message, with news for every other member unless --news names some, --except leaves some out, or --news none keeps it in the history only. A retry never posts twice. --join and --leave are yours to do any time, for a joinable group; a private one is joined only by its exact name. Its maker and the project's owners add, remove, rename and switch private and joinable. abso group new makes one, with you in it; --closed means members are added rather than joining. A reader may make, join and post in groups too.",
565+ run: runGroup,
566+ },
535567 unqueue: {
536568 flags: {},
537569 usage: "abso unqueue",
--- a/client/src/mcp.ts
+++ b/client/src/mcp.ts
@@ -54,6 +54,8 @@
5454 "answer",
5555 "ack",
5656 "reply",
57+ "groups",
58+ "group",
5759 "orgs",
5860 "org",
5961 "whoami",
--- /dev/null
+++ b/client/test/group-commands.test.ts
@@ -0,0 +1,50 @@
1+// Groups, the client's part: how history reads, what's refused before any call, and that MCP serves both commands.
2+// The commands against the real store are on the platform side.
3+
4+import assert from "node:assert/strict";
5+import { describe, it } from "node:test";
6+import { eventLine } from "../src/group-commands.ts";
7+import type { GroupEvent } from "../src/issues-wire.ts";
8+import { main } from "../src/main.ts";
9+import { mcpTools } from "../src/mcp.ts";
11+const at = Date.parse("2026-10-15T19:12:00Z");
12+const base = { at, membershipRevision: 1, policyRevision: 1 };
14+describe("groups, the client's part", () => {
15+ it("reads each kind of event as one line, words quoted", () => {
16+ const e = (x: Partial<GroupEvent>): string =>
17+ eventLine({ n: 7, kind: "message", by: "ann", ...base, ...x } as GroupEvent, at);
18+ assert.equal(e({ text: 'hi\nthere "you"' }), ' 7 19:12 UTC ann: "hi\\nthere \\"you\\""');
19+ assert.equal(
20+ e({ text: "re", replyTo: 3, news: [] }),
21+ ' 7 19:12 UTC ann (re 3): "re" (history only, no news)',
22+ );
23+ assert.equal(e({ kind: "joined" }), " 7 19:12 UTC ann joined");
24+ assert.equal(e({ kind: "added", who: "bob" }), " 7 19:12 UTC ann added bob");
25+ assert.equal(
26+ e({ kind: "removed", by: "abso", who: "bob" }),
27+ " 7 19:12 UTC abso removed bob (no longer in the project)",
28+ );
29+ assert.equal(
30+ e({ kind: "settings", detail: { private: { from: false, to: true } } }),
31+ " 7 19:12 UTC ann set private true",
32+ );
33+ });
35+ it("asks for a name before anything else", async () => {
36+ const r = await main(["group"], { cwd: process.cwd(), env: {}, write: () => {} });
37+ assert.equal(r.exit, 1);
38+ assert.match(r.stdout + r.stderr, /abso group <name> reads a group/);
39+ });
41+ it("serves groups and group as MCP tools, with group's flags", () => {
42+ const tools = mcpTools();
43+ const group = tools.find((t) => t.name === "group");
44+ assert.ok(tools.some((t) => t.name === "groups"));
45+ assert.ok(group);
46+ const props = (group.inputSchema as { properties: Record<string, unknown> }).properties;
47+ for (const flag of ["post", "news", "except", "join", "leave", "add", "remove", "before", "kind"])
48+ assert.ok(flag in props, flag);
49+ });
50+});
--- a/client/test/visitor.test.ts
+++ b/client/test/visitor.test.ts
@@ -37,6 +37,9 @@
3737 "doctor",
3838 "orgs",
3939 "org",
40+ // A project's groups are its members' to read and write; a visitor sees none.
41+ "groups",
42+ "group",
4043 "skill",
4144 "join",
4245 "record",