@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.
@@ -37,6 +37,7 @@ Answers are shared by name, so when several recipes, or several versions of one
37
37
  the same name, sous asks **one** question, built from the strictest combination of every definition:
38
38
 
39
39
  - secret when any definition is secret, `scope: local` when any is local, and required when any is required;
40
+ - an empty answer allowed only when every definition sets `allowEmpty: true`;
40
41
  - only the values every definition accepts: the `enum` options they share, the highest `min` and `minLength`,
41
42
  the lowest `max` and `maxLength`, and every `pattern`;
42
43
  - the first definition's prompt, description and example, with the question naming the other recipes
@@ -64,8 +65,40 @@ name in its templates, does not define it, so it adds nothing to the combination
64
65
 
65
66
  ## Answer the questions
66
67
 
67
- Subscribing asks whatever is unanswered, so in normal use you rarely run `sous vars ask` yourself; reach for
68
- it after editing an env file by hand, after an upgrade tightened a constraint, or to re-answer with `--all`.
68
+ Subscribing and updating ask what a recipe needs, so in normal use you rarely run `sous vars ask` yourself;
69
+ reach for it to choose your own value for a variable a default answered, after editing an env file by hand,
70
+ after an upgrade tightened a constraint, or to re-answer with `--all`.
71
+
72
+ ### Which questions subscribing and updating ask
73
+
74
+ `sous subscription add` and `sous update` ask a variable only when nothing answers it yet and its
75
+ definition's `priority` says to:
76
+
77
+ | The variable | `priority: standard` (or none) | `priority: high` |
78
+ |--------------|--------------------------------|------------------|
79
+ | Has a default that fits | Not asked; the default is used | Asked, offering the default |
80
+ | Has no default, and is required | Asked | Asked |
81
+ | Has no default, and is optional (`required: false`) | Not asked; left unanswered | Asked; Enter with nothing typed leaves it unanswered |
82
+
83
+ A default used this way is not stored as an answer: the build reads the definition's default, so a later
84
+ version of the recipe may change it. The run lists every default it used, and how to choose your own value:
85
+
86
+ ```text
87
+ ▶ Defaults used:
88
+ taskDir : docs/tasks
89
+ reviewDir: docs/reviews
90
+ A default is not stored as an answer, so a later version of its recipe may change it. To choose your own value, run 'sous vars ask <name>'.
91
+ ```
92
+
93
+ Under `--json`, and through MCP, the same list is `defaulted: [{ variable, value }]`. When several recipes
94
+ define one name, the variable is `high` when any of their definitions says so.
95
+
96
+ `sous vars ask` itself ignores `priority`: run with no name it asks every required variable nothing answers,
97
+ offering its default, and every variable whose answer no longer fits; with a name or `--all` it asks every
98
+ variable it covers. Without a terminal,
99
+ see [Answer without a terminal](#answer-without-a-terminal).
100
+
101
+ ### What a question looks like
69
102
 
70
103
  Every trust decision is settled first: a subscribe resolves the dependency closure and runs the trust
71
104
  ceremony for each new repository before the first question prints. Questions then run one recipe at a time,
@@ -77,82 +110,83 @@ workflow/task-files needs 4 answers, and workflow/sub-agent-delegation, which it
77
110
  workflow/task-files needs 4 answers before it can be used.
78
111
  ```
79
112
 
80
- Each question prints its header, the publisher's description wrapped to your terminal, and four labeled facts:
113
+ Each question prints its header, the publisher's description wrapped to your terminal, and the facts about
114
+ the answer: the example, the recipe that asks it, the file the answer is stored in and the environment
115
+ variable it is stored as. The prompt shows the value Enter alone accepts in parentheses: the definition's
116
+ default, or the value already in scope.
81
117
 
82
118
  ```text
83
- Question 1 of 4: taskFileRoot
119
+ Question 1 of 4: taskFileRoot
84
120
 
85
- This recipe mandates the creation of task files that are stored locally and, in
86
- general, should not be committed. The default stores them in the project's .sous
87
- directory; any local path works, relative to the project root or absolute.
121
+ This recipe mandates the creation of task files that are stored locally and, in
122
+ general, should not be committed. The default stores them in the project's .sous
123
+ directory; any local path works, relative to the project root or absolute.
88
124
 
89
- default : .sous/tasks
90
- example : ~/my-task-files
91
- stored-as : SOUS_VAR_TASK_FILE_ROOT
92
- storage-path: /home/you/project/.sous/.env
125
+ Example : ~/my-task-files
126
+ Recipe : workflow/task-files
127
+ Stored in: /home/you/project/.sous/.env
128
+ Stored as: SOUS_VAR_TASK_FILE_ROOT
93
129
 
94
- ? Where should task files be stored? (.sous/tasks):
95
- ⏎ accept default • ⇥ advanced
130
+ Where should task files be stored? (.sous/tasks)
96
131
  ```
97
132
 
98
- The legend under the input line names the keys that do anything: Enter accepts what is typed, or the default
99
- when there is one; a list question names the arrow keys instead, and a yes-or-no question the two letters.
133
+ Enter with nothing typed on a question with no default and no value in scope depends on the definition:
134
+ `allowEmpty: true` stores an empty answer (`NAME=""`); otherwise an optional question is skipped and nothing
135
+ is saved, and a required one is asked again. See [Empty answers](#empty-answers).
100
136
 
101
- ### Tab opens the advanced view
137
+ An `enum` question lists its options by number and takes the number of the one you pick; a `boolean`
138
+ question takes yes or no, with the default capitalized in `[Y/n]` or `[y/N]`. An answer that does not fit
139
+ the definition is refused with the reason, and the question is asked again.
102
140
 
103
- Tab works at every kind of question. The advanced view repeats the header and description, prints every fact
104
- about the variable through the renderer `sous vars show` uses, and offers a menu:
141
+ An answer goes to the file its definition's `scope` names: `.sous/.env`, or `.sous/.env.local` for a
142
+ machine-specific variable or a secret. `--save-locally` and `--save-shared` send every answer of a run to
143
+ one file instead. Sending a secret, or a variable the publisher declared machine-specific, to the committed
144
+ file is allowed; sous says what that means and asks you to confirm, which is informed consent rather than a
145
+ locked door:
105
146
 
106
147
  ```text
107
- [Advanced Variable Settings]
108
-
109
- Question 1 of 4: taskFileRoot
110
-
111
- default : .sous/tasks
112
- example : ~/my-task-files
113
- required-by : workflow/task-files https://example.com/owner/recipes/workflow/task-files
114
- defined-by : workflow/task-files https://example.com/owner/recipes/workflow/task-files
115
- storage-path: /home/you/project/.sous/.env
116
- stored-as : SOUS_VAR_TASK_FILE_ROOT
117
- constraints : • must be a value of the type path (type: path)
118
-
119
- ? What would you like to do?
120
- Return to value entry
121
- Change the storage file
122
- Change the stored variable name
148
+ workflow/task-files declared this variable a secret, and .sous/.env is committed to git. An answer
149
+ stored there enters your project's git history, is pushed with every clone, and is visible to everyone
150
+ who can read the repository.
151
+
152
+ Store this answer in .sous/.env anyway? [y/N]
123
153
  ```
124
154
 
125
- `required-by` names the recipe whose closure pulled this variable in, and spells out the chain when it
126
- arrived through a dependency; `defined-by` names the recipe that declares it. Both carry the location beside
127
- the recipe key, in muted grey: a repository URL, or a filesystem path for a repository on this machine.
155
+ When an answer is entered, two lines say what was stored and where; a secret is never printed:
128
156
 
129
- **Changing the stored variable name** offers every rung the ladder looks up, sous's choice preselected, plus
130
- a name you type; one the ladder never looks at is bound with a [mapping record](#when-names-collide-mapping-records).
157
+ ```text
158
+ Answer : SOUS_VAR_TASK_FILE_ROOT=.sous/tasks
159
+ Saved to: /home/you/project/.sous/.env
160
+ ```
131
161
 
132
- **Changing the storage file** offers the committed `.sous/.env` and the gitignored `.sous/.env.local`.
133
- Pointing a secret, or a variable the publisher declared machine-specific, at the committed file is allowed;
134
- sous says what that means and asks you to confirm, which is informed consent rather than a locked door:
162
+ Every run ends with a report in up to four parts: `Answers already in scope:`, `Answers stored:`,
163
+ `Left unanswered:` and `Defaults used:`. A name several recipes share is reported once, naming the recipes.
164
+ When optional variables are left unanswered, the report ends with how to answer them: `sous vars ask <name>`,
165
+ or `sous vars ask --all`.
135
166
 
136
- ```text
137
- workflow/task-files declared this variable a secret, and .env is committed to git. An answer stored
138
- there enters your project's git history, is pushed with every clone, and is visible to everyone who
139
- can read the repository.
167
+ ## Empty answers
140
168
 
141
- ? Store this answer in .env anyway? (y/N)
142
- ```
169
+ An empty answer is `NAME=` or `NAME=""` in an env file, `--answer name=`, an empty value in an answers file,
170
+ or a value of only spaces. It is a valid answer only when the definition sets `allowEmpty: true`, for an
171
+ optional and a required variable alike; without it, sous treats an empty value as no answer at all:
143
172
 
144
- Once anything has changed, the first menu item becomes "Save changes and return to value entry" and a
145
- "Discard changes and return to value entry" item joins it; returning prints the question again with the
146
- updated facts. When an answer is entered, two lines say what was stored and where; a secret is never printed:
173
+ - Given up front (`--answer`, `--answers-file`), it is refused before anything is written, naming the
174
+ variable.
175
+ - At a prompt, Enter with nothing typed skips an optional question and saves nothing.
176
+ - Already stored, it is passed over as if the name were not set: a less specific name on
177
+ [the ladder](#how-sous-finds-an-answer-the-ladder) may answer instead, else the default applies, else the
178
+ variable is unanswered. A build warns about it and carries on:
147
179
 
148
180
  ```text
149
- Answer : SOUS_VAR_TASK_FILE_ROOT=.sous/tasks
150
- Saved to: /home/you/project/.sous/.env
181
+ 1 recipe variable is set to an empty value, which it does not allow, so sous treats it as unanswered:
182
+ - teamName (asked by acme/jira), set empty by the shared scope name SOUS_VAR_TEAM_NAME, from the .env file
183
+ Run 'sous vars ask teamName' to answer it, or remove the empty value.
151
184
  ```
152
185
 
153
- Every run ends with a three-part report: `Answers already in scope:`, `Answers stored:`, `Left unanswered:`.
154
- A name several recipes share is reported once, naming the recipes. When optional variables are left
155
- unanswered, the report ends with how to answer them: `sous vars ask <name>`, or `sous vars ask --all`.
186
+ `sous vars list` shows such a variable as unanswered (or using its default), naming the empty name, and the
187
+ ladder table of `sous vars show` marks that name as ignored. A template tells "not answered" from "empty"
188
+ with `== blank`, which is true for both; a variable that allows an empty answer and needs to tell them apart
189
+ compares with `== nil` (unanswered) and `== ""` (answered empty).
156
190
 
157
191
  ## Where answers are stored
158
192
 
@@ -177,7 +211,8 @@ Comments are output only; sous never reads one back, and editing the value line
177
211
 
178
212
  ## How sous finds an answer: the ladder
179
213
 
180
- For each variable, sous tries these names in order; the first one holding a value wins.
214
+ For each variable, sous tries these names in order; the first one holding a value wins. An empty value
215
+ counts only for a variable with `allowEmpty: true` (see [Empty answers](#empty-answers)).
181
216
 
182
217
  | Rung | Name | Example | When it applies |
183
218
  |------|------|---------|-----------------|
@@ -253,8 +288,8 @@ source `its default; no answer is stored`, because a build uses the default. `(u
253
288
  no answer and no default.
254
289
 
255
290
  `sous vars show <name>` prints one variable in full: the question, the publisher's description and example,
256
- the recipe and version that published it, the value in scope and whether it fits, the labeled facts the
257
- advanced view draws, and the ladder table above. `Stored in` names the file the value in scope came from (or
291
+ the recipe and version that published it, the value in scope and whether it fits, its default, the recipes
292
+ that require and define it, the name it is stored as and its constraints, and the ladder table above. `Stored in` names the file the value in scope came from (or
258
293
  the shell environment), and `Saved to` names the file a new answer goes to; the two differ when, say, a
259
294
  machine-specific answer was put in `.sous/.env` by hand. A default in use shows as `Value: PROJ- (default)`.
260
295
  The name may be bare, the full `namespace/recipe.name`, or an environment variable name that answers it,
@@ -276,7 +311,7 @@ lists them and asks which one, and `--accept-first` takes the first.
276
311
  | `sous vars ask --save-locally` | Stores every answer of the run in `.sous/.env.local` (gitignored, this machine only) |
277
312
  | `sous vars ask --save-shared` | Stores every answer of the run in `.sous/.env` (committed); a secret or machine-specific variable sent there needs a yes (`--yes`). It cannot be used with `--save-locally` |
278
313
  | `sous vars ask --answer <name>=<value>` | Answers one question ahead of time; repeat it for each answer |
279
- | `sous vars ask --answers-file <path>` | Reads answers from a YAML or JSON file of `name: value` pairs |
314
+ | `sous vars ask --answers-file <path>` | Reads answers from a YAML, JSON, JSONC or `.env` file of `name: value` pairs |
280
315
  | `sous vars ask --dry-run` | Reports what would be asked and written, without writing anything; with no terminal, it lists the questions it would ask instead of failing |
281
316
  | `sous vars ask --non-interactive` | Never asks; fails instead, naming the environment variable or flag that would answer each question |
282
317
 
@@ -311,7 +346,7 @@ the long way: `sous vars show ask`.
311
346
  ### Answering ahead of the questions
312
347
 
313
348
  `--answer <name>=<value>` answers a question before it is asked and repeats as often as needed, and
314
- `--answers-file <path>` reads the same pairs from YAML or JSON; an `--answer` wins over the same name in the
349
+ `--answers-file <path>` reads the same pairs from a YAML, JSON, JSONC or `.env` file; an `--answer` wins over the same name in the
315
350
  file. Pair either with `--dry-run` first, as in
316
351
  `sous vars ask --var qaScratchDir --answer qaScratchDir=/var/tmp/qa-review --dry-run`. Both work the same way
317
352
  on `sous subscription add`; see [Answer the questions](repositories-consuming.md#answer-the-questions).
@@ -331,8 +366,16 @@ one is written where that answer lives, and a value the shell supplies is never
331
366
  ## Answer without a terminal
332
367
 
333
368
  Sous never hangs waiting on a prompt it cannot show; what counts as "no terminal" is listed under
334
- [Run sous in CI, or from an agent](repositories-consuming.md#run-sous-in-ci-or-from-an-agent). Such a run
335
- fails on the unanswered required variables, naming every environment variable that would satisfy each one:
369
+ [Run sous in CI, or from an agent](repositories-consuming.md#run-sous-in-ci-or-from-an-agent). In such a run,
370
+ an unanswered variable is settled without a question:
371
+
372
+ - one with a default that fits takes that default, whatever its `priority`, as a build does, and the run
373
+ lists it under `Defaults used:`;
374
+ - an optional one with no default is left unanswered;
375
+ - a required one with no default fails the run.
376
+
377
+ A variable named on the command line, or covered by `--all`, needs an answer of its own, so its default does
378
+ not answer it. The failure names every environment variable that would satisfy each variable:
336
379
 
337
380
  ```text
338
381
  Error: 1 variable still needs an answer, and there is no terminal to ask on.
@@ -242,7 +242,9 @@ Every project trusts two repositories without `sous repo add`:
242
242
  Nothing in it is subscribed until you subscribe to it.
243
243
 
244
244
  `core` is the exception. It holds the skills that teach an agent what sous is, why generated files
245
- must not be hand-edited and where the source of a managed file lives; without them an agent will
245
+ must not be hand-edited and where the source of a managed file lives, and one memory, loaded in
246
+ every session, that points the agent at them (`recipes.memories.exclude` leaves it out, as for any
247
+ recipe; see [Consuming recipes](repositories-consuming.md)); without them an agent will
246
248
  cheerfully edit a compiled `CLAUDE.md`. So `core` is subscribed in every project, pinned to the
247
249
  sous CLI version you are running, and a copy ships inside the package and seeds the store on first
248
250
  run, so a fresh install needs no network at all.
@@ -311,8 +313,9 @@ $ sous subscription add workflow/task-files
311
313
  ```
312
314
 
313
315
  **Answer the questions** the recipe publishes. A question is asked only when a subscribed recipe
314
- needs a variable and no valid answer is already in scope, and the answers land in this project's
315
- env files. See [Recipe variables](repositories-variables.md).
316
+ needs a variable, no valid answer is already in scope, and no default answers it (a recipe can mark a
317
+ variable `priority: high` to have its default confirmed), and the answers land in this project's env
318
+ files. See [Recipe variables](repositories-variables.md).
316
319
 
317
320
  **Build.** Every later build reads the pins, restores anything missing from the store, then
318
321
  compiles the recipe's files into your project's agent directories alongside your own templates:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sous-io/sous",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "Compiles AI coding agent configuration (CLAUDE.md, skills, memories) from LiquidJS templates",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -39,49 +39,50 @@
39
39
  "sous.config.schema.json"
40
40
  ],
41
41
  "dependencies": {
42
- "@sous-io/sous-plugin-api": "1.3.1"
42
+ "@sous-io/sous-plugin-api": "1.5.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "esbuild": "^0.27.4",
46
46
  "jsonc-parser": "^3.3.1",
47
47
  "yaml": "^2.9.0",
48
48
  "zod": "^4.4.3",
49
- "@sous-io/sous-lib-documents": "1.3.1",
50
- "@sous-io/sous-plugin-authoring": "1.3.1",
51
- "@sous-io/sous-lib-core": "1.3.1",
52
- "@sous-io/sous-plugin-claude-code": "1.3.1",
53
- "@sous-io/sous-plugin-build": "1.3.1",
54
- "@sous-io/sous-plugin-cli": "1.3.1",
55
- "@sous-io/sous-plugin-config-files": "1.3.1",
56
- "@sous-io/sous-plugin-confd": "1.3.1",
57
- "@sous-io/sous-plugin-compiler": "1.3.1",
58
- "@sous-io/sous-plugin-expressions": "1.3.1",
59
- "@sous-io/sous-plugin-formats": "1.3.1",
60
- "@sous-io/sous-plugin-github": "1.3.1",
61
- "@sous-io/sous-plugin-git": "1.3.1",
62
- "@sous-io/sous-plugin-gitlab": "1.3.1",
63
- "@sous-io/sous-plugin-harnesses": "1.3.1",
64
- "@sous-io/sous-plugin-host": "1.3.1",
65
- "@sous-io/sous-plugin-init": "1.3.1",
66
- "@sous-io/sous-plugin-inspect": "1.3.1",
67
- "@sous-io/sous-plugin-local": "1.3.1",
68
- "@sous-io/sous-plugin-liquid": "1.3.1",
69
- "@sous-io/sous-plugin-mcp": "1.3.1",
70
- "@sous-io/sous-plugin-npm": "1.3.1",
71
- "@sous-io/sous-plugin-memories": "1.3.1",
72
- "@sous-io/sous-plugin-recipe-answers": "1.3.1",
73
- "@sous-io/sous-plugin-pnpm": "1.3.1",
74
- "@sous-io/sous-plugin-recipes": "1.3.1",
75
- "@sous-io/sous-plugin-refs": "1.3.1",
76
- "@sous-io/sous-plugin-update": "1.3.1",
77
- "@sous-io/sous-plugin-skills": "1.3.1",
78
- "@sous-io/sous-plugin-yarn": "1.3.1",
79
- "@sous-io/sous-plugin-variables": "1.3.1",
80
- "@sous-io/sous-plugin-handlers": "1.3.1",
81
- "@sous-io/sous-plugin-migrations": "1.3.1",
82
- "@sous-io/sous-plugin-doctor": "1.3.1",
83
- "@sous-io/sous-plugin-codex": "1.3.1",
84
- "@sous-io/sous-plugin-editor": "1.3.1"
49
+ "@sous-io/sous-lib-core": "1.5.0",
50
+ "@sous-io/sous-plugin-authoring": "1.5.0",
51
+ "@sous-io/sous-lib-documents": "1.5.0",
52
+ "@sous-io/sous-plugin-build": "1.5.0",
53
+ "@sous-io/sous-plugin-claude-code": "1.5.0",
54
+ "@sous-io/sous-plugin-compiler": "1.5.0",
55
+ "@sous-io/sous-plugin-confd": "1.5.0",
56
+ "@sous-io/sous-plugin-config-files": "1.5.0",
57
+ "@sous-io/sous-plugin-cli": "1.5.0",
58
+ "@sous-io/sous-plugin-expressions": "1.5.0",
59
+ "@sous-io/sous-plugin-formats": "1.5.0",
60
+ "@sous-io/sous-plugin-git": "1.5.0",
61
+ "@sous-io/sous-plugin-gitlab": "1.5.0",
62
+ "@sous-io/sous-plugin-github": "1.5.0",
63
+ "@sous-io/sous-plugin-harnesses": "1.5.0",
64
+ "@sous-io/sous-plugin-init": "1.5.0",
65
+ "@sous-io/sous-plugin-host": "1.5.0",
66
+ "@sous-io/sous-plugin-local": "1.5.0",
67
+ "@sous-io/sous-plugin-inspect": "1.5.0",
68
+ "@sous-io/sous-plugin-mcp": "1.5.0",
69
+ "@sous-io/sous-plugin-liquid": "1.5.0",
70
+ "@sous-io/sous-plugin-npm": "1.5.0",
71
+ "@sous-io/sous-plugin-memories": "1.5.0",
72
+ "@sous-io/sous-plugin-pnpm": "1.5.0",
73
+ "@sous-io/sous-plugin-recipe-answers": "1.5.0",
74
+ "@sous-io/sous-plugin-refs": "1.5.0",
75
+ "@sous-io/sous-plugin-recipes": "1.5.0",
76
+ "@sous-io/sous-plugin-skills": "1.5.0",
77
+ "@sous-io/sous-plugin-update": "1.5.0",
78
+ "@sous-io/sous-plugin-variables": "1.5.0",
79
+ "@sous-io/sous-plugin-yarn": "1.5.0",
80
+ "@sous-io/sous-plugin-bun": "1.5.0",
81
+ "@sous-io/sous-plugin-editor": "1.5.0",
82
+ "@sous-io/sous-plugin-handlers": "1.5.0",
83
+ "@sous-io/sous-plugin-doctor": "1.5.0",
84
+ "@sous-io/sous-plugin-migrations": "1.5.0",
85
+ "@sous-io/sous-plugin-codex": "1.5.0"
85
86
  },
86
87
  "engines": {
87
88
  "node": ">=22"
@@ -0,0 +1,12 @@
1
+ # Sous
2
+
3
+ This project uses Sous (https://sous.io/markdown/#/for-agents), a tool that builds the agent's
4
+ instruction files (memories like this one, skills, commands and other agent settings) from
5
+ source templates in the project and from shared recipes published in recipe repositories. The
6
+ skills whose names start with `about-sous` explain how it works; load the matching one before
7
+ changing ANY of your own instructions (skills, memories, etc.) or settings.
8
+
9
+ Never edit a file Sous built: the next build overwrites the change, and nobody else receives
10
+ it. Change the source instead (a built skill names its source path at its end), then run
11
+ `sous build`. For a file that came from a recipe, `sous repo contribute <namespace>/<recipe>`
12
+ is always the default way to change it and is strongly preferred.
@@ -136,6 +136,27 @@ user must return it to the orchestrator, which relays it.
136
136
  **If no action skill exists for a task, ask the user.** Do not improvise an action
137
137
  that warrants its own skill.
138
138
 
139
+ ## Spending Tokens Well
140
+
141
+ Every token an agent loads costs time and money, so instructions are written to load as little as
142
+ the work allows. These are rulings by the sous maintainers:
143
+
144
+ 1. **Keep always-loaded text small.** Expose information as a trail the agent follows: a short
145
+ pointer in a memory, a skill it loads on demand, a reference file the skill names. Each step
146
+ costs a load, and an agent may not follow it, so put what nearly every use needs at the first
147
+ step. A command beats a skill, because the user has already declared the action. A partial
148
+ raises the chance an agent sees a piece of text without every session loading it.
149
+ 2. **Be brief in text only agents read.** This is the largest saving: cut filler, preamble and
150
+ repetition, but NEVER a fact or a word the meaning needs.
151
+ 3. **Move depth into reference files**, inside the skill's folder. This is the second-largest
152
+ saving; a reference file MAY point at further reference files, as deep as the topic needs.
153
+ 4. **Script repeated actions.** When agents keep doing the same steps by hand, ship a script
154
+ (ideally `.mjs`, which runs anywhere Node does) in the skill's `scripts/` folder, so later
155
+ sessions run it instead of spending tokens on it.
156
+ 5. **Weigh tokens by who spends them.** A token on a more capable model is worth more than one on
157
+ a lower tier, and a token in the main session is worth more than one in a sub-agent. Put
158
+ bulky, mechanical work where tokens are cheapest.
159
+
139
160
  ## Writing a Skill's Text
140
161
 
141
162
  These rules apply to every new skill, memory, partial and reference file. A skill is read by an
@@ -281,8 +281,11 @@ project's variables change.
281
281
  use a variable. When no suitable variable exists, add one to the project's sous
282
282
  config file (the file that defines the project's `_vars`).
283
283
  2. **Guard project-specific blocks with conditionals.** If a section only applies when
284
- a variable is set, wrap it in {% raw %}`{% if varName %} ... {% endif %}`{% endraw %} so the
285
- block disappears cleanly for projects that don't define it.
284
+ a variable is set, wrap it in {% raw %}`{% if varName != blank %} ... {% endif %}`{% endraw %} so the
285
+ block disappears cleanly for projects that don't define it. Test with `!= blank`, not a bare
286
+ {% raw %}`{% if varName %}`{% endraw %}, which an empty answer `""` passes. For a recipe
287
+ variable with no default, the block's absence must also tell the agent what is missing and how
288
+ to fill it in; `about-sous-recipes` ("Variables") holds that rule and its examples.
286
289
  3. **Prefer derived variables over raw values.** Example: `ticketPrefix` is derived
287
290
  from `jiraProjectKey`; templates use `ticketPrefix` so they stay correct if the
288
291
  key changes.
@@ -77,6 +77,11 @@ which is read-only build input: an edit there is lost and reaches nobody. Change
77
77
 
78
78
  YOU MUST load `about-sous-repos` before running these commands.
79
79
 
80
+ `sous repo contribute` is ALWAYS the default way to change a recipe's file, because the steps a
81
+ contribution needs are built into it. Open a pull request directly in the recipe's repository
82
+ only when the user explicitly asks for one. When a sous command fails, report the failure to the
83
+ user, with the command and its output, so sous can be fixed; NEVER work around it.
84
+
80
85
  ## Where Your Skills Live
81
86
 
82
87
  Skills for this project live at `{{ skillsRoot }}`. That is the source directory Sous
@@ -155,6 +160,25 @@ migrations, please run 'sous migrate' or 'sous doctor', first", listing each que
155
160
  `sous migrate --answer <name>=<value>` with their answers. `--yes` takes every default without
156
161
  asking the user; use it only when the user agrees to the defaults.
157
162
 
163
+ ## New Checkouts
164
+
165
+ In a project set up with `sous init hooks`, a new checkout gets its dependencies and agent files
166
+ without anyone running sous. What is covered:
167
+
168
+ - `git worktree add`, a branch checkout, a pull and a rebase: the hooks in `.githooks/` run
169
+ `scripts/init-new-worktree.mjs`, which copies the gitignored files listed at its top from the
170
+ main checkout, installs and builds when needed.
171
+ - A fresh clone: its first install runs the script through the package script (`prepare`, or
172
+ `postinstall` for Yarn). Until then git runs none of the hooks.
173
+ - A Claude Code session that starts in a checkout without the agent files: the `SessionStart`
174
+ hook in `.claude/settings.json` builds them in the background and says so at the start of the
175
+ session. Read the memories file once its log says the checkout is ready.
176
+
177
+ Not covered: a cloud session or CI (an install with `CI` set builds nothing), a worktree created
178
+ without checking files out (`git worktree add --no-checkout`), and a project without the hooks.
179
+ When the agent files are missing and nothing is building them, run
180
+ `node scripts/init-new-worktree.mjs`, or `sous build` in a project without the script.
181
+
158
182
  ## Sous's Own Documentation
159
183
 
160
184
  Sous's full documentation ships inside the installed package as plain markdown
@@ -151,9 +151,40 @@ The fields in that example, and the ones it leaves out:
151
151
  acceptable; the `prompt` is one plain question. An example is only shown beside the question,
152
152
  never stored or offered as an answer; a `default` is the answer of last resort. Both MUST fit the
153
153
  declared type.
154
- - Every variable MUST provide a conservative default: the answer that does the least harm when the
155
- project never chose one. For example, a setting for whether the agent may merge pull requests on
156
- its own defaults to "only when asked", never to "always".
154
+ - Every variable MUST either provide a conservative default (the answer that does the least harm
155
+ when the project never chose one: a setting for whether the agent may merge pull requests on its
156
+ own defaults to "only when asked", never to "always"), or every known use of it MUST handle a
157
+ missing value. Handling means more than still working: the result tells the agent what is
158
+ missing and how to make it whole, in this order of preference:
159
+ 1. the agent works the value out itself, and says so;
160
+ 2. the agent offers to find the value and fill the answer in for the user
161
+ (`sous vars ask <name> --answer <name>=<value>`, then a build);
162
+ 3. only when the user alone can supply it (a secret, a personal choice), the agent asks the user
163
+ and points at `sous vars ask <name>`.
164
+
165
+ A missing value MUST NEVER produce a broken command, a wrong path, an invalid file, or text that
166
+ reads as if the value were known. Sous itself allows a variable with no default (`default` is
167
+ optional): this is a rule for agents, so never add a release check or a schema change to enforce
168
+ it. In a template, test {% raw %}`{% if v == blank %}`{% endraw %} or `!= blank`, never a bare
169
+ {% raw %}`{% if v %}`{% endraw %}: an unanswered variable is undefined, and an empty answer `""`
170
+ passes a bare `if`. [variables-without-a-default.md](references/variables-without-a-default.md)
171
+ shows five template cases, and the rules for hooks, scripts, plugin code and recipes passing a
172
+ value on.
173
+ - `priority` (`standard` when absent, or `high`) decides whether `sous subscription add` and
174
+ `sous update` ask the variable. A `standard` variable whose default fits is not asked: its default
175
+ is used, not stored, and listed under "Defaults used". A `high` variable is asked even when it has
176
+ a default (offering it) and even when it is optional. Mark a variable `high` when the subscriber
177
+ should confirm its default, for example a placeholder such as `my-team` that every project is
178
+ expected to replace. Only sous 1.4.0 or later reads `priority`, and `sous repo release` warns
179
+ about every recipe that uses it. When several recipes define one name, it is `high` if any
180
+ definition is.
181
+ - `allowEmpty: true` makes an empty answer (`NAME=""`) valid. Without it an empty answer is not
182
+ valid, for an optional variable too: it is refused when given up front, Enter with nothing typed
183
+ skips an optional question, and an empty value already stored counts as unanswered (the build
184
+ warns). So `""` reaches a template only for a variable with `allowEmpty: true`; set it only when
185
+ "deliberately empty" means something other than "not answered". When several recipes define one
186
+ name, empty is allowed only if every definition allows it. Only sous 1.5.0 or later reads it,
187
+ and `sous repo release` warns about every recipe that uses it; taking it away is a major bump.
157
188
  - `scope: local` stores the answer in the gitignored `.sous/.env.local`; use it for anything that
158
189
  belongs to one person or one machine. `scope: shared`, the default, stores it in the committed
159
190
  `.sous/.env`.
@@ -164,16 +195,16 @@ The fields in that example, and the ones it leaves out:
164
195
  (`reviewNotesDir` becomes `SOUS_VAR_REVIEW_NOTES_DIR`). Two definitions of different names MUST
165
196
  NOT claim the same environment variable.
166
197
  - `validate` takes `pattern`, `minLength`, `maxLength`, `min`, `max` and `enum`. Within a major
167
- version a definition MAY only loosen; tightening is a major bump, because an upgrade re-checks the
168
- answers already stored.
198
+ version a definition MAY only loosen; tightening is a major bump, because an answer a project
199
+ already stored may stop fitting, and `sous vars ask` then asks it again.
169
200
 
170
201
  A template may also read a variable another recipe defines. List that recipe under `depends`, so
171
202
  the variable is there wherever this recipe is, and MUST NOT redefine it; branch on it in the
172
203
  template rather than telling the agent to look the setting up (`about-liquid-templates` shows how).
173
204
 
174
205
  When two recipes do define one name, the project is asked one question built from the strictest
175
- combination: secret, `local` or required if any definition is, and only the values every definition
176
- accepts. When no value can satisfy both (different types, no shared `enum` option), each recipe is
206
+ combination: secret, `local`, required or `high` priority if any definition is, an empty answer allowed only if
207
+ every definition allows it, and only the values every definition accepts. When no value can satisfy both (different types, no shared `enum` option), each recipe is
177
208
  asked separately under its recipe-scoped name.
178
209
 
179
210
  ## Depends, Subscribes and Recommends