@aragon-agent/cli 0.6.55 → 0.6.56
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.
- package/CHANGELOG.md +2912 -2864
- package/README.md +160 -45
- package/dist/agent/controller.d.ts +47 -0
- package/dist/agent/controller.js +153 -2
- package/dist/agent/governance-wiring.js +8 -1
- package/dist/agent/system-prompt.d.ts +26 -0
- package/dist/agent/system-prompt.js +11 -0
- package/dist/app/App.js +101 -3
- package/dist/cli.js +29 -1
- package/dist/commands/builtins.js +4 -0
- package/dist/commands/catalog.js +1 -0
- package/dist/commands/registry.d.ts +8 -0
- package/dist/config/app-paths.d.ts +10 -0
- package/dist/config/app-paths.js +12 -0
- package/dist/config/cli-commands.d.ts +29 -0
- package/dist/config/cli-commands.js +76 -1
- package/dist/config/env.d.ts +2 -1
- package/dist/config/env.js +12 -1
- package/dist/config/load.d.ts +10 -0
- package/dist/config/load.js +13 -2
- package/dist/config/store.js +11 -1
- package/dist/exec/bridge/server.d.ts +7 -0
- package/dist/exec/bridge/server.js +6 -2
- package/dist/exec/cli-commands.js +4 -0
- package/dist/exec/index.js +2 -0
- package/dist/exec/options.d.ts +11 -0
- package/dist/exec/options.js +21 -1
- package/dist/gene/block.d.ts +33 -0
- package/dist/gene/block.js +51 -0
- package/dist/gene/capacity.d.ts +74 -0
- package/dist/gene/capacity.js +169 -0
- package/dist/gene/catalog-reconcile.d.ts +13 -0
- package/dist/gene/catalog-reconcile.js +105 -0
- package/dist/gene/catalog-stats.d.ts +27 -0
- package/dist/gene/catalog-stats.js +89 -0
- package/dist/gene/catalog-sync.d.ts +82 -0
- package/dist/gene/catalog-sync.js +324 -0
- package/dist/gene/catalog.d.ts +160 -0
- package/dist/gene/catalog.js +433 -0
- package/dist/gene/cli-commands.d.ts +50 -0
- package/dist/gene/cli-commands.js +500 -0
- package/dist/gene/command-report.d.ts +40 -0
- package/dist/gene/command-report.js +246 -0
- package/dist/gene/command.d.ts +29 -0
- package/dist/gene/command.js +561 -0
- package/dist/gene/commit-apply-types.d.ts +13 -0
- package/dist/gene/commit-apply-types.js +1 -0
- package/dist/gene/commit-compound.d.ts +34 -0
- package/dist/gene/commit-compound.js +212 -0
- package/dist/gene/commit-counts.d.ts +41 -0
- package/dist/gene/commit-counts.js +70 -0
- package/dist/gene/commit-exec.d.ts +42 -0
- package/dist/gene/commit-exec.js +134 -0
- package/dist/gene/commit-head.d.ts +52 -0
- package/dist/gene/commit-head.js +97 -0
- package/dist/gene/commit-plan.d.ts +95 -0
- package/dist/gene/commit-plan.js +68 -0
- package/dist/gene/commit-prepare.d.ts +63 -0
- package/dist/gene/commit-prepare.js +159 -0
- package/dist/gene/commit-types.d.ts +234 -0
- package/dist/gene/commit-types.js +3 -0
- package/dist/gene/curator/agent.d.ts +137 -0
- package/dist/gene/curator/agent.js +203 -0
- package/dist/gene/curator/budget.d.ts +69 -0
- package/dist/gene/curator/budget.js +131 -0
- package/dist/gene/curator/conflicts.d.ts +54 -0
- package/dist/gene/curator/conflicts.js +143 -0
- package/dist/gene/curator/curator.d.ts +170 -0
- package/dist/gene/curator/curator.js +617 -0
- package/dist/gene/curator/deps.d.ts +34 -0
- package/dist/gene/curator/deps.js +48 -0
- package/dist/gene/curator/deterministic.d.ts +62 -0
- package/dist/gene/curator/deterministic.js +287 -0
- package/dist/gene/curator/executors.d.ts +36 -0
- package/dist/gene/curator/executors.js +379 -0
- package/dist/gene/curator/lanes.d.ts +52 -0
- package/dist/gene/curator/lanes.js +99 -0
- package/dist/gene/curator/lease.d.ts +76 -0
- package/dist/gene/curator/lease.js +171 -0
- package/dist/gene/curator/library.d.ts +36 -0
- package/dist/gene/curator/library.js +169 -0
- package/dist/gene/curator/lifecycle.d.ts +52 -0
- package/dist/gene/curator/lifecycle.js +109 -0
- package/dist/gene/curator/maintenance.d.ts +71 -0
- package/dist/gene/curator/maintenance.js +213 -0
- package/dist/gene/curator/probation.d.ts +51 -0
- package/dist/gene/curator/probation.js +71 -0
- package/dist/gene/curator/probe.d.ts +131 -0
- package/dist/gene/curator/probe.js +534 -0
- package/dist/gene/curator/prompt.d.ts +18 -0
- package/dist/gene/curator/prompt.js +128 -0
- package/dist/gene/curator/publish.d.ts +64 -0
- package/dist/gene/curator/publish.js +113 -0
- package/dist/gene/curator/recheck.d.ts +55 -0
- package/dist/gene/curator/recheck.js +103 -0
- package/dist/gene/curator/run-events.d.ts +63 -0
- package/dist/gene/curator/run-events.js +55 -0
- package/dist/gene/curator/similarity.d.ts +13 -0
- package/dist/gene/curator/similarity.js +46 -0
- package/dist/gene/curator/switches.d.ts +78 -0
- package/dist/gene/curator/switches.js +146 -0
- package/dist/gene/curator/task-context.d.ts +93 -0
- package/dist/gene/curator/task-context.js +63 -0
- package/dist/gene/curator/task-runner.d.ts +56 -0
- package/dist/gene/curator/task-runner.js +257 -0
- package/dist/gene/curator/tool-support.d.ts +112 -0
- package/dist/gene/curator/tool-support.js +197 -0
- package/dist/gene/curator/toolkit.d.ts +49 -0
- package/dist/gene/curator/toolkit.js +104 -0
- package/dist/gene/curator/tools-read.d.ts +4 -0
- package/dist/gene/curator/tools-read.js +177 -0
- package/dist/gene/curator/tools-release.d.ts +73 -0
- package/dist/gene/curator/tools-release.js +287 -0
- package/dist/gene/curator/tools-verify.d.ts +47 -0
- package/dist/gene/curator/tools-verify.js +202 -0
- package/dist/gene/curator/tools-write.d.ts +26 -0
- package/dist/gene/curator/tools-write.js +394 -0
- package/dist/gene/curator/tools.d.ts +23 -0
- package/dist/gene/curator/tools.js +21 -0
- package/dist/gene/curator/validate/common.d.ts +87 -0
- package/dist/gene/curator/validate/common.js +132 -0
- package/dist/gene/curator/validate/evidence-tokens.d.ts +36 -0
- package/dist/gene/curator/validate/evidence-tokens.js +139 -0
- package/dist/gene/curator/validate/index.d.ts +23 -0
- package/dist/gene/curator/validate/index.js +62 -0
- package/dist/gene/curator/validate/knowledge.d.ts +25 -0
- package/dist/gene/curator/validate/knowledge.js +216 -0
- package/dist/gene/curator/validate/live-check.d.ts +14 -0
- package/dist/gene/curator/validate/live-check.js +144 -0
- package/dist/gene/curator/validate/ports.d.ts +67 -0
- package/dist/gene/curator/validate/ports.js +1 -0
- package/dist/gene/curator/validate/prompts.d.ts +41 -0
- package/dist/gene/curator/validate/prompts.js +161 -0
- package/dist/gene/curator/validate/skill.d.ts +15 -0
- package/dist/gene/curator/validate/skill.js +251 -0
- package/dist/gene/curator/validate/tool.d.ts +6 -0
- package/dist/gene/curator/validate/tool.js +217 -0
- package/dist/gene/curator/validate/types.d.ts +90 -0
- package/dist/gene/curator/validate/types.js +1 -0
- package/dist/gene/curator/validator-ports.d.ts +38 -0
- package/dist/gene/curator/validator-ports.js +29 -0
- package/dist/gene/diag.d.ts +209 -0
- package/dist/gene/diag.js +549 -0
- package/dist/gene/env.d.ts +10 -0
- package/dist/gene/env.js +214 -0
- package/dist/gene/eval-recorder.d.ts +84 -0
- package/dist/gene/eval-recorder.js +222 -0
- package/dist/gene/explain-transport.d.ts +3 -0
- package/dist/gene/explain-transport.js +39 -0
- package/dist/gene/explain.d.ts +96 -0
- package/dist/gene/explain.js +293 -0
- package/dist/gene/fs.d.ts +39 -0
- package/dist/gene/fs.js +139 -0
- package/dist/gene/fsck.d.ts +68 -0
- package/dist/gene/fsck.js +134 -0
- package/dist/gene/gc-library-sweeps.d.ts +9 -0
- package/dist/gene/gc-library-sweeps.js +220 -0
- package/dist/gene/gc-rejected-set.d.ts +15 -0
- package/dist/gene/gc-rejected-set.js +63 -0
- package/dist/gene/gc-safe.d.ts +12 -0
- package/dist/gene/gc-safe.js +74 -0
- package/dist/gene/gc-scope-sweeps.d.ts +18 -0
- package/dist/gene/gc-scope-sweeps.js +297 -0
- package/dist/gene/gc-types.d.ts +55 -0
- package/dist/gene/gc-types.js +26 -0
- package/dist/gene/gc.d.ts +42 -0
- package/dist/gene/gc.js +129 -0
- package/dist/gene/gene-errors.d.ts +23 -0
- package/dist/gene/gene-errors.js +29 -0
- package/dist/gene/hints.d.ts +91 -0
- package/dist/gene/hints.js +394 -0
- package/dist/gene/hub.d.ts +149 -0
- package/dist/gene/hub.js +371 -0
- package/dist/gene/import-plan.d.ts +80 -0
- package/dist/gene/import-plan.js +294 -0
- package/dist/gene/import-proposal.d.ts +23 -0
- package/dist/gene/import-proposal.js +101 -0
- package/dist/gene/import-skill-port.d.ts +6 -0
- package/dist/gene/import-skill-port.js +53 -0
- package/dist/gene/import-sources.d.ts +48 -0
- package/dist/gene/import-sources.js +140 -0
- package/dist/gene/index-writer.d.ts +36 -0
- package/dist/gene/index-writer.js +101 -0
- package/dist/gene/learn/learn-call.d.ts +63 -0
- package/dist/gene/learn/learn-call.js +157 -0
- package/dist/gene/learn/learn-prompt.d.ts +51 -0
- package/dist/gene/learn/learn-prompt.js +245 -0
- package/dist/gene/learn/learner.d.ts +181 -0
- package/dist/gene/learn/learner.js +426 -0
- package/dist/gene/learn/ledger.d.ts +220 -0
- package/dist/gene/learn/ledger.js +394 -0
- package/dist/gene/learn/proposal-build.d.ts +83 -0
- package/dist/gene/learn/proposal-build.js +211 -0
- package/dist/gene/learn/proposal-guard.d.ts +43 -0
- package/dist/gene/learn/proposal-guard.js +37 -0
- package/dist/gene/learn/signals-port.d.ts +47 -0
- package/dist/gene/learn/signals-port.js +86 -0
- package/dist/gene/maintenance-paths.d.ts +7 -0
- package/dist/gene/maintenance-paths.js +20 -0
- package/dist/gene/maintenance-probation.d.ts +33 -0
- package/dist/gene/maintenance-probation.js +127 -0
- package/dist/gene/maintenance-proposals.d.ts +24 -0
- package/dist/gene/maintenance-proposals.js +68 -0
- package/dist/gene/maintenance-runner.d.ts +92 -0
- package/dist/gene/maintenance-runner.js +262 -0
- package/dist/gene/maintenance-tasks.d.ts +37 -0
- package/dist/gene/maintenance-tasks.js +95 -0
- package/dist/gene/manager-actions.d.ts +12 -0
- package/dist/gene/manager-actions.js +279 -0
- package/dist/gene/manager-approve.d.ts +29 -0
- package/dist/gene/manager-approve.js +84 -0
- package/dist/gene/manager-context.d.ts +90 -0
- package/dist/gene/manager-context.js +201 -0
- package/dist/gene/manager-detail.d.ts +17 -0
- package/dist/gene/manager-detail.js +313 -0
- package/dist/gene/manager-gc.d.ts +13 -0
- package/dist/gene/manager-gc.js +81 -0
- package/dist/gene/manager-library.d.ts +39 -0
- package/dist/gene/manager-library.js +90 -0
- package/dist/gene/manager-list.d.ts +27 -0
- package/dist/gene/manager-list.js +170 -0
- package/dist/gene/manager-queue.d.ts +16 -0
- package/dist/gene/manager-queue.js +124 -0
- package/dist/gene/manager-stats.d.ts +28 -0
- package/dist/gene/manager-stats.js +53 -0
- package/dist/gene/manager-view.d.ts +27 -0
- package/dist/gene/manager-view.js +124 -0
- package/dist/gene/manager.d.ts +56 -0
- package/dist/gene/manager.js +179 -0
- package/dist/gene/orphan-scopes.d.ts +37 -0
- package/dist/gene/orphan-scopes.js +150 -0
- package/dist/gene/paths.d.ts +73 -0
- package/dist/gene/paths.js +239 -0
- package/dist/gene/plan-content.d.ts +73 -0
- package/dist/gene/plan-content.js +522 -0
- package/dist/gene/plan-lifecycle.d.ts +29 -0
- package/dist/gene/plan-lifecycle.js +310 -0
- package/dist/gene/policy.d.ts +71 -0
- package/dist/gene/policy.js +313 -0
- package/dist/gene/project-learning.d.ts +25 -0
- package/dist/gene/project-learning.js +54 -0
- package/dist/gene/propagation.d.ts +48 -0
- package/dist/gene/propagation.js +45 -0
- package/dist/gene/queue-lock.d.ts +22 -0
- package/dist/gene/queue-lock.js +99 -0
- package/dist/gene/queue-record.d.ts +57 -0
- package/dist/gene/queue-record.js +145 -0
- package/dist/gene/queue.d.ts +235 -0
- package/dist/gene/queue.js +764 -0
- package/dist/gene/read.d.ts +61 -0
- package/dist/gene/read.js +252 -0
- package/dist/gene/runlog.d.ts +101 -0
- package/dist/gene/runlog.js +404 -0
- package/dist/gene/schema-lite.d.ts +24 -0
- package/dist/gene/schema-lite.js +159 -0
- package/dist/gene/scope-guard.d.ts +23 -0
- package/dist/gene/scope-guard.js +9 -0
- package/dist/gene/scope-lock.d.ts +48 -0
- package/dist/gene/scope-lock.js +222 -0
- package/dist/gene/scope-verify.d.ts +63 -0
- package/dist/gene/scope-verify.js +123 -0
- package/dist/gene/secrets.d.ts +43 -0
- package/dist/gene/secrets.js +161 -0
- package/dist/gene/service-context.d.ts +43 -0
- package/dist/gene/service-context.js +79 -0
- package/dist/gene/service-prepare.d.ts +25 -0
- package/dist/gene/service-prepare.js +219 -0
- package/dist/gene/service-types.d.ts +196 -0
- package/dist/gene/service-types.js +1 -0
- package/dist/gene/service-view.d.ts +41 -0
- package/dist/gene/service-view.js +69 -0
- package/dist/gene/service.d.ts +114 -0
- package/dist/gene/service.js +761 -0
- package/dist/gene/session-start.d.ts +36 -0
- package/dist/gene/session-start.js +212 -0
- package/dist/gene/store-port.d.ts +88 -0
- package/dist/gene/store-port.js +10 -0
- package/dist/gene/store-rows.d.ts +36 -0
- package/dist/gene/store-rows.js +72 -0
- package/dist/gene/store.d.ts +125 -0
- package/dist/gene/store.js +622 -0
- package/dist/gene/tombstones.d.ts +47 -0
- package/dist/gene/tombstones.js +61 -0
- package/dist/gene/tool-runner.d.ts +47 -0
- package/dist/gene/tool-runner.js +154 -0
- package/dist/gene/tool-screen.d.ts +41 -0
- package/dist/gene/tool-screen.js +227 -0
- package/dist/gene/tools.d.ts +112 -0
- package/dist/gene/tools.js +539 -0
- package/dist/gene/transfer.d.ts +85 -0
- package/dist/gene/transfer.js +433 -0
- package/dist/gene/ui-hints.d.ts +15 -0
- package/dist/gene/ui-hints.js +67 -0
- package/dist/gene/usage-fold-cursor.d.ts +24 -0
- package/dist/gene/usage-fold-cursor.js +115 -0
- package/dist/gene/usage-fold.d.ts +49 -0
- package/dist/gene/usage-fold.js +397 -0
- package/dist/gene/usage.d.ts +67 -0
- package/dist/gene/usage.js +231 -0
- package/dist/gene/version-service.d.ts +118 -0
- package/dist/gene/version-service.js +453 -0
- package/dist/gene/wiring-events.d.ts +43 -0
- package/dist/gene/wiring-events.js +113 -0
- package/dist/gene/wiring-models.d.ts +46 -0
- package/dist/gene/wiring-models.js +81 -0
- package/dist/gene/wiring.d.ts +200 -0
- package/dist/gene/wiring.js +764 -0
- package/dist/governance/prompts/orchestrator-block.js +3 -2
- package/dist/host/gene.d.ts +26 -0
- package/dist/host/gene.js +24 -0
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +1 -0
- package/dist/team/runtime.d.ts +5 -0
- package/dist/team/runtime.js +23 -0
- package/dist/team/subagent.d.ts +34 -0
- package/dist/team/subagent.js +39 -2
- package/dist/tools/index.d.ts +36 -2
- package/dist/tools/index.js +48 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1208,6 +1208,121 @@ survive across sessions, that you can search, edit by hand and choose to put in
|
|
|
1208
1208
|
`ARAGON_MEMORY=0` (or `--no-memory`) is the kill switch; it can only turn memory **off**. The headless
|
|
1209
1209
|
`aragon exec` / `-p` path and subagents never load memory and never register the tools.
|
|
1210
1210
|
|
|
1211
|
+
## Gene Bank
|
|
1212
|
+
|
|
1213
|
+
Memory is what **you** write down. The **Gene Bank** is what the agent learns by working: a library of
|
|
1214
|
+
*knowledge* genes (project facts, environment limits, fixes, preferences), *tool* genes (a parameterised
|
|
1215
|
+
command with an input schema) and *skill* genes (a method: trigger, steps, branches, acceptance
|
|
1216
|
+
criteria, fallback). It is on by default, bounded, and every part of it can be inspected and corrected.
|
|
1217
|
+
|
|
1218
|
+
- **`Ctrl+Q`** (or `Alt+Q`, or `/gene`) opens the manager: Knowledge / Tools / Skills, search and filters,
|
|
1219
|
+
and for each gene its source, applicability, version history with a diff, dependencies, usage and why it
|
|
1220
|
+
was (not) loaded. You can create, edit, pin, archive, restore, roll back and delete. *Delete* removes
|
|
1221
|
+
the entry; *Delete and never learn this again* also writes a tombstone so an old session cannot
|
|
1222
|
+
regenerate it. Your edits are committed at once through the same version service the background
|
|
1223
|
+
curator uses, and a stale background update can never overwrite them. The status row shows how many
|
|
1224
|
+
genes are in context and what the learner is doing.
|
|
1225
|
+
- **Three layers, loaded only when needed.** The prompt carries stable rules and a separate
|
|
1226
|
+
`<gene_context>` zone of one-line previews (scope, source and version on each line), chosen by task,
|
|
1227
|
+
project, role and relevance within an item budget and a token budget - whichever is reached first
|
|
1228
|
+
stops loading. `gene_search` finds anything you may see, past the first 200, with keyword plus a light
|
|
1229
|
+
vector match (a Chinese task finds English genes); `gene_read` opens the full text (tier 2) and the
|
|
1230
|
+
evidence (tier 3). The agent, the reviewer and sub-agents all use the same tools; none needs the curator.
|
|
1231
|
+
- **Learning is asynchronous and proposal-only.** After a run the fast model reviews it and either does
|
|
1232
|
+
nothing or queues proposals (new knowledge, a reusable operation, a working procedure, your correction,
|
|
1233
|
+
a gene that stopped being true). One **curator** per library - a separate agent with its own token
|
|
1234
|
+
budget, holding a lease so several terminals share one - validates by type, publishes, watches a
|
|
1235
|
+
probation window and rolls back on harm. Nothing a session learns can change the system rules, a
|
|
1236
|
+
permission, or a reviewer's acceptance criteria; a tool gene can never widen what the agent may do.
|
|
1237
|
+
Anything that would run a script waits for **your** approval in the manager, with the full command
|
|
1238
|
+
shown.
|
|
1239
|
+
- **Locality.** Recently useful, relevant genes are shown first; unused ones lose exposure but stay
|
|
1240
|
+
searchable, and only then are they archived. Pin what must stay (`user_requirement`,
|
|
1241
|
+
`project_constraint`, `recovery_experience`): pinned genes are never evicted for low use and are
|
|
1242
|
+
re-checked when the environment changes.
|
|
1243
|
+
- **Scopes.** User, project, team (a read-only directory you name) and the current task. A personal
|
|
1244
|
+
preference or project lesson is never promoted to team or global on its own.
|
|
1245
|
+
- **Honest numbers.** Exposure is not value: shown / retrieved / read / adopted and helped / harmed are
|
|
1246
|
+
counted separately, and a whole run succeeding does not credit every gene it touched. `/gene stats`
|
|
1247
|
+
reports success rate, repeated errors, harmful-gene adoption, time, and the cost of each run split
|
|
1248
|
+
into the main agent and the reviewer. The curator's background spend is not attributed to individual
|
|
1249
|
+
runs; `/gene status` shows today's learning, curation and validation tokens against `gene.dailyTokens`.
|
|
1250
|
+
- **Privacy.** Genes are plain JSON under `~/.aragon-agent/genes/`; secrets are redacted before anything
|
|
1251
|
+
is stored; learning sends excerpts of your session to the configured fast (or main) model. There is no
|
|
1252
|
+
telemetry. `gene.autoLearn: false` stops all automatic creation and publishing; existing genes stay
|
|
1253
|
+
usable and manual management stays on. `gene.use: false` stops retrieval and loading altogether.
|
|
1254
|
+
- **Start from what you already have.** An empty library says so, and offers three starts. `/gene
|
|
1255
|
+
import-memory` and `/gene import-skills` turn your memory notes and installed skills into **candidates**:
|
|
1256
|
+
a dry run by default (what would be queued, what was skipped and why, the token estimate, and which
|
|
1257
|
+
model the text goes to), and `--yes` queues them. Nothing is published by an import - the curator drafts
|
|
1258
|
+
an English gene from each source, validation decides, and no Agent sees it before it is published.
|
|
1259
|
+
Notes that look like a secret or like instructions to an Agent are skipped, a source you told the library
|
|
1260
|
+
to forget is skipped, a source is never queued twice, and an import never fills the queue or the day's
|
|
1261
|
+
token allowance (see `gene.importMaxItems`; the curator leaves imports pending while less than half of
|
|
1262
|
+
the day's allowance is left).
|
|
1263
|
+
- **A Chinese reading of an English gene.** Genes are English by design. `x` in the manager, or `/gene
|
|
1264
|
+
explain <id>`, asks the fast model for a Chinese explanation: it is cached beside the library, marked as a
|
|
1265
|
+
machine translation, never stored in the gene and never read by any Agent. The text of the gene is sent
|
|
1266
|
+
to your fast model, and the panel says which. `gene.explainLanguage` is `auto` (when your locale is
|
|
1267
|
+
Chinese), `zh` or `off`.
|
|
1268
|
+
- **Commands.** `/gene` (manager), `status`, `search`, `show`, `explain` (the Chinese reading), `why` (the
|
|
1269
|
+
score breakdown: why a gene is or is not loaded), `on|off`, `learn on|off`,
|
|
1270
|
+
`pin|unpin|archive|restore|rollback|forget`, `queue`, `curator pause|resume`, `recheck`, `stats`,
|
|
1271
|
+
`export|import` (packs, imported as candidates), `import-memory`, `import-skills`, `gc`, `diag`. `/gene help`
|
|
1272
|
+
is generated from the same table that dispatches the commands. From a script: `aragon gene list | show |
|
|
1273
|
+
search | export | import | stats | fsck | explain | import-memory | import-skills | learn | diag`. Not
|
|
1274
|
+
planned: a "trusted" import of your own exported packs (`--trusted`). Packs are untrusted by design and
|
|
1275
|
+
every pack import is validated again; to restore a library, copy it back (see **Backup & restore**).
|
|
1276
|
+
- **Do not learn in this project.** `/gene learn off --project` (or `aragon gene learn off --project`, or the
|
|
1277
|
+
Genes settings page) turns off learning for the current project only: nothing from a session in that
|
|
1278
|
+
project is sent to a model for learning, and what it had queued is dropped with its text removed.
|
|
1279
|
+
Existing genes keep being used, and manual management keeps working. The setting is yours
|
|
1280
|
+
(`<genes>/policy.json`, keyed by the project). A repository can also ask for it by committing
|
|
1281
|
+
`.aragon/gene.json` with `{ "learn": false }` at the repository root; that file can only turn learning
|
|
1282
|
+
**off** (any other content is ignored), is never searched for in parent directories, and a marker that
|
|
1283
|
+
exists but cannot be read counts as "off". The same applies to a policy file that cannot be read: learning
|
|
1284
|
+
pauses until it is repaired (`aragon gene fsck`). `/gene status` shows which one applies. Limits: a
|
|
1285
|
+
model call already in flight cannot be recalled; a candidate that was already written when you switched
|
|
1286
|
+
learning off stays on disk as an unpublished candidate (nothing is published from it; delete it in the
|
|
1287
|
+
manager); proposals queued by an older release carry no project and are not covered. A project scope
|
|
1288
|
+
is keyed by its path, so a renamed or moved repository is a new project: `fsck` and `/gene status` then
|
|
1289
|
+
list the old scope as "not found at its recorded path" (its genes are still on disk); export from the old
|
|
1290
|
+
scope in the manager and import the pack as candidates in the new project.
|
|
1291
|
+
- **What is sent where.** Automatic learning sends excerpts of your session to the model named by
|
|
1292
|
+
`gene.reviewerModel` (the fast tier by default); the curator's drafting and validation go to
|
|
1293
|
+
`gene.curatorModel`. A Chinese reading sends the gene text to the fast model, and an import sends the
|
|
1294
|
+
chosen notes or skills to it. Using genes, searching, reading and every manual edit send nothing anywhere.
|
|
1295
|
+
`gene.autoLearn: false` stops all learning everywhere; the per-project switch stops it for one project;
|
|
1296
|
+
`gene.use: false` stops using genes altogether.
|
|
1297
|
+
- **Backup & restore.** Everything is plain files under `<ARAGON_HOME>/genes/` and the search index is only a
|
|
1298
|
+
cache. To back up, quit every Aragon process (including the desktop app) and copy that directory
|
|
1299
|
+
(`aragon gene export` also produces a pack). To restore, put it back and run `aragon gene fsck --repair`;
|
|
1300
|
+
the index is rebuilt, forgotten items stay forgotten, and queued work resumes. A pack import is always
|
|
1301
|
+
re-validated: packs are untrusted by design.
|
|
1302
|
+
- **Support.** `aragon gene diag [--out <file>]` writes a diagnostic bundle you can attach to an issue:
|
|
1303
|
+
versions, counts, budgets, queue and lease state and recent outcome codes. It never contains gene text,
|
|
1304
|
+
evidence, session content, file paths, project names or keys.
|
|
1305
|
+
|
|
1306
|
+
| Config key | Default | Meaning |
|
|
1307
|
+
| --- | --- | --- |
|
|
1308
|
+
| `gene.enabled` | `true` | Registers the tools, prompt blocks and keys. Turning it **on** needs a restart |
|
|
1309
|
+
| `gene.use` | `true` | Retrieve, load and call existing genes. Read at every call |
|
|
1310
|
+
| `gene.autoLearn` | `true` | Automatic creation, revision and publishing. Read before every step, including a queued task |
|
|
1311
|
+
| `gene.capPerType` | `5000` | Published, valid genes kept per type (current versions only) |
|
|
1312
|
+
| `gene.reviewerMaxItems` / `reviewerMaxTokens` | `200` / `8000` | The reviewer's preview budget; both limits apply |
|
|
1313
|
+
| `gene.dailyTokens` | `800000` | Rolling 24 h token budget for learning, curation and validation (a Chinese reading is a click, not learning, and is counted as its own cost) |
|
|
1314
|
+
| `gene.holdoutPercent` | `0` | Share of runs (0-20) that deliberately do not use the Gene Bank, for a randomised comparison. `/gene status` says when it is on |
|
|
1315
|
+
| `gene.importMaxItems` | `100` | Most items one `import-memory` / `import-skills` queues (1-400, and never more than the queue has room for) |
|
|
1316
|
+
| `gene.explainLanguage` | `auto` | `auto`, `zh` or `off`. Anything else reads as `auto` |
|
|
1317
|
+
| `gene.reviewerModel` / `curatorModel` | `fast` | `fast` or `main` |
|
|
1318
|
+
| `gene.probeMode` | `readonly` | What the curator may run on its own while validating a tool; there is no value that allows scripts |
|
|
1319
|
+
| `gene.teamPath` | `` | A read-only team directory |
|
|
1320
|
+
| `gene.key` | `ctrl+q` | `ctrl+q`, `ctrl+y` or `none`; `Alt+<letter>` always follows |
|
|
1321
|
+
|
|
1322
|
+
`ARAGON_GENE=0` (or `--no-gene`) is the kill switch; it can only turn the Gene Bank **off**. `aragon exec`
|
|
1323
|
+
and `-p` use the library only with `--gene`, and learn only with `--gene-learn`; sub-agents share the
|
|
1324
|
+
session's library and never get a copy.
|
|
1325
|
+
|
|
1211
1326
|
## Terminal setup for Shift+Enter
|
|
1212
1327
|
|
|
1213
1328
|
应用现在会主动请求终端区分修饰键:Windows 上推送 win32-input-mode(conhost 与
|
|
@@ -3610,51 +3725,51 @@ greater than it, and the two are resolved together rather than left to collide.
|
|
|
3610
3725
|
These are additive: a config file written by an earlier version loads
|
|
3611
3726
|
unchanged, with no migration and no version bump.
|
|
3612
3727
|
|
|
3613
|
-
## Red team and security mode
|
|
3614
|
-
|
|
3615
|
-
A session posture for authorized offensive-security work: **Ctrl+R** (or `/redteam on`, or
|
|
3616
|
-
`aragon --redteam`) switches the agent from a general assistant into an offensive-security
|
|
3617
|
-
professional, with the authorization and the boundary stated in the system prompt itself.
|
|
3618
|
-
|
|
3619
|
-
**What it actually changes - first, because the honest answer is small.** The only permission
|
|
3620
|
-
effect is that the interactive confirmation gate (`--confirm`) is skipped while the mode is
|
|
3621
|
-
armed. `confirmTools` defaults to **false**, so for most sessions there is no gate to skip and
|
|
3622
|
-
this mode changes no permissions at all: its value is the prompt, the visibility and the declared
|
|
3623
|
-
scope. A session with `redteam.bypassConfirm: false` keeps the gate. Nothing else is loosened:
|
|
3624
|
-
plan-mode write refusals, the governed Orchestrator's gate, the workspace boundary and the skill
|
|
3625
|
-
tool-policy ceiling are untouched, and `/redteam status` says so in its fourth line.
|
|
3626
|
-
|
|
3627
|
-
**The waiver.** The first press of `Ctrl+R` opens a six-clause liability waiver and arms
|
|
3628
|
-
nothing. The cursor starts on **Decline**; `y` accepts; `Esc` declines. Acceptance is remembered
|
|
3629
|
-
per machine in `state.json` and per clause-set version, so raising the version asks everyone
|
|
3630
|
-
again - and `redteam.askEveryArm: true` asks on every arm. On a terminal too short for the whole
|
|
3631
|
-
text, **Accept and `y` are both disabled**: a shortcut that agrees to text you cannot see is
|
|
3632
|
-
worse than a button that does. Enlarging the terminal is enough - the overlay re-measures on
|
|
3633
|
-
resize.
|
|
3634
|
-
|
|
3635
|
-
**What you see.** An `RT armed` chip at the right end of the status row (at every width; it is
|
|
3636
|
-
never dropped for lack of space), a composer border in the red team colour, and a three-row
|
|
3637
|
-
banner in the transcript that states the scope and how to leave. Under PLAN or GOVERN the mode
|
|
3638
|
-
is **paused**: the chip reads `RT paused`, the border returns to the plan / govern colour, and
|
|
3639
|
-
the prompt says the authorization covers analysis and reporting only for that turn. Disarming is
|
|
3640
|
-
immediate in every state; arming during a turn waits for it to end, because that turn's prompt
|
|
3641
|
-
and tool array are already assembled.
|
|
3642
|
-
|
|
3643
|
-
**The scope** (`/redteam scope <one line>`) is what you declare you are authorized to test. It
|
|
3644
|
-
lives only in this session - never in `config.json`, never in a session file, never in a log -
|
|
3645
|
-
because a target name can itself be the sensitive half of an engagement. It is normalized before
|
|
3646
|
-
it reaches the prompt (control characters dropped, folded to one line, `<` / `>` neutralized, 200
|
|
3647
|
-
characters max, refused rather than truncated) and the prompt is explicit that **it is a promise,
|
|
3648
|
-
not a control**: nothing in this tool enforces it.
|
|
3649
|
-
|
|
3650
|
-
**Subagents inherit it.** A dispatched child gets its own trimmed `<redteam_mode>` block and the
|
|
3651
|
-
same bypass predicate, passed down explicitly (its confirmation closure is its own, so nothing
|
|
3652
|
-
inherits automatically). Leaving is one keystroke: `Ctrl+R` again, or `/redteam off`.
|
|
3653
|
-
|
|
3654
|
-
`aragon --redteam` starts armed - refused in print / exec mode and before the waiver is accepted,
|
|
3655
|
-
and refused by `--no-redteam` or `ARAGON_REDTEAM=0` (a kill switch that can only switch it off).
|
|
3656
|
-
`Alt+R` repaints the frame in every configuration, including the ones where this mode is off.
|
|
3657
|
-
|
|
3728
|
+
## Red team and security mode
|
|
3729
|
+
|
|
3730
|
+
A session posture for authorized offensive-security work: **Ctrl+R** (or `/redteam on`, or
|
|
3731
|
+
`aragon --redteam`) switches the agent from a general assistant into an offensive-security
|
|
3732
|
+
professional, with the authorization and the boundary stated in the system prompt itself.
|
|
3733
|
+
|
|
3734
|
+
**What it actually changes - first, because the honest answer is small.** The only permission
|
|
3735
|
+
effect is that the interactive confirmation gate (`--confirm`) is skipped while the mode is
|
|
3736
|
+
armed. `confirmTools` defaults to **false**, so for most sessions there is no gate to skip and
|
|
3737
|
+
this mode changes no permissions at all: its value is the prompt, the visibility and the declared
|
|
3738
|
+
scope. A session with `redteam.bypassConfirm: false` keeps the gate. Nothing else is loosened:
|
|
3739
|
+
plan-mode write refusals, the governed Orchestrator's gate, the workspace boundary and the skill
|
|
3740
|
+
tool-policy ceiling are untouched, and `/redteam status` says so in its fourth line.
|
|
3741
|
+
|
|
3742
|
+
**The waiver.** The first press of `Ctrl+R` opens a six-clause liability waiver and arms
|
|
3743
|
+
nothing. The cursor starts on **Decline**; `y` accepts; `Esc` declines. Acceptance is remembered
|
|
3744
|
+
per machine in `state.json` and per clause-set version, so raising the version asks everyone
|
|
3745
|
+
again - and `redteam.askEveryArm: true` asks on every arm. On a terminal too short for the whole
|
|
3746
|
+
text, **Accept and `y` are both disabled**: a shortcut that agrees to text you cannot see is
|
|
3747
|
+
worse than a button that does. Enlarging the terminal is enough - the overlay re-measures on
|
|
3748
|
+
resize.
|
|
3749
|
+
|
|
3750
|
+
**What you see.** An `RT armed` chip at the right end of the status row (at every width; it is
|
|
3751
|
+
never dropped for lack of space), a composer border in the red team colour, and a three-row
|
|
3752
|
+
banner in the transcript that states the scope and how to leave. Under PLAN or GOVERN the mode
|
|
3753
|
+
is **paused**: the chip reads `RT paused`, the border returns to the plan / govern colour, and
|
|
3754
|
+
the prompt says the authorization covers analysis and reporting only for that turn. Disarming is
|
|
3755
|
+
immediate in every state; arming during a turn waits for it to end, because that turn's prompt
|
|
3756
|
+
and tool array are already assembled.
|
|
3757
|
+
|
|
3758
|
+
**The scope** (`/redteam scope <one line>`) is what you declare you are authorized to test. It
|
|
3759
|
+
lives only in this session - never in `config.json`, never in a session file, never in a log -
|
|
3760
|
+
because a target name can itself be the sensitive half of an engagement. It is normalized before
|
|
3761
|
+
it reaches the prompt (control characters dropped, folded to one line, `<` / `>` neutralized, 200
|
|
3762
|
+
characters max, refused rather than truncated) and the prompt is explicit that **it is a promise,
|
|
3763
|
+
not a control**: nothing in this tool enforces it.
|
|
3764
|
+
|
|
3765
|
+
**Subagents inherit it.** A dispatched child gets its own trimmed `<redteam_mode>` block and the
|
|
3766
|
+
same bypass predicate, passed down explicitly (its confirmation closure is its own, so nothing
|
|
3767
|
+
inherits automatically). Leaving is one keystroke: `Ctrl+R` again, or `/redteam off`.
|
|
3768
|
+
|
|
3769
|
+
`aragon --redteam` starts armed - refused in print / exec mode and before the waiver is accepted,
|
|
3770
|
+
and refused by `--no-redteam` or `ARAGON_REDTEAM=0` (a kill switch that can only switch it off).
|
|
3771
|
+
`Alt+R` repaints the frame in every configuration, including the ones where this mode is off.
|
|
3772
|
+
|
|
3658
3773
|
## Auto-update
|
|
3659
3774
|
|
|
3660
3775
|
`aragon` checks npm for a newer release in the background, installs it silently
|
|
@@ -33,6 +33,11 @@ import type { RedTeamView } from '@aragon-agent/tui/model/redteam/types';
|
|
|
33
33
|
import { MemoryService } from '../memory/service.js';
|
|
34
34
|
import type { MemorySessionView } from '@aragon-agent/tui/model/memory/types';
|
|
35
35
|
import type { MemoryConfig } from '@aragon-agent/tui/model/config/schema';
|
|
36
|
+
import type { GeneConfig } from '@aragon-agent/tui/model/config/schema';
|
|
37
|
+
import { type GeneWiring } from '../gene/wiring.js';
|
|
38
|
+
import type { GeneManager } from '../gene/manager.js';
|
|
39
|
+
import type { GeneService } from '../gene/service.js';
|
|
40
|
+
import type { GeneSessionView } from '@aragon-agent/tui/model/gene/types';
|
|
36
41
|
import type { TeamModeOutcome, TeamModeRequest, TeamModeView } from '@aragon-agent/tui/model/team/team-mode';
|
|
37
42
|
import type { TeamEvent, TeamSnapshot } from '@aragon-agent/tui/model/team/types';
|
|
38
43
|
import { ProcSupervisor } from '../proc/supervisor.js';
|
|
@@ -88,6 +93,17 @@ export interface ControllerDeps {
|
|
|
88
93
|
* wizard or a plan card.
|
|
89
94
|
*/
|
|
90
95
|
humanInput?: HumanInputGate;
|
|
96
|
+
/**
|
|
97
|
+
* Gene Bank host facts (gene-bank 9.8). Absent => an interactive terminal session. A headless
|
|
98
|
+
* host (`-p`, `exec`) reads the library but never learns (D-40): `printMode` + `learnFlag`
|
|
99
|
+
* say whether `--gene-learn` was given. `root` is a test seam for the library directory.
|
|
100
|
+
*/
|
|
101
|
+
gene?: {
|
|
102
|
+
kind?: 'tui' | 'desktop' | 'exec';
|
|
103
|
+
printMode?: boolean;
|
|
104
|
+
learnFlag?: boolean;
|
|
105
|
+
root?: string;
|
|
106
|
+
};
|
|
91
107
|
/**
|
|
92
108
|
* Whether this session could EVER render the todo rail (todo-plan-execution
|
|
93
109
|
* §3.7 / P1-6). Full-screen and interactive; headless calls are false.
|
|
@@ -335,6 +351,15 @@ export declare class AgentController {
|
|
|
335
351
|
private readonly teamMode;
|
|
336
352
|
private readonly redTeam;
|
|
337
353
|
private readonly memory;
|
|
354
|
+
/**
|
|
355
|
+
* The Gene Bank composition root (gene-bank spec 4), or `undefined` when the feature is off
|
|
356
|
+
* (`gene.enabled`, after the `ARAGON_GENE` kill switch and `--no-gene`). `undefined` is what
|
|
357
|
+
* leaves the tool array, the system prompt and the status row byte-identical to the build
|
|
358
|
+
* before the feature existed (I-20). Fixed at construction, like `memory`: tools cannot be
|
|
359
|
+
* unregistered, so `enabled` turned off mid-session makes the blocks vanish and the tools
|
|
360
|
+
* refuse (`use`), but a fully clean session needs a restart.
|
|
361
|
+
*/
|
|
362
|
+
private readonly gene;
|
|
338
363
|
private readonly todoRegistered;
|
|
339
364
|
private todoEnabled;
|
|
340
365
|
private readonly todos;
|
|
@@ -993,6 +1018,28 @@ export declare class AgentController {
|
|
|
993
1018
|
* the file, this updates the runtime.
|
|
994
1019
|
*/
|
|
995
1020
|
setMemoryConfig(patch: Partial<MemoryConfig>): MemoryConfig;
|
|
1021
|
+
/** The composition root, or `undefined` when the library is off / a subagent. */
|
|
1022
|
+
getGeneWiring(): GeneWiring | undefined;
|
|
1023
|
+
/** The per-session read facade, or `undefined` when off. */
|
|
1024
|
+
getGeneService(): GeneService | undefined;
|
|
1025
|
+
/** The manager both user interfaces talk to, or `undefined` when off. */
|
|
1026
|
+
getGeneManager(): GeneManager | undefined;
|
|
1027
|
+
/** The unified status; `available: false` when the library is off. */
|
|
1028
|
+
getGeneView(): GeneSessionView;
|
|
1029
|
+
/** Subscribe to status changes; the returned function unsubscribes. */
|
|
1030
|
+
subscribeGene(listener: () => void): () => void;
|
|
1031
|
+
/**
|
|
1032
|
+
* Adopt a new `gene` config for this session (Settings > Genes, `/gene on|off`), clamped here
|
|
1033
|
+
* as well as on the persist path. Like `setMemoryConfig` this does NOT persist. The two user
|
|
1034
|
+
* switches take effect on the NEXT call (I-18); the prompt is rebuilt so the blocks follow.
|
|
1035
|
+
*/
|
|
1036
|
+
setGeneConfig(patch: Partial<GeneConfig>): GeneConfig;
|
|
1037
|
+
/** A SESSION-level `use` override (the desktop's host command); `null` returns to the config. */
|
|
1038
|
+
setGeneUse(value: boolean | null): void;
|
|
1039
|
+
/** A SESSION-level `autoLearn` override; `null` returns to the config. */
|
|
1040
|
+
setGeneAutoLearn(value: boolean | null): void;
|
|
1041
|
+
/** Pause / resume THIS machine's curator consumption (queueing is unaffected). */
|
|
1042
|
+
geneCurator(action: 'pause' | 'resume'): void;
|
|
996
1043
|
/** The window of the model `cfg` selects, or `undefined` when only a fallback is known. */
|
|
997
1044
|
private memoryWindowTokens;
|
|
998
1045
|
/** Configured API keys, so a note that contains one is refused by value. */
|
package/dist/agent/controller.js
CHANGED
|
@@ -10,7 +10,7 @@ import { countAllImages, countHistoryImages, makeImageProjection, projectImagesF
|
|
|
10
10
|
import { buildImageInputBlock } from './image-input-prompt.js';
|
|
11
11
|
import { isImageCapabilityRefusal } from '@aragon-agent/tui/model/agent/image-refusal';
|
|
12
12
|
import { Agent, IMAGE_TOKEN_ESTIMATE, initProviders, ModelRegistry, } from '@aragon-agent/core';
|
|
13
|
-
import { clampCompactionConfig, clampFastConfig, clampRetryConfig, clampMemoryConfig, clampTeamConfig, clampTodoConfig, isAdapterProvider, toRetryPolicy, } from '@aragon-agent/tui/model/config/schema';
|
|
13
|
+
import { clampCompactionConfig, clampFastConfig, clampRetryConfig, clampGeneConfig, clampMemoryConfig, clampTeamConfig, clampTodoConfig, isAdapterProvider, toRetryPolicy, } from '@aragon-agent/tui/model/config/schema';
|
|
14
14
|
import { resolveModelProfileState } from '@aragon-agent/tui/model/config/model-profile-resolution';
|
|
15
15
|
import { makeGetApiKey } from '../config/load.js';
|
|
16
16
|
import { updatePersistedConfig } from '../config/store.js';
|
|
@@ -37,6 +37,10 @@ import { buildRedTeamBanner } from './redteam-prompt.js';
|
|
|
37
37
|
import { acceptRedTeamWaiver, getRedTeamWaiverVersion, } from '../config/ui-state.js';
|
|
38
38
|
import { MemoryService, UNAVAILABLE_VIEW } from '../memory/service.js';
|
|
39
39
|
import { createMemoryTools } from '../memory/tools.js';
|
|
40
|
+
import { createGeneWiring } from '../gene/wiring.js';
|
|
41
|
+
import { skillPortOf } from '../gene/import-skill-port.js';
|
|
42
|
+
import { createToolAccess, geneRunTimeoutOverride } from '../gene/tools.js';
|
|
43
|
+
import { emptyGeneSessionView } from '@aragon-agent/tui/model/gene/activity';
|
|
40
44
|
import { buildFastBlock } from '../fast/prompt.js';
|
|
41
45
|
import { ProcSupervisor } from '../proc/supervisor.js';
|
|
42
46
|
import { buildBackgroundJobsBlock, buildBackgroundServicesBlock } from '../proc/prompt.js';
|
|
@@ -74,7 +78,7 @@ import { createNodeSkillHost } from '../skills/node-host.js';
|
|
|
74
78
|
import { SkillService } from '../skills/service.js';
|
|
75
79
|
import { createSkillTools } from '../skills/tools.js';
|
|
76
80
|
import { SKILL_TRIAGE_LIMITS } from '../skills/triage.js';
|
|
77
|
-
import { buildSystemPrompt } from './system-prompt.js';
|
|
81
|
+
import { buildSystemPrompt, describeShell } from './system-prompt.js';
|
|
78
82
|
import { buildSkillTriageBlock } from './skill-triage-prompt.js';
|
|
79
83
|
import { resetConversationWith, } from './conversation-reset.js';
|
|
80
84
|
import { archiveClearedConversation, } from '../session/clear-archive.js';
|
|
@@ -252,6 +256,15 @@ export class AgentController {
|
|
|
252
256
|
// unregistered, so `memory.enabled` turned off mid-session makes the block disappear and
|
|
253
257
|
// the tools refuse, but a fully clean session needs a restart.
|
|
254
258
|
memory;
|
|
259
|
+
/**
|
|
260
|
+
* The Gene Bank composition root (gene-bank spec 4), or `undefined` when the feature is off
|
|
261
|
+
* (`gene.enabled`, after the `ARAGON_GENE` kill switch and `--no-gene`). `undefined` is what
|
|
262
|
+
* leaves the tool array, the system prompt and the status row byte-identical to the build
|
|
263
|
+
* before the feature existed (I-20). Fixed at construction, like `memory`: tools cannot be
|
|
264
|
+
* unregistered, so `enabled` turned off mid-session makes the blocks vanish and the tools
|
|
265
|
+
* refuse (`use`), but a fully clean session needs a restart.
|
|
266
|
+
*/
|
|
267
|
+
gene;
|
|
255
268
|
// -----------------------------------------------------------------------
|
|
256
269
|
// Todo planning (todo-plan-execution §3.6a) — THE SAME TWO FLAGS, FOR THE
|
|
257
270
|
// SAME REASON.
|
|
@@ -577,9 +590,46 @@ export class AgentController {
|
|
|
577
590
|
// keystroke. It still goes through the wiring, so the log and the view agree.
|
|
578
591
|
if (deps.redTeamArmed === true)
|
|
579
592
|
this.redTeam.armForLaunch();
|
|
593
|
+
// THE GENE BANK (gene-bank spec 4), ABOVE `createBuiltinTools` because its tools and hint
|
|
594
|
+
// engine are passed in. Every closure below is read LATER (tools / agent / fast do not exist
|
|
595
|
+
// yet), which is why none of them is evaluated here.
|
|
596
|
+
this.gene = createGeneWiring({
|
|
597
|
+
getConfig: () => this.config,
|
|
598
|
+
getCwd: () => this.cwd,
|
|
599
|
+
sessionId: this.jobSessionTag,
|
|
600
|
+
kind: deps.gene?.kind ?? 'tui',
|
|
601
|
+
headless: !this.planInteractive,
|
|
602
|
+
learnFlag: deps.gene?.learnFlag === true,
|
|
603
|
+
printMode: deps.gene?.printMode === true,
|
|
604
|
+
registeredToolNames: () => [...this.tools, ...this.callerTools].map((tool) => tool.name),
|
|
605
|
+
windowTokens: () => this.getModelInfo().contextWindow,
|
|
606
|
+
knownSecrets: () => this.memoryKnownSecrets(),
|
|
607
|
+
rebuildPrompt: () => this.rebuildSystemPrompt(),
|
|
608
|
+
notify: (level, text) => deps.notify?.(level, text),
|
|
609
|
+
mode: () => {
|
|
610
|
+
const posture = this.getPosture();
|
|
611
|
+
if (posture === 'govern' || posture === 'plan_govern')
|
|
612
|
+
return 'govern';
|
|
613
|
+
if (posture === 'plan')
|
|
614
|
+
return 'plan';
|
|
615
|
+
return this.teamRegistered ? 'team' : 'build';
|
|
616
|
+
},
|
|
617
|
+
redTeamArmed: () => this.redTeam?.isArmed() === true,
|
|
618
|
+
fastTier: () => this.fast?.getTier() ?? { ok: false, reason: 'disabled' },
|
|
619
|
+
mainModel: () => ({
|
|
620
|
+
providerId: this.config.provider,
|
|
621
|
+
modelId: this.config.model,
|
|
622
|
+
...(this.config.baseUrl ? { baseUrl: this.config.baseUrl } : {}),
|
|
623
|
+
}),
|
|
624
|
+
getApiKey: (providerId, role) => this.resolveKey(providerId, role ?? 'main'),
|
|
625
|
+
skills: () => (this.skillsEnabled ? skillPortOf(this.skills) : null),
|
|
626
|
+
...(deps.gene?.root === undefined ? {} : { root: deps.gene.root }),
|
|
627
|
+
});
|
|
580
628
|
this.teamRuntime = this.teamRegistered
|
|
581
629
|
? new TeamRuntime({
|
|
582
630
|
getConfig: () => this.config,
|
|
631
|
+
// Sub-agents share the process-wide library (no copy); absent when the library is off.
|
|
632
|
+
...(this.gene ? { geneTools: this.gene.subagentTools() } : {}),
|
|
583
633
|
// Read LIVE: the closure is only ever called from inside a dispatch,
|
|
584
634
|
// and `childFactory()` re-reads `compaction.subagents` on every call
|
|
585
635
|
// so a settings-screen edit reaches the next dispatch.
|
|
@@ -941,6 +991,17 @@ export class AgentController {
|
|
|
941
991
|
}),
|
|
942
992
|
}
|
|
943
993
|
: {}),
|
|
994
|
+
// THE FOUR GENE TOOLS AND THE HINT ENGINE (gene-bank 9.1 / 9.4), THROUGH THE FACTORY for the
|
|
995
|
+
// reason `memoryTools` records - and for one more: `gene_run` must sit INSIDE the plan gate,
|
|
996
|
+
// the skill ceiling and the approval wrappers applied there, exactly like `bash`. The access
|
|
997
|
+
// object reads `this.tools` LAZILY, so the `bash` it delegates to is the fully wrapped one
|
|
998
|
+
// (I-15). Absent when the library is off, which leaves the array provably untouched.
|
|
999
|
+
...(this.gene
|
|
1000
|
+
? {
|
|
1001
|
+
geneTools: this.gene.tools(createToolAccess(() => this.tools), true, () => describeShell().shell),
|
|
1002
|
+
geneHints: this.gene.hints,
|
|
1003
|
+
}
|
|
1004
|
+
: {}),
|
|
944
1005
|
// SPREAD, NEVER `resultTool: deps.resultTool` (the D-12 lesson, and the shape
|
|
945
1006
|
// every optional dep in this bag follows). With no schema the options bag has no
|
|
946
1007
|
// such key, so `createBuiltinTools` adds nothing and the tool array is the one it
|
|
@@ -1041,6 +1102,13 @@ export class AgentController {
|
|
|
1041
1102
|
}
|
|
1042
1103
|
: {}),
|
|
1043
1104
|
});
|
|
1105
|
+
// `gene_run` FOLLOWS `bash` (9.6): with the shell denied or absent the tool could only be
|
|
1106
|
+
// refused, and advertising it would burn a turn. In place, because `tools` is `readonly`.
|
|
1107
|
+
if (this.gene && !this.tools.some((tool) => tool.name === 'bash')) {
|
|
1108
|
+
const orphan = this.tools.findIndex((tool) => tool.name === 'gene_run');
|
|
1109
|
+
if (orphan >= 0)
|
|
1110
|
+
this.tools.splice(orphan, 1);
|
|
1111
|
+
}
|
|
1044
1112
|
const model = {
|
|
1045
1113
|
providerId: config.provider,
|
|
1046
1114
|
modelId: config.model,
|
|
@@ -1160,6 +1228,11 @@ export class AgentController {
|
|
|
1160
1228
|
// outlived a mid-session `Settings > Team` switch to the supervisor
|
|
1161
1229
|
// and killed the dispatch the supervisor was meant to look after.
|
|
1162
1230
|
...(this.teamRegistered ? { task: 0 } : {}),
|
|
1231
|
+
// `gene_run` delegates to `bash`, which may wait on a human approval: the executor arms
|
|
1232
|
+
// its timer when `gene_run` starts, so the wait must not be charged to the gene's command.
|
|
1233
|
+
...(this.gene
|
|
1234
|
+
? geneRunTimeoutOverride(config.toolTimeoutMs, deps.decisionBudgetMs ?? 0)
|
|
1235
|
+
: {}),
|
|
1163
1236
|
// THE EXECUTOR'S OWN CLOCK FOR A LONG WAIT (extended-job-wait I-2 / I-4').
|
|
1164
1237
|
// Without it `job_wait` falls onto `toolTimeoutMs` (180 s) and a 20-minute
|
|
1165
1238
|
// wait dies at three; with `0` the wait would have no independent backstop
|
|
@@ -1227,6 +1300,9 @@ export class AgentController {
|
|
|
1227
1300
|
// its own agent. A receipt is where a user steer stops being pending;
|
|
1228
1301
|
// `agent_start` is where a requested abort stops being in force.
|
|
1229
1302
|
this.agent.subscribe((event) => {
|
|
1303
|
+
// The Gene Bank's feed (learner ledger, usage, evaluation). Never throws.
|
|
1304
|
+
// `abortRequested` is still in force here: it is cleared at the NEXT `agent_start`.
|
|
1305
|
+
this.gene?.onAgentEvent(event, this.abortRequested);
|
|
1230
1306
|
if (event.type === 'agent_start')
|
|
1231
1307
|
this.abortRequested = false;
|
|
1232
1308
|
if (event.type === 'message_update' && event.streamEvent.type === 'error') {
|
|
@@ -1292,6 +1368,9 @@ export class AgentController {
|
|
|
1292
1368
|
if (this.fast) {
|
|
1293
1369
|
this.rebuildSystemPrompt();
|
|
1294
1370
|
}
|
|
1371
|
+
// The library opens LAST: it needs the Agent (events), the tools (registered names) and the fast
|
|
1372
|
+
// wiring. `start()` never rejects; its failures are a degraded view, not an exception.
|
|
1373
|
+
void this.gene?.start();
|
|
1295
1374
|
// ONE LINE FOR THE TWO CONFIGURATION MISTAKES THAT ARE OTHERWISE INVISIBLE
|
|
1296
1375
|
// (§3.3): the tier is on but unnamed, or named against a provider with no
|
|
1297
1376
|
// key. Nothing else in the session would ever mention either.
|
|
@@ -1367,6 +1446,11 @@ export class AgentController {
|
|
|
1367
1446
|
// pre-builds the INCOMING model's prompt, and budgets sized for the outgoing window
|
|
1368
1447
|
// would overrun a smaller one. `''` when memory is off, which splices nothing.
|
|
1369
1448
|
memoryBlock: this.memory?.renderBlock(config) ?? '',
|
|
1449
|
+
// Gene Bank (9.2). The rules block is a source constant; the context block is the last
|
|
1450
|
+
// zone `planForTurn` computed and is spliced BEFORE `Operating guidance`, never after the
|
|
1451
|
+
// caller's appended instructions (RV-2). Both '' when off: nothing is spliced.
|
|
1452
|
+
geneRulesBlock: this.gene?.rulesBlock(this.tools.map((tool) => tool.name), config) ?? '',
|
|
1453
|
+
geneContextBlock: this.gene?.contextBlock() ?? '',
|
|
1370
1454
|
// Immediately after the catalog it refers to, before the plan block whose
|
|
1371
1455
|
// first step defers to it (§4.2.4).
|
|
1372
1456
|
skillTriageBlock: triageBlock,
|
|
@@ -1663,6 +1747,16 @@ export class AgentController {
|
|
|
1663
1747
|
}
|
|
1664
1748
|
/** Prepare before clearing the plan, then enter the engine without yielding. */
|
|
1665
1749
|
async startPrompt(text, options, request) {
|
|
1750
|
+
// THE GENE ZONE IS PLANNED BEFORE THE PROMPT IS BUILT (9.3), because the loop captures the
|
|
1751
|
+
// system prompt by value on its way in. Bounded (~100 ms) and never rejects; a cancellation
|
|
1752
|
+
// that arrived while it ran is honoured before anything is prepared.
|
|
1753
|
+
if (this.gene) {
|
|
1754
|
+
this.gene.beginRun();
|
|
1755
|
+
await this.gene.planForTurn(text, 'user_turn');
|
|
1756
|
+
if (request !== this.startupSequence) {
|
|
1757
|
+
return { status: 'not-started', reason: 'cancelled' };
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1666
1760
|
this.prepareUserTurn(text, { steering: false });
|
|
1667
1761
|
if (request !== this.startupSequence) {
|
|
1668
1762
|
return { status: 'not-started', reason: 'cancelled' };
|
|
@@ -1711,6 +1805,7 @@ export class AgentController {
|
|
|
1711
1805
|
* thoughtless option.
|
|
1712
1806
|
*/
|
|
1713
1807
|
prepareUserTurn(text, options) {
|
|
1808
|
+
this.gene?.onUserMessage(text, { steering: options.steering });
|
|
1714
1809
|
if (this.skillsEnabled)
|
|
1715
1810
|
this.skills.beginUserTurn();
|
|
1716
1811
|
if (!options.steering) {
|
|
@@ -2554,6 +2649,56 @@ export class AgentController {
|
|
|
2554
2649
|
this.rebuildSystemPrompt();
|
|
2555
2650
|
return memory;
|
|
2556
2651
|
}
|
|
2652
|
+
// -----------------------------------------------------------------------
|
|
2653
|
+
// Gene Bank - public surface (gene-bank spec 16.8)
|
|
2654
|
+
// -----------------------------------------------------------------------
|
|
2655
|
+
/** The composition root, or `undefined` when the library is off / a subagent. */
|
|
2656
|
+
getGeneWiring() {
|
|
2657
|
+
return this.gene;
|
|
2658
|
+
}
|
|
2659
|
+
/** The per-session read facade, or `undefined` when off. */
|
|
2660
|
+
getGeneService() {
|
|
2661
|
+
return this.gene?.service;
|
|
2662
|
+
}
|
|
2663
|
+
/** The manager both user interfaces talk to, or `undefined` when off. */
|
|
2664
|
+
getGeneManager() {
|
|
2665
|
+
return this.gene?.manager;
|
|
2666
|
+
}
|
|
2667
|
+
/** The unified status; `available: false` when the library is off. */
|
|
2668
|
+
getGeneView() {
|
|
2669
|
+
return this.gene?.getView() ?? emptyGeneSessionView();
|
|
2670
|
+
}
|
|
2671
|
+
/** Subscribe to status changes; the returned function unsubscribes. */
|
|
2672
|
+
subscribeGene(listener) {
|
|
2673
|
+
return this.gene?.subscribe(listener) ?? (() => { });
|
|
2674
|
+
}
|
|
2675
|
+
/**
|
|
2676
|
+
* Adopt a new `gene` config for this session (Settings > Genes, `/gene on|off`), clamped here
|
|
2677
|
+
* as well as on the persist path. Like `setMemoryConfig` this does NOT persist. The two user
|
|
2678
|
+
* switches take effect on the NEXT call (I-18); the prompt is rebuilt so the blocks follow.
|
|
2679
|
+
*/
|
|
2680
|
+
setGeneConfig(patch) {
|
|
2681
|
+
const gene = clampGeneConfig({ ...this.config.gene, ...patch });
|
|
2682
|
+
this.advanceSettingsRevision();
|
|
2683
|
+
this.config = { ...this.config, gene };
|
|
2684
|
+
this.gene?.onConfigChanged();
|
|
2685
|
+
this.rebuildSystemPrompt();
|
|
2686
|
+
return gene;
|
|
2687
|
+
}
|
|
2688
|
+
/** A SESSION-level `use` override (the desktop's host command); `null` returns to the config. */
|
|
2689
|
+
setGeneUse(value) {
|
|
2690
|
+
this.gene?.setUseOverride(value);
|
|
2691
|
+
this.rebuildSystemPrompt();
|
|
2692
|
+
}
|
|
2693
|
+
/** A SESSION-level `autoLearn` override; `null` returns to the config. */
|
|
2694
|
+
setGeneAutoLearn(value) {
|
|
2695
|
+
this.gene?.setAutoLearnOverride(value);
|
|
2696
|
+
this.rebuildSystemPrompt();
|
|
2697
|
+
}
|
|
2698
|
+
/** Pause / resume THIS machine's curator consumption (queueing is unaffected). */
|
|
2699
|
+
geneCurator(action) {
|
|
2700
|
+
this.gene?.curatorControl(action);
|
|
2701
|
+
}
|
|
2557
2702
|
/** The window of the model `cfg` selects, or `undefined` when only a fallback is known. */
|
|
2558
2703
|
memoryWindowTokens(cfg) {
|
|
2559
2704
|
if (typeof cfg.contextWindow === 'number' && cfg.contextWindow > 0)
|
|
@@ -2620,6 +2765,8 @@ export class AgentController {
|
|
|
2620
2765
|
this.modelMetadataGeneration += 1;
|
|
2621
2766
|
this.modelMetadataAbort.abort();
|
|
2622
2767
|
this.teamRuntime?.dispose();
|
|
2768
|
+
// Flushes usage, stops the learner / curator / maintenance and releases the lease. Never rejects.
|
|
2769
|
+
void this.gene?.dispose();
|
|
2623
2770
|
this.governance.dispose();
|
|
2624
2771
|
this.fast?.dispose();
|
|
2625
2772
|
this.compaction?.dispose();
|
|
@@ -3002,6 +3149,8 @@ export class AgentController {
|
|
|
3002
3149
|
// The PROJECT scope moved with the directory: recompute which notes are visible before
|
|
3003
3150
|
// the rebuild reads them (agent-memory 5.3).
|
|
3004
3151
|
this.memory?.setCwd(cwd);
|
|
3152
|
+
// The PROJECT scope and the environment fingerprint moved with the directory (gene-bank 9.3).
|
|
3153
|
+
this.gene?.resetSession('cwd');
|
|
3005
3154
|
this.rebuildSystemPrompt();
|
|
3006
3155
|
this.onSkillsChanged?.();
|
|
3007
3156
|
}
|
|
@@ -3101,6 +3250,7 @@ export class AgentController {
|
|
|
3101
3250
|
* `docs/plans/clear-command-context-reset/spec.md`.
|
|
3102
3251
|
*/
|
|
3103
3252
|
clearMessages() {
|
|
3253
|
+
this.gene?.resetSession('clear');
|
|
3104
3254
|
this.idleCompaction?.abort();
|
|
3105
3255
|
this.restoredCompactionIdentity = undefined;
|
|
3106
3256
|
this.agent.clearMessages();
|
|
@@ -3191,6 +3341,7 @@ export class AgentController {
|
|
|
3191
3341
|
return this.agent.state.systemPrompt;
|
|
3192
3342
|
}
|
|
3193
3343
|
replaceMessages(messages, identity) {
|
|
3344
|
+
this.gene?.resetSession('resume');
|
|
3194
3345
|
this.idleCompaction?.abort();
|
|
3195
3346
|
this.restoredCompactionIdentity = identity;
|
|
3196
3347
|
this.agent.replaceMessages(messages);
|
|
@@ -36,6 +36,7 @@ import { buildRoleBlock } from '../governance/prompts/role-blocks.js';
|
|
|
36
36
|
import { readRunReport } from '../governance/report-reader.js';
|
|
37
37
|
import { ArtifactStore } from '../governance/store/artifacts.js';
|
|
38
38
|
import { RunStore } from '../governance/store/run-store.js';
|
|
39
|
+
import { withoutOrphanGeneRun } from '../gene/tools.js';
|
|
39
40
|
import { buildChildTools } from '../governance/tools/child-tools.js';
|
|
40
41
|
import { applyInspectorToolPolicy, withGovernanceReadGuard } from '../governance/tools/guard.js';
|
|
41
42
|
import { makeGovDispatchTool, makeGovRunTool } from '../governance/tools/lead-tools.js';
|
|
@@ -287,9 +288,15 @@ export class GovernanceWiring {
|
|
|
287
288
|
if (ext === undefined)
|
|
288
289
|
return tools;
|
|
289
290
|
const root = getGovernanceDir();
|
|
290
|
-
const
|
|
291
|
+
const policed = ext.role === 'INSP'
|
|
291
292
|
? applyInspectorToolPolicy(tools, { integrationCommands: ext.integrationCommands ?? [] })
|
|
292
293
|
: tools;
|
|
294
|
+
// `gene_run` FOLLOWS `bash` (gene-bank 9.6): an inspector with no registered integration
|
|
295
|
+
// command has no shell, and a library tool that runs through that shell goes with it. When the
|
|
296
|
+
// inspector DOES keep a (restricted) `bash`, `gene_run` stays and delegates to that restricted
|
|
297
|
+
// tool, because the child's gene tools resolve `bash` from its FINAL array (`createToolAccess`).
|
|
298
|
+
// The gene READ tools pass through untouched: they write nothing and need no shell.
|
|
299
|
+
const base = withoutOrphanGeneRun(policed);
|
|
293
300
|
return base.map((tool) => withGovernanceReadGuard(tool, root));
|
|
294
301
|
}
|
|
295
302
|
// -------------------------------------------------------------------------
|
|
@@ -36,6 +36,32 @@ export interface SystemPromptParams {
|
|
|
36
36
|
* pre-memory prompt BYTE FOR BYTE (`memory.enabled: false`, `-p`, and every subagent).
|
|
37
37
|
*/
|
|
38
38
|
memoryBlock?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The stable `<gene_library>` rules block, or `''` / absent (gene-bank spec 9.2, I-2, I-20).
|
|
41
|
+
*
|
|
42
|
+
* POSITION IS THE SEMANTICS: immediately AFTER `memoryBlock` and before the skills catalog.
|
|
43
|
+
* Both are stable prefix text (every sentence of this block is independent of the current
|
|
44
|
+
* task), so they sit together in front of the blocks that change with the mode. The text is a
|
|
45
|
+
* SOURCE CONSTANT built by `buildGeneRulesBlock`; nothing a gene says can reach it.
|
|
46
|
+
*
|
|
47
|
+
* Spliced conditionally exactly as `memoryBlock` is: `gene.enabled: false`, `--no-gene`,
|
|
48
|
+
* `ARAGON_GENE=0`, a session without the gene tools and every caller that passes nothing
|
|
49
|
+
* produce the pre-feature prompt BYTE FOR BYTE for a fixed tool array.
|
|
50
|
+
*/
|
|
51
|
+
geneRulesBlock?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The `<gene_context>` zone of one-line previews, or `''` / absent (gene-bank spec 9.2, RV-2).
|
|
54
|
+
*
|
|
55
|
+
* THE ONE BLOCK THAT CHANGES PER TASK, so it goes AFTER every stable subsystem block (their
|
|
56
|
+
* prefix cache stays warm) and BEFORE `<structured_result>`, `Operating guidance:` and the
|
|
57
|
+
* caller's `## Additional instructions`. It must NEVER move after `appendSystemPrompt`: that
|
|
58
|
+
* section is last so "no CLI-generated content can be read as a correction of the caller's
|
|
59
|
+
* instructions", and `project-guidance-prompt.test.ts` pins the `endsWith` that says so. This
|
|
60
|
+
* zone is automatically generated and the lowest-trust text in the prompt.
|
|
61
|
+
*
|
|
62
|
+
* Empty splices NOTHING (not even a blank line), which keeps the closed state byte-identical.
|
|
63
|
+
*/
|
|
64
|
+
geneContextBlock?: string;
|
|
39
65
|
/**
|
|
40
66
|
* The session's current mode. Absent or `'build'` produces a BYTE-IDENTICAL
|
|
41
67
|
* prompt to the pre-plan-mode output for a fixed `tools` array (I-P1) — the
|