agentera 3.0.0-dev.22 → 3.0.0-dev.23

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 (87) hide show
  1. package/README.md +7 -3
  2. package/bundle/.cursor/agents/agentera.md +1 -1
  3. package/bundle/.opencode/agents/agentera.md +1 -1
  4. package/bundle/CHANGELOG.md +2 -0
  5. package/bundle/references/artifacts/state-storage-authority.yaml +109 -3
  6. package/bundle/references/cli/agent-ready-state-contract.yaml +22 -14
  7. package/bundle/references/cli/prime-consumer-compatibility.yaml +676 -0
  8. package/bundle/references/cli/vocabulary-index.yaml +3 -3
  9. package/bundle/references/cli/vocabulary.md +10 -3
  10. package/bundle/skills/agentera/SKILL.md +7 -6
  11. package/bundle/skills/agentera/agents/audit.toml +1 -1
  12. package/bundle/skills/agentera/agents/build.toml +1 -1
  13. package/bundle/skills/agentera/agents/design.toml +1 -1
  14. package/bundle/skills/agentera/agents/discuss.toml +1 -1
  15. package/bundle/skills/agentera/agents/document.toml +1 -1
  16. package/bundle/skills/agentera/agents/optimize.toml +1 -1
  17. package/bundle/skills/agentera/agents/orchestrate.toml +1 -1
  18. package/bundle/skills/agentera/agents/plan.toml +1 -1
  19. package/bundle/skills/agentera/agents/profile.toml +1 -1
  20. package/bundle/skills/agentera/agents/research.toml +1 -1
  21. package/bundle/skills/agentera/agents/status.toml +1 -1
  22. package/bundle/skills/agentera/agents/vision.toml +1 -1
  23. package/dist/capabilities/index.js +2 -1
  24. package/dist/capabilities/index.js.map +1 -1
  25. package/dist/capabilities/status/startupInstructions.js +35 -0
  26. package/dist/capabilities/status/startupInstructions.js.map +1 -0
  27. package/dist/cli/capabilityContext/build.js +3 -3
  28. package/dist/cli/capabilityContext/build.js.map +1 -1
  29. package/dist/cli/capabilityContext/closeout.js +5 -5
  30. package/dist/cli/capabilityContext/closeout.js.map +1 -1
  31. package/dist/cli/capabilityContext/contract.js +4 -4
  32. package/dist/cli/capabilityContext/contract.js.map +1 -1
  33. package/dist/cli/capabilityContext/evidence.js +4 -4
  34. package/dist/cli/capabilityContext/evidence.js.map +1 -1
  35. package/dist/cli/capabilityContext/planState.js +7 -6
  36. package/dist/cli/capabilityContext/planState.js.map +1 -1
  37. package/dist/cli/capabilityContext/startup.js +4 -4
  38. package/dist/cli/capabilityContext/startup.js.map +1 -1
  39. package/dist/cli/commands/prime/briefOrientation.js +582 -0
  40. package/dist/cli/commands/prime/briefOrientation.js.map +1 -0
  41. package/dist/cli/commands/prime/orientationOutput.js +117 -23
  42. package/dist/cli/commands/prime/orientationOutput.js.map +1 -1
  43. package/dist/cli/commands/prime.js +30 -3
  44. package/dist/cli/commands/prime.js.map +1 -1
  45. package/dist/cli/commands/schema.js +3 -29
  46. package/dist/cli/commands/schema.js.map +1 -1
  47. package/dist/cli/commands/state/plan.js +3 -2
  48. package/dist/cli/commands/state/plan.js.map +1 -1
  49. package/dist/cli/help.js +1 -1
  50. package/dist/cli/help.js.map +1 -1
  51. package/dist/cli/orientation.js +3 -3
  52. package/dist/cli/orientation.js.map +1 -1
  53. package/dist/cli/startupCompletenessContract.js +3 -3
  54. package/dist/cli/startupCompletenessContract.js.map +1 -1
  55. package/dist/cli/stateQuery.js +37 -0
  56. package/dist/cli/stateQuery.js.map +1 -1
  57. package/dist/state/decisionLegacyValidation.js +185 -0
  58. package/dist/state/decisionLegacyValidation.js.map +1 -0
  59. package/dist/state/decisionOverlay.js +24 -1
  60. package/dist/state/decisionOverlay.js.map +1 -1
  61. package/dist/state/decisionRevision.js +622 -0
  62. package/dist/state/decisionRevision.js.map +1 -0
  63. package/dist/state/decisionRevisionPublication.js +532 -0
  64. package/dist/state/decisionRevisionPublication.js.map +1 -0
  65. package/dist/state/directRetrieval.js +55 -4
  66. package/dist/state/directRetrieval.js.map +1 -1
  67. package/dist/state/listRetrieval.js +42 -11
  68. package/dist/state/listRetrieval.js.map +1 -1
  69. package/dist/state/startupProjection.js +68 -1
  70. package/dist/state/startupProjection.js.map +1 -1
  71. package/dist/state/write/candidateMutation.js +331 -0
  72. package/dist/state/write/candidateMutation.js.map +1 -0
  73. package/dist/state/write/explain.js +36 -12
  74. package/dist/state/write/explain.js.map +1 -1
  75. package/dist/state/write/helpers.js +22 -0
  76. package/dist/state/write/helpers.js.map +1 -1
  77. package/dist/state/write/mutation.js +42 -0
  78. package/dist/state/write/mutation.js.map +1 -1
  79. package/dist/state/write/operations.js +49 -1
  80. package/dist/state/write/operations.js.map +1 -1
  81. package/dist/state/write/transaction.js +23 -357
  82. package/dist/state/write/transaction.js.map +1 -1
  83. package/dist/validate/lifecycleAdapters/lifecycleMain.js +154 -0
  84. package/dist/validate/lifecycleAdapters/lifecycleMain.js.map +1 -0
  85. package/dist/validate/lifecycleAdapters.js +5 -156
  86. package/dist/validate/lifecycleAdapters.js.map +1 -1
  87. package/package.json +2 -2
@@ -0,0 +1,676 @@
1
+ schema_version: agentera.prime_consumer_compatibility.v1
2
+ status: approved_boundary
3
+ plan: plan:634c092e-a7bc-48f4-80ee-2c91940e54f1
4
+ plan_task: 1
5
+ purpose: >-
6
+ Task 1 compatibility boundary for the "Make prime startup compact and
7
+ self-contained" plan. Inventory every documented prime consumer, classify
8
+ every field proposed for omission as removable, conditional, or
9
+ transition-required, and record the approved public-output policy that Tasks 2
10
+ through 4 must satisfy. This file is the consumer-facing contract boundary; it
11
+ does not consolidate the emitted field authority (Task 2) and does not define
12
+ byte budgets (json_output_surface_manifest.yaml owns those).
13
+ exclusions:
14
+ - Structured attention records (attention stays delimiter-encoded string[]).
15
+ - Stable artifact identities and reference-based routing.
16
+ - New summary-versus-diagnostic projection modes.
17
+ - Compiled or cached capability instructions.
18
+
19
+ # ---------------------------------------------------------------------------
20
+ # Consumer inventory. Each consumer names its startup command and the concrete
21
+ # fields it reads, with a file:line evidence pointer into the current tree.
22
+ # Tasks 2-4 MUST keep every consumed field resolvable from a declared surface.
23
+ # ---------------------------------------------------------------------------
24
+ consumers:
25
+ - id: opencode_compaction_context
26
+ startup_command: agentera prime --format json
27
+ evidence: .opencode/plugins/agentera.js:502-517
28
+ consumed_fields:
29
+ - mode
30
+ - profile.status
31
+ - profile
32
+ - health.grade
33
+ - health.trajectory
34
+ - health
35
+ - issues
36
+ - plan
37
+ - plan.exists
38
+ - plan.status
39
+ - plan.title
40
+ - plan.first_pending.name
41
+ - progress
42
+ - progress.latest
43
+ - progress.latest.number
44
+ - progress.latest.what
45
+ - progress.latest.next
46
+ - next_action
47
+ - next_action.object
48
+ - attention
49
+ notes: >-
50
+ Reads the deprecated `issues` alias instead of `todo` (lines 480-486).
51
+ This is the only documented runtime consumer of the deprecated alias, so
52
+ `issues` is transition-required until the stable cut.
53
+ - id: status_dashboard_renderer
54
+ startup_command: agentera prime --context status --format json
55
+ evidence: skills/agentera/SKILL.md:68
56
+ dashboard_evidence: packages/cli/src/capabilities/status/instructions.ts
57
+ state_evidence: packages/cli/src/cli/commands/prime/orientationOutput.ts:206
58
+ consumed_fields:
59
+ - capability_context.instructions
60
+ - capability_context.context.status_context.health
61
+ - capability_context.context.status_context.todo
62
+ - capability_context.context.status_context.plan
63
+ - capability_context.context.status_context.objective
64
+ - capability_context.context.status_context.profile
65
+ - capability_context.context.status_context.next_action
66
+ - capability_context.context.status_context.attention
67
+ - capability_context.context.status_context.state_presence
68
+ - capability_context.context.status_context.source_contract
69
+ notes: >-
70
+ Bare `/agentera` and natural-language routing run one status-context call.
71
+ The response contains the full `capability_context.instructions` body and
72
+ the bounded `capability_context.context.status_context` projection. The
73
+ dashboard glyphs (health/todo/plan/objective/profile/next_action/attention)
74
+ define the minimum required state families; omitted rich detail is recovered
75
+ through the named command in the status context, never by raw artifact read.
76
+ - id: capability_context_dispatcher
77
+ startup_command: agentera prime --context <capability> --format json
78
+ evidence: .opencode/agents/agentera.md:12
79
+ alt_evidence: .cursor/agents/agentera.md:7
80
+ runtime_evidence: packages/cli/src/cli/capabilityContext/startup.ts:250
81
+ consumed_fields:
82
+ - command
83
+ - status
84
+ - capability_context
85
+ - capability_context.instructions
86
+ notes: >-
87
+ Per-capability startup capsule. The runtime emits
88
+ `capability_context.instructions` (the capability's instructions module),
89
+ not `prose`. The agent descriptors (.opencode/agents/agentera.md and
90
+ .cursor/agents/agentera.md) formerly documented a `prose` field that the
91
+ v3 runtime never emits; they were reconciled to
92
+ `capability_context.instructions` to match
93
+ packages/cli/src/cli/capabilityContext/startup.ts:250 and
94
+ skills/agentera/SKILL.md (lines 68, 103), which already documented
95
+ `capability_context.instructions`. This consumer governs the `--context`
96
+ surface, not the bare briefing; the bounded decision brief (Task 3) must
97
+ not break the `--context` capsule. Executable fixture proves the emitted
98
+ payload contains `capability_context.instructions` and NOT `prose`.
99
+ - id: packaging_distribution_gate
100
+ startup_command: agentera prime --format json
101
+ evidence: docs/packaging/v3-packaging.md:130-139
102
+ consumed_fields:
103
+ - command
104
+ - status
105
+ - app_home
106
+ - app_home.source
107
+ notes: >-
108
+ Distribution/packaging verification matrix consumer. The Prime gate
109
+ (line 136) asserts `command: "prime"`, `status: "ok"`, and that
110
+ `app_home.source` reflects resolution; the Bun smoke gate (line 139)
111
+ asserts the published single binary runs `agentera prime --format json`
112
+ and exits 0 with the same JSON shape. Tasks 2-4 must keep the published
113
+ prime JSON shape stable so packaged binaries and fresh-cache npx gates
114
+ keep passing. Not a dashboard consumer; does not read state families.
115
+ - id: json_output_surface_manifest
116
+ startup_command: agentera prime [ --dashboard | --context <capability> ] --format json
117
+ evidence: scripts/json_output_surface_manifest.yaml:47-161
118
+ consumed_fields: declared_surfaces
119
+ notes: >-
120
+ Measurement/budget authority, not a runtime consumer. Declares five prime
121
+ surfaces: prime-dashboard, prime-status-context, prime-briefing,
122
+ prime-fields-sparse, and prime-capability-context. The capability surface expands over the current
123
+ English CAPABILITY_NAMES set; generic capsules use the 55000-byte ceiling,
124
+ while status uses its dedicated 25000-byte one-call budget. It owns the
125
+ byte/token budgets; Task 3 (<=12000) and Task 4 (<=25000) budgets are
126
+ reconciled against it.
127
+ - id: vocabulary_capability_context_guide
128
+ startup_command: agentera prime --context <capability> --format json
129
+ evidence: references/cli/vocabulary.md:90-113
130
+ consumed_fields:
131
+ - capability_context
132
+ - capability_context.instructions
133
+ notes: >-
134
+ Documentation consumer, not a runtime consumer: the vocabulary guide
135
+ tells capability consumers how to read the startup capsule. Reconciled
136
+ from the retired `prose` field to the v3 `capability_context.instructions`
137
+ field after the second Task 1 evaluation found this guidance was the one
138
+ remaining live consumer contradiction. Runtime authority
139
+ (capabilityContext/startup.ts:250), SKILL.md (lines 68, 103), and the
140
+ agent descriptors (.opencode/agents/agentera.md, .cursor/agents/agentera.md)
141
+ all already used `capability_context.instructions`. The
142
+ `documentation_drift` guard below prevents this guidance from drifting
143
+ back to `prose`; it does not execute a prime command.
144
+
145
+ # ---------------------------------------------------------------------------
146
+ # Field-authority reconciliation. The four lists that described the prime field
147
+ # surface used to disagree (Task 1 documented the drift). Task 2 reconciled them
148
+ # to one authority: PRIME_STRUCTURED_FIELDS in packages/cli/src/cli/stateQuery.ts
149
+ # (public_output_policy.canonical_field_set). Each list below now derives from
150
+ # that authority, so schema discovery, the emitted JSON source_contract.fields,
151
+ # the text-mode fields line, and the agent-ready-state contract advertise the
152
+ # same canonical 27-field set. The `issues` deprecated transition alias is
153
+ # emitted by default as a duplicate of `todo` (with a stderr deprecation warning)
154
+ # and kept until the 3.0.0 stable cut; it is excluded only from the canonical
155
+ # advertised `source_contract.fields` set (one canonical representation — `todo`
156
+ # is canonical). It is NOT selector-only: it ships in the default bare briefing
157
+ # for the opencode_compaction_context consumer that still reads it.
158
+ # ---------------------------------------------------------------------------
159
+ field_authorities:
160
+ - id: orientation_output_emission
161
+ location: packages/cli/src/cli/commands/prime/orientationOutput.ts
162
+ authority: packages/cli/src/cli/stateQuery.ts:PRIME_STRUCTURED_FIELDS
163
+ field_count: 27
164
+ role: actual_emission_authority
165
+ notes: >-
166
+ Emits PRIME_STRUCTURED_FIELDS as source_contract.fields; the keys actually
167
+ serialized by buildOrientationJsonPayload. `issues` is emitted as a
168
+ deprecated alias of `todo` with a stderr warning, not as a member of the
169
+ canonical set.
170
+ - id: schema_advertised
171
+ location: packages/cli/src/cli/commands/schema.ts
172
+ authority: packages/cli/src/cli/stateQuery.ts:PRIME_STRUCTURED_FIELDS
173
+ field_count: 27
174
+ role: schema_discovery
175
+ notes: >-
176
+ Reconciled by Task 2: availableStructuredFields for the prime selector
177
+ advertises PRIME_STRUCTURED_FIELDS plus the context-only capability_context
178
+ pointer (28 declared); fields_by_command.status advertises the 27-field
179
+ set. Previously drifted (missing project_integration and history).
180
+ - id: text_briefing_hardcoded
181
+ location: packages/cli/src/cli/commands/prime/orientationOutput.ts
182
+ authority: packages/cli/src/cli/stateQuery.ts:PRIME_STRUCTURED_FIELDS
183
+ field_count: 27
184
+ role: text_briefing
185
+ notes: >-
186
+ Reconciled by Task 2: the text-mode source_contract fields line is now
187
+ derived from PRIME_STRUCTURED_FIELDS.join so text and JSON advertise one
188
+ canonical representation. Previously hardcoded a 21-field subset.
189
+ - id: agent_ready_state_contract
190
+ location: references/cli/agent-ready-state-contract.yaml
191
+ authority: packages/cli/src/cli/stateQuery.ts:PRIME_STRUCTURED_FIELDS
192
+ field_count: 27
193
+ role: documented_consumer_contract
194
+ notes: >-
195
+ Reconciled by Task 2: both hej.fields lists now mirror the canonical
196
+ 27-field set (retired `bundle` dropped; app, app_home, project_integration,
197
+ runtime_lifecycle, and history added).
198
+
199
+ # ---------------------------------------------------------------------------
200
+ # Field classification. Every field proposed for omission is classified with a
201
+ # rationale and the task that consumes the decision.
202
+ # required: always present in bare prime; consumers depend on it.
203
+ # conditional: default-only; Task 2 may omit when in default state, preserving
204
+ # missing-vs-empty semantics and named-command recovery.
205
+ # diagnostic: lifecycle/history detail; omitted from default startup unless
206
+ # status declares it necessary (Task 4 decision).
207
+ # deprecated_transition: emitted alias; removable at the 3.0.0 stable cut only.
208
+ # retired: not emitted; a consumer depending on it must fail visibly.
209
+ # ---------------------------------------------------------------------------
210
+ field_classification:
211
+ - field: command
212
+ status: required
213
+ rationale: REQUIRED_SPARSE_CONTEXT_FIELDS; emitted on every structured payload.
214
+ - field: status
215
+ status: required
216
+ rationale: REQUIRED_SPARSE_CONTEXT_FIELDS; every consumer gates on status=ok.
217
+ - field: app_home
218
+ status: required
219
+ rationale: Install/v1/profile safety; status text briefing prints app_home.
220
+ - field: app
221
+ status: required
222
+ rationale: publicDoctorStatus projection; app/v1/profile safety per source_contract.access.
223
+ - field: mode
224
+ status: required
225
+ rationale: Fresh-vs-returning routing; opencode and status consumers read it.
226
+ - field: profile
227
+ status: required
228
+ rationale: opencode reads profile.status; status dashboard glyph.
229
+ - field: v1_migration
230
+ status: conditional
231
+ rationale: >-
232
+ Default-only when detected=false. No documented consumer reads it in the
233
+ default startup path. Task 2 omits it from the default bare briefing when
234
+ not detected (see default_emission_omission_contract); recovery via
235
+ `agentera upgrade --dry-run`.
236
+ - field: health
237
+ status: required
238
+ rationale: opencode reads grade/trajectory; status dashboard glyph.
239
+ - field: todo
240
+ status: required
241
+ rationale: Status dashboard glyph; canonical replacement for the issues alias.
242
+ - field: plan
243
+ status: required
244
+ rationale: opencode reads exists/status/title/first_pending; status dashboard glyph.
245
+ - field: docs
246
+ status: conditional
247
+ rationale: >-
248
+ Default-only when no docs state. Task 2 omits it from the default bare
249
+ briefing when docs.exists is false (see default_emission_omission_contract);
250
+ recovery via `agentera state docs`.
251
+ - field: progress
252
+ status: required
253
+ rationale: opencode reads progress.latest; status brief references shipped work.
254
+ - field: objective
255
+ status: conditional
256
+ rationale: >-
257
+ Default-only when none active. Task 2 omits it from the default bare
258
+ briefing when objective.active is false (see
259
+ default_emission_omission_contract); status derives "none active" from
260
+ state_presence.active.objective. Recovery via `agentera state objective`.
261
+ - field: state_presence
262
+ status: required
263
+ rationale: Owns missing-versus-empty semantics; must not be omitted.
264
+ - field: project_integration
265
+ status: required
266
+ rationale: >-
267
+ Status routing consumes the recommendation and aggregate lifecycle state;
268
+ the bounded brief retains the routing projection even when no upgrade
269
+ recommendation is active.
270
+ - field: attention
271
+ status: required
272
+ rationale: Bounded; opencode and status dashboard consume it.
273
+ - field: history
274
+ status: diagnostic
275
+ rationale: >-
276
+ Startup history. The bounded brief retains counts and named retrieval
277
+ pointers while omitting entry detail; explicit state list/get commands
278
+ recover the current history.
279
+ - field: runtime_lifecycle
280
+ status: conditional
281
+ rationale: >-
282
+ Diagnostic. Plan constraint: unrelated lifecycle diagnostics are omitted
283
+ unless status declares them necessary for the current brief (Task 4).
284
+ - field: decision_attention
285
+ status: conditional
286
+ rationale: Null unless returned decisions require satisfaction review.
287
+ - field: next_action
288
+ status: required
289
+ rationale: opencode and status routing; SKILL.md bare /agentera route follows it.
290
+ - field: orchestration_context
291
+ status: conditional
292
+ rationale: >-
293
+ Always null in bare prime; meaningful only in --context orchestrate. Task 2
294
+ may omit null bespoke contexts from the bare briefing without breaking
295
+ documented consumers.
296
+ - field: closeout_context
297
+ status: conditional
298
+ rationale: Always null in bare prime; meaningful only in --context document.
299
+ - field: evidence_context
300
+ status: conditional
301
+ rationale: Always null in bare prime; meaningful only in --context audit.
302
+ - field: benchmark_context
303
+ status: conditional
304
+ rationale: Always null in bare prime; meaningful only in --context optimize.
305
+ - field: execution_context
306
+ status: conditional
307
+ rationale: Always null in bare prime; meaningful only in --context build.
308
+ - field: source
309
+ status: required
310
+ rationale: Provenance; artifacts_present drives fresh-vs-returning dashboard.
311
+ - field: source_contract
312
+ status: required
313
+ rationale: Declares fields, capability_startup, capability_context, artifact_writes.
314
+ - field: capability_context
315
+ status: conditional
316
+ rationale: >-
317
+ Declared available on the `prime` selector but emitted only by the
318
+ `--context <capability>` surface (buildPrimeCapabilityContextPayload),
319
+ NOT by the default bare briefing. The bare briefing instead carries a
320
+ `source_contract.capability_context` pointer with a `fetch_command`. The
321
+ capability_context_dispatcher consumer depends on it. Required when
322
+ present; its nested `instructions` field is the capability's startup
323
+ instructions module (runtime authority: capabilityContext/startup.ts:250).
324
+ Task 2 may keep it off the bare default; Tasks 3-4 must not break the
325
+ `--context` capsule that emits it.
326
+ - field: issues
327
+ status: deprecated_transition
328
+ rationale: >-
329
+ Deprecated alias of `todo`. opencode_compaction_context reads it
330
+ (.opencode/plugins/agentera.js:480-486). Removable at the 3.0.0 stable cut
331
+ only; tracked in TODO.md [fix:3.0.0]. Tasks 2-4 must keep the alias and
332
+ the stderr deprecation warning.
333
+ - field: bundle
334
+ status: retired
335
+ rationale: >-
336
+ v2-era field renamed to `app`/`app_home` in v3. agent-ready-state-contract
337
+ still documents it (drift); it is not emitted. A consumer depending on it
338
+ must fail visibly (see fail fixtures).
339
+
340
+ # ---------------------------------------------------------------------------
341
+ # Approved public-output policy for Tasks 2-4. Unambiguous so each later task
342
+ # can make emission decisions without re-litigating compatibility.
343
+ # ---------------------------------------------------------------------------
344
+ public_output_policy:
345
+ canonical_field_set: >-
346
+ The emitted STATUS_STRUCTURED_FIELDS (27) is the single consumer-facing
347
+ authority for the bare prime briefing. Task 2 reconciles schema.ts, the text
348
+ briefing hardcoded list, and agent-ready-state-contract.yaml hej.fields to
349
+ this set, removing the four-way drift documented above.
350
+ deprecated_alias_rule: >-
351
+ `issues` remains a transition alias of `todo` with a stderr deprecation
352
+ warning until the 3.0.0 stable cut. No task in this plan may remove it.
353
+ default_only_omission_rule: >-
354
+ Fields classified conditional or diagnostic may be omitted by Task 2 when
355
+ they are in their default/empty state, provided missing-versus-empty
356
+ semantics stay distinguishable and a named authoritative command returns the
357
+ current detail (`agentera state <artifact>`, `agentera schema`,
358
+ `agentera upgrade --dry-run`). Null bespoke contexts
359
+ (orchestration/closeout/evidence/benchmark/execution) may be omitted from
360
+ the bare briefing; they remain declared on the `--context` surface.
361
+ bounded_brief_rule: >-
362
+ Task 3 produces a bounded default decision brief (<=12000 bytes pretty
363
+ UTF-8 JSON + trailing newline; diagnostics on stderr) that retains every
364
+ required field plus any active conditional field, and never collapses
365
+ missing versus present-but-empty.
366
+ self_contained_status_rule: >-
367
+ Task 4 folds the bounded state into one `agentera prime --context status
368
+ --format json` response (<=25000 bytes) so the status dashboard needs no
369
+ separate bare-prime call or raw artifact read. The `--context` capsule
370
+ contract (command/status/capability_context) is unchanged. The status
371
+ capsule puts the canonical Task 3 projection at
372
+ `capability_context.context.status_context`; unrelated per-runtime
373
+ lifecycle diagnostics are omitted while aggregate release-blocking state
374
+ remains available for routing.
375
+ status_context_contract:
376
+ startup_command: agentera prime --context status --format json
377
+ state_path: capability_context.context.status_context
378
+ instructions_path: capability_context.instructions
379
+ max_utf8_bytes: 25000
380
+ measurement: Buffer.byteLength(JSON.stringify(payload, null, 2) + "\n", "utf8")
381
+ required_state:
382
+ - health
383
+ - todo
384
+ - plan
385
+ - profile
386
+ - next_action
387
+ - attention
388
+ - state_presence
389
+ - source_contract
390
+ omitted_detail_recovery: capability_context.context.status_context.brief.omitted_rich_state
391
+ raw_artifact_reads_required: false
392
+ fail_visible_rule: >-
393
+ Undeclared or retired field dependencies must fail visibly: selecting an
394
+ undeclared field via `--fields` returns nonzero exit code 1 and a correction
395
+ listing the declared available fields. Tasks 2-4 must preserve this
396
+ contract after any field-set change.
397
+
398
+ # ---------------------------------------------------------------------------
399
+ # Default-emission conditional omission contract. Advertised selectable fields
400
+ # (declared_available_fields / PRIME_STRUCTURED_FIELDS) may be broader than the
401
+ # keys present in a given bare prime response: the declaration is the union of
402
+ # fields a consumer may select, not a promise that every one is emitted on every
403
+ # call. The following conditional top-level fields are OMITTED from the default
404
+ # bare briefing when they carry only default/inactive payload so startup does not
405
+ # carry adjective noise. Their omission is unambiguous because (a) the field
406
+ # stays declared in source_contract.fields as a selectable surface, (b)
407
+ # state_presence carries the missing-vs-empty signal for the artifact families
408
+ # it owns, and (c) a named authoritative command returns the live detail.
409
+ # Required consumers and missing-vs-empty semantics are preserved: explicit
410
+ # `--fields <name>` selection and the `--context` capsule keep the full payload,
411
+ # so a consumer recovering an omitted field is never confused by its absence.
412
+ # The emitted `issues` deprecated transition alias is NOT conditional: it ships
413
+ # by default (excluded only from the canonical advertised set) until the stable
414
+ # cut; see deprecated_alias_rule.
415
+ # ---------------------------------------------------------------------------
416
+ default_emission_omission_contract:
417
+ implemented_by: packages/cli/src/cli/commands/prime/orientationOutput.ts:omitInactiveConditionalDefaults
418
+ applies_to: default bare prime (requested fields empty)
419
+ does_not_apply_to: explicit `--fields <name>` selection; `--context <capability>` capsule
420
+ omitted_when_default:
421
+ - field: v1_migration
422
+ omitted_when: v1_migration.detected !== true
423
+ recovery_command: agentera upgrade --dry-run
424
+ disambiguated_by: >-
425
+ source_contract.fields declares v1_migration as a selectable field; the
426
+ named recovery command returns the live migration preview. state_presence
427
+ does not carry v1_migration (it is not an artifact family); the field is
428
+ the sole v1 signal.
429
+ - field: docs
430
+ omitted_when: docs.exists !== true
431
+ recovery_command: agentera state docs
432
+ disambiguated_by: >-
433
+ state_presence.available.docs and state_presence.absence.docs carry the
434
+ missing-vs-empty signal for the docs artifact family.
435
+ - field: objective
436
+ omitted_when: objective.active !== true
437
+ recovery_command: agentera state objective
438
+ disambiguated_by: >-
439
+ state_presence.active.objective is false; status derives "none active"
440
+ from state_presence rather than from an emitted default-only objective
441
+ blob.
442
+ never_omitted:
443
+ - state_presence
444
+ - next_action
445
+ - health
446
+ - todo
447
+ - plan
448
+ - progress
449
+ - profile
450
+ - source
451
+ - source_contract
452
+ - attention
453
+
454
+ # Task 3 bounded decision brief. The default bare emission projects the full
455
+ # orientation payload to a bounded decision brief (<=12000 bytes pretty UTF-8
456
+ # JSON + trailing newline; diagnostics on stderr). Every required top-level
457
+ # field stays PRESENT (compatibility_boundary test asserts the key set); only
458
+ # rich diagnostic/writer detail WITHIN those fields is projected to
459
+ # routing-essential leaves. Each projected sub-detail carries a named
460
+ # authoritative recovery command so an agent never needs raw artifact access.
461
+ # `--dashboard` (full fidelity, 35000-byte budget), `--fields <name>`, and the
462
+ # `--context` capsule are NOT projected and keep the full payload. The byte
463
+ # gate is deterministic pretty-JSON UTF-8 measurement; an over-budget brief is
464
+ # rejected in favor of a bounded degraded envelope (status ok, brief.brief
465
+ # block signals degraded) that keeps command/status/mode/state_presence/a
466
+ # bounded brief source_contract and the byte-budget error with a recovery command.
467
+ brief_omission_contract:
468
+ implemented_by: packages/cli/src/cli/commands/prime/briefOrientation.ts:briefOrientationPayload
469
+ applies_to: default bare prime (no --fields, no --dashboard, no --context)
470
+ does_not_apply_to: "agentera prime --dashboard --format json; --fields <name>; --context <capability>"
471
+ budget_utf8_bytes: 12000
472
+ measurement: >-
473
+ Buffer.byteLength(JSON.stringify(brief, null, 2) + "\n", "utf8"); stdout
474
+ only; diagnostics measured separately on stderr.
475
+ retained_top_level_fields: >-
476
+ Every field in never_omitted plus command, status, app_home, app, mode,
477
+ history, runtime_lifecycle, project_integration, decision_attention, and
478
+ the bespoke context pointers (kept null on the bare surface). The
479
+ conditional v1_migration/docs/objective are retained when active (see
480
+ omitted_when_default). issues ships as the deprecated transition alias.
481
+ projected_subdetail:
482
+ - field: plan.tasks
483
+ reason: plan_task_detail
484
+ recovery: agentera state plan tasks list --format json
485
+ - field: plan.archived_plans
486
+ reason: archive_catalog
487
+ recovery: agentera state plan list --format json
488
+ - field: plan.diagnostics
489
+ reason: plan_diagnostics
490
+ recovery: agentera state plan --format json
491
+ - field: history.{progress,decisions,health}.entries
492
+ reason: startup_history_entries
493
+ recovery: agentera state <artifact> list --limit 20 --format json
494
+ - field: runtime_lifecycle.runtimes
495
+ reason: lifecycle_runtime_detail
496
+ recovery: agentera upgrade --dry-run --format json
497
+ - field: project_integration.phases
498
+ reason: phase_blockers
499
+ recovery: agentera doctor --format json
500
+ - field: source_contract.artifact_writes.artifacts
501
+ reason: writer_contract_detail
502
+ recovery: agentera schema --format json
503
+ - field: source_contract.capability_startup.available_state
504
+ reason: startup_available_state_listing
505
+ recovery: agentera schema --format json
506
+ - field: profile.bounded_signals
507
+ reason: profile_signal_detail
508
+ recovery: agentera profile --format json
509
+ never_collapsed: >-
510
+ state_presence is projected to its finite contract-owned active, available,
511
+ any_active, absence_explained, and absence keys rather than copied verbatim;
512
+ known boolean values and absence reasons remain bounded, so missing versus
513
+ present-but-empty stays behaviorally distinguishable even for adversarial
514
+ caller objects. source_contract is likewise projected to bounded known
515
+ fields and named recovery pointers. plan.first_pending, progress.latest,
516
+ health.grade/trajectory, todo counts, next_action.object, and attention
517
+ are retained as the routing-essential leaves consumers read.
518
+ fallback_behavior: >-
519
+ The detailed degraded envelope is byte-gated again after utf8_bytes is
520
+ settled. If it cannot fit, a compact and then an irreducible finite routing
521
+ envelope are tried deterministically. If the configured budget cannot hold
522
+ the irreducible envelope, briefOrientationPayload fails explicitly rather
523
+ than emitting over-budget stdout.
524
+
525
+ # ---------------------------------------------------------------------------
526
+ # Fixtures used by packages/cli/test/cli/primeCompatibilityBoundary.test.ts.
527
+ # Pass fixtures are the documented consumers; their consumed_fields must be a
528
+ # subset of declared_available_fields. Fail fixtures depend on retired or
529
+ # undeclared fields and must fail visibly through the fail_visible_rule.
530
+ # ---------------------------------------------------------------------------
531
+ declared_available_fields:
532
+ - command
533
+ - status
534
+ - app_home
535
+ - app
536
+ - mode
537
+ - profile
538
+ - v1_migration
539
+ - health
540
+ - todo
541
+ - plan
542
+ - docs
543
+ - progress
544
+ - objective
545
+ - state_presence
546
+ - project_integration
547
+ - attention
548
+ - history
549
+ - runtime_lifecycle
550
+ - decision_attention
551
+ - next_action
552
+ - orchestration_context
553
+ - closeout_context
554
+ - evidence_context
555
+ - benchmark_context
556
+ - execution_context
557
+ - source
558
+ - source_contract
559
+ - capability_context
560
+ - issues
561
+ fixtures:
562
+ pass:
563
+ - consumer: opencode_compaction_context
564
+ executable_command: agentera prime --format json
565
+ depends_on:
566
+ - mode
567
+ - profile
568
+ - health
569
+ - issues
570
+ - plan
571
+ - progress
572
+ - next_action
573
+ - attention
574
+ nested_fields:
575
+ - profile.status
576
+ - next_action.object
577
+ conditional_nested_fields:
578
+ - path: health.grade
579
+ present_when: health.exists
580
+ - path: health.trajectory
581
+ present_when: health.exists
582
+ - path: plan.first_pending.name
583
+ present_when: plan.first_pending
584
+ - path: progress.latest.number
585
+ present_when: progress.latest
586
+ - path: progress.latest.what
587
+ present_when: progress.latest
588
+ - path: progress.latest.next
589
+ present_when: progress.latest
590
+ - consumer: status_dashboard_renderer
591
+ executable_command: agentera prime --context status --format json
592
+ depends_on:
593
+ - capability_context
594
+ nested_fields:
595
+ - capability_context.instructions
596
+ - capability_context.context.status_context.health
597
+ - capability_context.context.status_context.todo
598
+ - capability_context.context.status_context.plan
599
+ - capability_context.context.status_context.profile.status
600
+ - capability_context.context.status_context.next_action.object
601
+ - capability_context.context.status_context.attention
602
+ - capability_context.context.status_context.state_presence
603
+ - capability_context.context.status_context.source_contract
604
+ conditional_nested_fields:
605
+ # objective is a conditional top-level field (see
606
+ # default_emission_omission_contract): emitted when an objective is
607
+ # active, omitted (and rendered "none active") otherwise. The dashboard
608
+ # derives the active/none-active signal from state_presence, so it does
609
+ # not declare objective as an always-present dependency.
610
+ - path: capability_context.context.status_context.objective
611
+ present_when: capability_context.context.status_context.state_presence.active.objective
612
+ - consumer: capability_context_dispatcher
613
+ executable_command: agentera prime --context build --format json
614
+ depends_on:
615
+ - command
616
+ - status
617
+ - capability_context
618
+ nested_fields:
619
+ - capability_context.instructions
620
+ absent_fields:
621
+ - capability_context.prose
622
+ - consumer: packaging_distribution_gate
623
+ executable_command: agentera prime --format json
624
+ depends_on:
625
+ - command
626
+ - status
627
+ - app_home
628
+ nested_fields:
629
+ - app_home.source
630
+ asserts:
631
+ - path: command
632
+ equals: prime
633
+ - path: status
634
+ equals: ok
635
+ - consumer: bare_agentera_route
636
+ executable_command: agentera prime --format json
637
+ depends_on:
638
+ - next_action
639
+ - source_contract
640
+ nested_fields:
641
+ - source_contract.capability_context
642
+ - next_action.object
643
+ fail:
644
+ - consumer: v2_bundle_consumer
645
+ depends_on:
646
+ - bundle
647
+ executable_command: agentera prime --fields bundle --format json
648
+ rationale: >-
649
+ `bundle` was renamed to `app`/`app_home` in v3 and is not emitted.
650
+ Selecting it via `--fields bundle` must return exit code 1 with a
651
+ correction listing the declared available fields.
652
+
653
+ # ---------------------------------------------------------------------------
654
+ # Documentation drift guard. Active consumer guidance must not send consumers
655
+ # to the retired `prose` field; the runtime emits `instructions` only (see
656
+ # capability_context_dispatcher fixture for the executable proof). Each entry
657
+ # names a documentation file that governs the consumer field name; the test
658
+ # suite scans the live file so the documented field cannot drift back.
659
+ # ---------------------------------------------------------------------------
660
+ documentation_drift:
661
+ canonical_field: capability_context.instructions
662
+ retired_field: capability_context.prose
663
+ scanned_documents:
664
+ - id: vocabulary_capability_context_contract
665
+ path: references/cli/vocabulary.md
666
+ evidence: references/cli/vocabulary.md:90-113
667
+ governs: the `--context` capsule field capability consumers are told to read
668
+ must_contain: capability_context.instructions
669
+ must_not_contain: capability_context.prose
670
+
671
+ approval:
672
+ recorded_for_tasks: [2, 3, 4]
673
+ decision: >-
674
+ The compatibility boundary above is approved. Tasks 2-4 implement emission
675
+ changes within this policy without re-deriving consumer compatibility.
676
+ recorded_at: 2026-07-16