@aragon-agent/cli 0.6.55 → 0.6.57

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 (319) hide show
  1. package/CHANGELOG.md +2935 -2864
  2. package/README.md +160 -45
  3. package/dist/agent/controller.d.ts +47 -0
  4. package/dist/agent/controller.js +153 -2
  5. package/dist/agent/governance-wiring.js +8 -1
  6. package/dist/agent/system-prompt.d.ts +26 -0
  7. package/dist/agent/system-prompt.js +11 -0
  8. package/dist/app/App.js +101 -3
  9. package/dist/cli.js +29 -1
  10. package/dist/commands/builtins.js +4 -0
  11. package/dist/commands/catalog.js +1 -0
  12. package/dist/commands/registry.d.ts +8 -0
  13. package/dist/config/app-paths.d.ts +10 -0
  14. package/dist/config/app-paths.js +12 -0
  15. package/dist/config/cli-commands.d.ts +29 -0
  16. package/dist/config/cli-commands.js +76 -1
  17. package/dist/config/env.d.ts +2 -1
  18. package/dist/config/env.js +12 -1
  19. package/dist/config/load.d.ts +10 -0
  20. package/dist/config/load.js +13 -2
  21. package/dist/config/store.js +11 -1
  22. package/dist/exec/bridge/server.d.ts +7 -0
  23. package/dist/exec/bridge/server.js +6 -2
  24. package/dist/exec/cli-commands.js +4 -0
  25. package/dist/exec/index.js +2 -0
  26. package/dist/exec/options.d.ts +11 -0
  27. package/dist/exec/options.js +21 -1
  28. package/dist/gene/block.d.ts +33 -0
  29. package/dist/gene/block.js +51 -0
  30. package/dist/gene/capacity.d.ts +74 -0
  31. package/dist/gene/capacity.js +169 -0
  32. package/dist/gene/catalog-reconcile.d.ts +13 -0
  33. package/dist/gene/catalog-reconcile.js +105 -0
  34. package/dist/gene/catalog-stats.d.ts +27 -0
  35. package/dist/gene/catalog-stats.js +89 -0
  36. package/dist/gene/catalog-sync.d.ts +82 -0
  37. package/dist/gene/catalog-sync.js +324 -0
  38. package/dist/gene/catalog.d.ts +160 -0
  39. package/dist/gene/catalog.js +433 -0
  40. package/dist/gene/cli-commands.d.ts +50 -0
  41. package/dist/gene/cli-commands.js +500 -0
  42. package/dist/gene/command-report.d.ts +40 -0
  43. package/dist/gene/command-report.js +246 -0
  44. package/dist/gene/command.d.ts +29 -0
  45. package/dist/gene/command.js +561 -0
  46. package/dist/gene/commit-apply-types.d.ts +13 -0
  47. package/dist/gene/commit-apply-types.js +1 -0
  48. package/dist/gene/commit-compound.d.ts +34 -0
  49. package/dist/gene/commit-compound.js +212 -0
  50. package/dist/gene/commit-counts.d.ts +41 -0
  51. package/dist/gene/commit-counts.js +70 -0
  52. package/dist/gene/commit-exec.d.ts +42 -0
  53. package/dist/gene/commit-exec.js +134 -0
  54. package/dist/gene/commit-head.d.ts +52 -0
  55. package/dist/gene/commit-head.js +97 -0
  56. package/dist/gene/commit-plan.d.ts +95 -0
  57. package/dist/gene/commit-plan.js +68 -0
  58. package/dist/gene/commit-prepare.d.ts +63 -0
  59. package/dist/gene/commit-prepare.js +159 -0
  60. package/dist/gene/commit-types.d.ts +234 -0
  61. package/dist/gene/commit-types.js +3 -0
  62. package/dist/gene/curator/agent.d.ts +137 -0
  63. package/dist/gene/curator/agent.js +203 -0
  64. package/dist/gene/curator/budget.d.ts +69 -0
  65. package/dist/gene/curator/budget.js +131 -0
  66. package/dist/gene/curator/conflicts.d.ts +54 -0
  67. package/dist/gene/curator/conflicts.js +143 -0
  68. package/dist/gene/curator/curator.d.ts +170 -0
  69. package/dist/gene/curator/curator.js +617 -0
  70. package/dist/gene/curator/deps.d.ts +34 -0
  71. package/dist/gene/curator/deps.js +48 -0
  72. package/dist/gene/curator/deterministic.d.ts +62 -0
  73. package/dist/gene/curator/deterministic.js +287 -0
  74. package/dist/gene/curator/executors.d.ts +36 -0
  75. package/dist/gene/curator/executors.js +379 -0
  76. package/dist/gene/curator/lanes.d.ts +52 -0
  77. package/dist/gene/curator/lanes.js +99 -0
  78. package/dist/gene/curator/lease.d.ts +76 -0
  79. package/dist/gene/curator/lease.js +171 -0
  80. package/dist/gene/curator/library.d.ts +36 -0
  81. package/dist/gene/curator/library.js +169 -0
  82. package/dist/gene/curator/lifecycle.d.ts +52 -0
  83. package/dist/gene/curator/lifecycle.js +109 -0
  84. package/dist/gene/curator/maintenance.d.ts +71 -0
  85. package/dist/gene/curator/maintenance.js +213 -0
  86. package/dist/gene/curator/probation.d.ts +51 -0
  87. package/dist/gene/curator/probation.js +71 -0
  88. package/dist/gene/curator/probe.d.ts +131 -0
  89. package/dist/gene/curator/probe.js +534 -0
  90. package/dist/gene/curator/prompt.d.ts +18 -0
  91. package/dist/gene/curator/prompt.js +128 -0
  92. package/dist/gene/curator/publish.d.ts +64 -0
  93. package/dist/gene/curator/publish.js +113 -0
  94. package/dist/gene/curator/recheck.d.ts +55 -0
  95. package/dist/gene/curator/recheck.js +104 -0
  96. package/dist/gene/curator/run-events.d.ts +63 -0
  97. package/dist/gene/curator/run-events.js +55 -0
  98. package/dist/gene/curator/similarity.d.ts +13 -0
  99. package/dist/gene/curator/similarity.js +46 -0
  100. package/dist/gene/curator/switches.d.ts +78 -0
  101. package/dist/gene/curator/switches.js +146 -0
  102. package/dist/gene/curator/task-context.d.ts +93 -0
  103. package/dist/gene/curator/task-context.js +63 -0
  104. package/dist/gene/curator/task-runner.d.ts +56 -0
  105. package/dist/gene/curator/task-runner.js +257 -0
  106. package/dist/gene/curator/tool-support.d.ts +112 -0
  107. package/dist/gene/curator/tool-support.js +206 -0
  108. package/dist/gene/curator/toolkit.d.ts +49 -0
  109. package/dist/gene/curator/toolkit.js +104 -0
  110. package/dist/gene/curator/tools-read.d.ts +4 -0
  111. package/dist/gene/curator/tools-read.js +177 -0
  112. package/dist/gene/curator/tools-release.d.ts +73 -0
  113. package/dist/gene/curator/tools-release.js +287 -0
  114. package/dist/gene/curator/tools-verify.d.ts +47 -0
  115. package/dist/gene/curator/tools-verify.js +243 -0
  116. package/dist/gene/curator/tools-write.d.ts +26 -0
  117. package/dist/gene/curator/tools-write.js +434 -0
  118. package/dist/gene/curator/tools.d.ts +23 -0
  119. package/dist/gene/curator/tools.js +21 -0
  120. package/dist/gene/curator/validate/common.d.ts +87 -0
  121. package/dist/gene/curator/validate/common.js +132 -0
  122. package/dist/gene/curator/validate/evidence-tokens.d.ts +24 -0
  123. package/dist/gene/curator/validate/evidence-tokens.js +217 -0
  124. package/dist/gene/curator/validate/index.d.ts +23 -0
  125. package/dist/gene/curator/validate/index.js +62 -0
  126. package/dist/gene/curator/validate/knowledge.d.ts +41 -0
  127. package/dist/gene/curator/validate/knowledge.js +255 -0
  128. package/dist/gene/curator/validate/live-check.d.ts +14 -0
  129. package/dist/gene/curator/validate/live-check.js +150 -0
  130. package/dist/gene/curator/validate/ports.d.ts +67 -0
  131. package/dist/gene/curator/validate/ports.js +1 -0
  132. package/dist/gene/curator/validate/prompts.d.ts +41 -0
  133. package/dist/gene/curator/validate/prompts.js +165 -0
  134. package/dist/gene/curator/validate/skill.d.ts +15 -0
  135. package/dist/gene/curator/validate/skill.js +251 -0
  136. package/dist/gene/curator/validate/tool.d.ts +6 -0
  137. package/dist/gene/curator/validate/tool.js +217 -0
  138. package/dist/gene/curator/validate/types.d.ts +90 -0
  139. package/dist/gene/curator/validate/types.js +1 -0
  140. package/dist/gene/curator/validator-ports.d.ts +38 -0
  141. package/dist/gene/curator/validator-ports.js +29 -0
  142. package/dist/gene/diag.d.ts +209 -0
  143. package/dist/gene/diag.js +549 -0
  144. package/dist/gene/env.d.ts +10 -0
  145. package/dist/gene/env.js +214 -0
  146. package/dist/gene/eval-recorder.d.ts +84 -0
  147. package/dist/gene/eval-recorder.js +222 -0
  148. package/dist/gene/explain-transport.d.ts +3 -0
  149. package/dist/gene/explain-transport.js +39 -0
  150. package/dist/gene/explain.d.ts +96 -0
  151. package/dist/gene/explain.js +293 -0
  152. package/dist/gene/fs.d.ts +39 -0
  153. package/dist/gene/fs.js +139 -0
  154. package/dist/gene/fsck.d.ts +68 -0
  155. package/dist/gene/fsck.js +134 -0
  156. package/dist/gene/gc-library-sweeps.d.ts +9 -0
  157. package/dist/gene/gc-library-sweeps.js +220 -0
  158. package/dist/gene/gc-rejected-set.d.ts +15 -0
  159. package/dist/gene/gc-rejected-set.js +63 -0
  160. package/dist/gene/gc-safe.d.ts +12 -0
  161. package/dist/gene/gc-safe.js +74 -0
  162. package/dist/gene/gc-scope-sweeps.d.ts +18 -0
  163. package/dist/gene/gc-scope-sweeps.js +297 -0
  164. package/dist/gene/gc-types.d.ts +55 -0
  165. package/dist/gene/gc-types.js +26 -0
  166. package/dist/gene/gc.d.ts +42 -0
  167. package/dist/gene/gc.js +129 -0
  168. package/dist/gene/gene-errors.d.ts +23 -0
  169. package/dist/gene/gene-errors.js +29 -0
  170. package/dist/gene/hints.d.ts +91 -0
  171. package/dist/gene/hints.js +394 -0
  172. package/dist/gene/hub.d.ts +149 -0
  173. package/dist/gene/hub.js +371 -0
  174. package/dist/gene/import-plan.d.ts +80 -0
  175. package/dist/gene/import-plan.js +294 -0
  176. package/dist/gene/import-proposal.d.ts +23 -0
  177. package/dist/gene/import-proposal.js +101 -0
  178. package/dist/gene/import-skill-port.d.ts +6 -0
  179. package/dist/gene/import-skill-port.js +53 -0
  180. package/dist/gene/import-sources.d.ts +48 -0
  181. package/dist/gene/import-sources.js +140 -0
  182. package/dist/gene/index-writer.d.ts +36 -0
  183. package/dist/gene/index-writer.js +101 -0
  184. package/dist/gene/learn/learn-call.d.ts +116 -0
  185. package/dist/gene/learn/learn-call.js +165 -0
  186. package/dist/gene/learn/learn-prompt.d.ts +58 -0
  187. package/dist/gene/learn/learn-prompt.js +254 -0
  188. package/dist/gene/learn/learner.d.ts +187 -0
  189. package/dist/gene/learn/learner.js +448 -0
  190. package/dist/gene/learn/ledger.d.ts +220 -0
  191. package/dist/gene/learn/ledger.js +394 -0
  192. package/dist/gene/learn/proposal-build.d.ts +83 -0
  193. package/dist/gene/learn/proposal-build.js +207 -0
  194. package/dist/gene/learn/proposal-guard.d.ts +43 -0
  195. package/dist/gene/learn/proposal-guard.js +37 -0
  196. package/dist/gene/learn/signals-port.d.ts +47 -0
  197. package/dist/gene/learn/signals-port.js +86 -0
  198. package/dist/gene/maintenance-paths.d.ts +7 -0
  199. package/dist/gene/maintenance-paths.js +20 -0
  200. package/dist/gene/maintenance-probation.d.ts +33 -0
  201. package/dist/gene/maintenance-probation.js +127 -0
  202. package/dist/gene/maintenance-proposals.d.ts +24 -0
  203. package/dist/gene/maintenance-proposals.js +68 -0
  204. package/dist/gene/maintenance-runner.d.ts +92 -0
  205. package/dist/gene/maintenance-runner.js +262 -0
  206. package/dist/gene/maintenance-tasks.d.ts +37 -0
  207. package/dist/gene/maintenance-tasks.js +95 -0
  208. package/dist/gene/manager-actions.d.ts +12 -0
  209. package/dist/gene/manager-actions.js +279 -0
  210. package/dist/gene/manager-approve.d.ts +29 -0
  211. package/dist/gene/manager-approve.js +84 -0
  212. package/dist/gene/manager-context.d.ts +90 -0
  213. package/dist/gene/manager-context.js +201 -0
  214. package/dist/gene/manager-detail.d.ts +17 -0
  215. package/dist/gene/manager-detail.js +313 -0
  216. package/dist/gene/manager-gc.d.ts +13 -0
  217. package/dist/gene/manager-gc.js +81 -0
  218. package/dist/gene/manager-library.d.ts +39 -0
  219. package/dist/gene/manager-library.js +90 -0
  220. package/dist/gene/manager-list.d.ts +27 -0
  221. package/dist/gene/manager-list.js +170 -0
  222. package/dist/gene/manager-queue.d.ts +16 -0
  223. package/dist/gene/manager-queue.js +124 -0
  224. package/dist/gene/manager-stats.d.ts +28 -0
  225. package/dist/gene/manager-stats.js +53 -0
  226. package/dist/gene/manager-view.d.ts +27 -0
  227. package/dist/gene/manager-view.js +124 -0
  228. package/dist/gene/manager.d.ts +56 -0
  229. package/dist/gene/manager.js +179 -0
  230. package/dist/gene/orphan-scopes.d.ts +37 -0
  231. package/dist/gene/orphan-scopes.js +150 -0
  232. package/dist/gene/paths.d.ts +73 -0
  233. package/dist/gene/paths.js +239 -0
  234. package/dist/gene/plan-content.d.ts +73 -0
  235. package/dist/gene/plan-content.js +522 -0
  236. package/dist/gene/plan-lifecycle.d.ts +29 -0
  237. package/dist/gene/plan-lifecycle.js +310 -0
  238. package/dist/gene/policy.d.ts +71 -0
  239. package/dist/gene/policy.js +313 -0
  240. package/dist/gene/project-learning.d.ts +25 -0
  241. package/dist/gene/project-learning.js +54 -0
  242. package/dist/gene/propagation.d.ts +48 -0
  243. package/dist/gene/propagation.js +45 -0
  244. package/dist/gene/queue-lock.d.ts +22 -0
  245. package/dist/gene/queue-lock.js +99 -0
  246. package/dist/gene/queue-record.d.ts +57 -0
  247. package/dist/gene/queue-record.js +145 -0
  248. package/dist/gene/queue.d.ts +235 -0
  249. package/dist/gene/queue.js +764 -0
  250. package/dist/gene/read.d.ts +61 -0
  251. package/dist/gene/read.js +252 -0
  252. package/dist/gene/runlog.d.ts +101 -0
  253. package/dist/gene/runlog.js +404 -0
  254. package/dist/gene/schema-lite.d.ts +24 -0
  255. package/dist/gene/schema-lite.js +159 -0
  256. package/dist/gene/scope-guard.d.ts +23 -0
  257. package/dist/gene/scope-guard.js +9 -0
  258. package/dist/gene/scope-lock.d.ts +48 -0
  259. package/dist/gene/scope-lock.js +222 -0
  260. package/dist/gene/scope-verify.d.ts +63 -0
  261. package/dist/gene/scope-verify.js +123 -0
  262. package/dist/gene/secrets.d.ts +43 -0
  263. package/dist/gene/secrets.js +161 -0
  264. package/dist/gene/service-context.d.ts +43 -0
  265. package/dist/gene/service-context.js +79 -0
  266. package/dist/gene/service-prepare.d.ts +25 -0
  267. package/dist/gene/service-prepare.js +219 -0
  268. package/dist/gene/service-types.d.ts +196 -0
  269. package/dist/gene/service-types.js +1 -0
  270. package/dist/gene/service-view.d.ts +41 -0
  271. package/dist/gene/service-view.js +69 -0
  272. package/dist/gene/service.d.ts +114 -0
  273. package/dist/gene/service.js +761 -0
  274. package/dist/gene/session-start.d.ts +36 -0
  275. package/dist/gene/session-start.js +212 -0
  276. package/dist/gene/store-port.d.ts +88 -0
  277. package/dist/gene/store-port.js +10 -0
  278. package/dist/gene/store-rows.d.ts +36 -0
  279. package/dist/gene/store-rows.js +72 -0
  280. package/dist/gene/store.d.ts +125 -0
  281. package/dist/gene/store.js +622 -0
  282. package/dist/gene/tombstones.d.ts +47 -0
  283. package/dist/gene/tombstones.js +61 -0
  284. package/dist/gene/tool-runner.d.ts +47 -0
  285. package/dist/gene/tool-runner.js +154 -0
  286. package/dist/gene/tool-screen.d.ts +41 -0
  287. package/dist/gene/tool-screen.js +227 -0
  288. package/dist/gene/tools.d.ts +112 -0
  289. package/dist/gene/tools.js +539 -0
  290. package/dist/gene/transfer.d.ts +85 -0
  291. package/dist/gene/transfer.js +433 -0
  292. package/dist/gene/ui-hints.d.ts +15 -0
  293. package/dist/gene/ui-hints.js +67 -0
  294. package/dist/gene/usage-fold-cursor.d.ts +24 -0
  295. package/dist/gene/usage-fold-cursor.js +115 -0
  296. package/dist/gene/usage-fold.d.ts +49 -0
  297. package/dist/gene/usage-fold.js +397 -0
  298. package/dist/gene/usage.d.ts +67 -0
  299. package/dist/gene/usage.js +231 -0
  300. package/dist/gene/version-service.d.ts +118 -0
  301. package/dist/gene/version-service.js +453 -0
  302. package/dist/gene/wiring-events.d.ts +43 -0
  303. package/dist/gene/wiring-events.js +113 -0
  304. package/dist/gene/wiring-models.d.ts +46 -0
  305. package/dist/gene/wiring-models.js +84 -0
  306. package/dist/gene/wiring.d.ts +200 -0
  307. package/dist/gene/wiring.js +764 -0
  308. package/dist/governance/prompts/orchestrator-block.js +3 -2
  309. package/dist/host/gene.d.ts +26 -0
  310. package/dist/host/gene.js +24 -0
  311. package/dist/host/index.d.ts +1 -0
  312. package/dist/host/index.js +1 -0
  313. package/dist/team/runtime.d.ts +5 -0
  314. package/dist/team/runtime.js +23 -0
  315. package/dist/team/subagent.d.ts +34 -0
  316. package/dist/team/subagent.js +39 -2
  317. package/dist/tools/index.d.ts +36 -2
  318. package/dist/tools/index.js +48 -7
  319. package/package.json +3 -3
@@ -33,6 +33,8 @@ export function buildSystemPrompt(params) {
33
33
  const skillsBlock = params.skillsBlock ?? '';
34
34
  const hasSkills = skillsBlock.length > 0;
35
35
  const memoryBlock = params.memoryBlock ?? '';
36
+ const geneRulesBlock = params.geneRulesBlock ?? '';
37
+ const geneContextBlock = params.geneContextBlock ?? '';
36
38
  const planBlock = params.agentMode === 'plan'
37
39
  ? buildPlanModeBlock({
38
40
  interactive: params.planInteractive !== false,
@@ -77,6 +79,10 @@ export function buildSystemPrompt(params) {
77
79
  ...(redteamBlock ? ['', redteamBlock] : []),
78
80
  // AFTER the project guidance and BEFORE the skills catalog (agent-memory D-5).
79
81
  ...(memoryBlock ? ['', memoryBlock] : []),
82
+ // IMMEDIATELY AFTER the memory block, before the skills catalog (gene-bank 9.2): the second
83
+ // piece of stable, task-independent text. A source constant, so it can carry the authority
84
+ // claim the dynamic zone below relies on.
85
+ ...(geneRulesBlock ? ['', geneRulesBlock] : []),
80
86
  ...(hasSkills ? ['', skillsBlock] : []),
81
87
  // AFTER <available_skills> (it refers to it as "above") and BEFORE <plan_mode>
82
88
  // (whose step 1 defers to it). Conditional like every other optional block.
@@ -96,6 +102,11 @@ export function buildSystemPrompt(params) {
96
102
  ...(backgroundBlock ? ['', backgroundBlock] : []),
97
103
  ...(jobsBlock ? ['', jobsBlock] : []),
98
104
  ...(imageInputBlock ? ['', imageInputBlock] : []),
105
+ // AFTER every stable subsystem block and the image block, BEFORE the answer-shape block and the
106
+ // operating guidance (gene-bank RV-2). Changing text goes last among the cacheable blocks so a
107
+ // refresh costs the prefix cache only what follows it; it is NOT after the caller's own
108
+ // instructions, which stay the final word.
109
+ ...(geneContextBlock ? ['', geneContextBlock] : []),
99
110
  // AFTER every subsystem block, BEFORE the caller's own instructions: it describes
100
111
  // the shape of the answer, which is the last thing to know before answering, while
101
112
  // `## Additional instructions` still has the final word (section 2.3.8).
package/dist/app/App.js CHANGED
@@ -8,6 +8,7 @@ import { selectTranscriptEntries, mergePendingEntries } from '@aragon-agent/tui/
8
8
  * input / toast stack / status bar / overlays.
9
9
  */
10
10
  import { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from 'react';
11
+ import process from 'node:process';
11
12
  import { Text, useApp, useInput, useStdout } from 'ink';
12
13
  import { advanceInterruptGesture, INTERRUPT_CONFIRM_MS, cancelInterruptConfirmation, } from '@aragon-agent/tui/input/interrupt-gesture';
13
14
  import { initialViewState, viewReducer, } from '@aragon-agent/tui/model/agent/reducer';
@@ -93,6 +94,14 @@ import { INITIAL_MEMORY_STATE, memoryReducer } from '@aragon-agent/tui/ui/overla
93
94
  import { memoryChipFacts } from '@aragon-agent/tui/ui/layout/memory-chip';
94
95
  import { memoryRepairCopy } from '@aragon-agent/tui/model/memory/copy';
95
96
  import { takeMemoryRepairNotice } from '../memory/store.js';
97
+ // Gene Bank (gene-bank spec 12): the manager, its state machine (OWNED HERE, RV-11) and the
98
+ // status chip. The overlay is a pure function of the state and a `GeneManagerPort`.
99
+ import { GeneOverlay } from '@aragon-agent/tui/ui/overlays/GeneOverlay';
100
+ import { INITIAL_GENE_STATE, geneReducer, } from '@aragon-agent/tui/ui/overlays/gene-state';
101
+ import { geneKeyLetter, isGeneToggleKey } from '@aragon-agent/tui/ui/overlays/gene-keys';
102
+ import { chipFacts as geneChipFactsOf } from '@aragon-agent/tui/model/gene/activity';
103
+ import { geneHintCopy } from '@aragon-agent/tui/model/gene/copy';
104
+ import { explainAvailableFor } from '../gene/explain.js';
96
105
  import { draftToInput } from '@aragon-agent/tui/ui/overlays/prompt-library-state';
97
106
  import { createPrompt, deletePrompt, flushPromptStats, loadPromptLibrary, movePrompt, recordPromptUse, setPromptFavorite, takePromptRepairNotice, updatePrompt, } from '../prompts/store.js';
98
107
  import { resolvePromptRef } from '../prompts/resolve.js';
@@ -288,6 +297,13 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
288
297
  const [memoryState, memoryDispatch] = useReducer(memoryReducer, INITIAL_MEMORY_STATE);
289
298
  const [memoryIntent, setMemoryIntent] = useState(null);
290
299
  const memoryIntentNonce = useRef(0);
300
+ // --- Gene Bank (gene-bank spec 12.2) -----------------------------------------------------
301
+ // THE SAME RULE AS MEMORY ABOVE (RV-11): the page stack and the editor draft live HERE, so an
302
+ // approval the agent asks for while the manager is open (`suspendedOverlay`) cannot destroy a
303
+ // half-written gene.
304
+ const [geneState, geneDispatch] = useReducer(geneReducer, INITIAL_GENE_STATE);
305
+ const [geneIntent, setGeneIntent] = useState(null);
306
+ const geneIntentNonce = useRef(0);
291
307
  /** The composer's draft text, kept current by `PromptInput`; read on ONE keypress. */
292
308
  const draftTextRef = useRef('');
293
309
  /** What the manager was opened with: the draft and the last reply, for `c` and `l`. */
@@ -1407,6 +1423,41 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
1407
1423
  memoryDispatch({ type: 'reset' });
1408
1424
  dispatch({ type: 'setOverlay', overlay: null });
1409
1425
  }, []);
1426
+ /**
1427
+ * Open the gene manager on a page (gene-bank spec 12.1). The nonce is bumped BEFORE the overlay
1428
+ * opens and the overlay consumes it at most once (two `/gene` in a row are two intents).
1429
+ */
1430
+ const openGene = useCallback((entry) => {
1431
+ geneIntentNonce.current += 1;
1432
+ setGeneIntent({ nonce: geneIntentNonce.current, entry });
1433
+ dispatch({ type: 'setOverlay', overlay: 'gene' });
1434
+ }, []);
1435
+ const closeGene = useCallback(() => {
1436
+ geneDispatch({ type: 'reset' });
1437
+ dispatch({ type: 'setOverlay', overlay: null });
1438
+ }, []);
1439
+ // The overlay's whole view of the library: ONE port, shared with `/gene` and (through the host
1440
+ // facade) the desktop. Absent for a host without the library (off, headless, a test double),
1441
+ // in which case the key does nothing and `/gene` says why.
1442
+ const genePort = useMemo(() => (typeof controller.getGeneManager === 'function' ? controller.getGeneManager() ?? null : null), [controller]);
1443
+ // The unified status (I-23): the chip, the overlay header and `/gene status` all read THIS.
1444
+ const [geneView, setGeneView] = useState(() => (typeof controller.getGeneView === 'function' ? controller.getGeneView() : null));
1445
+ useEffect(() => {
1446
+ if (typeof controller.subscribeGene !== 'function')
1447
+ return undefined;
1448
+ return controller.subscribeGene(() => setGeneView(controller.getGeneView()));
1449
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1450
+ }, [controller]);
1451
+ // The one-time "Ctrl+Q opens the Gene Bank" hint (I3-9 U-1). The hub raises it once per library
1452
+ // and records that on disk, so this only has to say it when it arrives, never twice in a session.
1453
+ const geneHintShown = useRef(false);
1454
+ useEffect(() => {
1455
+ if (geneView?.hint === undefined || geneHintShown.current)
1456
+ return;
1457
+ geneHintShown.current = true;
1458
+ toast('info', geneHintCopy(geneView.hint, controller.getConfig().gene?.key ?? 'ctrl+q'));
1459
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1460
+ }, [geneView?.hint]);
1410
1461
  // The overlay's whole view of the session: a port over the controller's service. Absent for a
1411
1462
  // host without memory (a test double, a headless run), in which case the overlay never opens.
1412
1463
  const memoryPort = useMemo(() => {
@@ -1996,6 +2047,29 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
1996
2047
  openMemory(entry);
1997
2048
  },
1998
2049
  },
2050
+ // The Gene Bank's host for `/gene` (spec 16.3). OMITTED when the library is off, so the
2051
+ // command says so instead of acting on a manager that does not exist.
2052
+ ...(genePort
2053
+ ? {
2054
+ gene: {
2055
+ manager: genePort,
2056
+ control: {
2057
+ getView: () => controller.getGeneView(),
2058
+ curator: (action) => controller.geneCurator(action),
2059
+ },
2060
+ // Persisted AND applied to this session at once (I-18); a failed write is a toast.
2061
+ setUse: (value) => {
2062
+ controller.setGeneConfig({ use: value });
2063
+ persistConfig({ gene: { use: value } });
2064
+ },
2065
+ setAutoLearn: (value) => {
2066
+ controller.setGeneConfig({ autoLearn: value });
2067
+ persistConfig({ gene: { autoLearn: value } });
2068
+ },
2069
+ openManager: (page) => openGene(page && page !== 'list' ? { kind: 'page', page } : { kind: 'list' }),
2070
+ },
2071
+ }
2072
+ : {}),
1999
2073
  setOverlay: (overlay) => dispatch({ type: 'setOverlay', overlay }),
2000
2074
  // THE TASK LABEL PORT (`/keys`, `/task`; §6.4). Reads go through `stateRef` so a
2001
2075
  // command always sees the LATEST label rather than the one from the render that
@@ -2681,6 +2755,22 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
2681
2755
  openMemory({ kind: 'list' });
2682
2756
  return;
2683
2757
  }
2758
+ // Ctrl+Q / Alt+Q: the gene manager (gene-bank spec 12.1). Ctrl+Q is the unambiguous C0 byte
2759
+ // 0x11 (unlike Ctrl+M / Ctrl+I it needs no key frame), the Alt twin is ALWAYS live because
2760
+ // VS Code's terminal and tmux can swallow the control key, and `gene.key` is read at KEY
2761
+ // TIME so a settings change needs no restart. Same guards and the same position as Ctrl+M:
2762
+ // BEFORE the `tooSmall` return, so "the key did nothing" stays distinguishable from "the key
2763
+ // never arrived". The overlay closes itself on the same key (it owns the unsaved-draft check).
2764
+ if (isGeneToggleKey(input, key, geneKeyLetter(controller.getConfig().gene?.key ?? 'ctrl+q'))) {
2765
+ if (tooSmall || (stateRef.current.overlay && stateRef.current.overlay !== 'gene'))
2766
+ return;
2767
+ if (stateRef.current.overlay === 'gene')
2768
+ return;
2769
+ if (controller.getConfig().gene?.enabled !== true || !genePort)
2770
+ return;
2771
+ openGene({ kind: 'list' });
2772
+ return;
2773
+ }
2684
2774
  // Ctrl+L: branch this session into a NEW terminal (tui-branch-terminal-
2685
2775
  // shortcut D-1 / D-2). Guarded exactly like Ctrl+G and Ctrl+I above it: an
2686
2776
  // overlay owns the keyboard, and on a too-small terminal the feedback has
@@ -2721,7 +2811,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
2721
2811
  // nothing and the wheel falls through to the transcript behind it.
2722
2812
  || overlay === 'prompts' || overlay === 'prompt-pick'
2723
2813
  // The memory manager pages through `overlayScroll` too (agent-memory V-4).
2724
- || overlay === 'memory';
2814
+ || overlay === 'memory'
2815
+ // And so does the gene manager (gene-bank 12.2).
2816
+ || overlay === 'gene';
2725
2817
  if (key.pageUp) {
2726
2818
  if (controlled)
2727
2819
  setOverlayScroll((n) => Math.max(0, n - overlayPage));
@@ -2895,6 +2987,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
2895
2987
  // and nothing else could close it.
2896
2988
  if (overlay === 'memory' && memoryPort)
2897
2989
  return;
2990
+ // THE GENE MANAGER OWNS ITS Esc for the same reason: the editor's first Esc only arms the discard.
2991
+ if (overlay === 'gene' && genePort)
2992
+ return;
2898
2993
  // THE WAIVER'S `Esc` (4.3). App owns the key for the plan overlays and for this one, so
2899
2994
  // declining and draining the queue happen in ONE place - the overlay registers no Escape
2900
2995
  // handler of its own, and a second one would decline twice.
@@ -3018,6 +3113,9 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
3018
3113
  .filter((kit) => kit.id !== activeKit.id).map((kit) => kit.name),
3019
3114
  };
3020
3115
  const memoryChip = memoryChipFacts(memoryView) ?? undefined;
3116
+ // THE GENE CHIP (gene-bank 12.3): `show` is false for an empty, idle library, which keeps the
3117
+ // row byte-identical to the build without the feature for everyone who has no genes.
3118
+ const geneChip = geneView && geneView.available ? geneChipFactsOf(geneView) : null;
3021
3119
  const empty = state.entries.length === 0;
3022
3120
  // RENDER SCOPE, so the chip and the composer hint agree with what the Ctrl+C
3023
3121
  // handler will do on the very next keystroke.
@@ -3235,7 +3333,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
3235
3333
  // user cannot even OPEN reads as a broken key.
3236
3334
  busy: controller.isModelSettingsBusy(), maxRows: overlayMaxRows, cols: viewCols, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onChoose: handleKitChoose, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompts' ? (_jsx(PromptLibraryOverlay, { isActive: !tooSmall, library: promptLibrary, ...(promptIntent ? { intent: promptIntent } : {}), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onMutate: handlePromptMutate, onNotice: notify, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'prompt-pick' ? (_jsx(PromptPicker, { isActive: !tooSmall, library: promptLibrary, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onFill: handlePromptFill, onManage: (entry) => openPromptLibrary(entry), onClose: closePromptPicker })) : overlay === 'memory' && memoryPort ? (_jsx(MemoryOverlay, { isActive: !tooSmall, state: memoryState, dispatch: memoryDispatch, port: memoryPort, ...(memoryIntent ? { intent: memoryIntent } : {}), context: memoryContext.current, cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, reducedMotion: cfg.reducedMotion ?? false, ...(terminal?.enhancedKeys === undefined ? {} : { enhancedKeys: terminal.enhancedKeys }),
3237
3335
  // Outcomes are toasts (they expire); the editor's own error row is what stays on screen.
3238
- onNotice: (level, text) => toast(level === 'info' ? 'success' : level, text), onClose: closeMemory })) : overlay === 'settings' ? (_jsx(SettingsScreen, { isActive: !tooSmall, initial: {
3336
+ onNotice: (level, text) => toast(level === 'info' ? 'success' : level, text), onClose: closeMemory })) : overlay === 'gene' && genePort && geneView ? (_jsx(GeneOverlay, { isActive: !tooSmall, state: geneState, dispatch: geneDispatch, port: genePort, view: geneView, ...(geneIntent ? { intent: geneIntent } : {}), cols: viewCols, maxRows: overlayMaxRows, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, reducedMotion: cfg.reducedMotion ?? false, configuredKey: cfg.gene?.key ?? 'ctrl+q', explainAvailable: explainAvailableFor(cfg.gene?.explainLanguage ?? 'auto', process.env.LC_ALL ?? process.env.LANG ?? '', controller.getFastStatus().tier.ok), onNotice: (level, text) => toast(level === 'info' ? 'success' : level, text), onClose: closeGene })) : overlay === 'settings' ? (_jsx(SettingsScreen, { isActive: !tooSmall, initial: {
3239
3337
  provider: cfg.provider,
3240
3338
  model: cfg.model,
3241
3339
  baseUrl: cfg.baseUrl ?? '',
@@ -3465,7 +3563,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
3465
3563
  const rail = fullscreenRailVisible && state.todos ? (_jsx(TodoPanel, { snapshot: state.todos, width: railWidth, rows: railRows, running: running, reducedMotion: viewReducedMotion, theme: theme, caps: caps })) : null;
3466
3564
  const viewport = (_jsxs(ScrollViewport, { active: overlay === null && !tooSmall, overlay: overlayNode, footer: _jsxs(_Fragment, { children: [team, _jsx(QueuePanel, { layout: queueLayout, theme: theme })] }), rail: rail, scrollbar: terminal?.scrollbar, resetKey: scrollResetKey, intent: scrollIntent, pinToBottomNonce: pinToBottomNonce, onScrolledLinesChange: setScrolledLines, onViewportShiftChange: onViewportShiftChange, onGeometryChange: onGeometryChange, geometryKey: `${rows}:${cols}:${viewportBudget}:${frameBudget.composerSlotRows}:${frameBudget.statusRows}:${contentCols}:${overlay}:${tooSmall}`, tailRowsRef: tailSink, hold: selectionHold, resumeMs: cfg.scrollResumeMs, showScrollIndicator: true, cols: contentCols, theme: theme, caps: caps, children: [opener, _jsx(TranscriptList, { entries: transcriptEntries, expandedToolIds: state.expandedToolIds, thinkingVisible: state.thinkingVisible, reducedMotion: viewReducedMotion, voice: voice, density: density, nowSec: nowSec, theme: theme, caps: caps, windowSize: transcriptWindow, cols: contentCols, heights: heights, mountedSink: mountedCount, tailSink: tailSink })] }));
3467
3565
  const detailsNode = _jsx(BottomStatusRow, { plan: details, columns: viewCols, theme: theme });
3468
- const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}), ...(memoryChip ? { memory: memoryChip } : {}), ...(redTeam.view.available && redTeam.view.armed
3566
+ const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}), ...(memoryChip ? { memory: memoryChip } : {}), ...(geneChip && geneChip.show ? { gene: geneChip } : {}), ...(redTeam.view.available && redTeam.view.armed
3469
3567
  ? { redteam: { armed: redTeam.view.armed, paused: redTeam.view.paused } }
3470
3568
  : {}), waitingForConfirmation: !!humanRequest || !!confirmState, stopping: interruptGesture.current.phase === 'stopping', interruptHint: interruptGesture.current.phase === 'stopping'
3471
3569
  ? 'Esc force-stop' : 'Esc x2 interrupt', model: cfg.model, provider: cfg.provider, usageTotal: state.usageTotal,
package/dist/cli.js CHANGED
@@ -15,7 +15,7 @@ import { runHistoryCommand } from './config/history-commands.js';
15
15
  import { checkGovernanceCommandLine } from './config/governance-launch.js';
16
16
  import { checkRedTeamCommandLine } from './config/redteam-launch.js';
17
17
  import { getRedTeamWaiverVersion, isRedTeamEnvOff } from './config/ui-state.js';
18
- import { COMPACTION_CONFIG_SET_KEYS, FAST_CONFIG_SET_KEYS, LOG_CONFIG_SET_KEYS, RETRY_CONFIG_SET_KEYS, TEAM_CONFIG_SET_KEYS, GOVERNANCE_CONFIG_SET_KEYS, MEMORY_CONFIG_SET_KEYS, applyMemoryConfigSet, JOBS_CONFIG_SET_KEYS, TASK_SUMMARY_CONFIG_SET_KEYS, UPDATE_CONFIG_SET_KEYS, applyCompactionConfigSet, applyFastConfigSet, applyLogConfigSet, applyRetryConfigSet, applyTeamConfigSet, applyGovernanceConfigSet, applyJobsConfigSet, applyTaskSummaryConfigSet, applyUpdateConfigSet, runConfigEdit, runConfigGet, runConfigHome, runConfigList, warnIfRedactionDisabled, } from './config/cli-commands.js';
18
+ import { COMPACTION_CONFIG_SET_KEYS, FAST_CONFIG_SET_KEYS, LOG_CONFIG_SET_KEYS, RETRY_CONFIG_SET_KEYS, TEAM_CONFIG_SET_KEYS, GOVERNANCE_CONFIG_SET_KEYS, MEMORY_CONFIG_SET_KEYS, applyMemoryConfigSet, GENE_CONFIG_SET_KEYS, applyGeneConfigSet, JOBS_CONFIG_SET_KEYS, TASK_SUMMARY_CONFIG_SET_KEYS, UPDATE_CONFIG_SET_KEYS, applyCompactionConfigSet, applyFastConfigSet, applyLogConfigSet, applyRetryConfigSet, applyTeamConfigSet, applyGovernanceConfigSet, applyJobsConfigSet, applyTaskSummaryConfigSet, applyUpdateConfigSet, runConfigEdit, runConfigGet, runConfigHome, runConfigList, warnIfRedactionDisabled, } from './config/cli-commands.js';
19
19
  import { attachAgentEvents, attachTeamEvents, installLogging, setScreenRestore, setSignalTerminator, } from './logging/install.js';
20
20
  import { getLogger } from './logging/logger.js';
21
21
  import { runLogsCommand } from './logging/cli-commands.js';
@@ -29,6 +29,7 @@ import { runHeadless } from './agent/headless.js';
29
29
  // `history` / `skills` convention.
30
30
  import { registerExecCommand } from './exec/cli-commands.js';
31
31
  import { registerSessionsCommand } from './session/cli-commands.js';
32
+ import { registerGeneCliCommand } from './gene/cli-commands.js';
32
33
  import { registerDoctorCommand, registerInfoCommand } from './diagnostics/cli-commands.js';
33
34
  import { App } from './app/App.js';
34
35
  import { createSessionWriter, makeController, readCliVersion, } from './host/controller-factory.js';
@@ -224,6 +225,10 @@ function toFlags(opts) {
224
225
  // that passed no flag at all.
225
226
  redteam: opts.redteam === true ? true : undefined,
226
227
  noRedteam: opts.redteam === false ? true : undefined,
228
+ // Site three of three for `--no-gene`, declared alone like `--no-memory`: commander
229
+ // defaults `opts.gene` to `true` when it is absent, so only an explicit `false` is forwarded
230
+ // (as `noGene: true`) and silence can never read as an override.
231
+ noGene: opts.gene === false ? true : undefined,
227
232
  // Site three of three for `--resume` / `--save` -- ELEVEN features, one trap
228
233
  // (`mouse` P1-2, `team` P1-4, `todo` C-9, render L4, retry, fast, update,
229
234
  // compaction, now session identity). A flag needs the `.option()`
@@ -1492,6 +1497,12 @@ const CONFIG_SET_KEYS = new Set([
1492
1497
  // spec 5.6): without this line they fall through to `Unknown config key`, and without the
1493
1498
  // matching case in `runConfigSet` the membership set accepts a write that never happens.
1494
1499
  ...MEMORY_CONFIG_SET_KEYS,
1500
+ // `gene.*` keys are handled by `applyGeneConfigSet`, same reasoning again (gene-bank spec
1501
+ // 14.1): without this line they fall through to `Unknown config key`, and without the
1502
+ // matching branch in `runConfigSetValue` the membership set accepts a write that never
1503
+ // happens. `gene.use` / `gene.autoLearn` are the two user switches (14.2), so a script that
1504
+ // cannot set them cannot honour the user's own off-switch.
1505
+ ...GENE_CONFIG_SET_KEYS,
1495
1506
  ]);
1496
1507
  /**
1497
1508
  * `aragon config set maxTokens <n|auto|default>`.
@@ -1681,6 +1692,16 @@ function runConfigSetValue(key, value) {
1681
1692
  process.stdout.write(`Set ${key} = ${String(merged.memory?.[field])}\n`);
1682
1693
  return;
1683
1694
  }
1695
+ const genePatch = applyGeneConfigSet(key, value);
1696
+ if (genePatch) {
1697
+ // Echoed from the STORED value, like every section above: `config set gene.probeMode all`
1698
+ // prints `readonly`, and `config set gene.pinnedMax 9999` prints the value clamped against
1699
+ // the stored `capPerType`, which is what the read path will report.
1700
+ const merged = updatePersistedConfig(genePatch);
1701
+ const field = key.slice('gene.'.length);
1702
+ process.stdout.write(`Set ${key} = ${String(merged.gene[field])}\n`);
1703
+ return;
1704
+ }
1684
1705
  const patch = {};
1685
1706
  switch (key) {
1686
1707
  case 'provider':
@@ -2121,6 +2142,11 @@ function buildProgram() {
2121
2142
  // could accept it, and an armed session nobody can leave is worse than no armed session.
2122
2143
  .option('--redteam', 'Start this session in red team / security mode (needs the waiver accepted)')
2123
2144
  .option('--no-redteam', 'Disable red team mode for this launch (no chip, no key; not persisted)')
2145
+ // Negative-only for the reason `--no-memory` records: it can only ever switch the Gene Bank
2146
+ // off for this launch (no service, no tools, byte-identical prompt), and `toFlags` forwards
2147
+ // it only when explicitly given. The positive `--gene` / `--gene-learn` belong to the
2148
+ // headless paths and are declared with their behaviour, not here (gene-bank spec 14.3).
2149
+ .option('--no-gene', 'Disable the Gene Bank for this launch (no gene tools or prompt block; not persisted)')
2124
2150
  .option('--no-skills', 'Disable the skill system entirely (no catalog, no skill tools)')
2125
2151
  .option('--skill <name>', 'Force-load a skill at Level 2 for this run (repeatable)', (value, previous = []) => [...previous, value])
2126
2152
  .option('--skills-yes', 'Approve skill installs for this run (CI / headless)')
@@ -2341,6 +2367,8 @@ function buildProgram() {
2341
2367
  makeController: makeExecController,
2342
2368
  });
2343
2369
  registerSessionsCommand(program);
2370
+ // `aragon gene ...` (gene-bank spec 16.4): list | show | search | export | import | stats | fsck.
2371
+ registerGeneCliCommand(program);
2344
2372
  registerInfoCommand(program, toFlags, VERSION);
2345
2373
  registerDoctorCommand(program, toFlags);
2346
2374
  return program;
@@ -26,6 +26,7 @@ import { getLogger } from '../logging/logger.js';
26
26
  import { registerQueueCommand } from './queue-command.js';
27
27
  import { registerPromptCommands } from '../prompts/command.js';
28
28
  import { registerMemoryCommands } from '../memory/command.js';
29
+ import { registerGeneCommands } from '../gene/command.js';
29
30
  import { registerKitCommand } from './kit-command.js';
30
31
  import { registerAgentsCommand } from './agents-command.js';
31
32
  import { registerSubagentCommand } from './subagent-command.js';
@@ -1386,6 +1387,9 @@ export function registerBuiltinCommands(registry) {
1386
1387
  registerPromptCommands(registry);
1387
1388
  // UNCONDITIONAL, like `/prompts`: with `memory.enabled=false` the command stays and says so.
1388
1389
  registerMemoryCommands(registry);
1390
+ // UNCONDITIONAL, like `/memory`: with `gene.enabled=false` (or `--no-gene`) the command stays and
1391
+ // says so (gene-bank spec 16.3). Its capabilities arrive on `CommandContext.gene`.
1392
+ registerGeneCommands(registry);
1389
1393
  // The read-only subagent board (tui-subagent-panel §6.4). Same shape again: the
1390
1394
  // body is `commands/agents-command.ts` and the registration is this one line.
1391
1395
  registerAgentsCommand(registry);
@@ -44,6 +44,7 @@ export const BUILTIN_COMMAND_CATALOG = [
44
44
  { name: 'kit', aliases: [], description: 'Agent kits: status, list, use for this session' },
45
45
  { name: 'prompts', aliases: [], description: 'Quick prompt library: pick, list, add, edit, remove, reorder' },
46
46
  { name: 'memory', aliases: ['mem'], description: 'Memory manager: list, save, show, remove, mount, auto-load, agent writes' },
47
+ { name: 'gene', aliases: ['genes'], description: 'Gene Bank: status, search, show, explain, pin, archive, rollback, queue, stats, export, import, import-memory' },
47
48
  { name: 'agents', aliases: [], description: 'Open the subagent board: every child, its facts and its timeline' },
48
49
  { name: 'subagent', aliases: [], description: 'Deprecated alias of /team - same arguments' },
49
50
  { name: 'team', aliases: [], description: 'Force team mode and start now: /team <brief>; /team [on [n]|off|status]' },
@@ -15,6 +15,7 @@ import type { SessionCommandPort } from './session-command.js';
15
15
  import type { BranchCommandPort } from './branch-command.js';
16
16
  import type { PromptCommandPort } from '@aragon-agent/tui/model/prompts/types';
17
17
  import type { MemoryCommandPort } from '@aragon-agent/tui/model/memory/types';
18
+ import type { GeneCommandHost } from '../gene/command.js';
18
19
  export interface CommandContext {
19
20
  /** App-owned shared lock and single feedback path for command and selection copies. */
20
21
  requestCopy?: (request: CopyRequest) => Promise<CopyRequestResult>;
@@ -194,6 +195,13 @@ export interface CommandContext {
194
195
  * constructed by literal in dozens of fixtures. TYPE-ONLY import: the command needs the SHAPE.
195
196
  */
196
197
  memory?: MemoryCommandPort;
198
+ /**
199
+ * The Gene Bank's host (gene-bank spec 16.3): the manager over this session's library, the live
200
+ * status and curator switch, the two persisted switches and "open the overlay". OPTIONAL for the
201
+ * reason `prompts` above records - `CommandContext` is constructed by literal in dozens of
202
+ * fixtures. Absent means a headless or sub-agent session, and `/gene` says so.
203
+ */
204
+ gene?: GeneCommandHost;
197
205
  /**
198
206
  * The task label's three capabilities (`/keys`, `/task`; tui-shortcut-drawer-and-
199
207
  * task-summary §6.4).
@@ -174,6 +174,16 @@ export declare function getGovernanceDir(): string;
174
174
  * The caller creates it (0700 on POSIX); this function only names it.
175
175
  */
176
176
  export declare function getMemoryDir(): string;
177
+ /**
178
+ * `<home>/genes` - the Gene Bank (gene-bank spec 6.8).
179
+ *
180
+ * ITS OWN ROOT, for the reason `getMemoryDir` records. Derived from the same
181
+ * `resolution.root`, so the `ARAGON_HOME` / VITEST isolation contract at the top of this file
182
+ * covers it too: a test that clears `getGeneDir()` recursively would be deleting a real
183
+ * user's library, so tests delete directories they built themselves. The caller creates it
184
+ * (0700 on POSIX); this function only names it.
185
+ */
186
+ export declare function getGeneDir(): string;
177
187
  /** `<home>` — parent of `skills/`, and where sidecar state such as usage lives. */
178
188
  export declare function getUserDataDir(): string;
179
189
  export declare function getUserSkillsDir(): string;
@@ -269,6 +269,18 @@ export function getGovernanceDir() {
269
269
  export function getMemoryDir() {
270
270
  return join(resolution.root, 'memory');
271
271
  }
272
+ /**
273
+ * `<home>/genes` - the Gene Bank (gene-bank spec 6.8).
274
+ *
275
+ * ITS OWN ROOT, for the reason `getMemoryDir` records. Derived from the same
276
+ * `resolution.root`, so the `ARAGON_HOME` / VITEST isolation contract at the top of this file
277
+ * covers it too: a test that clears `getGeneDir()` recursively would be deleting a real
278
+ * user's library, so tests delete directories they built themselves. The caller creates it
279
+ * (0700 on POSIX); this function only names it.
280
+ */
281
+ export function getGeneDir() {
282
+ return join(resolution.root, 'genes');
283
+ }
272
284
  /** `<home>` — parent of `skills/`, and where sidecar state such as usage lives. */
273
285
  export function getUserDataDir() {
274
286
  return resolution.root;
@@ -106,6 +106,16 @@ export declare const GOVERNANCE_CONFIG_SET_KEYS: readonly ["governance.enabled",
106
106
  * Every key is writable and ONE level deep, so `runConfigGet`'s single-dot split resolves it.
107
107
  */
108
108
  export declare const MEMORY_CONFIG_SET_KEYS: readonly ["memory.enabled", "memory.autoload", "memory.agentWrites", "memory.indexMaxChars", "memory.bodyBudgetChars", "memory.perBodyMaxChars"];
109
+ /**
110
+ * Config keys under `gene.` that `aragon config set` accepts (gene-bank spec 14.1).
111
+ *
112
+ * EVERY KEY OF `GeneConfig` IS LISTED, strings and enums included, and ONE level deep so
113
+ * `runConfigGet`'s single-dot split resolves it. `gene-config.test.ts` pins this set against
114
+ * `Object.keys(DEFAULT_GENE_CONFIG)`: a key added to the section and forgotten here is
115
+ * visible in `config list` and refused by `config set` as "Unknown config key" - the gap
116
+ * `COMPACTION_CONFIG_SET_KEYS` records at length.
117
+ */
118
+ export declare const GENE_CONFIG_SET_KEYS: readonly ["gene.enabled", "gene.use", "gene.autoLearn", "gene.capPerType", "gene.pinnedMax", "gene.candidateMax", "gene.versionsKept", "gene.archiveMaxMB", "gene.reviewerMaxItems", "gene.reviewerMaxTokens", "gene.mainMaxItems", "gene.mainMaxTokens", "gene.subagentMaxItems", "gene.subagentMaxTokens", "gene.hints", "gene.reviewerModel", "gene.curatorModel", "gene.curatorConcurrency", "gene.curatorTaskTokens", "gene.dailyTokens", "gene.learnMinIntervalSec", "gene.learnMaxPerSession", "gene.toolsAllowNetwork", "gene.probeMode", "gene.teamPath", "gene.teamTrusted", "gene.key", "gene.explainLanguage", "gene.holdoutPercent", "gene.importMaxItems"];
109
119
  /**
110
120
  * Translate a `log.*` dotted key into a patch, or `null` for anything else.
111
121
  *
@@ -164,6 +174,25 @@ export declare function applyGovernanceConfigSet(key: string, value: string): Pa
164
174
  * `memory` (the tenth time that trap is recorded in `store.ts`).
165
175
  */
166
176
  export declare function applyMemoryConfigSet(key: string, value: string): Partial<PersistedConfig> | null;
177
+ /**
178
+ * Translate a `gene.*` dotted key into a patch, or `null` for anything else.
179
+ *
180
+ * EVERY KEY ROUTES THROUGH `clampGeneConfig`, so `config set gene.probeMode all` stores
181
+ * `readonly` (the safe direction; there is no wider value) and the caller echoes the STORED
182
+ * value. Booleans, numbers and strings are typed by the DEFAULT's runtime type; an unparseable
183
+ * number becomes `NaN`, which the clamp repairs to the default - the "typo changes nothing"
184
+ * rule.
185
+ *
186
+ * ONE CROSS-FIELD CASE: `pinnedMax` is clamped against `capPerType`, and this function does
187
+ * not know the STORED `capPerType`. Clamping against the default's 5000 would refuse
188
+ * `pinnedMax 20000` for a user whose stored cap is 50000, so that key is validated against the
189
+ * loosest cap here and the real bound is applied by `updatePersistedConfig`, which re-clamps
190
+ * the merged section (the second half of the two-direction gate).
191
+ *
192
+ * The patch is a PARTIAL section, safe only because `updatePersistedConfig` deep-merges
193
+ * `gene` (the twelfth time that trap is recorded in `store.ts`).
194
+ */
195
+ export declare function applyGeneConfigSet(key: string, value: string): Partial<PersistedConfig> | null;
167
196
  /**
168
197
  * Translate a `team.*` dotted key into a patch, or `null` for anything else.
169
198
  *
@@ -14,7 +14,7 @@ import { getConfigBackupPath, getConfigPath, getHomeRoot, getLogsDir, getPromptH
14
14
  import { getHomeMigrationBreadcrumbPath } from './migrate-home.js';
15
15
  import { loadPersistedConfig, updatePersistedConfig } from './store.js';
16
16
  import { normalizeModelProfiles, validateModelProfiles } from '@aragon-agent/tui/model/config/model-profiles';
17
- import { clampFastConfig, clampRetryConfig, clampCompactionConfig, clampTeamConfig, parseThresholdInput, clampUpdateConfig, coercePositiveInt, maskSecret, DEFAULT_FAST_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_TEAM_CONFIG, DEFAULT_COMPACTION_CONFIG, DEFAULT_UPDATE_CONFIG, DEFAULT_JOBS_CONFIG, clampJobsConfig, clampGovernanceConfig, clampMemoryConfig, DEFAULT_GOVERNANCE_CONFIG, DEFAULT_MEMORY_CONFIG, } from '@aragon-agent/tui/model/config/schema';
17
+ import { clampFastConfig, clampRetryConfig, clampCompactionConfig, clampTeamConfig, parseThresholdInput, clampUpdateConfig, coercePositiveInt, maskSecret, DEFAULT_FAST_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_TEAM_CONFIG, DEFAULT_COMPACTION_CONFIG, DEFAULT_UPDATE_CONFIG, DEFAULT_JOBS_CONFIG, clampJobsConfig, clampGovernanceConfig, clampMemoryConfig, clampGeneConfig, DEFAULT_GOVERNANCE_CONFIG, DEFAULT_MEMORY_CONFIG, DEFAULT_GENE_CONFIG, } from '@aragon-agent/tui/model/config/schema';
18
18
  import { clampLogLevel } from '@aragon-agent/tui/model/logging/levels';
19
19
  /** Config keys under `log.` that `aragon config set` accepts. */
20
20
  export const LOG_CONFIG_SET_KEYS = [
@@ -196,6 +196,47 @@ export const MEMORY_CONFIG_SET_KEYS = [
196
196
  'memory.bodyBudgetChars',
197
197
  'memory.perBodyMaxChars',
198
198
  ];
199
+ /**
200
+ * Config keys under `gene.` that `aragon config set` accepts (gene-bank spec 14.1).
201
+ *
202
+ * EVERY KEY OF `GeneConfig` IS LISTED, strings and enums included, and ONE level deep so
203
+ * `runConfigGet`'s single-dot split resolves it. `gene-config.test.ts` pins this set against
204
+ * `Object.keys(DEFAULT_GENE_CONFIG)`: a key added to the section and forgotten here is
205
+ * visible in `config list` and refused by `config set` as "Unknown config key" - the gap
206
+ * `COMPACTION_CONFIG_SET_KEYS` records at length.
207
+ */
208
+ export const GENE_CONFIG_SET_KEYS = [
209
+ 'gene.enabled',
210
+ 'gene.use',
211
+ 'gene.autoLearn',
212
+ 'gene.capPerType',
213
+ 'gene.pinnedMax',
214
+ 'gene.candidateMax',
215
+ 'gene.versionsKept',
216
+ 'gene.archiveMaxMB',
217
+ 'gene.reviewerMaxItems',
218
+ 'gene.reviewerMaxTokens',
219
+ 'gene.mainMaxItems',
220
+ 'gene.mainMaxTokens',
221
+ 'gene.subagentMaxItems',
222
+ 'gene.subagentMaxTokens',
223
+ 'gene.hints',
224
+ 'gene.reviewerModel',
225
+ 'gene.curatorModel',
226
+ 'gene.curatorConcurrency',
227
+ 'gene.curatorTaskTokens',
228
+ 'gene.dailyTokens',
229
+ 'gene.learnMinIntervalSec',
230
+ 'gene.learnMaxPerSession',
231
+ 'gene.toolsAllowNetwork',
232
+ 'gene.probeMode',
233
+ 'gene.teamPath',
234
+ 'gene.teamTrusted',
235
+ 'gene.key',
236
+ 'gene.explainLanguage',
237
+ 'gene.holdoutPercent',
238
+ 'gene.importMaxItems',
239
+ ];
199
240
  function isTrue(value) {
200
241
  return value === 'true' || value === '1';
201
242
  }
@@ -323,6 +364,40 @@ export function applyMemoryConfigSet(key, value) {
323
364
  const clamped = clampMemoryConfig({ ...DEFAULT_MEMORY_CONFIG, [field]: typed });
324
365
  return { memory: { [field]: clamped[field] } };
325
366
  }
367
+ /** The loosest `capPerType` the clamp accepts; see `applyGeneConfigSet`'s `pinnedMax` note. */
368
+ const GENE_CAP_PER_TYPE_CEILING = 50_000;
369
+ /**
370
+ * Translate a `gene.*` dotted key into a patch, or `null` for anything else.
371
+ *
372
+ * EVERY KEY ROUTES THROUGH `clampGeneConfig`, so `config set gene.probeMode all` stores
373
+ * `readonly` (the safe direction; there is no wider value) and the caller echoes the STORED
374
+ * value. Booleans, numbers and strings are typed by the DEFAULT's runtime type; an unparseable
375
+ * number becomes `NaN`, which the clamp repairs to the default - the "typo changes nothing"
376
+ * rule.
377
+ *
378
+ * ONE CROSS-FIELD CASE: `pinnedMax` is clamped against `capPerType`, and this function does
379
+ * not know the STORED `capPerType`. Clamping against the default's 5000 would refuse
380
+ * `pinnedMax 20000` for a user whose stored cap is 50000, so that key is validated against the
381
+ * loosest cap here and the real bound is applied by `updatePersistedConfig`, which re-clamps
382
+ * the merged section (the second half of the two-direction gate).
383
+ *
384
+ * The patch is a PARTIAL section, safe only because `updatePersistedConfig` deep-merges
385
+ * `gene` (the twelfth time that trap is recorded in `store.ts`).
386
+ */
387
+ export function applyGeneConfigSet(key, value) {
388
+ if (!GENE_CONFIG_SET_KEYS.includes(key))
389
+ return null;
390
+ const field = key.slice('gene.'.length);
391
+ const trimmed = value.trim();
392
+ const kind = typeof DEFAULT_GENE_CONFIG[field];
393
+ const typed = kind === 'boolean' ? isTrue(trimmed) : kind === 'number' ? (trimmed === '' ? Number.NaN : Number(trimmed)) : trimmed;
394
+ const clamped = clampGeneConfig({
395
+ ...DEFAULT_GENE_CONFIG,
396
+ ...(field === 'pinnedMax' ? { capPerType: GENE_CAP_PER_TYPE_CEILING } : {}),
397
+ [field]: typed,
398
+ });
399
+ return { gene: { [field]: clamped[field] } };
400
+ }
326
401
  function parseGovernanceArgument(field, value) {
327
402
  const kind = typeof DEFAULT_GOVERNANCE_CONFIG[field];
328
403
  const trimmed = value.trim();
@@ -24,7 +24,8 @@
24
24
  * ARAGON_PROMPTS (the quick-prompt library's `enabled` switch, and only that),
25
25
  * ARAGON_MEMORY (agent memory's kill switch: `0` turns it off, nothing turns it on),
26
26
  * ARAGON_GOVERNANCE (a KILL switch: `0` disables governance mode, nothing enables it),
27
- * ARAGON_REDTEAM (a KILL switch: `0` disables red team mode, nothing enables it).
27
+ * ARAGON_REDTEAM (a KILL switch: `0` disables red team mode, nothing enables it),
28
+ * ARAGON_GENE (a KILL switch: `0` disables the Gene Bank, nothing enables it).
28
29
  *
29
30
  * READ ELSEWHERE, ON PURPOSE: `ARAGON_UPDATE_REGISTRY` and `npm_config_registry`
30
31
  * are resolved by `update/registry.ts::resolveRegistryUrl`, NOT here, because
@@ -24,7 +24,8 @@
24
24
  * ARAGON_PROMPTS (the quick-prompt library's `enabled` switch, and only that),
25
25
  * ARAGON_MEMORY (agent memory's kill switch: `0` turns it off, nothing turns it on),
26
26
  * ARAGON_GOVERNANCE (a KILL switch: `0` disables governance mode, nothing enables it),
27
- * ARAGON_REDTEAM (a KILL switch: `0` disables red team mode, nothing enables it).
27
+ * ARAGON_REDTEAM (a KILL switch: `0` disables red team mode, nothing enables it),
28
+ * ARAGON_GENE (a KILL switch: `0` disables the Gene Bank, nothing enables it).
28
29
  *
29
30
  * READ ELSEWHERE, ON PURPOSE: `ARAGON_UPDATE_REGISTRY` and `npm_config_registry`
30
31
  * are resolved by `update/registry.ts::resolveRegistryUrl`, NOT here, because
@@ -359,6 +360,16 @@ export function readEnvConfig() {
359
360
  if (redteam === '0' || redteam === 'false' || redteam === 'off' || redteam === 'no') {
360
361
  partial.redteam = { enabled: false };
361
362
  }
363
+ // ARAGON_GENE=0 is the Gene Bank KILL switch (gene-bank spec 14.3): it can only switch
364
+ // `enabled` OFF, and it outranks the config file. Like ARAGON_MEMORY it is not a toggle -
365
+ // `ARAGON_GENE=1` writes nothing, so an environment variable can never re-enable what the
366
+ // user's config or `--no-gene` turned off, and it can never reach `use` or `autoLearn`: those
367
+ // are the user's own runtime switches, and an env var that flipped them would be a second,
368
+ // invisible owner of a setting the Settings page claims to own.
369
+ const gene = process.env.ARAGON_GENE?.trim().toLowerCase();
370
+ if (gene === '0' || gene === 'false' || gene === 'off' || gene === 'no') {
371
+ partial.gene = { enabled: false };
372
+ }
362
373
  // ARAGON_TASK_SUMMARY is the header label's kill switch
363
374
  // (tui-shortcut-drawer-and-task-summary §4.8 / P2-7), and it maps `enabled` and
364
375
  // NOTHING ELSE - the same wording and the same reason as the block above. A
@@ -273,6 +273,15 @@ export interface CliFlags {
273
273
  */
274
274
  redteam?: boolean;
275
275
  noRedteam?: boolean;
276
+ /**
277
+ * `--no-gene` (gene-bank spec 14.3), carried as `true` ONLY. A lone negative flag makes
278
+ * commander default its option (`opts.gene`) to `true`, so `cli.tsx` translates the explicit
279
+ * `false` into `noGene: true` and forwards `undefined` for silence - the polarity is reversed
280
+ * from `memory` above on purpose, so that the field reads as the thing it does (switch OFF)
281
+ * and a future positive `--gene` cannot be mistaken for it. Launch-only: never written to the
282
+ * store.
283
+ */
284
+ noGene?: boolean;
276
285
  /**
277
286
  * `--resume <id|path>` - continue a saved session under a NEW id
278
287
  * (tui-session-id-resume 4).
@@ -295,6 +304,7 @@ export interface CliFlags {
295
304
  */
296
305
  export declare function loadConfig(flags?: CliFlags, options?: {
297
306
  interactive?: boolean;
307
+ quiet?: boolean;
298
308
  }): CliConfig;
299
309
  /**
300
310
  * Build the `getApiKey(providerId)` resolver the core `Agent` consumes.
@@ -6,7 +6,7 @@
6
6
  * legitimately long single tool run can never be watchdog-killed.
7
7
  */
8
8
  import process from 'node:process';
9
- import { DEFAULT_CONFIG, DEFAULT_SCROLL_MODE, IDLE_TIMEOUT_MARGIN_MS, clampDensity, clampHumanTimeout, clampCompactionConfig, clampLogConfig, clampFastConfig, clampRetryConfig, clampSkillsConfig, clampTeamConfig, clampTodoConfig, clampBashConfig, clampJobsConfig, clampPromptsConfig, clampMemoryConfig, clampRedTeamConfig, clampTaskSummaryConfig, clampUpdateConfig, clampTheme, clampThinkingLevel, clampContextWindow, clampMaxTokens, clampMaxRenderInterval, clampScrollMode, clampScrollResumeMs, clampTranscriptRetain, clampTranscriptWindow, coercePositiveInt, isAutoToken, isSkillsToolPolicyMode, legacyTeamCeilingPatch, legacyTeamFanoutPatch, LEGACY_TEAM_FANOUT_DEFAULTS, parseThresholdInput, } from '@aragon-agent/tui/model/config/schema';
9
+ import { DEFAULT_CONFIG, DEFAULT_SCROLL_MODE, IDLE_TIMEOUT_MARGIN_MS, clampDensity, clampHumanTimeout, clampCompactionConfig, clampLogConfig, clampFastConfig, clampRetryConfig, clampSkillsConfig, clampTeamConfig, clampTodoConfig, clampBashConfig, clampJobsConfig, clampPromptsConfig, clampMemoryConfig, clampRedTeamConfig, clampGeneConfig, clampTaskSummaryConfig, clampUpdateConfig, clampTheme, clampThinkingLevel, clampContextWindow, clampMaxTokens, clampMaxRenderInterval, clampScrollMode, clampScrollResumeMs, clampTranscriptRetain, clampTranscriptWindow, coercePositiveInt, isAutoToken, isSkillsToolPolicyMode, legacyTeamCeilingPatch, legacyTeamFanoutPatch, LEGACY_TEAM_FANOUT_DEFAULTS, parseThresholdInput, } from '@aragon-agent/tui/model/config/schema';
10
10
  import { loadDotenv, readEnvConfig, readEnvDisabledSkills } from './env.js';
11
11
  import { readConfigFile, updatePersistedConfig } from './store.js';
12
12
  import { projectModelProfiles, resolveModelProfileState, resolveModelRoleKey, } from '@aragon-agent/tui/model/config/model-profile-resolution';
@@ -815,6 +815,15 @@ export function loadConfig(flags = {}, options = {}) {
815
815
  ...(env.partial.redteam ?? {}),
816
816
  ...(flags.noRedteam === true ? { enabled: false } : {}),
817
817
  }),
818
+ // Gene Bank: file < env kill switch < `--no-gene`, clamped like every section. The kill
819
+ // switches can only switch `enabled` OFF and are applied AFTER the file so they outrank
820
+ // it; `use` and `autoLearn` come from the file alone (spec 14.2: the user's own switches).
821
+ gene: clampGeneConfig({
822
+ ...DEFAULT_CONFIG.gene,
823
+ ...(file.gene ?? {}),
824
+ ...(env.partial.gene ?? {}),
825
+ ...(flags.noGene === true ? { enabled: false } : {}),
826
+ }),
818
827
  initialPosture,
819
828
  cwd,
820
829
  color,
@@ -826,7 +835,9 @@ export function loadConfig(flags = {}, options = {}) {
826
835
  if (config.apiKeyOverride && (config.modelProfiles?.mainId || config.modelProfiles?.fastId)) {
827
836
  config.apiKeyOverrideTarget = { provider, baseUrl: baseUrl?.trim() || null };
828
837
  }
829
- recordResolvedConfig(config);
838
+ // `quiet`: a background reader (the Gene Bank's explanation) must not add a startup record.
839
+ if (options.quiet !== true)
840
+ recordResolvedConfig(config);
830
841
  return config;
831
842
  }
832
843
  /**