Skip to content

Let a Planner open, list, instruct and index the documents it created - #1002

Merged
lavaman131 merged 1 commit into
mainfrom
planner-fan-out
Nov 24, 2026
Merged

lavaman131 merged 1 commit into
mainfrom
planner-fan-out

Conversation

@lavaman131

Copy link
Copy Markdown
Collaborator

A Planner that splits work into many documents with create_document had no way back to them: it couldn't tell which documents it made, see where each one's Planner and build stood, or ask them all to carry on. Resuming meant opening every document by hand.

Change

  • Each document a Planner creates records the document it came from (ChannelRecord.createdFrom, migration 054). Deleting the parent clears the link and keeps the children.
  • A new fan_out host tool, offered with create_document under the same rules (a turn a person's message drives; that person's login rechecked for write access). It reaches only unarchived top-level documents of the same repository created from this document:
    • open: create up to 20 documents at once, each exactly as create_document does (idempotent per key).
    • list: each one's link, Planner (working, idle, stopped), open Decisions and build state.
    • instruct: post one instruction, as the person's message, to all or named documents, starting Planners that aren't running; per-document outcome.
    • index: keep a table of them under ## Documents created from this one in this document, refreshed by open and list, never rewritten when unchanged.

Limits

  • Documents created before this change have no parent link, so fan_out doesn't see them.
  • The index refreshes only when open, list or index runs.

Verification

  • fan-out.test.ts (12 tests, each operation, argument checks, build state, the index writer), a fan_out case in tools.test.ts, and a created-from storage contract run against the memory store and Postgres.
  • bun test src/agent src/harness src/chat src/mcp src/storage/memory src/questions: 2842 pass. Postgres adapter tests on postgres:17-alpine: 204 pass. bun run types, dprint check clean.

A Planner that split work into many documents with create_document had no way back to them:
it could not tell which documents it had made, see where each one's Planner and build stood,
or ask them all to carry on, so resuming the work meant opening every document by hand.

Each document a Planner creates now records the document it was created from
(ChannelRecord.createdFrom, migration 054, cleared when that document is deleted), and the
Planner gets a fan_out host tool, offered with create_document under the same rules (a turn a
person's message drives, that person's login rechecked for write access). It reaches only
unarchived top-level documents of the same repository created from its own document:

- open creates up to 20 documents at once, each exactly as create_document does;
- list gives each one's link, Planner (working, idle or stopped), open Decisions and build;
- instruct posts one instruction, as the person's message, to all of them or the named ones,
  starting Planners that aren't running, and reports each outcome;
- index keeps a table of them under its own heading in the creating document, refreshed by
  open and list and never rewritten when unchanged.

Assistant-model: Claude Opus 5.5 (fast)
Assistant-verification: bun run types
Assistant-verification: bun test src/agent src/harness src/chat src/mcp src/storage/memory src/questions
Assistant-verification: TEST_DATABASE_URL=<fresh database> bun test apps/server/src/storage/postgres/adapter.test.ts
@lavaman131
lavaman131 merged commit 8432603 into main Nov 24, 2026
26 checks passed
@lavaman131
lavaman131 deleted the planner-fan-out branch November 24, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant