A new mind has Docs, and its agents keep a card with calls: docs.<domain>, the nine task calls, and the task feed
Jonas Templestein, 2026-11-27 14:40 UTC · 3b8ad1b8fdfd291f1743e4e0232c847b69078a0b · parent a3ed324
7 files changed
M AGENTS.md
@@ -12,7 +12,8 @@ | `/repos/config` | this repo: `worker.ts`, the mind's own API (`api.ts`), the homepage, the public profile (`profile/`) | | `/repos/stdlib` | the agent (`agent/`), and what `worker.ts` calls at each publish and each event | | `/repos/dash` | the Dash, on `dash.<domain>`, for members | -| `/repos/tasks` | the Tasks board, on `tasks.<domain>`, for members | +| `/repos/tasks` | the Tasks board, on `tasks.<domain>`, for members, and the calls that an agent keeps a card with | +| `/repos/docs` | Docs, on `docs.<domain>`, for members: the files of the mind's repos, written together in a browser | | `/repos/onboarding` | the first steps of a new mind, on `onboarding.<domain>`, for members: the page, its steps and the onboarding agent's guides | | `/repos/git` | the git app: every repo as a git remote at `git.<domain>/repos/<name>` | | `/repos/task-board` | the task files, under `todo/`, and nothing else. The mind makes it empty at its first publish | @@ -111,7 +112,28 @@ A task is a markdown file under `todo/` of `/repos/task-board`. Its frontmatter holds `status`, `tags`, `size`, `priority`, `owner` and `agent`; its first heading is its title. The board on -`tasks.<domain>` shows and moves them. To take or finish a task, commit its file. +`tasks.<domain>` shows and moves them, and its "Needs a person" lists what the agents ask the +members, who answer there. The switcher at the top of the board shows any other repo's `todo/`. + +Keep a card with the calls of `itx.config`, and write no frontmatter by hand: + +```ts +const { file } = await itx.config.taskOpen({ title, text, owner }); // a new card +await itx.config.taskUpdate({ file, status: "in-review", note: "Found the cause." }); // move it +await itx.config.taskUpdate({ file, ask: "Ada: ship on Friday or on Monday?", decision }); // ask a person +await itx.config.followTasks({ file }); // each change of it then comes to you as a message +await itx.config.taskBoard(); // the whole board, in one call +``` + +Before you make, move, give out, follow or answer a task, read the guide: +`await itx.repos.get("/repos/tasks").readFile("README.md")`. + +## Docs + +`docs.<domain>` shows the files of the mind's repos, for members: several people write one file +at once, comment on it, and what they type is saved as commits to that repo. A task's sheet on the +board edits the task's file the same way. A commit to `/repos/config` publishes the mind, so text +that people write together belongs in another repo. ## Rules
M README.md
@@ -34,6 +34,7 @@ stdlib/ the agent, what worker.ts calls, and what every repo is checked and tested with dash/ the Dash app tasks/ the Tasks app + docs/ the Docs app onboarding/ the first steps of a new mind: the page at onboarding.<domain> and its guides git/ the git app: it serves git.<domain> ```
M api.ts
@@ -4,11 +4,27 @@ // names alone, and never an arrow field, which is no method of the class. worker.ts's class // extends this one. Add a method here, or to worker.ts's class. import { IterateConfigEntrypoint } from "iterate/sdk"; +import { agentCatalogOf, type CatalogItx, isAgentOf } from "@repos/dash/agent-catalog.ts"; import { mergePull } from "@repos/git/pulls.ts"; import { runStep, stepContext } from "@repos/onboarding/steps.ts"; +// @ts-expect-error -- a plain module of the Tasks app, with no types +import { taskAskers } from "@repos/tasks/askers.js"; +// @ts-expect-error -- a plain module of the Tasks app, with no types +import { answerTask } from "@repos/tasks/asks.js"; +// @ts-expect-error -- a plain module of the Tasks app, with no types +import { taskBoard } from "@repos/tasks/board.js"; +// @ts-expect-error -- a plain module of the Tasks app, with no types +import { taskAssign, taskOpen, taskUpdate } from "@repos/tasks/cards.js"; +// @ts-expect-error -- a plain module of the Tasks app, with no types +import { followTasks, taskFollowers, unfollowTasks } from "@repos/tasks/feed.js"; import { profileOf } from "./profile.ts"; import profileFiles from "./profile/"; +/** THE REPO OF THE MIND'S TASKS: the board shows the markdown files under its `todo/` + * (worker.ts, `tasksApp({ repo })`), and the task calls below read and write it when a call + * names no repo. It holds nothing else, and a commit to it publishes nothing. */ +export const TASKS_REPO = "/repos/task-board"; + export abstract class ConfigApi extends IterateConfigEntrypoint { /** `itx.config.profile()`: what the mind says of itself to the world, `{ name, description, * icon }`, as its website answers it at `/.well-known/iterate-profile` (profile.ts). `problem` @@ -37,5 +53,124 @@ async onboardingStep(step: string, action: string) { using itx = this.getItx(); return await runStep(await stepContext(itx), step, action); + } + + // ── THE TASK CALLS: how an agent keeps a card of the board, with no YAML by hand. README.md of + // /repos/tasks is their guide; the code is that repo's cards.js, feed.js, asks.js, askers.js + // and board.js. Each takes `repo: "<name>"` for another repo of the mind than the tasks repo. + + /** `itx.config.taskOpen({ title, text?, status?, owner?, agent?, tags?, ask?, decision?, + * noChoice?, repo?, by? })`: a new card on the board: `text` is the ask in the person's own + * words and where it came from, `owner` the person who asked. It answers + * `{ repo, file, commitOid, link }`. */ + async taskOpen(input: Record<string, unknown>) { + using itx = this.getItx(); + return await taskOpen(itx, { ...input, repo: input?.repo || TASKS_REPO }, this.taskDeps(itx)); + } + + /** `itx.config.taskUpdate({ file, status?, title?, owner?, agent?, tags?, blockedOn?, ask?, + * decision?, tell?, noChoice?, withdraw?, reword?, note?, repo?, by? })`: one commit that keeps + * a card true. `blockedOn: ""` takes the blocker away; `ask` is one more question for a person, + * with its `decision`, its `tell: { agent, words? }` (the agent that acts on the answer) or + * `noChoice`; `withdraw: { ask, why }` takes an ask off, and `reword: { ask, to }` writes one + * again; `note` is one line under `## Log`. `by`: the agent that makes the change, when the + * call comes from no agent's context (the MCP `run` tool). It answers + * `{ repo, file, commitOid, changed, card }`. */ + async taskUpdate(input: Record<string, unknown>) { + using itx = this.getItx(); + return await taskUpdate(itx, { ...input, repo: input?.repo || TASKS_REPO }, this.taskDeps(itx)); + } + + /** `itx.config.taskAssign({ file, agent, message?, repo?, by? })`: gives a card to an agent that + * runs. The card names the agent and is in progress, and the agent gets one message that makes + * the card its brief. It answers `{ repo, file, agent, model, effort, starting, running, card }`. */ + async taskAssign(input: Record<string, unknown>) { + using itx = this.getItx(); + return await taskAssign(itx, { ...input, repo: input?.repo || TASKS_REPO }, this.taskDeps(itx)); + } + + /** `itx.config.answerTask({ file, ask, answer, by, repo? })`: an answer that a person gave to + * an ask of a task (one line of its `human-ask:`), written into the task file as the board + * writes it: the ask's line goes, and the ask with the answer, `by` and the time is kept under + * `## Answers`. For an answer that reached an agent in a chat or on a call; a person at the + * board answers there ("Needs a person"). `ask`: the ask's whole text. It answers + * `{ repo, file, commitOid, stillAsked }`. */ + async answerTask(input: { file: string; ask: string; answer: string; by: string; repo?: string }) { + using itx = this.getItx(); + return await answerTask(itx, { ...input, repo: input?.repo || TASKS_REPO }); + } + + /** `itx.config.followTasks({ file?, agent?, wake?, only?, repo? })`: from now on an agent is + * told of each change of one task file (`file`, like "todo/a-task.md"), or with no `file` of + * every task, as a message with what changed and a small diff. `agent`: the calling agent's + * own context when not given; a member's script and the MCP `run` tool name it. `wake: false`: + * the words are context only. `only`: the changes that moved one of the fields it names + * (`["status", "blocked-on", "human-ask"]`), and no other. It answers + * `{ agent, follows, only, repo, log, row }`. */ + async followTasks(input?: { + file?: string; + agent?: string; + wake?: boolean; + only?: string[]; + repo?: string; + }) { + using itx = this.getItx(); + return await followTasks(itx, { ...input, repo: input?.repo || TASKS_REPO }, this.taskDeps(itx)); + } + + /** `itx.config.unfollowTasks({ file?, agent?, repo? })`: ends what `followTasks` with the same + * `file` (or with none) and the same repo began. It answers `{ agent, follows, repo, ended }`. */ + async unfollowTasks(input?: { file?: string; agent?: string; repo?: string }) { + using itx = this.getItx(); + return await unfollowTasks(itx, { ...input, repo: input?.repo || TASKS_REPO }, this.taskDeps(itx)); + } + + /** `itx.config.taskFollowers({ repo? })`: which agent follows which task file, or "every task". */ + async taskFollowers(input?: { repo?: string }) { + using itx = this.getItx(); + return await taskFollowers(itx, { ...input, repo: input?.repo || TASKS_REPO }); + } + + /** `itx.config.taskAskers({ repo? })`: who asked each ask that a task still has (a line of its + * `human-ask:`), read from the change feed: the agent of the commit that added the ask, by its + * `Via:` line or the platform's stamp. The board's "Needs a person" links each ask to that + * agent's chat. It answers `{ repo, asks, readFrom }`, each ask as + * `{ file, ask, agent, by, page, at, message, model, blocking, assignee }`. `agent` is null + * when nothing says who asked; `assignee` is the task's own agent, which is not the asker. */ + async taskAskers(input?: { repo?: string }) { + using itx = this.getItx(); + return await taskAskers(itx, { ...input, repo: input?.repo || TASKS_REPO }); + } + + /** `itx.config.taskBoard({ repo? })`: the whole board as data, in one call, for an agent that + * manages work or starts with no history: every task as its card with the answers people gave + * to its asks, its last change and whether the agent it names has work now, the tasks that + * need a person, the board's newest changes and who follows what. It answers + * `{ repo, commitOid, board, tasks, needsAPerson, recentChanges, followers }`. */ + async taskBoard(input?: { repo?: string }) { + using itx = this.getItx(); + return await taskBoard(itx, { ...input, repo: input?.repo || TASKS_REPO }); + } + + /** What the task calls ask of the mind (cards.js and feed.js of /repos/tasks): where a call came + * from, and the one gate that says a path is an agent (agent-catalog.ts of /repos/dash), since a + * follower's row writes to the path it names. A mind adds its own parts by overriding this in + * worker.ts's class: cards.js lists them (`linkNote`, `briefRules`, `startWorker`, + * `sessionState`). */ + protected taskDeps(itx: object) { + // Two casts, both of shapes that this file cannot name more closely: `itx` is the root's + // handle, which has `cd(path).facets` as `CatalogItx` asks; and the catalog's live state is + // `unknown` to its reader, with `agents` a map by path (iterate/agents writes it). + const catalog = async () => + (await agentCatalogOf(itx as CatalogItx)) as { agents?: Record<string, unknown> } | null; + return { + callerPath: () => this.callerPath(), + isAgent: async (path: string) => isAgentOf(await catalog(), path), + /** the agent's row in the catalog (`kind`, `status`, `lastActivityAt`), or null */ + agentRow: async (path: string) => { + const agents = (await catalog())?.agents; + return agents && Object.hasOwn(agents, path) ? agents[path] : null; + }, + }; } }
M package.json
@@ -9,6 +9,7 @@ }, "dependencies": { "@repos/dash": "../dash", + "@repos/docs": "../docs", "@repos/git": "../git", "@repos/onboarding": "../onboarding", "@repos/stdlib": "../stdlib",
M pnpm-lock.yaml
@@ -11,6 +11,9 @@ '@repos/dash': specifier: ../dash version: link:../dash + '@repos/docs': + specifier: ../docs + version: link:../docs '@repos/git': specifier: ../git version: link:../git
M tests/worker.test.mjs
@@ -10,7 +10,7 @@ const { default: Config } = await import("../worker.ts"); const repoFile = (path) => new URL(`../${path}`, import.meta.url); -for (const app of ["dash", "tasks", "onboarding"]) +for (const app of ["dash", "docs", "tasks", "onboarding"]) test(`${app}.<domain>: the app's name and icon are for anyone, and everything else is for members`, async () => { const mind = mindAt("example.com"); const ask = (path) => mind.config.fetch(new Request(`https://${app}.example.com${path}`)); @@ -87,7 +87,7 @@ const mind = mindAt("example.com"); mind.config.auth = { ...mind.config.auth, require: () => null }; const board = await mind.config.fetch(new Request("https://tasks.example.com/board.json")); - assert.deepEqual(await board.json(), { repo: "/repos/task-board" }); + assert.deepEqual(await board.json(), { repo: "/repos/task-board", retiredAgents: [] }); }); test("git.<domain> is the git app's, with no guard before it: it serves its own files to anyone, and no repo, since none is public", async () => {
M worker.ts
@@ -16,6 +16,7 @@ import type { IterateConfigProcessEventArgs } from "iterate/sdk"; import { dashApp } from "@repos/dash/app.ts"; import { framedSignIn } from "@repos/dash/framed-sign-in.ts"; +import { docsApp } from "@repos/docs/app.ts"; import { gitApp } from "@repos/git/app.ts"; import { onboardingApp } from "@repos/onboarding/app.ts"; import { onboardingEvents, onboardingMindEvents } from "@repos/onboarding/events.ts"; @@ -23,7 +24,9 @@ import { init, step } from "@repos/stdlib/init.ts"; import { mailReceived } from "@repos/stdlib/mail.ts"; import { tasksApp } from "@repos/tasks/app.ts"; -import { ConfigApi } from "./api.ts"; +// @ts-expect-error -- a plain module of the Tasks app, with no types +import { taskChangesEvent } from "@repos/tasks/feed.js"; +import { ConfigApi, TASKS_REPO } from "./api.ts"; import { homepage } from "./homepage.ts"; import { mindIcon, serveProfile } from "./profile.ts"; import profileFiles from "./profile/"; @@ -32,14 +35,17 @@ const icon = () => mindIcon(profileFiles); const dash = dashApp({ icon }); +// Docs, for members: the files of the mind's repos, written together in a browser. The page, and +// the processors that keep an open doc, are /repos/docs. +const docs = docsApp({ icon }); // The first steps of a new mind, for its owner: connect to iterate Cloud, prove that AI answers, // and start the first agent. The page, its steps and the agent's guides are /repos/onboarding. // To retire it: take out its lines here and in api.ts, and its line of package.json. const onboarding = onboardingApp({ icon }); -// The Tasks board shows the markdown files under todo/ of this repo, which holds nothing else. -// No code is loaded from it, so package.json does not list it and it is cloned from nowhere: -// the publish hook below makes it, empty, and the board's first task is its first commit. -const TASKS_REPO = "/repos/task-board"; +// The Tasks board shows the markdown files under todo/ of the tasks repo (api.ts `TASKS_REPO`), +// which holds nothing else. No code is loaded from it, so package.json does not list it and it is +// cloned from nowhere: the publish hook below makes it, empty, and the board's first task is its +// first commit. The calls that an agent keeps a card with are in api.ts. const tasks = tasksApp({ repo: TASKS_REPO, icon }); // git.<domain>/repos/<name>, for git and for a browser. A repo listed in `public`, by its path // (`"/repos/stdlib"`), is for anyone to read and clone, with its pulls. None is listed: a new @@ -62,6 +68,8 @@ framedSignIn(request, this.auth.require(request)) || dash.fetch(request, this) ); + case "docs": // Docs, for members: the files of the mind's repos, written together + return docs.open(request) || this.auth.require(request) || docs.fetch(request, this); case "onboarding": // the first steps of a new mind, for members return ( onboarding.open(request) || this.auth.require(request) || onboarding.fetch(request, this) @@ -100,9 +108,13 @@ await mailReceived(itx, event); break; } - // What looks at every event, side by side: one that fails does not stop the other, and the - // first failure is thrown after both settled. + // What looks at every event, side by side: one that fails does not stop the others, and the + // first failure is thrown after all settled. const hooks = await Promise.allSettled([ + // An update of a repo's main: one `tasks/task-changed` for each task file that it changed, + // on that repo's feed log, /task-files/<repo>. The followers of a task are told from there + // (feed.js of /repos/tasks). + taskChangesEvent(itx, event), // the onboarding app's part: what the owner told iterate Cloud, and what moves a step's card onboardingEvents(itx, event), // the agent's inputs, its prompt, each context's description