@techgoblin/gobstack 0.6.0-alpha.4 → 0.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +249 -116
  3. package/VERSION +1 -1
  4. package/bans/README.md +5 -5
  5. package/bans/grep-ban.sh +1 -1
  6. package/bin/goblin-bans +103 -27
  7. package/bin/goblin-init +345 -259
  8. package/bin/goblin-install +269 -213
  9. package/bin/goblin-lib.sh +63 -66
  10. package/bin/goblin-map +130 -579
  11. package/bin/goblin-mcp.js +9 -14
  12. package/bin/goblin-verify +249 -993
  13. package/bin/goblin.js +4 -9
  14. package/docs/GUIDE.md +724 -179
  15. package/docs/LIMITS.md +273 -301
  16. package/docs/RECORD-NOTES.md +1 -2
  17. package/manifest/bans.tsv +9 -9
  18. package/manifest/categories.tsv +18 -0
  19. package/manifest/enforcement.tsv +11 -67
  20. package/manifest/glossary.tsv +6 -12
  21. package/manifest/library.tsv +33 -0
  22. package/package.json +1 -4
  23. package/skills/goblin-bootstrap/SKILL.md +20 -32
  24. package/skills/goblin-feature-map/SKILL.md +1 -1
  25. package/skills/goblin-verify-author/SKILL.md +2 -2
  26. package/skills/practice/SKILL.md +4 -4
  27. package/templates/AGENTS.md.tmpl +6 -6
  28. package/templates/HANDOFF.md.tmpl +1 -1
  29. package/templates/SPEC.md.tmpl +2 -2
  30. package/templates/agents-block.tmpl +1 -10
  31. package/adapters/_template/adapter.tsv +0 -16
  32. package/adapters/_template/detect.sh +0 -10
  33. package/adapters/_template/emit.sh +0 -5
  34. package/adapters/_template/verify.sh +0 -4
  35. package/adapters/claude/adapter.tsv +0 -8
  36. package/adapters/claude/detect.sh +0 -8
  37. package/adapters/claude/verify.sh +0 -47
  38. package/adapters/codex/adapter.tsv +0 -12
  39. package/adapters/codex/detect.sh +0 -9
  40. package/adapters/codex/verify.sh +0 -45
  41. package/adapters/copilot/adapter.tsv +0 -10
  42. package/adapters/copilot/detect.sh +0 -8
  43. package/adapters/copilot/verify.sh +0 -45
  44. package/adapters/cursor/adapter.tsv +0 -11
  45. package/adapters/cursor/detect.sh +0 -10
  46. package/adapters/cursor/verify.sh +0 -45
  47. package/adapters/gemini/adapter.tsv +0 -15
  48. package/adapters/gemini/detect.sh +0 -11
  49. package/adapters/gemini/verify.sh +0 -49
  50. package/adapters/hermes/adapter.tsv +0 -9
  51. package/adapters/hermes/detect.sh +0 -8
  52. package/adapters/hermes/verify.sh +0 -27
  53. package/adapters/opencode/adapter.tsv +0 -14
  54. package/adapters/opencode/detect.sh +0 -9
  55. package/adapters/opencode/verify.sh +0 -45
  56. package/automations/README.md +0 -53
  57. package/automations/bugreporter-intake.sh +0 -145
  58. package/automations/drift-audit.sh +0 -139
  59. package/automations/report.schema.tsv +0 -10
  60. package/bin/goblin +0 -144
  61. package/bin/goblin-audit +0 -143
  62. package/bin/goblin-doctor +0 -233
  63. package/bin/goblin-emit +0 -495
  64. package/bin/goblin-extras +0 -365
  65. package/bin/goblin-model +0 -105
  66. package/bin/goblin-upgrade +0 -580
  67. package/docs/ADOPTION.md +0 -173
  68. package/docs/CI.md +0 -190
  69. package/docs/CONTRACTS.md +0 -218
  70. package/docs/DESIGN.md +0 -92
  71. package/docs/ENFORCEMENT.md +0 -228
  72. package/docs/FLOWS.md +0 -164
  73. package/docs/GLOSSARY.md +0 -40
  74. package/docs/GUARDRAILS.md +0 -126
  75. package/docs/INTEGRATION.md +0 -92
  76. package/docs/LOOP.md +0 -165
  77. package/docs/RE-PLAYBOOK.md +0 -183
  78. package/docs/RISKS.md +0 -70
  79. package/docs/ROLES.md +0 -105
  80. package/extras-catalogue/catalogue.tsv +0 -42
  81. package/extras-catalogue/payload/README.md +0 -14
  82. package/extras-catalogue/payload/taste-skill/taste/REFERENCE.md +0 -3
  83. package/extras-catalogue/payload/taste-skill/taste/SKILL.md +0 -9
  84. package/manifest/classes.tsv +0 -51
  85. package/manifest/playbooks.tsv +0 -16
  86. package/presets/electron-overlay.yaml +0 -38
  87. package/presets/fleet.yaml +0 -43
  88. package/presets/game.yaml +0 -38
  89. package/presets/research.yaml +0 -41
  90. package/presets/service.yaml +0 -40
  91. package/presets/software.yaml +0 -48
  92. package/roles.yaml +0 -54
  93. package/skills/goblin-bugfix/SKILL.md +0 -26
  94. package/skills/goblin-bugreporter/SKILL.md +0 -52
  95. package/skills/goblin-drift-audit/SKILL.md +0 -43
  96. package/skills/goblin-eval/SKILL.md +0 -68
  97. package/skills/goblin-feature/SKILL.md +0 -26
  98. package/skills/goblin-investigation/SKILL.md +0 -26
  99. package/skills/goblin-judge/SKILL.md +0 -74
  100. package/skills/goblin-loop/SKILL.md +0 -88
  101. package/skills/goblin-mode/SKILL.md +0 -70
  102. package/skills/goblin-overnight/SKILL.md +0 -42
  103. package/skills/goblin-pr-gate/SKILL.md +0 -42
  104. package/skills/goblin-re-mobile/SKILL.md +0 -51
  105. package/skills/goblin-refactor/SKILL.md +0 -23
  106. package/skills/goblin-sweep/SKILL.md +0 -23
  107. package/skills/goblin-tdd-repro/SKILL.md +0 -27
  108. package/templates/audit-waiver.tsv.tmpl +0 -10
  109. package/templates/install-hooks.allowlist.tmpl +0 -9
  110. package/templates/report.yaml.tmpl +0 -16
@@ -3,30 +3,23 @@
3
3
  #
4
4
  # Usage: bash bin/goblin-install --target <dir> [options] # checkout-only; `gob init --write` is the user surface
5
5
  # --target <dir> required; the repo root to install into
6
- # --class <name> required unless --uninstall or --re-pin; one of
7
- # software|service|game|research|fleet, or the aliases A-E / app / agent
8
- # / desktop (desktop/F => software + --electron); anything else is refused
9
- # --electron the electron opt-in overlay over the software class (electron: true):
10
- # the app_bundle_bytes ratchet, BN-06..09 bans, the host-gate declaration
11
- # --models <path> model mapping file (default: $GOBLIN_MODELS; unset = rendered as an
12
- # empty models_file: the repo's machine-specific input, never a path
13
- # from the machine the installer ran on)
14
6
  # --practice <path> the referenced standard (default: $GOBLIN_PRACTICE; unset = empty
15
7
  # practice: pin — a named path that is absent is reported, never
16
8
  # silently dropped)
17
- # --parts <list> comma list to install; default = every part the class requires
9
+ # --parts <list> comma list to install (default = the whole default part set)
18
10
  # --archive mark the project archive: verify requires no HANDOFF and no gates
19
- # --skills yes|no install agent skills under .hermes/skills (default no; opt in per
20
- # catalogue row with: gob extras install <id>)
11
+ # --skills <spec> which skills to vendor into .gob/skills/ (default: the 5 core
12
+ # skills). <spec> is `no`/`yes` (the core tier), `all` (every skill
13
+ # in the repo's skills/), or a comma-separated list of skill names
14
+ # (`goblin-handoff,goblin-bootstrap`) — an unknown name is refused, never
15
+ # silently skipped. `yes` additionally installs the full set under
16
+ # .hermes/skills/ (the Hermes project tier).
17
+ # --list-skills print the skill library (name, tier, one-line purpose) and exit
21
18
  # --dry-run print the plan; write nothing
22
19
  # --upgrade re-install at the current version; report created/updated/unchanged/skipped
23
20
  # --opt-out <part> record the part in disabled: so its required checks are skipped
24
21
  # --uninstall remove exactly the files in installed.json
25
22
  # --re-pin re-record practice_sha256: for an edited standard; nothing else changes
26
- # (the CI lane was REMOVED from the product in v2: no .github/workflows payload, the
27
- # explicit no opts the part out (recorded in disabled: so CL-01
28
- # reports the opt-out, never a silent absence); an explicit yes is
29
- # refused for a class that forbids the part.
30
23
  # --force allow overwriting a file goblin-stack did not create
31
24
  # --yes non-interactive; take the defaults above
32
25
  #
@@ -35,23 +28,41 @@
35
28
 
36
29
  set -uo pipefail
37
30
 
38
- GOBLIN_INSTALL_VERSION="0.6.0-alpha.4"
31
+ GOBLIN_INSTALL_VERSION="0.6.0-beta.1"
39
32
  SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
40
33
  SRC=$(cd "$SELF_DIR/.." && pwd)
41
34
  # shellcheck source=goblin-lib.sh
42
35
  . "$SELF_DIR/goblin-lib.sh"
43
36
 
37
+ # The skill LIBRARY: the repo's skills/ directory. The 5 CORE skills are the ones whose rows
38
+ # (SK-01/02/04) ride every install and are vendored by default; every other skill is available
39
+ # on request (`--skills all`, or a name list). This is the same shape the rule LIBRARY uses:
40
+ # a default set on, the rest held back and selectable, discoverable from the CLI (--list-skills).
41
+ # v3 enhance-layer (proposal §2): the 12+1 commodity/dormant skills were cut to the attic/
42
+ # branch; the payload ships only gate-coupled skills.
43
+ CORE_SKILLS="goblin-handoff goblin-verify-author goblin-feature-map practice goblin-bootstrap"
44
+ # skill_list — name<TAB>one-line-purpose for every skill in $SRC/skills/, sorted. The purpose is
45
+ # the first line of the SKILL.md frontmatter `description:` (the same field SK-01 requires).
46
+ skill_list() {
47
+ local d name desc
48
+ for d in "$SRC"/skills/*/; do
49
+ [ -f "$d/SKILL.md" ] || continue
50
+ name=$(basename "$d")
51
+ desc=$(awk 'NR==1{f=1;next} /^---/{f=0} f&&/^description:/{sub(/^description:[[:space:]]*/,"");print;exit}' "$d/SKILL.md")
52
+ printf '%s\t%s\n' "$name" "$desc"
53
+ done | sort
54
+ }
55
+ skill_names() { skill_list | cut -f1; }
56
+ # skill_tier <name> — core | optional
57
+ skill_tier() { case " $CORE_SKILLS " in *" $1 "*) printf 'core' ;; *) printf 'optional' ;; esac; }
58
+
44
59
  TARGET=""
45
- CLASS=""
46
- # QA fix (v2-qa issue 4): the old defaults were $HOME/projects/fleet-model.yaml and
47
- # $HOME/projects/PROJECT-PRACTICE.md - the MAINTAINER's home layout baked into every
48
- # rendered config on every machine, including a fresh contributor's (their rendered
49
- # AGENTS.md pointed at a file that does not exist on their machine). The neutral default
50
- # is EMPTY: no --models / no GOBLIN_MODELS renders an empty models_file: line, and the
51
- # practice pin stays empty (verify already treats both as the legitimate no-mapping /
52
- # no-standard state). A machine that HAS a fleet mapping exports GOBLIN_MODELS (or
53
- # passes --models) and gets the same rendering as before.
54
- MODELS="${GOBLIN_MODELS:-}"
60
+ # QA fix (v2-qa issue 4): the old default was $HOME/projects/PROJECT-PRACTICE.md - the
61
+ # MAINTAINER's home layout baked into every rendered config on every machine, including a
62
+ # fresh contributor's (their rendered AGENTS.md pointed at a file that does not exist on
63
+ # their machine). The neutral default is EMPTY: the practice pin stays empty (verify
64
+ # treats that as the legitimate no-standard state). A machine that HAS a standard exports
65
+ # GOBLIN_PRACTICE (or passes --practice) and gets the same rendering as before.
55
66
  PRACTICE="${GOBLIN_PRACTICE:-}"
56
67
  # W5-3: `--practice <path>` naming a file that is not there used to be IGNORED IN SILENCE -
57
68
  # exit 0, `practice: ~`, `practice_sha256: ~`, and not one line about it in the install log.
@@ -71,6 +82,7 @@ SKILLS="no"
71
82
  # "whatever the record says" (the migration contract below); a NAMED --skills no is an
72
83
  # explicit opt-out and is honoured verbatim.
73
84
  SKILLS_NAMED=0
85
+ LIST_SKILLS=0
74
86
  DRY_RUN=0
75
87
  UPGRADE=0
76
88
  UNINSTALL=0
@@ -79,10 +91,6 @@ FORCE=0
79
91
  OPT_OUT=""
80
92
  GATE_NAME_ARG="" # parsed by --gate <cmd> [name] below; reset before the loop
81
93
  # CI_GATE_OPT is gone with the CI lane (v2): no flag, no workflow file, no ci_gate field.
82
- # The electron opt-in (the merged desktop/F class): renders presets/electron-overlay.yaml over
83
- # the software preset. Auto-set when --class resolves via the desktop/F/f alias, so the alias
84
- # behaves as the old class F did rather than silently installing weaker software.
85
- ELECTRON=0
86
94
 
87
95
  usage() {
88
96
  # The header comment runs from line 2 to the first blank line, so adding an option cannot
@@ -94,13 +102,12 @@ usage() {
94
102
  while [ $# -gt 0 ]; do
95
103
  case "$1" in
96
104
  --target) TARGET="${2:-}"; shift 2 ;;
97
- --class) CLASS="${2:-}"; shift 2 ;;
98
- --models) MODELS="${2:-}"; shift 2 ;;
99
105
  --practice) PRACTICE="${2:-}"; PRACTICE_ARG="$PRACTICE"; shift 2 ;;
100
106
  --parts) PARTS="${2:-}"; shift 2 ;;
101
107
  --archive) ARCHIVE="true"; shift ;;
102
- --electron) ELECTRON=1; shift ;;
103
108
  --skills) SKILLS="${2:-}"; SKILLS_NAMED=1; shift 2 ;;
109
+ --list-skills) LIST_SKILLS=1; shift ;;
110
+ --print-core-skills) printf '%s\n' "$CORE_SKILLS"; exit 0 ;;
104
111
  --dry-run) DRY_RUN=1; shift ;;
105
112
  --upgrade) UPGRADE=1; shift ;;
106
113
  --uninstall) UNINSTALL=1; shift ;;
@@ -117,6 +124,19 @@ done
117
124
  for dep in git awk sed grep; do
118
125
  command -v "$dep" >/dev/null 2>&1 || { g_err "missing dependency: $dep"; exit 2; }
119
126
  done
127
+
128
+ # --list-skills: print the library and exit. This is the discovery surface BEFORE choosing — the
129
+ # same role `gob verify --library` plays for the rule rows. It needs no --target and writes nothing.
130
+ if [ "$LIST_SKILLS" -eq 1 ]; then
131
+ printf 'the skill library (%s/skills/):\n' "$SRC"
132
+ printf ' %-22s %-9s %s\n' NAME TIER PURPOSE
133
+ while IFS=$'\t' read -r n p; do
134
+ printf ' %-22s %-9s %s\n' "$n" "$(skill_tier "$n")" "$p"
135
+ done < <(skill_list)
136
+ printf '\ndefault install: the 5 core skills. choose with --skills all | <name>[,<name>...]\n'
137
+ exit 0
138
+ fi
139
+
120
140
  [ -n "$TARGET" ] || { g_err "--target is required"; exit 2; }
121
141
  TARGET=$(g_expand_tilde "$TARGET")
122
142
  [ -d "$TARGET" ] || { g_err "--target is not a directory: $TARGET"; exit 2; }
@@ -124,7 +144,6 @@ TARGET=$(cd "$TARGET" && pwd)
124
144
  [ -f "$SRC/VERSION" ] || { g_err "no VERSION at $SRC — is this a goblin-stack checkout?"; exit 2; }
125
145
 
126
146
  VERSION=$(head -n 1 "$SRC/VERSION")
127
- CLASSES_TSV="$SRC/manifest/classes.tsv"
128
147
  INSTALLED="$TARGET/.gob/installed.json"
129
148
  CONFIG="$TARGET/AGENTS.md"
130
149
  STAMP=$(date +%F)
@@ -171,9 +190,10 @@ if [ "$UNINSTALL" -eq 1 ]; then
171
190
  [ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/$f"
172
191
  g_info "removed $f (runtime state)"
173
192
  done
174
- # The repo-distributed MCP registration (init --with-mcp-config): removed ONLY when it
175
- # still carries the generated bytes — the preimage pattern, the same clause the decision
176
- # records below get. A hand-tuned or team-customized .mcp.json is the project's and stays.
193
+ # The repo-distributed MCP registration (init --write --with-mcp-config): removed ONLY
194
+ # when it still carries the generated bytes — the preimage pattern, the same clause the
195
+ # decision records below get. A hand-tuned or team-customized .mcp.json is the project's
196
+ # and stays.
177
197
  if [ -f "$TARGET/.mcp.json" ]; then
178
198
  if [ "$(cat "$TARGET/.mcp.json" 2>/dev/null)" = '{"mcpServers":{"gob":{"command":"npx","args":["-y","@techgoblin/gobstack","mcp"]}}}' ]; then
179
199
  [ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/.mcp.json"
@@ -182,6 +202,27 @@ if [ "$UNINSTALL" -eq 1 ]; then
182
202
  g_info "kept .mcp.json (not the generated bytes: a registration you customized stays)"
183
203
  fi
184
204
  fi
205
+ # The agent hooks (init --write, v3 enhance layer): removed ONLY when the file on disk
206
+ # still hashes to the value .gob/manifest/hooks.tsv recorded at write time. A snippet the
207
+ # project edited is the project's and stays, named in the output — the same
208
+ # removed-vs-kept fork the decision records get. The record itself goes last (it is
209
+ # goblin-stack's own file, and an uninstall that left it would be residue).
210
+ if [ -f "$TARGET/.gob/manifest/hooks.tsv" ]; then
211
+ while IFS=$'\t' read -r vendor rel sha; do
212
+ [ -n "$rel" ] || continue
213
+ [ -f "$TARGET/$rel" ] || continue
214
+ if [ "$(g_sha256_file "$TARGET/$rel")" = "$sha" ]; then
215
+ [ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/$rel"
216
+ g_info "removed $rel (the recorded $vendor hook, byte-identical)"
217
+ n=$((n + 1))
218
+ d="$rel"; while [ "${d%/*}" != "$d" ]; do d="${d%/*}"; PARENTS="$PARENTS$d"$'\n'; done
219
+ else
220
+ g_info "kept $rel (not the recorded bytes: a hook you customized stays)"
221
+ fi
222
+ done < "$TARGET/.gob/manifest/hooks.tsv"
223
+ [ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/.gob/manifest/hooks.tsv"
224
+ g_info "removed .gob/manifest/hooks.tsv (the hook record)"
225
+ fi
185
226
  # The three decision records (audit waivers, boundary waivers, the install-hook allowlist) are
186
227
  # put_once files. An UNEDITED one is still goblin-stack's template and goes; an EDITED one is
187
228
  # the project's decision and stays, named in the summary. Deleting a decision silently would be
@@ -190,7 +231,7 @@ if [ "$UNINSTALL" -eq 1 ]; then
190
231
  while IFS=$'\t' read -r p h; do
191
232
  [ -n "$p" ] || continue
192
233
  case "$p" in
193
- .gob/audit-waiver.tsv|.gob/boundary-waivers|.gob/install-hooks.allowlist) ;;
234
+ .gob/boundary-waivers) ;;
194
235
  *) continue ;;
195
236
  esac
196
237
  [ -e "$TARGET/$p" ] || continue
@@ -231,16 +272,16 @@ if [ "$UNINSTALL" -eq 1 ]; then
231
272
  printf '%s' "$PARENTS"
232
273
  printf '.goblin\n.gob/bin\n.gob/manifest\n.gob/bans\n.hermes\n.hermes/skills\n'
233
274
  } | awk 'NF' | awk -F/ '{print NF " " $0}' | sort -rn | cut -d' ' -f2- | awk '!seen[$0]++')
234
- g_info "removed $n file(s) and $nd empty director(y|ies). Left in place: HANDOFF.md, AGENTS.md, ROUND-000-SPEC.md, reviews/, the .gitignore block${KEPT:+, and the decision record(s) you edited:$KEPT}."
275
+ g_info "removed $n file(s) and $nd empty director(y|ies). Left in place: HANDOFF.md, AGENTS.md, the .gitignore block${KEPT:+, and the decision record(s) you edited:$KEPT}."
235
276
  # QA fix (v2-qa issue 10): honesty about what the uninstall leaves UNTOUCHED. Two
236
277
  # by-design residues a reader could otherwise read as a clean sweep:
237
278
  # - the .gitignore block the install appended stays (removing it could eat a
238
279
  # line the project added inside the block; the preimage is untracked text),
239
- # - prose in kept files (HANDOFF.md, AGENTS.md body, SPECs) may still name
280
+ # - prose in kept files (HANDOFF.md, AGENTS.md body) may still name
240
281
  # now-deleted paths (.gob/bin/goblin-verify, checks/) — those references are
241
282
  # dead after this command.
242
283
  g_info " note: the .gitignore ignore-rules block stays (by design: it may carry lines the project added; remove it by hand if you want it gone)"
243
- g_info " note: prose that names .gob/ paths (HANDOFF.md, AGENTS.md body, SPECs) now points at removed files — those references are dead"
284
+ g_info " note: prose that names .gob/ paths (HANDOFF.md, AGENTS.md body) now points at removed files — those references are dead"
244
285
  exit 0
245
286
  fi
246
287
 
@@ -251,7 +292,7 @@ fi
251
292
  # intended has to be explicit, printed and deliberate. This mode rewrites exactly one line and
252
293
  # reports the old and new hash. It is unreachable from --upgrade and from goblin-verify, by
253
294
  # design: an automatic re-pin would be the silent edit the pin exists to catch.
254
- # See docs/CONTRACTS.md, "An edited standard is not a dead end".
295
+ # See docs/GUIDE.md, "An edited standard is not a dead end".
255
296
  # The write's own failure output is captured (not discarded) so the fail-closed branch below can
256
297
  # name it: a g_agents_write that could not land used to vanish into >/dev/null and the pipe still
257
298
  # exited 0 (the sed inside writes via mktemp+mv, and only the mv reports).
@@ -304,125 +345,151 @@ if [ "$RE_PIN" -eq 1 ]; then
304
345
  exit 0
305
346
  fi
306
347
 
307
- [ -n "$CLASS" ] || { g_err "--class is required (software|service|game|research|fleet, or A-E / app / agent / desktop)"; exit 2; }
308
- # Resolve every accepted spelling to the canonical class NAME before anything reads it. The
309
- # letters A-E and the old names app/agent/desktop are read-time aliases; desktop/F/f also sets
310
- # the electron opt-in so the merged class behaves as the old class F did.
311
- g_class_is_electron_alias "$CLASS" && ELECTRON=1
312
- CLASS_RAW="$CLASS"
313
- CLASS=$(g_class_canon "$CLASS") \
314
- || { g_err "--class must be software|service|game|research|fleet (or A-E / app / agent / desktop), got '$CLASS_RAW'"; exit 2; }
315
- case "$SKILLS" in yes|no) ;; *) g_err "--skills must be yes or no"; exit 2 ;; esac
316
-
317
348
  # W6 migration safety: on a --upgrade (or any re-install) of a repo whose record shows skills
318
349
  # were installed, an OMITTED --skills flag must READ that state, not silently strip it. The
319
350
  # idempotence contract (created/updated/unchanged) holds only if the effective skills choice
320
351
  # for a flag-less re-install is `the record's choice`, so previously-installed skills survive
321
352
  # every upgrade unchanged. An EXPLICIT --skills no is honoured verbatim (the switch stays
322
- # real), and --uninstall still removes exactly what the record lists.
353
+ # real), and --uninstall still removes exactly what the record lists. The record's value may be
354
+ # yes, no, all, or a name list — a flag-less re-install reads whichever it was, so a chosen set
355
+ # is stable through every re-install.
323
356
  if [ -f "$INSTALLED" ] && [ "$SKILLS_NAMED" -eq 0 ]; then
324
357
  PREV_SKILLS=$(g_installed_scalar_options "$INSTALLED" skills)
325
- if [ "$PREV_SKILLS" = "yes" ]; then
326
- SKILLS="yes"
327
- g_info "skills: this repo's install record has agent skills installed - they are kept (remove them with an explicit --skills no, or --uninstall)"
328
- fi
329
- fi
330
-
331
- PRESET="$SRC/presets/$CLASS.yaml"
332
- [ -f "$PRESET" ] || { g_err "no preset for class $CLASS ($PRESET)"; exit 2; }
333
-
334
- # The electron overlay (the merged desktop/F class): every key it declares — including an empty
335
- # one like sec_write_routes: "" — wins over the class preset; an absent key falls through. This
336
- # is config, not a second code path: the same preset() reader, one layer up.
337
- OVERLAY=""
338
- if [ "$ELECTRON" -eq 1 ]; then
339
- OVERLAY="$SRC/presets/electron-overlay.yaml"
340
- [ -f "$OVERLAY" ] || { g_err "no electron overlay at $OVERLAY"; exit 2; }
358
+ case "$PREV_SKILLS" in
359
+ ""|no) ;;
360
+ *) SKILLS="$PREV_SKILLS"
361
+ g_info "skills: this repo's install record has agent skills installed - they are kept (remove them with an explicit --skills no, or --uninstall)" ;;
362
+ esac
341
363
  fi
342
- overlay_has() { [ -n "$OVERLAY" ] && grep -qE "^$1:" "$OVERLAY"; }
343
364
 
344
- preset() {
345
- local v
346
- if overlay_has "$1"; then v=$(g_yaml_scalar "$OVERLAY" "$1"); else v=$(g_yaml_scalar "$PRESET" "$1"); fi
347
- printf '%s' "${v%\"}" | sed 's/^"//'
365
+ # --skills spec, validated AFTER the migration read so a recorded choice is accepted too:
366
+ # yes|no the 5-skill core tier (yes also installs the full set under .hermes/skills/)
367
+ # all every skill in the repo's skills/
368
+ # a,b,c exactly those names
369
+ # A name that does not exist is REFUSED — with the available set named — never silently skipped.
370
+ # The check runs before anything is planned or written, so a refused selection leaves no partial
371
+ # install (the fail-closed shape the honesty gate uses for rows).
372
+ case "$SKILLS" in
373
+ yes|no|all) ;;
374
+ "")
375
+ g_err "--skills needs a value: yes, no, all, or a comma-separated skill name list (run --list-skills)"; exit 2 ;;
376
+ *)
377
+ BAD_NAMES=""
378
+ for _n in $(printf '%s' "$SKILLS" | tr ',' ' '); do
379
+ [ -n "$_n" ] || continue
380
+ [ -d "$SRC/skills/$_n" ] || BAD_NAMES="$BAD_NAMES $_n"
381
+ done
382
+ if [ -n "$BAD_NAMES" ]; then
383
+ g_err "unknown --skills name(s):$BAD_NAMES"
384
+ g_err " available: $(skill_names | paste -sd, -)"
385
+ g_err " or use --skills all (every skill) / --skills no (the 5 core skills)"
386
+ exit 2
387
+ fi ;;
388
+ esac
389
+
390
+ # The default config block: ONE built-in set of values (the old software preset). There is no
391
+ # class and no preset file: a class only ever selected which bans ran, and the ban table now
392
+ # self-selects per row via applies_when, so the installer needs no taxonomy to render a block.
393
+ # --- default key/values (key<TAB>value) ---
394
+ default_tsv() {
395
+ cat <<'XEOF'
396
+ harness_dir checks
397
+ scaffold_checks yes
398
+ gate_name commit
399
+ gate_cmd git rev-parse --verify --quiet HEAD
400
+ gate2_name todo_ceiling
401
+ gate2_cmd test "$(grep -rniE '\b(TODO|FIXME)\b' --include='*.ts' --include='*.tsx' --include='*.js' --include='*.jsx' --include='*.mjs' . 2>/dev/null | wc -l)" -le 160
402
+ ratchet_name client_js_bytes
403
+ ratchet_cmd find .next/static dist/assets dist -type f -name '*.js' -exec cat {} + 2>/dev/null | wc -c
404
+ ratchet_ceiling measure
405
+ replay_env GOBLIN_PRE_COMMIT
406
+ replay_cmd node checks/{name}.mjs
407
+ runtime_data .gob/state.json
408
+ advisory_ceiling 10
409
+ sec_gitignore_family yes
410
+ sec_build_output .next/static dist/assets dist
411
+ sec_write_routes app src/app
412
+ perf_metric client_js_bytes
413
+ perf_cmd find .next/static dist/assets dist -type f -name '*.js' -exec cat {} + 2>/dev/null | wc -c
414
+ perf_baseline_commit
415
+ perf_baseline_value 0
416
+ perf_measured
417
+ perf_host_gate
418
+ bans_disabled
419
+ XEOF
348
420
  }
349
-
350
- HARNESS_DIR=$(preset harness_dir); [ -n "$HARNESS_DIR" ] || HARNESS_DIR=checks
351
- SCAFFOLD=$(preset scaffold_checks); [ -n "$SCAFFOLD" ] || SCAFFOLD=no
352
- GATE_NAME=$(preset gate_name)
353
- # (GATE1/GATE2 render names are set in render_config; the preset keys are unchanged.)
354
- GATE_CMD=$(preset gate_cmd)
355
- # `--gate <cmd>` (gob init --write): the proposal's first gate REPLACES the class default.
421
+ default_() { default_tsv | awk -F'\t' -v OFS='\t' -v k="$1" '$1==k { $1=""; sub(/^\t/,""); print; exit }'; }
422
+
423
+ HARNESS_DIR=$(default_ harness_dir); [ -n "$HARNESS_DIR" ] || HARNESS_DIR=checks
424
+ SCAFFOLD=$(default_ scaffold_checks); [ -n "$SCAFFOLD" ] || SCAFFOLD=no
425
+ GATE_NAME=$(default_ gate_name)
426
+ # (GATE1/GATE2 render names are set in render_config; the default keys are unchanged.)
427
+ GATE_CMD=$(default_ gate_cmd)
428
+ # `--gate <cmd>` (gob init --write): the proposal's first gate REPLACES the default.
356
429
  # `--gate <cmd> <name>` (optional 2nd word): the proposal may also name the gate — the
357
430
  # HANDOFF template renders THAT name, so HP-03 (anchored on the DECLARED names) sees the
358
- # gate line a fresh HANDOFF carries even when the name is not the class default.
431
+ # gate line a fresh HANDOFF carries even when the name is not the default.
359
432
  case "${GATE_NAME_ARG:-}" in "") ;; *) GATE_NAME="$GATE_NAME_ARG" ;; esac
360
433
  [ -n "${GOB_GATE:-}" ] && GATE_CMD="$GOB_GATE"
361
- RAT_NAME=$(preset ratchet_name)
362
- RAT_CMD=$(preset ratchet_cmd)
363
- RAT_CEIL=$(preset ratchet_ceiling)
364
- REPLAY_ENV=$(preset replay_env)
365
- REPLAY_CMD=$(preset replay_cmd)
366
- RUNTIME_DATA=$(preset runtime_data)
367
- ADV_CEILING=$(preset advisory_ceiling); [ -n "$ADV_CEILING" ] || ADV_CEILING=10
368
- # The loop ceiling (G2, LP-03) is a CEILING, not a per-class policy: every class gets the same
369
- # one, defaulted to the engine's own DEFAULT_MAX_TURNS when a preset predates the key.
370
- LOOP_MAX_TURNS=$(preset loop_max_turns_ceiling); [ -n "$LOOP_MAX_TURNS" ] || LOOP_MAX_TURNS=20
371
- # The optional second gate (class A: the TODO ceiling). Empty for every other class.
372
- GATE2_NAME=$(preset gate2_name)
373
- GATE2_CMD=$(preset gate2_cmd)
434
+ # Whether the gate was DECLARED by the caller (gob init --write passes --gate, having MEASURED
435
+ # it) or is the installer's generic default. The next-steps advice depends on it: a declared gate
436
+ # is already real and owes no edit, while the default gate does. GATE_LABEL is non-empty only for
437
+ # a declared gate and rides into g_next_block.
438
+ GATE_LABEL=""
439
+ [ -n "${GOB_GATE:-}" ] && GATE_LABEL="$GATE_NAME: $GATE_CMD"
440
+ RAT_NAME=$(default_ ratchet_name)
441
+ RAT_CMD=$(default_ ratchet_cmd)
442
+ RAT_CEIL=$(default_ ratchet_ceiling)
443
+ REPLAY_ENV=$(default_ replay_env)
444
+ REPLAY_CMD=$(default_ replay_cmd)
445
+ RUNTIME_DATA=$(default_ runtime_data)
446
+ ADV_CEILING=$(default_ advisory_ceiling); [ -n "$ADV_CEILING" ] || ADV_CEILING=10
447
+ # The optional second gate (the TODO ceiling); blank it to render one gate only.
448
+ GATE2_NAME=$(default_ gate2_name)
449
+ GATE2_CMD=$(default_ gate2_cmd)
374
450
  # The security surface (SC-01..SC-09) and the perf baseline (PF-01).
375
- SEC_GITIGNORE_FAMILY=$(preset sec_gitignore_family); [ -n "$SEC_GITIGNORE_FAMILY" ] || SEC_GITIGNORE_FAMILY=no
376
- SEC_BUILD_OUTPUT=$(preset sec_build_output)
377
- SEC_AUDIT_CMD=$(preset sec_audit_cmd)
378
- SEC_AUDIT_MAX_AGE=$(preset sec_audit_max_age_days); [ -n "$SEC_AUDIT_MAX_AGE" ] || SEC_AUDIT_MAX_AGE=90
379
- SEC_WAIVER_MAX_AGE=$(preset sec_waiver_max_age_days); [ -n "$SEC_WAIVER_MAX_AGE" ] || SEC_WAIVER_MAX_AGE=180
380
- SEC_WRITE_ROUTES=$(preset sec_write_routes)
381
- PERF_METRIC=$(preset perf_metric)
382
- PERF_CMD=$(preset perf_cmd)
383
- PERF_BASELINE_COMMIT=$(preset perf_baseline_commit)
384
- PERF_BASELINE_VALUE=$(preset perf_baseline_value); [ -n "$PERF_BASELINE_VALUE" ] || PERF_BASELINE_VALUE=0
385
- PERF_MEASURED=$(preset perf_measured)
386
- PERF_HOST_GATE=$(preset perf_host_gate)
387
- # The ban list (G5): which bans this class turns on. An unlisted ban SKIPs with a reason.
388
- BANS=$(preset bans)
389
- # `layers:` is a block list the project declares; no preset ships one, so it renders empty and
390
- # BN-05 SKIPs with that reason until the project declares a from/to pair.
451
+ SEC_GITIGNORE_FAMILY=$(default_ sec_gitignore_family); [ -n "$SEC_GITIGNORE_FAMILY" ] || SEC_GITIGNORE_FAMILY=no
452
+ SEC_BUILD_OUTPUT=$(default_ sec_build_output)
453
+ SEC_WRITE_ROUTES=$(default_ sec_write_routes)
454
+ PERF_METRIC=$(default_ perf_metric)
455
+ PERF_CMD=$(default_ perf_cmd)
456
+ PERF_BASELINE_COMMIT=$(default_ perf_baseline_commit)
457
+ PERF_BASELINE_VALUE=$(default_ perf_baseline_value); [ -n "$PERF_BASELINE_VALUE" ] || PERF_BASELINE_VALUE=0
458
+ PERF_MEASURED=$(default_ perf_measured)
459
+ PERF_HOST_GATE=$(default_ perf_host_gate)
460
+ # The ban selection is the GLOB (a ban runs when a real file matches its applies_when cell);
461
+ # the only config knob is an explicit DISABLE list, rendered empty by default. A ban outside
462
+ # any of this is on automatically.
463
+ BANS_DISABLED=$(default_ bans_disabled)
464
+ # `layers:` is a block list the project declares; the default ships none, so it renders empty
465
+ # and BN-05 SKIPs with that reason until the project declares a from/to pair.
391
466
  LAYERS_BLOCK=""
392
467
 
393
- need() { g_class_need "$CLASSES_TSV" "$CLASS" "$1"; }
394
-
395
- # parts that are OFF for this class become real opt-outs, not silent absences
468
+ # Every part is on by default (there is no class turning parts off). The CORE procedure
469
+ # tier is vendored on EVERY install (.gob/skills/), so the product never disables its own
470
+ # skill rows (SK-01/02/04) — a fresh repo's harness runs them instead of skipping. An
471
+ # explicit --opt-out is the only thing that records a part in disabled:.
396
472
  DISABLED=""
397
- for p in handoff spec gate replay ratchet pr-gate review-panel playbooks tokens; do
398
- [ "$(need "$p")" = "-" ] && DISABLED="$DISABLED$p,"
399
- done
400
- [ "$SKILLS" = "no" ] && DISABLED="$DISABLED""playbooks,"
401
473
  if [ -n "$OPT_OUT" ]; then DISABLED="$DISABLED$OPT_OUT,"; fi
402
474
  DISABLED=$(printf '%s' "$DISABLED" | tr ',' '\n' | grep -v '^$' | sort -u | paste -sd, -)
403
- # The automation producers ride the `playbooks` part (they are the shipped automation files, and
404
- # --skills no disables that part), so they are written under exactly the condition that makes
405
- # AU-01..AU-04 and SK-04 honour an opt-out.
406
- PLAYBOOKS_ON=1
407
- case ",$DISABLED," in *,playbooks,*) PLAYBOOKS_ON=0 ;; esac
408
- # parts the class forbids are never installed
409
- for p in spec replay ratchet pr-gate; do
410
- [ "$(need "$p")" = "-" ] && SCAFFOLD=no
411
- done
412
475
 
413
- WANT_SPEC=1; [ "$(need spec)" = "-" ] && WANT_SPEC=0
476
+ # FIX 3: a *-SPEC.md and reviews/ are policed by LIBRARY rows (SP-01..03, PG-01..03, off by
477
+ # default), so a default install ships NEITHER: an artefact nothing checks on this repo is a false
478
+ # promise ("the installer scaffolds rows that are off by default"). They come back only on an
479
+ # explicit opt-in, `--parts spec` / `--parts reviews` — the same surface a repo turns the library
480
+ # rows on through — because "create them when the row is enabled" is not knowable at install time
481
+ # (enablement is a POST-install edit of .gob/manifest/enforcement.local.tsv). The installed file
482
+ # set therefore matches what the ENABLED (default) rows actually need.
483
+ WANT_SPEC=0
414
484
  WANT_REVIEWS=0
415
- case "$(need pr-gate)$(need review-panel)" in *R*|*O*) WANT_REVIEWS=1 ;; esac
416
- WANT_RATCHET=1; [ "$(need ratchet)" = "-" ] && WANT_RATCHET=0
417
- # The CI lane is GONE (v2 product decision): no .github/workflows file is written, the ci-gate
418
- # part is recorded as a class-level opt-out, and no flag configures it.
485
+ case ",${PARTS}," in *,spec,*) WANT_SPEC=1 ;; esac
486
+ case ",${PARTS}," in *,reviews,*) WANT_REVIEWS=1 ;; esac
487
+ WANT_RATCHET=1
488
+ # The CI lane is GONE (v2 product decision): no .github/workflows file is written and no flag
489
+ # configures it.
419
490
  WANT_CI_GATE=0
420
491
  [ "$ARCHIVE" = "true" ] && { WANT_SPEC=0; WANT_REVIEWS=0; SCAFFOLD=no; }
421
492
 
422
- OWNER_EMAIL=$( cd "$TARGET" && git config user.email 2>/dev/null )
423
- [ -n "$OWNER_EMAIL" ] || OWNER_EMAIL="you@example.com"
424
- BRANCH=$( cd "$TARGET" && git rev-parse --abbrev-ref HEAD 2>/dev/null )
425
- case "$BRANCH" in ""|HEAD) BRANCH=main ;; esac
426
493
  HEAD_SHORT=$( cd "$TARGET" && git rev-parse --short HEAD 2>/dev/null )
427
494
  [ -n "$HEAD_SHORT" ] || HEAD_SHORT="0000000"
428
495
 
@@ -447,9 +514,6 @@ if [ "$RAT_CEIL" = "measure" ]; then
447
514
  case "$RAT_CEIL" in ''|*[!0-9]*) RAT_CEIL=0 ;; esac
448
515
  fi
449
516
  [ "$WANT_RATCHET" -eq 0 ] && { RAT_NAME=""; RAT_CMD=""; RAT_CEIL=0; }
450
- # A part the class turns off must not be declared either: leaving replay.env/replay.cmd in the
451
- # config made CL-01's "class forbids this part" branch fire on the installer's own output (D10).
452
- [ "$(need replay)" = "-" ] && { REPLAY_ENV=""; REPLAY_CMD=""; }
453
517
 
454
518
  # parts selected with --parts
455
519
  part_wanted() {
@@ -470,7 +534,7 @@ REFUSED_PATHS=""
470
534
  PREV_OWNED=""
471
535
  # Files a PREVIOUS run installed (the hash-checked 'files' map). A path that exists on disk
472
536
  # but is NOT in this map was not created by goblin-stack, so it is refused rather than
473
- # clobbered - the contract in docs/CONTRACTS.md. --force is the only way past it.
537
+ # clobbered - the contract in docs/GUIDE.md. --force is the only way past it.
474
538
  PREV_FILES=""
475
539
  if [ -f "$INSTALLED" ]; then
476
540
  PREV_OWNED=$(g_json_object "$INSTALLED" owned | cut -f1)
@@ -568,28 +632,20 @@ put_once() {
568
632
  # ------------------------------------------------------- generated content ---
569
633
  render_config() {
570
634
  local gates runtime
571
- # v2 gate shape: one flat key per gate (gate_<name>_cmd:). A class may declare a second
572
- # gate (A: the TODO ceiling that used to be the ratchet, G4 D2); a class with none renders
573
- # an empty gate name and the key line is dropped below.
635
+ # v2 gate shape: one flat key per gate (gate_<name>_cmd:). The default declares a second
636
+ # gate (the TODO ceiling, G4 D2); with none, the gate name renders empty and the key line
637
+ # is dropped below.
574
638
  GATE1_NAME="$GATE_NAME"; GATE1_CMD="$GATE_CMD"
575
639
  GATE2_RENDER_NAME="$GATE2_NAME"; GATE2_RENDER_CMD="$GATE2_CMD"
576
640
  runtime="$RUNTIME_DATA"
577
641
  render "$SRC/templates/agents-block.tmpl" \
578
- CLASS "$CLASS" \
579
- ELECTRON "$( [ "$ELECTRON" -eq 1 ] && printf 'true' || printf 'false' )" \
580
- BRANCH "$BRANCH" \
581
- MODELS_FILE "$MODELS" \
582
642
  PRACTICE "$PRACTICE" \
583
643
  PRACTICE_SHA "$PRACTICE_SHA" \
584
- OWNER_EMAIL "$OWNER_EMAIL" \
585
644
  ARCHIVE "$ARCHIVE" \
586
645
  MAX_DIRTY "0" \
587
646
  ADVISORY_CEILING "$ADV_CEILING" \
588
647
  SEC_GITIGNORE_FAMILY "$SEC_GITIGNORE_FAMILY" \
589
648
  SEC_BUILD_OUTPUT "$SEC_BUILD_OUTPUT" \
590
- SEC_AUDIT_CMD "$SEC_AUDIT_CMD" \
591
- SEC_AUDIT_MAX_AGE "$SEC_AUDIT_MAX_AGE" \
592
- SEC_WAIVER_MAX_AGE "$SEC_WAIVER_MAX_AGE" \
593
649
  SEC_WRITE_ROUTES "$SEC_WRITE_ROUTES" \
594
650
  PERF_METRIC "$PERF_METRIC" \
595
651
  PERF_CMD "$PERF_CMD" \
@@ -604,7 +660,6 @@ render_config() {
604
660
  VERIFY_DOCTOR "" \
605
661
  REFERENCE_MANIFEST "" \
606
662
  QUARANTINE_ROOT "" \
607
- LOOP_MAX_TURNS "$LOOP_MAX_TURNS" \
608
663
  GATE1_NAME "$GATE1_NAME" \
609
664
  GATE1_CMD "$GATE1_CMD" \
610
665
  GATE2_NAME "$GATE2_RENDER_NAME" \
@@ -613,7 +668,7 @@ render_config() {
613
668
  RATCHET_CMD "$RAT_CMD" \
614
669
  RATCHET_CEILING "$RAT_CEIL" \
615
670
  RUNTIME_DATA "$runtime" \
616
- BANS "$BANS" \
671
+ BANS_DISABLED "$BANS_DISABLED" \
617
672
  BANS_EXEMPT "" \
618
673
  LAYERS "$LAYERS_BLOCK" \
619
674
  REPLAY_ENV "$REPLAY_ENV" \
@@ -660,14 +715,16 @@ fi
660
715
 
661
716
  put ".gob/bin/goblin-verify" "$SRC/bin/goblin-verify"
662
717
  put ".gob/bin/goblin-lib.sh" "$SRC/bin/goblin-lib.sh"
663
- # The audit record is produced by a DELIBERATE, separate command - SC-07 reads the record and
664
- # never the network (RISKS.md K4: no network at verify time).
665
- put ".gob/bin/goblin-audit" "$SRC/bin/goblin-audit"
666
- put ".gob/roles.yaml" "$SRC/roles.yaml"
667
718
  put ".gob/manifest/enforcement.tsv" "$SRC/manifest/enforcement.tsv"
668
- put ".gob/manifest/playbooks.tsv" "$SRC/manifest/playbooks.tsv"
669
- put ".gob/manifest/classes.tsv" "$SRC/manifest/classes.tsv"
719
+ # The library (batch 2b-ii): the off-by-default rows, held next to the matrix so `gob verify
720
+ # --library` can list them and the summary can count them. Data, not a check: it ships whole
721
+ # or not at all with the manifest it is the complement of.
722
+ put ".gob/manifest/library.tsv" "$SRC/manifest/library.tsv"
670
723
  put ".gob/manifest/glossary.tsv" "$SRC/manifest/glossary.tsv"
724
+ # The external-categories inventory (v3 §4.1): data-only, vendored and hash-pinned like
725
+ # every other manifest file. No gobstack code reads it — the reader is the agent following
726
+ # the init brief; the pin just makes the target's copy tamper-evident.
727
+ put ".gob/engine/categories.tsv" "$SRC/manifest/categories.tsv"
671
728
  # The ban list (G5): the table, the engine, and the two probes. A ban with no mechanism is a
672
729
  # wish, so the table and the engine install together or not at all.
673
730
  put ".gob/manifest/bans.tsv" "$SRC/manifest/bans.tsv"
@@ -678,7 +735,7 @@ put ".gob/bans/layer-check.sh" "$SRC/bans/layer-check.sh"
678
735
  # The AGENTS.md frontmatter: the body prose is rendered once (put_once), then the marker
679
736
  # block is written into it through g_agents_write — the same path every later rewrite takes,
680
737
  # so the block is never a second copy of the file and the body is never machine-owned.
681
- render "$SRC/templates/AGENTS.md.tmpl" CLASS "$CLASS" DATE "$STAMP" > "$TMP/agents-body"
738
+ render "$SRC/templates/AGENTS.md.tmpl" DATE "$STAMP" > "$TMP/agents-body"
682
739
  put_once "AGENTS.md" "$TMP/agents-body"
683
740
  if [ "$DRY_RUN" -eq 0 ] && [ -f "$CONFIG" ]; then
684
741
  # The install-once contract for the project's own answers: on a RE-install (the previous
@@ -700,74 +757,83 @@ if [ "$DRY_RUN" -eq 0 ] && [ -f "$CONFIG" ]; then
700
757
  g_agents_write "$CONFIG" < "$TMP/agents-block" >/dev/null \
701
758
  || { g_err "could not write the gob block into $CONFIG"; exit 1; }
702
759
  fi
703
- # The security lane's two decision records and the audit allowlist are created once, then YOURS:
704
- # they are answers to questions only the project can answer (G4 B3).
705
- [ -f "$SRC/templates/audit-waiver.tsv.tmpl" ] && put_once ".gob/audit-waiver.tsv" "$SRC/templates/audit-waiver.tsv.tmpl"
760
+ # The security lane's decision record is created once, then YOURS: it is an answer to a question
761
+ # only the project can answer (G4 B3).
706
762
  [ -f "$SRC/templates/boundary-waivers.tmpl" ] && put_once ".gob/boundary-waivers" "$SRC/templates/boundary-waivers.tmpl"
707
- [ -f "$SRC/templates/install-hooks.allowlist.tmpl" ] && put_once ".gob/install-hooks.allowlist" "$SRC/templates/install-hooks.allowlist.tmpl"
708
763
 
709
- if [ "$SKILLS" = "yes" ] && part_wanted playbooks; then
764
+ # the Hermes project tier (opt-in): --skills yes installs the FULL set under .hermes/skills/.
765
+ if [ "$SKILLS" = "yes" ] && part_wanted skills; then
710
766
  for d in "$SRC"/skills/*/; do
711
- [ -d "$d" ] || continue
767
+ [ -f "$d/SKILL.md" ] || continue
712
768
  name=$(basename "$d")
713
769
  put ".hermes/skills/$name/SKILL.md" "$d/SKILL.md"
714
770
  done
715
771
  fi
716
772
 
717
- # W6 neutral-first: an EXPLICIT --skills no re-install of a repo that HAS recorded skills
718
- # removes them — the switch stays real in both directions. The paths come from the previous
719
- # record, so exactly what was installed is what goes; a skill file the project edited by hand
720
- # is refused by put's own contract (never clobbered silently), reported in the summary.
721
- if [ "$SKILLS_NAMED" -eq 1 ] && [ "$SKILLS" = "no" ] && [ -n "$PREV_FILES" ]; then
773
+ # The vendored procedure tier under .gob/skills/ — the SELECTED set (this mirrors the rule
774
+ # library: a default set on, the rest held back and selectable). Default (yes|no): the 5 core
775
+ # skills whose rows (SK-01/02/04) ride every install, so a default install never disables its
776
+ # own rows. `all`: every skill in the repo. A name list: exactly those (validated above). put:
777
+ # hash-checked, so IN-02/SK-02 see them like any other payload file, and installed.json covers
778
+ # EXACTLY this set — no more, no fewer.
779
+ VENDOR_SKILLS="$CORE_SKILLS"
780
+ case "$SKILLS" in
781
+ all) VENDOR_SKILLS=$(skill_names | tr '\n' ' ') ;;
782
+ yes|no) VENDOR_SKILLS="$CORE_SKILLS" ;;
783
+ *) VENDOR_SKILLS=$(printf '%s' "$SKILLS" | tr ',' ' ') ;;
784
+ esac
785
+ for name in $VENDOR_SKILLS; do
786
+ [ -f "$SRC/skills/$name/SKILL.md" ] || continue
787
+ put ".gob/skills/$name/SKILL.md" "$SRC/skills/$name/SKILL.md"
788
+ done
789
+
790
+ # no more, no fewer: remove any RECORDED skill file the new selection no longer covers, so
791
+ # installed.json (and SK-02) covers exactly the vendored set. Both cases read the previous
792
+ # record, so exactly what was installed is what goes:
793
+ # * .hermes/skills/* goes when the Hermes tier is no longer selected (SKILLS != yes);
794
+ # * .gob/skills/<name>/* goes when <name> left the vendored set (e.g. all -> no shrinks 5 -> 5).
795
+ # Empty directories left behind are pruned (deepest first).
796
+ if [ -n "$PREV_FILES" ]; then
722
797
  while IFS= read -r rel; do
723
- case "$rel" in .hermes/skills/*) ;; *) continue ;; esac
798
+ case "$rel" in
799
+ .hermes/skills/*) [ "$SKILLS" = "yes" ] && continue ;;
800
+ .gob/skills/*)
801
+ sname=${rel#.gob/skills/}; sname=${sname%%/*}
802
+ case " $VENDOR_SKILLS " in *" $sname "*) continue ;; esac ;;
803
+ *) continue ;;
804
+ esac
724
805
  dst="$TARGET/$rel"
725
- [ -f "$dst" ] || { rm -f "$TARGET/.gob/$(basename "$rel")" 2>/dev/null; continue; }
806
+ [ -f "$dst" ] || continue
726
807
  if [ "$DRY_RUN" -eq 1 ]; then
727
- g_info "plan: remove $rel (explicit --skills no)"
808
+ g_info "plan: remove $rel (no longer selected)"
728
809
  else
729
810
  rm -f "$dst"
730
- g_info "removed $rel (explicit --skills no)"
811
+ g_info "removed $rel (no longer selected)"
731
812
  fi
732
813
  done <<EOF
733
814
  $PREV_FILES
734
815
  EOF
735
- # the emptied .hermes/skills/*/<name> and .hermes/ directories go too (deepest first)
736
816
  if [ "$DRY_RUN" -eq 0 ]; then
737
- find "$TARGET/.hermes" -depth -type d -exec rmdir {} + 2>/dev/null
738
- fi
739
- fi
740
-
741
- # The automation producers. They land in the target so the target is self-contained and
742
- # IN-02/SK-02 hash them like every other installed file; the cron copy step then reads from
743
- # here (see the "next:" block and automations/README.md).
744
- if [ "$PLAYBOOKS_ON" -eq 1 ] && part_wanted playbooks; then
745
- for f in "$SRC"/automations/drift-audit.sh "$SRC"/automations/bugreporter-intake.sh \
746
- "$SRC"/automations/README.md "$SRC"/automations/report.schema.tsv; do
747
- [ -f "$f" ] || continue
748
- put ".gob/automations/$(basename "$f")" "$f"
749
- done
750
- if [ -f "$SRC/templates/report.yaml.tmpl" ]; then
751
- put ".gob/automations/report.yaml.tmpl" "$SRC/templates/report.yaml.tmpl"
817
+ find "$TARGET/.hermes" "$TARGET/.gob/skills" -depth -type d -exec rmdir {} + 2>/dev/null
752
818
  fi
753
819
  fi
754
820
 
755
821
  if [ "$WANT_SPEC" -eq 1 ] && part_wanted spec; then
756
- render "$SRC/templates/SPEC.md.tmpl" CLASS "$CLASS" DATE "$STAMP" > "$TMP/spec"
822
+ render "$SRC/templates/SPEC.md.tmpl" DATE "$STAMP" > "$TMP/spec"
757
823
  put_once "ROUND-000-SPEC.md" "$TMP/spec"
758
824
  fi
759
825
  if [ "$ARCHIVE" != "true" ] && part_wanted handoff; then
760
826
  # The HANDOFF names the gate the way GT-02 runs it: by the command's own name key
761
827
  # (gate_<name>_cmd), so HP-03 anchors on a declared name even when --gate replaced the
762
- # class default command. GATE2_LINE renders the class's second gate (if any) the same
763
- # way — a Gates section that names only gate 1 while AGENTS.md declares two is the
764
- # HP-03 day-one anchoring red. A class with no second gate renders an empty line.
828
+ # default command. GATE2_LINE renders the second gate (if any) the same way — a Gates
829
+ # section that names only gate 1 while AGENTS.md declares two is the HP-03 day-one
830
+ # anchoring red. With no second gate an empty line is rendered.
765
831
  if [ -n "$GATE2_NAME" ]; then
766
832
  GATE2_LINE="- \`$GATE2_NAME\` = 0 · measured $STAMP"
767
833
  else
768
834
  GATE2_LINE=""
769
835
  fi
770
- render "$SRC/templates/HANDOFF.md.tmpl" CLASS "$CLASS" DATE "$STAMP" HEAD "$HEAD_SHORT" BRANCH "$BRANCH" GATE_NAME "$GATE_NAME" GATE_CMD "$GATE_CMD" GATE2_LINE "$GATE2_LINE" > "$TMP/handoff"
836
+ render "$SRC/templates/HANDOFF.md.tmpl" DATE "$STAMP" HEAD "$HEAD_SHORT" GATE_NAME "$GATE_NAME" GATE_CMD "$GATE_CMD" GATE2_LINE "$GATE2_LINE" > "$TMP/handoff"
771
837
  put_once "HANDOFF.md" "$TMP/handoff"
772
838
  fi
773
839
 
@@ -816,7 +882,6 @@ fi
816
882
  printf '{\n'
817
883
  printf ' "version": "%s",\n' "$VERSION"
818
884
  printf ' "source_sha": "%s",\n' "$( cd "$SRC" && git rev-parse HEAD 2>/dev/null || echo unknown )"
819
- printf ' "class": "%s",\n' "$CLASS"
820
885
  printf ' "installed_at": "%s",\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
821
886
  printf ' "options": {"skills": "%s", "archive": %s, "parts": "%s"},\n' "$SKILLS" "$ARCHIVE" "${PARTS:-all}"
822
887
  printf ' "files": {\n'
@@ -866,29 +931,20 @@ if [ "$DRY_RUN" -eq 0 ]; then
866
931
  g_info "recorded opt-out: $OPT_OUT"
867
932
  fi
868
933
  g_info ""
869
- g_info "next:"
870
- g_info " 1. cd $TARGET && git add -A && git commit # the install is a change like any other"
871
- g_info " 2. .gob/bin/goblin-verify # or add .gob/bin to PATH"
872
- g_info " 3. edit AGENTS.md: replace the default gate with your real commands (P8 step 3)"
873
- if [ "$SKILLS" = "yes" ]; then
874
- g_info " 4. hermes skills trust $TARGET # one-time, so the project-tier skills load"
875
- else
876
- g_info " 4. agent skills are opt-in: gob extras install <id...> # gob extras list shows the catalogue"
934
+ # ONE ordered next-steps list, shared with `gob init` (g_next_block, bin/goblin-lib.sh), and
935
+ # every line true of the artefact. When `gob init --write` ran this install it defers the block
936
+ # (GOB_NEXT_DEFER) and prints the same list itself at the end, so a user never sees two lists.
937
+ if [ "${GOB_NEXT_DEFER:-0}" != "1" ]; then
938
+ g_next_block "$TARGET" "$SKILLS" "$GATE_LABEL"
877
939
  fi
878
940
  g_info ""
879
- g_info "automations (optional; neither writes outside this repo, and A-02 has no agent in it):"
880
- g_info " bash $TARGET/.gob/automations/drift-audit.sh --dry-run # read the record first"
881
- g_info " cp $TARGET/.gob/automations/drift-audit.sh ~/.hermes/scripts/"
882
- g_info " hermes cron create \"0 9 * * 1\" --name \"Drift audit - weekly\" --no-agent \\"
883
- g_info " --script drift-audit.sh --deliver <channel>"
884
- g_info " P13/P14 in docs/FLOWS.md; the whole model in automations/README.md"
885
941
  else
886
942
  g_info "dry-run: created $CREATED · updated $UPDATED · unchanged $UNCHANGED · skipped $SKIPPED"
887
943
  fi
888
944
 
889
945
  if [ -n "$REFUSED_PATHS" ]; then
890
- g_info "refused to overwrite:$REFUSED_PATHS (kept - reconcile it: docs/ADOPTION.md; --force would destroy it)"
891
- # Documented contract (docs/CONTRACTS.md, this file's header): exit 1 is "a refusal, with
946
+ g_info "refused to overwrite:$REFUSED_PATHS (kept - reconcile it: docs/GUIDE.md; --force would destroy it)"
947
+ # Documented contract (docs/GUIDE.md, this file's header): exit 1 is "a refusal, with
892
948
  # the path and the fix". A wrapper has to be able to detect it (D2).
893
949
  exit 1
894
950
  fi