agentera 3.0.0-dev.20 → 3.0.0-dev.21

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 (228) hide show
  1. package/README.md +19 -0
  2. package/bundle/CHANGELOG.md +63 -70
  3. package/bundle/README.md +17 -0
  4. package/bundle/UPGRADE.md +38 -0
  5. package/bundle/references/adapters/package-surface-characterization.md +7 -0
  6. package/bundle/references/artifacts/artifact-registry-interface-model.yaml +3 -3
  7. package/bundle/references/artifacts/state-storage-authority.yaml +1446 -0
  8. package/bundle/references/cli/agent-ready-state-contract.yaml +11 -39
  9. package/bundle/references/cli/audience-namespace-cli-migration.yaml +30 -15
  10. package/bundle/references/meta/documentation-inventory.md +1 -0
  11. package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +18 -10
  12. package/bundle/skills/agentera/capabilities/audit/schemas/validation.yaml +10 -10
  13. package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +11 -6
  14. package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +3 -2
  15. package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +15 -8
  16. package/bundle/skills/agentera/capabilities/document/schemas/validation.yaml +13 -13
  17. package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +15 -9
  18. package/bundle/skills/agentera/references/contract.md +65 -23
  19. package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +15 -10
  20. package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +134 -3
  21. package/bundle/skills/agentera/schemas/artifacts/health.yaml +16 -10
  22. package/bundle/skills/agentera/schemas/artifacts/objective.yaml +18 -4
  23. package/bundle/skills/agentera/schemas/artifacts/plan.yaml +23 -1
  24. package/bundle/skills/agentera/schemas/artifacts/progress.yaml +16 -10
  25. package/bundle/skills/agentera/schemas/artifacts/todo.yaml +34 -0
  26. package/dist/capabilities/audit/instructions.js +1 -1
  27. package/dist/capabilities/audit/instructions.js.map +1 -1
  28. package/dist/capabilities/build/instructions.js +1 -1
  29. package/dist/capabilities/build/instructions.js.map +1 -1
  30. package/dist/capabilities/discuss/instructions.js +1 -1
  31. package/dist/capabilities/discuss/instructions.js.map +1 -1
  32. package/dist/capabilities/document/instructions.js +1 -1
  33. package/dist/capabilities/document/instructions.js.map +1 -1
  34. package/dist/capabilities/optimize/instructions.js +1 -1
  35. package/dist/capabilities/optimize/instructions.js.map +1 -1
  36. package/dist/capabilities/orchestrate/instructions.js +1 -1
  37. package/dist/capabilities/orchestrate/instructions.js.map +1 -1
  38. package/dist/capabilities/plan/instructions.js +1 -1
  39. package/dist/capabilities/plan/instructions.js.map +1 -1
  40. package/dist/capabilities/profile/instructions.js +1 -1
  41. package/dist/capabilities/profile/instructions.js.map +1 -1
  42. package/dist/capabilities/vision/instructions.js +1 -1
  43. package/dist/capabilities/vision/instructions.js.map +1 -1
  44. package/dist/cli/appContext.js +14 -6
  45. package/dist/cli/appContext.js.map +1 -1
  46. package/dist/cli/capabilityContext/bespoke.js +3 -1
  47. package/dist/cli/capabilityContext/bespoke.js.map +1 -1
  48. package/dist/cli/capabilityContext/build.js +5 -4
  49. package/dist/cli/capabilityContext/build.js.map +1 -1
  50. package/dist/cli/capabilityContext/closeout.js +2 -1
  51. package/dist/cli/capabilityContext/closeout.js.map +1 -1
  52. package/dist/cli/capabilityContext/contract.js +29 -0
  53. package/dist/cli/capabilityContext/contract.js.map +1 -1
  54. package/dist/cli/capabilityContext/evidence.js +21 -20
  55. package/dist/cli/capabilityContext/evidence.js.map +1 -1
  56. package/dist/cli/capabilityContext/orchestration.js +3 -2
  57. package/dist/cli/capabilityContext/orchestration.js.map +1 -1
  58. package/dist/cli/capabilityContext/progress.js +9 -4
  59. package/dist/cli/capabilityContext/progress.js.map +1 -1
  60. package/dist/cli/capabilityContext/slim.js +37 -6
  61. package/dist/cli/capabilityContext/slim.js.map +1 -1
  62. package/dist/cli/capabilityContext/startup.js +30 -6
  63. package/dist/cli/capabilityContext/startup.js.map +1 -1
  64. package/dist/cli/capabilityContext/types.js +14 -4
  65. package/dist/cli/capabilityContext/types.js.map +1 -1
  66. package/dist/cli/commands/backfill.js +194 -0
  67. package/dist/cli/commands/backfill.js.map +1 -0
  68. package/dist/cli/commands/compact.js +40 -11
  69. package/dist/cli/commands/compact.js.map +1 -1
  70. package/dist/cli/commands/durability.js +85 -0
  71. package/dist/cli/commands/durability.js.map +1 -0
  72. package/dist/cli/commands/migrate.js +677 -0
  73. package/dist/cli/commands/migrate.js.map +1 -0
  74. package/dist/cli/commands/prime/collectOrientationState.js +23 -0
  75. package/dist/cli/commands/prime/collectOrientationState.js.map +1 -1
  76. package/dist/cli/commands/prime/orientationOutput.js +4 -2
  77. package/dist/cli/commands/prime/orientationOutput.js.map +1 -1
  78. package/dist/cli/commands/query.js +20 -2
  79. package/dist/cli/commands/query.js.map +1 -1
  80. package/dist/cli/commands/schema.js +247 -69
  81. package/dist/cli/commands/schema.js.map +1 -1
  82. package/dist/cli/commands/state/decisions.js +28 -10
  83. package/dist/cli/commands/state/decisions.js.map +1 -1
  84. package/dist/cli/commands/state/experimentRecords.js +156 -0
  85. package/dist/cli/commands/state/experimentRecords.js.map +1 -0
  86. package/dist/cli/commands/state/get.js +141 -0
  87. package/dist/cli/commands/state/get.js.map +1 -0
  88. package/dist/cli/commands/state/index.js +2 -2
  89. package/dist/cli/commands/state/index.js.map +1 -1
  90. package/dist/cli/commands/state/list.js +159 -0
  91. package/dist/cli/commands/state/list.js.map +1 -0
  92. package/dist/cli/commands/state/plan.js +146 -41
  93. package/dist/cli/commands/state/plan.js.map +1 -1
  94. package/dist/cli/commands/state/planTasks.js +164 -0
  95. package/dist/cli/commands/state/planTasks.js.map +1 -0
  96. package/dist/cli/commands/state/plans.js +154 -0
  97. package/dist/cli/commands/state/plans.js.map +1 -0
  98. package/dist/cli/commands/state/write.js +8 -3
  99. package/dist/cli/commands/state/write.js.map +1 -1
  100. package/dist/cli/dispatch/check.js +71 -4
  101. package/dist/cli/dispatch/check.js.map +1 -1
  102. package/dist/cli/dispatch/index.js +48 -30
  103. package/dist/cli/dispatch/index.js.map +1 -1
  104. package/dist/cli/dispatch/lifecycle.js +4 -4
  105. package/dist/cli/dispatch/lifecycle.js.map +1 -1
  106. package/dist/cli/dispatch/state.js +23 -3
  107. package/dist/cli/dispatch/state.js.map +1 -1
  108. package/dist/cli/errors.js +13 -14
  109. package/dist/cli/errors.js.map +1 -1
  110. package/dist/cli/help.js +162 -3
  111. package/dist/cli/help.js.map +1 -1
  112. package/dist/cli/orientation.js +146 -34
  113. package/dist/cli/orientation.js.map +1 -1
  114. package/dist/cli/planArtifacts.js +31 -2
  115. package/dist/cli/planArtifacts.js.map +1 -1
  116. package/dist/cli/prime-blob.js +1 -0
  117. package/dist/cli/prime-blob.js.map +1 -1
  118. package/dist/cli/startupCompletenessContract.js +3 -2
  119. package/dist/cli/startupCompletenessContract.js.map +1 -1
  120. package/dist/cli/stateQuery.js +5 -3
  121. package/dist/cli/stateQuery.js.map +1 -1
  122. package/dist/core/text.js +11 -0
  123. package/dist/core/text.js.map +1 -0
  124. package/dist/hooks/compaction/apply.js +224 -46
  125. package/dist/hooks/compaction/apply.js.map +1 -1
  126. package/dist/hooks/compaction/dryRun.js +2 -0
  127. package/dist/hooks/compaction/dryRun.js.map +1 -1
  128. package/dist/hooks/compaction/index.js +4 -4
  129. package/dist/hooks/compaction/index.js.map +1 -1
  130. package/dist/hooks/compaction/parse.js +73 -5
  131. package/dist/hooks/compaction/parse.js.map +1 -1
  132. package/dist/hooks/compaction/retention.js +22 -21
  133. package/dist/hooks/compaction/retention.js.map +1 -1
  134. package/dist/hooks/compaction/status.js +116 -23
  135. package/dist/hooks/compaction/status.js.map +1 -1
  136. package/dist/hooks/sessionStart.js +39 -7
  137. package/dist/hooks/sessionStart.js.map +1 -1
  138. package/dist/hooks/validateArtifact/index.js +2 -2
  139. package/dist/hooks/validateArtifact/index.js.map +1 -1
  140. package/dist/hooks/validateArtifact/markdown.js +9 -9
  141. package/dist/hooks/validateArtifact/markdown.js.map +1 -1
  142. package/dist/hooks/validateArtifact/traversal.js +11 -9
  143. package/dist/hooks/validateArtifact/traversal.js.map +1 -1
  144. package/dist/registries/artifactRegistry.js +147 -44
  145. package/dist/registries/artifactRegistry.js.map +1 -1
  146. package/dist/release/releaseMetadata.js +95 -1
  147. package/dist/release/releaseMetadata.js.map +1 -1
  148. package/dist/state/archiveDiscovery.js +589 -0
  149. package/dist/state/archiveDiscovery.js.map +1 -0
  150. package/dist/state/archivePublication.js +225 -0
  151. package/dist/state/archivePublication.js.map +1 -0
  152. package/dist/state/archiveRecovery.js +238 -0
  153. package/dist/state/archiveRecovery.js.map +1 -0
  154. package/dist/state/archiveReplay.js +54 -0
  155. package/dist/state/archiveReplay.js.map +1 -0
  156. package/dist/state/decisionOverlay.js +255 -0
  157. package/dist/state/decisionOverlay.js.map +1 -0
  158. package/dist/state/directRetrieval.js +322 -0
  159. package/dist/state/directRetrieval.js.map +1 -0
  160. package/dist/state/durability.js +451 -0
  161. package/dist/state/durability.js.map +1 -0
  162. package/dist/state/experimentArchive.js +64 -0
  163. package/dist/state/experimentArchive.js.map +1 -0
  164. package/dist/state/experimentIdentity.js +191 -0
  165. package/dist/state/experimentIdentity.js.map +1 -0
  166. package/dist/state/experimentRetrieval.js +447 -0
  167. package/dist/state/experimentRetrieval.js.map +1 -0
  168. package/dist/state/gitBackfill.js +561 -0
  169. package/dist/state/gitBackfill.js.map +1 -0
  170. package/dist/state/gitBackfillAuthority.js +141 -0
  171. package/dist/state/gitBackfillAuthority.js.map +1 -0
  172. package/dist/state/gitBackfillHistory.js +278 -0
  173. package/dist/state/gitBackfillHistory.js.map +1 -0
  174. package/dist/state/gitBackfillOutput.js +209 -0
  175. package/dist/state/gitBackfillOutput.js.map +1 -0
  176. package/dist/state/healthRepair.js +70 -0
  177. package/dist/state/healthRepair.js.map +1 -0
  178. package/dist/state/legacyIdentity.js +48 -0
  179. package/dist/state/legacyIdentity.js.map +1 -0
  180. package/dist/state/legacyMigration.js +516 -0
  181. package/dist/state/legacyMigration.js.map +1 -0
  182. package/dist/state/legacyMigrationParser.js +489 -0
  183. package/dist/state/legacyMigrationParser.js.map +1 -0
  184. package/dist/state/listAccounting.js +55 -0
  185. package/dist/state/listAccounting.js.map +1 -0
  186. package/dist/state/listClassification.js +18 -0
  187. package/dist/state/listClassification.js.map +1 -0
  188. package/dist/state/listRetrieval.js +782 -0
  189. package/dist/state/listRetrieval.js.map +1 -0
  190. package/dist/state/migrationAuthority.js +413 -0
  191. package/dist/state/migrationAuthority.js.map +1 -0
  192. package/dist/state/migrationEnrichment.js +35 -0
  193. package/dist/state/migrationEnrichment.js.map +1 -0
  194. package/dist/state/planIdentity.js +45 -0
  195. package/dist/state/planIdentity.js.map +1 -0
  196. package/dist/state/planRetrieval.js +314 -0
  197. package/dist/state/planRetrieval.js.map +1 -0
  198. package/dist/state/planTaskRetrieval.js +285 -0
  199. package/dist/state/planTaskRetrieval.js.map +1 -0
  200. package/dist/state/projectionPolicy.js +184 -0
  201. package/dist/state/projectionPolicy.js.map +1 -0
  202. package/dist/state/retrievalAuthority.js +326 -0
  203. package/dist/state/retrievalAuthority.js.map +1 -0
  204. package/dist/state/startupProjection.js +498 -0
  205. package/dist/state/startupProjection.js.map +1 -0
  206. package/dist/state/write/experimentPublication.js +193 -0
  207. package/dist/state/write/experimentPublication.js.map +1 -0
  208. package/dist/state/write/explain.js +28 -14
  209. package/dist/state/write/explain.js.map +1 -1
  210. package/dist/state/write/helpers.js +8 -0
  211. package/dist/state/write/helpers.js.map +1 -0
  212. package/dist/state/write/index.js +1 -0
  213. package/dist/state/write/index.js.map +1 -1
  214. package/dist/state/write/lock.js +24 -1
  215. package/dist/state/write/lock.js.map +1 -1
  216. package/dist/state/write/mutation.js +190 -0
  217. package/dist/state/write/mutation.js.map +1 -0
  218. package/dist/state/write/operations.js +36 -2
  219. package/dist/state/write/operations.js.map +1 -1
  220. package/dist/state/write/planPublication.js +172 -0
  221. package/dist/state/write/planPublication.js.map +1 -0
  222. package/dist/state/write/transaction.js +238 -225
  223. package/dist/state/write/transaction.js.map +1 -1
  224. package/dist/upgrade/migrateArtifactsV2ToV3.js +2 -2
  225. package/dist/upgrade/migrateArtifactsV2ToV3.js.map +1 -1
  226. package/dist/validate/crossCapability.js +9 -6
  227. package/dist/validate/crossCapability.js.map +1 -1
  228. package/package.json +2 -2
@@ -252,21 +252,34 @@ The test: if a reader can reconstruct the information from the project's current
252
252
 
253
253
  ### Compaction thresholds
254
254
 
255
- Growing artifacts are compacted to cap read cost for consuming skills. Compaction runs when the producing skill writes a new entry. All growing artifacts follow a uniform 10/40/50 rule: 10 full-detail entries, 40 one-line archive entries, drop beyond 50 total.
255
+ Numbered state artifacts use `uniform_10_40_50` as projection capacity to cap
256
+ read cost for consuming skills: 10 active full-detail entries and 40 archive
257
+ projection entries. These are bounded active/archive projections, not retention
258
+ or deletion limits. Verified numbered archives remain authoritative; projection
259
+ compaction performs no destructive deletion. Recovery refuses to omit entries
260
+ when archive evidence is missing and retains full entries with metadata.
261
+ Compaction runs when the producing skill writes a new entry. Other artifacts
262
+ retain their owning artifact-specific compaction rules below.
256
263
 
257
264
  **CHANGELOG.md is exempt**: it is the public version-level history and is not compacted.
258
265
 
259
266
  **PROGRESS.md**, compacted by realisera when writing a new cycle entry:
260
267
 
261
- | Tier | Entries | Format |
262
- | ---------------- | --------------------- | ---------------------------------------- |
263
- | Full detail | 10 most recent cycles | Standard cycle entry format |
264
- | One-line archive | Cycles 11 through 50 | `Cycle N (YYYY-MM-DD): ≤15-word summary` |
265
- | Dropped | Cycles older than 50 | Removed entirely |
268
+ | Tier | Entries | Format |
269
+ | ------------------- | --------------------- | ---------------------------------------- |
270
+ | Active full detail | 10 most recent cycles | Standard cycle entry format |
271
+ | Archive projection | Cycles 11 through 50 | `Cycle N (YYYY-MM-DD): ≤15-word summary` |
272
+ | Outside projection | Older cycles | Omission metadata; numbered archive |
266
273
 
267
- When writing a new cycle: if >10 full-detail entries exist, collapse the oldest to one-line format under an `## Archived Cycles` heading (below the recent cycles). If >40 one-line entries exist, drop the oldest. One-line summaries preserve cycle number, date, and work-type, enough for trend analysis by consuming skills.
274
+ When writing a new cycle: if >10 full-detail entries exist and their numbered
275
+ archives verify, collapse the oldest to one-line format under an `## Archived
276
+ Cycles` heading (below the recent cycles). If >40 one-line entries exist, omit
277
+ the oldest from this bounded projection with metadata; if archive evidence is
278
+ missing, retain the full entry and refuse the projection change. One-line
279
+ summaries preserve cycle number, date, and work-type, enough for trend analysis
280
+ by consuming skills.
268
281
 
269
- Active cycle entries are stored newest-first: descending by cycle number. Insert the newest full-detail cycle before older active cycles so `agentera progress --limit 1` reads the current cycle without scanning the full file.
282
+ Active cycle entries are stored newest-first: descending by cycle number. Insert the newest full-detail cycle before older active cycles so `agentera state progress list --limit 1 --format json` reads the current cycle through the bounded state interface.
270
283
 
271
284
  **EXPERIMENTS.md**, compacted by optimera when writing a new experiment:
272
285
 
@@ -276,17 +289,24 @@ Active cycle entries are stored newest-first: descending by cycle number. Insert
276
289
  | One-line archive | Experiments 11 through 50 | `EXP-N: ≤15-word result summary` |
277
290
  | Dropped | Experiments older than 50 | Removed entirely |
278
291
 
279
- Same logic: collapse oldest full-detail to one-line when >10 exist. Drop oldest one-line when >40 one-line entries exist. Archive section sits below recent experiments under an `## Archived Experiments` heading.
292
+ Same logic: collapse oldest full-detail to one-line when >10 exist. Drop oldest
293
+ one-line when >40 one-line entries exist. Archive section sits below recent
294
+ experiments under an `## Archived Experiments` heading.
280
295
 
281
296
  **DECISIONS.md**, compacted by resonera when writing a new decision:
282
297
 
283
- | Tier | Entries | Format |
284
- | ---------------- | ------------------------ | ------------------------------------------------------ |
285
- | Full detail | 10 most recent decisions | Standard decision entry format |
286
- | One-line archive | Decisions 11 through 50 | `Decision N (YYYY-MM-DD): [Choice] — ≤15-word summary` |
287
- | Dropped | Decisions older than 50 | Removed entirely |
298
+ | Tier | Entries | Format |
299
+ | ------------------- | ------------------------ | ------------------------------------------------------ |
300
+ | Active full detail | 10 most recent decisions | Standard decision entry format |
301
+ | Archive projection | Decisions 11 through 50 | `Decision N (YYYY-MM-DD): [Choice] — ≤15-word summary` |
302
+ | Outside projection | Older decisions | Omission metadata; numbered archive |
288
303
 
289
- Same logic: collapse oldest full-detail to one-line when >10 exist. Drop oldest one-line when >40 one-line entries exist. Archive section sits below recent decisions under an `## Archived Decisions` heading. One-line summaries preserve decision number, date, and the chosen alternative.
304
+ Same logic: collapse oldest full-detail to one-line when >10 exist and their
305
+ numbered archives verify. If >40 one-line entries exist, omit the oldest from
306
+ this bounded projection with metadata; if archive evidence is missing, retain
307
+ the full entry and refuse the projection change. Archive section sits below
308
+ recent decisions under an `## Archived Decisions` heading. One-line summaries
309
+ preserve decision number, date, and the chosen alternative.
290
310
 
291
311
  When writing a new decision, choose `N` as one greater than the highest decision number in active and archived entries. Insert the new full entry in the active section immediately before `## Archived Decisions`; if no archive exists, append it at the end of the file. Active decision entries must have unique numbers and remain ascending by decision number. Do not reuse or renumber decisions except when repairing artifact corruption.
292
312
 
@@ -294,23 +314,45 @@ When writing a new decision, choose `N` as one greater than the highest decision
294
314
 
295
315
  **HEALTH.md**, compacted by inspektera when writing a new audit:
296
316
 
297
- | Tier | Entries | Format |
298
- | ---------------- | --------------------- | -------------------------------------------------- |
299
- | Full detail | 10 most recent audits | Standard audit entry format |
300
- | One-line archive | Audits 11 through 50 | `Audit N (YYYY-MM-DD): [grade] — ≤15-word summary` |
301
- | Dropped | Audits older than 50 | Removed entirely |
317
+ | Tier | Entries | Format |
318
+ | ------------------- | --------------------- | -------------------------------------------------- |
319
+ | Active full detail | 10 most recent audits | Standard audit entry format |
320
+ | Archive projection | Audits 11 through 50 | `Audit N (YYYY-MM-DD): [grade] — ≤15-word summary` |
321
+ | Outside projection | Older audits | Omission metadata; numbered archive |
302
322
 
303
- Same logic: collapse oldest full-detail to one-line when >10 exist. Drop oldest one-line when >40 one-line entries exist. Archive section sits below recent audits under an `## Archived Audits` heading. One-line summaries preserve audit number, date, overall grade, and trajectory.
323
+ Same logic: collapse oldest full-detail to one-line when >10 exist and their
324
+ numbered archives verify. If >40 one-line entries exist, omit the oldest from
325
+ this bounded projection with metadata; if archive evidence is missing, retain
326
+ the full entry and refuse the projection change. Archive section sits below
327
+ recent audits under an `## Archived Audits` heading. One-line summaries preserve
328
+ audit number, date, overall grade, and trajectory.
304
329
 
305
330
  **TODO.md Resolved section**, compacted by realisera when marking an item resolved:
306
331
 
307
332
  | Tier | Entries | Format |
308
333
  | ---------------- | ----------------------------- | ------------------------------------------------ |
309
334
  | Full detail | 10 most recent resolved items | Standard resolved entry format |
310
- | One-line archive | Items 11 through 50 | `- [x] [type:train] ≤15-word resolution summary` |
335
+ | One-line summary | Items 11 through 50 | `- [x] [type:train] ≤15-word resolution summary` |
311
336
  | Dropped | Items older than 50 | Removed entirely |
312
337
 
313
- Same logic: collapse oldest full-detail to one-line when >10 exist. Drop oldest one-line when >40 one-line entries exist. Compaction applies only within the `## ✓ Resolved` section; active severity sections are not affected.
338
+ The first ten resolved rows are the recent/full-detail tier even when they have
339
+ no indented body; rows 11 through 50 are the summary tier. Collapse the oldest
340
+ full-detail entries to one line when more than 10 exist. Drop the oldest
341
+ summaries when more than 40 exist. Compaction applies only within the
342
+ `## ✓ Resolved` section; active severity sections are not affected.
343
+
344
+ TODO.md is a **bounded human-facing queue, not a lossless numbered archive**.
345
+ Unlike progress, decisions, and health—which preserve verified numbered archives
346
+ and perform no destructive deletion—TODO compaction is intentionally destructive.
347
+ Dropped resolved entries are removed from the working tree and are recoverable
348
+ only for previously committed content through project history
349
+ (`git log -p -- :/TODO.md`; the `:/` pathspec is project-root-safe). Non-Git
350
+ projects have no historical recovery for dropped entries. Compaction diagnostics
351
+ MUST report removed entries as `dropped` and MUST NOT describe TODO compaction as
352
+ a lossless projection. Exactly one `## ✓ Resolved` section is permitted;
353
+ parsing, validation, and compaction refuse with an actionable diagnostic when
354
+ duplicates are present because parsing processes only the first section and
355
+ otherwise hides trailing entries from the budget.
314
356
 
315
357
  ## 5. Artifact Path Resolution
316
358
 
@@ -69,10 +69,10 @@ BUDGET:
69
69
  COMPACTION:
70
70
  1:
71
71
  id: DX1
72
- rule: uniform_10_40_50
72
+ rule: lossless_projection
73
73
  description: >-
74
- Growing artifacts follow a uniform 10/40/50 rule: 10 full-detail
75
- entries, 40 one-line archive entries, drop beyond 50 total.
74
+ The 10/40/50 values are current projection defaults, not deletion limits.
75
+ Numbered archive records remain complete and unlimited.
76
76
  2:
77
77
  id: DX2
78
78
  full_detail:
@@ -93,21 +93,26 @@ COMPACTION:
93
93
  the archive section. Compact summaries preserve decision number, date,
94
94
  and chosen alternative; structured compact fields preserve outcome and
95
95
  explicit feeds_into references when present so CLI downstream references
96
- remain non-inferential.
96
+ remain non-inferential. Entries beyond the summary default are represented
97
+ by omission metadata while their numbered archive records remain available.
97
98
  4:
98
99
  id: DX4
99
- dropped:
100
- threshold: 50
101
- action: "Removed entirely"
100
+ omission:
101
+ fields: [omitted, omitted_count, omission_reason, retrieval]
102
+ reason: projection_capacity_or_byte_budget
102
103
  description: >-
103
- Decisions older than 50 are dropped entirely.
104
+ Omitted projection detail is never silently deleted or truncated. The
105
+ numbered archive is the complete historical source and retrieval points
106
+ use the direct state get contract.
104
107
  5:
105
108
  id: DX5
106
109
  trigger: "When discuss writes a new decision"
107
110
  description: >-
108
111
  Compaction runs when the producing skill writes a new entry.
109
- If >10 full-detail entries exist, collapse the oldest to one-line.
110
- If >40 one-line entries exist, drop the oldest.
112
+ If >10 full-detail entries exist and their numbered archives verify,
113
+ collapse the oldest to one-line. If >40 summary entries exist, omit the
114
+ oldest from this bounded projection with metadata; never delete its
115
+ numbered archive record. Unresolved review entries do not block storage.
111
116
  6:
112
117
  id: DX6
113
118
  archive_section:
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Experiment log maintained by optimize. Each experiment records hypothesis,
4
4
  # method, metric results, kept/discarded status, and conclusions. Lives
5
- # alongside OBJECTIVE.md in .agentera/optimera/<name>/.
5
+ # alongside OBJECTIVE.md in .agentera/optimize/<name>/.
6
6
  #
7
7
  # Structural pattern: UPPER_CASE groups with numbered entries and stable IDs,
8
8
  # following capability_schema_contract.yaml and protocol.yaml conventions.
@@ -41,9 +41,9 @@ meta:
41
41
  version: "1.0.0"
42
42
  description: >-
43
43
  Experiment log for optimize objectives. Produced and consumed by optimize.
44
- Lives in .agentera/optimera/<name>/ alongside the objective.
44
+ Lives in .agentera/optimize/<name>/ alongside the objective.
45
45
  artifact_type: agent_facing
46
- path: ".agentera/optimera/<name>/experiments.yaml"
46
+ path: ".agentera/optimize/<name>/experiments.yaml"
47
47
  producer: optimize
48
48
  consumers: [status, optimize]
49
49
  format: yaml
@@ -54,6 +54,8 @@ GROUP_PREFIXES:
54
54
  EXPERIMENT: EX
55
55
  CLOSURE: EC
56
56
  ARCHIVE: EA
57
+ PUBLICATION: EP
58
+ RETRIEVAL: ER
57
59
  VALIDATION: EV
58
60
 
59
61
  BUDGET:
@@ -133,6 +135,7 @@ EXPERIMENT:
133
135
  validation:
134
136
  - "Must be a non-negative integer"
135
137
  - "Must be unique across active and archived entries"
138
+ - "Identity is <objective-id>/experiment:<number>"
136
139
  2:
137
140
  id: EX2
138
141
  field: date
@@ -267,6 +270,94 @@ EXPERIMENT:
267
270
  Harness refinement log for baseline experiments. Each entry
268
271
  records a run number, issue encountered, and fix applied.
269
272
 
273
+ PUBLICATION:
274
+ 1:
275
+ id: EP1
276
+ operation: publish
277
+ command: >-
278
+ agentera state experiments publish --objective OBJECTIVE_ID --number N
279
+ --input EXPERIMENT.yaml --format json
280
+ description: >-
281
+ The typed state writer is the mutation authority. It validates the
282
+ objective, identity, caller entry, existing projection, and final bytes
283
+ before assigning number and atomically publishing one experiment.
284
+ 2:
285
+ id: EP2
286
+ identity: '<objective-id>/experiment:<non-negative-integer>'
287
+ cli_owned_fields: [number]
288
+ retry: byte_equivalent_identity_is_idempotent
289
+ collision: same_identity_with_different_content_fails
290
+ description: >-
291
+ Retry never duplicates an experiment. Invalid identity, collisions, and
292
+ pre-publication failures preserve active and archive projection bytes.
293
+ 3:
294
+ id: EP3
295
+ projection: uniform_10_40_50
296
+ durable_archive: objective_scoped_immutable_full_detail
297
+ description: >-
298
+ Publication validates and durably publishes the full experiment under
299
+ the objective directory before replacing the compacted projection. The
300
+ projection still retains 10 full entries and 40 one-line summaries.
301
+ 4:
302
+ id: EP4
303
+ archive_path: '.agentera/<objective-root>/<objective>/archive/experiments/<experiment-number>.yaml'
304
+ canonical_objective_root: optimize
305
+ readable_legacy_objective_roots: [optimera]
306
+ envelope_schema: agentera.experimentArchive.v1
307
+ required_fields:
308
+ - schemaVersion
309
+ - stable_id
310
+ - objective_id
311
+ - experiment_number
312
+ - record
313
+ - record_sha256
314
+ - provenance
315
+ provenance_fields: [authority, objective_id, experiment_id, storage_scope, publication_order]
316
+ retry: byte_equivalent_envelope_is_idempotent
317
+ collision: same_identity_with_different_bytes_fails
318
+ description: >-
319
+ Archive identity binds stable objective and experiment identity to the
320
+ immutable full record. Legacy projection entries remain readable without
321
+ fabricating archive history that predates this publication contract.
322
+ 5:
323
+ id: EP5
324
+ directory_durability: fsync_each_new_child_parent_before_advancing
325
+ exact_full_replay: reconstruct_missing_archive_before_success
326
+ summary_only_replay: never_reconstruct_without_full_detail
327
+ description: >-
328
+ First publication durably records every new archive directory entry.
329
+ Replay may recover only the exact full record still present in the
330
+ projection; compacted summaries and dropped rows are not fabricated.
331
+
332
+ RETRIEVAL:
333
+ 1:
334
+ id: ER1
335
+ list: >-
336
+ agentera state experiments list --objective OBJECTIVE_ID [--limit N]
337
+ [--cursor TOKEN] --format json
338
+ get: >-
339
+ agentera state experiments get --objective OBJECTIVE_ID --number N
340
+ --format json
341
+ description: >-
342
+ List returns newest-first objective-scoped identities from the bounded
343
+ projection and immutable archive. Get returns one exact identity.
344
+ 2:
345
+ id: ER2
346
+ cursor: opaque_snapshot_cursor
347
+ cursor_binding: [collection, objective, order, snapshot]
348
+ detail_availability: [full, summary, unavailable]
349
+ description: >-
350
+ Cursor tokens are copied, never parsed or constructed. List and get retain
351
+ compatibility and provenance when legacy detail is summary-only or absent.
352
+ 3:
353
+ id: ER3
354
+ maximum_limit: 100
355
+ max_serialized_utf8_bytes: 32768
356
+ omission_fields: [omitted, omitted_count, omission_reason, retrieval]
357
+ description: >-
358
+ Structured pages omit whole entries rather than truncating scalar values;
359
+ every addressable omission has continuation or exact-get recovery.
360
+
270
361
  CLOSURE:
271
362
  1:
272
363
  id: EC1
@@ -371,3 +462,43 @@ VALIDATION:
371
462
  and serve as the reference measurement.
372
463
  checks:
373
464
  - "Experiment 0 has status 'baseline'"
465
+ 6:
466
+ id: EV6
467
+ rule: identity_compatibility
468
+ severity: error
469
+ description: >-
470
+ Experiment identity is objective-scoped. Reads retain legacy entries with
471
+ missing or duplicate numbers as unaddressable data with explicit caveats;
472
+ a new publication must reject ambiguous objective or experiment identity
473
+ before changing objective, experiment, or archive bytes.
474
+ checks:
475
+ - "Objective identity is stable across title and directory rename"
476
+ - "Experiment 0 and later non-negative numbers are addressable"
477
+ - "Duplicate or missing experiment numbers remain visible but unaddressable"
478
+ - "Publication rejects ambiguity before effects"
479
+ 7:
480
+ id: EV7
481
+ rule: validated_publication
482
+ severity: error
483
+ description: >-
484
+ New experiments are published only through the typed writer after pure
485
+ identity and schema preflight, with atomic replacement and idempotent retry.
486
+ checks:
487
+ - "Caller input omits the CLI-owned number field"
488
+ - "Objective and experiment identity validate before staging"
489
+ - "Final experiments.yaml bytes validate before atomic replacement"
490
+ - "A byte-equivalent retry returns the existing experiment without duplication"
491
+ 8:
492
+ id: EV8
493
+ rule: durable_archive_before_projection
494
+ severity: error
495
+ description: >-
496
+ Newly published full detail must be validated, immutably archived, and
497
+ directory-synced before the compacted projection is replaced.
498
+ checks:
499
+ - "Archive envelope identity and provenance validate before publication"
500
+ - "Every newly created archive directory entry is parent-synced in order"
501
+ - "Archive publication succeeds before projection replacement"
502
+ - "Exact full replay reconstructs a missing archive before success"
503
+ - "Conflicting immutable archive bytes preserve archive and projection"
504
+ - "Retry after archive or projection interruption does not duplicate detail"
@@ -87,10 +87,10 @@ BUDGET:
87
87
  COMPACTION:
88
88
  1:
89
89
  id: HX1
90
- rule: uniform_10_40_50
90
+ rule: lossless_projection
91
91
  description: >-
92
- Growing artifacts follow a uniform 10/40/50 rule: 10 full-detail
93
- entries, 40 one-line archive entries, drop beyond 50 total.
92
+ The 10/40/50 values are current projection defaults, not deletion limits.
93
+ Numbered archive records remain complete and unlimited.
94
94
  2:
95
95
  id: HX2
96
96
  full_detail:
@@ -109,21 +109,27 @@ COMPACTION:
109
109
  description: >-
110
110
  Audits 11 through 50 are collapsed to one-line format under the
111
111
  archive section. One-line summaries preserve audit number, date,
112
- overall grade, and trajectory.
112
+ overall grade, and trajectory. Entries beyond the summary default are
113
+ represented by omission metadata while their numbered archive records
114
+ remain available.
113
115
  4:
114
116
  id: HX4
115
- dropped:
116
- threshold: 50
117
- action: "Removed entirely"
117
+ omission:
118
+ fields: [omitted, omitted_count, omission_reason, retrieval]
119
+ reason: projection_capacity_or_byte_budget
118
120
  description: >-
119
- Audits older than 50 are dropped entirely.
121
+ Omitted projection detail is never silently deleted or truncated. The
122
+ numbered archive is the complete historical source and retrieval points
123
+ use the direct state get contract.
120
124
  5:
121
125
  id: HX5
122
126
  trigger: "When audit writes a new audit"
123
127
  description: >-
124
128
  Compaction runs when the producing skill writes a new entry.
125
- If >10 full-detail entries exist, collapse the oldest to one-line.
126
- If >40 one-line entries exist, drop the oldest.
129
+ If >10 full-detail entries exist and their numbered archives verify,
130
+ collapse the oldest to one-line. If >40 summary entries exist, omit the
131
+ oldest from this bounded projection with metadata; never delete its
132
+ numbered archive record. Unverified entries remain full for recovery.
127
133
  6:
128
134
  id: HX6
129
135
  archive_section:
@@ -1,7 +1,7 @@
1
1
  # Objective Artifact Schema
2
2
  #
3
3
  # Optimization objective maintained by optimize. Each objective lives in its
4
- # own subdirectory under .agentera/optimera/<name>/ and captures the metric,
4
+ # own subdirectory under .agentera/optimize/<name>/ and captures the metric,
5
5
  # target, baseline, constraints, measurement method, gates, and scope.
6
6
  #
7
7
  # Structural pattern: UPPER_CASE groups with numbered entries and stable IDs,
@@ -48,9 +48,9 @@ meta:
48
48
  version: "1.0.0"
49
49
  description: >-
50
50
  Optimization objective. Produced by optimize and discuss. Each objective
51
- lives in its own subdirectory under .agentera/optimera/<name>/.
51
+ lives in its own subdirectory under .agentera/optimize/<name>/.
52
52
  artifact_type: agent_facing
53
- path: ".agentera/optimera/<name>/objective.yaml"
53
+ path: ".agentera/optimize/<name>/objective.yaml"
54
54
  producer: [optimize, discuss]
55
55
  consumers: [status, optimize, discuss]
56
56
  format: yaml
@@ -78,6 +78,19 @@ BUDGET:
78
78
  bounded by the measurement description's inherent complexity.
79
79
 
80
80
  HEADER:
81
+ 0:
82
+ id: OB_HDR0
83
+ field: id
84
+ type: string
85
+ required: true
86
+ description: >-
87
+ Stable objective identity in objective:<lowercase RFC 9562 UUID> form.
88
+ It is assigned when a new objective is published and remains unchanged
89
+ when the title or containing directory is renamed. Legacy objectives
90
+ without this field remain read-compatible through a derived identity and
91
+ an explicit compatibility caveat; reads never rewrite legacy bytes.
92
+ validation:
93
+ - "Matches objective:<lowercase-rfc9562-uuid>"
81
94
  1:
82
95
  id: OB_HDR1
83
96
  field: title
@@ -360,10 +373,11 @@ VALIDATION_RULES:
360
373
  rule: required_fields
361
374
  severity: error
362
375
  description: >-
363
- The objective must have: title, status, description, why,
376
+ A newly published objective must have: stable id, title, status, description, why,
364
377
  measurement, metric (description, direction, unit), baseline,
365
378
  and scope (included, excluded).
366
379
  checks:
380
+ - "id is present and matches objective:<lowercase-rfc9562-uuid>"
367
381
  - "title is present and non-empty"
368
382
  - "status is present and is 'open' or 'closed'"
369
383
  - "description is present and non-empty"
@@ -142,6 +142,17 @@ HEADER:
142
142
  Format: 'Plan: <descriptive name>'.
143
143
  validation:
144
144
  - "Non-empty string"
145
+ 8:
146
+ id: PH8
147
+ field: id
148
+ type: string
149
+ required: false
150
+ description: >-
151
+ Stable plan identity assigned by the typed writer at first publication and
152
+ retained unchanged when the plan moves from active to archived history.
153
+ Legacy plans without this field derive a read-only identity.
154
+ validation:
155
+ - "Must match plan:<lowercase RFC 9562 UUID> when present"
145
156
 
146
157
  PLAN:
147
158
  1:
@@ -413,6 +424,13 @@ VALIDATION:
413
424
  LIFECYCLE_CONTRACT:
414
425
  authority: this schema
415
426
  canonical:
427
+ identity:
428
+ field: header.id
429
+ format: 'plan:<lowercase-rfc9562-uuid>'
430
+ assignment: The typed create writer assigns identity at first publication.
431
+ transition: Active and archived positions retain the identical identity.
432
+ legacy: Missing identity is derived deterministically at read time without rewriting bytes.
433
+ collision: Different documents with one identity are ambiguous and never selected by path or time.
416
434
  persisted_status:
417
435
  field: header.status
418
436
  values:
@@ -536,7 +554,8 @@ LIFECYCLE_CONTRACT:
536
554
  - packages/cli/src/cli/plan*.ts
537
555
  - packages/cli/src/cli/orientation.ts
538
556
  - packages/cli/src/cli/appContext.ts
539
- - packages/cli/src/cli/commands/state/plan.ts
557
+ - packages/cli/src/cli/commands/state/plan*.ts
558
+ - packages/cli/src/state/plan*.ts
540
559
  - packages/cli/src/cli/commands/prime/*.ts
541
560
  - packages/cli/src/cli/capabilityContext/*.ts
542
561
  - packages/cli/src/cli/contracts/orientationState.ts
@@ -558,6 +577,8 @@ LIFECYCLE_CONTRACT:
558
577
  adapters:
559
578
  - references/**/*.yaml
560
579
  - packages/cli/src/registries/*.ts
580
+ - packages/cli/src/state/retrievalAuthority.ts
581
+ - packages/cli/src/state/projectionPolicy.ts
561
582
  - packages/cli/src/state/startupAnalysis/*.ts
562
583
  - packages/cli/src/cli/commands/schema.ts
563
584
  - packages/cli/src/cli/commands/validate.ts
@@ -582,6 +603,7 @@ LIFECYCLE_CONTRACT:
582
603
  - .agentera/**
583
604
  documented_external_commitments:
584
605
  - packages/cli/src/capabilities/*/instructions.ts
606
+ - packages/cli/README.md
585
607
  - skills/agentera/SKILL.md
586
608
  - skills/agentera/agents/*
587
609
  - skills/agentera/references/*
@@ -72,10 +72,10 @@ BUDGET:
72
72
  COMPACTION:
73
73
  1:
74
74
  id: PX1
75
- rule: uniform_10_40_50
75
+ rule: lossless_projection
76
76
  description: >-
77
- Growing artifacts follow a uniform 10/40/50 rule: 10 full-detail
78
- entries, 40 one-line archive entries, drop beyond 50 total.
77
+ The 10/40/50 values are current projection defaults, not deletion limits.
78
+ Numbered archive records remain complete and unlimited.
79
79
  2:
80
80
  id: PX2
81
81
  full_detail:
@@ -94,21 +94,27 @@ COMPACTION:
94
94
  description: >-
95
95
  Cycles 11 through 50 are collapsed to one-line format under the
96
96
  archive section. One-line summaries preserve cycle number, date,
97
- and work-type, enough for trend analysis by consuming skills.
97
+ and work-type, enough for trend analysis by consuming skills. Entries
98
+ beyond the summary default are represented by omission metadata while
99
+ their numbered archive records remain available.
98
100
  4:
99
101
  id: PX4
100
- dropped:
101
- threshold: 50
102
- action: "Removed entirely"
102
+ omission:
103
+ fields: [omitted, omitted_count, omission_reason, retrieval]
104
+ reason: projection_capacity_or_byte_budget
103
105
  description: >-
104
- Cycles older than 50 are dropped entirely.
106
+ Omitted projection detail is never silently deleted or truncated. The
107
+ numbered archive is the complete historical source and retrieval points
108
+ use the direct state get contract.
105
109
  5:
106
110
  id: PX5
107
111
  trigger: "When build writes a new cycle entry"
108
112
  description: >-
109
113
  Compaction runs when the producing skill writes a new entry.
110
- If >10 full-detail entries exist, collapse the oldest to one-line.
111
- If >40 one-line entries exist, drop the oldest.
114
+ If >10 full-detail entries exist and their numbered archives verify,
115
+ collapse the oldest to one-line. If >40 summary entries exist, omit the
116
+ oldest from this bounded projection with metadata; never delete its
117
+ numbered archive record. Unverified entries remain full for recovery.
112
118
  6:
113
119
  id: PX6
114
120
  archive_section:
@@ -127,3 +127,37 @@ CONVENTION:
127
127
  feat/v3 @ <hash>` or dual-branch hash reconciliation; git history
128
128
  is the archaeology source. Fold the Resolved move into the
129
129
  implementation commit — no follow-up hash-backfill commit.
130
+ 8:
131
+ id: TC8
132
+ field: single_resolved_section
133
+ level: required
134
+ description: >-
135
+ Exactly one `## ✓ Resolved` section is permitted. Two or more
136
+ `## ✓ Resolved` sections hide the trailing entries from parsing
137
+ (which processes only the first) and from the compaction budget
138
+ gate. Validation (`validateTodoResolvedPlacement`) and compaction
139
+ (status + apply) refuse with an actionable diagnostic when more
140
+ than one is present; merge the duplicates into a single section
141
+ before compacting. See TC6 for placement and TC9 for recovery.
142
+ 9:
143
+ id: TC9
144
+ field: bounded_queue_not_lossless_archive
145
+ level: required
146
+ description: >-
147
+ TODO.md is a bounded human-facing queue, not a lossless numbered
148
+ archive. It is excluded from the lossless numbered-archive model
149
+ that governs progress, decisions, and health (those preserve
150
+ verified numbered archives; TODO does not). Older resolved
151
+ entries and their detail bodies may be summarized to one-line or
152
+ removed entirely to stay within the 10/40/50 retention cap;
153
+ removal is destructive in the working tree. The first ten
154
+ resolved rows are the recent/full-detail tier even when they have
155
+ no indented body; rows 11 through 50 are the summary tier; rows
156
+ beyond 50 are dropped. Git history is the designated archaeology
157
+ source for dropped resolved entries, and only for previously
158
+ committed content: inspect prior versions with
159
+ `git log -p -- :/TODO.md` (the `:/` pathspec is project-root-safe
160
+ regardless of the current working directory). Non-Git projects
161
+ have no historical recovery for dropped entries. Compaction
162
+ diagnostics MUST report removed entries as `dropped` and MUST NOT
163
+ describe TODO compaction as a lossless projection.