@sous-io/sous 1.0.18 → 1.0.19

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.
@@ -53,3 +53,4 @@
53
53
  - [0021: Reporting as levels and styles](adrs/0021-reporting-levels-and-styles.md)
54
54
  - [0022: Intents return outputs](adrs/0022-intents-return-outputs.md)
55
55
  - [0023: The project's lockfile is the only lock](adrs/0023-the-project-lockfile-is-the-only-lock.md)
56
+ - [0024: `sous init` imports a project's agent files](adrs/0024-init-imports-agent-files.md)
@@ -14,9 +14,10 @@ and `--sous-confd <path>`. They point sous at a config file, a `.sous/` director
14
14
  instead of the one walk-up discovery would find. The environment variables `SOUS_CONFIG`, `SOUS_DIR` and
15
15
  `SOUS_CONFD` do the same; a flag beats its variable. See [Discovery and overrides](config-discovery.md).
16
16
 
17
- ?> `repo init`, `repo release` and `repo submit` take none of these. They run inside a recipe repository, which
18
- has no `.sous/` directory to discover. `repo submit` may also be run from a project, which it finds by walking up
19
- from the working directory.
17
+ ?> `repo init`, `repo release` and `repo submit` take none of these. They work on a recipe repository, which
18
+ they find by its `sous.repo.yaml`, not through a project's config. (A recipe repository is also a sous project,
19
+ with a `.sous/` of its own, but these commands do not locate the repository through it.) `repo submit` may also be run from a project, which it
20
+ finds by walking up from the working directory.
20
21
 
21
22
  ## Flags that answer questions
22
23
 
@@ -72,19 +73,65 @@ so on), and `sous search`, `sous subscribe` and `sous unsubscribe` are one-word
72
73
 
73
74
  ### `sous init [DIRECTORY]`
74
75
 
75
- Sets a project up for sous, then runs the first build. It writes a commented `sous.config.js`, a starter prompt
76
- at `.sous/memories/AGENTS.tpl.md` that compiles to `AGENTS.md` at the project root, the `.sous/.env` and
77
- `.sous/.env.local.example` files, and the sous block in `.sous/.gitignore`. A project with a `package.json` also
76
+ Sets a project up for sous: it imports the project's existing agent files into a new `.sous/` directory, then
77
+ runs the first build. Sous owns all of a project's agent configuration from then on. `CLAUDE.md`, `AGENTS.md` and
78
+ `.claude/skills/` at the project root become build output, so edit their sources under `.sous/` and run
79
+ `sous build` after cloning.
80
+
81
+ It writes a commented `sous.config.js`, the instructions source `.sous/memories/instructions.tpl.md` that the
82
+ config compiles into both `CLAUDE.md` and `AGENTS.md` at the project root, the `.sous/.env` and
83
+ `.sous/.env.local.example` files, the sous block in `.sous/.gitignore`, and a sous block in the project-root
84
+ `.gitignore` that ignores `/CLAUDE.md`, `/AGENTS.md` and `/.claude/skills/`. A project with a `package.json` also
78
85
  gains `@sous-io/sous` as a devDependency at the running version; run your package manager's install afterwards.
79
86
 
80
- The starter prompt holds one line, `@#memories/**/*.md`, which includes every memory your subscribed recipes
81
- publish. Agent plugins can add more places for memories (the built-in Claude Code plugin adds `CLAUDE.md`).
87
+ The instructions source holds two includes:
88
+
89
+ ```markdown
90
+ @*/**/*.md
91
+ @#memories/**/*.md
92
+ ```
82
93
 
83
- A project whose `.sous/` already holds a config is left untouched. The config it writes is `sous.config.js`. `--no-build` skips the first build.
94
+ The first pulls in this project's own memories, every markdown file in a folder beside the source (such as
95
+ `imported/` and `conventions/`). The second pulls in every memory the subscribed recipes publish. Because the
96
+ config's target writes `CLAUDE.md`, the Claude Code plugin's own memory target for that file steps aside. An
97
+ include that matches nothing stops a build, so the project's folder is never empty: when there was nothing to
98
+ import, init writes a starter memory at `.sous/memories/project/overview.tpl.md` (or
99
+ `.sous/memories/project/sous-repo.tpl.md` in a recipe repository, one with a `sous.repo.yaml`).
100
+
101
+ What init imports, before the first build:
102
+
103
+ - **The instructions.** A root `CLAUDE.md` or `AGENTS.md` is copied to `.sous/memories/imported/` as plain `.md`,
104
+ so Liquid never touches it. A file that is a symlink to the other, holds the same text, or only points at the
105
+ other (at most 3 non-blank lines and 400 characters, naming the other file) is skipped.
106
+ - **The files they include.** A line holding only `@path.md` includes that file, and init follows those lines
107
+ through every included file. Each file is moved (the default), copied, or left where it is. A moved or copied
108
+ file goes to `.sous/includes/<its path from the project root>`, outside `memories/`, so it appears only where
109
+ its include line is. A README, and a file outside the project, always stay where they are; a file included by
110
+ a file that stays is copied rather than moved. Every `@` reference in a copied file is rewritten to work from
111
+ its new place, and an include that names a missing file becomes an HTML comment, with a warning.
112
+ - **The skills.** Every folder in `.claude/skills/` moves to `.sous/skills/`. The config always has a target
113
+ that compiles `.sous/skills/` into `.claude/skills/`, and init writes `SKILLS_ROOT=.sous/skills` into
114
+ `.sous/.env`, so a skill the `create-skill` skill writes later is compiled too. Until the folder exists the
115
+ target compiles nothing, without a warning. A project skill with the same name as a recipe skill wins, and
116
+ the build warns that the recipe's copy was not written.
117
+
118
+ Everything init moves is backed up first, to `.sous/backups/<YYYY-MM-DD>/<HHMM-SS>/<path>`, which git ignores.
119
+ Git stops tracking the root `CLAUDE.md`, `AGENTS.md` and each moved skill folder (`git rm -r --cached`); the files
120
+ stay on disk until the build compiles over them. `.claude/agents/`, `.claude/commands/` and
121
+ `.claude/settings.json` are left alone.
122
+
123
+ What happens to the included files is one question, asked once after init lists them: move them, copy them,
124
+ leave them, or choose for each file. `--move-includes`, `--copy-includes` and `--leave-includes` answer it ahead
125
+ of time, one at a time, and `--yes` accepts the default, move. A run with no terminal and none of these flags
126
+ fails, naming them. `--dry-run` plans with the default and asks nothing.
127
+
128
+ A project whose `.sous/` already holds a config is left untouched. `--no-build` skips the first build.
84
129
 
85
130
  ```bash
86
131
  sous init
87
132
  sous init --name "My Project"
133
+ sous init --copy-includes
134
+ sous init --dry-run
88
135
  ```
89
136
 
90
137
  ### `sous build`
@@ -130,6 +177,37 @@ sous prune --dry-run
130
177
  sous clear --force
131
178
  ```
132
179
 
180
+ ### Backups before overwriting or removing
181
+
182
+ Sous never destroys content it did not produce. Before `build`, `compile`, `prune` or `clear` overwrites or
183
+ removes a file, it copies the file to a backup when sous did not write the file, or when sous wrote it but the
184
+ file was edited by hand since (its content no longer matches the hash the state file recorded). A file whose
185
+ content already matches what is about to be written needs no backup, and neither does an output that is still
186
+ exactly as sous wrote it.
187
+
188
+ Backups go to `.sous/backups/<YYYY-MM-DD>/<HHMM-SS>/`, followed by the file's path relative to the project root,
189
+ in local time. Every backup of one run shares one timestamp folder. A file outside the project goes under
190
+ `outside-project/` in that folder, followed by its absolute path without the leading slash, so
191
+ `/home/me/.claude/CLAUDE.md` is backed up to `.sous/backups/2026-11-15/0912-04/outside-project/home/me/.claude/CLAUDE.md`.
192
+ A backup is never overwritten: if one is already there, the new one gets `.1`, `.2` and so on after its name.
193
+
194
+ Each backup is listed in the command's output, just before the line that says the file was written or removed.
195
+ A dry run lists the backups it would make and writes nothing:
196
+
197
+ ```text
198
+ ↪ /work/app/CLAUDE.md (backed up to /work/app/.sous/backups/2026-11-15/0912-04/CLAUDE.md)
199
+ ✓ /work/app/CLAUDE.md
200
+ ↪ /work/app/notes.md (would back up to /work/app/.sous/backups/2026-11-15/0913-20/notes.md)
201
+ − /work/app/notes.md (would remove)
202
+ ```
203
+
204
+ The first two lines come from a build, the last two from `sous prune --dry-run`.
205
+
206
+ A build also puts an output edited by hand back to its compiled content, even when its source did not change,
207
+ so the edit is backed up rather than silently kept as if sous had written it. With
208
+ `compilation.overwriteUntracked: false`, a file sous did not write is left alone instead, so it needs no backup.
209
+ Sous never deletes backups; remove old ones from `.sous/backups/` yourself.
210
+
133
211
  ### `sous launch TOOL...`
134
212
 
135
213
  Builds the project, then starts a coding agent: one an agent plugin provides (the built-in Claude Code plugin
@@ -274,7 +352,11 @@ sous repo contribute workflow/task-files --finish --title "Clarify the resume st
274
352
 
275
353
  ### `sous repo init [DIRECTORY]`
276
354
 
277
- Creates a new recipe repository. See [Authoring a repository](repositories-authoring.md).
355
+ Creates a new recipe repository, then runs [`sous init`](#sous-init-directory) in the same directory, so the
356
+ repository is also a sous project whose `CLAUDE.md`, `AGENTS.md` and `.claude/skills/` are build output. It
357
+ passes `--yes`, `--move-includes`, `--copy-includes`, `--leave-includes`, `--no-build` and `--dry-run` through to
358
+ init. A directory that already holds a sous config keeps it, and init is skipped with a note. See
359
+ [Authoring a repository](repositories-authoring.md).
278
360
 
279
361
  ```bash
280
362
  sous repo init ./my-recipes --name team-recipes --namespace workflow
@@ -45,6 +45,11 @@ need no target of their own: the built-in Claude Code plugin sends them to `.cla
45
45
  `recipes.skills.outputs` adds destinations of your own (see
46
46
  [Consuming recipes](repositories-consuming.md)).
47
47
 
48
+ A target in your config wins over a plugin's or a recipe's target that would write the same file. A
49
+ project that compiles its own `CLAUDE.md`, as the config `sous init` writes does, replaces the one the
50
+ Claude Code plugin would build from recipe memories. A project skill with the same name as a recipe skill
51
+ replaces it too, and the build warns that the recipe's copy was not written.
52
+
48
53
  A JSON config may set `"$schema"` to bind the `sous.config.schema.json` artifact shipped with
49
54
  sous for editor autocompletion; sous accepts and ignores the key.
50
55
 
@@ -170,6 +175,22 @@ Two more keys settle what plugins do:
170
175
  `sous plugins show` lists every plugin and what it adds. Recipes may ship plugins too; see
171
176
  [where plugins come from](architecture/specifications/S1-engine.md#where-plugins-come-from).
172
177
 
178
+ ## Outputs, the state file and backups
179
+
180
+ Sous records every file it writes in the state file, `.sous/sous.state.json` by default
181
+ (`compilation.stateFile` moves it), along with a hash of the content it wrote. `prune` and `clear` read
182
+ it to know which files are sous's to remove.
183
+
184
+ When a target's output already exists and sous did not write it, sous overwrites it and takes it
185
+ over by default. Set `compilation.overwriteUntracked: false` to have sous leave such a file alone
186
+ and warn instead.
187
+
188
+ Sous never destroys content it did not produce. Before it overwrites or removes a file that it did
189
+ not write, or one that was edited by hand since sous wrote it, it copies the file to
190
+ `.sous/backups/<YYYY-MM-DD>/<HHMM-SS>/<path relative to the project root>` and lists the backup in
191
+ the command's output. See [Backups before overwriting or
192
+ removing](commands.md#backups-before-overwriting-or-removing) for the details.
193
+
173
194
  ## Where to go next
174
195
 
175
196
  - [Discovery and overrides](config-discovery.md): how sous finds the config, and the flags and
@@ -4,9 +4,11 @@ The guide to publishing recipes of your own: creating a repository, writing a re
4
4
  needs, cutting a release, editing a published repository in place, and proposing a change to somebody else's.
5
5
  [Repository file formats](repositories-file-formats.md) holds the schemas; this page is the workflow.
6
6
 
7
- ?> A recipe repository is not a sous project. It has no `.sous/` directory, and `sous repo init` and `sous repo
8
- release` do not look for one. Run them from inside the repository itself. `sous repo submit` runs there too, and
9
- may also be run from a project that links the repository.
7
+ ?> A recipe repository is also a sous project: `sous repo init` sets one up with a `.sous/` directory of its
8
+ own, so its `CLAUDE.md`, `AGENTS.md` and `.claude/skills/` are build output, and anyone who clones it runs
9
+ `sous build`. `sous repo init` and `sous repo release` find the repository by its `sous.repo.yaml`, not through
10
+ that config. Run them from inside the repository itself. `sous repo submit` runs there too, and may also be run
11
+ from a project that links the repository.
10
12
 
11
13
  ## Create a repository
12
14
 
@@ -20,26 +22,35 @@ $ sous repo init ./my-recipes --name my-recipes --namespace workflow
20
22
  wrote recipes/workflow/example/skills/example-skill/SKILL.tpl.md
21
23
  wrote README.md
22
24
  wrote CONTRIBUTING.md
23
- wrote CLAUDE.md
24
- wrote AGENTS.md
25
25
  wrote .github/workflows/sous-release.yml
26
26
  wrote .gitignore
27
+ // then sous init sets the repository up as a sous project, and runs its first build
27
28
  ```
28
29
 
29
30
  `--name` is the repository's short name (default: the directory's own name), `--namespace` the one namespace to
30
31
  declare (default: the repository's name), `--force` overwrites a repository that already exists, and `--dry-run`
31
- lists the files without writing them. The command asks nothing, and names are lowercase kebab-case, so `My-Recipes`
32
- yields `my-recipes`. Every file is read back through the schemas sous uses on published repositories, so the
33
- scaffold validates. The scaffold is files only: run `git init`, commit it, and add the remote you publish from
34
- before releasing, since `sous repo release` reads and writes tags and fails in a directory git does not track.
32
+ lists the files without writing them. Names are lowercase kebab-case, so `My-Recipes` yields `my-recipes`. Every
33
+ file is read back through the schemas sous uses on published repositories, so the scaffold validates. The scaffold
34
+ is files only: run `git init`, commit it, and add the remote you publish from before releasing, since
35
+ `sous repo release` reads and writes tags and fails in a directory git does not track.
36
+
37
+ After the scaffold, the command runs [`sous init`](commands.md#sous-init-directory) in the same directory, so the
38
+ repository is also a sous project. Init imports a `CLAUDE.md`, an `AGENTS.md` or skills in `.claude/skills/` that
39
+ the directory already holds, and with nothing to import it writes a starter memory,
40
+ `.sous/memories/project/sous-repo.tpl.md`, which says this is a sous recipe repository and names the core skills
41
+ an agent loads before changing anything. It then runs the first build, which compiles `CLAUDE.md` and
42
+ `AGENTS.md` and installs the core skills. The only question init can ask is what happens to files an existing
43
+ `CLAUDE.md` or `AGENTS.md` includes; `--yes`, `--move-includes`, `--copy-includes` and `--leave-includes` answer it
44
+ and are passed through, as are `--no-build` and `--dry-run`. A directory that already holds a sous config keeps
45
+ it, and init is skipped with a note.
35
46
 
36
47
  ?> `repo init --force` means overwrite, not "answer yes". It is unrelated to the confirmation flag other
37
48
  commands spell `--yes`, `-y`, `--force` or `--trust`.
38
49
 
39
50
  `sous.repo.yaml` says what the repository publishes, `sous.index.json` is the catalog that `sous repo release`
40
- writes, and each recipe folder carries one `sous.recipe.yaml` beside the files it contributes. `CONTRIBUTING.md`,
41
- `CLAUDE.md` and `AGENTS.md` are for agents: they say that contribution instructions are written for agents, and
42
- point an agent at the sous core skills, which explain how a recipe repository works. The scaffold follows
51
+ writes, and each recipe folder carries one `sous.recipe.yaml` beside the files it contributes. `CONTRIBUTING.md` is
52
+ for agents: it says that contribution instructions are written for agents, and that `sous build` after cloning
53
+ installs the sous core skills, which explain how a recipe repository works. The scaffold follows
43
54
  [`sous-io/sous-recipes`](https://github.com/sous-io/sous-recipes), a complete repository minus its recipes, and
44
55
  its placeholder skill is named `SKILL.tpl.md` because it ends with a footer that only a render fills in. Nothing else is
45
56
  fixed: recipe folders may live anywhere, and what makes a folder a recipe is that `sous.repo.yaml` lists its
@@ -207,7 +207,8 @@ instruction source includes them. Put one line in the file your `AGENTS.md` or `
207
207
  `#memories` is a view: it lists the memories of every recipe you hold directly (a subscription to it, to its
208
208
  namespace, or a co-subscription of a recipe you hold) at the virtual path
209
209
  `#memories/<namespace>/<recipe>/<path>`, and the line includes each one. A recipe held only through `depends`
210
- adds none. `sous init` writes this line into its starter, `.sous/memories/AGENTS.tpl.md`.
210
+ adds none. `sous init` writes this line into the source it compiles into `CLAUDE.md` and `AGENTS.md`,
211
+ `.sous/memories/instructions.tpl.md`, after a line that includes the project's own memories.
211
212
 
212
213
  Memories come in dependency order (a recipe after the recipes it depends on, ties by recipe key). Two config
213
214
  lists under `recipes.memories` shape the rest, each entry a glob over `namespace/recipe` keys or a regular
@@ -230,7 +231,9 @@ includes nothing, and the warning is how that is never silent.
230
231
  ?> In sous 1.0 an agent's plugin can also name the instruction file that agent reads in every session
231
232
  (`CLAUDE.md` for the Claude Code plugin built into sous). Sous then writes that file with one `@` include
232
233
  line for each memory `recipes.memories` selects, so the memories reach the agent without a line of your own.
233
- How that file and an instruction file your own templates write fit together is still being decided.
234
+ When a target in your own config writes the same file, as the config `sous init` writes does for `CLAUDE.md`
235
+ and `AGENTS.md`, your target wins and the plugin's steps aside; your source then includes the memories with the
236
+ `@#memories/**/*.md` line above.
234
237
 
235
238
  ## Answer the questions
236
239
 
@@ -26,8 +26,9 @@ echo 'name: my-project' > .sous/sous.config.yaml
26
26
  Everything else has a default: skills compile into `<project root>/.claude/skills` (where the
27
27
  Claude Code plugin built into sous puts them), and the lockfile, the state file and the `conf.d`
28
28
  files sous writes land under `.sous/`. Outside a
29
- walkthrough, `sous init` writes a fuller starting point (a commented config, a starter prompt,
30
- the env files and the ignore block) and runs the first build for you; the one-line config is
29
+ walkthrough, `sous init` writes a fuller starting point (it imports the project's existing
30
+ `CLAUDE.md`, `AGENTS.md` and skills, and writes a commented config, the source both instruction
31
+ files compile from, the env files and the ignore blocks) and runs the first build for you; the one-line config is
31
32
  used here so that each step shows one thing. `SOUS_HOME` puts
32
33
  the machine-wide store somewhere throwaway, so this walkthrough leaves your real one alone. See
33
34
  [The config file](configuration.md) for the keys you will want later.
@@ -152,8 +153,10 @@ under
152
153
 
153
154
  ## 6. Start a repository of your own
154
155
 
155
- A recipe repository is not a sous project; it has no `.sous/` directory, and the three commands
156
- that work inside one do not look for a config. Run this outside your project:
156
+ A recipe repository is also a sous project: `sous repo init` writes the repository, then runs
157
+ `sous init` in it, so its agent instructions and skills are compiled from its own `.sous/`. The
158
+ `sous repo` commands that work inside a repository find it by its `sous.repo.yaml`, not through
159
+ that config. Run this outside your project:
157
160
 
158
161
  ```bash
159
162
  sous repo init ~/projects/my-recipes --name my-recipes --namespace workflow
@@ -167,13 +170,12 @@ sous repo init ~/projects/my-recipes --name my-recipes --namespace workflow
167
170
  wrote recipes/workflow/example/skills/example-skill/SKILL.tpl.md
168
171
  wrote README.md
169
172
  wrote CONTRIBUTING.md
170
- wrote CLAUDE.md
171
- wrote AGENTS.md
172
173
  wrote .github/workflows/sous-release.yml
173
174
  wrote .gitignore
174
175
  ```
175
176
 
176
- The scaffold validates as written, and every file it leaves is heavily commented. `sous.repo.yaml`
177
+ The output goes on with what `sous init` writes and with its first build, which compiles
178
+ `CLAUDE.md` and `AGENTS.md`. The scaffold validates as written, and every file it leaves is heavily commented. `sous.repo.yaml`
177
179
  declares the namespaces and lists every recipe folder; each folder's `sous.recipe.yaml` is one
178
180
  recipe, with its own version.
179
181
 
@@ -361,7 +361,7 @@ listed it), the error names it:
361
361
 
362
362
  ```text
363
363
  Error: Include not found: @~workflow/member/memories/member.md
364
- in file: .sous/prompts/AGENTS.md
364
+ in file: .sous/memories/instructions.tpl.md
365
365
  namespace: workflow
366
366
  recipe: workflow/member
367
367
  The namespace "workflow" holds no recipe named "workflow/member".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sous-io/sous",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
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,44 +39,44 @@
39
39
  "sous.config.schema.json"
40
40
  ],
41
41
  "dependencies": {
42
- "@sous-io/plugin-api": "1.0.18"
42
+ "@sous-io/plugin-api": "1.0.19"
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/documents": "1.0.18",
50
- "@sous-io/plugin-authoring": "1.0.18",
51
- "@sous-io/core": "1.0.18",
52
- "@sous-io/plugin-build": "1.0.18",
53
- "@sous-io/plugin-claude-code": "1.0.18",
54
- "@sous-io/plugin-compiler": "1.0.18",
55
- "@sous-io/plugin-cli": "1.0.18",
56
- "@sous-io/plugin-confd": "1.0.18",
57
- "@sous-io/plugin-config-files": "1.0.18",
58
- "@sous-io/plugin-expressions": "1.0.18",
59
- "@sous-io/plugin-git": "1.0.18",
60
- "@sous-io/plugin-formats": "1.0.18",
61
- "@sous-io/plugin-gitlab": "1.0.18",
62
- "@sous-io/plugin-harnesses": "1.0.18",
63
- "@sous-io/plugin-github": "1.0.18",
64
- "@sous-io/plugin-init": "1.0.18",
65
- "@sous-io/plugin-inspect": "1.0.18",
66
- "@sous-io/plugin-liquid": "1.0.18",
67
- "@sous-io/plugin-mcp": "1.0.18",
68
- "@sous-io/plugin-memories": "1.0.18",
69
- "@sous-io/plugin-host": "1.0.18",
70
- "@sous-io/plugin-local": "1.0.18",
71
- "@sous-io/plugin-npm": "1.0.18",
72
- "@sous-io/plugin-recipe-answers": "1.0.18",
73
- "@sous-io/plugin-refs": "1.0.18",
74
- "@sous-io/plugin-recipes": "1.0.18",
75
- "@sous-io/plugin-skills": "1.0.18",
76
- "@sous-io/plugin-update": "1.0.18",
77
- "@sous-io/plugin-pnpm": "1.0.18",
78
- "@sous-io/plugin-variables": "1.0.18",
79
- "@sous-io/plugin-yarn": "1.0.18"
49
+ "@sous-io/documents": "1.0.19",
50
+ "@sous-io/plugin-build": "1.0.19",
51
+ "@sous-io/plugin-claude-code": "1.0.19",
52
+ "@sous-io/core": "1.0.19",
53
+ "@sous-io/plugin-authoring": "1.0.19",
54
+ "@sous-io/plugin-cli": "1.0.19",
55
+ "@sous-io/plugin-compiler": "1.0.19",
56
+ "@sous-io/plugin-confd": "1.0.19",
57
+ "@sous-io/plugin-config-files": "1.0.19",
58
+ "@sous-io/plugin-expressions": "1.0.19",
59
+ "@sous-io/plugin-formats": "1.0.19",
60
+ "@sous-io/plugin-github": "1.0.19",
61
+ "@sous-io/plugin-gitlab": "1.0.19",
62
+ "@sous-io/plugin-host": "1.0.19",
63
+ "@sous-io/plugin-harnesses": "1.0.19",
64
+ "@sous-io/plugin-git": "1.0.19",
65
+ "@sous-io/plugin-init": "1.0.19",
66
+ "@sous-io/plugin-local": "1.0.19",
67
+ "@sous-io/plugin-liquid": "1.0.19",
68
+ "@sous-io/plugin-memories": "1.0.19",
69
+ "@sous-io/plugin-mcp": "1.0.19",
70
+ "@sous-io/plugin-npm": "1.0.19",
71
+ "@sous-io/plugin-pnpm": "1.0.19",
72
+ "@sous-io/plugin-inspect": "1.0.19",
73
+ "@sous-io/plugin-recipe-answers": "1.0.19",
74
+ "@sous-io/plugin-recipes": "1.0.19",
75
+ "@sous-io/plugin-refs": "1.0.19",
76
+ "@sous-io/plugin-variables": "1.0.19",
77
+ "@sous-io/plugin-update": "1.0.19",
78
+ "@sous-io/plugin-yarn": "1.0.19",
79
+ "@sous-io/plugin-skills": "1.0.19"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=22"
@@ -17,8 +17,9 @@ copies or renders files to their destinations in this project.
17
17
  ## Files You Must Never Edit
18
18
 
19
19
  Sous manages certain files in this project by compiling them from a central source.
20
- **You must never edit these directly.** Your changes will be silently overwritten the
21
- next time Sous runs:
20
+ **You must never edit these directly.** Your changes will be overwritten the next time
21
+ Sous runs. Sous copies the edited file to `.sous/backups/<date>/<time>/` first and says so
22
+ in its output, but the edit no longer takes effect:
22
23
 
23
24
  - `.claude/`: Claude Code configuration, skills, and instructions
24
25
  - `.codex/`: Codex configuration and skills
@@ -28,6 +29,35 @@ next time Sous runs:
28
29
  If you need to change something in one of these files, the change must be made at the
29
30
  source, in the central configuration this project uses with Sous.
30
31
 
32
+ ## Where the Instructions Come From
33
+
34
+ In a project `sous init` set up, Sous owns all agent configuration. The root `CLAUDE.md` and
35
+ `AGENTS.md` are both compiled from `.sous/memories/instructions.tpl.md`, and they and
36
+ `.claude/skills/` are gitignored build output, so `sous build` recreates them after a clone.
37
+ That source holds no instructions itself; it includes:
38
+
39
+ ```markdown
40
+ @*/**/*.md
41
+ @#memories/**/*.md
42
+ ```
43
+
44
+ - The first line pulls in this project's own memories: every markdown file in a folder beside
45
+ the source, such as `.sous/memories/imported/` (the `CLAUDE.md` or `AGENTS.md` the project had
46
+ before `sous init`), `.sous/memories/project/` or `.sous/memories/conventions/`. To change the
47
+ instructions, edit one of these files or add one, then run `sous build`. Keep at least one file
48
+ there: an include that matches nothing stops the build.
49
+ - Files those memories include by a line holding only `@path.md` were moved or copied to
50
+ `.sous/includes/<their path from the project root>`, outside `memories/`, so each one appears
51
+ only where its include line is. Edit them there.
52
+ - The second line pulls in the memories of every recipe this project subscribes to; change those
53
+ upstream, as described below.
54
+
55
+ In a project `sous init` set up, the project's own skills live in `.sous/skills/` (the
56
+ `skillsRoot` answer `sous init` writes), and the config compiles them into `.claude/skills/`;
57
+ skills the project had in `.claude/skills/` before `sous init` were moved there. A project skill
58
+ with the same name as a recipe skill wins, and the build warns that the recipe's copy was not
59
+ written. Whatever `sous init` moved was backed up first to `.sous/backups/<date>/<time>/`.
60
+
31
61
  ## Changing a File That Came From a Recipe
32
62
 
33
63
  A file whose footer names a recipe (`This skill comes from the <namespace>/<recipe> recipe`)
@@ -73,6 +73,11 @@ prefer the on-disk copies.
73
73
  `recipes.skills.outputs`; with neither, the build skips the skills and says why.
74
74
  `recipes.memories.first` and `recipes.memories.exclude` (globs over `namespace/recipe`, or
75
75
  `/regex/` strings) order and filter the recipe memories.
76
+ - A target in `compilation.targets` wins over a plugin's or a recipe's target that would write
77
+ the same file. That is why the config `sous init` writes, which compiles
78
+ `.sous/memories/instructions.tpl.md` into both `CLAUDE.md` and `AGENTS.md`, replaces the
79
+ Claude Code plugin's own `CLAUDE.md`, and why a project skill compiled from `.sous/skills/`
80
+ replaces a recipe skill of the same name (the build warns about the recipe's copy).
76
81
  - The `plugins` key decides which Sous plugins (packages that extend sous itself) load, beyond
77
82
  the built-ins and those listed in the project's `package.json`, and holds each plugin's own
78
83
  options. `configuration.md` above documents its fields. Run `sous plugins show` to see which
@@ -214,7 +214,8 @@ a memory lands. A subscribing project can include the memories of every recipe i
214
214
  with one line, `@#memories/**/*.md`, at the virtual path `#memories/<namespace>/<recipe>/<path>`
215
215
  (the path being relative to the pattern's static base). The Sous plugin for a coding agent may
216
216
  also name the instruction file that agent reads (`CLAUDE.md` for Claude Code, for example), and
217
- sous then adds the active recipes' memories to that file itself. A recipe held only through `depends` is a library and
217
+ sous then adds the active recipes' memories to that file itself, unless the subscriber's own config
218
+ compiles that file (as one `sous init` set up does, through `@#memories/**/*.md`). A recipe held only through `depends` is a library and
218
219
  contributes none, and the subscriber's build warns about a published memory no output includes.
219
220
 
220
221
  ## Includes and Partials
@@ -19,9 +19,12 @@ metadata:
19
19
 
20
20
  A **recipe** is a versioned bundle of agent instructions (skills, memories, prompts and config
21
21
  layers) that sous installs into every project subscribed to it. A **recipe repository** is a git
22
- repository that publishes recipes. It is not a sous project and needs no `.sous/` directory; the
23
- commands that work on it (`sous repo release`, `sous repo submit`) run from anywhere inside it,
24
- and find its root by walking up to the first directory holding a repo manifest.
22
+ repository that publishes recipes. It is also a sous project, with a `.sous/` directory of its own:
23
+ its `CLAUDE.md`, `AGENTS.md` and `.claude/skills/` are build output, compiled from the sources under
24
+ `.sous/`, so NEVER edit the compiled copies, and run `sous build` after cloning. The commands that
25
+ work on the repository itself (`sous repo release`, `sous repo submit`) run from anywhere inside it,
26
+ and find its root by walking up to the first directory holding a repo manifest, not through that
27
+ config.
25
28
 
26
29
  Everything here holds for every recipe repository, the official `sous-io/sous-recipes` included.
27
30
  For one recipe (its manifest, version, variables, contents and dependencies), YOU MUST load
@@ -168,10 +171,19 @@ yet, then unlinks with `--update`.
168
171
 
169
172
  `sous repo init [dir]` writes a new recipe repository into the directory (the current one by
170
173
  default): the repo manifest, an empty index, one example recipe with its manifest and a
171
- placeholder skill, a README, `CONTRIBUTING.md`, `CLAUDE.md` and `AGENTS.md` for agents, the release
172
- workflow and a `.gitignore`. `sous-io/sous-recipes` is the model a scaffold follows: a new repository
173
- is as complete as it, minus its recipes. It does not run git: run `git init`, commit, and add a
174
- remote before the first release, because `sous repo release` reads and writes tags. Every new recipe folder is then listed under `recipes` in `sous.repo.yaml`.
174
+ placeholder skill, a README, `CONTRIBUTING.md` for agents, the release workflow and a `.gitignore`.
175
+ `sous-io/sous-recipes` is the model a scaffold follows: a new repository is as complete as it, minus
176
+ its recipes. It does not run git: run `git init`, commit, and add a remote before the first release,
177
+ because `sous repo release` reads and writes tags. Every new recipe folder is then listed under
178
+ `recipes` in `sous.repo.yaml`.
179
+
180
+ After the scaffold it runs `sous init` in the same directory, so the repository is also a sous
181
+ project. Init imports any `CLAUDE.md`, `AGENTS.md` or `.claude/skills/` already there; with nothing
182
+ to import, it writes `.sous/memories/project/sous-repo.tpl.md`, a memory saying this is a sous
183
+ recipe repository and naming the core skills an agent loads before changing anything. Its first
184
+ build compiles `CLAUDE.md` and `AGENTS.md`. `--yes`, `--move-includes`, `--copy-includes`,
185
+ `--leave-includes`, `--no-build` and `--dry-run` pass through to init. A directory that already
186
+ holds a sous config keeps it, and init is skipped with a note.
175
187
 
176
188
  ## Source for this Skill
177
189
 
@@ -11,7 +11,7 @@ formatVersion: 1
11
11
 
12
12
  namespace: core
13
13
  name: sous-skills
14
- version: 1.0.18
14
+ version: 1.0.19
15
15
 
16
16
  description: >-
17
17
  The skills that teach an agent what sous is and how it works: which files sous
@@ -63,7 +63,7 @@
63
63
  }
64
64
  },
65
65
  "compilation": {
66
- "description": "What to compile: targets, their outputs, source comments, the state file, overwriting files sous did not write.",
66
+ "description": "What to compile: targets, their outputs, source comments, the state file, overwriting files sous did not write. Content sous did not produce is backed up to <sousDir>/backups/ before it is overwritten or removed.",
67
67
  "type": "object",
68
68
  "properties": {
69
69
  "_vars": {
@@ -81,10 +81,12 @@
81
81
  },
82
82
  "overwriteUntracked": {
83
83
  "default": true,
84
+ "description": "Overwrite an output file sous did not write, and take it over. Sous copies the file to <sousDir>/backups/ first. With false, the file is left alone and the build warns.",
84
85
  "type": "boolean"
85
86
  },
86
87
  "stateFile": {
87
88
  "default": "${sousDir}/sous.state.json",
89
+ "description": "Where sous records every file it wrote and the hash of what it wrote, which tells prune and clear what is theirs to remove and which outputs were edited by hand.",
88
90
  "type": "string"
89
91
  },
90
92
  "targets": {