@sous-io/sous 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  - [Overview](/)
2
+ - [For agents](for-agents.md)
2
3
  - [Design principles](design-principles.md)
3
4
  - [Skill categories](skill-categories.md)
4
5
  - [Command reference](commands.md)
@@ -89,3 +90,6 @@
89
90
  - [0043: Every command runs the waiting migrations first](adrs/0043-migrations-before-every-command.md)
90
91
  - [0044: A recipe can recommend other recipes, and sous asks before subscribing to them](adrs/0044-recipe-recommendations.md)
91
92
  - [0045: `core` comes from `sous`, and `the-pantry` replaces `sous-recipes`](adrs/0045-core-in-sous-and-the-pantry.md)
93
+ - [0046: A variable with a default is not asked at subscribe or update, unless its priority is high](adrs/0046-variable-priority.md)
94
+ - [0047: One generated script sets up every new checkout, and Husky is dropped](adrs/0047-worktree-setup.md)
95
+ - [0048: An empty answer is valid only when its variable sets `allowEmpty: true`](adrs/0048-allow-empty.md)
@@ -33,14 +33,13 @@ finds by walking up from the working directory.
33
33
  command takes it.
34
34
  - `--non-interactive` never asks anything. A run that would have asked fails instead, naming the question and
35
35
  the flag that would have answered it.
36
- - `--dry-run` prints what the command would do, and writes, downloads and asks nothing.
36
+ - `--dry-run` prints what the command would do, and writes and downloads nothing. It asks nothing either,
37
+ except `sous vars ask --dry-run`, which asks its questions in a terminal to show what each answer would
38
+ write.
37
39
 
38
40
  Sous asks a question only when it can. Piping output, redirecting it to a file and running in CI therefore do
39
41
  what `--non-interactive` does; see [When sous cannot ask](repositories-consuming.md#when-sous-cannot-ask).
40
42
 
41
- !> `sous clear` is the exception: without `-f` it asks even under `--non-interactive` or in CI, so pass `-f`
42
- whenever you script it.
43
-
44
43
  ?> `sous repo init --force` used to overwrite a repository that already existed. It is now the same flag as
45
44
  `--yes`, as on every other command, and `sous repo init` never replaces a file unless `--overwrite` is given.
46
45
 
@@ -177,90 +176,116 @@ leave them, or choose for each file. `--move-includes`, `--copy-includes` and `-
177
176
  of time, one at a time, and `--yes` accepts the default, move. A run with no terminal and none of these flags
178
177
  fails, naming them. `--dry-run` plans with the default and asks nothing.
179
178
 
180
- In a project with a `.git` folder, init asks whether to install the git hooks, which
181
- [`sous init hooks`](#sous-init-hooks-directory) describes, and then whether to add the ones that run after a pull.
182
- `--hooks` and `--no-hooks` answer the first question, `--pull-hooks` and `--no-pull-hooks` the second, and `--yes`
183
- installs the hooks without the pull ones. With a `package.json`, the hooks run the package manager's install,
184
- and init then offers to run it (`--install`, `--no-install`; `--yes` runs it). That install runs `sous build`
185
- through the package script, so init skips its own build; when the install is declined, init builds by itself.
186
- `--no-build` also leaves the install out, unless `--install` asks for it.
179
+ In a project with a `.git` folder, init asks whether to install the git hooks, the worktree script and the
180
+ Claude Code settings that set up each new checkout, which [`sous init hooks`](#sous-init-hooks-directory)
181
+ describes. `--hooks` and `--no-hooks` answer, and `--yes` installs them. `--worktree-script` writes only
182
+ `scripts/init-new-worktree.mjs`, without hooks. `--no-pull-hooks` leaves out the hooks that run after a pull and a
183
+ rebase. A run with no terminal and none of `--hooks`, `--no-hooks` and `--yes` fails, naming them.
187
184
 
188
- A project whose `.sous/` already holds a config is left untouched. `--no-build` skips the first build.
185
+ A project whose `.sous/` already holds a config is left untouched: plain `sous init` refuses there, naming
186
+ `--hooks` and `--worktree-script`. With either flag, init writes only those files and leaves `.sous/` alone (apart
187
+ from the `conf.d` layer `--hooks` adds). A file that already exists is kept and reported; `--overwrite` replaces
188
+ it, asking before each file, and `--overwrite --yes` replaces them all without asking. `--overwrite` with no
189
+ terminal and without `--yes` fails, naming `--yes`. `--no-build` skips the first build.
189
190
 
190
191
  ```bash
191
192
  sous init
192
193
  sous init --name "My Project"
193
194
  sous init --copy-includes
194
- sous init --yes --pull-hooks
195
195
  sous init --no-hooks
196
+ sous init --hooks
197
+ sous init --worktree-script --overwrite
196
198
  sous init --dry-run
197
199
  ```
198
200
 
199
201
  ### `sous init hooks [DIRECTORY]`
200
202
 
201
- Installs the git hooks that give a new worktree, and each checked-out branch, Sous's output. Sous's output is
202
- git-ignored, so a new worktree starts without it; git runs `post-checkout` whenever a worktree is created or a
203
- branch is checked out, whoever runs git (a person, Claude Code, the Claude Desktop app, an IDE).
203
+ Sets a project up so that every new checkout of it gets its dependencies and Sous's output, with nothing to
204
+ remember. Sous's output is git-ignored, so a new worktree or a fresh clone starts without it. `sous init hooks`
205
+ writes these files once; after that they belong to the project, and sous never changes them again:
206
+
207
+ - **`scripts/init-new-worktree.mjs`**, which does the work and decides what is needed. It copies the gitignored
208
+ files listed at its top (by default `.sous/.env.local`) from the main checkout into a linked worktree (a copy,
209
+ never a link, and never over a file the worktree has; the main checkout is never copied into), runs the
210
+ package manager's install when the dependencies changed or `node_modules` is missing, and builds when the
211
+ build's sources (`.sous/`, the package files) changed or the agent files are missing. It is generated for the
212
+ project's package manager (npm, pnpm, Yarn or Bun, falling back to `corepack` when pnpm or Yarn is not on the
213
+ PATH) and builds through a package script that runs `sous build` when the project has one, else through the
214
+ package manager, else with `sous build` from the PATH. Run it by hand with `node scripts/init-new-worktree.mjs`.
215
+ - **A hook per event** in the tracked `.githooks/` folder: `post-checkout` (a branch checkout, a new worktree, a
216
+ clone's first checkout), `post-merge` (a merge, which includes a pull) and `post-rewrite` (a rebase).
217
+ `--no-pull-hooks` leaves out the last two. Each hook only finds Node (on the PATH, where Volta, asdf and mise
218
+ put their shims, else through nvm's `nvm.sh`) and runs the script; when Node cannot be found, it prints one
219
+ line and exits 0. A hook never stops git.
220
+ - **`core.hooksPath`**, set to `.githooks` in this clone, so git runs those hooks. When the project already points
221
+ git at a folder of its own (its own Husky, lefthook), the hooks go into that folder instead and the setting is
222
+ left as it is. A setting that names a folder outside the project (a machine-wide hooks folder) is replaced in
223
+ this clone.
224
+ - **The package script** the manager runs after an install (`prepare` for npm, pnpm and Bun, `postinstall` for
225
+ Yarn) gains `node scripts/init-new-worktree.mjs after-install`, after what it already runs. A clone's settings
226
+ do not travel with it, so this is how a fresh clone gets the hooks: its first install points git at
227
+ `.githooks/` and builds. With `CI` set, and while a package is packed or published, the call only points git at
228
+ the hooks.
229
+ - **`.sous/conf.d/300-worktree-setup.jsonc`**, which declares two [edits](editing-files.md) to Claude Code's
230
+ `.claude/settings.json` that every build applies: a `SessionStart` hook that runs the script when a session
231
+ starts in a checkout whose agent files are missing, and `~/worktrees` in `permissions.additionalDirectories`.
232
+ Claude Code waits for a `SessionStart` hook before the session begins, so the script builds in the background
233
+ and tells the agent where its log is; the session itself starts without the project's instructions.
204
234
 
205
235
  ```text
206
- git worktree add / git checkout <branch>
207
- -> .husky/post-checkout runs `pnpm install`
208
- -> pnpm runs the "prepare" script
209
- -> sous build
210
- ```
211
-
212
- - **With a `package.json`:** Husky is added as a dev dependency, and `.husky/post-checkout` runs the package
213
- manager's install (`npm install`, `pnpm install` or `yarn install`, by the manager sous detects) on every
214
- branch checkout. The script the manager runs after an install runs Husky and `sous build`: `prepare` for npm
215
- and pnpm, `postinstall` for Yarn, whose newer versions skip `prepare` on install. A script already under that
216
- name keeps what it has, and Sous's part runs after it. The guard `|| exit 0` means a missing `sous` command (an
217
- install without dev dependencies) or a failed build prints its error and does not fail the install. At the
218
- end, sous offers to run the install, which installs Husky and so turns the hooks on (`--install`,
219
- `--no-install`; `--yes` runs it). Since sous has just added Husky to `package.json`, that install may update the
220
- lockfile even where the manager would freeze it in CI (`pnpm install --no-frozen-lockfile`,
221
- `yarn install --no-immutable` for Yarn 2 and later); the hook itself runs the plain install. Sous does not look for other hook managers: installing Husky points git at
222
- `.husky/`, so another manager's hooks stop running until the project sorts that out.
223
- - **Without one:** the repository's own `post-checkout` hook (in `.git/hooks/`, or wherever `core.hooksPath`
224
- points) runs `sous build` directly, and does nothing when there is no `sous` command.
225
-
226
- `post-checkout` is installed by default. Sous asks whether to add `post-merge` (after a pull that merges) and
227
- `post-rewrite` (after a rebase, including a pull set to rebase); `--pull-hooks` and `--no-pull-hooks` answer, and
228
- `--yes` leaves them out. Each hook prints a failure and exits 0, so git carries on.
229
-
230
- The hook for pnpm, `.husky/post-checkout`:
236
+ git worktree add / checkout / pull / rebase -> .githooks/<hook> -> node scripts/init-new-worktree.mjs <hook> ...
237
+ pnpm install in a fresh clone -> the "prepare" script -> node scripts/init-new-worktree.mjs after-install
238
+ a Claude Code session starts -> the SessionStart hook -> node .../init-new-worktree.mjs session-start
239
+ ```
240
+
241
+ The hook `.githooks/post-checkout`:
231
242
 
232
243
  ```sh
233
- # >>> sous managed: init hooks (do not edit between these markers)
234
- # After a checkout, install the dependencies; the "prepare" script then runs `sous build`, so the
235
- # files Sous writes match this checkout. A failure is printed, and git carries on.
236
- if [ "$3" = "1" ]; then
237
- pnpm install || echo "sous: 'pnpm install' failed after a checkout; git carried on." >&2
244
+ #!/bin/sh
245
+ [ -f scripts/init-new-worktree.mjs ] || exit 0
246
+
247
+ # Find Node: on the PATH (Volta, asdf and mise put their shims there), else through nvm.
248
+ if ! command -v node >/dev/null 2>&1 && [ -s "${NVM_DIR:-$HOME/.nvm}/nvm.sh" ]; then
249
+ . "${NVM_DIR:-$HOME/.nvm}/nvm.sh" >/dev/null 2>&1
238
250
  fi
239
- # <<< sous managed: init hooks
240
- ```
241
251
 
242
- And the script it adds to a `package.json` that had none:
252
+ if command -v node >/dev/null 2>&1; then
253
+ node scripts/init-new-worktree.mjs post-checkout "$@" || true
254
+ else
255
+ echo "Node was not found, so this checkout was not set up. Run 'node scripts/init-new-worktree.mjs' once Node is on the PATH." >&2
256
+ fi
243
257
 
244
- ```json
245
- {
246
- "scripts": {
247
- "prepare": "husky && sous build || exit 0"
248
- }
249
- }
258
+ exit 0
250
259
  ```
251
260
 
252
- A hook file that already exists keeps its lines and gains Sous's block after them; running the command again
253
- replaces the block and changes nothing else. Installing the hooks is a one-time action: no build puts them back,
254
- since a project may change them.
261
+ A file that already exists is kept and reported, and nothing in it changes. `--overwrite` replaces it, asking
262
+ before each file; `--overwrite --yes` replaces every one without asking, and `--overwrite` with no terminal and
263
+ without `--yes` fails, naming `--yes`. A project set up by an older sous, whose hooks run through Husky, keeps
264
+ working as it is; `--overwrite` replaces its `.husky/` hooks with ones that run the script. `--dry-run` shows the
265
+ files and changes nothing. `--install` and `--no-install` are still accepted, and do nothing: the hooks are on as
266
+ soon as they are written.
267
+
268
+ Only a project whose `.sous/` is at the top of its git repository is supported, since the hooks, the install and
269
+ the build all run there. Anywhere else (a project in a folder of a monorepo, say) the command stops and says why.
270
+
271
+ Where the hooks do not reach:
255
272
 
256
- Only a project whose `.sous/` is at the top of its git repository is supported, since the hook, the install and
257
- the build all run there. Anywhere else (a project in a folder of a monorepo, say) the command stops, says why,
258
- and prints the lines to add by hand. `--dry-run` shows the files and the install command and changes nothing.
273
+ - **A cloud session**, or any environment that clones the repository and installs with `CI` set: the clone's
274
+ first install points git at the hooks but does not build. Build in the environment's own setup
275
+ (`sous build`), or rely on the Claude Code `SessionStart` hook where the session reads `.claude/settings.json`.
276
+ - **A tool that creates a worktree without checking files out** (`git worktree add --no-checkout`): git runs no
277
+ `post-checkout`. The Claude Code `SessionStart` hook still builds when a session starts there.
278
+ - **A fresh clone before its first install**: git's settings are not cloned, so the hooks are off until
279
+ `npm install` (or the project's own manager) runs, or `git config core.hooksPath .githooks` is set by hand.
280
+ Without a `package.json` there is no install, so that setting is the one manual step; `sous doctor` reports it.
281
+ - **A developer using Sous privately in a project that does not**: the hooks, the script and the package script
282
+ are committed changes.
259
283
 
260
284
  ```bash
261
285
  sous init hooks
262
- sous init hooks --pull-hooks
263
- sous init hooks --yes --no-install
286
+ sous init hooks --no-pull-hooks
287
+ sous init hooks --overwrite
288
+ sous init hooks --overwrite --yes
264
289
  sous init hooks --dry-run
265
290
  ```
266
291
 
@@ -478,11 +503,10 @@ problem it finds, asking before each fix. Its checks, in order:
478
503
  4. Every migration for this version of sous has run (fix: run them). This check runs even when the config does
479
504
  not load, since a migration may be what makes it load again (an option a newer sous removed). When it does,
480
505
  the config is read again in the same run: the first check shows as fixed, and the checks it had skipped run.
481
- 5. The git hooks are turned on, when the project was set up with them (fix: `sous init hooks --install`). Sous
482
- reads what `sous init hooks` committed: hook files in `.husky/` holding its marked block. They are on when
483
- git's hooks folder is Husky's `.husky/_`, which the package manager's install sets up; a fresh clone whose
484
- install has not run is what this finds. A project without a `package.json` keeps its hook outside git, so a
485
- new clone cannot tell, and the check says so.
506
+ 5. The project's git hooks are on in this clone (fix: point git at them, `git config core.hooksPath .githooks`).
507
+ It reports only a project with hooks committed in `.githooks/` whose clone has `core.hooksPath` unset or
508
+ pointing elsewhere: a clone does not copy git's settings, and the worktree script sets it on its first run.
509
+ The fix never writes a hook file. A project without `.githooks/` gets no message.
486
510
  6. The `check` handlers of the recipes and plugins report no errors. Their errors are a problem and their
487
511
  warnings a warning, one line each. No fix: what they report is yours to put right.
488
512
  7. Every assertion on the files sous edits holds, checked without writing anything. A failed assertion at level
@@ -685,7 +709,9 @@ merge job. A recipe the repository no longer lists keeps its published versions,
685
709
  replacements `sous.repo.yaml` names (see
686
710
  [Retire or move a recipe](repositories-authoring.md#retire-or-move-a-recipe)). It warns about every recipe that
687
711
  uses `recommends`, which needs sous 1.2.0 or later in every subscribing project (see
688
- [Recommend other recipes](repositories-authoring.md#recommend-other-recipes)).
712
+ [Recommend other recipes](repositories-authoring.md#recommend-other-recipes)), and about every recipe that gives
713
+ a variable a `priority`, which only sous 1.4.0 or later reads, or `allowEmpty`, which only sous 1.5.0 or later
714
+ reads (see [Declare the variables a recipe needs](repositories-authoring.md#declare-the-variables-a-recipe-needs)).
689
715
 
690
716
  `--create-manifest` creates `sous.repo.yaml` at the project root, listing the project's recipe paths, when there
691
717
  is none, without asking. `--publish-dependencies` also publishes the project's own recipes that a published
@@ -717,7 +743,8 @@ Manages which recipes the project subscribes to. `REF` is `namespace` or `namesp
717
743
  recipe's questions ahead of time with `--answer <name>=<value>` or `--answers-file <path>`, and let it install
718
744
  the sous plugins it requires with `--install-plugins`. It checks everything before it writes anything: a
719
745
  repository it has to trust is trusted in memory only, every recipe it installs is downloaded, and the recipes'
720
- questions are asked (without a terminal, a required question nothing answers fails it). Only then are the
746
+ questions are asked (a question a default answers is not asked unless the variable's priority is `high`;
747
+ without a terminal, a required question nothing answers fails it). Only then are the
721
748
  trust, the subscription, the lockfile and the answers written, so a failed subscription, a declined question
722
749
  or Ctrl-C leaves the project as it was. Without `@<range>` the subscription accepts any version,
723
750
  so an update may move it to a new major version; the plan shown before the question, and the result, name
@@ -0,0 +1,84 @@
1
+ # For agents
2
+
3
+ This page is for an AI coding agent working in a project that uses Sous. Sous builds the agent's
4
+ instruction files (memories, skills, commands and other agent settings) from source templates in
5
+ the project and from shared recipes published in recipe repositories. Everything the agent reads
6
+ about how to behave in such a project was built by `sous build`, so the agent changes it by
7
+ changing the source.
8
+
9
+ ## Built files and their sources
10
+
11
+ Never edit a file Sous built. The next build overwrites the change, and nobody else receives it.
12
+ Sous backs the edited file up to `.sous/backups/` first, but the edit no longer takes effect.
13
+
14
+ The built files include:
15
+
16
+ - `.claude/rules/SOUS-MEMORIES.md` (Claude Code) and `AGENTS.override.md` (Codex): the memories
17
+ file each coding tool reads in every session.
18
+ - `.claude/skills/` and `.codex/skills/`: the compiled skills.
19
+ - Any other file a target in the project's config writes.
20
+
21
+ Their sources:
22
+
23
+ - **The project's own memories**: the markdown files under `.sous/memories/`, included by
24
+ `.sous/MEMORIES.tpl.md`.
25
+ - **The project's own skills**: the directory the project's `skillsRoot` answer names
26
+ (`.sous/skills/` in a project `sous init` set up).
27
+ - **The project's own recipes**: the folders under `.sous/recipes/`. These are sources; edit them
28
+ in place.
29
+ - **Subscribed recipes**: published by a recipe repository and kept in Sous's machine-wide store,
30
+ which is read-only build input. Change them upstream, as described below.
31
+
32
+ A built skill names its source path at its end, under "Source for this Skill". After changing a
33
+ source, run `sous build`.
34
+
35
+ ## Changing a file that came from a recipe
36
+
37
+ `sous repo contribute <namespace>/<recipe>` is always the default way to change a recipe's file,
38
+ and is strongly preferred:
39
+
40
+ 1. `sous repo contribute <namespace>/<recipe>` links a working copy of the recipe's repository on
41
+ a new branch. The project's builds read from it until the contribution is finished.
42
+ 2. Edit the recipe there, and raise its version.
43
+ 3. `sous repo contribute <namespace>/<recipe> --finish` proposes the change and unlinks.
44
+
45
+ Open a pull request directly in a recipe repository only when the user says so. When a Sous
46
+ command fails, report the failure (the command and its output) so it can be fixed, rather than
47
+ working around it.
48
+
49
+ [Contributing a change](repositories-contributing.md) describes the whole flow.
50
+
51
+ ## The skills that explain Sous
52
+
53
+ Every project receives these skills from the `core/sous-skills` recipe. Load the matching one
54
+ before changing any of the agent's own instructions or settings:
55
+
56
+ - `about-sous`: which files Sous owns, where each one's source lives, and how to change a file
57
+ that came from a recipe.
58
+ - `about-sous-configuration`: the Sous config files, config variables, and where a setting belongs.
59
+ - `about-sous-recipes`: a recipe's manifest, its version, its variables and the files it ships.
60
+ - `about-sous-repos`: recipe repositories, and releasing and proposing changes to them.
61
+
62
+ `about-agent-skills` and `create-skill` cover writing a skill, and `about-liquid-templates` covers
63
+ `.tpl.` templates.
64
+
65
+ ## Config and variables
66
+
67
+ - The project's config is `.sous/sous.config.jsonc` (or another `sous.config.*`), with layers in
68
+ `.sous/conf.d/` applied over it. `sous config show` prints the result.
69
+ - A recipe's variables are answered in `.sous/.env` (shared, committed) and `.sous/.env.local`
70
+ (this machine only). `sous vars` lists them with their answers, and `sous vars ask` answers them.
71
+
72
+ ## New worktrees
73
+
74
+ A new worktree or clone has no built files until the first build; the git hooks
75
+ `sous init --hooks` installs run it in each new worktree.
76
+
77
+ ## Further reading
78
+
79
+ - [Your project's own recipes](project-recipes.md)
80
+ - [Consuming recipes](repositories-consuming.md)
81
+ - [Contributing a change](repositories-contributing.md)
82
+ - [The config file](configuration.md)
83
+ - [Variables](config-variables.md)
84
+ - [Command reference](commands.md)
@@ -287,14 +287,29 @@ variables:
287
287
  `GITLAB_TOKEN`, `NPM_TOKEN`, or anything starting `AWS_` or `SOUS_`, except the `SOUS_VAR_` names sous
288
288
  derives itself). Two definitions of the same name share one variable; two of **different** names
289
289
  claiming the same one is an error.
290
+ - **`priority: high`** asks the variable at `sous subscription add` and `sous update` even though it has a
291
+ default, offering that default, and even when it is optional. Without it (`standard`), a default that fits
292
+ answers the variable and nothing is asked. Mark a variable `high` when the subscriber should confirm its
293
+ default, for example a placeholder such as `my-team` that every project is expected to replace. Only
294
+ sous 1.4.0 or later reads it: `sous repo release` warns about each recipe that uses it, because sous 1.2.0
295
+ or later but older than 1.4.0 ignores it, and a sous older than 1.2.0 cannot read the manifest at all.
296
+ - **`allowEmpty: true`** makes an empty answer (`NAME=""`) valid. Without it an empty answer is not valid, for
297
+ an optional variable too: it is refused when given up front, Enter with nothing typed skips an optional
298
+ question, and an empty value already stored counts as no answer (see
299
+ [Empty answers](repositories-variables.md#empty-answers)). Set it only when "deliberately empty" means
300
+ something different from "not answered", for example a prefix that may be blank. Only sous 1.5.0 or later
301
+ reads it, and `sous repo release` warns about each recipe that uses it; an older sous ignores it and accepts
302
+ an empty answer for an optional variable only. Taking it away is a tightening, so it is a major bump.
303
+ - **A variable needs no `default`.** Without one, every template, hook and plugin that uses it must handle the
304
+ missing value; the `about-sous-recipes` skill holds the rules and examples.
290
305
  - **`secret: true`** hides the value everywhere sous prints it, and **`scope`** picks the file the answer is
291
306
  written to: `shared` for the committed `.sous/.env`, `local` for the gitignored `.sous/.env.local`. A secret
292
307
  is always stored locally, so a secret declared `shared` is rejected.
293
308
  - **`validate`** carries `pattern`, `minLength`, `maxLength`, `min`, `max` and `enum`. A published `pattern` runs on
294
309
  a worker under a time budget, so one that backtracks forever fails validation rather than hanging the person
295
310
  answering, and the message names your pattern. Within a major version a schema may only LOOSEN: tightening a
296
- constraint is a major bump, and an upgrade re-validates stored answers, re-prompting only where an old one no
297
- longer fits.
311
+ constraint is a major bump, because an answer a project already stored may stop fitting, and `sous vars ask`
312
+ then asks it again.
298
313
  - **Reading another recipe's variable** needs no definition: list that recipe under `depends` and use the name in
299
314
  your templates. Redefining it makes a second definition, which sous combines with the first; see
300
315
  [Two recipes, one name](repositories-variables.md#two-recipes-one-name).
@@ -92,6 +92,12 @@ $ sous recipe show omakase/house
92
92
  answered : no, and this recipe requires an answer
93
93
  ```
94
94
 
95
+ The `answered` fact says what subscribing does with each question nothing answers yet: `no, so its default
96
+ is used: .sous/notes`, `no, so it is asked, offering its default: my-team`, `no, so it is asked, though an
97
+ answer is optional`, `no, and an answer is optional` (not asked), or `no, and this recipe requires an
98
+ answer` (asked). Which questions are asked is described under
99
+ [Which questions subscribing and updating ask](repositories-variables.md#which-questions-subscribing-and-updating-ask).
100
+
95
101
  ?> A recipe released before sous recorded questions in the index is described from its files
96
102
  instead, so its questions are listed once it is installed, and named as unknown until then.
97
103
 
@@ -113,8 +119,9 @@ recorded in its canonical form, `namespace/recipe`.
113
119
  The whole dependency closure resolves before anything is written, and so is everything else that
114
120
  could make the subscription fail: a repository you agree to trust along the way is trusted in memory
115
121
  only, every recipe the subscription installs is downloaded into this machine's store, and the
116
- recipes' questions are asked (without a terminal, a required question nothing answers, with no
117
- `--answer`, no value in scope and no default, is an error). Only then are the trust, the
122
+ recipes' questions are asked (a question a default answers is not asked unless the variable's priority
123
+ is `high`; without a terminal, a required question nothing answers, with no `--answer`, no value in scope
124
+ and no default, is an error). Only then are the trust, the
118
125
  subscription, the lockfile and the answers written; an install is whole or not at all, and a failed
119
126
  one, a declined question or Ctrl-C leaves the project as it was.
120
127
 
@@ -163,9 +170,10 @@ $ sous subscription add workflow/qa-variables
163
170
  into this project's agent directories.
164
171
  • Any scripts it ships can be run on this machine when an agent uses them. Sous does not
165
172
  run them itself, and it cannot vouch for what they do.
166
- // two more bullets: the variables it publishes that require an answer and have none yet are
167
- // asked about before anything is written, and the answers are written into this project's env
168
- // files with the subscription; and its dependencies are pinned in the lockfile
173
+ // two more bullets: the variables it publishes that have no answer yet are asked about before
174
+ // anything is written, unless the recipe lets their default answer them, and the answers are
175
+ // written into this project's env files with the subscription; and its dependencies are pinned
176
+ // in the lockfile
169
177
  • If a dependency turns out to live in a repository this project does not trust, sous stops
170
178
  and asks about that repository by name before fetching anything from it.
171
179
  ? Proceed? (y/N) y
@@ -297,11 +305,11 @@ When a target in your own config writes the same file, your target wins and the
297
305
 
298
306
  ## Answer the questions
299
307
 
300
- A recipe publishes variable definitions; you supply answers. Subscribing asks whatever is
301
- unanswered, reports whatever it inherited from an answer already in scope, and never re-asks
302
- something that already fits. [Recipe variables](repositories-variables.md#answer-the-questions)
303
- covers the question screen, the advanced view and the ladder; what follows is what a subscribe
304
- needs.
308
+ A recipe publishes variable definitions; you supply answers. Subscribing asks what nothing answers
309
+ yet, except a variable whose default answers it (unless its priority is `high`), lists the defaults
310
+ it used, reports whatever it inherited from an answer already in scope, and never re-asks something
311
+ that already fits. [Recipe variables](repositories-variables.md#answer-the-questions) covers which
312
+ questions are asked, the question screen and the ladder; what follows is what a subscribe needs.
305
313
 
306
314
  ### Answering questions ahead of time
307
315
 
@@ -390,7 +398,11 @@ What it will and will not do:
390
398
  - It prints the plan and asks once; `--yes` accepts it, and a run with no terminal and no `--yes`
391
399
  fails naming the flag. With nothing to update it says so and asks nothing.
392
400
  - A repository a newer version needs that the project does not trust goes through the usual trust
393
- question, and new questions the newer versions ask are asked the way subscribing asks them.
401
+ question, and new questions the newer versions ask are asked the way subscribing asks them: a
402
+ default answers a variable unless its priority is `high`, and the run lists the defaults it used.
403
+ The plan's list "Questions the new versions ask that nothing answers yet" holds only the questions
404
+ the update will ask: it leaves out the ones a default answers, and optional ones of standard
405
+ priority.
394
406
  - Every recommendation the project has not answered yet is offered, as subscribing offers it
395
407
  ([Recommended recipes](#recommended-recipes)): one a newer version brings, and one an earlier run
396
408
  left pending. A declined one is not. The plan lists them, marking the ones a new version brings.
@@ -454,6 +466,9 @@ opt-out outlives it. Like any switched-off subscription, `core` keeps its pin in
454
466
  `sous subscription add core` clears the opt-out again. If you remove `core`, make sure
455
467
  something else tells your agents not to edit generated files.
456
468
 
469
+ To keep the `core` skills but leave out its one memory (the short note, loaded in every session, that
470
+ points agents at them), list it under `recipes.memories.exclude` instead: `exclude: ["core/sous-skills"]`.
471
+
457
472
  ## Switch a subscription off
458
473
 
459
474
  A subscription stays in the config with `enabled: false`, so the opt-out is visible. A switched-off
@@ -602,8 +617,8 @@ megabytes) overrides it for one run, and `--dry-run` reports what would go.
602
617
  Sous treats a run as non-interactive, and asks nothing at all, when any of these is true:
603
618
 
604
619
  - `--non-interactive` is passed (every command that works on a project accepts it);
605
- - the `CI` environment variable is set to anything but an empty value, `0`, `false`, `no` or `off`
606
- (case and surrounding spaces are ignored);
620
+ - the `CI` environment variable is set to anything but an empty value, `0` or `false` (case and
621
+ surrounding spaces are ignored);
607
622
  - stdin or stdout is not a terminal, which is what piping or scripting looks like.
608
623
 
609
624
  Such a run fails rather than guessing, naming both the question and the flag that answers it:
@@ -617,7 +632,9 @@ $ CI=true sous subscription add quality/qa-pattern
617
632
  accept the plan above without being asked.
618
633
  ```
619
634
 
620
- An unanswered variable fails the same way, naming every environment variable that answers it:
635
+ A default that fits answers a variable in such a run, and an optional variable with no default is left
636
+ unanswered. A required variable with no answer and no default fails the run the same way, naming every
637
+ environment variable that answers it:
621
638
 
622
639
  ```text
623
640
  Error: One variable still needs an answer, and there is no terminal to ask on.
@@ -407,6 +407,8 @@ variables:
407
407
  | `env` | no | The environment variable an answer binds to; omitted, it is `SOUS_VAR_` plus the upper snake case form of the variable's own name, so `qaScratchDir` binds to `SOUS_VAR_QA_SCRATCH_DIR` |
408
408
  | `required`, `secret` | no | Default to `true` and `false`; a secret is always written to the gitignored `.sous/.env.local` |
409
409
  | `scope` | no | `shared` (the committed `.sous/.env`) or `local` (the gitignored `.sous/.env.local`); defaults to `shared` |
410
+ | `priority` | no | When `sous subscription add` and `sous update` ask it: `standard` (the default) asks only when no default that fits answers it and it is required; `high` asks even when it has a default, offering it, and even when it is optional. `sous vars ask` ignores it; see [Which questions subscribing and updating ask](repositories-variables.md#which-questions-subscribing-and-updating-ask). Sous 1.4.0 or later reads it |
411
+ | `allowEmpty` | no | Whether an empty answer (`NAME=`, `NAME=""`) is valid. Only `true` allows it; left out, it means `false`, for an optional variable too, and an empty value counts as no answer; see [Empty answers](repositories-variables.md#empty-answers). Sous 1.5.0 or later reads it; an older sous ignores it |
410
412
  | `validate` | no | `pattern`, `minLength`, `maxLength`, `min`, `max`, `enum` |
411
413
 
412
414
  At publish time: a `type: enum` variable must list its options under `validate.enum`; `minLength` cannot
@@ -110,32 +110,32 @@ sous subscription add workflow/task-files
110
110
  ```
111
111
 
112
112
  Sous states what subscribing does, asks once, resolves the whole dependency closure, downloads it,
113
- then asks the questions the recipe requires that have no answer yet. Answering the confirmation and the
114
- two questions:
113
+ then asks the questions nothing answers yet. Every variable this recipe publishes has a default and none
114
+ asks to be confirmed (`priority: high`), so each takes its default and nothing more is asked:
115
115
 
116
116
  ```text
117
- ➔ What was installed:
117
+ ▶ What was installed:
118
118
  Recipe Version Repository Why
119
119
  ----------------------------- ------- ------------ --------------------------
120
120
  workflow/sub-agent-delegation 1.0.0 the-pantry needed by workflow/task-files
121
121
  workflow/task-files 1.0.2 the-pantry you subscribed to it
122
122
 
123
- ➔ Answers stored:
124
- taskFileRoot : .sous/tasks TASK_FILE_ROOT in .env
125
- ticketIdExample : PROJ-1234 TICKET_ID_EXAMPLE in .env
126
-
127
- ➔ Left unanswered:
128
- ticketPrefix : no answer yet, and this variable is optional
129
- To answer an optional variable, run 'sous vars ask <name>'. 'sous vars ask --all' asks every
130
- variable, including the ones already answered.
123
+ ▶ Defaults used:
124
+ taskFileRoot : .sous/tasks
125
+ ticketIdExample: PROJ-1234
126
+ ticketPrefix : PROJ-
127
+ A default is not stored as an answer, so a later version of its recipe may change it. To choose
128
+ your own value, run 'sous vars ask <name>'.
131
129
  ```
132
130
 
133
- A script, a pipeline or a coding agent has no terminal to answer on, so it passes the answers in:
131
+ To choose your own values, run `sous vars ask workflow/task-files`, which asks every question the recipe
132
+ publishes. A script, a pipeline or a coding agent has no terminal to answer on; the defaults answer there
133
+ too, and it passes in any value of its own:
134
134
 
135
135
  ```bash
136
136
  sous subscription add workflow/task-files --yes \
137
- --answer taskFileRoot=.sous/tasks \
138
- --answer ticketIdExample=PROJ-1234
137
+ --answer taskFileRoot=docs/tasks \
138
+ --answer ticketIdExample=ACME-1234
139
139
  ```
140
140
 
141
141
  The answers land in `.sous/.env`, which is committed; a definition marked secret goes to the