Package conventions and ownership blocks
How eight packages share app.contract and app.ts through marked blocks, how files and testIds are named, and the steps to add a route, resource or source.

Seed Exact was built by several agents working in parallel, one per package, with a lead owning the shared files. Because Exact requires all data declarations in one root file, the code uses marked ownership blocks and naming prefixes so that edits do not collide. The conventions still apply to anyone changing the app.

Packages

A package is a name shared by a contract file, a source directory and a prefix:

Package

Contract

Source directory

Identifier prefix

Contract tests

read

read.contract

src/read

read, dir, author

read.test.contract, open-site.test.contract

discuss

discuss.contract

src/discuss

discuss

discuss.test.contract

activity

activity.contract

src/activity

activity

activity.test.contract, open-site-activity.test.contract

agents

agents.contract

src/agents

agents

agents.test.contract

me

me.contract

src/me

me

me.test.contract

profile

profile.contract

src/profile

profile

profile.test.contract

vault

vault.contract

src/vault

vault

vault.test.contract

crypto

none

src/crypto

crypto

crypto.test.contract

identity

none

src/identity

none: a library

none

See Feature modules for what each does.

Ownership blocks

app.contract opens with the rule: "the lead owns this file. Each package edits ONLY inside its own // >>> pkg:<name> ... // <<< pkg:<name> blocks". The block kinds are:

Block

Where

Example

pkg:<name> imports

top of file

profile and vault

pkg:<name> routes

inside a tab of routes nav

agents routes

pkg:<name> shapes

before the component

crypto

pkg:<name> decl

component declarations

activity

pkg:<name> actions

component actions

profile

pkg:<name> provide

the provide section

discuss

pkg:<name> view

the route switch

vault

app.ts has three unnamed blocks, // >>> imports, // >>> grants and // >>> parts, with a // pkg:<name> comment on a line where the owner matters.

Lead-owned files

app.contract outside the blocks (shared state, pick, follow, back, the root node and tab bar), app.ts outside its blocks, ui.contract, DESIGN.md, and tools/test-server/index.ts are marked lead-owned in their headers. app.json, app.tamber and app.test.contract carry no marker and are treated the same way (inferred). exact.mjs and the marked block of AGENTS.md are generated by Exact and must not be edited. DESIGN.md says workers "propose changes in RESULT.md, don't diverge silently"; that file was part of the build process and is not in the repository.

File naming inside a package

File

Role

src/<pkg>/sources.ts

Exports sources: Partial<Sources>, the only thing app.ts imports. Thin: argument unpacking and error shaping

src/<pkg>/load.ts, client.ts, api.ts

Network code

src/<pkg>/logic.ts, model.ts

Pure functions that turn wire data into the shapes the contract declares

src/<pkg>/__tests__/*.test.ts

Bun unit tests, with JSON fixtures beside them

<pkg>.contract

Shapes, pure fns and view components. No resources

<pkg>.test.contract

Contract UI tests

tools/mock-<service>/

A mock mounted by the local test server

Naming rules

    Root state, derives, resources, mutations, tasks and actions start with the package prefix: discussDraft, agentsSend, vaultPoll. Source names do too, because all sources share one namespace in app.ts (Object.assign lets a later package overwrite an earlier one silently).

    Components and shapes are prefixed in PascalCase: AgentRunCard, MeIdentity, DiscussThread.

    TestIds start with the package or the thing: agents-send, me-server-input, activity-mark-all, tab-read. Rows append their id: agent-<id>, session-<id>, run-<id>. Read and discuss wrap ids in tid(active, name); see Shared UI.

    Every screen takes eid and sets navigationKey=eid on its root.

How to add a route

    Add the route line inside your pkg:<name> routes block under the right tab in routes nav. Put literal paths before parameter paths that could match them.

    Write the screen component in <pkg>.contract with an eid prop. Add navigationPresentation="modal" to its root for a sheet.

    Import it in the use line or your imports block.

    Add if e.name == "<route>" with the screen call inside your pkg:<name> view block.

    Navigate to it with nav = push(nav, path("<route>", param)). See Navigation.

How to add a resource or mutation

    Declare the reply shape in <pkg>.contract and import it.

    In your decl block add resource x = pkgSource(args) as shape S else empty() or mutation m as shape S refreshes x then pkgAfter.

    Include an owner or visit field in the shape and a Ready derive that checks it. Pass time as an argument. See refresh patterns.

    Add actions in your actions block and pass data and actions to the screen as props.

How to add a source

    Implement pkgSource: ([a, b], store) => ... in src/<pkg>/sources.ts. Exact regenerates app.contract.d.ts from the contract when it builds, which types the argument tuple (see Commands and verbs).

    A new package also adds its import and entry to the imports and parts blocks of app.ts.

    If it reaches a new origin, secret or file, add a literal grant in the grants block. See Grants.

    Keep each synchronous step short for the turn budget, and add a Bun test.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Comments