@jsonstudio/appsdk-linux-x64-gnu 0.0.0-stage → 0.1.15

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.
@@ -0,0 +1,482 @@
1
+ # Bootstrap and Migration
2
+
3
+ ## New project
4
+
5
+ ```text
6
+ requirements + acceptance
7
+ -> appsdk prepare
8
+ -> confirm project root/boundaries/non-goals
9
+ -> appsdk init
10
+ -> optional approved Guidance setup/compile
11
+ -> appsdk verify
12
+ -> clean owner worktree
13
+ ```
14
+
15
+ `init` is idempotent. It fills missing governance resources and preserves
16
+ business files. AppSDK project initialization remains its own owner and may
17
+ invoke the daemon context internally when a live Codex App Server sessionID
18
+ binding exists. The agent must not rerun AppSDK initialization or run another
19
+ identity command to repair pending Collab. For agent-facing Collab bootstrap,
20
+ run `collab context` once. `registered: true` ends bootstrap. If the snapshot
21
+ returns `required_fields`, supply only those real facts once with
22
+ `collab context --provide '<JSON>'`. The supplement may contain only requested
23
+ `session_id`, `thread_id`, `endpoint`, or `namespace` facts; it never supplies
24
+ a worker, approval, token, route, or binding. The daemon owns identity
25
+ creation, selection, recovery, registration, route publication, and lease
26
+ restoration. If AppSDK reports Collab pending or context explicitly reports
27
+ daemon DOWN or a runtime error, preserve the exact result and stop; daemon
28
+ maintenance is human-authorized. Use `new` only for an empty destination.
29
+
30
+ `appsdk prepare` is a hard gate. First invocation writes `.appsdk-prepare.json`
31
+ with `status: "draft"`. `appsdk init` rejects an unconfirmed preparation with
32
+ `PREPARATION_NOT_CONFIRMED`; it does not guess scope or boundaries. Rerunning
33
+ `appsdk prepare` prints the existing record and does not overwrite it.
34
+
35
+ Before `appsdk init`, the operator must explicitly confirm these fields in
36
+ `.appsdk-prepare.json`:
37
+
38
+ ```json
39
+ {
40
+ "schema_version": 1,
41
+ "preparation_id": "prepare-<slug>",
42
+ "status": "confirmed",
43
+ "objective": "One-sentence confirmed goal for AppSDK governance admission.",
44
+ "change_kind": "new_project",
45
+ "project_root": ".",
46
+ "legacy_roots": [],
47
+ "new_roots": [".appsdk/**", ".appsdk-control/**", "playground/**"],
48
+ "protected_roots": ["protected/**", ".git/**"],
49
+ "runtime_forbidden_roots": ["generated/**", ".agent-collab/**"],
50
+ "boundary": {
51
+ "allowed_paths": [".appsdk/**", "playground/**", "active/lib/**", "protected/**"],
52
+ "forbidden_paths": [".git/**", ".agent-collab/**", "dist/**"],
53
+ "payload_control_separation": "confirmed"
54
+ },
55
+ "acceptance_criteria": ["appsdk init completes", "appsdk verify passes"],
56
+ "non_goals": [],
57
+ "questions": [],
58
+ "confirmed_by": "Jason (explicit user approval)",
59
+ "confirmed_at": "2026-09-15T00:00:00Z"
60
+ }
61
+ ```
62
+
63
+ `change_kind` must be one of `new_project`, `module_refactor`,
64
+ `project_refactor`, or `debug`. `project_root` is the relative AppSDK project
65
+ root from the preparation file location; `.` means the same directory. All open
66
+ questions must be answered or removed before `init`. Never confirm the record
67
+ on behalf of the user, and never replace the preparation gate by editing
68
+ `.appsdk/project.json` before initialization.
69
+
70
+ For an existing project with prior `.appsdk/` or `.agent-collab/`, do not use
71
+ this ordinary new-project path. Use
72
+ [Existing project: remove old governance](#existing-project-remove-old-governance)
73
+ and keep AppSDK and Collab reset/migration in separate transactions.
74
+
75
+ AppSDK preserves the launching environment and does not pass a project path to
76
+ Collab. The daemon resolves project scope from the exact process cwd. Without a
77
+ live registered App Server transport, AppSDK initializes governance and
78
+ reports Collab pending because no peer can be registered; it never fabricates
79
+ subscription state.
80
+
81
+ Collab bootstrap errors from AppSDK's internal context invocation are explicit
82
+ warnings for AppSDK initialization. Automatic multi-worker registration and
83
+ task/file coordination remain enabled; shared operations wait for reliable
84
+ ownership while independent work continues.
85
+
86
+ ### Master and ordinary peer bootstrap
87
+
88
+ For a project that will run multiple agents, initialize the AppSDK governance
89
+ root first, then run one `collab context`. Through that invocation the daemon
90
+ registers/establishes the current peer and its lease; role assignment is
91
+ human-approved and separate.
92
+
93
+ Master initialization, after user approval for the exact project and peer:
94
+
95
+ ```bash
96
+ cd /abs/path/project
97
+ appsdk prepare
98
+ # confirm .appsdk-prepare.json exactly as above
99
+ appsdk init .
100
+ appsdk guide status
101
+ appsdk verify
102
+ collab context
103
+ # if required_fields are present, provide only those facts once
104
+ # only when the context snapshot has no live master and the user approved
105
+ # this exact peer:
106
+ collab master promote --approval "<user approval text>"
107
+ collab context
108
+ ```
109
+
110
+ Do not promote while a live master already exists. `appsdk init` alone never
111
+ creates master authority. If `appsdk init` reports Collab pending or a failed
112
+ registration, preserve the exact error; do not report Collab as available and
113
+ do not start a second daemon.
114
+
115
+ Ordinary peer initialization, after the project already has
116
+ `.appsdk/project.json` and a live master or parent:
117
+
118
+ ```bash
119
+ cd /abs/path/project
120
+ collab context
121
+ # if required_fields are present, provide only those facts once
122
+ ```
123
+
124
+ The peer must observe its own identity, liveness, presence, transport and peer
125
+ role. Do not run a second identity bootstrap, do not promote itself, do
126
+ not register a long-horizon goal, and do not fabricate a worker role from
127
+ AppSDK initialization output.
128
+
129
+ Long-horizon master scheduling is a separate, master-only step. Create the
130
+ plan file first, then register and verify:
131
+
132
+ ```bash
133
+ appsdk goal subscribe --goal docs/goals/<goal>-plan.md --interval 10m
134
+ appsdk goal status --json
135
+ appsdk longhorizon show --json
136
+ ```
137
+
138
+ `appsdk goal status --json` must report `active: true`, `desired: subscribed`,
139
+ `observed: subscribed`, `collab_subscribed: true`, a non-null
140
+ `subscription_id`, and a null `error`. A successful command output is not
141
+ proof that a timer fired. Run one short-interval live replay and record the
142
+ armed subscription, fired deadline notification, and consumed result before
143
+ declaring long-horizon scheduling verified. The current implementation is a
144
+ one-shot deadline that must be explicitly rearmed with `appsdk goal subscribe`
145
+ after it is consumed, expires, or Collab restarts.
146
+
147
+ For a new governance root, AppSDK installs a project-neutral root `AGENTS.md`
148
+ when none exists. It contains the Project Truth, Semantic Invariants,
149
+ Ownership, Architecture Truth, Development Process Control, Git Protection,
150
+ Task Routing, and Evidence Boundary sections used by Guide setup. Customize
151
+ the bracketed project facts through the approved setup flow. Existing project
152
+ rules are never overwritten, and rerunning `init` on an already governed root
153
+ does not recreate a deliberately absent `AGENTS.md`.
154
+
155
+ ## Repeat initialization and template upgrade
156
+
157
+ Initialization is not one-shot. After AppSDK is updated, or when the project
158
+ wants to revisit its process, rerun `appsdk init` to refresh AppSDK-owned Bundle
159
+ resources. It installs the current versioned standard reference at
160
+ `.appsdk/templates/minimal/AGENTS.md` while preserving the project-owned
161
+ `AGENTS.md`, local Skills, machine Guidance, lifecycle records, Active, and
162
+ Protected state.
163
+
164
+ ```text
165
+ appsdk init
166
+ -> Agent reads effective upstream rules, project AGENTS/Skills, test commands,
167
+ and CI/hook entrypoints
168
+ -> when Guidance is selected:
169
+ appsdk guide init --task guidance-upgrade --mode bootstrap --module <id>
170
+ compare retained rules and useful differences
171
+ GuidanceSetupProposal
172
+ reuse existing session authorization; approve only uncovered differences
173
+ -> otherwise: perform the same audit directly
174
+ -> latest origin/main clean owner worktree
175
+ -> apply authorized changes
176
+ -> when Guidance is selected: appsdk guide compile
177
+ -> appsdk verify
178
+ ```
179
+
180
+ The template is a standard reference, not an active rule source. Do not add it
181
+ to `.appsdk/project.json#/guidance/rule_sources`, automatically overwrite
182
+ project rules, or reset valid governance merely to adopt a newer template.
183
+ The proposal records retained project rules, recommended changes, and declined
184
+ template items so choosing not to adopt an item is explicit and valid.
185
+ Guidance is optional for this audit. Repeated initialization and unrelated
186
+ version refreshes do not trigger a whole-project rule audit.
187
+ Missing or locally removed reference material does not fail ordinary
188
+ `appsdk verify`; rerun `appsdk init` only when a fresh comparison is wanted.
189
+
190
+ ## Governance exists but Guide is missing
191
+
192
+ Do not reset or migrate valid lifecycle truth merely to add Guide. Run
193
+ idempotent initialization so the current AppSDK can install missing Guide
194
+ resources while preserving the existing project contract, maps, records,
195
+ Active, and Protected state.
196
+
197
+ An already governed root containing `.appsdk/project.json` may rerun
198
+ `appsdk init` directly; its existing project root is the authority, so a new
199
+ preparation record is not required for this non-destructive resource refresh.
200
+ Fresh or relocated initialization still requires confirmed preparation.
201
+
202
+ ```text
203
+ appsdk init
204
+ -> appsdk guide status
205
+ -> GUIDANCE_SETUP_REQUIRED
206
+ -> appsdk guide init --task guidance-setup --mode bootstrap
207
+ -> Agent reads returned AGENTS and local Skill candidates
208
+ -> Agent asks only unresolved questions
209
+ -> Agent presents GuidanceSetupProposal
210
+ -> reuse session authorization; approve only uncovered differences
211
+ -> clean owner worktree updates AGENTS/local Skill/machine contract/source declaration
212
+ -> appsdk guide compile
213
+ -> appsdk verify
214
+ ```
215
+
216
+ Bootstrap intake is read-only and may be invoked again after Guidance has been
217
+ compiled. Candidate files are not compiled rule sources
218
+ until the user approves them and `.appsdk/project.json` declares them. A
219
+ task-level PlanProposal is not a substitute for this project-level setup and is
220
+ never copied into a Skill automatically.
221
+
222
+ ## Existing project
223
+
224
+ Inventory AppSDK roots, maps, records, Active/Protected, local control state,
225
+ claims, and worktrees. Choose one route:
226
+
227
+ ### Preserve and migrate
228
+
229
+ Use when historical evidence remains valuable and the current version has a
230
+ supported canonical migration.
231
+
232
+ ```text
233
+ snapshot immutable truth
234
+ -> reconcile ownership/conflicts
235
+ -> run canonical migration once
236
+ -> verify one retained truth
237
+ -> compile Harness rules
238
+ ```
239
+
240
+ ### Reset and reinitialize
241
+
242
+ Use when old governance is obsolete, unsupported, or costs more than its audit
243
+ value. Reset is destructive and requires user authorization for the named
244
+ objects.
245
+
246
+ ```text
247
+ inventory + immutable audit snapshot
248
+ -> classify retained business source and Protected artifacts
249
+ -> request exact reset/delete authority
250
+ -> clean non-main owner worktree
251
+ -> appsdk init <project> --fresh --discard-legacy
252
+ -> old .appsdk audit/migration records and generated projection removed
253
+ -> current .appsdk contract, record contracts, and transition manifest rebuilt
254
+ -> rebuild maps/goal/module/owner from current project truth
255
+ -> appsdk guide compile
256
+ -> appsdk guide init for the current task/domain
257
+ -> appsdk verify
258
+ ```
259
+
260
+ `--fresh --discard-legacy` is an explicit existing-project initialization route,
261
+ not ordinary `init` behavior. It requires `.appsdk/project.json`, a clean
262
+ non-`main`/`master` worktree, and the discard confirmation. It preserves
263
+ business source, runtime data, `active/`, `protected/`, and human documents;
264
+ only the named AppSDK control plane and declared generated roots are removed.
265
+ The current SDK scaffold is the only reset baseline: legacy SDK pins, migration
266
+ witnesses, indexes, and SDK-owned contract projections are ignored and
267
+ regenerated; missing SDK-owned fields are refilled. Project identity, module
268
+ ownership, build, and protection boundaries are carried forward.
269
+ The new reset record has `mode: "fresh_init"` and proves the reset operation
270
+ only. It does not inherit old PASS, review, delivery, or freeze claims.
271
+
272
+ Before choosing this route, install the reviewed current AppSDK and Collab
273
+ versions globally and use only those installed binaries and Skills for the
274
+ inventory. Do not read, replay, or interpret old local control history to make
275
+ the old baseline compatible. The current version is the only reset baseline:
276
+ missing SDK-owned fields are refilled, legacy SDK pins/migration witnesses are
277
+ ignored, and old local control state is removed only through the canonical
278
+ owner.
279
+
280
+ The replacement order is:
281
+
282
+ 1. Install the reviewed AppSDK and Collab binaries/Skills.
283
+ 2. Inspect with the newly installed commands and record the exact old control
284
+ roots and owner.
285
+ 3. Retire or migrate Collab through the Collab owner.
286
+ 4. Reset AppSDK through the AppSDK owner in a clean non-main worktree.
287
+ 5. Validate the new baseline only. Do not import old PASS, receipts, review,
288
+ install, restart, or delivery evidence.
289
+
290
+ If a legacy user-local Collab binary pair is proven by its own version
291
+ response, removal requires explicit user authorization naming the exact binary
292
+ paths. After the canonical pair is installed, remove only those authorized,
293
+ verified paths. Never remove `~/.appsdk`, `~/.collab`, project
294
+ `.agent-collab/`, or business source as part of binary cleanup.
295
+
296
+ The lower-level `appsdk reset-governance <project> --discard-legacy` command remains
297
+ available and uses the same transactional reset owner. Neither command
298
+ authorizes manual deletion or hand-editing of version/hash/ReviewRecord, and
299
+ neither permits two active governance roots. If old Active/Protected artifacts
300
+ are also obsolete, name exact paths and authorize a separate cleanup.
301
+
302
+ ### What to do with old reports and delivery output
303
+
304
+ Use ownership and rebuildability, not age, to decide what is removable:
305
+
306
+ | Class | Default action | Reason |
307
+ | --- | --- | --- |
308
+ | `.appsdk/records`, `.appsdk/transactions`, audit/migration reports | Inventory/snapshot if needed, then remove through reset | Old control truth must not leak into the new baseline. |
309
+ | Declared `governance.generated_root`, module generated outputs | Remove through reset and regenerate | These are reproducible projections, not source or release truth. |
310
+ | Failed transaction staging | Canonical abort/retry if current; otherwise reset | Manual deletion can hide ownership or partial publication. |
311
+ | `active/`, `protected/`, runtime data, business source | Retain | They may be the only published or operational truth. |
312
+ | `dist/`, `.deploy/`, `build/`, `tmp/`, custom reports/artifacts | Keep until exact disposable ownership is confirmed | AppSDK cannot infer that an external output is safe to delete. |
313
+
314
+ The reset command reads and validates the old project contract before removal,
315
+ carries that contract into the new `.appsdk` root, and includes its declared
316
+ generated root in the disposable set. It does not use a fixed project path or
317
+ silently delete Active/Protected. For external outputs, the
318
+ owner must name the exact path, establish that it is rebuildable, authorize
319
+ cleanup, and record the result separately. Never preserve an old report by
320
+ renaming it as a new record, and never make a new record by editing an old
321
+ hash or receipt.
322
+
323
+ ## Mid-development adoption
324
+
325
+ Do not force release/freeze evidence onto unfinished work.
326
+
327
+ ```text
328
+ snapshot current source and task state
329
+ -> initialize advisory governance
330
+ -> bind current goal/module/owner/worktree
331
+ -> if Guide is missing, complete the user-approved setup proposal first
332
+ -> run task guide init, read declared AGENTS/Skills, ask unresolved questions
333
+ -> place workflow at the current real phase
334
+ -> apply new rules to new/changed nodes
335
+ -> continue development
336
+ ```
337
+
338
+ Untouched legacy gaps are warnings unless safety, source ownership, evidence
339
+ truth, or current delivery is affected.
340
+
341
+ ## Existing project: remove old governance
342
+
343
+ Use this section when a real project root already contains `.appsdk/`,
344
+ `.appsdk-control/`, or `.agent-collab/` from an older version and the operator
345
+ wants to start the current governance and coordination baseline instead of
346
+ migrating old control state. The two roots have different owners and must be
347
+ handled in separate transactions.
348
+
349
+ ### 1. Inventory and freeze
350
+
351
+ Run read-only inventory from the project root. Do not delete anything yet.
352
+
353
+ ```bash
354
+ cd /abs/path/project
355
+ git status --short --branch
356
+ git worktree list
357
+ find .appsdk .appsdk-control .agent-collab -maxdepth 3 -print 2>/dev/null
358
+ collab migrate inspect
359
+ collab context
360
+ ```
361
+
362
+ Record the exact project root, branch/HEAD, worktrees, `.appsdk/` and
363
+ `.appsdk-control/` contents, generated roots, `active/`, `protected/`,
364
+ `.agent-collab/` journal/mailbox/tasks/claims, daemon PID/socket, peer
365
+ identities, routes, and migration blockers in the run note. A file name, old
366
+ PID file, socket existence, or successful `collab status` is not sufficient
367
+ proof of ownership.
368
+
369
+ Stop new shared writes, dispatches, and task admission before either reset.
370
+ Preserve every active worktree and task until its owner or an explicitly
371
+ authorized migration decision resolves it.
372
+
373
+ ### 2. Collab migration or retirement
374
+
375
+ `.agent-collab/` is owned by Collab. AppSDK reset does not remove it. If the
376
+ project uses Collab v1 and the journal is replayable, use the authenticated
377
+ migration transaction:
378
+
379
+ ```bash
380
+ collab migrate inspect
381
+ collab migrate plan
382
+ collab migrate apply
383
+ # install the reviewed Collab binary, then:
384
+ collab down
385
+ collab up
386
+ collab context
387
+ collab migrate verify
388
+ ```
389
+
390
+ `inspect` is read-only. `plan` does not freeze admission. `apply` freezes
391
+ admission and persists the deterministic snapshot. `verify` resumes admission
392
+ only after journal/mailbox/task/identity continuity passes. If the result is
393
+ `reset_required`, `needs_operator`, `unknown`, or an owner/count mismatch, stop
394
+ and resolve it through Collab's canonical owner; do not continue to the AppSDK
395
+ reset as if the whole operation passed.
396
+
397
+ When the operator explicitly authorizes abandoning the old Collab epoch
398
+ instead of preserving it, use the single offline reset owner:
399
+
400
+ ```bash
401
+ collab down
402
+ collab reset --project --discard-legacy --approval "<explicit user authorization>"
403
+ collab up
404
+ collab context
405
+ ```
406
+
407
+ `collab reset` archives the exact `.agent-collab/` and `.agent-collab-v2/`
408
+ bytes, removes only Collab-owned project control state and stale routes, and
409
+ rebuilds the current empty baseline. It never removes `.appsdk/` or
410
+ `.appsdk-control/` and records `delivery_verified: false`. Never manually
411
+ delete `.agent-collab/`, edit its JSON/JSONL, clear its mailbox, copy identity
412
+ tokens, or start a second daemon. A project that has no valid Collab state to
413
+ preserve still needs this explicit Collab retirement or the migration
414
+ decision; AppSDK must not make that decision for it.
415
+
416
+ ### 3. AppSDK reset
417
+
418
+ After the Collab side is either migrated/verified or explicitly retired by its
419
+ owner, handle `.appsdk/` from a clean non-`main` owner worktree with no
420
+ competing claim. For a project that must abandon the old governance epoch and
421
+ start from the current SDK baseline, the preferred single entry is:
422
+
423
+ ```bash
424
+ cd /abs/path/project
425
+ git worktree add -b codex/governance-reset-<slug> \
426
+ /Volumes/Intel/playground/<project-key>/<task-slug> origin/main
427
+ cd /Volumes/Intel/playground/<project-key>/<task-slug>
428
+ appsdk init "$PWD" --fresh --discard-legacy
429
+ appsdk guide init --task governance-reset --mode bootstrap --module <module-id>
430
+ appsdk guide compile
431
+ appsdk verify
432
+ appsdk compile
433
+ ```
434
+
435
+ `<project-key>` and `<task-slug>` come from the current project and task. Do not
436
+ reuse another task's worktree path.
437
+
438
+ `appsdk init --fresh --discard-legacy` requires an existing
439
+ `.appsdk/project.json`, a clean non-`main`/`master` worktree, and the explicit
440
+ discard confirmation. It uses the same transactional reset owner as
441
+ `appsdk reset-governance <project> --discard-legacy`, but combines reset with current
442
+ contract rebuild. It removes the old AppSDK control plane, `.appsdk-control/`,
443
+ and declared rebuildable generated roots; it preserves business source,
444
+ runtime data, `active/`, and `protected/` by default. It must not remove
445
+ `.agent-collab/`.
446
+
447
+ If the operator explicitly chooses the lower-level AppSDK operation instead,
448
+ run it in the same clean non-`main` worktree and then initialize:
449
+
450
+ ```bash
451
+ appsdk reset-governance "$PWD" --discard-legacy
452
+ appsdk init "$PWD"
453
+ appsdk guide compile
454
+ appsdk verify
455
+ ```
456
+
457
+ Do not hand-edit `.appsdk/` JSON, reuse old PASS/hash/receipts, or delete
458
+ `active/` or `protected/` as part of reset. Those are separate authorized
459
+ cleanup decisions.
460
+
461
+ If the old `.appsdk/project.json` is missing, malformed, unreadable, or the
462
+ worktree is dirty, `--fresh --discard-legacy` must fail closed. Do not replace
463
+ that check with manual deletion. Preserve the exact error and use the AppSDK
464
+ migration owner to establish whether the project contract can be recovered;
465
+ only an existing, valid contract can authorize a fresh reset. If no contract
466
+ can be established, a new root must go through a separate confirmed
467
+ preparation/init flow rather than claiming to reset the old project.
468
+
469
+ ### 4. Verify the new baseline
470
+
471
+ The operation is complete only when all of the following are true:
472
+
473
+ - Collab reports the exact migration/retirement result and has one verified
474
+ daemon/socket/identity state.
475
+ - `appsdk verify` passes against the current project contract and the fresh
476
+ reset baseline.
477
+ - The removed classes are limited to the authorized AppSDK control plane,
478
+ `.appsdk-control/`, and declared rebuildable generated roots.
479
+ - Business source, runtime data, `active/`, `protected/`, and all retained
480
+ Collab evidence still exist.
481
+ - The new reset record is current and does not claim delivery, review,
482
+ install, restart, or communication success.
@@ -0,0 +1,111 @@
1
+ # AppSDK and Collab Command Surface
2
+
3
+ Use these commands instead of guessing paths or running broad help exploration.
4
+ This list is the decision path for normal setup, quality, delivery, and Collab
5
+ work.
6
+
7
+ ## AppSDK commands
8
+
9
+ ```text
10
+ appsdk prepare create or print .appsdk-prepare.json
11
+ appsdk init . scaffold/refresh governance and register project
12
+ appsdk init . --fresh --discard-legacy reset old AppSDK control plane and rebuild
13
+ appsdk reset-governance . --discard-legacy
14
+ lower-level AppSDK control-plane reset
15
+ appsdk new <dir> create an empty new governed project
16
+ appsdk verify . verify current governance contract/baseline
17
+ appsdk compile . compile project modules
18
+ appsdk compile-module . --module <id> compile one module
19
+ appsdk pin-lock . --binary <path> pin project to a binary and write sdk.lock
20
+ appsdk guide status read compiled guidance status
21
+ appsdk guide compile compile declared guidance after contract binding
22
+ appsdk guide init --task <id> --mode <mode> --module <module-id>
23
+ create a task-specific guide plan
24
+ appsdk goal subscribe --goal <file.md> --interval <interval>
25
+ master-only long-horizon registration
26
+ appsdk goal status --json verify goal subscription state
27
+ appsdk longhorizon show --json read long-horizon role/task state
28
+ appsdk bug intake --input <json> deduplicate/classify execution work and return issue_id
29
+ appsdk bug list -q <kw> --json query bug backlog
30
+ appsdk bug new -t <title> -m <body> -l <labels>
31
+ create a bug record
32
+ appsdk bug list ... --upstream inspect upstream AppSDK defects
33
+ appsdk bug new --upstream ... report an AppSDK defect upstream
34
+ appsdk bug show ... --upstream read an upstream AppSDK defect
35
+ appsdk bug show <id> --json read a bug record
36
+ appsdk bug close <id> -m <solution> --receipt-id <receipt>
37
+ close a bug with solution evidence
38
+ appsdk subagent start --id <id> start a managed subagent
39
+ appsdk subagent status inspect managed subagents
40
+ appsdk subagent send <id> --subject <topic> "<assignment>"
41
+ dispatch a managed subagent task
42
+ appsdk subagent close <id> close a managed subagent
43
+ appsdk subworker <action> compatibility entry for Collab subagent flow
44
+ appsdk communication reset-runtime-registry --discard-legacy --approval "<text>"
45
+ archive legacy ~/.appsdk/runtimes.jsonl and rebuild current baseline
46
+ project-memory entry append memory entry and regenerate projections
47
+ project-memory reentry [project] --run <run-id>
48
+ resume a memory run after interruption
49
+ ```
50
+
51
+ ## Collab commands
52
+
53
+ ```text
54
+ collab context single agent identity bootstrap and authority query
55
+ collab context --provide '<JSON>' supply only required missing facts once
56
+ (session_id/thread_id/endpoint/namespace only)
57
+ collab sendmessage --to <peer> --subject <topic> "<body>"
58
+ send one durable ordinary message
59
+ collab recv consume delivered notifications
60
+ collab inbox list unread messages (read-only)
61
+ collab msg <id> read one message without consuming
62
+ collab ack <id> | --all compatibility ACK for delivered messages
63
+ collab master promote --approval "<text>"
64
+ promote this peer when user approves and no master exists
65
+ collab master delegate <peer> transfer live master authority
66
+ collab master send --project <target> --to <target-master> --subject <topic> "<body>"
67
+ cross-project master-to-master send
68
+ collab subagent dispatch --request-id <id> --subject <topic> "<assignment>"
69
+ scheduler-reserved dispatch
70
+ collab task accept <task-id> accept assigned task (assigned -> working)
71
+ collab task update --status <state> update task state
72
+ collab task block <id> block with concrete cause/owner/unblock condition
73
+ collab task close <id> [--force --reason "<reason>"]
74
+ close owned task
75
+ collab migrate inspect read-only migration/retirement inspection
76
+ collab migrate plan prepare migration/retirement snapshot
77
+ collab migrate apply freeze admission and persist snapshot
78
+ collab migrate verify verify migration/retirement continuity
79
+ collab reset --project --discard-legacy --approval "<text>"
80
+ retire/rebuild Collab-owned local control plane
81
+ collab down controlled daemon stop
82
+ collab up controlled daemon start
83
+ ```
84
+
85
+ The commands below are read-only operator diagnostics. They are not
86
+ initialization, route recovery, or agent bootstrap steps. Do not chain them
87
+ after `collab context` during setup. If context explicitly reports daemon DOWN
88
+ or a runtime error, preserve the exact failure and stop; daemon lifecycle
89
+ maintenance is human-authorized. See
90
+ [`init-prompts.md`](init-prompts.md#stale-daemon-socket-or-lock).
91
+
92
+ ```text
93
+ collab status --all server summary and worker/task state
94
+ collab who registered peers and liveness
95
+ collab worker status <peer-id> one peer's identity/liveness/transport
96
+ collab notify status own subscriptions
97
+ ```
98
+
99
+ ## Do not guess
100
+
101
+ - Do not edit `~/.appsdk`, `~/.collab`, `.appsdk/`, `.appsdk-control/`, or
102
+ `.agent-collab/` by hand.
103
+ - Do not delete project directories to clean global truth.
104
+ - Do not use `--help` exploration as the setup path; read the referenced
105
+ lifecycle docs when a command's exact flag matters.
106
+ - If a command returns an error, preserve the exact error and report it.
107
+ Never claim a route, migration, merge, install, restart, or delivery from
108
+ command output alone.
109
+ - Do not run AppSDK or Collab initialization or operator diagnostics to repair
110
+ pending identity.
111
+ `collab context` and its one factual supplement are the only agent bootstrap.
@@ -0,0 +1,74 @@
1
+ # Contracts and Failures
2
+
3
+ ## Severity
4
+
5
+ - `advisory`: recommendation; never blocks.
6
+ - `warning`: visible debt; current work may continue.
7
+ - `forbidden`: unsafe or false transition; command stops.
8
+
9
+ Forbidden defaults:
10
+
11
+ - fabricated/empty evidence for required PASS;
12
+ - non-adjacent transition within a selected workflow;
13
+ - plan/event history overwrite or deletion;
14
+ - stale project, goal, source, tree, scope, owner, Skill, AGENTS, or manifest;
15
+ - committed governance mutation from main;
16
+ - false review, delivery, promotion, freeze, or cleanup completion.
17
+
18
+ Legacy optional metadata, historical strictness outside changed scope, missing
19
+ release evidence during ordinary development, and absent parallel-worker data
20
+ in a single-worker task are warnings or advisory.
21
+
22
+ Architecture conformance is change-scoped. New or modified behavior that puts
23
+ control truth in payload/metadata/log context, duplicates an owner or
24
+ implementation in a way that breaks its contract, or mocks a required capability
25
+ is forbidden. A project-declared operation/hook/gate boundary remains binding.
26
+ Optional simplifications are advisory; direct code is not a violation merely
27
+ because it could use configuration. The same pattern in untouched historical code
28
+ is advisory unless it affects safety, ownership, evidence truth, or the current
29
+ delivery boundary.
30
+
31
+ ## Compatibility
32
+
33
+ Project-scoped commands resolve the project from the process `cwd` when their
34
+ optional project argument is omitted. Do not require a project-root environment
35
+ variable. `--help` is project-independent and must never resolve or validate a
36
+ project.
37
+
38
+ Harness does not check binary SHA. Existing AppSDK version/contract compatibility
39
+ belongs to canonical lifecycle commands. A mismatch must return either a
40
+ supported migration route or an authorized reset/reinitialize route; it must
41
+ not trap development behind repeated byte-identity checks.
42
+
43
+ `GUIDANCE_SETUP_REQUIRED` is not a lifecycle failure. It means existing
44
+ governance has no approved Guide declaration. Only when Guidance is selected,
45
+ run the returned read-only bootstrap intake, present `GuidanceSetupProposal`,
46
+ reuse session authorization that covers a difference, and obtain explicit
47
+ approval only for uncovered changes. Then update and compile project-owned rule
48
+ sources. Do not report an external AppSDK blocker or retry compile against an
49
+ undeclared rule set.
50
+
51
+ ## Failure output
52
+
53
+ Required fields:
54
+
55
+ ```text
56
+ first failing gate/code
57
+ project/module/lifecycle projection
58
+ preserved state
59
+ retry_allowed
60
+ canonical owner
61
+ one executable next action
62
+ ```
63
+
64
+ Do not retry unchanged failures. Do not hand-write records or hashes. Fix the
65
+ first divergent owner, revise the plan if bound context changed, then execute
66
+ once.
67
+
68
+ ## Worktree audit
69
+
70
+ Every claim binds one branch and owner worktree. Resource close requires remote
71
+ receipt when delivery is in scope, retention/cleanup record, worktree removal,
72
+ removal verification, then claim release. Engineering delivery may be complete
73
+ while an owned worktree is retained and its cleanup obligation stays open. An abandoned or foreign dirty
74
+ worktree is preserved until its owner or explicit cleanup authorization exists.