aether-colony 3.1.4 → 3.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/.claude/commands/ant/archaeology.md +12 -0
  2. package/.claude/commands/ant/build.md +382 -319
  3. package/.claude/commands/ant/chaos.md +23 -1
  4. package/.claude/commands/ant/colonize.md +147 -87
  5. package/.claude/commands/ant/continue.md +213 -23
  6. package/.claude/commands/ant/council.md +22 -0
  7. package/.claude/commands/ant/dream.md +18 -0
  8. package/.claude/commands/ant/entomb.md +178 -6
  9. package/.claude/commands/ant/init.md +87 -13
  10. package/.claude/commands/ant/lay-eggs.md +45 -5
  11. package/.claude/commands/ant/oracle.md +82 -9
  12. package/.claude/commands/ant/organize.md +2 -2
  13. package/.claude/commands/ant/pause-colony.md +86 -28
  14. package/.claude/commands/ant/phase.md +26 -0
  15. package/.claude/commands/ant/plan.md +204 -111
  16. package/.claude/commands/ant/resume-colony.md +23 -1
  17. package/.claude/commands/ant/resume.md +159 -0
  18. package/.claude/commands/ant/seal.md +177 -3
  19. package/.claude/commands/ant/swarm.md +78 -97
  20. package/.claude/commands/ant/verify-castes.md +7 -7
  21. package/.claude/commands/ant/watch.md +17 -0
  22. package/.opencode/agents/aether-ambassador.md +97 -0
  23. package/.opencode/agents/aether-archaeologist.md +91 -0
  24. package/.opencode/agents/aether-architect.md +66 -0
  25. package/.opencode/agents/aether-auditor.md +111 -0
  26. package/.opencode/agents/aether-builder.md +28 -10
  27. package/.opencode/agents/aether-chaos.md +98 -0
  28. package/.opencode/agents/aether-chronicler.md +80 -0
  29. package/.opencode/agents/aether-gatekeeper.md +107 -0
  30. package/.opencode/agents/aether-guardian.md +107 -0
  31. package/.opencode/agents/aether-includer.md +108 -0
  32. package/.opencode/agents/aether-keeper.md +106 -0
  33. package/.opencode/agents/aether-measurer.md +119 -0
  34. package/.opencode/agents/aether-probe.md +91 -0
  35. package/.opencode/agents/aether-queen.md +72 -19
  36. package/.opencode/agents/aether-route-setter.md +85 -0
  37. package/.opencode/agents/aether-sage.md +98 -0
  38. package/.opencode/agents/aether-scout.md +33 -15
  39. package/.opencode/agents/aether-surveyor-disciplines.md +334 -0
  40. package/.opencode/agents/aether-surveyor-nest.md +272 -0
  41. package/.opencode/agents/aether-surveyor-pathogens.md +209 -0
  42. package/.opencode/agents/aether-surveyor-provisions.md +277 -0
  43. package/.opencode/agents/aether-tracker.md +91 -0
  44. package/.opencode/agents/aether-watcher.md +30 -12
  45. package/.opencode/agents/aether-weaver.md +87 -0
  46. package/.opencode/agents/workers.md +1034 -0
  47. package/.opencode/commands/ant/archaeology.md +44 -26
  48. package/.opencode/commands/ant/build.md +327 -295
  49. package/.opencode/commands/ant/chaos.md +32 -4
  50. package/.opencode/commands/ant/colonize.md +119 -93
  51. package/.opencode/commands/ant/continue.md +98 -10
  52. package/.opencode/commands/ant/council.md +28 -0
  53. package/.opencode/commands/ant/dream.md +24 -0
  54. package/.opencode/commands/ant/entomb.md +73 -1
  55. package/.opencode/commands/ant/feedback.md +8 -2
  56. package/.opencode/commands/ant/flag.md +9 -3
  57. package/.opencode/commands/ant/flags.md +8 -2
  58. package/.opencode/commands/ant/focus.md +8 -2
  59. package/.opencode/commands/ant/help.md +12 -0
  60. package/.opencode/commands/ant/init.md +49 -4
  61. package/.opencode/commands/ant/lay-eggs.md +30 -2
  62. package/.opencode/commands/ant/oracle.md +39 -7
  63. package/.opencode/commands/ant/organize.md +9 -3
  64. package/.opencode/commands/ant/pause-colony.md +54 -1
  65. package/.opencode/commands/ant/phase.md +36 -4
  66. package/.opencode/commands/ant/plan.md +225 -117
  67. package/.opencode/commands/ant/redirect.md +8 -2
  68. package/.opencode/commands/ant/resume-colony.md +51 -26
  69. package/.opencode/commands/ant/seal.md +76 -0
  70. package/.opencode/commands/ant/status.md +50 -20
  71. package/.opencode/commands/ant/swarm.md +108 -104
  72. package/.opencode/commands/ant/tunnels.md +107 -2
  73. package/CHANGELOG.md +21 -0
  74. package/README.md +199 -86
  75. package/bin/cli.js +142 -25
  76. package/bin/generate-commands.sh +100 -16
  77. package/bin/lib/caste-colors.js +5 -5
  78. package/bin/lib/errors.js +16 -0
  79. package/bin/lib/file-lock.js +279 -44
  80. package/bin/lib/state-sync.js +206 -23
  81. package/bin/lib/update-transaction.js +206 -24
  82. package/bin/sync-to-runtime.sh +129 -0
  83. package/package.json +2 -2
  84. package/runtime/CONTEXT.md +160 -0
  85. package/runtime/aether-utils.sh +1421 -55
  86. package/runtime/docs/AETHER-2.0-IMPLEMENTATION-PLAN.md +1343 -0
  87. package/runtime/docs/AETHER-PHEROMONE-SYSTEM-MASTER-SPEC.md +2642 -0
  88. package/runtime/docs/PHEROMONE-INJECTION.md +240 -0
  89. package/runtime/docs/PHEROMONE-INTEGRATION.md +192 -0
  90. package/runtime/docs/PHEROMONE-SYSTEM-DESIGN.md +426 -0
  91. package/runtime/docs/README.md +94 -0
  92. package/runtime/docs/VISUAL-OUTPUT-SPEC.md +219 -0
  93. package/runtime/docs/biological-reference.md +272 -0
  94. package/runtime/docs/codebase-review.md +399 -0
  95. package/runtime/docs/command-sync.md +164 -0
  96. package/runtime/docs/implementation-learnings.md +89 -0
  97. package/runtime/docs/known-issues.md +217 -0
  98. package/runtime/docs/namespace.md +148 -0
  99. package/runtime/docs/planning-discipline.md +159 -0
  100. package/runtime/lib/queen-utils.sh +729 -0
  101. package/runtime/model-profiles.yaml +100 -0
  102. package/runtime/recover.sh +136 -0
  103. package/runtime/templates/QUEEN.md.template +79 -0
  104. package/runtime/utils/atomic-write.sh +5 -5
  105. package/runtime/utils/chamber-utils.sh +6 -3
  106. package/runtime/utils/error-handler.sh +200 -0
  107. package/runtime/utils/queen-to-md.xsl +395 -0
  108. package/runtime/utils/spawn-tree.sh +428 -0
  109. package/runtime/utils/spawn-with-model.sh +56 -0
  110. package/runtime/utils/state-loader.sh +215 -0
  111. package/runtime/utils/swarm-display.sh +5 -5
  112. package/runtime/utils/watch-spawn-tree.sh +90 -22
  113. package/runtime/utils/xml-compose.sh +247 -0
  114. package/runtime/utils/xml-core.sh +186 -0
  115. package/runtime/utils/xml-utils.sh +2161 -0
  116. package/runtime/verification-loop.md +1 -1
  117. package/runtime/workers-new-castes.md +516 -0
  118. package/runtime/workers.md +20 -8
  119. package/.aether/visualizations/anthill-stages/brood-stable.txt +0 -26
  120. package/.aether/visualizations/anthill-stages/crowned-anthill.txt +0 -30
  121. package/.aether/visualizations/anthill-stages/first-mound.txt +0 -18
  122. package/.aether/visualizations/anthill-stages/open-chambers.txt +0 -24
  123. package/.aether/visualizations/anthill-stages/sealed-chambers.txt +0 -28
  124. package/.aether/visualizations/anthill-stages/ventilated-nest.txt +0 -27
@@ -7,7 +7,23 @@ You are the **Queen Ant Colony**. Reconcile completed work and advance to the ne
7
7
 
8
8
  ## Instructions
9
9
 
10
- ### Step 0: Version Check (Non-blocking)
10
+ Parse `$ARGUMENTS`:
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
13
+
14
+ ### Step 0: Initialize Visual Mode (if enabled)
15
+
16
+ If `visual_mode` is true:
17
+ ```bash
18
+ # Generate session ID
19
+ continue_id="continue-$(date +%s)"
20
+
21
+ # Initialize swarm display
22
+ bash .aether/aether-utils.sh swarm-display-init "$continue_id"
23
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Phase continuation" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
24
+ ```
25
+
26
+ ### Step 0.5: Version Check (Non-blocking)
11
27
 
12
28
  Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
13
29
 
@@ -82,8 +98,8 @@ Resolve each command (build, test, types, lint) using this priority chain. Stop
82
98
  **Priority 1 — CLAUDE.md (System Context):**
83
99
  Check the CLAUDE.md instructions already loaded in your system context for explicit build, test, type-check, or lint commands. These are authoritative and override all other sources.
84
100
 
85
- **Priority 2 — .planning/CODEBASE.md `## Commands`:**
86
- Read `.planning/CODEBASE.md` and look for the `## Commands` section. Use any commands listed there for slots not yet filled by Priority 1.
101
+ **Priority 2 — codebase.md `## Commands`:**
102
+ Read `.aether/data/codebase.md` and look for the `## Commands` section. Use any commands listed there for slots not yet filled by Priority 1.
87
103
 
88
104
  **Priority 3 — Fallback Heuristic Table:**
89
105
  For any commands still unresolved, check for these files in order, use first match:
@@ -649,6 +665,105 @@ Update COLONY_STATE.json:
649
665
 
650
666
  Write COLONY_STATE.json.
651
667
 
668
+ ### Step 2.2: Promote Validated Learnings to QUEEN.md
669
+
670
+ After extracting learnings in Step 2, promote high-confidence validated learnings to QUEEN.md wisdom.
671
+
672
+ **Promotion Criteria:**
673
+ - Only learnings with `status: "validated"` are eligible
674
+ - Must have been tested and confirmed working
675
+ - Should represent actionable patterns, not one-off observations
676
+
677
+ **Process:**
678
+
679
+ 1. **Get colony name from state:**
680
+ ```bash
681
+ colony_name=$(jq -r '.session_id | split("_")[1] // "unknown"' .aether/data/COLONY_STATE.json)
682
+ ```
683
+
684
+ 2. **Extract validated learnings from current phase:**
685
+ Read `memory.phase_learnings` and filter for entries where:
686
+ - `phase` matches the completed phase number
687
+ - Any learning in `learnings[]` has `status: "validated"`
688
+
689
+ 3. **Promote to QUEEN.md using queen-promote:**
690
+
691
+ For each validated learning, determine the wisdom type and call queen-promote:
692
+
693
+ **Type Mapping:**
694
+ - Learning about success patterns → `pattern`
695
+ - Learning about what to avoid/corrections → `redirect`
696
+ - Learning about fundamental principles → `philosophy`
697
+ - Learning about technology/stack → `stack`
698
+
699
+ ```bash
700
+ # Example promotions
701
+ bash .aether/aether-utils.sh queen-promote "pattern" "<learning claim>" "$colony_name"
702
+ bash .aether/aether-utils.sh queen-promote "redirect" "<what to avoid>" "$colony_name"
703
+ ```
704
+
705
+ 4. **Log promotion results:**
706
+ ```bash
707
+ bash .aether/aether-utils.sh activity-log "PROMOTED" "Queen" "Promoted N validated learnings to QUEEN.md wisdom"
708
+ ```
709
+
710
+ **Display promotion summary:**
711
+ ```
712
+ 🧠 Wisdom Promotion
713
+ ==================
714
+ {count} validated learning(s) promoted to QUEEN.md:
715
+ - [{type}] {brief claim preview}
716
+ ```
717
+
718
+ Skip this step if:
719
+ - No validated learnings exist for this phase
720
+ - QUEEN.md does not exist (run queen-init first if needed)
721
+ - All learnings are still hypotheses or disproven
722
+
723
+ ### Step 2.3: Update Handoff Document
724
+
725
+ After advancing the phase, update the handoff document with the new current state:
726
+
727
+ ```bash
728
+ # Determine if there's a next phase
729
+ next_phase_id=$((current_phase + 1))
730
+ has_next_phase=$(jq --arg next "$next_phase_id" '.plan.phases | map(select(.id == ($next | tonumber))) | length' .aether/data/COLONY_STATE.json)
731
+
732
+ # Write updated handoff
733
+ cat > .aether/HANDOFF.md << 'HANDOFF_EOF'
734
+ # Colony Session — Phase Advanced
735
+
736
+ ## Quick Resume
737
+ Run `/ant:build {next_phase_id}` to start working on the current phase.
738
+
739
+ ## State at Advancement
740
+ - Goal: "$(jq -r '.goal' .aether/data/COLONY_STATE.json)"
741
+ - Completed Phase: {completed_phase_id} — {completed_phase_name}
742
+ - Current Phase: {next_phase_id} — {next_phase_name}
743
+ - State: READY
744
+ - Updated: $(date -u +%Y-%m-%dT%H:%M:%SZ)
745
+
746
+ ## What Was Completed
747
+ - Phase {completed_phase_id} marked as completed
748
+ - Learnings extracted: {learning_count}
749
+ - Instincts updated: {instinct_count}
750
+ - Wisdom promoted to QUEEN.md: {promoted_count}
751
+
752
+ ## Current Phase Tasks
753
+ $(jq -r '.plan.phases[] | select(.id == next_phase_id) | .tasks[] | "- [ ] \(.id): \(.description)"' .aether/data/COLONY_STATE.json)
754
+
755
+ ## Next Steps
756
+ - Build current phase: `/ant:build {next_phase_id}`
757
+ - Review phase details: `/ant:phase {next_phase_id}`
758
+ - Pause colony: `/ant:pause-colony`
759
+
760
+ ## Session Note
761
+ Phase advanced successfully. Colony is READY to build Phase {next_phase_id}.
762
+ HANDOFF_EOF
763
+ ```
764
+
765
+ This handoff reflects the post-advancement state, allowing seamless resumption even if the session is lost.
766
+
652
767
  ### Step 2.4: Update Changelog
653
768
 
654
769
  **Append a changelog entry for the completed phase.**
@@ -681,57 +796,88 @@ If `CHANGELOG.md` exists in the project root:
681
796
 
682
797
  After the phase is advanced and changelog updated, suggest a commit to preserve the milestone.
683
798
 
684
- 1. **Generate the commit message:**
799
+ #### Step 2.6.1: Capture AI Description
800
+
801
+ **As the AI, briefly describe what was accomplished in this phase.**
802
+
803
+ Look at:
804
+ 1. The phase PLAN.md `<objective>` section (what we set out to do)
805
+ 2. Tasks that were marked complete
806
+ 3. Files that were modified (from git diff --stat)
807
+ 4. Any patterns or decisions recorded
808
+
809
+ **Provide a brief, memorable description** (10-15 words, imperative mood):
810
+ - Good: "Implement task-based model routing with keyword detection and precedence chain"
811
+ - Good: "Fix build timing by removing background execution from worker spawns"
812
+ - Bad: "Phase complete" (too vague)
813
+ - Bad: "Modified files in bin/lib" (too mechanical)
814
+
815
+ Store this as `ai_description` for the commit message.
816
+
817
+ #### Step 2.6.2: Generate Enhanced Commit Message
818
+
685
819
  ```bash
686
- bash .aether/aether-utils.sh generate-commit-message "milestone" {phase_id} "{phase_name}" "{one_line_summary}"
820
+ bash .aether/aether-utils.sh generate-commit-message "contextual" {phase_id} "{phase_name}" "{ai_description}" {plan_number}
687
821
  ```
688
- Parse the returned JSON to extract `message` and `files_changed`.
689
822
 
690
- 2. **Check files changed:**
823
+ Parse the returned JSON to extract:
824
+ - `message` - the commit subject line
825
+ - `body` - structured metadata (Scope, Files)
826
+ - `files_changed` - file count
827
+ - `subsystem` - derived subsystem name
828
+ - `scope` - phase.plan format
829
+
830
+ **Check files changed:**
691
831
  ```bash
692
832
  git diff --stat HEAD 2>/dev/null | tail -5
693
833
  ```
694
834
  If not in a git repo or no changes detected, skip this step silently.
695
835
 
696
- 3. **Display the suggestion:**
836
+ **Display the enhanced suggestion:**
697
837
  ```
698
838
  ──────────────────────────────────────────────────
699
839
  Commit Suggestion
700
840
  ──────────────────────────────────────────────────
701
841
 
702
- Message: {generated_message}
703
- Files: {files_changed} files changed
704
- Preview: {first 5 lines of git diff --stat}
842
+ AI Description: {ai_description}
843
+
844
+ Formatted Message:
845
+ {message}
846
+
847
+ Metadata:
848
+ Scope: {scope}
849
+ Files: {files_changed} files changed
850
+ Preview: {first 5 lines of git diff --stat}
705
851
 
706
852
  ──────────────────────────────────────────────────
707
853
  ```
708
854
 
709
- 4. **Use AskUserQuestion:**
855
+ **Use AskUserQuestion:**
710
856
  ```
711
857
  Commit this milestone?
712
858
 
713
859
  1. Yes, commit with this message
714
- 2. Yes, but let me write the message
860
+ 2. Yes, but let me edit the description
715
861
  3. No, I'll commit later
716
862
  ```
717
863
 
718
- 5. **If option 1 ("Yes, commit with this message"):**
864
+ **If option 1 ("Yes, commit with this message"):**
719
865
  ```bash
720
- git add -A && git commit -m "{generated_message}"
866
+ git add -A && git commit -m "{message}" -m "{body}"
721
867
  ```
722
- Display: `Committed: {generated_message} ({files_changed} files)`
868
+ Display: `Committed: {message} ({files_changed} files)`
723
869
 
724
- 6. **If option 2 ("Yes, but let me write the message"):**
725
- Use AskUserQuestion to get the user's custom commit message, then:
726
- ```bash
727
- git add -A && git commit -m "{custom_message}"
870
+ **If option 2 ("Yes, but let me edit"):**
871
+ Use AskUserQuestion to get the user's custom description:
872
+ ```
873
+ Enter your description (or press Enter to keep: '{ai_description}'):
728
874
  ```
729
- Display: `Committed: {custom_message} ({files_changed} files)`
875
+ Then regenerate the commit message with the new description and commit.
730
876
 
731
- 7. **If option 3 ("No, I'll commit later"):**
877
+ **If option 3 ("No, I'll commit later"):**
732
878
  Display: `Skipped. Your changes are saved on disk but not committed.`
733
879
 
734
- 8. **Record the suggestion to prevent double-prompting:**
880
+ **Record the suggestion to prevent double-prompting:**
735
881
  Set `last_commit_suggestion_phase` to `{phase_id}` in COLONY_STATE.json (add the field at the top level if it does not exist).
736
882
 
737
883
  **Error handling:** If any git command fails (not a repo, merge conflict, pre-commit hook rejection), display the error output and continue to the next step. The commit suggestion is advisory only -- it never blocks the flow.
@@ -780,6 +926,26 @@ Clear context now?
780
926
 
781
927
  Continue to Step 2.5 (Project Completion) or Step 3 (Display Result).
782
928
 
929
+ ### Step 2.8: Update Context Document
930
+
931
+ After phase advancement is complete, update `.aether/CONTEXT.md`:
932
+
933
+ **Log the activity:**
934
+ ```bash
935
+ bash .aether/aether-utils.sh context-update activity "continue" "Phase {prev_id} completed, advanced to {next_id}" "—"
936
+ ```
937
+
938
+ **Update the phase:**
939
+ ```bash
940
+ bash .aether/aether-utils.sh context-update update-phase {next_id} "{next_phase_name}" "YES" "Phase advanced, ready to build"
941
+ ```
942
+
943
+ **Log any decisions from this session:**
944
+ If any architectural decisions were made during verification, also run:
945
+ ```bash
946
+ bash .aether/aether-utils.sh context-update decision "{decision_description}" "{rationale}" "Queen"
947
+ ```
948
+
783
949
  ### Step 2.5: Project Completion
784
950
 
785
951
  Runs ONLY when all phases complete.
@@ -803,6 +969,9 @@ Runs ONLY when all phases complete.
803
969
  🧠 Colony Learnings:
804
970
  {condensed learnings from memory.phase_learnings}
805
971
 
972
+ 👑 Wisdom Added to QUEEN.md:
973
+ {count} patterns/redirects/philosophies promoted across all phases
974
+
806
975
  🐜 The colony rests. Well done!
807
976
  ```
808
977
 
@@ -811,6 +980,12 @@ Runs ONLY when all phases complete.
811
980
 
812
981
  ### Step 3: Display Result
813
982
 
983
+ **If visual_mode is true, render final swarm display:**
984
+ ```bash
985
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Phase advanced" "Colony" '{"read":5,"grep":2,"edit":3,"bash":2}' 100 "fungus_garden" 100
986
+ bash .aether/aether-utils.sh swarm-display-render "$continue_id"
987
+ ```
988
+
814
989
  Output:
815
990
 
816
991
  ```
@@ -823,6 +998,11 @@ Output:
823
998
  🧠 Learnings Extracted:
824
999
  {list learnings added}
825
1000
 
1001
+ 👑 Wisdom Promoted to QUEEN.md:
1002
+ {for each promoted learning:}
1003
+ [{type}] {brief claim}
1004
+ {end for}
1005
+
826
1006
  🐜 Instincts Updated:
827
1007
  {for each instinct created or updated:}
828
1008
  [{confidence}] {domain}: {action}
@@ -841,6 +1021,16 @@ Output:
841
1021
  /ant:focus "<area>" 🎯 Guide colony attention
842
1022
 
843
1023
  💾 State persisted — context clear suggested above
1024
+
1025
+ 📋 Context document updated at `.aether/CONTEXT.md`
844
1026
  ```
845
1027
 
846
1028
  **IMPORTANT:** In the "Next Steps" section above, substitute the actual phase number for `{next_id}` (calculated in Step 2 as `current_phase + 1`). For example, if advancing to phase 4, output `/ant:build 4` not `/ant:build {next_id}`.
1029
+
1030
+ ### Step 4: Update Session
1031
+
1032
+ Update the session tracking file to enable `/ant:resume` after context clear:
1033
+
1034
+ ```bash
1035
+ bash .aether/aether-utils.sh session-update "/ant:continue" "/ant:build {next_id}" "Phase {prev_id} completed, advanced to Phase {next_id}"
1036
+ ```
@@ -7,6 +7,22 @@ You are the **Queen Ant Colony**. Convene the council to clarify user intent and
7
7
 
8
8
  ## Instructions
9
9
 
10
+ Parse `$ARGUMENTS`:
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
13
+
14
+ ### Step 0: Initialize Visual Mode (if enabled)
15
+
16
+ If `visual_mode` is true:
17
+ ```bash
18
+ # Generate session ID
19
+ council_id="council-$(date +%s)"
20
+
21
+ # Initialize swarm display
22
+ bash .aether/aether-utils.sh swarm-display-init "$council_id"
23
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Convening council" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
24
+ ```
25
+
10
26
  ### Step 1: Read Current State
11
27
 
12
28
  Read `.aether/data/COLONY_STATE.json`.
@@ -223,6 +239,12 @@ Keep max 100 events.
223
239
 
224
240
  ### Step 8: Display Summary
225
241
 
242
+ **If visual_mode is true, render final swarm display:**
243
+ ```bash
244
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Council adjourned" "Colony" '{"read":3,"grep":0,"edit":2,"bash":1}' 100 "fungus_garden" 100
245
+ bash .aether/aether-utils.sh swarm-display-render "$council_id"
246
+ ```
247
+
226
248
  ```
227
249
  📜🐜🏛️🐜📜 COUNCIL ADJOURNED
228
250
 
@@ -29,6 +29,24 @@ You wander the codebase like a monk walks a garden — not to fix, not to judge,
29
29
 
30
30
  ## Instructions
31
31
 
32
+ ### Step 0: Parse Arguments
33
+
34
+ Parse `$ARGUMENTS`:
35
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
36
+ - Otherwise: set `visual_mode = true`
37
+
38
+ ### Step 0.5: Initialize Visual Mode (if enabled)
39
+
40
+ If `visual_mode` is true:
41
+ ```bash
42
+ # Generate session ID
43
+ dream_id="dream-$(date +%s)"
44
+
45
+ # Initialize swarm display
46
+ bash .aether/aether-utils.sh swarm-display-init "$dream_id"
47
+ bash .aether/aether-utils.sh swarm-display-update "Dreamer" "dreamer" "observing" "Wandering the codebase" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "nursery" 0
48
+ ```
49
+
32
50
  ### Step 1: Awaken — Load Context
33
51
 
34
52
  Read these files in parallel to understand the world you're dreaming about:
@@ -7,6 +7,22 @@ You are the **Queen**. Archive the completed colony to chambers.
7
7
 
8
8
  ## Instructions
9
9
 
10
+ Parse `$ARGUMENTS`:
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
13
+
14
+ ### Step 0: Initialize Visual Mode (if enabled)
15
+
16
+ If `visual_mode` is true:
17
+ ```bash
18
+ # Generate session ID
19
+ entomb_id="entomb-$(date +%s)"
20
+
21
+ # Initialize swarm display
22
+ bash .aether/aether-utils.sh swarm-display-init "$entomb_id"
23
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Entombing colony" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
24
+ ```
25
+
10
26
  ### Step 1: Read State
11
27
 
12
28
  Read `.aether/data/COLONY_STATE.json`.
@@ -17,6 +33,28 @@ No colony to entomb. Run /ant:init first.
17
33
  ```
18
34
  Stop here.
19
35
 
36
+ #### Step 1.5: Check for Concurrent Entomb Operations
37
+
38
+ Capture session start time:
39
+ ```bash
40
+ ENTOMB_START=$(date +%s)
41
+ ```
42
+
43
+ Check for incomplete chamber operations:
44
+ ```bash
45
+ # Check for incomplete chambers (no colony-state.json)
46
+ incomplete_chambers=$(find .aether/chambers -type d -mindepth 1 -maxdepth 1 2>/dev/null | while read dir; do
47
+ if [[ ! -f "$dir/colony-state.json" ]]; then
48
+ echo "$dir"
49
+ fi
50
+ done)
51
+
52
+ if [[ -n "$incomplete_chambers" ]]; then
53
+ echo "Warning: Incomplete chamber operations detected:"
54
+ echo "$incomplete_chambers"
55
+ fi
56
+ ```
57
+
20
58
  ### Step 2: Validate Colony Can Be Entombed
21
59
 
22
60
  Extract: `goal`, `state`, `current_phase`, `plan.phases`, `memory.decisions`, `memory.phase_learnings`.
@@ -99,7 +137,91 @@ Entombment cancelled. Colony remains active.
99
137
  ```
100
138
  Stop here.
101
139
 
102
- ### Step 5: Create Chamber
140
+ ### Step 5: Promote Wisdom to QUEEN.md
141
+
142
+ Before creating the chamber, promote validated learnings to QUEEN.md for future colonies.
143
+
144
+ **Step 5.1: Ensure QUEEN.md exists**
145
+
146
+ ```bash
147
+ queen_file=".aether/docs/QUEEN.md"
148
+ if [[ ! -f "$queen_file" ]]; then
149
+ init_result=$(bash .aether/aether-utils.sh queen-init 2>/dev/null || echo '{"ok":false}')
150
+ init_ok=$(echo "$init_result" | jq -r '.ok // false')
151
+ if [[ "$init_ok" == "true" ]]; then
152
+ created=$(echo "$init_result" | jq -r '.result.created // false')
153
+ if [[ "$created" == "true" ]]; then
154
+ bash .aether/aether-utils.sh activity-log "CREATED" "Queen" "Initialized QUEEN.md for wisdom promotion"
155
+ fi
156
+ fi
157
+ fi
158
+ ```
159
+
160
+ **Step 5.2: Extract and promote validated learnings**
161
+
162
+ ```bash
163
+ # Extract colony name from goal (sanitized)
164
+ colony_name=$(jq -r '.goal' .aether/data/COLONY_STATE.json | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/^-//;s/-$//' | cut -c1-30)
165
+
166
+ # Extract validated learnings from phase_learnings
167
+ learnings=$(jq -c '.memory.phase_learnings // []' .aether/data/COLONY_STATE.json)
168
+
169
+ # Extract decisions
170
+ decisions=$(jq -c '.memory.decisions // []' .aether/data/COLONY_STATE.json)
171
+
172
+ promotion_count=0
173
+
174
+ # Promote patterns from validated learnings
175
+ if [[ -f "$queen_file" ]]; then
176
+ # Process each phase's learnings
177
+ echo "$learnings" | jq -c '.[]' 2>/dev/null | while read -r learning_group; do
178
+ phase=$(echo "$learning_group" | jq -r '.phase // "unknown"')
179
+ # Extract individual learnings and promote as patterns
180
+ echo "$learning_group" | jq -r '.learnings[]? | select(.status == "validated") | .claim' 2>/dev/null | while read -r claim; do
181
+ if [[ -n "$claim" && "$claim" != "null" ]]; then
182
+ # Truncate if too long
183
+ content=$(echo "$claim" | cut -c1-200)
184
+ result=$(bash .aether/aether-utils.sh queen-promote "pattern" "$content" "$colony_name" 2>/dev/null || echo '{"ok":false}')
185
+ if [[ $(echo "$result" | jq -r '.ok // false') == "true" ]]; then
186
+ promotion_count=$((promotion_count + 1))
187
+ fi
188
+ fi
189
+ done
190
+ done
191
+
192
+ # Promote high-confidence instincts as patterns
193
+ instincts=$(jq -c '.memory.instincts // []' .aether/data/COLONY_STATE.json)
194
+ echo "$instincts" | jq -c '.[]' 2>/dev/null | while read -r instinct; do
195
+ confidence=$(echo "$instinct" | jq -r '.confidence // 0')
196
+ status=$(echo "$instinct" | jq -r '.status // ""')
197
+ action=$(echo "$instinct" | jq -r '.action // ""')
198
+ # Promote validated instincts with high confidence (>= 0.7)
199
+ if [[ "$status" == "validated" && $(echo "$confidence >= 0.7" | bc -l 2>/dev/null || echo 0) -eq 1 && -n "$action" ]]; then
200
+ content=$(echo "$action" | cut -c1-200)
201
+ result=$(bash .aether/aether-utils.sh queen-promote "pattern" "$content" "$colony_name" 2>/dev/null || echo '{"ok":false}')
202
+ if [[ $(echo "$result" | jq -r '.ok // false') == "true" ]]; then
203
+ promotion_count=$((promotion_count + 1))
204
+ fi
205
+ fi
206
+ done
207
+
208
+ # Log promotion results
209
+ bash .aether/aether-utils.sh activity-log "MODIFIED" "Queen" "Promoted $promotion_count validated learnings to QUEEN.md from entombed colony"
210
+ fi
211
+ ```
212
+
213
+ **Step 5.3: Display promotion summary**
214
+
215
+ ```
216
+ ---
217
+ Wisdom Promotion Summary
218
+ ---
219
+ Colony: {colony_name}
220
+ Promoted: {promotion_count} validated patterns to QUEEN.md
221
+ ---
222
+ ```
223
+
224
+ ### Step 6: Create Chamber
103
225
 
104
226
  Generate chamber name:
105
227
  ```bash
@@ -118,7 +240,7 @@ while [[ -d ".aether/chambers/$chamber_name" ]]; do
118
240
  done
119
241
  ```
120
242
 
121
- ### Step 6: Create Chamber Using Utilities
243
+ ### Step 7: Create Chamber Using Utilities
122
244
 
123
245
  Extract decisions and learnings as JSON arrays:
124
246
  ```bash
@@ -143,7 +265,7 @@ bash .aether/aether-utils.sh chamber-create \
143
265
  '{learnings_json}'
144
266
  ```
145
267
 
146
- ### Step 7: Verify Chamber Integrity
268
+ ### Step 8: Verify Chamber Integrity
147
269
 
148
270
  Run verification:
149
271
  ```bash
@@ -161,7 +283,7 @@ The colony has NOT been reset. Please check the chamber directory:
161
283
  ```
162
284
  Stop here.
163
285
 
164
- ### Step 8: Reset Colony State
286
+ ### Step 9: Reset Colony State
165
287
 
166
288
  Backup current state:
167
289
  ```bash
@@ -204,7 +326,45 @@ Remove backup after successful reset:
204
326
  rm -f .aether/data/COLONY_STATE.json.bak
205
327
  ```
206
328
 
207
- ### Step 9: Display Result
329
+ ### Step 9.5: Write Final Handoff
330
+
331
+ After entombing the colony, write the final handoff documenting the archived colony:
332
+
333
+ ```bash
334
+ cat > .aether/HANDOFF.md << 'HANDOFF_EOF'
335
+ # Colony Session — ENTOMBED
336
+
337
+ ## ⚰️ Colony Archived
338
+ **Status:** Entombed in Chambers — Colony work preserved
339
+
340
+ ## Chamber Location
341
+ .aether/chambers/{chamber_name}/
342
+
343
+ ## Colony Summary
344
+ - Goal: "{goal}"
345
+ - Phases: {completed} completed of {total}
346
+ - Milestone: {milestone}
347
+ - Entombed At: {timestamp}
348
+
349
+ ## Chamber Contents
350
+ - colony-state.json — Full colony state
351
+ - manifest.json — Archive metadata
352
+ - activity.log — Colony activity history
353
+ - spawn-tree.txt — Worker spawn records
354
+ - flags.json — Project flags (if existed)
355
+
356
+ ## Session Note
357
+ This colony has been entombed and the active state reset.
358
+ The colony rests. Its learnings are preserved in the chamber.
359
+
360
+ To start anew: /ant:lay-eggs "<new goal>"
361
+ To explore chambers: /ant:tunnels
362
+ HANDOFF_EOF
363
+ ```
364
+
365
+ This handoff serves as the record of the entombed colony.
366
+
367
+ ### Step 10: Display Result
208
368
 
209
369
  ```
210
370
  🏺 ═══════════════════════════════════════════════════
@@ -220,7 +380,19 @@ rm -f .aether/data/COLONY_STATE.json.bak
220
380
  📦 Chamber: .aether/chambers/{chamber_name}/
221
381
 
222
382
  🐜 The colony rests. Its learnings are preserved.
223
- Run /ant:lay-eggs to begin anew.
383
+
384
+ 💾 State persisted — safe to /clear
385
+
386
+ 🐜 What would you like to do next?
387
+ 1. /ant:lay-eggs "<new goal>" — Start a new colony
388
+ 2. /ant:tunnels — Browse archived colonies
389
+ 3. /clear — Clear context and continue
390
+
391
+ Use AskUserQuestion with these three options.
392
+
393
+ If option 1 selected: proceed to run /ant:lay-eggs flow
394
+ If option 2 selected: run /ant:tunnels
395
+ If option 3 selected: display "Run /ant:lay-eggs to begin anew after clearing"
224
396
  ```
225
397
 
226
398
  ### Edge Cases