aether-colony 5.3.2 → 5.3.3

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 (165) hide show
  1. package/.aether/aether-utils.sh +181 -5
  2. package/.aether/commands/build.yaml +35 -0
  3. package/.aether/commands/entomb.yaml +1 -1
  4. package/.aether/commands/init.yaml +29 -12
  5. package/.aether/commands/oracle.yaml +70 -0
  6. package/.aether/commands/patrol.yaml +2 -2
  7. package/.aether/commands/run.yaml +3 -3
  8. package/.aether/commands/swarm.yaml +1 -1
  9. package/.aether/docs/command-playbooks/build-complete.md +41 -8
  10. package/.aether/docs/command-playbooks/build-full.md +7 -7
  11. package/.aether/docs/command-playbooks/build-prep.md +1 -1
  12. package/.aether/docs/command-playbooks/continue-advance.md +33 -0
  13. package/.aether/docs/command-playbooks/continue-finalize.md +15 -1
  14. package/.aether/docs/command-playbooks/continue-full.md +15 -1
  15. package/.aether/docs/source-of-truth-map.md +10 -10
  16. package/.aether/docs/structural-learning-stack.md +283 -0
  17. package/.aether/utils/consolidation-seal.sh +196 -0
  18. package/.aether/utils/consolidation.sh +127 -0
  19. package/.aether/utils/curation-ants/archivist.sh +97 -0
  20. package/.aether/utils/curation-ants/critic.sh +214 -0
  21. package/.aether/utils/curation-ants/herald.sh +102 -0
  22. package/.aether/utils/curation-ants/janitor.sh +121 -0
  23. package/.aether/utils/curation-ants/librarian.sh +99 -0
  24. package/.aether/utils/curation-ants/nurse.sh +153 -0
  25. package/.aether/utils/curation-ants/orchestrator.sh +181 -0
  26. package/.aether/utils/curation-ants/scribe.sh +164 -0
  27. package/.aether/utils/curation-ants/sentinel.sh +119 -0
  28. package/.aether/utils/event-bus.sh +301 -0
  29. package/.aether/utils/graph.sh +559 -0
  30. package/.aether/utils/instinct-store.sh +401 -0
  31. package/.aether/utils/learning.sh +79 -7
  32. package/.aether/utils/session.sh +13 -0
  33. package/.aether/utils/state-api.sh +1 -1
  34. package/.aether/utils/trust-scoring.sh +347 -0
  35. package/.aether/utils/worktree.sh +97 -0
  36. package/.claude/commands/ant/entomb.md +1 -1
  37. package/.claude/commands/ant/init.md +29 -12
  38. package/.claude/commands/ant/oracle.md +35 -0
  39. package/.claude/commands/ant/patrol.md +2 -2
  40. package/.claude/commands/ant/run.md +3 -3
  41. package/.claude/commands/ant/swarm.md +1 -1
  42. package/.opencode/commands/ant/build.md +35 -0
  43. package/.opencode/commands/ant/init.md +29 -12
  44. package/.opencode/commands/ant/oracle.md +35 -0
  45. package/.opencode/commands/ant/patrol.md +2 -2
  46. package/.opencode/commands/ant/run.md +3 -3
  47. package/CHANGELOG.md +83 -0
  48. package/README.md +22 -9
  49. package/bin/lib/update-transaction.js +8 -3
  50. package/bin/npx-entry.js +0 -0
  51. package/package.json +1 -1
  52. package/.aether/agents/aether-ambassador.md +0 -140
  53. package/.aether/agents/aether-archaeologist.md +0 -108
  54. package/.aether/agents/aether-architect.md +0 -133
  55. package/.aether/agents/aether-auditor.md +0 -144
  56. package/.aether/agents/aether-builder.md +0 -184
  57. package/.aether/agents/aether-chaos.md +0 -115
  58. package/.aether/agents/aether-chronicler.md +0 -122
  59. package/.aether/agents/aether-gatekeeper.md +0 -116
  60. package/.aether/agents/aether-includer.md +0 -117
  61. package/.aether/agents/aether-keeper.md +0 -177
  62. package/.aether/agents/aether-measurer.md +0 -128
  63. package/.aether/agents/aether-oracle.md +0 -137
  64. package/.aether/agents/aether-probe.md +0 -133
  65. package/.aether/agents/aether-queen.md +0 -286
  66. package/.aether/agents/aether-route-setter.md +0 -130
  67. package/.aether/agents/aether-sage.md +0 -106
  68. package/.aether/agents/aether-scout.md +0 -101
  69. package/.aether/agents/aether-surveyor-disciplines.md +0 -391
  70. package/.aether/agents/aether-surveyor-nest.md +0 -329
  71. package/.aether/agents/aether-surveyor-pathogens.md +0 -264
  72. package/.aether/agents/aether-surveyor-provisions.md +0 -334
  73. package/.aether/agents/aether-tracker.md +0 -137
  74. package/.aether/agents/aether-watcher.md +0 -174
  75. package/.aether/agents/aether-weaver.md +0 -130
  76. package/.aether/commands/claude/archaeology.md +0 -334
  77. package/.aether/commands/claude/build.md +0 -65
  78. package/.aether/commands/claude/chaos.md +0 -336
  79. package/.aether/commands/claude/colonize.md +0 -259
  80. package/.aether/commands/claude/continue.md +0 -60
  81. package/.aether/commands/claude/council.md +0 -507
  82. package/.aether/commands/claude/data-clean.md +0 -81
  83. package/.aether/commands/claude/dream.md +0 -268
  84. package/.aether/commands/claude/entomb.md +0 -498
  85. package/.aether/commands/claude/export-signals.md +0 -57
  86. package/.aether/commands/claude/feedback.md +0 -96
  87. package/.aether/commands/claude/flag.md +0 -151
  88. package/.aether/commands/claude/flags.md +0 -169
  89. package/.aether/commands/claude/focus.md +0 -76
  90. package/.aether/commands/claude/help.md +0 -154
  91. package/.aether/commands/claude/history.md +0 -140
  92. package/.aether/commands/claude/import-signals.md +0 -71
  93. package/.aether/commands/claude/init.md +0 -505
  94. package/.aether/commands/claude/insert-phase.md +0 -105
  95. package/.aether/commands/claude/interpret.md +0 -278
  96. package/.aether/commands/claude/lay-eggs.md +0 -210
  97. package/.aether/commands/claude/maturity.md +0 -113
  98. package/.aether/commands/claude/memory-details.md +0 -77
  99. package/.aether/commands/claude/migrate-state.md +0 -171
  100. package/.aether/commands/claude/oracle.md +0 -642
  101. package/.aether/commands/claude/organize.md +0 -232
  102. package/.aether/commands/claude/patrol.md +0 -620
  103. package/.aether/commands/claude/pause-colony.md +0 -233
  104. package/.aether/commands/claude/phase.md +0 -115
  105. package/.aether/commands/claude/pheromones.md +0 -156
  106. package/.aether/commands/claude/plan.md +0 -693
  107. package/.aether/commands/claude/preferences.md +0 -65
  108. package/.aether/commands/claude/quick.md +0 -100
  109. package/.aether/commands/claude/redirect.md +0 -76
  110. package/.aether/commands/claude/resume-colony.md +0 -197
  111. package/.aether/commands/claude/resume.md +0 -388
  112. package/.aether/commands/claude/run.md +0 -231
  113. package/.aether/commands/claude/seal.md +0 -774
  114. package/.aether/commands/claude/skill-create.md +0 -286
  115. package/.aether/commands/claude/status.md +0 -410
  116. package/.aether/commands/claude/swarm.md +0 -349
  117. package/.aether/commands/claude/tunnels.md +0 -426
  118. package/.aether/commands/claude/update.md +0 -132
  119. package/.aether/commands/claude/verify-castes.md +0 -143
  120. package/.aether/commands/claude/watch.md +0 -239
  121. package/.aether/commands/opencode/archaeology.md +0 -331
  122. package/.aether/commands/opencode/build.md +0 -1168
  123. package/.aether/commands/opencode/chaos.md +0 -329
  124. package/.aether/commands/opencode/colonize.md +0 -195
  125. package/.aether/commands/opencode/continue.md +0 -1436
  126. package/.aether/commands/opencode/council.md +0 -437
  127. package/.aether/commands/opencode/data-clean.md +0 -77
  128. package/.aether/commands/opencode/dream.md +0 -260
  129. package/.aether/commands/opencode/entomb.md +0 -377
  130. package/.aether/commands/opencode/export-signals.md +0 -54
  131. package/.aether/commands/opencode/feedback.md +0 -99
  132. package/.aether/commands/opencode/flag.md +0 -149
  133. package/.aether/commands/opencode/flags.md +0 -167
  134. package/.aether/commands/opencode/focus.md +0 -73
  135. package/.aether/commands/opencode/help.md +0 -157
  136. package/.aether/commands/opencode/history.md +0 -136
  137. package/.aether/commands/opencode/import-signals.md +0 -68
  138. package/.aether/commands/opencode/init.md +0 -518
  139. package/.aether/commands/opencode/insert-phase.md +0 -111
  140. package/.aether/commands/opencode/interpret.md +0 -272
  141. package/.aether/commands/opencode/lay-eggs.md +0 -213
  142. package/.aether/commands/opencode/maturity.md +0 -108
  143. package/.aether/commands/opencode/memory-details.md +0 -83
  144. package/.aether/commands/opencode/migrate-state.md +0 -165
  145. package/.aether/commands/opencode/oracle.md +0 -593
  146. package/.aether/commands/opencode/organize.md +0 -226
  147. package/.aether/commands/opencode/patrol.md +0 -626
  148. package/.aether/commands/opencode/pause-colony.md +0 -203
  149. package/.aether/commands/opencode/phase.md +0 -113
  150. package/.aether/commands/opencode/pheromones.md +0 -162
  151. package/.aether/commands/opencode/plan.md +0 -684
  152. package/.aether/commands/opencode/preferences.md +0 -71
  153. package/.aether/commands/opencode/quick.md +0 -91
  154. package/.aether/commands/opencode/redirect.md +0 -84
  155. package/.aether/commands/opencode/resume-colony.md +0 -190
  156. package/.aether/commands/opencode/resume.md +0 -394
  157. package/.aether/commands/opencode/run.md +0 -237
  158. package/.aether/commands/opencode/seal.md +0 -452
  159. package/.aether/commands/opencode/skill-create.md +0 -63
  160. package/.aether/commands/opencode/status.md +0 -307
  161. package/.aether/commands/opencode/swarm.md +0 -15
  162. package/.aether/commands/opencode/tunnels.md +0 -400
  163. package/.aether/commands/opencode/update.md +0 -127
  164. package/.aether/commands/opencode/verify-castes.md +0 -139
  165. package/.aether/commands/opencode/watch.md +0 -227
@@ -48,6 +48,21 @@ CURRENT_LOCK=${CURRENT_LOCK:-""}
48
48
  [[ -f "$SCRIPT_DIR/utils/council.sh" ]] && source "$SCRIPT_DIR/utils/council.sh"
49
49
  [[ -f "$SCRIPT_DIR/utils/clash-detect.sh" ]] && source "$SCRIPT_DIR/utils/clash-detect.sh"
50
50
  [[ -f "$SCRIPT_DIR/utils/worktree.sh" ]] && source "$SCRIPT_DIR/utils/worktree.sh"
51
+ [[ -f "$SCRIPT_DIR/utils/event-bus.sh" ]] && source "$SCRIPT_DIR/utils/event-bus.sh"
52
+ [[ -f "$SCRIPT_DIR/utils/trust-scoring.sh" ]] && source "$SCRIPT_DIR/utils/trust-scoring.sh"
53
+ [[ -f "$SCRIPT_DIR/utils/instinct-store.sh" ]] && source "$SCRIPT_DIR/utils/instinct-store.sh"
54
+ [[ -f "$SCRIPT_DIR/utils/graph.sh" ]] && source "$SCRIPT_DIR/utils/graph.sh"
55
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/sentinel.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/sentinel.sh"
56
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/janitor.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/janitor.sh"
57
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/archivist.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/archivist.sh"
58
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/scribe.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/scribe.sh"
59
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/nurse.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/nurse.sh"
60
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/herald.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/herald.sh"
61
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/librarian.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/librarian.sh"
62
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/critic.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/critic.sh"
63
+ [[ -f "$SCRIPT_DIR/utils/curation-ants/orchestrator.sh" ]] && source "$SCRIPT_DIR/utils/curation-ants/orchestrator.sh"
64
+ [[ -f "$SCRIPT_DIR/utils/consolidation-seal.sh" ]] && source "$SCRIPT_DIR/utils/consolidation-seal.sh"
65
+ [[ -f "$SCRIPT_DIR/utils/consolidation.sh" ]] && source "$SCRIPT_DIR/utils/consolidation.sh"
51
66
 
52
67
  # Fallback error constants if error-handler.sh wasn't sourced
53
68
  # This prevents "unbound variable" errors in older installations
@@ -1260,13 +1275,16 @@ case "$cmd" in
1260
1275
  {"name": "pheromone-export", "description": "Export pheromone data to JSON"},
1261
1276
  {"name": "pheromone-export-xml", "description": "Export pheromone data to XML"},
1262
1277
  {"name": "pheromone-import-xml", "description": "Import pheromone data from XML"},
1263
- {"name": "pheromone-validate-xml", "description": "Validate pheromone XML against schema"}
1278
+ {"name": "pheromone-validate-xml", "description": "Validate pheromone XML against schema"},
1279
+ {"name": "pheromone-snapshot-inject", "description": "Copy active pheromone signals into a new worktree branch"},
1280
+ {"name": "pheromone-export-branch", "description": "Export branch-specific pheromone signals for merge"},
1281
+ {"name": "pheromone-merge-back", "description": "Merge eligible branch pheromone signals back to main"}
1264
1282
  ],
1265
1283
  "Utilities": [
1266
1284
  {"name": "generate-ant-name", "description": "Generate a unique ant name with caste prefix"},
1267
1285
  {"name": "activity-log", "description": "Append an entry to the activity log"},
1268
1286
  {"name": "activity-log-init", "description": "Initialize the activity log file"},
1269
- {"name": "activity-log-read", "description": "Read recent activity log entries"},
1287
+ {"name": "activity-log-read", "description": "Read recent activity log entries; --no-errors excludes ERROR/WARN lines"},
1270
1288
  {"name": "generate-commit-message", "description": "Generate a commit message (types: milestone, pause, fix, contextual, seal)"},
1271
1289
  {"name": "version-check", "description": "Check if Aether version meets requirement"},
1272
1290
  {"name": "registry-add", "description": "Register a repo with Aether (supports --tags, --goal, --active)"},
@@ -1295,7 +1313,9 @@ case "$cmd" in
1295
1313
  {"name": "suggest-quick-dismiss", "description": "Dismiss all suggestions without approving"}
1296
1314
  ],
1297
1315
  "Maintenance": [
1298
- {"name": "data-clean", "description": "Scan and remove test/synthetic artifacts from colony data files"}
1316
+ {"name": "data-clean", "description": "Scan and remove test/synthetic artifacts from colony data files"},
1317
+ {"name": "backup-prune-global", "description": "Prune .aether/data/backups/ to 50-file global cap (newest kept)"},
1318
+ {"name": "temp-clean", "description": "Remove files from .aether/temp/ older than 7 days"}
1299
1319
  ],
1300
1320
  "Autopilot": [
1301
1321
  {"name": "autopilot-init", "description": "Initialize autopilot run state (run-state.json)"},
@@ -1793,6 +1813,12 @@ HELP_EOF
1793
1813
  json_ok "{\"archived\":$archived_flag}"
1794
1814
  ;;
1795
1815
  activity-log-read)
1816
+ # Parse optional --no-errors flag before positional caste_filter
1817
+ _alr_no_errors=false
1818
+ if [[ "${1:-}" == "--no-errors" ]]; then
1819
+ _alr_no_errors=true
1820
+ shift
1821
+ fi
1796
1822
  caste_filter="${1:-}"
1797
1823
 
1798
1824
  # Graceful degradation: check if activity logging is enabled
@@ -1808,6 +1834,12 @@ HELP_EOF
1808
1834
  else
1809
1835
  content=$(cat "$log_file")
1810
1836
  fi
1837
+
1838
+ # Filter out ERROR/WARN lines if --no-errors flag was set
1839
+ if [[ "$_alr_no_errors" == "true" ]]; then
1840
+ content=$(echo "$content" | grep -vE 'ERROR|WARN' || true)
1841
+ fi
1842
+
1811
1843
  json_ok "$(echo "$content" | jq -Rs '.')"
1812
1844
  ;;
1813
1845
  learning-promote) _learning_promote "$@" ;;
@@ -3567,12 +3599,14 @@ Files: ${files_changed} files changed"
3567
3599
 
3568
3600
  memory-capture)
3569
3601
  # Capture learning/failure events with deterministic memory actions.
3570
- # Usage: memory-capture <event_type> <content> [wisdom_type] [source]
3602
+ # Usage: memory-capture <event_type> <content> [wisdom_type] [source] [source_type] [evidence_type]
3571
3603
  # event_type: learning|failure|redirect|feedback|success|resolution
3572
3604
  mc_event="${1:-}"
3573
3605
  mc_content="${2:-}"
3574
3606
  mc_wisdom_type="${3:-}"
3575
3607
  mc_source="${4:-system:memory-capture}"
3608
+ mc_source_type="${5:-observation}"
3609
+ mc_evidence_type="${6:-anecdotal}"
3576
3610
 
3577
3611
  [[ -z "$mc_event" ]] && json_err "$E_VALIDATION_FAILED" "Usage: memory-capture <event_type> <content> [wisdom_type] [source]" '{"missing":"event_type"}'
3578
3612
  [[ -z "$mc_content" ]] && json_err "$E_VALIDATION_FAILED" "Usage: memory-capture <event_type> <content> [wisdom_type] [source]" '{"missing":"content"}'
@@ -3595,7 +3629,7 @@ Files: ${files_changed} files changed"
3595
3629
  [[ -z "$colony_name" ]] && colony_name="unknown"
3596
3630
 
3597
3631
  # SUPPRESS:OK -- read-default: returns fallback on failure
3598
- observe_result=$(bash "$0" learning-observe "$mc_content" "$mc_wisdom_type" "$colony_name" 2>/dev/null || echo '{}')
3632
+ observe_result=$(bash "$0" learning-observe "$mc_content" "$mc_wisdom_type" "$colony_name" "$mc_source_type" "$mc_evidence_type" 2>/dev/null || echo '{}')
3599
3633
  if ! echo "$observe_result" | jq -e '.ok == true' >/dev/null 2>&1; then # SUPPRESS:OK -- validation: testing JSON field
3600
3634
  # SUPPRESS:OK -- read-default: query may return empty
3601
3635
  obs_msg=$(echo "$observe_result" | jq -r '.error.message // "learning_observe_failed"' 2>/dev/null || echo "learning_observe_failed")
@@ -3907,6 +3941,9 @@ Files: ${files_changed} files changed"
3907
3941
  pheromone-count) _pheromone_count "$@" ;;
3908
3942
  pheromone-display) _pheromone_display "$@" ;;
3909
3943
  pheromone-read) _pheromone_read "$@" ;;
3944
+ pheromone-snapshot-inject) _pheromone_snapshot_inject "$@" ;;
3945
+ pheromone-export-branch) _pheromone_export_branch "$@" ;;
3946
+ pheromone-merge-back) _pheromone_merge_back "$@" ;;
3910
3947
 
3911
3948
  instinct-read) _instinct_read "$@" ;;
3912
3949
  instinct-create) _instinct_create "$@" ;;
@@ -5174,6 +5211,50 @@ DRYRUN_EOF
5174
5211
  '{ok:true, removed:{pheromones:$phero, queen:$queen, observations:$obs, midden:$midden, spawn_tree:$spawn, constraints:$constraints}, total:$total}')"
5175
5212
  ;;
5176
5213
 
5214
+ # --- Housekeeping Subcommands ---
5215
+
5216
+ backup-prune-global)
5217
+ # Prune .aether/data/backups/ to a global cap of 50 files (newest kept).
5218
+ # Per-filename rotation (MAX_BACKUPS=3) already runs in atomic-write.sh.
5219
+ # This is the global sweep for unique-filename growth.
5220
+ _bpg_cap=50
5221
+ _bpg_dir="${BACKUP_DIR:-$DATA_DIR/backups}"
5222
+
5223
+ if [[ ! -d "$_bpg_dir" ]]; then
5224
+ json_ok '{"pruned":0,"kept":0,"dir_exists":false}'; exit 0
5225
+ fi
5226
+
5227
+ _bpg_total=$(find "$_bpg_dir" -maxdepth 1 -type f 2>/dev/null | wc -l | tr -d ' ')
5228
+
5229
+ if [[ "$_bpg_total" -le "$_bpg_cap" ]]; then
5230
+ json_ok "$(jq -n --argjson pruned 0 --argjson kept "$_bpg_total" '{pruned:$pruned,kept:$kept}')"; exit 0
5231
+ fi
5232
+
5233
+ _bpg_pruned=0
5234
+ while IFS= read -r _bpg_file; do
5235
+ rm -f "$_bpg_file" 2>/dev/null && _bpg_pruned=$((_bpg_pruned + 1))
5236
+ done < <(find "$_bpg_dir" -maxdepth 1 -type f -print0 2>/dev/null | xargs -0 ls -t 2>/dev/null | tail -n +$((_bpg_cap + 1)))
5237
+
5238
+ _bpg_kept=$((_bpg_total - _bpg_pruned))
5239
+ json_ok "$(jq -n --argjson pruned "$_bpg_pruned" --argjson kept "$_bpg_kept" '{pruned:$pruned,kept:$kept}')"
5240
+ ;;
5241
+
5242
+ temp-clean)
5243
+ # Remove files from .aether/temp/ older than 7 days.
5244
+ _tc_dir="$AETHER_ROOT/.aether/temp"
5245
+ _tc_cleaned=0
5246
+
5247
+ if [[ ! -d "$_tc_dir" ]]; then
5248
+ json_ok '{"cleaned":0,"dir_exists":false}'; exit 0
5249
+ fi
5250
+
5251
+ while IFS= read -r _tc_file; do
5252
+ rm -f "$_tc_file" 2>/dev/null && _tc_cleaned=$((_tc_cleaned + 1))
5253
+ done < <(find "$_tc_dir" -maxdepth 1 -type f -mtime +7 2>/dev/null)
5254
+
5255
+ json_ok "$(jq -n --argjson cleaned "$_tc_cleaned" '{cleaned:$cleaned}')"
5256
+ ;;
5257
+
5177
5258
  # --- Autopilot State Tracking ---
5178
5259
  # Tracks /ant:run autopilot sessions in run-state.json (separate from COLONY_STATE.json)
5179
5260
  # Optional — colonies without /ant:run are unaffected
@@ -5462,6 +5543,101 @@ DRYRUN_EOF
5462
5543
  worktree-cleanup)
5463
5544
  _worktree_cleanup "$@"
5464
5545
  ;;
5546
+ worktree-merge)
5547
+ _worktree_merge "$@"
5548
+ ;;
5549
+
5550
+ # ── Event Bus ───────────────────────────────────────────────────────────────
5551
+ event-publish)
5552
+ _event_publish "$@"
5553
+ ;;
5554
+ event-subscribe)
5555
+ _event_subscribe "$@"
5556
+ ;;
5557
+ event-cleanup)
5558
+ _event_cleanup "$@"
5559
+ ;;
5560
+ event-replay)
5561
+ _event_replay "$@"
5562
+ ;;
5563
+
5564
+ # ── Trust Scoring ──────────────────────────────────────────────────────────
5565
+ trust-calculate)
5566
+ _trust_calculate "$@"
5567
+ ;;
5568
+ trust-decay)
5569
+ _trust_decay "$@"
5570
+ ;;
5571
+ trust-tier)
5572
+ _trust_tier "$@"
5573
+ ;;
5574
+
5575
+ # ── Instinct Store ─────────────────────────────────────────────────────────
5576
+ instinct-store)
5577
+ _instinct_store "$@"
5578
+ ;;
5579
+ instinct-read-trusted)
5580
+ _instinct_read_trusted "$@"
5581
+ ;;
5582
+ instinct-decay-all)
5583
+ _instinct_decay_all "$@"
5584
+ ;;
5585
+ instinct-archive)
5586
+ _instinct_archive "$@"
5587
+ ;;
5588
+
5589
+ # ── Graph Traversal ────────────────────────────────────────────────────────
5590
+ graph-link)
5591
+ _graph_link "$@"
5592
+ ;;
5593
+ graph-neighbors)
5594
+ _graph_neighbors "$@"
5595
+ ;;
5596
+ graph-reach)
5597
+ _graph_reach "$@"
5598
+ ;;
5599
+ graph-cluster)
5600
+ _graph_cluster "$@"
5601
+ ;;
5602
+
5603
+ # ── Curation Ants ──────────────────────────────────────────────────────────
5604
+ curation-sentinel)
5605
+ _curation_sentinel "$@"
5606
+ ;;
5607
+ curation-janitor)
5608
+ _curation_janitor "$@"
5609
+ ;;
5610
+ curation-archivist)
5611
+ _curation_archivist "$@"
5612
+ ;;
5613
+ curation-scribe)
5614
+ _curation_scribe "$@"
5615
+ ;;
5616
+ curation-nurse)
5617
+ _curation_nurse "$@"
5618
+ ;;
5619
+ curation-herald)
5620
+ _curation_herald "$@"
5621
+ ;;
5622
+ curation-librarian)
5623
+ _curation_librarian "$@"
5624
+ ;;
5625
+ curation-critic)
5626
+ _curation_critic "$@"
5627
+ ;;
5628
+ curation-run)
5629
+ _curation_run "$@"
5630
+ ;;
5631
+
5632
+ # ── Consolidation Seal ─────────────────────────────────────────────────────
5633
+ consolidation-seal)
5634
+ _consolidation_seal "$@"
5635
+ ;;
5636
+
5637
+ # ── Consolidation Phase End ───────────────────────────────────────────────
5638
+ consolidation-phase-end)
5639
+ _consolidation_phase_end "$@"
5640
+ ;;
5465
5641
 
5466
5642
  *)
5467
5643
  json_err "$E_VALIDATION_FAILED" "Unknown command: $cmd"
@@ -931,6 +931,41 @@ body_opencode: |
931
931
 
932
932
  This ensures verification failures are persisted as blockers that survive context resets. Chaos Ant findings are flagged in Step 5.7.
933
933
 
934
+ ### Stage Audit Gate (Pre-Synthesis Check)
935
+
936
+ **This gate runs before Step 5.9. All build stages must have completed before synthesizing results.**
937
+
938
+ Verify that each of the following stages has a recorded completion status:
939
+
940
+ | Stage | Steps | Required |
941
+ |-------|-------|----------|
942
+ | Builder waves | Steps 5.1–5.3 | At least 1 worker completed (status "completed") |
943
+ | Watcher | Steps 5.4–5.5 | Watcher returned a result (any status) |
944
+ | Chaos | Steps 5.6–5.7 | Chaos ant returned a result (any status) |
945
+
946
+ Check by reviewing the in-memory worker results accumulated during Steps 5.1–5.7:
947
+ - `builder_results` — results from all builder wave tasks
948
+ - `watcher_result` — result from Step 5.5
949
+ - `chaos_result` — result from Step 5.7
950
+
951
+ **If any stage result is absent (stage did not run or returned no result):**
952
+ - HALT — do not proceed to Step 5.9
953
+ - Display:
954
+ ```
955
+ Stage Audit FAILED — cannot synthesize results.
956
+
957
+ Missing or incomplete stages:
958
+ {list each missing stage: "Builders — no results recorded" / "Watcher — did not complete" / "Chaos — did not complete"}
959
+
960
+ Recovery options:
961
+ 1. Re-run /ant:build to restart this phase
962
+ 2. Run /ant:flags to review blockers
963
+ 3. Run /ant:swarm to auto-repair failed tasks
964
+ ```
965
+ - Return `{"status": "failed", "summary": "Stage audit failed — stages did not complete"}` and stop.
966
+
967
+ **If all stages have results (even if some workers failed):** proceed to Step 5.9.
968
+
934
969
  ### Step 5.9: Synthesize Results
935
970
 
936
971
  **This step runs after all worker tasks have completed (Builders, Watcher, Chaos).**
@@ -441,7 +441,7 @@ body_claude: |
441
441
  Display:
442
442
  ```
443
443
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
444
- C O L O N Y E N T O M B E D
444
+ ⚰️ C O L O N Y E N T O M B E D
445
445
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
446
446
 
447
447
  Entombed v{colony_version}
@@ -44,7 +44,6 @@ body: |
44
44
  - .aether/dreams/ (user notes)
45
45
  - .aether/chambers/ (archived colonies)
46
46
  - .env* files
47
- - .claude/settings.json
48
47
  - .github/workflows/
49
48
  </read_only>
50
49
 
@@ -159,7 +158,7 @@ body: |
159
158
  Display a brief header:
160
159
  ```
161
160
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
162
- A E T H E R C O L O N Y I N I T
161
+ 🥚 A E T H E R C O L O N Y I N I T
163
162
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
164
163
  ```
165
164
 
@@ -473,30 +472,48 @@ body: |
473
472
  **If xml_import_available is false (no chambers, no XML, or no xmllint):**
474
473
 
475
474
  Skip silently -- proceed directly to Step 8 without any mention of import (per D-11).
475
+ ### Step 7.5: Install Clash Detection Hook
476
+
477
+ If `.aether/utils/clash-detect.sh` exists, run:
478
+
479
+ ```bash
480
+ bash .aether/aether-utils.sh clash-setup --install 2>/dev/null || true
481
+ ```
482
+
483
+ This installs the PreToolUse hook that prevents conflicting edits across worktrees.
484
+ Non-blocking — if it fails, init continues normally.
485
+
486
+ Also configure the merge driver for package-lock.json:
487
+
488
+ ```bash
489
+ git config merge.lockfile.driver "bash .aether/utils/merge-driver-lockfile.sh %O %A %B" 2>/dev/null || true
490
+ git config merge.lockfile.name "npm lockfile auto-merge" 2>/dev/null || true
491
+ ```
492
+
476
493
  ### Step 8: Display Result
477
494
 
478
495
  Display the success header and result block:
479
496
 
480
497
  ```
481
498
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
482
- A E T H E R C O L O N Y
499
+ 🥚 A E T H E R C O L O N Y
483
500
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
484
501
 
485
- Queen has set the colony's intention
502
+ 👑 Queen has set the colony's intention
486
503
 
487
504
  "{approved_intent}"
488
505
 
489
- Colony Status: READY
506
+ 🟢 Colony Status: READY
490
507
 
491
- {If re-init: " Mode: Re-init (charter updated, state preserved)"}
492
- {If fresh and seeded_count > 0: " Hive wisdom: {seeded_count} cross-colony pattern(s) seeded into QUEEN.md"}
508
+ {If re-init: " 🔄 Mode: Re-init (charter updated, state preserved)"}
509
+ {If fresh and seeded_count > 0: " 🧠 Hive wisdom: {seeded_count} cross-colony pattern(s) seeded into QUEEN.md"}
493
510
 
494
- State persisted -- safe to /clear, then run /ant:plan
511
+ 💾 State persisted -- safe to /clear, then run /ant:plan
495
512
 
496
513
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
497
- Next Up
514
+ 🐜 Next Up
498
515
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
499
- /ant:plan Generate execution plan
500
- /ant:status Check colony state
501
- /ant:focus Set initial focus
516
+ /ant:plan 📊 Generate execution plan
517
+ /ant:status 📋 Check colony state
518
+ /ant:focus 🎯 Set initial focus
502
519
  ```
@@ -276,6 +276,41 @@ body_claude: |
276
276
 
277
277
  (The user will type their topic via the "Other" free-text option.)
278
278
 
279
+ **Question 1.5: Research Brief — Formulate and Approve**
280
+
281
+ Take the user's raw topic (from `$ARGUMENTS` or Question 1) and reformulate it into a structured research brief. The user may have typed casual natural language — your job is to sharpen it into a clear, well-scoped research prompt that will produce better results.
282
+
283
+ Display the brief for approval:
284
+
285
+ ```
286
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
287
+ 🔮 R E S E A R C H B R I E F
288
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
289
+
290
+ **Topic:** {reformulated topic — clear, specific, actionable}
291
+ **Core Question:** {the single most important question this research should answer}
292
+ **Context:** {what we already know from the codebase or user input}
293
+ **Success Criteria:** {what a good answer looks like — what would make this research useful}
294
+ ```
295
+
296
+ Guidelines for formulation:
297
+ - Turn vague topics into specific ones ("auth stuff" → "Authentication architecture: session-based vs token-based for this Node.js API")
298
+ - Add codebase context if relevant (tech stack, existing patterns)
299
+ - Make the core question answerable — not open-ended philosophy
300
+ - Keep success criteria concrete ("A recommendation with trade-offs" not "understand everything")
301
+
302
+ Then ask the user to approve:
303
+
304
+ ```
305
+ Does this capture what you're looking for? (approve / edit)
306
+ ```
307
+
308
+ - If the user approves: use the reformulated topic as the research topic going forward
309
+ - If the user edits: incorporate their changes, display the updated brief, and ask again
310
+ - Max 2 revision rounds (same as init). After 2, ask for final approval or cancel.
311
+
312
+ The approved **Topic** from the brief becomes the topic used in all subsequent steps (state.json, plan.json, research-plan.md).
313
+
279
314
  **Question 2: Research Template**
280
315
 
281
316
  ```
@@ -913,6 +948,41 @@ body_opencode: |
913
948
 
914
949
  (The user will type their topic via the "Other" free-text option.)
915
950
 
951
+ **Question 1.5: Research Brief — Formulate and Approve**
952
+
953
+ Take the user's raw topic (from `$normalized_args` or Question 1) and reformulate it into a structured research brief. The user may have typed casual natural language — your job is to sharpen it into a clear, well-scoped research prompt that will produce better results.
954
+
955
+ Display the brief for approval:
956
+
957
+ ```
958
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
959
+ 🔮 R E S E A R C H B R I E F
960
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
961
+
962
+ **Topic:** {reformulated topic — clear, specific, actionable}
963
+ **Core Question:** {the single most important question this research should answer}
964
+ **Context:** {what we already know from the codebase or user input}
965
+ **Success Criteria:** {what a good answer looks like — what would make this research useful}
966
+ ```
967
+
968
+ Guidelines for formulation:
969
+ - Turn vague topics into specific ones ("auth stuff" → "Authentication architecture: session-based vs token-based for this Node.js API")
970
+ - Add codebase context if relevant (tech stack, existing patterns)
971
+ - Make the core question answerable — not open-ended philosophy
972
+ - Keep success criteria concrete ("A recommendation with trade-offs" not "understand everything")
973
+
974
+ Then ask the user to approve:
975
+
976
+ ```
977
+ Does this capture what you're looking for? (approve / edit)
978
+ ```
979
+
980
+ - If the user approves: use the reformulated topic as the research topic going forward
981
+ - If the user edits: incorporate their changes, display the updated brief, and ask again
982
+ - Max 2 revision rounds (same as init). After 2, ask for final approval or cancel.
983
+
984
+ The approved **Topic** from the brief becomes the topic used in all subsequent steps (state.json, plan.json, research-plan.md).
985
+
916
986
  **Question 2: Research Template**
917
987
 
918
988
  ```
@@ -78,7 +78,7 @@ body: |
78
78
  Display audit header:
79
79
  ```
80
80
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
81
- C O L O N Y A U D I T
81
+ 🔍 C O L O N Y A U D I T
82
82
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
83
83
 
84
84
  Goal: {goal}
@@ -502,7 +502,7 @@ body: |
502
502
 
503
503
  ```
504
504
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
505
- A U D I T R E S U L T S
505
+ 📋 A U D I T R E S U L T S
506
506
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
507
507
 
508
508
  Goal: {goal}
@@ -47,7 +47,7 @@ body: |
47
47
  (applying `--max-phases` cap), display the plan, then stop without executing.
48
48
 
49
49
  ```
50
- ━━━ A U T O P I L O T P R E V I E W ━━━
50
+ ━━━ 🤖 A U T O P I L O T P R E V I E W ━━━
51
51
  Goal: {goal} | Current: Phase {N} | Remaining: {count} | Max: {max or "all"}
52
52
 
53
53
  Phase {id}: {name} ({task_count} tasks) -> build -> continue -> advance
@@ -185,7 +185,7 @@ body: |
185
185
  If `result.should_replan == true`: **PAUSE** with replan suggestion banner:
186
186
 
187
187
  ```
188
- ━━━ R E P L A N S U G G E S T E D ━━━
188
+ ━━━ 🔄 R E P L A N S U G G E S T E D ━━━
189
189
  Phases auto-completed: {N} | Learnings accumulated: {learnings_since_last}
190
190
 
191
191
  The colony has completed {N} phases since the last plan review.
@@ -203,7 +203,7 @@ body: |
203
203
  ### Step 6: Final Summary
204
204
 
205
205
  ```
206
- ━━━ A U T O P I L O T C O M P L E T E ━━━
206
+ ━━━ A U T O P I L O T C O M P L E T E ━━━
207
207
  Phases completed: {N} | Elapsed: {Xm Ys} | Now at: Phase {current}
208
208
 
209
209
  {all complete} -> Colony goal achieved! Run /ant:seal
@@ -235,7 +235,7 @@ body_claude: |
235
235
  Rank fix options:
236
236
  ```
237
237
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
238
- S O L U T I O N R A N K I N G
238
+ 🏆 S O L U T I O N R A N K I N G
239
239
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
240
240
 
241
241
  #1 [0.85 confidence] {best solution}
@@ -1,3 +1,36 @@
1
+ ### Stage Audit Gate (Pre-Synthesis Check)
2
+
3
+ **This gate runs before Step 5.9. All 4 prior playbook stages must have completed with "ok" status.**
4
+
5
+ Check the cross-stage state record for each of the following stages:
6
+
7
+ | Stage | Playbook | Required Status |
8
+ |-------|----------|----------------|
9
+ | 1 | build-prep | ok |
10
+ | 2 | build-context | ok |
11
+ | 3 | build-wave | ok |
12
+ | 4 | build-verify | ok |
13
+
14
+ To verify, read the cross-stage state (typically `.aether/data/build-stage-state.json` or the in-memory record accumulated during the build run) and confirm each stage entry has `"status": "ok"`.
15
+
16
+ **If any stage is missing or did not complete with "ok" status:**
17
+ - HALT — do not proceed to Step 5.9
18
+ - Display:
19
+ ```
20
+ Stage Audit FAILED — cannot synthesize results.
21
+
22
+ Missing or failed stages:
23
+ {list each stage name with its recorded status, or "not recorded" if absent}
24
+
25
+ Recovery options:
26
+ 1. Re-run the missing stage(s) manually, then retry /ant:build
27
+ 2. Run /ant:flags to review blockers
28
+ 3. Run /ant:swarm to auto-repair failed tasks
29
+ ```
30
+ - Return `{"status": "failed", "summary": "Stage audit failed — stages {names} did not complete successfully"}` and stop.
31
+
32
+ **If all 4 stages passed:** proceed to Step 5.9.
33
+
1
34
  ### Step 5.9: Synthesize Results
2
35
 
3
36
  **This step runs after all worker tasks have completed (Builders, Watcher, Chaos).**
@@ -253,7 +286,7 @@ Write the result to .aether/HANDOFF.md using the Write tool.
253
286
 
254
287
  This ensures the handoff always reflects the latest build state, even if the session crashes before explicit pause.
255
288
 
256
- ### Step 6.5: Update Context Document
289
+ ### Step 6.6: Update Context Document
257
290
 
258
291
  Log this build activity to `.aether/CONTEXT.md`:
259
292
 
@@ -263,7 +296,7 @@ Also update safe-to-clear status:
263
296
  - If build completed successfully: `context-update safe-to-clear "YES" "Build complete, ready to continue"`
264
297
  - If build failed: `context-update safe-to-clear "NO" "Build failed — run /ant:swarm or /ant:flags"`
265
298
 
266
- ### Step 5.10: Check for Promotion Proposals
299
+ ### Step 6.7: Check for Promotion Proposals
267
300
 
268
301
  After build completion (success or failure), check if any observations have met promotion thresholds.
269
302
 
@@ -295,14 +328,14 @@ Calculate `elapsed` using `build_started_at_epoch` (epoch integer captured at St
295
328
 
296
329
  ```
297
330
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
298
- B U I L D S U M M A R Y
331
+ 🔨 B U I L D S U M M A R Y
299
332
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
300
- Phase {id}: {name}
301
- Pattern: {selected_pattern}
333
+ 📍 Phase {id}: {name}
334
+ 🎲 Pattern: {selected_pattern}
302
335
 
303
- Workers: {pass_count} passed {fail_count} failed ({total} total)
304
- Tools: {total_tools} calls across all workers
305
- Duration: {elapsed}
336
+ 🐜 Workers: {pass_count} passed {fail_count} failed ({total} total)
337
+ 🛠️ Tools: {total_tools} calls across all workers
338
+ ⏱️ Duration: {elapsed}
306
339
 
307
340
  {if measurer_ran:}
308
341
  📊 Measurer: {baseline_count} baselines established, {bottleneck_count} bottlenecks identified
@@ -268,7 +268,7 @@ Output header:
268
268
 
269
269
  ```
270
270
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
271
- B U I L D I N G P H A S E {id}
271
+ 🔨 B U I L D I N G P H A S E {id}
272
272
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
273
273
 
274
274
  📍 Phase {id}: {name}
@@ -1629,14 +1629,14 @@ Calculate `elapsed` using `build_started_at_epoch` (epoch integer captured at St
1629
1629
 
1630
1630
  ```
1631
1631
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1632
- B U I L D S U M M A R Y
1632
+ 🔨 B U I L D S U M M A R Y
1633
1633
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1634
- Phase {id}: {name}
1635
- Pattern: {selected_pattern}
1634
+ 📍 Phase {id}: {name}
1635
+ 🎲 Pattern: {selected_pattern}
1636
1636
 
1637
- Workers: {pass_count} passed {fail_count} failed ({total} total)
1638
- Tools: {total_tools} calls across all workers
1639
- Duration: {elapsed}
1637
+ 🐜 Workers: {pass_count} passed {fail_count} failed ({total} total)
1638
+ 🛠️ Tools: {total_tools} calls across all workers
1639
+ ⏱️ Duration: {elapsed}
1640
1640
 
1641
1641
  {if measurer_ran:}
1642
1642
  📊 Measurer: {baseline_count} baselines established, {bottleneck_count} bottlenecks identified
@@ -275,7 +275,7 @@ Output header:
275
275
 
276
276
  ```
277
277
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
278
- B U I L D I N G P H A S E {id}
278
+ 🔨 B U I L D I N G P H A S E {id}
279
279
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
280
280
 
281
281
  📍 Phase {id}: {name}