aether-colony 1.1.0

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 (207) hide show
  1. package/.aether/CONTEXT.md +160 -0
  2. package/.aether/QUEEN.md +84 -0
  3. package/.aether/aether-utils.sh +7749 -0
  4. package/.aether/docs/QUEEN-SYSTEM.md +211 -0
  5. package/.aether/docs/README.md +68 -0
  6. package/.aether/docs/caste-system.md +48 -0
  7. package/.aether/docs/disciplines/DISCIPLINES.md +93 -0
  8. package/.aether/docs/disciplines/coding-standards.md +197 -0
  9. package/.aether/docs/disciplines/debugging.md +207 -0
  10. package/.aether/docs/disciplines/learning.md +254 -0
  11. package/.aether/docs/disciplines/tdd.md +257 -0
  12. package/.aether/docs/disciplines/verification-loop.md +167 -0
  13. package/.aether/docs/disciplines/verification.md +116 -0
  14. package/.aether/docs/error-codes.md +268 -0
  15. package/.aether/docs/known-issues.md +233 -0
  16. package/.aether/docs/pheromones.md +205 -0
  17. package/.aether/docs/queen-commands.md +97 -0
  18. package/.aether/exchange/colony-registry.xml +11 -0
  19. package/.aether/exchange/pheromone-xml.sh +575 -0
  20. package/.aether/exchange/pheromones.xml +87 -0
  21. package/.aether/exchange/queen-wisdom.xml +14 -0
  22. package/.aether/exchange/registry-xml.sh +273 -0
  23. package/.aether/exchange/wisdom-xml.sh +319 -0
  24. package/.aether/midden/approach-changes.md +5 -0
  25. package/.aether/midden/build-failures.md +5 -0
  26. package/.aether/midden/test-failures.md +5 -0
  27. package/.aether/model-profiles.yaml +100 -0
  28. package/.aether/rules/aether-colony.md +134 -0
  29. package/.aether/schemas/aether-types.xsd +255 -0
  30. package/.aether/schemas/colony-registry.xsd +309 -0
  31. package/.aether/schemas/example-prompt-builder.xml +234 -0
  32. package/.aether/schemas/pheromone.xsd +163 -0
  33. package/.aether/schemas/prompt.xsd +416 -0
  34. package/.aether/schemas/queen-wisdom.xsd +325 -0
  35. package/.aether/schemas/worker-priming.xsd +276 -0
  36. package/.aether/templates/QUEEN.md.template +79 -0
  37. package/.aether/templates/colony-state-reset.jq.template +22 -0
  38. package/.aether/templates/colony-state.template.json +35 -0
  39. package/.aether/templates/constraints.template.json +9 -0
  40. package/.aether/templates/crowned-anthill.template.md +36 -0
  41. package/.aether/templates/handoff-build-error.template.md +30 -0
  42. package/.aether/templates/handoff-build-success.template.md +39 -0
  43. package/.aether/templates/handoff.template.md +40 -0
  44. package/.aether/templates/learning-observations.template.json +6 -0
  45. package/.aether/templates/midden.template.json +7 -0
  46. package/.aether/templates/pheromones.template.json +6 -0
  47. package/.aether/templates/session.template.json +9 -0
  48. package/.aether/utils/atomic-write.sh +219 -0
  49. package/.aether/utils/chamber-compare.sh +193 -0
  50. package/.aether/utils/chamber-utils.sh +297 -0
  51. package/.aether/utils/colorize-log.sh +132 -0
  52. package/.aether/utils/error-handler.sh +212 -0
  53. package/.aether/utils/file-lock.sh +158 -0
  54. package/.aether/utils/queen-to-md.xsl +395 -0
  55. package/.aether/utils/semantic-cli.sh +413 -0
  56. package/.aether/utils/spawn-tree.sh +428 -0
  57. package/.aether/utils/spawn-with-model.sh +56 -0
  58. package/.aether/utils/state-loader.sh +215 -0
  59. package/.aether/utils/swarm-display.sh +268 -0
  60. package/.aether/utils/watch-spawn-tree.sh +253 -0
  61. package/.aether/utils/xml-compose.sh +253 -0
  62. package/.aether/utils/xml-convert.sh +273 -0
  63. package/.aether/utils/xml-core.sh +186 -0
  64. package/.aether/utils/xml-query.sh +201 -0
  65. package/.aether/utils/xml-utils.sh +110 -0
  66. package/.aether/workers.md +765 -0
  67. package/.claude/agents/ant/aether-ambassador.md +264 -0
  68. package/.claude/agents/ant/aether-archaeologist.md +322 -0
  69. package/.claude/agents/ant/aether-auditor.md +266 -0
  70. package/.claude/agents/ant/aether-builder.md +187 -0
  71. package/.claude/agents/ant/aether-chaos.md +268 -0
  72. package/.claude/agents/ant/aether-chronicler.md +304 -0
  73. package/.claude/agents/ant/aether-gatekeeper.md +325 -0
  74. package/.claude/agents/ant/aether-includer.md +373 -0
  75. package/.claude/agents/ant/aether-keeper.md +271 -0
  76. package/.claude/agents/ant/aether-measurer.md +317 -0
  77. package/.claude/agents/ant/aether-probe.md +210 -0
  78. package/.claude/agents/ant/aether-queen.md +325 -0
  79. package/.claude/agents/ant/aether-route-setter.md +173 -0
  80. package/.claude/agents/ant/aether-sage.md +353 -0
  81. package/.claude/agents/ant/aether-scout.md +142 -0
  82. package/.claude/agents/ant/aether-surveyor-disciplines.md +416 -0
  83. package/.claude/agents/ant/aether-surveyor-nest.md +354 -0
  84. package/.claude/agents/ant/aether-surveyor-pathogens.md +288 -0
  85. package/.claude/agents/ant/aether-surveyor-provisions.md +359 -0
  86. package/.claude/agents/ant/aether-tracker.md +265 -0
  87. package/.claude/agents/ant/aether-watcher.md +244 -0
  88. package/.claude/agents/ant/aether-weaver.md +247 -0
  89. package/.claude/commands/ant/archaeology.md +341 -0
  90. package/.claude/commands/ant/build.md +1160 -0
  91. package/.claude/commands/ant/chaos.md +349 -0
  92. package/.claude/commands/ant/colonize.md +270 -0
  93. package/.claude/commands/ant/continue.md +1070 -0
  94. package/.claude/commands/ant/council.md +309 -0
  95. package/.claude/commands/ant/dream.md +265 -0
  96. package/.claude/commands/ant/entomb.md +487 -0
  97. package/.claude/commands/ant/feedback.md +78 -0
  98. package/.claude/commands/ant/flag.md +139 -0
  99. package/.claude/commands/ant/flags.md +155 -0
  100. package/.claude/commands/ant/focus.md +58 -0
  101. package/.claude/commands/ant/help.md +122 -0
  102. package/.claude/commands/ant/history.md +137 -0
  103. package/.claude/commands/ant/init.md +409 -0
  104. package/.claude/commands/ant/interpret.md +267 -0
  105. package/.claude/commands/ant/lay-eggs.md +201 -0
  106. package/.claude/commands/ant/maturity.md +102 -0
  107. package/.claude/commands/ant/memory-details.md +77 -0
  108. package/.claude/commands/ant/migrate-state.md +165 -0
  109. package/.claude/commands/ant/oracle.md +387 -0
  110. package/.claude/commands/ant/organize.md +227 -0
  111. package/.claude/commands/ant/pause-colony.md +247 -0
  112. package/.claude/commands/ant/phase.md +126 -0
  113. package/.claude/commands/ant/plan.md +544 -0
  114. package/.claude/commands/ant/redirect.md +58 -0
  115. package/.claude/commands/ant/resume-colony.md +182 -0
  116. package/.claude/commands/ant/resume.md +363 -0
  117. package/.claude/commands/ant/seal.md +306 -0
  118. package/.claude/commands/ant/status.md +272 -0
  119. package/.claude/commands/ant/swarm.md +361 -0
  120. package/.claude/commands/ant/tunnels.md +425 -0
  121. package/.claude/commands/ant/update.md +209 -0
  122. package/.claude/commands/ant/verify-castes.md +95 -0
  123. package/.claude/commands/ant/watch.md +238 -0
  124. package/.opencode/agents/aether-ambassador.md +140 -0
  125. package/.opencode/agents/aether-archaeologist.md +108 -0
  126. package/.opencode/agents/aether-auditor.md +144 -0
  127. package/.opencode/agents/aether-builder.md +184 -0
  128. package/.opencode/agents/aether-chaos.md +115 -0
  129. package/.opencode/agents/aether-chronicler.md +122 -0
  130. package/.opencode/agents/aether-gatekeeper.md +116 -0
  131. package/.opencode/agents/aether-includer.md +117 -0
  132. package/.opencode/agents/aether-keeper.md +177 -0
  133. package/.opencode/agents/aether-measurer.md +128 -0
  134. package/.opencode/agents/aether-probe.md +133 -0
  135. package/.opencode/agents/aether-queen.md +286 -0
  136. package/.opencode/agents/aether-route-setter.md +130 -0
  137. package/.opencode/agents/aether-sage.md +106 -0
  138. package/.opencode/agents/aether-scout.md +101 -0
  139. package/.opencode/agents/aether-surveyor-disciplines.md +386 -0
  140. package/.opencode/agents/aether-surveyor-nest.md +324 -0
  141. package/.opencode/agents/aether-surveyor-pathogens.md +259 -0
  142. package/.opencode/agents/aether-surveyor-provisions.md +329 -0
  143. package/.opencode/agents/aether-tracker.md +137 -0
  144. package/.opencode/agents/aether-watcher.md +174 -0
  145. package/.opencode/agents/aether-weaver.md +130 -0
  146. package/.opencode/commands/ant/archaeology.md +338 -0
  147. package/.opencode/commands/ant/build.md +1200 -0
  148. package/.opencode/commands/ant/chaos.md +346 -0
  149. package/.opencode/commands/ant/colonize.md +202 -0
  150. package/.opencode/commands/ant/continue.md +938 -0
  151. package/.opencode/commands/ant/council.md +305 -0
  152. package/.opencode/commands/ant/dream.md +262 -0
  153. package/.opencode/commands/ant/entomb.md +367 -0
  154. package/.opencode/commands/ant/feedback.md +80 -0
  155. package/.opencode/commands/ant/flag.md +137 -0
  156. package/.opencode/commands/ant/flags.md +153 -0
  157. package/.opencode/commands/ant/focus.md +56 -0
  158. package/.opencode/commands/ant/help.md +124 -0
  159. package/.opencode/commands/ant/history.md +127 -0
  160. package/.opencode/commands/ant/init.md +337 -0
  161. package/.opencode/commands/ant/interpret.md +256 -0
  162. package/.opencode/commands/ant/lay-eggs.md +141 -0
  163. package/.opencode/commands/ant/maturity.md +92 -0
  164. package/.opencode/commands/ant/memory-details.md +77 -0
  165. package/.opencode/commands/ant/migrate-state.md +153 -0
  166. package/.opencode/commands/ant/oracle.md +338 -0
  167. package/.opencode/commands/ant/organize.md +224 -0
  168. package/.opencode/commands/ant/pause-colony.md +220 -0
  169. package/.opencode/commands/ant/phase.md +123 -0
  170. package/.opencode/commands/ant/plan.md +531 -0
  171. package/.opencode/commands/ant/redirect.md +67 -0
  172. package/.opencode/commands/ant/resume-colony.md +178 -0
  173. package/.opencode/commands/ant/resume.md +363 -0
  174. package/.opencode/commands/ant/seal.md +247 -0
  175. package/.opencode/commands/ant/status.md +272 -0
  176. package/.opencode/commands/ant/swarm.md +357 -0
  177. package/.opencode/commands/ant/tunnels.md +406 -0
  178. package/.opencode/commands/ant/update.md +191 -0
  179. package/.opencode/commands/ant/verify-castes.md +85 -0
  180. package/.opencode/commands/ant/watch.md +220 -0
  181. package/.opencode/opencode.json +3 -0
  182. package/CHANGELOG.md +325 -0
  183. package/DISCLAIMER.md +74 -0
  184. package/LICENSE +21 -0
  185. package/README.md +258 -0
  186. package/bin/cli.js +2436 -0
  187. package/bin/generate-commands.sh +291 -0
  188. package/bin/lib/caste-colors.js +57 -0
  189. package/bin/lib/colors.js +76 -0
  190. package/bin/lib/errors.js +255 -0
  191. package/bin/lib/event-types.js +190 -0
  192. package/bin/lib/file-lock.js +695 -0
  193. package/bin/lib/init.js +454 -0
  194. package/bin/lib/logger.js +242 -0
  195. package/bin/lib/model-profiles.js +445 -0
  196. package/bin/lib/model-verify.js +288 -0
  197. package/bin/lib/nestmate-loader.js +130 -0
  198. package/bin/lib/proxy-health.js +253 -0
  199. package/bin/lib/spawn-logger.js +266 -0
  200. package/bin/lib/state-guard.js +602 -0
  201. package/bin/lib/state-sync.js +516 -0
  202. package/bin/lib/telemetry.js +441 -0
  203. package/bin/lib/update-transaction.js +1454 -0
  204. package/bin/npx-install.js +178 -0
  205. package/bin/sync-to-runtime.sh +6 -0
  206. package/bin/validate-package.sh +88 -0
  207. package/package.json +70 -0
@@ -0,0 +1,167 @@
1
+ # Verification Loop Discipline
2
+
3
+ ## Purpose
4
+
5
+ A comprehensive 6-phase quality check that runs before phase advancement or PR creation. Complements the core Verification Discipline (evidence before claims) with systematic quality gates.
6
+
7
+ ## When to Invoke
8
+
9
+ - After completing a phase (via `/ant:continue`)
10
+ - Before creating a PR
11
+ - After significant refactoring
12
+ - After major changes (every 15 minutes in long sessions)
13
+
14
+ ## The 6 Phases
15
+
16
+ ### Phase 1: Build Verification
17
+
18
+ ```bash
19
+ # Detect and run build command
20
+ npm run build 2>&1 | tail -30
21
+ # OR: pnpm build, cargo build, go build ./..., python -m build
22
+ ```
23
+
24
+ **Gate:** If build fails, STOP. Fix before continuing.
25
+
26
+ ### Phase 2: Type Check
27
+
28
+ ```bash
29
+ # TypeScript
30
+ npx tsc --noEmit 2>&1 | head -30
31
+
32
+ # Python
33
+ pyright . 2>&1 | head -30
34
+
35
+ # Go
36
+ go vet ./... 2>&1 | head -30
37
+ ```
38
+
39
+ **Gate:** Report all type errors. Fix critical ones before continuing.
40
+
41
+ ### Phase 3: Lint Check
42
+
43
+ ```bash
44
+ # JavaScript/TypeScript
45
+ npm run lint 2>&1 | head -30
46
+
47
+ # Python
48
+ ruff check . 2>&1 | head -30
49
+
50
+ # Go
51
+ golangci-lint run 2>&1 | head -30
52
+ ```
53
+
54
+ **Gate:** Report warnings. Fix errors before continuing.
55
+
56
+ ### Phase 4: Test Suite
57
+
58
+ ```bash
59
+ # Run tests with coverage
60
+ npm run test -- --coverage 2>&1 | tail -50
61
+
62
+ # Python
63
+ pytest --cov=. 2>&1 | tail -50
64
+ ```
65
+
66
+ Report:
67
+ - Total tests: X
68
+ - Passed: X
69
+ - Failed: X
70
+ - Coverage: X% (target: 80%+)
71
+
72
+ **Gate:** If tests fail, STOP. Fix before continuing.
73
+
74
+ ### Phase 5: Security Scan
75
+
76
+ ```bash
77
+ # Check for exposed secrets
78
+ grep -rn "sk-\|api_key\|password\s*=" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null | head -10
79
+
80
+ # Check for debug artifacts
81
+ grep -rn "console\.log\|debugger\|TODO.*REMOVE" --include="*.ts" --include="*.tsx" --include="*.js" src/ 2>/dev/null | head -10
82
+ ```
83
+
84
+ Report:
85
+ - Potential secrets: X
86
+ - Debug artifacts: X
87
+
88
+ **Gate:** Fix exposed secrets immediately. Debug artifacts are warnings.
89
+
90
+ ### Phase 6: Diff Review
91
+
92
+ ```bash
93
+ # Show what changed
94
+ git diff --stat
95
+ git diff HEAD~1 --name-only
96
+ ```
97
+
98
+ Review each changed file for:
99
+ - Unintended changes (files touched that shouldn't be)
100
+ - Missing error handling
101
+ - Potential edge cases
102
+ - Leftover debugging code
103
+
104
+ **Gate:** Review before advancing. Flag concerns.
105
+
106
+ ## Verification Report Format
107
+
108
+ After running all phases, produce a verification report:
109
+
110
+ ```
111
+ VERIFICATION LOOP REPORT
112
+ ========================
113
+
114
+ Phase 1: Build [PASS/FAIL]
115
+ Phase 2: Types [PASS/FAIL] (X errors)
116
+ Phase 3: Lint [PASS/FAIL] (X warnings)
117
+ Phase 4: Tests [PASS/FAIL] (X/Y passed, Z% coverage)
118
+ Phase 5: Security [PASS/FAIL] (X issues)
119
+ Phase 6: Diff [X files changed]
120
+
121
+ Overall: [READY/NOT READY] for advancement
122
+
123
+ Issues to Fix:
124
+ 1. ...
125
+ 2. ...
126
+ ```
127
+
128
+ ## Command Detection
129
+
130
+ Resolve each command (build, test, types, lint) independently using the priority chain below. Use the first source that provides a match for each label; do not mix sources for the same label.
131
+
132
+ ### Command Resolution Priority
133
+
134
+ 1. **CLAUDE.md** — Check the project's CLAUDE.md (in LLM system context) for explicit commands under headings like `Commands`, `Scripts`, `Development`, `Build`, `Testing`, or `Lint`.
135
+ 2. **CODEBASE.md** — Read `.aether/data/codebase.md` `## Commands` section for commands detected during `/ant:colonize`. Each entry includes source attribution (`claude_md` or `heuristic`).
136
+ 3. **Fallback Heuristic Table** — Use the table below if neither source provides a command for the needed label.
137
+
138
+ ### Fallback Heuristic Table
139
+
140
+ | File | Build | Test | Types | Lint |
141
+ |------|-------|------|-------|------|
142
+ | `package.json` | `npm run build` | `npm test` | `npx tsc --noEmit` | `npm run lint` |
143
+ | `Cargo.toml` | `cargo build` | `cargo test` | (built-in) | `cargo clippy` |
144
+ | `go.mod` | `go build ./...` | `go test ./...` | `go vet ./...` | `golangci-lint run` |
145
+ | `pyproject.toml` | `python -m build` | `pytest` | `pyright .` | `ruff check .` |
146
+ | `Makefile` | `make build` | `make test` | (check targets) | `make lint` |
147
+
148
+ ## Skip Conditions
149
+
150
+ If command doesn't exist for project:
151
+ - Skip that phase
152
+ - Note "N/A" in report
153
+ - Don't fail the loop
154
+
155
+ ## Integration with Hooks
156
+
157
+ This discipline provides comprehensive review. Hooks catch issues immediately during development. Use both:
158
+ - Hooks: Real-time feedback
159
+ - Verification Loop: Comprehensive gate before advancement
160
+
161
+ ## Why This Matters
162
+
163
+ - Catches issues before they compound
164
+ - Ensures consistent quality gates
165
+ - Prevents shipping broken code
166
+ - Creates audit trail of verification
167
+ - Builds confidence in phase completion
@@ -0,0 +1,116 @@
1
+ # Verification Discipline
2
+
3
+ ## The Iron Law
4
+
5
+ ```
6
+ NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
7
+ ```
8
+
9
+ If you haven't run the verification command in this message, you cannot claim it passes.
10
+
11
+ ## The Gate Function
12
+
13
+ ```
14
+ BEFORE claiming any status or expressing satisfaction:
15
+
16
+ 1. IDENTIFY: What command proves this claim?
17
+ 2. RUN: Execute the FULL command (fresh, complete)
18
+ 3. READ: Full output, check exit code, count failures
19
+ 4. VERIFY: Does output confirm the claim?
20
+ - If NO: State actual status with evidence
21
+ - If YES: State claim WITH evidence
22
+ 5. ONLY THEN: Make the claim
23
+
24
+ Skip any step = lying, not verifying
25
+ ```
26
+
27
+ ## Common Failures
28
+
29
+ | Claim | Requires | Not Sufficient |
30
+ |-------|----------|----------------|
31
+ | Tests pass | Test command output: 0 failures | Previous run, "should pass" |
32
+ | Build succeeds | Build command: exit 0 | Linter passing, logs look good |
33
+ | Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
34
+ | Task complete | Success criteria verified | "I wrote the code" |
35
+ | Phase ready | All tasks verified | Prime Worker reports success |
36
+
37
+ ## Red Flags - STOP
38
+
39
+ When you catch yourself:
40
+ - Using "should", "probably", "seems to"
41
+ - Expressing satisfaction before verification ("Great!", "Done!")
42
+ - About to report completion without running checks
43
+ - Trusting spawn reports without independent verification
44
+ - Relying on partial verification
45
+ - **ANY wording implying success without having run verification**
46
+
47
+ ## Rationalization Prevention
48
+
49
+ | Excuse | Reality |
50
+ |--------|---------|
51
+ | "Should work now" | RUN the verification |
52
+ | "I'm confident" | Confidence ≠ evidence |
53
+ | "Just this once" | No exceptions |
54
+ | "Spawn said success" | Verify independently |
55
+ | "Partial check is enough" | Partial proves nothing |
56
+
57
+ ## Verification Patterns
58
+
59
+ **Tests:**
60
+ ```
61
+ ✅ [Run test command] → [See: 34/34 pass] → "All tests pass"
62
+ ❌ "Should pass now" / "Looks correct"
63
+ ```
64
+
65
+ **Build:**
66
+ ```
67
+ ✅ [Run build] → [See: exit 0] → "Build succeeds"
68
+ ❌ "Code compiles" (without running build)
69
+ ```
70
+
71
+ **Task Completion:**
72
+ ```
73
+ ✅ Re-read success criteria → Verify each with evidence → Report with proof
74
+ ❌ "Tasks done, phase complete"
75
+ ```
76
+
77
+ **Spawn Verification:**
78
+ ```
79
+ ✅ Spawn reports success → Check files exist → Run tests → Report actual state
80
+ ❌ Trust spawn report blindly
81
+ ```
82
+
83
+ ## Phase Advancement Gate
84
+
85
+ Before `/ant:continue` advances to next phase:
86
+
87
+ 1. **Build Check**: Run project build command (if exists)
88
+ 2. **Test Check**: Run test suite, capture pass/fail counts
89
+ 3. **Success Criteria**: Line-by-line verification of phase criteria
90
+ 4. **Evidence Required**: Each criterion needs specific proof
91
+
92
+ ```
93
+ Phase {N} Verification
94
+ ======================
95
+
96
+ Build: {command} → {exit code}
97
+ Tests: {command} → {pass}/{total} ({fail} failures)
98
+
99
+ Success Criteria:
100
+ ✅ Criterion 1: {evidence}
101
+ ✅ Criterion 2: {evidence}
102
+ ❌ Criterion 3: {what's missing}
103
+
104
+ Verdict: PASS / FAIL
105
+ ```
106
+
107
+ If ANY criterion fails verification, phase cannot advance.
108
+
109
+ ## Why This Matters
110
+
111
+ - False completion claims break trust
112
+ - Unverified code ships bugs
113
+ - Time wasted on rework from premature advancement
114
+ - Colony integrity depends on honest reporting
115
+
116
+ **Evidence before claims, always.**
@@ -0,0 +1,268 @@
1
+ # Aether Error Code Reference
2
+
3
+ This document is the complete reference for all `E_*` error constants used in Aether's bash utilities and Node.js CLI. When a command fails, the error output includes a `code` field that maps to one of the entries below.
4
+
5
+ **How to read this document:** Find the code you see in the error output, then check the meaning, when it happens, and what to do.
6
+
7
+ ---
8
+
9
+ ## File Errors
10
+
11
+ ### E_FILE_NOT_FOUND
12
+
13
+ - **Meaning:** A required file or directory doesn't exist at the expected path.
14
+ - **When it happens:**
15
+ - A command is invoked but the data file it needs (e.g., `COLONY_STATE.json`, `flags.json`, `CONTEXT.md`) hasn't been created yet.
16
+ - A directory path passed as an argument doesn't exist.
17
+ - **Suggested fix:** Check that `aether init` (or the relevant setup command) has been run. Verify the path exists and is spelled correctly.
18
+ - **Example output:**
19
+ ```json
20
+ {"ok":false,"error":{"code":"E_FILE_NOT_FOUND","message":"Couldn't find CONTEXT.md. Try: run context-update init first.","details":null,"recovery":"Check file path and permissions","timestamp":"2026-02-19T13:00:00Z"}}
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Lock Errors
26
+
27
+ ### E_LOCK_FAILED
28
+
29
+ - **Meaning:** Couldn't acquire a file lock — another process is currently holding it.
30
+ - **When it happens:**
31
+ - Two commands try to write to the same file (e.g., `flags.json`) at the same time.
32
+ - A previous command crashed and didn't release its lock. Use `force-unlock` to clear stale locks.
33
+ - **Suggested fix:** Wait for any running operations to finish, then retry. If you're sure nothing else is running, use `aether force-unlock` to clear the lock manually.
34
+ - **Example output:**
35
+ ```json
36
+ {"ok":false,"error":{"code":"E_LOCK_FAILED","message":"Failed to acquire lock on flags.json","details":null,"recovery":"Wait for other operations to complete","timestamp":"2026-02-19T13:00:00Z"}}
37
+ ```
38
+
39
+ ### E_LOCK_STALE
40
+
41
+ - **Meaning:** A lock file exists but belongs to a process that is no longer running, or has exceeded the maximum lock timeout (5 minutes). This differs from `E_LOCK_FAILED` (which means another process holds a live lock) — `E_LOCK_STALE` means the lock is abandoned.
42
+ - **When it happens:**
43
+ - A previous command crashed without releasing its lock.
44
+ - The locking process was killed by the OS (e.g., OOM) or terminated by the user (Ctrl+C) before the trap handler could fire.
45
+ - The lock is older than the configured timeout (300 seconds).
46
+ - **Suggested fix:** Run `aether force-unlock` to clear stale locks, or manually remove the lock file shown in the error message.
47
+ - **Example output:**
48
+ ```json
49
+ {"ok":false,"error":{"code":"E_LOCK_STALE","message":"Stale lock found. Remove manually: .aether/locks/flags.json.lock"}}
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Tool / Dependency Errors
55
+
56
+ ### E_FEATURE_UNAVAILABLE
57
+
58
+ - **Meaning:** A feature or optional tool required for this operation isn't installed or enabled.
59
+ - **When it happens:**
60
+ - XML operations are attempted but `xmllint` isn't installed.
61
+ - A feature has been disabled due to a missing dependency or configuration.
62
+ - **Suggested fix:** Install the required tool (e.g., `brew install libxml2` for xmllint on macOS) or check the feature's documentation for setup steps.
63
+ - **Example output:**
64
+ ```json
65
+ {"ok":false,"error":{"code":"E_FEATURE_UNAVAILABLE","message":"xmllint not available. Try: brew install libxml2","details":null,"recovery":null,"timestamp":"2026-02-19T13:00:00Z"}}
66
+ ```
67
+
68
+ ### E_DEPENDENCY_MISSING
69
+
70
+ - **Meaning:** A required utility script or binary is missing from the expected location.
71
+ - **When it happens:**
72
+ - A utility script in `.aether/utils/` (e.g., `error-handler.sh`, `file-lock.sh`) can't be found.
73
+ - A required binary (e.g., `jq`, `git`) isn't installed or isn't on `$PATH`.
74
+ - **Suggested fix:** Run `aether install` to restore missing system files, or install the missing binary via your system package manager.
75
+ - **Example output:**
76
+ ```json
77
+ {"ok":false,"error":{"code":"E_DEPENDENCY_MISSING","message":"Couldn't load error-handler.sh. Try: run aether install to restore system files.","details":null,"recovery":"Install the required dependency","timestamp":"2026-02-19T13:00:00Z"}}
78
+ ```
79
+
80
+ ---
81
+
82
+ ## JSON / Data Errors
83
+
84
+ ### E_JSON_INVALID
85
+
86
+ - **Meaning:** A JSON file is malformed or is missing required fields.
87
+ - **When it happens:**
88
+ - A data file (`COLONY_STATE.json`, `flags.json`, etc.) has been manually edited and contains a syntax error.
89
+ - A write operation was interrupted, leaving a partially-written file.
90
+ - **Suggested fix:** Open the file and fix the JSON syntax, or delete it and re-run the initialization command to regenerate a fresh copy.
91
+ - **Example output:**
92
+ ```json
93
+ {"ok":false,"error":{"code":"E_JSON_INVALID","message":"Failed to parse COLONY_STATE.json. Try: validate with jq '.'' .aether/data/COLONY_STATE.json","details":null,"recovery":"Validate JSON syntax","timestamp":"2026-02-19T13:00:00Z"}}
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Validation Errors
99
+
100
+ ### E_VALIDATION_FAILED
101
+
102
+ - **Meaning:** The command was called with missing or invalid arguments.
103
+ - **When it happens:**
104
+ - A required argument (e.g., flag type, flag ID, spawn summary) is missing.
105
+ - An argument value is outside the allowed range or format.
106
+ - **Suggested fix:** Check the usage message in the error output. The error message typically includes the correct usage syntax.
107
+ - **Example output:**
108
+ ```json
109
+ {"ok":false,"error":{"code":"E_VALIDATION_FAILED","message":"Usage: flag-add <type> <title> <description> [source] [phase]","details":null,"recovery":null,"timestamp":"2026-02-19T13:00:00Z"}}
110
+ ```
111
+
112
+ ---
113
+
114
+ ## System Errors
115
+
116
+ ### E_BASH_ERROR
117
+
118
+ - **Meaning:** An unexpected system command failure occurred — a bash command returned a non-zero exit code where one wasn't expected.
119
+ - **When it happens:**
120
+ - A system command (e.g., `cp`, `mkdir`, `git`) fails unexpectedly.
121
+ - A script runs under `set -e` and a command exits non-zero.
122
+ - **Suggested fix:** Check the `details` field in the error output for the exact command and line number. Fix the underlying system issue (permissions, disk space, etc.) and retry.
123
+ - **Example output:**
124
+ ```json
125
+ {"ok":false,"error":{"code":"E_BASH_ERROR","message":"Bash command failed","details":{"line":42,"command":"cp src dst","exit_code":1},"recovery":null,"timestamp":"2026-02-19T13:00:00Z"}}
126
+ ```
127
+
128
+ ### E_UNKNOWN
129
+
130
+ - **Meaning:** An unclassified error occurred — something went wrong that doesn't fit a more specific category.
131
+ - **When it happens:**
132
+ - An error path that hasn't been given a specific code yet.
133
+ - A catch-all for unexpected failure conditions.
134
+ - **Suggested fix:** Check the error message for context. If you see this frequently, please report it so a specific code can be added.
135
+ - **Example output:**
136
+ ```json
137
+ {"ok":false,"error":{"code":"E_UNKNOWN","message":"An unknown error occurred","details":null,"recovery":null,"timestamp":"2026-02-19T13:00:00Z"}}
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Hub / Repository Errors
143
+
144
+ ### E_HUB_NOT_FOUND
145
+
146
+ - **Meaning:** The Aether hub (`~/.aether/`) doesn't exist on this machine.
147
+ - **When it happens:**
148
+ - Aether hasn't been installed yet.
149
+ - The hub directory was accidentally deleted.
150
+ - **Suggested fix:** Run `npm install -g aether` to install Aether. This creates the hub at `~/.aether/`.
151
+ - **Example output:**
152
+ ```json
153
+ {"ok":false,"error":{"code":"E_HUB_NOT_FOUND","message":"Couldn't find the Aether hub. Try: npm install -g aether","details":null,"recovery":"Run: aether install","timestamp":"2026-02-19T13:00:00Z"}}
154
+ ```
155
+
156
+ ### E_REPO_NOT_INITIALIZED
157
+
158
+ - **Meaning:** The current repository hasn't been initialized with Aether.
159
+ - **When it happens:**
160
+ - Running an Aether command in a repo before running `/ant:init`.
161
+ - The `.aether/` directory or `COLONY_STATE.json` is missing from the current repo.
162
+ - **Suggested fix:** Run `/ant:init` in Claude Code to initialize Aether in this repository.
163
+ - **Example output:**
164
+ ```json
165
+ {"ok":false,"error":{"code":"E_REPO_NOT_INITIALIZED","message":"Couldn't find Aether initialization in this repo. Try: run /ant:init first.","details":null,"recovery":"Run /ant:init in this repo first","timestamp":"2026-02-19T13:00:00Z"}}
166
+ ```
167
+
168
+ ### E_GIT_ERROR
169
+
170
+ - **Meaning:** A git operation failed.
171
+ - **When it happens:**
172
+ - `git stash`, `git commit`, `git log`, or another git command returns an error.
173
+ - The directory isn't a git repository.
174
+ - There are merge conflicts or a detached HEAD state.
175
+ - **Suggested fix:** Run `git status` to see the current state of your repository. Resolve any conflicts or uncommitted changes, then retry the command.
176
+ - **Example output:**
177
+ ```json
178
+ {"ok":false,"error":{"code":"E_GIT_ERROR","message":"Git operation failed. Try: run git status to check repository state.","details":null,"recovery":"Check git status and resolve conflicts","timestamp":"2026-02-19T13:00:00Z"}}
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Resource Errors
184
+
185
+ ### E_RESOURCE_NOT_FOUND
186
+
187
+ - **Meaning:** A runtime resource (e.g., an active session, a worker, a swarm) doesn't exist.
188
+ - **When it happens:**
189
+ - A command refers to a session ID, worker name, or swarm ID that doesn't exist or has already completed.
190
+ - Attempting to read or update a resource that hasn't been created yet.
191
+ - **Suggested fix:** Check that the resource was created first. List available resources with the relevant `list` command (e.g., `flag-list`, `swarm-findings-read`).
192
+ - **Example output:**
193
+ ```json
194
+ {"ok":false,"error":{"code":"E_RESOURCE_NOT_FOUND","message":"Couldn't find the requested resource. Try: check that it was created first.","details":null,"recovery":"Check that the resource exists and try again","timestamp":"2026-02-19T13:00:00Z"}}
195
+ ```
196
+
197
+ ---
198
+
199
+ ## For Contributors
200
+
201
+ ### Adding a New Error Code
202
+
203
+ When you need a new error code, follow this checklist:
204
+
205
+ 1. **Define the constant** in `.aether/utils/error-handler.sh` at the top of the file:
206
+ ```bash
207
+ E_MY_NEW_CODE="E_MY_NEW_CODE"
208
+ ```
209
+
210
+ 2. **Add a recovery function** in `error-handler.sh`:
211
+ ```bash
212
+ _recovery_my_new_code() { echo '"Description of how to fix this"'; }
213
+ ```
214
+
215
+ 3. **Add a case entry** in the `_get_recovery` function in `error-handler.sh`:
216
+ ```bash
217
+ "$E_MY_NEW_CODE") _recovery_my_new_code ;;
218
+ ```
219
+
220
+ 4. **Add a fallback definition** at the top of `aether-utils.sh` (in the fallback constants block):
221
+ ```bash
222
+ : "${E_MY_NEW_CODE:=E_MY_NEW_CODE}"
223
+ ```
224
+
225
+ 5. **Export the constant and function** at the bottom of `error-handler.sh`:
226
+ ```bash
227
+ export E_MY_NEW_CODE
228
+ export -f _recovery_my_new_code
229
+ ```
230
+
231
+ 6. **Document the code** in this file (`docs/error-codes.md`) following the existing format.
232
+
233
+ ### Naming Convention
234
+
235
+ - **Prefix:** Always start with `E_`
236
+ - **Case:** SCREAMING_SNAKE_CASE (e.g., `E_FILE_NOT_FOUND`, `E_LOCK_FAILED`)
237
+ - **Be specific:** Prefer `E_FILE_NOT_FOUND` over `E_ERROR` — the code should communicate the failure category
238
+
239
+ ### Category Selection Guide
240
+
241
+ | Category | Use when... |
242
+ |----------|-------------|
243
+ | File Errors | A file or directory path doesn't exist |
244
+ | Lock Errors | Lock acquisition fails |
245
+ | Tool/Dependency Errors | A required tool or script is missing |
246
+ | JSON/Data Errors | File content is malformed or invalid |
247
+ | Validation Errors | Arguments are wrong or missing |
248
+ | System Errors | Unexpected bash command failure |
249
+ | Hub/Repository Errors | Aether infrastructure is missing or not set up |
250
+ | Resource Errors | A named runtime object doesn't exist |
251
+
252
+ ### Message Style Requirements
253
+
254
+ Every `json_err` call **must** include a "Try:" suggestion in the message:
255
+
256
+ ```bash
257
+ # Correct — includes Try: suggestion
258
+ json_err "$E_FILE_NOT_FOUND" "Couldn't find flags.json. Try: run flag-add first to create it."
259
+
260
+ # Wrong — no actionable suggestion
261
+ json_err "$E_FILE_NOT_FOUND" "flags.json not found"
262
+ ```
263
+
264
+ **Tone:** Use plain, friendly language. "Couldn't find..." is better than "File not found". Users are not experts in bash internals.
265
+
266
+ ---
267
+
268
+ *Last updated: 2026-02-19*