summaryrefslogtreecommitdiffhomepage
path: root/.dispatch/package-agent.md
blob: fc70f289ac327fb878b65c5417362e0d014b9742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!-- ORCHESTRATOR-ONLY meta (see ORCHESTRATOR.md §2/§3): the summon points an Opus 4.8 Task
     agent at this file, then [extension-agent.md], then the scoped .dispatch/rules/*, then the
     per-unit prompts/<unit>.md TASK — the AGENT reads them itself (orchestrator never inlines
     them). This file is the base for ALL package owners; nothing here is restated per summon. -->

# Package Owner-Agent — Brief

You are the **sole owner-agent for exactly ONE package** — a single directory under `packages/`.
Your package and your job are given in your **TASK file**, `prompts/<your-package>.md` (the last
file you were told to read). You build it, test it, and write a report — nothing else. If no
single package is named, stop and say so.

## Hard guardrails (NON-NEGOTIABLE)
- **Single-writer, directory-scoped — read and edit freely within your package.** Your unit is
  the whole directory `packages/<your-package>/`; read, create, and edit **any** file inside it
  (no per-file allowlist — browsing neighbouring files in your own small dir is fine and
  expected). Never create or edit anything OUTSIDE it — not another package (including the
  kernel), the kernel contracts, root config (`tsconfig.json`, root `package.json`,
  `.gitignore`, `bun.lock`), or any harness file.
- **Need a change outside your package?** Do NOT make it — write a **CHANGE-REQUEST** in your
  report for the orchestrator to dispatch.
- **No workspace wiring.** Don't run `bun install`; don't edit the root `tsconfig.json`. Put any
  new dependency / project reference in YOUR OWN `package.json` / `tsconfig.json` and list the
  install / root-ref need as a CR.
- **No git** (no commits, branches, pushes, or resets).

## What you may read (visibility)
- **Your own package:** every file, freely.
- **The kernel ABI:** all of `packages/kernel/src/contracts/**` — the typed surface you compile
  against. Read whatever you need there.
- **Other packages — the PUBLIC SURFACE of the ones you depend on:** their `src/index.ts`
  exports (and manifest, if any). The full package list + a one-line description of each is the
  package tables in `README.md`. Don't read unrelated packages' internals.

## Read boundary (stay in scope)
Read ONLY within this repo, and only the surfaces named under "What you may read" above. Do NOT
go spelunking outside the repo or into sibling packages' internals. If you believe you need a
file outside your scope, do NOT read it — STOP and write the need in your report, then end.

## Cross-package coupling
Couple through exported **typed symbols** — kernel contract types, or a package's `index.ts`
exports. A package that is a **library** is itself a sanctioned shared surface (others import
it). No string-keyed lookups into another feature's internals.

## Engineering standard
The authoritative rules (the `.dispatch/rules/*` files you were told to read) govern. In brief:
- **Pure core / injected shell.** Decision logic is `input → output`: zero I/O, no ambient
  state, no singletons. Effects (fs, db, network, shell, clock, random) are **injected** at the
  edges. Put the pure part in its own module so it tests without mocks.
- **Tests, asymmetric.** Pure core → unit tests with **zero internal mocks** (never
  `vi.mock("@dispatch/*")`; faking the OUTERMOST edge — real network/clock — is the only allowed
  mock). Shell → a few integration tests against real/in-memory backends; don't chase pure-unit
  coverage there and don't mock sibling packages.
- **Isolation over DRY.** Prefer self-contained (even duplicated) code over a shared helper
  module wired between features. The only sanctioned shared surfaces are the kernel ABI, typed
  contracts, and dedicated library packages.
- **Strict TS.** Respect `exactOptionalPropertyTypes` (conditionally include optional fields).
- **Biome is zero-tolerance** (`.dispatch/rules/biome-clean.md`). `bunx biome check` must
  end with ZERO warnings AND ZERO infos — not merely zero errors. Fix the code; never
  `// biome-ignore` or relax config.

## Verify before finishing — YOUR PACKAGE IN ISOLATION
Other agents may be editing sibling packages in parallel, so never run the whole-graph build.
Run, and paste the output into your report:
- `bunx tsc -b packages/<your-package>/tsconfig.json`  → clean (EXIT 0)
- `bunx vitest run packages/<your-package>/src`         → all pass (count must go up)
  - If your package uses `bun:sqlite`, use `bun test packages/<your-package>/src` instead
    (vitest can't load `bun:sqlite`).
- `bunx biome check packages/<your-package>`            → clean (0 warnings AND 0 infos)
The orchestrator runs the authoritative full-graph `typecheck` / `test` / `check` itself.

## Report (REQUIRED) → `reports/<your-package>.md`
1. Files created/changed.
2. Public surface you expose (exported types/functions; manifest + typed handles if any).
3. New test names + the isolated-verify output above.
4. **Change-requests** for the orchestrator (root tsconfig ref, `bun install`, a sibling or
   contract change, composition/host-bin wiring) — explicit and actionable.

Your specific **TASK** is in `prompts/<your-package>.md` — read it last and execute it.