iterate.com / config-template

git clone https://git.iterate.com/repos/config-template

Import each repo by its name, list them in package.json, and make the tasks repo

A file of another repo is `@repos/<name>/<path>`. package.json lists each repo this one imports from as the folder next door (`"@repos/dash": "../dash"`): an install on a laptop links them, and a new mind reads the same lines at its birth to know which repos to clone.

The Tasks board's repo, /repos/home, holds no code that is loaded, so it is not in that list. The publish hook makes it: a repo that is there is left as it is.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Misha Kaletsky, 2026-11-25 17:42 UTC · 9814333a63a745e5147661ba3151679be89bf51b · parent d7316b2

6 files changed

M AGENTS.md
@@ -19,15 +19,28 @@
 
 ## Imports across repos
 
-`/repos` is the module root. A file imports a file of another repo by a relative path:
+A file imports a file of another repo by the repo's name:
 
 ```ts
 // /repos/config/worker.ts
-import { init } from "../stdlib/init.ts";
-import { dashApp } from "../dash/app.ts";
+import { init } from "@repos/stdlib/init.ts";
+import { dashApp } from "@repos/dash/app.ts";
 ```
 
-- There is no `package.json` entry and no alias for these. The repos' names are part of the code.
+- `@repos/<name>` is the repo `/repos/<name>`. `package.json` lists each repo that this one needs,
+  as the folder next door:
+
+  ```json
+  "dependencies": { "@repos/stdlib": "../stdlib", "@repos/dash": "../dash" }
+  ```
+
+  On a laptop an install links those folders, so the type-checker and the tests find them.
+- **This list is also what a new mind is born with.** A mind that starts from this repo makes
+  each repo named here and clones it from beside where this repo came from. That happens once,
+  at its birth. After that a line for a repo the mind does not have fetches nothing: make the
+  repo first (`itx.repos.create`), then name it here.
+- A relative import stays inside its own repo. One that leaves it is refused when the mind
+  publishes, with the name to write.
 - `iterate/*` and `zod` come from the platform. Worker code imports no npm package.
 - A page's script (`public/app.js`) runs in a browser. It loads `@iterate-com/ui` through the
   import map of its `index.html`.
M agent-kinds/agent.ts
@@ -8,7 +8,7 @@
 // /repos/config alone. No worker code imports this file.
 //
 // IT HAS NO IMPORT. In the frame every import is a stub that throws when used. What the mind does
-// with the facts below is ../../stdlib/agent-kinds/agent.ts (`agentKindEvent`).
+// with the facts below is agent-kinds/agent.ts of /repos/stdlib (`agentKindEvent`).
 const T = "events.iterate.com/";
 
 export default {
M api.ts
@@ -4,7 +4,7 @@
 // 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 { mergePull } from "../git/pulls.ts";
+import { mergePull } from "@repos/git/pulls.ts";
 import { profileOf } from "./profile.ts";
 import profileFiles from "./profile/";
 
@@ -22,7 +22,7 @@
    *  git app's page does when a member presses "Squash and merge". One commit lands on main,
    *  named `<title> (#7)` with the pull's body under it, and answers `{ commitOid }`. It throws,
    *  in words for the one who asked, when the pull is not open or main has moved past what the
-   *  branch has (../git/pulls.ts says what a pull is, and how to open one or comment on one:
+   *  branch has (pulls.ts of /repos/git says what a pull is, and how to open one or comment on one:
    *  each is one event). */
   async pullMerge(repo: string, number: number) {
     using itx = this.getItx();
M package.json
@@ -1,5 +1,12 @@
 {
-  "name": "config",
+  "name": "@repos/config",
+  "private": true,
   "type": "module",
-  "main": "worker.ts"
+  "main": "worker.ts",
+  "dependencies": {
+    "@repos/dash": "../dash",
+    "@repos/git": "../git",
+    "@repos/stdlib": "../stdlib",
+    "@repos/tasks": "../tasks"
+  }
 }
M tests/worker.test.mjs
@@ -134,7 +134,7 @@
   });
 });
 
-test("a publish installs the agents from stdlib's module, and tells the Dash which file of this repo holds the kind", async () => {
+test("a publish installs the agents from stdlib's module, tells the Dash which file of this repo holds the kind, and makes the repo whose tasks the board shows", async () => {
   const mind = mindAt("example.com");
   await mind.config.processEvent({
     event: { type: "events.iterate.com/mind/worker-updated", path: "/", offset: 9, payload: {} },
@@ -148,6 +148,8 @@
   assert.deepEqual(kinds, { agent: "agent-kinds/agent.ts" });
   // the Dash reads the file from /repos/config by this path
   assert.equal(existsSync(repoFile(kinds.agent)), true);
+  // a mind born from this config has no such repo yet: it is made empty, and making it again is nothing
+  assert.deepEqual(mind.made, ["/repos/home"]);
 });
 
 test("an event that is no case's still reaches the hooks that look at every event", async () => {
@@ -180,6 +182,7 @@
   const appended = [];
   const enabled = [];
   const kv = {};
+  const made = [];
   const context = (path) => ({
     append: async (...events) => void appended.push(...events.map((event) => ({ path, event }))),
     processors: {
@@ -200,9 +203,10 @@
       },
     },
     contexts: { list: async () => [] },
+    repos: { create: async (path) => (made.push(path), { path }) },
     [Symbol.dispose]() {},
   };
   const config = new Config({ waitUntil() {} }, { ITX: {} });
   config.getItx = () => itx;
-  return { config, itx, appended, enabled, kv };
+  return { config, itx, appended, enabled, kv, made };
 }
M worker.ts
@@ -1,9 +1,10 @@
 // worker.ts — THIS FILE IS THE MIND'S WIRING.
 //
-// The mind loads this module first (package.json `main`). `/repos` is the module root: this file
-// is `config/worker.ts`, and `../stdlib/init.ts` is the file init.ts of /repos/stdlib, in the mind
-// and in a folder on a laptop where the repos are cloned side by side. A push to `main` of any
-// repo that this file's imports reach publishes the mind a few seconds later (AGENTS.md).
+// The mind loads this module first (package.json `main`). A file of another repo is imported by
+// the repo's name: `@repos/stdlib/init.ts` is the file init.ts of /repos/stdlib. package.json
+// lists each repo that this one needs as the folder next door, which is where an install on a
+// laptop finds it. A push to `main` of any repo that this file's imports reach publishes the mind
+// a few seconds later (AGENTS.md).
 //
 // The platform calls two methods of the class below:
 //
@@ -13,13 +14,13 @@
 // Every other public method of the class is the mind's own API, `itx.config.<name>(…)`, for its
 // agents and its pages. Those are in api.ts.
 import type { IterateConfigProcessEventArgs } from "iterate/sdk";
-import { dashApp } from "../dash/app.ts";
-import { framedSignIn } from "../dash/framed-sign-in.ts";
-import { gitApp } from "../git/app.ts";
-import { everyEvent } from "../stdlib/every-event.ts";
-import { init, step } from "../stdlib/init.ts";
-import { mailReceived } from "../stdlib/mail.ts";
-import { tasksApp } from "../tasks/app.ts";
+import { dashApp } from "@repos/dash/app.ts";
+import { framedSignIn } from "@repos/dash/framed-sign-in.ts";
+import { gitApp } from "@repos/git/app.ts";
+import { everyEvent } from "@repos/stdlib/every-event.ts";
+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";
 import { homepage } from "./homepage.ts";
 import { mindIcon, serveProfile } from "./profile.ts";
@@ -29,8 +30,10 @@
 const icon = () => mindIcon(profileFiles);
 
 const dash = dashApp({ icon });
-// The Tasks board shows the markdown files under todo/ of /repos/home.
-const tasks = tasksApp({ repo: "/repos/home", icon });
+// The Tasks board shows the markdown files under todo/ of this repo. No code is loaded from
+// it, so package.json does not list it: the publish hook below makes it.
+const TASKS_REPO = "/repos/home";
+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
 // mind shows its code to its members alone. Every other repo's pages are for members, and git
@@ -73,12 +76,14 @@
         // The mind's code was published. It happens after every push, so every line is
         // idempotent. A `step` that throws is reported under its name, and the lines after it
         // still run.
-        await init(itx); // the agents (../stdlib/init.ts)
+        await init(itx); // the agents (init.ts of /repos/stdlib)
         // Where the Dash finds what it draws for each kind of agent: a file of THIS repo, by its
         // path in it (agent-kinds/agent.ts says why it is here).
         await step("agent-kinds", () =>
           itx.kv.put("agent-kinds", JSON.stringify({ agent: "agent-kinds/agent.ts" })),
         );
+        // The repo whose task files the board shows. A repo that is there already is left as it is.
+        await step("tasks-repo", () => itx.repos.create(TASKS_REPO));
         break;
       case "events.iterate.com/email/received": // a mail came: it goes to the agent it is for
         await mailReceived(itx, event);