@agentshouse/kit 0.1.0-alpha.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +14 -1740
  2. package/dist/api.js +11 -0
  3. package/dist/home.js +24 -0
  4. package/dist/house-main.js +4 -0
  5. package/dist/kit-main.js +16 -0
  6. package/dist/login.js +112 -0
  7. package/dist/resident.js +10 -0
  8. package/dist/stream.js +31 -0
  9. package/package.json +16 -11
  10. package/bin/connect-linux.sh +0 -134
  11. package/bin/kit.js +0 -1023
  12. package/bootstrap.json +0 -17
  13. package/src/acp.js +0 -99
  14. package/src/adapter-mcp.js +0 -44
  15. package/src/adapter.js +0 -252
  16. package/src/agent-logins.js +0 -65
  17. package/src/agents.js +0 -504
  18. package/src/apply.js +0 -29
  19. package/src/attach.js +0 -52
  20. package/src/binding.js +0 -90
  21. package/src/blocks.js +0 -156
  22. package/src/bridge.js +0 -449
  23. package/src/bytes.js +0 -89
  24. package/src/channel.js +0 -37
  25. package/src/command.js +0 -109
  26. package/src/configuration.js +0 -465
  27. package/src/connector-login.js +0 -91
  28. package/src/connector.js +0 -107
  29. package/src/continuation.js +0 -61
  30. package/src/contract.js +0 -363
  31. package/src/conversation-originals.js +0 -143
  32. package/src/custom/authorization.js +0 -63
  33. package/src/declaration.js +0 -35
  34. package/src/delivery.js +0 -191
  35. package/src/directory.js +0 -102
  36. package/src/draft.js +0 -89
  37. package/src/google/calendar.js +0 -177
  38. package/src/google/declared.js +0 -146
  39. package/src/google/drive.js +0 -435
  40. package/src/google/gateway.js +0 -166
  41. package/src/google/gmail.js +0 -249
  42. package/src/google/id.js +0 -1
  43. package/src/google/oauth.js +0 -273
  44. package/src/google/source.js +0 -25
  45. package/src/hook.js +0 -376
  46. package/src/host.js +0 -121
  47. package/src/house-main.js +0 -79
  48. package/src/house.js +0 -1090
  49. package/src/inbound.js +0 -175
  50. package/src/instance/google.js +0 -1
  51. package/src/kit-work-stream.js +0 -84
  52. package/src/launcher-main.js +0 -19
  53. package/src/launcher.js +0 -276
  54. package/src/local-files.js +0 -113
  55. package/src/login.js +0 -274
  56. package/src/mcp.js +0 -71
  57. package/src/migrator.js +0 -248
  58. package/src/mount.js +0 -582
  59. package/src/operation.js +0 -20
  60. package/src/original.js +0 -631
  61. package/src/peer.js +0 -124
  62. package/src/plan.js +0 -57
  63. package/src/question.js +0 -316
  64. package/src/refusal.js +0 -79
  65. package/src/repository.js +0 -521
  66. package/src/session-bin/house +0 -2
  67. package/src/settlement.js +0 -57
  68. package/src/setup.js +0 -190
  69. package/src/source-originals.js +0 -116
  70. package/src/source.js +0 -286
  71. package/src/starter-set/grilling/LICENSE +0 -21
  72. package/src/starter-set/grilling/SKILL.md +0 -30
  73. package/src/starter-set/grilling/agents/openai.yaml +0 -3
  74. package/src/starter-set.js +0 -17
  75. package/src/state.js +0 -157
  76. package/src/sync-library.js +0 -293
  77. package/src/sync-state.js +0 -120
  78. package/src/sync.js +0 -482
  79. package/src/telegram.js +0 -1045
  80. package/src/terminal.js +0 -57
  81. package/src/tmux.js +0 -119
  82. package/src/worker.js +0 -925
  83. package/src/workspace.js +0 -500
package/README.md CHANGED
@@ -1,1749 +1,23 @@
1
1
  # House Kit
2
2
 
3
- House Kit is a public package repository. Product development is planned and
4
- coordinated in the [Agents House repository](https://github.com/trof3039/agents.house);
5
- this repository contains only the package source and its operator documentation.
3
+ House Kit connects an Environment, a Linux computer or server, to
4
+ [agents.house](https://agents.house). It runs your Agents' conversations
5
+ through the agent CLIs you chose and gives each Agent the `house` command.
6
6
 
7
- ## Connect a Linux computer
7
+ ## Install
8
8
 
9
- On Linux `amd64` or `arm64` with a working Docker Engine, run the published,
10
- versioned bootstrap once:
9
+ Connect a computer from agents.house. It gives you the one command that
10
+ installs House Kit on that computer and updates it when you run it again.
11
11
 
12
- ```sh
13
- bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.1.0-alpha.8/connect-linux.sh)
14
- ```
12
+ ## Commands
15
13
 
16
- The release asset pins one immutable multi-architecture image digest. It creates
17
- owner-protected `~/.house-kit` and `~/AgentsHouse`, mounts those as the complete
18
- Kit home and `/agents/house`, enrolls through House Login in the host browser,
19
- and starts the container with Docker's `unless-stopped` lifecycle. Pass
20
- `--workspace /absolute/path` for one other workspace root or `--manual` for
21
- the existing URL and one-time-code login route. `--house <origin>` selects
22
- another House and is retained in Kit home. A repeated invocation reuses the
23
- same container, credential and Environment; a different installed image is
24
- left for the explicit update journey.
14
+ `kit login` opens a link you confirm in your browser and keeps the
15
+ Environment's credential in `~/.house-kit`, or in `$HOUSE_KIT_HOME` when it is
16
+ set. Pass `--manual` to paste the code by hand on a machine without a browser,
17
+ and `--environment <id>` to reconnect an Environment you already have.
25
18
 
26
- The versioned `bootstrap.json` is the machine-readable command source for this
27
- release. It is exported from the npm package as `@agentshouse/kit/bootstrap`
28
- (JSON import) and published byte-for-byte beside `connect-linux.sh` in the
29
- GitHub release. Its schema version is `1`, its `version` is the Kit package
30
- version, and `hosts` contains only bootstrap scripts published in that release.
31
- The package exports only the `./bootstrap` subpath; `./package.json` and source
32
- subpaths are not exported. For this release, only `hosts.linux` exists. In this
33
- schema example, `<version>` stands for the package's version:
19
+ `kit resident` keeps the Environment connected.
34
20
 
35
- ```json
36
- {
37
- "schemaVersion": 1,
38
- "version": "<version>",
39
- "hosts": {
40
- "linux": {
41
- "command": "bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v<version>/connect-linux.sh)",
42
- "asset": {
43
- "name": "connect-linux.sh",
44
- "url": "https://github.com/agentshouse/kit/releases/download/v<version>/connect-linux.sh"
45
- },
46
- "workspace": { "argument": "--workspace", "quoting": "posix" }
47
- }
48
- }
49
- }
50
- ```
21
+ ## License
51
22
 
52
- `command` is complete for the default workspace. To show a selected absolute
53
- workspace, append the declared `workspace.argument` and the path as one POSIX
54
- shell-quoted argument. For example, `/home/user/My Agents' House` becomes
55
- `--workspace '/home/user/My Agents'\'' House'`. Quote the entire path before
56
- adding it to a copyable shell command; never interpolate it as shell syntax.
57
- The bootstrap validates an absolute workspace root and encodes it as one Docker
58
- `--mount` CSV source field, including commas and double quotes in the name.
59
- The package manifest contains no image digest: the release workflow
60
- fills the immutable image digest into the published script after the package
61
- has been built.
62
-
63
- The bootstrap does not install native Kit on an ordinary computer. The native
64
- package remains for managed Nodes and an explicitly selected eligible Kit host.
65
-
66
- ## Building the package
67
-
68
- The repository checkout is the development source. Build the package
69
- that can be published by supplying House's dedicated installed-application
70
- Google OAuth client, its id and its client secret:
71
-
72
- ```sh
73
- HOUSE_KIT_GOOGLE_OAUTH_CLIENT_ID=kit-client.apps.googleusercontent.com \
74
- HOUSE_KIT_GOOGLE_OAUTH_CLIENT_SECRET=GOCSPX-kit-installed-app \
75
- npm run build
76
- ```
77
-
78
- The command writes the publishable package to `dist/package`. Both values are
79
- public instance content fixed into that package at build time: Google issues an
80
- installed application's client secret without treating it as confidential, and
81
- still requires it in every token request. The installed Kit does not read either
82
- from its runtime environment and never requests them from House.
83
-
84
- Runtime dependencies stay minimal and exactly pinned in `package.json` and
85
- `package-lock.json`: House's own `@agentshouse/mdmodel`, `yaml`, which reads
86
- House's text answers, and the Agent Client Protocol SDK
87
- `@agentclientprotocol/sdk` with its peer `zod`, which is this Kit's one protocol
88
- client for the compiled adapter contracts, and `ws` for the authenticated Kit
89
- control stream. The SDK's approval
90
- receipt is [`docs/agents/acp-sdk-dependency-approval.json`](docs/agents/acp-sdk-dependency-approval.json),
91
- which the User wrote once this adoption's proof had passed. The adapter
92
- packages themselves are Environment prerequisites, not Kit dependencies, and
93
- carry no record.
94
-
95
- The bootstrap invokes bare `kit login`. The first login names its new
96
- Environment after the host computer and stores its Environment id in Kit home;
97
- an explicit later login reconnects that retained id. `--environment <uuid>`
98
- selects a different retained Environment for explicit recovery. A malformed
99
- id or an answer naming a different Environment is refused before installation.
100
-
101
- Use `--manual` when the browser cannot reach the Kit's loopback listener. The
102
- command stores the issued Kit User credential in `$HOUSE_KIT_HOME/credential`
103
- or `~/.house-kit/credential` with owner-only permissions, replacing the previous
104
- file in one rename and leaving configuration, checkpoints, source state and
105
- Agent relationships untouched. Reconnecting installs authority only: it starts
106
- no Run and resumes no work, and the next `kit worker run` reconciles this
107
- installation's bound sessions under its ordinary control rules.
108
-
109
- If House never answers the exchange, the command refuses with
110
- `kit_credential_not_installed` and no credential is written; the remedy is a
111
- fresh owner-authorized `kit login` for the same Environment. The credential is
112
- never printed by Kit.
113
-
114
- ## Configuration
115
-
116
- `$HOUSE_KIT_HOME/kit.json` is the one declarative configuration file. Use
117
- `--config <path>` to name it elsewhere.
118
-
119
- ```json
120
- {
121
- "availability": "continuous",
122
- "execution_authority": "allow",
123
- "migrators": [],
124
- "instances": [
125
- {
126
- "id": "acme",
127
- "preset": "custom",
128
- "services": [
129
- {
130
- "service": "notes",
131
- "source_ref": "src_acme_notes",
132
- "rooms": ["work-room"],
133
- "backfill": { "days": 30 },
134
- "connector": {
135
- "command": ["/usr/local/bin/acme-export", "--ndjson"],
136
- "timeout_ms": 120000,
137
- "environment": { "ACME_REGION": "eu" },
138
- "secrets": {
139
- "ACME_TOKEN": { "environment": "ACME_TOKEN_SOURCE" },
140
- "ACME_KEY": { "file": "/run/secrets/acme-key" }
141
- }
142
- }
143
- }
144
- ]
145
- }
146
- ],
147
- "clients": [
148
- {
149
- "kind": "claude-code",
150
- "settings": "/home/ada/.claude/settings.json"
151
- }
152
- ],
153
- "host": null
154
- }
155
- ```
156
-
157
- This file is the whole desired state, so every section it declares is
158
- reconciled and every section it omits is refused rather than assumed. The
159
- agent CLI list is not local configuration: House owns it for this Environment,
160
- and every controlled pass reads, installs, updates, signs in and reports exactly
161
- the kinds House names. House also owns every Agent, its Profile and its route,
162
- so this file declares neither Agents nor agent CLIs. The Kit runs whatever Agent
163
- House assigns on one of House's selected kinds and refuses any other kind. The required
164
- top-level `execution_authority` is this Environment's one answer to every agent
165
- permission request, `"allow"` or `"refuse"`; the Agents sharing the Environment
166
- share it. The
167
- required top-level `availability` declares this Environment's availability
168
- mode: `"intermittent"` for a laptop or other normally offline placement,
169
- `"continuous"` for a server expected to stay online. Omitting it or declaring
170
- any other value refuses as `kit_configuration_invalid`; `kit apply` sends the
171
- declared mode with the rest of the desired state. An
172
- instance declares one or more services, and under the `custom` preset each
173
- service owns the command that produces it.
174
-
175
- `host` declares the Linux host this installation measures for
176
- [host capacity reporting](#host-capacity). `null` declares that this Kit reports
177
- no capacity; the section is required like the others, so a host is measured only
178
- where the Environment owner says so.
179
-
180
- `clients` is the local Agent client catalogue and never leaves the installation.
181
- Each entry names one client whose lifecycle hook configuration this Kit
182
- reconciles: `kind` is `claude-code`, the one client this Kit installs a hook
183
- into, and `settings` is the absolute path of that client's own settings
184
- document. The section is required like the others and declares `[]` when this
185
- Environment runs no such client. An unknown `kind`, a relative path, and two
186
- entries naming the same document each refuse as `kit_configuration_invalid`.
187
-
188
- A secret is never written into this file. `secrets` names either an
189
- environment variable the Kit reads at run time or a mounted file it reads from
190
- disk; the resolved value reaches the connector's environment and nothing else.
191
-
192
- `backfill` is chosen once and honored on the first capture: `{ "days": 30 }`
193
- never delivers anything observed earlier, `{ "count": 500 }` bounds the first
194
- capture to 500 items and then continues from its cursor unbounded, and
195
- `{ "all": true }` takes every history the connector offers. The boundary is
196
- fixed when the service first captures, not each time a capture is attempted, so
197
- a run that fails and is repeated days later still starts where it would have.
198
-
199
- `timeout_ms` may shorten the connector's 120000 ms bound but never raise it. The
200
- Kit holds this installation's Environment control lease across the connector run
201
- and the batch it produces, and the lease has to outlive both.
202
-
203
- Apply the declared source state to House:
204
-
205
- ```sh
206
- kit apply --house https://agents.house
207
- ```
208
-
209
- Only the state House declares - instances, services, `source_ref`, and Room
210
- routes - leaves the installation. The connector, its secret references, and the
211
- backfill boundary stay local.
212
-
213
- ## The SessionStart hook
214
-
215
- House answers `kit apply` with its current SessionStart hook: one
216
- `{id, version, event, instruction}` document whose `instruction` tells the Agent
217
- which Pulse and continuation reads to perform itself. The document is House's
218
- own text under a stable `id`, versioned with the Kit contract version, and it
219
- carries no Room content, open item, count, checkpoint, or identity.
220
-
221
- `kit apply` writes that instruction to
222
- `$HOUSE_KIT_HOME/state/hooks/<hook id>.txt` and installs one `SessionStart`
223
- command hook printing it in every declared client's settings document. The
224
- installed hook is that read and nothing else: it calls no House operation, marks
225
- nothing seen, embeds no Room material, and infers no chat Session, so the Agent
226
- decides what to read from the guidance it receives.
227
-
228
- `state/hooks.json` records exactly which settings documents this installation
229
- has written and the exact command it installed in each, so ownership is that
230
- record and the command it names rather than any resemblance to one. An entry
231
- whose command merely mentions the instruction is another owner's and is left
232
- alone. `clients` is the desired state of that record: applying the same served
233
- document again leaves each settings document byte-identical, dropping a client
234
- from the catalogue removes this installation's entry from the document it named,
235
- and an empty catalogue removes every entry, the record, and `state/hooks/`
236
- without touching a hook, group, or setting the installation does not own.
237
-
238
- One apply reaches every client or restores the ones it already wrote. Every
239
- declared and previously recorded document is canonicalized, checked, and parsed
240
- before House is contacted at all - including the `hooks` object and the
241
- `SessionStart` array this Kit edits, so a document shaped differently refuses as
242
- `kit_client_settings_unreadable` without changing anything remotely. The counters
243
- House answers with are validated before the first local change. Each write then
244
- re-resolves the whole declared path and re-checks the document it prepared,
245
- refusing as `kit_client_settings_refused` when any part of the path, or the
246
- document itself, was replaced meanwhile - a parent directory turned into a link
247
- after preparation receives no write at all. A failed write or a cancellation
248
- part-way restores every document already written to its previous bytes, removes
249
- one this installation created, and names as `kit_client_settings_unrestored` any
250
- it could not restore.
251
- The previous instruction stays readable until the last document is written and
252
- only then is it pruned, so a client left holding an older command still reads an
253
- instruction that is there.
254
-
255
- A path is canonicalized through `..` and symlinks before it is used: the Kit
256
- writes through a symlinked settings document instead of replacing the link, and
257
- refuses as `kit_client_settings_refused` a path that is not a regular document,
258
- that two entries share, that resolves into this installation's own directory,
259
- or - for a document already in the record - that no longer resolves to itself,
260
- rather than writing through a link that replaced it. An existing document keeps
261
- its file mode, one the client does not have yet is created owner-only, and one
262
- the Kit cannot parse refuses as `kit_client_settings_unreadable` rather than
263
- being replaced. Preparation reads before the Environment control lease is taken;
264
- every write happens under that renewed lease with the apply it belongs to.
265
-
266
- Continuity does not depend on the hook. An Agent working through any client
267
- receives the same guidance in the server instructions and the tool descriptions,
268
- and an installation whose catalogue is empty neither installs a hook nor needs
269
- one served. A declared client is the opposite: an absent or malformed document
270
- refuses as `kit_hook_rejected` instead of leaving whatever was installed before.
271
-
272
- ## The Google preset
273
-
274
- The published Kit is built with one House-owned Google installed-application
275
- OAuth client. Its id and client secret are public build-time instance content,
276
- not House secrets and not values served by House at run time. Google refresh
277
- and access tokens remain in the installation's local credential store.
278
-
279
- Each Google instance represents one Google account, and one Kit installation
280
- may declare as many as the User has. Each instance owns its own local Google
281
- authorization, selectors, Source references, Room routes, checkpoints and
282
- health under `state/<instance>/`; the installation's one `kit login` covers
283
- them all, and no instance can read another's provider credential.
284
-
285
- ```json
286
- {
287
- "availability": "intermittent",
288
- "execution_authority": "refuse",
289
- "migrators": [],
290
- "instances": [
291
- {
292
- "id": "google-account",
293
- "preset": "google",
294
- "scopes": ["https://www.googleapis.com/auth/contacts.readonly"],
295
- "services": [
296
- {
297
- "service": "gmail",
298
- "source_ref": "src_google_mail",
299
- "rooms": ["work-room"],
300
- "backfill": { "days": 30 },
301
- "selection": { "labels": ["INBOX"] }
302
- },
303
- {
304
- "service": "calendar",
305
- "source_ref": "src_google_calendar",
306
- "rooms": ["work-room"],
307
- "backfill": { "all": true },
308
- "selection": { "calendars": ["primary"] }
309
- },
310
- {
311
- "service": "drive",
312
- "source_ref": "src_google_drive",
313
- "rooms": ["work-room"],
314
- "backfill": { "count": 500 },
315
- "selection": { "files": ["file-id"], "folders": ["folder-id"] }
316
- }
317
- ]
318
- }
319
- ],
320
- "clients": [],
321
- "host": null
322
- }
323
- ```
324
-
325
- Google authorization is incremental. Enabling Gmail requests only Gmail's
326
- read-only scope; Calendar and Drive request their own read-only scopes only
327
- when enabled. Each service scope set has its own local provider grant, so a
328
- later authorization never widens or replaces a sibling service's grant.
329
- Additional Google API scopes are declared once on the preset instance and
330
- remain local; a declared service names only scopes that instance already
331
- holds. Drive requires at least one explicit file or folder selection and never
332
- defaults to the whole account.
333
-
334
- A Google API outside the three curated services may use the closed declared
335
- service schema. The declaration is data only: no script or executable transform
336
- is loaded. Its host must be a Google API domain and it runs under scopes the
337
- instance already holds.
338
-
339
- ```json
340
- {
341
- "service": "people",
342
- "source_ref": "src_google_people",
343
- "rooms": ["work-room"],
344
- "backfill": { "all": true },
345
- "declaration": {
346
- "host": "people.googleapis.com",
347
- "path": "/v1/people/me/connections",
348
- "query": { "personFields": "names,emailAddresses,metadata" },
349
- "page_size": "pageSize",
350
- "scopes": ["https://www.googleapis.com/auth/contacts.readonly"],
351
- "page_token": {
352
- "request": "pageToken",
353
- "response": "nextPageToken",
354
- "checkpoint_request": "syncToken",
355
- "checkpoint_response": "nextSyncToken"
356
- },
357
- "items": "connections",
358
- "fields": {
359
- "native_id": "resourceName",
360
- "native_version": "etag",
361
- "provider_modified_at": "metadata.sources.0.updateTime",
362
- "observed_at": "metadata.sources.0.updateTime",
363
- "body": ["names.0.displayName", "emailAddresses.0.value"],
364
- "container": "metadata.sources.0.type"
365
- }
366
- }
367
- }
368
- ```
369
-
370
- A Google instance signs in only through [Environment setup](#environment-setup),
371
- on House's owner-authenticated page, so the owner's browser never has to reach
372
- this Environment. For each enabled service whose scopes the instance does not
373
- hold yet, the page links to Google's consent for exactly that service's scopes.
374
- Google then sends the browser to a `http://127.0.0.1:<port>/` address that
375
- nothing answers: the owner copies that whole address from the address bar and
376
- pastes it into the page. The Kit accepts it only when it carries the state its
377
- own consent issued, exchanges the code with its PKCE verifier and the built
378
- client, and stores the grant locally. An address that answers another consent,
379
- or a code Google refuses to exchange, fails the login and stores nothing; a
380
- declined consent cancels it. Grants already completed for earlier services stay.
381
-
382
- `kit source sign-in <instance>` signs in a custom connector instance through
383
- its own command, described below. It skips an instance whose local
384
- authorization is already valid and answers `ready`, `skipped`, or
385
- `needs_attention`. A Google instance refuses it as `kit_connector_login_guided`
386
- and names House setup.
387
-
388
- ## Environment setup
389
-
390
- House requests one setup when it creates a managed Environment and again when
391
- its owner asks it to renew what the Environment holds. The Kit acts on the
392
- request it acquires, never on its own:
393
-
394
- ```sh
395
- kit setup --house https://agents.house
396
- ```
397
-
398
- `kit worker run` performs the same step at the start of a pass, before it
399
- hands out any work, so a managed Environment needs no terminal. The walk first
400
- prepares the absolute `/agents/house` base, then visits every declared agent
401
- CLI and then every connector instance, in configuration order:
402
-
403
- - an agent CLI is installed or kept at its served release as
404
- [the declared agent CLIs](#the-declared-agent-clis) describe; a kind no
405
- release could be installed for needs attention as `install_failed`;
406
- - a module whose own status check already answers signed in reports
407
- `authenticated` to `/kit/logins/report`, which closes any renewal episode an
408
- earlier attempt left open, and is `skipped`;
409
- - otherwise the Kit runs the module's guided login. It reports the login to
410
- House as `renewal_required` for `/kit/logins/report`, which opens or returns
411
- one renewal episode, and presents the provider's steps on House's
412
- owner-authenticated page by holding `/kit/secret-input/<episode>` until the
413
- owner submits. Collected values go only to the waiting sign-in process; the
414
- Kit sends none of them, and none of the sign-in's output, to any other act. A
415
- sign-in whose status check then answers signed in reports `authenticated`
416
- and is `ready`;
417
- - a module without a guided route in this Kit, or one House does not advertise
418
- (`kit_login_renewal_unsupported`), needs attention as `login_unavailable`
419
- and opens no ceremony; a sign-in that exits without authenticating needs
420
- attention as `login_failed`, and one that outlives its ten-minute bound as
421
- `login_cancelled`. Either leaves its renewal episode open.
422
-
423
- One module's failure never stops the walk. The Kit reports what it now holds
424
- for every declared agent CLI and then the whole summary, one entry per module
425
- with its `category`, `name`, `status` and `reason`, to `/kit/setup/report`
426
- under the request it served, and releases its control lease. A cancelled
427
- command reports no partial summary and releases its lease once the walk has
428
- stopped.
429
-
430
- Each compiled adapter contract carries the guided route its provider's own
431
- headless sign-in offers, read from that command's output:
432
-
433
- - `codex-acp` runs Codex's device sign-in. The page links to the provider's
434
- device page and shows the one-time code the command printed; the owner signs
435
- in with ChatGPT there and enters the code, and the command completes on its
436
- own. Nothing is written back to it.
437
- - `claude-agent-acp` runs Claude Code's sign-in. The page links to the authorize
438
- page the command printed and collects the authentication code Claude shows
439
- afterwards, which the Kit writes to that command alone. Claude Code answers a
440
- code it refuses by asking for another, so the Kit ends that sign-in as soon as
441
- the command prints `Invalid code.` and it needs attention as `login_failed`
442
- rather than waiting out its ten-minute bound.
443
- - `grok-build` runs Grok Build's device sign-in. The page links to the Grok
444
- device URL and shows the anti-phishing one-time code printed by the command;
445
- authorization completes in the browser and no secret is written back to the
446
- process.
447
-
448
- House offers only a route its provider evidence qualifies; one it does not
449
- advertise stays `login_unavailable`.
450
-
451
- ## The custom connector
452
-
453
- Each custom service names one User-owned command. The Kit invokes it through an
454
- argument vector, never a shell, with an environment holding only `PATH`, the
455
- declared `environment` entries, and the resolved secrets. No House credential
456
- and no Kit User credential is ever placed there. The request carries no service
457
- name because the command is the service.
458
-
459
- Stdin carries one JSON request line:
460
-
461
- ```json
462
- { "contract": "2026-08-22", "instance": "acme", "cursor": null, "limit": 100 }
463
- ```
464
-
465
- `cursor` is the opaque cursor the connector last returned, or `null` on the
466
- first capture and after a reset. Stdout carries NDJSON: zero or more `item`
467
- lines and at most one terminal `cursor` line.
468
-
469
- ```
470
- {"type":"item","namespace":"acme/notes","native_object_id":"note-91","native_version":"7","observed_at":"2026-08-20T09:15:00.000Z","body":"the note","author":"ada","url":"https://acme.example/notes/91","attachments":[{"url":"https://acme.example/files/1","name":"plan.pdf"}]}
471
- {"type":"cursor","cursor":"page-2"}
472
- ```
473
-
474
- `namespace`, `native_object_id`, `observed_at`, and `body` are required;
475
- `native_version`, `author`, `url`, and `attachments` are optional. There is no
476
- metadata bag, no executable field, and no embedded credential. A malformed line
477
- anywhere rejects the whole run: nothing is delivered and no checkpoint moves. A
478
- non-zero exit status, a timeout, or output beyond the bound rejects the run the
479
- same way.
480
-
481
- An attachment names exactly one target. `url` is a verbatim reference House never
482
- fetches. `file` names one work file the connector already acquired into this
483
- Environment and declares its exact version:
484
-
485
- ```
486
- {"file":{"path":"/srv/acme/files/plan.pdf","bytes":48213,"sha256":"<hex>","media_type":"application/pdf"},"name":"plan.pdf"}
487
- ```
488
-
489
- `path` is absolute and never leaves the installation; `bytes` and `sha256`
490
- describe the accepted version even when the connector could not download it,
491
- and `media_type` is optional. The Kit publishes that descriptor as a retained
492
- original on the Capture item, under an accepted version derived from the
493
- delivery key, the attachment position and the descriptor, so reoffering the same
494
- item always names the same version and a different descriptor under the same
495
- delivery key is House's delivery-key conflict.
496
-
497
- The Kit derives each item's delivery key from the instance, the service, the
498
- declared namespace, the native object id, and the native version when present.
499
- An object whose content changes without its native version changing keeps its
500
- key and is refused by House as a delivery-key conflict rather than silently
501
- overwriting the earlier Record.
502
-
503
- The same command owns its module authorization. `kit source sign-in` and the
504
- setup walk's status check send one JSON line
505
- with `action: "authorization"` and `mode: "status"` or `mode: "login"`; the
506
- command returns exactly one JSON object such as `{ "authorized": true }`.
507
-
508
- ## The Worker runtime
509
-
510
- ```sh
511
- kit worker run --house https://agents.house
512
- ```
513
-
514
- Worker-runtime readiness validates the tmux this Kit declares support for,
515
- reopens any already-bound live WorkerSession, brings every declared agent CLI
516
- to its current release, starts each installed declared kind's command adapter
517
- long enough to verify its compiled contract and read the options its own
518
- session offers, reports what it holds to House, and only then acquires another
519
- WorkerRun. This Kit compiles three MVP adapter kinds: `codex-acp` contract `2` selects
520
- `@agentclientprotocol/codex-acp` `1.12.0` or a later `1.x` release, and
521
- `claude-agent-acp` contract `1` selects
522
- `@agentclientprotocol/claude-agent-acp` `0.79.0` or a later `0.x` release, while
523
- `grok-build` contract `1` selects `@xai-official/grok` `1.0.41` or a later
524
- `1.x` release and launches its native supervised ACP stdio mode. Each
525
- contract names the adapter package, the minimum release the `initialize` answer
526
- must reach, the executable it installs, the install recipe's own settings, the
527
- CLI's headless sign-in command and the command that answers whether it is
528
- signed in, the Agent Client Protocol version it speaks, its capability
529
- descriptor - the admitted `elicitation/create` field kinds, whether the adapter
530
- admits a declined form, and the stop-reason table of that adapter - whether the
531
- adapter loads a session, and the identifiers of the session configuration
532
- options the route's model and effort reach, or `null` for a field whose
533
- adapter offers no such option. An acquired route carrying any other descriptor for
534
- that kind refuses as `kit_adapter_contract_mismatch` before any spawn
535
- commitment.
536
- The `codex-acp` and `grok-build` contracts pin session loading and the
537
- `claude-agent-acp` contract does not. The same readiness asserts that the initialize exchange Kit
538
- wrote carried its elicitation declaration, because without it Claude Code
539
- disables its question tool and Codex answers nothing.
540
- An adapter whose running release is older than the contract's minimum, of
541
- another major, mismatched, or unresponsive refuses `kit worker run` within 10
542
- seconds per installed kind and names what it found, after the pass has reported
543
- what it holds, and every other Kit command keeps working.
544
-
545
- Once `initialize` passes, the Kit opens one Agent Client Protocol session with
546
- `session/new` in its own home directory and no MCP server, reads that session's
547
- configuration options, and stops the adapter; no prompt is sent. For each field
548
- the contract names, it takes the `select` option carrying that identifier and
549
- reports every value it offers with the display name the adapter gave it,
550
- flattening option groups and keeping nothing else. A field whose identifier the
551
- contract declares `null`, or whose option the session does not expose as a
552
- `select`, reports none. An adapter that refuses the session with the Agent
553
- Client Protocol's `auth_required` error, as `codex-acp` does before it is signed
554
- in, reports no options at all and its kind stays served. A session that fails
555
- for any other reason, does not open within 30 seconds, answers without a session
556
- id, or offers options the Kit cannot read as values and names reports no options
557
- either and refuses `kit worker run` as `kit_adapter_contract_mismatch`, like any
558
- other contract failure. The Kit keeps no catalogue of these values and no copy
559
- of them between passes: every report reads them from the adapter again.
560
-
561
- ## Agent working directories
562
-
563
- Connecting an installation creates `/agents/house`, the absolute base every
564
- default Agent working directory lives under. Connecting again keeps whatever is
565
- already under it. An installation that cannot create that directory refuses
566
- with `kit_launch_base_unprepared` and names it, rather than substituting a
567
- home-relative location: the Environment owner creates it once and gives the
568
- installation write access to it.
569
-
570
- Every acquired WorkerRun carries its Agent's absolute working directory and its
571
- Agent id in its execution plan, and Kit launches the supervised session and its
572
- adapter in exactly that directory. Kit recognises the Agent's own default
573
- directory by exact equality with `/agents/house/<agent id>`, never by a
574
- directory's mere position beneath the base: a sibling directory one level
575
- inside `/agents/house` is somebody else's default or an owner's own workspace,
576
- never this Agent's. Every path that is not this exact equality, one deeper
577
- inside `/agents/house` included, must
578
- already exist in this Environment as a directory the installation can enter;
579
- Kit never creates or seeds it.
580
-
581
- When the Agent's own default directory is absent, Kit builds the starter set in
582
- a temporary directory beneath the base and renames it into place as one atomic
583
- step, so a partly seeded directory is never visible at the default path. Two
584
- concurrent first launches race that rename; the loser discards its temporary
585
- directory and uses the directory the winner put there, so the pair still leaves
586
- one complete directory and nothing partial. A present default directory -
587
- including one whose starter files the owner edited or removed - launches
588
- exactly as it is, and a deleted default directory is recreated with a fresh
589
- starter set on its next launch.
590
-
591
- The starter set is `AGENTS.md` with the single line ``The agents.house `house`
592
- CLI is available: run `house --help`.``, `CLAUDE.md` as a relative symbolic link to it, `.agents/skills/grilling/`
593
- vendored from [`mattpocock/skills`](https://github.com/mattpocock/skills)
594
- `skills/productivity/grilling` at a pinned commit with its MIT license and a
595
- provenance header naming that commit, and `.claude/skills` as a relative
596
- symbolic link to `.agents/skills`. Once seeded the files belong to the owner:
597
- Kit never syncs, refreshes, or restores them, and refreshing the vendored skill
598
- for new Agents is an ordinary Kit release that never touches an already seeded
599
- directory.
600
-
601
- A relative, missing, inaccessible, or non-directory working directory refuses
602
- with `kit_launch_directory_unavailable` before any provider process starts. Kit falls back to no other location - not the
603
- base, not `$HOUSE_KIT_HOME`, and not its own current directory - and neither
604
- connecting an installation nor launching a session moves, copies, overwrites,
605
- or removes anything a working directory holds.
606
-
607
- ## The declared agent CLIs
608
-
609
- The Environment owner installs no adapter binary by hand. `kit agents update`
610
- and every `kit worker run` bring each declared kind to the latest release its
611
- contract serves - no older than the contract's minimum and inside that
612
- minimum's major - under
613
- `$HOUSE_KIT_HOME/agents/<kind>/releases/<release>/`, never touching what the
614
- owner installed globally, and an acquired route's command is that installed
615
- executable rather than a path anyone writes into `kit.json`.
616
- The resident Kit also listens for an `agents` availability pointer on its
617
- control stream. It reads the whole wanted list from House over HTTPS, removes
618
- Kit-owned CLI directories that are no longer wanted, installs newly wanted
619
- kinds, and reports its held state immediately, including while another Agent
620
- run remains active. A newly wanted kind that needs provider authorization uses
621
- the existing guided House login ceremony; Kit reports readiness again when it
622
- ends. A reconnect reads the list again, so a pointer missed during a stream
623
- outage changes no authority.
624
- Removal waits for an active worker pass or any unresolved live WorkerSession
625
- binding to stop using a CLI directory; the Kit keeps reporting that kind until
626
- it removes the directory.
627
-
628
- Every candidate release is proved before it serves: the Kit installs it beside
629
- the current release, runs the contract's own conformance check - the protocol's
630
- `initialize` against the minimum release, the protocol version and the
631
- capability descriptor the contract requires, and no provider-billed turn - and
632
- switches to it only on green. On red it keeps the release it already has,
633
- removes the candidate, and holds that kind with the refused release named in
634
- its report until a newer candidate appears. Non-major releases advance this way
635
- on their own; a major release waits for a contract revision. The candidate
636
- check runs at most every six hours per kind, and `kit agents update` runs it at
637
- once. A kind whose release lookup or installation fails keeps the release it
638
- already has, or none, and is named with its failure; the other kinds go on,
639
- `kit agents update` then exits non-zero, and a worker pass verifies and serves only the kinds with an installed release, so
640
- one CLI the Kit could not install leaves only that kind's work unavailable.
641
-
642
- The install recipe carries what the CLI needs beside its binary: for
643
- `codex-acp` the Kit enables user-input questions in Codex's own configuration
644
- document, because a Codex that disables them raises no `elicitation/create` and
645
- answers nothing, and the Kit adds that setting only where the owner declared
646
- none.
647
-
648
- `kit agents sign-in <kind>` runs that CLI's own headless sign-in command in the
649
- terminal it was started from, so the owner only completes it; House opens that
650
- terminal and runs nothing itself. Both commands hold one control lease, release
651
- it once they are done, and report to House afterwards what
652
- this Environment now holds: per declared kind its compiled contract version,
653
- the installed release or none, whether the contract's native readiness evidence
654
- shows a signed-in provider, the candidate release a red conformance check refused, and the model and
655
- effort options the installed adapter's own session offered, or `null` when no
656
- release is installed or its session did not open. Every report, the worker pass's
657
- and `kit setup`'s included, reads those options the same way and goes to
658
- `POST /kit/agents/report` with one entry per declared kind:
659
-
660
- ```json
661
- {"agents": [{"kind": "claude-agent-acp", "contract_version": "1", "release": "0.81.2",
662
- "signed_in": true, "hold": null,
663
- "options": {"model": [{"value": "haiku", "name": "Haiku 4.5"}], "effort": []}}]}
664
- ```
665
-
666
- House knows about an agent CLI only
667
- what this Kit reported: it probes no binary, version or login of its own, and
668
- it refuses an Agent, an Agent Session and Agent-runtime acquisition for a kind
669
- this Environment does not declare or this Kit has not reported installed and
670
- signed in.
671
-
672
- This installation owns one private tmux server namespace derived from
673
- `$HOUSE_KIT_HOME`, so House never joins, lists, or destroys an ordinary tmux
674
- session. Each acquired WorkerRun becomes one WorkerSession in one opaque exact
675
- tmux session of that namespace, created from a Kit-owned configuration that
676
- disables terminal retention. tmux owns the terminal lifecycle and nothing else:
677
- the pane, its scrollback, and anything the adapter writes to its own stderr are
678
- never read, stored, parsed, or answered, and no key is ever injected into a
679
- pane.
680
-
681
- Inside that session the Kit starts the launcher for the acquired route's
682
- declared command adapter and hands it, over a Kit-private local channel, the
683
- canonical request House gave the Kit and the adapter argument vector. Routine assignments carry their Routine Request.
684
- Direct conversation assignments carry the sealed turn and its ordered messages,
685
- and the Kit seals the reply itself on its own ingress.
686
- An Agent resolves exactly one Execution route, so the acquisition envelope's
687
- execution plan carries one `route` object and this Kit selects, orders, and
688
- hands off nothing. The Kit launches that route as House admitted it and keeps
689
- no local copy of it: an acquired route naming a kind `agents` does not declare
690
- refuses as `kit_agent_undeclared`, and one whose kind has no installed release
691
- as `kit_agent_not_installed`. The route names `adapter.kind` and
692
- `adapter.contract_version`. The installed release of that kind plus the route's
693
- `arguments` are the exact argument vector, so no route names a binary path.
694
- The route's `model` and its `effort` or `null` are House-visible route facts in
695
- the CLI's own vocabulary, which House stores as given and never validates; the
696
- Kit hands them to the adapter at session start as its contract names, and a
697
- value the CLI refuses fails the attempt with the CLI's own cause as
698
- `kit_adapter_failed`. A route whose `effort` is `null` sets no effort, so the
699
- CLI's own default effort applies and a model that offers no effort option
700
- starts.
701
- The adapter inherits only `PATH` and `HOME`, so the provider's own local
702
- authorization stays in the Environment where its CLI already keeps it. The Kit
703
- adds the Session's `house` CLI in front of that `PATH` and names the Session's
704
- bridge socket and nonce in `HOUSE_KIT_BRIDGE` and `HOUSE_KIT_BRIDGE_NONCE`.
705
-
706
- The launcher speaks the Agent Client Protocol through the protocol's official
707
- TypeScript SDK, `@agentclientprotocol/sdk`, as this Kit's one protocol client;
708
- the Kit frames no protocol JSON-RPC of its own. It opens the session with `session/new`
709
- in the Environment's working directory with no MCP server, or reloads the
710
- retained one with `session/load`, then sets the
711
- route's model, and its effort when the route names one, through the protocol's
712
- `session/set_config_option` with the option identifiers the adapter contract
713
- names: `model` and
714
- `reasoning_effort` for `codex-acp`, `model` and `effort` for
715
- `claude-agent-acp`. Neither pinned adapter reads a model or effort flag of its
716
- own. It carries the turn with one `session/prompt`, and maps that
717
- prompt's stop reason through the contract's own table to one of four turn
718
- outcomes: completed, interrupted, refused by the provider, or exhausted. A stop
719
- reason the contract does not name, including a vendor-specific one a different
720
- contract names, fails the turn as `kit_adapter_contract_mismatch` rather than
721
- being guessed. It sends the request
722
- as the first prompt block, followed by current House guidance fetched through
723
- the Run connection. Missing or unreadable guidance refuses the turn; the
724
- launcher does not copy the private Routine instruction into the acquisition
725
- request. It forwards only adapter-classified User-visible assistant
726
- text back over the local channel, and leaves reasoning, tool traces, and
727
- terminal output where they are. The supervised process's own House calls travel
728
- that same channel through the `house` CLI. The Kit holds the WorkerRunToken, replaces it in place when
729
- it nears expiry without the child noticing, attaches a bridge-generated UUIDv7
730
- to every Session mutation it forwards, and never places a House
731
- credential in any child environment.
732
-
733
- The Kit is the single source of assistant text: it observes the adapter, streams
734
- what it has seen so far, and seals the turn itself. No Agent is asked to report
735
- text a deterministic observer already sees, and no agent-facing tool admits final
736
- text.
737
-
738
- While the adapter generates, the Kit posts the whole User-visible assistant text
739
- of the turn so far to `sessions/<session>/drafts` as an ephemeral draft. Only
740
- adapter-classified assistant message text enters that stream; reasoning, tool
741
- calls, plans, and terminal output never do. The Kit maps the structure it can
742
- read in that text - paragraphs, headings, fenced code, ordered and unordered
743
- lists, pipe tables, and `$$` formulas - into House's admitted blocks, and leaves
744
- anything it did not parse as the paragraph it observed. It invents no structure
745
- and renders nothing.
746
-
747
- The Kit coalesces and paces that stream rather than mirroring every chunk. It
748
- sends the first observed view at once, then at most one view every 500
749
- milliseconds, and one more the moment the adapter completes a message; one call
750
- is in flight at a time, so a newer view replaces the view it overtook and the
751
- view observed last is the view House sees last. A view whose text exceeds
752
- House's 4096-byte bound is not sent. A draft persists nowhere - not in this
753
- Kit's local state, not as House history - is never retried, and can neither
754
- delay nor prove turn completion: a refused, lost, or overtaken draft changes no
755
- Run, WorkerSession, or delivery state. Ending the stream waits for no draft the
756
- transport is still holding, so a slow or unanswered draft call cannot delay the
757
- seal or the Run behind it.
758
-
759
- When the adapter completes the turn, the Kit seals it with one
760
- `sessions/<session>/assistant-messages` call carrying the same blocks and a
761
- UUIDv7 `operation_id`. The exact request - that identity and those blocks - is
762
- written into the WorkerSession binding before the call leaves, so a recovered
763
- call returns the outcome House recorded and never seals a turn twice, and
764
- House's answer names the turn it closed and the delivery it queued. An answer
765
- the Kit never received leaves the Run unsettled with the request retained: the
766
- next `kit worker run` replays exactly that operation and those blocks before
767
- settling anything, rather than reporting a failure it cannot prove. A refusal
768
- House did decide is the Run's reported failure.
769
-
770
- That seal is the one durable record of the turn, and only a seal House accepted
771
- completes a turn: the Kit reports whole-turn completion to House after the seal
772
- succeeds and never otherwise. A turn whose adapter produced no User-visible text
773
- seals nothing and claims no completed turn; the Run's own terminal outcome still
774
- follows what the adapter reported.
775
-
776
- The Agent reaches House only through the `house` CLI. Its verbs are the Tools
777
- House lists to the Session, and its help is House's own: `house --help` prints
778
- each listed Tool's name and description, and `house <verb> --help` prints that
779
- Tool's description and input schema, all read from House's `tools/list` at the
780
- call, so a catalogue change needs no Kit release. `house <verb>
781
- '<arguments as one JSON object>'` calls that Tool, or `house <verb> -` with the
782
- object on standard input for arguments longer than one command-line argument
783
- holds. It prints House's text answer, or a refusal on standard error with a
784
- nonzero exit status. The CLI holds
785
- no credential: it calls over its Session's bridge, which attaches the Session
786
- credential and refuses a caller without that Session's nonce as
787
- `kit_bridge_unauthorized`. House network calls use only the selected
788
- `2026-07-28` profile.
789
-
790
- Two verbs name files on the Session's own computer: `upload_attachment` takes
791
- one `path`, and `append_record` takes `attachments` as local paths. The CLI
792
- resolves each path against its working directory. The bridge reads each regular
793
- file, computes its size and SHA-256 and the media type an image's leading bytes
794
- show, declares them beside the call, and uploads the exact bytes through the
795
- one-use grant House answers before the call completes, so the answer carries the
796
- attachment's `at_` reference. `append_record` uploads every file into its Room
797
- first and names their references in the Record; a file that cannot be read or
798
- saved appends nothing. The bridge reads House's YAML answers to
799
- `upload_attachment`. A Room or `/private` upload ends at the byte upload rather
800
- than at a House answer, so the bridge prints that saved answer in the same YAML;
801
- every other answer passes through as House wrote it. With `conversation: true`
802
- the file becomes the owner's conversation original, and the bridge calls again
803
- and waits for House's delivery outcome. House derives the presentation from the
804
- declared media type: an image is uploaded inline beside a link to the unmodified
805
- original, and every other file is offered as that link alone.
806
-
807
- The bridge retains the exact pending House request in memory before transfer.
808
- Within the same live Kit and supervised WorkerSession, a lost response or
809
- infrastructure failure resends that request with the same identifier. A local
810
- socket reconnect delivers the retained outcome to the process.
811
- A second deliberate call gets a new identifier; read-only calls carry none.
812
- House refusals pass through to the CLI without automatic resend. [R193](https://github.com/agentshouse/core/blob/main/docs/concept/implementation/08-routine-requests-human-notifications-and-workers.md#r193)
813
- owns recovery authority, lifetime, and refusal semantics.
814
-
815
- The launcher speaks only what the adapter contract fixes for this build. Every
816
- session initializes with the same fixed client capabilities: no file-system
817
- methods, no terminal methods, and elicitation in form mode and not in URL mode.
818
- It offers the adapter no filesystem or terminal surface of its own, so an adapter
819
- that needs a decision the Kit cannot carry fails its turn instead of receiving a
820
- guessed answer. Execution permission is the one decision the Environment already
821
- settled: `kit.json` declares the Environment's `execution_authority` as `allow`
822
- or `refuse`, and the launcher answers every adapter permission request with that
823
- declared outcome and nothing else. The authority is a local Environment fact - it never reaches
824
- House, and no permission request is ever projected to a human.
825
-
826
- A task question is the decision the Environment cannot settle, so the launcher
827
- carries it to the owner instead of answering it. The Interaction is the
828
- protocol's own form end to end: an adapter's `elicitation/create` request in
829
- form mode reaches House's interaction act as its `message` and its
830
- `requested_schema`, unchanged in meaning, with the exact correlation of the
831
- provider turn and of the adapter request that raised it. House alone judges
832
- whether the schema is inside the flat subset it can ask; a form it admits as
833
- unsupported, and a URL-mode request the Kit never forwards, cancel the
834
- adapter's request with the protocol's `cancel` and ask the owner nothing.
835
-
836
- Nothing of an adapter's native wire crosses: the Kit strips every native
837
- `_meta` from the request, the schema, its properties and their options, and
838
- gives a property the adapter left untitled its own name as title. Two facts
839
- cross as House-namespaced marks instead. The batch carries
840
- `_meta["agents.house/secret"]` when the adapter classifies the request as
841
- secret in its own meta, as `codex-acp` does with `isSecret`; House records it
842
- as unsupported and raises an interrupt rather than a card, so no secret prompt
843
- is projected to a human and no secret answer travels back through House. A
844
- choice carries `_meta["agents.house/free-text"]` when the adapter's own
845
- convention admits the owner's words beside the listed options:
846
- `claude-agent-acp` pairs a question with a `_askUserQuestionCustomAnswer`
847
- companion field, and `codex-acp` pairs it with a `"None of the above"` option
848
- and a `<id>_note` field tagged `user_note`. The companion field and the
849
- synthetic option never reach House.
850
-
851
- The owner's answer arrives as the `answer` command carrying the protocol's own
852
- response, `accept` with content keyed by property name or `decline` for the
853
- whole form, and is applied to that exact pending request; an answer naming
854
- another turn or another correlation has no effect, so a stale or cross-Session
855
- answer cannot reach a live adapter. A typed answer to a free-text choice goes
856
- back through the adapter's own convention: into the companion field for
857
- `claude-agent-acp`, and as `"None of the above"` with the typed text in the note
858
- field for `codex-acp`. The turn waits on the adapter's own request while the
859
- owner decides, and the Kit reports what became of each Interaction, so a
860
- Session that ends with one outstanding expires it instead of leaving it live.
861
-
862
- Before new execution, `kit worker run` reconciles House-authorized inbound cache
863
- cleanup and materializes every pending conversation file House offers, ten at a
864
- time, under `$HOUSE_KIT_HOME/conversation-inbound/<run>/<attachment>/<name>`.
865
- House seals due input itself. The Kit uses the existing Environment lease and
866
- byte endpoint, limits each file to 32 MiB, and reports materialization after
867
- receiving a complete byte stream, validating any reported size, and writing the
868
- file. A lost acknowledgement preserves the completed local file for House's
869
- idempotent admission and later cleanup. Failed files remain pending; House's
870
- all-files-ready gate keeps their turn unprocessed.
871
- The provider receives absolute local paths beside the owning messages, both in
872
- its initial prompt and in `session_get_request`. The cache persists across
873
- turns; only House-authorized terminal Run cleanup removes its Run directory.
874
-
875
- The accepted attachment's retained original is separate from that cache. The Kit
876
- records a local note for the attachment before it acknowledges materialization,
877
- then saves the exact bytes it received through House's conversation-original
878
- door, naming only the attachment; a download that fails reports
879
- `source_unavailable` for the same version.
880
-
881
- A save that fails leaves one note in `state/conversation-originals/` naming the
882
- attachment, its Run, the local file and the descriptor it declared. Each
883
- later `kit worker run` retries it from that file without materializing or
884
- acknowledging anything again, and reports `source_unavailable` when
885
- the file is gone or changed rather than saving different bytes. While a
886
- WorkerSession stays supervised the same retry runs at the heartbeat interval. The note leaves once
887
- House records the save, once House answers that the Run is over, or when House
888
- authorizes that Run's cache cleanup; House accepts no save for a Run that has
889
- settled, so an unsaved original keeps its failed outcome from then on. The owner
890
- reads every saved original through House afterwards, whether or not this
891
- Environment still exists. `kit worker run` prints every conversation original
892
- outcome it handled, and exits non-zero while any of them is unsaved.
893
-
894
- One `kit worker run` then takes one House-authorized resumption, or otherwise
895
- acquires one waiting Run, and supervises exactly that WorkerSession. A resumed
896
- conversation loads its retained native provider session through ACP
897
- `session/load`, receives the current input from House through
898
- `session_get_request`, and executes one turn. Historical output replayed during
899
- loading is not emitted as new assistant output. Missing or rejected provider
900
- continuation never starts a replacement provider conversation in the same Run.
901
-
902
- Continuation is per adapter. A contract that pins session loading retains the
903
- adapter's opaque session handle between turns and resumes through it, as
904
- `codex-acp` and `grok-build` do. A contract without it, as `claude-agent-acp`, retains nothing:
905
- its turn reports no provider continuation, the Agent Session ends with the
906
- reported cause `kit_provider_continuation_unavailable`, and the owner starts the
907
- next one.
908
-
909
- Between turns, Kit retains the opaque provider session identifier and the Run's
910
- Worker, working directory, and route references in an owner-only local record.
911
- The record carries no transcript or Session credential and grants no authority:
912
- House must authorize each successor WorkerSession. A reported terminal state and
913
- owner stops remove the record. [R199](https://github.com/agentshouse/core/blob/main/docs/concept/implementation/08-routine-requests-human-notifications-and-workers.md#r199)
914
- owns conversation continuity.
915
-
916
- Launcher exit is the terminal process observation. The Kit closes the local
917
- channel, grants the launcher a fixed local exit grace, destroys the exact tmux
918
- session if it is still there, and then reports one stopped Session at
919
- `POST /kit/sessions/:session/stopped` and the adapter's own continuation facts at
920
- `POST /kit/sessions/:session/continuation`, whose body is exactly
921
- `{"provider_continuation": <bool>, "provider_capacity_exhausted": <bool>}`. No
922
- adapter-supplied reset instant and no handoff availability is sent, and nothing
923
- schedules a wake.
924
-
925
- Kit, not the Agent, then reports the terminal state the execution reached at
926
- `POST /kit/runs/:run/outcome`. No agent-facing tool posts it, and settling writes
927
- no Record, Posting or Capture by itself: whatever the instruction wanted written
928
- is written through the ordinary authorized Run mutations first. The body is
929
- `{"operation_id": <uuidv7>, "outcome": "completed"}` or
930
- `{"operation_id": <uuidv7>, "outcome": "failed", "cause": "<1-200 chars>"}`, and
931
- the reported cause is exactly what the adapter gave. A finished turn that needed
932
- no further Provider continuation is `completed`. A known execution failure, a
933
- provider capacity exhaustion, a positively lost Provider continuation, and a
934
- rejected native resume command are each `failed` with their own cause; House
935
- notifies the owner and nothing is retried. A confirmed-stopped Session whose
936
- Provider continuation remains available reports no terminal state at all and
937
- leaves the Run active for an owner-originated resumption.
938
-
939
- The Kit decides that terminal state once, records it beside its stable operation
940
- identity before it reports it, and reports it from that record. A Run with a
941
- supervised session records it in that session's durable local binding; a Run
942
- whose terminal state was decided without one — a resume command this Kit rejects
943
- because it retains no Provider continuation for the Run, or an acquired Run it
944
- refuses before any provider process starts, which it commits and fails with the
945
- refusal as the cause so no Run stays acquired behind it — records it in a
946
- durable local settlement note of its own, named by the Run. A lost response is recovered by reporting that
947
- identical body under the same operation identity on the next `kit worker run`;
948
- House answers the committed settlement verbatim and the Agent is never executed
949
- again. A Run House has already settled answers `worker_run_settled`, which the
950
- Kit accepts as settled and drops the record for.
951
-
952
- Every other refusal leaves that record exactly as it is. The Run stays bound to
953
- this installation, `kit worker run` names the refusal House answered with and
954
- exits non-zero, and the same decided body is reported again before anything is
955
- acquired. Nothing is dropped locally that House did not accept, and a refused
956
- report is never presented to the owner as a delivered one.
957
-
958
- While a WorkerSession is supervised the Kit keeps one durable local binding
959
- naming this installation, the WorkerRun, the WorkerSession, the exact tmux
960
- session, and the local channel that reaches it. The binding carries no terminal
961
- content, no prompt, and no resolved secret, and Session authority is always
962
- reissued by House rather than recovered from disk. It is evidence for
963
- reconciliation, never permission to resume or recreate work, and nothing keeps
964
- it once House has answered for the Run: a settled terminal state, a confirmed
965
- owner stop, and a retained Provider continuation each drop it.
966
-
967
- A restarted `kit worker run` reconciles the records it kept before it acquires
968
- anything new. It reports every retained settlement note first, because those
969
- Runs have no session left to reconcile, and drops each note House accepts or
970
- already settled. It next consumes the durable commands House holds for this
971
- Environment, so a requested owner stop ends the exact tmux session before any
972
- local channel reopens. It then considers only sessions of its own namespace
973
- whose binding is complete, and never lists unknown sessions, scans host
974
- processes, searches another namespace, or adopts an arbitrary process. A session
975
- that is already gone is confirmed gone, reported as one stopped Session with no
976
- Provider continuation, and settled as a terminal execution failure. A session
977
- that is still running is restored only after House
978
- positively replaces the Session authority for the same Run and Session; the Kit
979
- then reconnects the typed adapter channel, refreshes the started observation,
980
- and supervises that session to settlement instead of acquiring another Run. An
981
- explicit House refusal destroys the stale tmux session and exposes no channel.
982
- House that cannot be reached leaves the binding and the session exactly as they
983
- are, invents no stopped, active, or authorized state, and acquires nothing.
984
-
985
- A restore of House's database starts a new log epoch. Until this Environment
986
- has reported in it, House refuses every act that touches a Run, acquisition and
987
- lease release included, as `epoch_report_required` naming the epoch. The first
988
- such refusal ends whatever the pass was doing. One raised inside a supervised
989
- Run's bridge, while it admits or settles a question, streams a draft, or
990
- replaces Session authority for a forwarded call, never becomes an answer to the
991
- Agent: it ends the bridge and the pass at once. The Kit then reports, under the
992
- lease it holds and at `POST /kit/sessions/report`, every Run it holds a spawn
993
- commitment or a terminal outcome for: each retained binding, settlement note,
994
- and Provider continuation, as `{"session": "<run>", "outcome": null}` while its
995
- process runs, while it holds only its continuation, or while its outcome is
996
- unknown, or with the held outcome it would have reported at
997
- `POST /kit/runs/:run/outcome`, `completed` or `failed` with its cause. One
998
- report carries at most 256 Runs, so the Kit sends as many as it needs, all
999
- before it acquires anything. House settles every reported Run and never offers
1000
- it again, so once it has answered every report the Kit destroys each reported
1001
- tmux session still running, drops each reported Run's binding, settlement note,
1002
- and retained Provider continuation, and runs the pass again from its start. A
1003
- refused act is never a Run failure, nothing is acquired in the new epoch before
1004
- the report, and a refusal that follows the report ends the command naming it.
1005
-
1006
- The launcher inside the supervised session outlives the Kit process that started
1007
- it. Its local channel reconnects to the same socket with a bounded backoff and
1008
- announces that its adapter session already exists, so a restored bridge
1009
- acknowledges the resumption instead of starting a second turn and the supervised
1010
- process never sees a second request. A call already transferred when the Kit
1011
- process ends is never automatically replayed by its successor, even when the
1012
- same local channel reopens. Pending mutation requests and identifiers are not
1013
- written into the durable binding. Reconciliation must obtain current House
1014
- authority before the live process can make further calls.
1015
-
1016
- An owner stop requested through House reaches this Kit as a durable command,
1017
- both at startup and while a Session is supervised. The Kit destroys the exact
1018
- tmux session, confirms that it is gone, and reports the stopped Session. It
1019
- reports no continuation for a Run stopped by its owner and never reopens the
1020
- local channel for that Session.
1021
-
1022
- ```sh
1023
- kit worker attach # the one supervised session
1024
- kit worker attach <session> # the exact session
1025
- ```
1026
-
1027
- Attachment is a read-only diagnostic for the Environment owner. It reaches only
1028
- the exact tmux session of a live binding in this installation's namespace, gives
1029
- the Worker no input, makes no House call, causes no lifecycle transition, and
1030
- leaves the namespace configuration and its disabled terminal retention as they
1031
- are. Once the Session has settled or its tmux session is gone, attaching is
1032
- refused and names why.
1033
-
1034
- ## Paired proof
1035
-
1036
- Paired installed-CLI proof against the merged House producer is a labelled
1037
- validation build, not an npm release. From Linux Compose:
1038
-
1039
- ```sh
1040
- docker build -f test/pair/producer.dockerfile -t kit-original-pair:latest .
1041
- HOUSE_CORE_ROOT=<agents.house checkout> \
1042
- docker compose -f test/pair/compose.yaml up --abort-on-container-exit --force-recreate producer
1043
- ```
1044
-
1045
- It boots the real producer against a real PostgreSQL, installs the exact
1046
- candidate package, and runs `test/pair/*.vitest.ts`: the attachment doors,
1047
- a Source adapter retaining a declared file into Rooms of two owners, and an
1048
- installed Worker retaining an incoming attachment through failure, retry, Run
1049
- settlement and cache disposal. `KIT_PAIR_SPECS`
1050
- names the specs to run, and `HOUSE_CORE_REVISION` and `KIT_REVISION` are copied
1051
- into the evidence each spec writes under `tmp/delivery-evidence/`.
1052
-
1053
- ## Capturing
1054
-
1055
- ```sh
1056
- kit source capture acme --house https://agents.house # every declared service
1057
- kit source capture acme notes --house https://agents.house # one service
1058
- ```
1059
-
1060
- Each run reads the checkpoint, acquires one bounded page, submits one batch,
1061
- and advances the checkpoint only once every item in that batch is accepted or
1062
- an idempotent duplicate at the House door. Every batch names the service's exact
1063
- Source reference and its complete Room destination set, so House admits all of
1064
- them or none: one destination the delivering User cannot currently write refuses
1065
- the whole publication before any content changes. A refused item leaves the
1066
- checkpoint where it was, so the next run reoffers the whole batch and converges
1067
- on the door's own deduplication. When House stops a batch early, its answer
1068
- settles only the prefix it reached, and the unsettled tail is reoffered with the
1069
- rest. The loop repeats while the connector still returns items and no Room
1070
- destination is blocked, and every run ends by writing the service's health into
1071
- this installation's own state. House holds no preset, service, route, checkpoint
1072
- or health of yours.
1073
-
1074
- A Capture item that declares a `file` attachment answers one Record per Room
1075
- destination: Rooms of one owner share that owner's Record, and a Room of another
1076
- owner holds its own Record of the same delivery. The Kit records one retained
1077
- reference for every destination Room and attachment in
1078
- `state/<instance>/originals/<service>.json` before it saves anything, then
1079
- saves that batch's references through House's captured-original door before it
1080
- asks the connector for the next page: it reads the declared path, and uploads
1081
- the bytes only when they still match the declared descriptor. References still
1082
- outstanding from earlier runs are retried once the run's pages are delivered.
1083
- A missing or changed file reports `source_unavailable` instead, so House never
1084
- receives a substitute version. House, not the Kit, chooses where each Room
1085
- owner's copy is kept. Every run prints each reference's save outcome beside its
1086
- Room and Record and exits non-zero while any stays unsaved; acquisition health
1087
- stays about acquisition, so a failed save never changes it.
1088
-
1089
- ```sh
1090
- kit source retry-files acme --house https://agents.house # every declared service
1091
- kit source retry-files acme notes --house https://agents.house # one service
1092
- ```
1093
-
1094
- `retry-files` saves only the references still outstanding. It runs no connector,
1095
- submits no Capture, moves no checkpoint, and keeps each reference's Record and
1096
- accepted version; with nothing outstanding it contacts no House at all. A saved
1097
- reference, or one whose Posting House no longer holds, leaves the local state. A
1098
- Room whose write authority is gone answers `room_not_found` and stays outstanding
1099
- until that authority returns.
1100
-
1101
- ```sh
1102
- kit source status acme # every declared service
1103
- kit source status acme notes # one service
1104
- ```
1105
-
1106
- `kit source status` reads only local state: the current health and its exact
1107
- category, the stored cursor, every open coverage gap with the recovery reference
1108
- House returned for it, the items this installation dropped permanently, and the
1109
- retained references still waiting to be saved.
1110
-
1111
- Every command that changes or reads installation state takes this
1112
- installation's exclusive Environment control lease for the length of its run
1113
- and renews it before it expires, so two Kit commands never work against the
1114
- same installation at once. A command that ends, or is interrupted once its work
1115
- has stopped, releases that exact lease so the next command acquires at once; a
1116
- refused command leaves it to expire. A `kit login` credential is presented only to take
1117
- that lease.
1118
-
1119
- Interrupting the command cancels the running connector without advancing the
1120
- checkpoint.
1121
-
1122
- ## Repository capture
1123
-
1124
- Publish one local Git checkout as a Repository Source without giving House any
1125
- Git credential:
1126
-
1127
- ```sh
1128
- kit repository capture /srv/acme \
1129
- --room work-room \
1130
- --source-handle acme-repository \
1131
- --house https://agents.house
1132
- ```
1133
-
1134
- The command runs ordinary `git pull` in the checkout with the local User's Git
1135
- configuration, credential helper, and SSH agent. After pull succeeds, Kit asks
1136
- Git for tracked files plus untracked non-ignored files, hashes each selected
1137
- file, and opens a Publication by posting that manifest - every selected path
1138
- with its content fingerprint and byte length - to the authenticated Kit door.
1139
- Git remains the only ignore owner.
1140
-
1141
- House answers the Publication reference, the paths it needs, and the chunk
1142
- bound it accepts. Kit delivers only those paths, in House's order, in chunks
1143
- under that bound, streaming each file from disk at delivery time; it carries no
1144
- bound, no delta, no counter and no retained archive of its own. House owns
1145
- every tombstone, orders the Publication, and completes it in the request that
1146
- leaves no needed path outstanding.
1147
-
1148
- A file whose bytes disagree with the manifest House holds is refused as that
1149
- item and the rest of the chunk stands. When a delivery round ends with refused
1150
- items and the Publication is still active, Kit opens a new manifest of the
1151
- current checkout and delivers again, at most three manifests per run. An
1152
- interrupted run is never resumed: the next run opens a new manifest and House
1153
- answers with what is still needed. The command reports the Publication
1154
- reference, the paths delivered, the items refused and the ending.
1155
-
1156
- ## Explicit synchronization
1157
-
1158
- Beside the reconciling Working Copy, Kit has one explicit synchronization mode.
1159
- It selects prefixes over the User root, materializes them into a named local
1160
- directory, enumerates whole content and removals after the recorded positions,
1161
- and submits a resolved exact-base change set the caller prepared. Kit does no
1162
- local reconciliation. The mode shares no Working Copy manifest, never infers a
1163
- removal from a locally absent file, and writes authored mutations only within
1164
- House's declared write scopes: a selected Room's Library and, where granted,
1165
- `ROOM.md`. `/private` selects the Private Room by its Room reference, records an independent Room
1166
- position, and keeps its `agents/` cards and Room-specific private `AGENTS.md`
1167
- beside `library/**`.
1168
-
1169
- ```sh
1170
- kit sync bootstrap ./replica \
1171
- --house https://agents.house \
1172
- --prefix /rooms/work/library \
1173
- --prefix /rooms/work/capture \
1174
- --prefix /private/library
1175
- kit sync pull ./replica --house https://agents.house
1176
- kit sync submit ./replica --house https://agents.house --changes ./changes.json
1177
- kit sync rebootstrap ./replica --house https://agents.house
1178
- ```
1179
-
1180
- `bootstrap` writes `ROOM.md`, Library text, House-derived projections, and
1181
- Capture text with its provenance sidecar, and records one position per selected
1182
- authority from the bundle, with the log epoch House issued it in, together with
1183
- the positive operation scopes House declared for it: `read`, `sync`, `write`,
1184
- and `delete`, each a list of paths relative to the authority under which that
1185
- operation is admitted. Managed replication needs `read` plus `sync` on a Room;
1186
- a Room the User can only read answers `bootstrap`, `pull`, and `rebootstrap`
1187
- with `operation_denied`. Generated `_provenance` files delivered beside authored
1188
- Library paths are House metadata, not authored Library documents. `pull` presents
1189
- each recorded position with its log epoch, applies each enumerated path's whole
1190
- content or removal, and advances those positions. A position older than House's
1191
- declared retention, or one of a log epoch before House's database was restored,
1192
- is reported as `position_expired` with rematerialization as the remedy; only
1193
- `rebootstrap` rebuilds the directory.
1194
-
1195
- `submit` sends field, section, and preamble operations with that value's prior
1196
- content as base, and whole-file, rename, and removal operations with the file
1197
- revision. A rename of a populated directory instead carries a `base` map from
1198
- every relative member path to its exact revision, such as
1199
- `{"plan.md": "<revision>", "deep/log.md": "<revision>"}`, and House refuses it
1200
- unless the map names exactly the directory's current members at their current
1201
- revisions. Kit admits the rename at its source and destination and each named
1202
- member at both, as House does.
1203
- House alone validates the resulting Library: a batch it refuses answers with
1204
- House's own file path, field, rule, and version. A refusal is reported with the
1205
- current material House returned and the local directory is left for the caller.
1206
- An acceptance updates the recorded position, its log epoch, and the affected
1207
- files from the returned final content.
1208
-
1209
- Pending submissions are written before transfer. A lost response, reconnect, or
1210
- lease renewal recovers that exact request under the same identifier. A domain
1211
- refusal is reported without automatic retry and without minting a replacement
1212
- identifier. A second deliberate submit is a new identifier. After a restore of
1213
- House's database, a request House holds no receipt for and whose identifier
1214
- dates earlier than five minutes after the new log epoch began is answered
1215
- `position_expired`: it wrote nothing and never will under that identifier, so
1216
- the Kit drops it like any other refusal, `rebootstrap` rebuilds the directory,
1217
- and a change still wanted is a new deliberate submit against the rebuilt bases.
1218
- Once House has answered any request for a replica `position_expired`, the
1219
- replica refuses `submit` as `position_expired` until `rebootstrap` rebuilds it.
1220
- `rebootstrap` drops a submission still pending against the directory it
1221
- replaces.
1222
-
1223
- `--changes` names a JSON array of exact-base operations, or an object with a
1224
- `changes` array. Omitting it derives field, section, preamble, create, and whole-file
1225
- operations from local writable files against the last confirmed snapshot and
1226
- still never infers a removal. A local edit of a selected protected path is
1227
- refused before House is contacted as `protected_path`; a change outside the
1228
- authority's `write` scope, or a removal outside its `delete` scope, is refused
1229
- before House is contacted as `operation_denied`, the same code House answers
1230
- for a batch that reaches it.
1231
-
1232
- ## Attachments
1233
-
1234
- Upload one local file as an attachment to a Room or to your Private Room. Name
1235
- the place explicitly. Kit sends the descriptor and the selected bytes; it does
1236
- not scan a directory, convert a URL, or attach sibling files, credentials, or
1237
- absolute paths.
1238
-
1239
- ```sh
1240
- kit attachment upload ./notes.bin \
1241
- --house https://agents.house \
1242
- --room room:work \
1243
- --media-type application/pdf
1244
-
1245
- kit attachment upload ./notes.bin \
1246
- --house https://agents.house \
1247
- --private
1248
-
1249
- kit attachment get \
1250
- --house https://agents.house \
1251
- --attachment at_1x.q \
1252
- --room room:work \
1253
- --output ./notes.bin
1254
- ```
1255
-
1256
- `--room` and `--private` are mutually exclusive and one is required; `--name`
1257
- defaults to the file's base name. The upload prints the attachment reference
1258
- (`at_…`) House answered. That reference is what text links to: an attachment is
1259
- meaningful only because a document links it, and House records those links from
1260
- the accepted text. Retrying the same file after a lost response or failed upload
1261
- reuses the stored version under the identical descriptor, so it completes the
1262
- same attachment instead of creating a second one; uploading the same file to the
1263
- same place again answers that same attachment. A changed file is a new
1264
- attachment. HTTP 200 is not retention: only `save.status: saved` plus an
1265
- independent download whose length and SHA-256 match counts. A failed local read
1266
- or failed House save is not reported as saved. Transfer uses the current control
1267
- lease and the one reusable byte client; the durable credential is presented only
1268
- to `POST /kit/lease`. Sync commands do not fetch attachment bytes; Source and
1269
- Worker retention save through the same byte client.
1270
-
1271
- The same paired installed-CLI proof covers these doors; see
1272
- [Paired proof](#paired-proof) for the command that runs it.
1273
-
1274
- ## Persistent container Environments
1275
-
1276
- An Always-on Linux host can run the persistent container Environments its owner
1277
- creates in House. House owns the target: which host, the workspace name, and the
1278
- CPU, memory and persistent-disk ceilings. This Kit owns the local lifecycle and
1279
- reports only what it proved.
1280
-
1281
- The supported configuration is one Linux host with
1282
-
1283
- - cgroup v2 delegating the `cpu` and `memory` controllers, read from
1284
- `/sys/fs/cgroup/cgroup.controllers`;
1285
- - a reachable Docker Engine daemon;
1286
- - `/dev/loop-control` present, so a workspace disk can carry an enforced size;
1287
- - `host.workspace` pointing at a directory this Kit may create workspaces under;
1288
- - `host.image` naming an image that carries Node, this Kit, `mkfs.ext4` and
1289
- `nsenter`, and whose own entrypoint starts `kit worker run` from
1290
- `HOUSE_KIT_HOME`.
1291
-
1292
- Any missing prerequisite refuses the create before House ever presents the
1293
- workspace as constrained, naming the exact missing piece.
1294
-
1295
- ```sh
1296
- kit workspace host --house https://agents.house
1297
- ```
1298
-
1299
- The command acquires this host's workspace work under its Environment control
1300
- lease and settles each operation with what it observed:
1301
-
1302
- - **create** formats one ext4 image of exactly the configured disk ceiling,
1303
- mounts it as the workspace's only writable filesystem, writes that
1304
- Environment's own Kit credential and a `kit.json` declaring the selected agent
1305
- CLIs with `execution_authority` `allow` inside it, since nobody holds a
1306
- terminal there to answer otherwise, and creates the container with
1307
- `--cpus`, `--memory` and `--memory-swap` at the configured ceilings. The
1308
- workspace is reported `stopped` with the runtime and the enforcement it
1309
- proved. This host's own credential never enters the workspace: the only
1310
- credential written there belongs to the Environment running inside it.
1311
- - **start** mounts the workspace disk if the host rebooted, refuses when
1312
- starting would leave less than the host reserve, starts the container, and
1313
- reports `ready` only after the exact workspace proved it accepts execution.
1314
- - **stop** stops the container and keeps the disk mounted, so ordinary files,
1315
- installed tools and login state survive to the next start.
1316
- - **delete** removes that exact container, unmounts that exact workspace disk and
1317
- removes that exact directory. No other workspace, and nothing else on this
1318
- host, is touched.
1319
-
1320
- Every operation names one workspace this Kit created. A workspace the runtime no
1321
- longer has is reported `absent` rather than recreated, so House ends the
1322
- Environment visibly instead of inventing a process observation. On every pass
1323
- this Kit reconciles its own labelled containers against the exact inventory
1324
- House authorizes: a managed workspace House no longer authorizes to run is
1325
- stopped, and a container this Kit did not create is never adopted, started or
1326
- removed.
1327
-
1328
- Ceilings are shared ceilings. The ceilings configured across one host may exceed
1329
- that host, nothing is reserved for any workspace, and no workspace is promised
1330
- its maximum while another one runs.
1331
-
1332
- ## The Telegram gateway
1333
-
1334
- House can project one owner's conversations through that owner's own Telegram
1335
- bot. In Kit mode the BotFather token stays in one installed Environment, and
1336
- this Kit is the only thing that calls the Bot API. House never receives the
1337
- token: it appears in no request body, no refusal and no printed summary.
1338
-
1339
- Exactly one Environment may be the gateway for one bot. House records that
1340
- binding when the gateway registers, and refuses a second Environment claiming
1341
- the same bot. Worker Environments stay unchanged: they still acquire Runs and
1342
- materialize inbound conversation files.
1343
- The gateway never runs a Worker's provider and a Worker never holds the token;
1344
- the two exchange bytes only through House, which relays an inbound attachment
1345
- from the gateway to the Worker that needs it and serves the gateway an outbound
1346
- image from the original the Session stored.
1347
-
1348
- Bind the bot to this Environment:
1349
-
1350
- ```sh
1351
- kit telegram connect --house https://agents.house
1352
- ```
1353
-
1354
- The command asks for the token on a hidden terminal prompt, or reads one line
1355
- from standard input when it is not attached to a terminal. It asks Telegram `getMe`, and
1356
- refuses a bot whose Threaded Mode is off, because House projects each
1357
- conversation into its own forum topic. It then asks House whether this
1358
- Environment may become the gateway, before it writes anything locally. Once
1359
- House admits the preflight it deletes any webhook, so long polling is the only
1360
- receiver, and proves the owner by reading one ordinary private message outside
1361
- any topic through `getUpdates`, advancing the stored offset past it. Only then
1362
- is the token written, and only then is the gateway registered with House. A
1363
- setup House refuses removes the written token again, so a refused connect leaves
1364
- no custody behind. The command prints the bot username, the bot user id and the
1365
- proven owner's Telegram user id.
1366
-
1367
- Run the gateway:
1368
-
1369
- ```sh
1370
- kit telegram serve --house https://agents.house
1371
- ```
1372
-
1373
- The command holds one Environment control lease for the whole run and performs
1374
- three activities inside it, each paced on its own so none of them blocks
1375
- another:
1376
-
1377
- - **ingress** reads updates from the stored offset, normalizes each one into the
1378
- update House accepts, submits it, and advances the stored offset only after
1379
- House has taken it. A submission that fails leaves the offset where it was, so
1380
- the same update is offered again rather than lost.
1381
- - **inbound files** acquires the attachments House still needs, refuses anything
1382
- reported above the 20 MiB download ceiling before calling `getFile`, downloads
1383
- the file with the local token, and pushes the bytes to House for the Worker
1384
- Environment that will materialize them. That push waits for the Worker to pull
1385
- and a single failed fetch never ends the pass.
1386
- - **outbound queue** acquires the per-bot queue in its exact order, marks each
1387
- delivery attempted before it sends, and reports what Telegram answered:
1388
- `delivered` with the exact message or topic Telegram returned, `failed` when
1389
- Telegram refuses outright, and `delivery_unknown` when
1390
- the answer is absent or unreadable. File items are pulled back from House,
1391
- refused as `file_too_large` above the 10 MiB image ceiling, uploaded as
1392
- `sendPhoto` with the caption House composed around the link to the retained
1393
- original, and reported the same way; a pull that fails reports
1394
- `transfer_failed` and an ambiguous upload answer reports `delivery_unknown`.
1395
- Only an image ever becomes a file item, because House offers every other file
1396
- as a `conversation_file_link` message this queue delivers like any other. Live drafts ride that same queue as their own item and are
1397
- never reported back, because a draft has no settlement: House has already
1398
- coalesced each conversation to its latest view, and the gateway sends the
1399
- drafts of a pass after its durable deliveries with the Bot API's native
1400
- `sendRichMessageDraft` on the bound forum topic thread, under the same bot-wide
1401
- `retry_after` gate. The gateway coalesces nothing again and holds no draft for
1402
- a later pass: a draft taken in a pass that gate closed is dropped, and the next
1403
- view House coalesces takes its place. Pacing lives here because this is where
1404
- the Bot API is called.
1405
-
1406
- Each serve run first asks House to settle the attempts an earlier run abandoned,
1407
- so a restarted gateway never leaves a delivery attempted forever. A Telegram
1408
- `retry_after` opens one bot-wide gate: nothing is sent, fetched or polled until
1409
- the delay Telegram supplied has passed. `--passes <count>` bounds each activity
1410
- to that many passes and is what tests and one-shot runs use; without it the
1411
- command is resident and stops on SIGINT or SIGTERM, printing what it settled.
1412
-
1413
- Release the bot:
1414
-
1415
- ```sh
1416
- kit telegram disconnect --house https://agents.house
1417
- ```
1418
-
1419
- The command writes a local disconnect marker first, deletes the webhook, removes
1420
- the token and the stored offset, tells House this Environment is no longer the
1421
- gateway, and removes the marker last. Local custody is therefore always gone
1422
- before House admits the change. A disconnect interrupted after the marker was
1423
- written finishes on a later run even though the token is already gone, and a
1424
- `kit telegram serve` that finds the marker refuses to act.
1425
-
1426
- ## Local state
1427
-
1428
- ```
1429
- $HOUSE_KIT_HOME/
1430
- credential
1431
- kit.json
1432
- conversation-inbound/<run>/<attachment>/<name>
1433
- secrets/personal-telegram-bot.token
1434
- state/telegram/get-updates-offset.json
1435
- state/telegram/disconnecting.json
1436
- state/hooks.json
1437
- state/hooks/<hook id>.txt
1438
- state/repositories/<repository identity>.json
1439
- state/sync/<replica identity>.json
1440
- state/sync/<replica identity>.pending.json
1441
- state/attachments/<upload identity>.json
1442
- state/conversation-originals/<attachment identity>.json
1443
- state/sessions/<tmux session>.json
1444
- state/continuations/<run identity>.json
1445
- state/<instance>/credentials/google.json
1446
- state/<instance>/checkpoints/<service>.json
1447
- state/<instance>/health/<service>.json
1448
- state/<instance>/gaps/<service>.json
1449
- state/<instance>/dropped/<service>.json
1450
- state/<instance>/originals/<service>.json
1451
- ```
1452
-
1453
- Every file is written atomically and readable only by its owner. A file the Kit
1454
- cannot read is refused rather than treated as a service that never captured.
1455
- Disabling a service or an instance leaves its state in place, so re-enabling
1456
- resumes from the stored cursor instead of importing again.
1457
-
1458
- ```sh
1459
- kit source reset acme --house https://agents.house # every service
1460
- kit source reset acme notes --house https://agents.house # one service
1461
- ```
1462
-
1463
- Reset is the only deletion of captured state. It removes the named checkpoints
1464
- and their outstanding retained references so the next capture restarts exactly at
1465
- the configured backfill boundary. It takes the same
1466
- Environment control lease a capture takes, so it cannot delete a checkpoint a
1467
- running capture is about to write back.
1468
-
1469
- ## Host capacity
1470
-
1471
- An owned Linux host can report what it actually has, so its owner reads real
1472
- capacity instead of guessing from Run counts. Declare the host section:
1473
-
1474
- ```json
1475
- "host": {
1476
- "workspace": "/var/lib/house-kit/workspaces",
1477
- "maxima": {
1478
- "cpu_millicores": 2000,
1479
- "memory_bytes": 4294967296,
1480
- "disk_bytes": 53687091200
1481
- },
1482
- "image": null
1483
- }
1484
- ```
1485
-
1486
- `image` is the workspace image this host runs persistent container Environments
1487
- from, and is only read by `kit workspace host` below; leave it `null` on a host
1488
- that reports capacity and hosts no container. `workspace` is the absolute path of the persistent workspace directory; the
1489
- report measures the filesystem holding it, not the root filesystem by
1490
- assumption. `maxima` are the ceilings this host is configured to apply to
1491
- Kit-managed workloads, and House keeps them apart from what it measured. Declare
1492
- `"maxima": null` when this host configures no ceiling; an empty object is
1493
- refused rather than read as no limit. A ceiling is a shared ceiling, never a
1494
- reservation, and House infers no supported Agent count from any of these values.
1495
-
1496
- ```sh
1497
- kit host report --house https://agents.house
1498
- ```
1499
-
1500
- The command reads `/proc/stat` twice a second apart, reads `/proc/meminfo`, and
1501
- asks the kernel for the workspace filesystem's block counts. It sends the host
1502
- totals, what is in use, and what is available for each of processors, memory and
1503
- that filesystem, with the instant it measured them. Nothing else is collected:
1504
- no process list, no command line, no environment value, and no credential. A
1505
- native source this Kit cannot read or parse refuses as
1506
- `kit_host_unmeasurable` and sends nothing, because a host that cannot be
1507
- measured is unknown to its owner rather than empty.
1508
-
1509
- The report is one observation, not a stream. Run it on a timer the host owner
1510
- owns:
1511
-
1512
- ```
1513
- [Unit]
1514
- Description=Report measured host capacity to House
1515
-
1516
- [Service]
1517
- Type=oneshot
1518
- User=house-kit
1519
- ExecStart=/usr/bin/kit host report --house https://agents.house
1520
- ```
1521
-
1522
- ```
1523
- [Timer]
1524
- OnBootSec=1min
1525
- OnUnitActiveSec=5min
1526
- ```
1527
-
1528
- House reads an observation as fresh only while three instants - the one this
1529
- Kit says it measured, the one House received the report, and now - all fall
1530
- inside one fifteen-minute window. A host that stops reporting reads as aged from
1531
- then on, a report that was already stale when it arrived reads as aged
1532
- immediately, and a host that never reported reads as unknown; none of them ever
1533
- reads as a measured zero. Keep this host's clock in step with real time - a
1534
- clock more than fifteen minutes out of step in either direction makes every
1535
- report it sends read as aged, which is the honest answer House can give about a
1536
- reading it cannot date, and dating a reading into the future buys no freshness
1537
- because it widens the same window. A smaller skew is not free either: it is
1538
- spent from the same fifteen minutes, so a clock a few minutes out of step leaves
1539
- the timer above correspondingly less room to miss a run before House reads this
1540
- host as aged.
1541
-
1542
- ## Migrating authored text and linked originals
1543
-
1544
- `kit migrate` runs under the Environment User's control lease. Its module
1545
- category is `migrator`, declared in the required `migrators` array in `kit.json`
1546
- (use `"migrators": []` when none are installed):
1547
-
1548
- ```json
1549
- {
1550
- "id": "my-import",
1551
- "category": "migrator",
1552
- "command": ["/home/ada/tools/my-import"],
1553
- "timeout_ms": 600000,
1554
- "environment": { "EXPORT_REGION": "eu" },
1555
- "secrets": { "EXPORT_TOKEN": { "file": "/run/secrets/export-token" } }
1556
- }
1557
- ```
1558
-
1559
- The example is a user-installed module. Kit ships no concrete external-system
1560
- migrator. Secret references resolve only in the Environment and are passed only
1561
- to that module's process environment. The module receives neither House's
1562
- credential nor its lease. Module output and stderr are not published or echoed;
1563
- a module must never write an external credential into its emitted content,
1564
- manifest, URLs, or attachments.
1565
-
1566
- ```sh
1567
- kit migrate emit my-import --package /home/ada/exports/project
1568
- kit migrate mount /home/ada/exports/project --house https://agents.house \
1569
- --subtree /rooms/work/library/project
1570
- # Or emit and mount in one maintained mount session:
1571
- kit migrate run my-import --package /home/ada/exports/another-project \
1572
- --house https://agents.house --subtree /private/library/another-project
1573
- ```
1574
-
1575
- Emission refuses an existing output directory. The module reads one JSON line
1576
- on stdin: `{"contract":"kit-migrator/1","migrator":"my-import","package":"/absolute/output"}`.
1577
- It must finish writing this tree before exiting successfully:
1578
-
1579
- ```text
1580
- project/
1581
- migrator.json
1582
- model/note.md # optional independently prepared type definition
1583
- content/page.md # UTF-8 authored Markdown
1584
- attachments/image.png # exact downloaded original bytes
1585
- attachments/notes.txt
1586
- ```
1587
-
1588
- The manifest is closed and versioned:
1589
-
1590
- ```json
1591
- {
1592
- "contract": "kit-migrator/1",
1593
- "category": "migrator",
1594
- "migrator": "my-import",
1595
- "attachments": [
1596
- {
1597
- "path": "image.png",
1598
- "source": "https://export.example/image.png",
1599
- "media_type": "image/png",
1600
- "download": "downloaded",
1601
- "referrers": ["page.md"]
1602
- },
1603
- {
1604
- "source": "https://export.example/unavailable",
1605
- "download": "unavailable",
1606
- "failure": "not_found",
1607
- "referrers": ["page.md"]
1608
- }
1609
- ]
1610
- }
1611
- ```
1612
-
1613
- `path` is relative to `attachments/`; `referrers` are relative to `content/`.
1614
- `name` optionally supplies the attachment's file name. Downloaded entries require a
1615
- local path and forbid `failure`. Unavailable or skipped entries require
1616
- `failure` and forbid a local path. Every downloaded attachment must be linked
1617
- from a declared referring document, for example
1618
- `![Image](../attachments/image.png)` in `content/page.md`. Unavailable ordinary
1619
- Markdown URLs remain visible; they do not satisfy required typed references.
1620
- Only Markdown enters the Library. Symlinks, invalid UTF-8, binary content, type
1621
- aliases under `content/types/`, and generated `_provenance` are refused.
1622
- `content/MIGRATION.md` is reserved for Kit's report.
1623
-
1624
- Before creating the text subtree, Kit checks the House-declared MD model version
1625
- against its exact `@agentshouse/mdmodel` dependency, which rewrites the
1626
- package's links. House alone validates the resulting Library: a mount it
1627
- refuses answers with House's own file path, field, rule and version, and no
1628
- content lands. Definitions in `model/` require their own write
1629
- grant at `/rooms/<handle>/settings/model/<type>.md` or
1630
- `/private/settings/model/<type>.md`; a content write grant cannot prepare them.
1631
- Kit adopts an identical existing definition and refuses a different one.
1632
- Preparation uses the existing authored batch producer before the empty-subtree
1633
- mount, so a missing model grant leaves no partial content tree. Independently
1634
- prepared model definitions survive a later content-mount refusal or unmount.
1635
-
1636
- The atomic text mount includes a report with pending transfer rows. Kit then
1637
- uploads each downloaded file once as an attachment to the mount's Room or
1638
- Private Room, independently retrieves and compares the saved bytes, and only
1639
- after that proof succeeds rewrites every link to it, in every referring
1640
- document, to its attachment reference, such as `at_1x.q`. The reference is an
1641
- identity House resolves, not an HTTP download URL. A link's query and fragment
1642
- are kept after the reference, as in `at_1x.q#page=3`. Failed or unverified
1643
- uploads remain source links in the authored text; their failure details appear
1644
- only in the report. Use `kit attachment get --attachment <at_ref> --room
1645
- <room-ref> --output <file>` (or `--private`) to retrieve the exact bytes. Binary
1646
- bytes never enter the text replica. Migrators create no Capture, Source
1647
- instance, or provenance.
1648
-
1649
- The mounted `MIGRATION.md` separates local downloads from saved, pending,
1650
- failed, and skipped attachment uploads, with source URLs, referring documents
1651
- and the attachment reference of each saved upload.
1652
- `MIGRATION.json` beside the emitted package preserves local pending and final
1653
- outcomes. A failed upload leaves usable mounted text and returns a nonzero
1654
- exit status. A failure to publish the final report also returns nonzero and
1655
- leaves the pending mounted report plus the local outcomes. Re-migration is
1656
- explicit unmount followed by mount.
1657
-
1658
- ```sh
1659
- kit migrate unmount /rooms/work/library/project --house https://agents.house
1660
- kit migrate unmount /rooms/work/library/project --house https://agents.house \
1661
- --confirm /rooms/work/library/project
1662
- ```
1663
-
1664
- The first command shows the subtree destruction summary and removes nothing.
1665
- Confirmation must repeat the exact subtree. Kit checks discovered write/delete
1666
- authority and protected paths for every selected target, then makes House's one
1667
- unmount call. House rechecks authority and subtree state at commit. Each
1668
- command requires the ordinary available Kit control lease; an already held lease
1669
- is refused by the existing Kit rail.
1670
-
1671
- ### Linux Compose validation
1672
-
1673
- The test service uses the host Docker daemon, loop device availability and a
1674
- shared `/tmp` mount because `npm test` includes Kit's real workspace-volume
1675
- proof. It runs with an init process, because the supervised-path proofs kill a
1676
- tmux pane whose adapter is then orphaned and has to be reaped rather than left
1677
- as a zombie. Set `KIT_TEST_UID`, `KIT_TEST_GID`, and `KIT_TEST_DOCKER_GID` for
1678
- the host when they differ from 1001, 1001, and 112. It starts only test-owned
1679
- workspaces.
1680
-
1681
- ```sh
1682
- docker compose -f test/compose.yaml build kit
1683
- docker compose -f test/compose.yaml run --rm kit npm test
1684
- docker compose -f test/compose.yaml run --rm \
1685
- -e HOUSE_KIT_GOOGLE_OAUTH_CLIENT_ID=kit-client.apps.googleusercontent.com \
1686
- -e HOUSE_KIT_GOOGLE_OAUTH_CLIENT_SECRET=GOCSPX-kit-installed-app \
1687
- kit npm run build
1688
- ```
1689
-
1690
- `test/pair/run.sh` boots real Core, Auth and PostgreSQL and runs the installed
1691
- package against them. `HOUSE_CORE_ROOT` names the Core checkout under proof and
1692
- `HOUSE_AUTH_ROOT` names an Auth checkout; the run exports the exact Auth revision
1693
- Core's own `scripts/auth-pair-source.mjs` pins into `tmp/auth-pinned` and pairs
1694
- that revision rather than whatever the checkout's working tree carries. Set
1695
- `HOUSE_AUTH_REVISION` to name another revision when Core's pin trails the Auth
1696
- contract that Core revision already requires. Both producer databases are
1697
- dropped and made again before either migrates, so a run never inherits the
1698
- schema another Core revision left behind. Every run prints the three revisions
1699
- it paired and writes them into each evidence document.
1700
-
1701
- The installed fixture in `test/fixtures/migrator.mjs` uses only local material
1702
- and is excluded from the published package. Its paired proof runs from Kit:
1703
-
1704
- ```sh
1705
- HOUSE_CORE_ROOT=<committed-core-snapshot> HOUSE_AUTH_ROOT=<committed-auth-snapshot> \
1706
- KIT_PAIR_SPECS=/kit/test/pair/migrator.vitest.ts bash test/pair/run.sh
1707
- ```
1708
-
1709
- The pair boots real Core, Auth, and PostgreSQL. It covers Room and private
1710
- mounts, separately authorized models, House's typed refusal, exact
1711
- attachment retrieval, failed storage, mounted reports, occupied mounts and the
1712
- confirmed unmount. As in the other installed-CLI pair tests, the fixture expires
1713
- the previous control lease before starting the next isolated command. Evidence
1714
- is written to `tmp/delivery-evidence/migrator-pair.json` with producer revisions
1715
- and the installed package digest.
1716
-
1717
- The retained-original consumers have their own paired proofs:
1718
-
1719
- ```sh
1720
- HOUSE_CORE_ROOT=<core checkout> HOUSE_AUTH_ROOT=<auth checkout> \
1721
- KIT_PAIR_SPECS="/kit/test/pair/source-originals.vitest.ts \
1722
- /kit/test/pair/conversation-originals.vitest.ts \
1723
- /kit/test/pair/conversation-house-storage.vitest.ts" bash test/pair/run.sh
1724
- ```
1725
-
1726
- `source-originals` drives a controlled local Source adapter through one
1727
- installed Kit: it proves that the connector receives its own authorization,
1728
- selection and cursor and never a House credential, that an unreachable House
1729
- leaves the checkpoint where it was and converges on reconnect, that two Room
1730
- owners hold independently owned retained copies of one delivery while one
1731
- owner's two Rooms share a Record, that a failed save is truthful and a later
1732
- byte retry publishes no second Capture and no substitute version, that an
1733
- unauthorized Room destination stays outstanding while acquisition health stays
1734
- its own, that an explicit backfill bound still holds in the installed package,
1735
- and that interrupting the Environment stops the receiver without advancing the
1736
- checkpoint or being woken again. After the Environment's authority is revoked
1737
- its next capture is refused.
1738
-
1739
- `conversation-originals` and `conversation-house-storage` drive the same
1740
- installed personal-bot gateway and Worker over House storage. Both prove an
1741
- incoming accepted attachment retained through the shared byte client
1742
- independently of transport, a failed save and its retry leaving every accepted
1743
- message identity unchanged, the Run settling and its temporary media cache being
1744
- disposed, the owner downloading the exact original through House afterwards, and
1745
- the Environment's next protected act being refused once its authority is gone.
1746
- A file a Session sends to its owner's conversation through `house
1747
- upload_attachment` is proven by Core's pair lane. Evidence is written
1748
- to `tmp/delivery-evidence/source-originals-pair.json`,
1749
- `conversation-originals-pair.json` and `conversation-house-storage-pair.json`.
23
+ MIT