@sassywares/skills 0.14.0 → 0.16.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.
Files changed (73) hide show
  1. package/README.md +58 -34
  2. package/package.json +1 -2
  3. package/skills/sassy-babysit/SKILL.md +3 -0
  4. package/skills/sassy-commit/SKILL.md +4 -1
  5. package/skills/sassy-commit-push-pr/SKILL.md +4 -1
  6. package/skills/sassy-compound/SKILL.md +4 -1
  7. package/skills/sassy-compound/references/concepts.md +8 -2
  8. package/skills/sassy-compound/references/templates.md +6 -0
  9. package/skills/sassy-cycle/SKILL.md +4 -1
  10. package/skills/sassy-debug/SKILL.md +3 -0
  11. package/skills/sassy-docs/SKILL.md +3 -0
  12. package/skills/sassy-docs/references/handbook-format.md +6 -0
  13. package/skills/sassy-docs/references/handbook.md +6 -0
  14. package/skills/sassy-docs/references/review.md +11 -2
  15. package/skills/sassy-dogfood/SKILL.md +3 -0
  16. package/skills/sassy-dogfood/references/check.md +6 -0
  17. package/skills/sassy-dogfood/references/discover.md +6 -0
  18. package/skills/sassy-dogfood/references/run.md +6 -0
  19. package/skills/sassy-goal/SKILL.md +18 -12
  20. package/skills/sassy-goal/references/check.md +7 -1
  21. package/skills/sassy-goal/references/close.md +11 -4
  22. package/skills/sassy-goal/references/goal-format.md +17 -4
  23. package/skills/sassy-goal/references/next.md +15 -9
  24. package/skills/sassy-goal/references/revise.md +25 -0
  25. package/skills/sassy-goal/references/write.md +8 -0
  26. package/skills/sassy-handoff/SKILL.md +3 -0
  27. package/skills/sassy-handoff/references/read.md +6 -0
  28. package/skills/sassy-handoff/references/write.md +6 -0
  29. package/skills/sassy-overview/SKILL.md +3 -0
  30. package/skills/sassy-overview/references/identify.md +6 -0
  31. package/skills/sassy-plan/SKILL.md +30 -23
  32. package/skills/sassy-plan/references/interview.md +8 -2
  33. package/skills/sassy-plan/references/plan-format.md +40 -11
  34. package/skills/sassy-plan/references/revision-format.md +86 -0
  35. package/skills/sassy-plan/references/sketches.md +6 -0
  36. package/skills/sassy-review/SKILL.md +3 -0
  37. package/skills/sassy-scout/SKILL.md +3 -0
  38. package/skills/sassy-setup/SKILL.md +22 -11
  39. package/skills/sassy-setup/assets/agents-md.md +71 -0
  40. package/skills/sassy-setup/assets/roster +1 -1
  41. package/skills/sassy-setup/references/anchors.md +128 -0
  42. package/skills/sassy-setup/references/branching.md +19 -10
  43. package/skills/sassy-setup/references/check.md +20 -2
  44. package/skills/sassy-setup/references/config.md +22 -12
  45. package/skills/sassy-setup/references/dogfood.md +6 -0
  46. package/skills/sassy-setup/references/harness.md +6 -0
  47. package/skills/sassy-setup/references/init.md +10 -0
  48. package/skills/sassy-setup/references/plan-resolution.md +53 -0
  49. package/skills/sassy-setup/references/scaffold-header.md +6 -0
  50. package/skills/sassy-setup/references/workspace.md +29 -0
  51. package/skills/sassy-setup/references/worktree.md +6 -0
  52. package/skills/sassy-setup/scripts/detect.sh +282 -31
  53. package/skills/sassy-ship/SKILL.md +8 -5
  54. package/skills/sassy-ship/references/brief.md +6 -0
  55. package/skills/sassy-ship/references/plan.md +7 -1
  56. package/skills/sassy-ship/references/slice.md +6 -0
  57. package/skills/sassy-simplify/SKILL.md +3 -0
  58. package/skills/sassy-skill/SKILL.md +3 -0
  59. package/skills/sassy-skill/references/create.md +6 -0
  60. package/skills/sassy-skill/references/retune.md +6 -0
  61. package/skills/sassy-skill/references/verify.md +6 -0
  62. package/skills/sassy-strategy/SKILL.md +69 -0
  63. package/skills/sassy-strategy/references/check.md +87 -0
  64. package/skills/sassy-strategy/references/strategy-format.md +90 -0
  65. package/skills/sassy-strategy/references/write.md +186 -0
  66. package/skills/sassy-validate/SKILL.md +4 -1
  67. package/skills/sassy-work/SKILL.md +66 -68
  68. package/skills/sassy-worktree/SKILL.md +3 -0
  69. package/skills/sassy-worktree/references/create.md +6 -0
  70. package/skills/sassy-worktree/references/list.md +6 -0
  71. package/skills/sassy-worktree/references/remove.md +6 -0
  72. package/CONCEPTS.md +0 -178
  73. package/skills/sassy-lfg/SKILL.md +0 -92
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-setup
5
+ ---
6
+
1
7
  # The scaffold header
2
8
 
3
9
  One header, one owner. Every project-owned file the suite plants **outside**
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-setup
5
+ ---
6
+
1
7
  # Workspace install
2
8
 
3
9
  Read this only when the topology is `workspace`. Everything setup installs
@@ -38,6 +44,29 @@ lives under one directory:
38
44
  - Do **not** run the snapshot during setup. It clones and pushes; that is the
39
45
  user's call. Offer `--dry-run` and run it only if they ask.
40
46
 
47
+ ## The routing block
48
+
49
+ A workspace has one config, so it has one set of `artifacts.*` paths and one routing
50
+ block, and both belong to the root that holds `.sassywares/`. Render it from the
51
+ shipped `assets/agents-md.md` exactly as `references/init.md` step 5 says — resolved
52
+ paths, anchors named with the absent note, idempotent, a difference shown as a diff
53
+ and asked about. Where it goes is the one place a workspace differs:
54
+
55
+ - **The workspace root, always.** The root's `AGENTS.md` gets the block — the whole
56
+ template when there is none, the marked block appended when there is.
57
+ - **A nested repo, only when that repo already keeps an `AGENTS.md`.** The agent
58
+ working inside a repo reads that repo's file, not the root's, so a repo that has
59
+ one gets the same block appended. **Never invent an `AGENTS.md` in a repo that
60
+ never kept one**: a file created only to hold a block is a second document the
61
+ project maintains and the next reader has to explain, and a repo with none was
62
+ never an agent's entry point here.
63
+ - **The report names both lists** — the files written or appended, and the nested
64
+ repos skipped because they have no `AGENTS.md`. A skipped repo is not a gap.
65
+ - **Nothing is committed.** The root is not a repo, so the root block rides the next
66
+ `snapshot` with the rest of the glue. A nested repo's `AGENTS.md` is that repo's
67
+ own file: setup leaves it uncommitted, says so in the report, and never sweeps it
68
+ into a sync.
69
+
41
70
  ## Script aliases (optional)
42
71
 
43
72
  The scripts are executable and tracked, so the whole contract is the path itself:
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-setup
5
+ ---
6
+
1
7
  # Worktrees
2
8
 
3
9
  Parallel work in one repo: each run gets its own checkout and its own branch,
@@ -14,9 +14,11 @@
14
14
  # detect.sh [--root DIR] --worktree-script MODE
15
15
  # print the absolute path of the create or
16
16
  # remove script a run executes
17
- # detect.sh [--root DIR] --sync [--write]
17
+ # detect.sh [--root DIR] --sync [--write] [--agents|--no-agents]
18
18
  # merge the existing config onto the template
19
19
  # and print it (or write it with --write)
20
+ # --agents syncs only the AGENTS.md block,
21
+ # --no-agents only the config
20
22
  #
21
23
  # --policy takes infer|current|new: the skill-level token. infer (the default)
22
24
  # defers to commit.branch in the config, and new is the fallback when the config
@@ -37,6 +39,10 @@
37
39
  # proposal. A malformed value is not accepted, so it comes from the proposal,
38
40
  # exactly as --check judges it. A dry run prints the merged file and writes
39
41
  # nothing.
42
+ # --sync owns two files: the config merge and the AGENTS.md routing block.
43
+ # --agents scopes it to the block, --no-agents to the config, so a run that
44
+ # declined one of the two diffs can fix the other with the same command. With
45
+ # neither flag it does both, exactly as before.
40
46
  set -euo pipefail
41
47
 
42
48
  ROOT_ARG=""
@@ -49,6 +55,8 @@ CHECK=0
49
55
  BRANCH=0
50
56
  SYNC=0
51
57
  SINGLE=0
58
+ AGENTS_ONLY=0
59
+ NO_AGENTS=0
52
60
 
53
61
  while (( $# )); do
54
62
  case "$1" in
@@ -68,6 +76,8 @@ while (( $# )); do
68
76
  --check) CHECK=1 ;;
69
77
  --sync) SYNC=1 ;;
70
78
  --write) SINGLE=1 ;;
79
+ --agents) AGENTS_ONLY=1 ;;
80
+ --no-agents) NO_AGENTS=1 ;;
71
81
  -h|--help) sed -n '2,/^set -euo pipefail/p' "${BASH_SOURCE[0]}" | sed '$d' | sed 's|^# \{0,1\}||'; exit 0 ;;
72
82
  *) echo "unknown argument: $1" >&2; exit 2 ;;
73
83
  esac
@@ -86,6 +96,12 @@ START="${ROOT_ARG:-$PWD}"
86
96
  # --write is read by --sync. Alone it would print the proposal and drop itself.
87
97
  (( ! SINGLE )) || (( SYNC )) \
88
98
  || { echo "--write is read with --sync; run them together" >&2; exit 2; }
99
+ # --agents and --no-agents name opposite halves of --sync: together they
100
+ # contradict, and alone they would print the proposal and drop themselves.
101
+ (( ! AGENTS_ONLY || ! NO_AGENTS )) \
102
+ || { echo "--agents and --no-agents are separate scopes; pick one" >&2; exit 2; }
103
+ (( ! AGENTS_ONLY && ! NO_AGENTS )) || (( SYNC )) \
104
+ || { echo "--agents and --no-agents are read with --sync; run them together" >&2; exit 2; }
89
105
  # --goal resolves hooks inside --check. Anywhere else the flag would print the
90
106
  # proposal and drop itself silently.
91
107
  (( CHECK )) || [[ -z "$GOAL_ARG" ]] || { echo "--goal is read with --check; run them together" >&2; exit 2; }
@@ -433,6 +449,13 @@ pick_artifact() {
433
449
  if path_exists "$candidate"; then printf '%s' "$candidate"; else printf '%s' "$fallback"; fi
434
450
  }
435
451
 
452
+ # The glossary moved under docs/. Prefer the new home, and fall back to a legacy
453
+ # root file only when that file already exists — an existing config is never
454
+ # migrated, and a project with neither file gets the new default.
455
+ pick_concepts() {
456
+ pick_artifact docs/concepts.md "$(pick_artifact CONCEPTS.md docs/concepts.md)"
457
+ }
458
+
436
459
  # wt_script_reason VALUE — succeeds with the reason when a `worktrees.create|remove`
437
460
  # value has the wrong shape, fails when it is usable. One path, relative to the
438
461
  # project, no arguments: the script is the lifecycle, so a command line here would
@@ -490,7 +513,195 @@ fi
490
513
  PLANS="$(pick_artifact docs/plans docs/plans)"
491
514
  SOLUTIONS="$(pick_artifact docs/solutions docs/solutions)"
492
515
  HANDBOOKS="$(pick_artifact docs/handbooks docs/handbooks)"
493
- CONCEPTS="$(pick_artifact CONCEPTS.md CONCEPTS.md)"
516
+ CONCEPTS="$(pick_concepts)"
517
+ STRATEGY="$(pick_artifact docs/strategy.md docs/strategy.md)"
518
+
519
+ # --- AGENTS.md routing block ----------------------------------------------
520
+ # One shipped file, assets/agents-md.md, used two ways: the whole file when the
521
+ # project has none, and the marked block appended to an existing one. The
522
+ # version lives in the markers, so a later shipped version can replace an older
523
+ # block by exact marker match. Placeholders are rendered from the resolved
524
+ # artifacts.* paths, never hardcoded here.
525
+ AGENTS_ASSET="$SKILL_DIR/assets/agents-md.md"
526
+ # The marker grammar in one place, valid as grep ERE, sed BRE, and awk ERE.
527
+ AGENTS_OPEN_RE='^<!-- sassywares:skills v[0-9][0-9]* -->$'
528
+ AGENTS_CLOSE_RE='^<!-- /sassywares:skills v[0-9][0-9]* -->$'
529
+
530
+ agents_md_open_no() { grep -n -E "$AGENTS_OPEN_RE" "$1" 2>/dev/null | head -n 1 | cut -d: -f1; }
531
+ agents_md_close_no() { grep -n -E "$AGENTS_CLOSE_RE" "$1" 2>/dev/null | head -n 1 | cut -d: -f1; }
532
+ agents_md_version() { sed -n 's/^<!-- sassywares:skills v\([0-9][0-9]*\) -->$/\1/p' "$1" 2>/dev/null | head -n 1; }
533
+ agents_md_shipped_version() { agents_md_version "$AGENTS_ASSET"; }
534
+ agents_md_close_version() { sed -n 's/^<!-- \/sassywares:skills v\([0-9][0-9]*\) -->$/\1/p' "$1" 2>/dev/null | head -n 1; }
535
+
536
+ # agents_md_artifact KEY DEFAULT — the configured path, else the default this
537
+ # detector already resolved. Relative to the project root, like every artifact.
538
+ agents_md_artifact() {
539
+ local v
540
+ v="$(block_value artifacts "$1" 2>/dev/null || true)"
541
+ [[ -n "$v" ]] || v="$2"
542
+ printf '%s' "${v#./}"
543
+ }
544
+
545
+ # The shipped block, rendered, on stdout.
546
+ agents_md_render() {
547
+ local strategy concepts plans solutions handbooks
548
+ strategy="$(agents_md_artifact strategy "$STRATEGY")"
549
+ concepts="$(agents_md_artifact concepts "$CONCEPTS")"
550
+ plans="$(agents_md_artifact plans "$PLANS")"
551
+ solutions="$(agents_md_artifact solutions "$SOLUTIONS")"
552
+ handbooks="$(agents_md_artifact handbooks "$HANDBOOKS")"
553
+ # Values go through the environment, not -v: awk's -v interprets escape
554
+ # sequences, so a configured path with a backslash would lose it.
555
+ SASSY_AGENTS_STRATEGY="$strategy" SASSY_AGENTS_CONCEPTS="$concepts" \
556
+ SASSY_AGENTS_PLANS="$plans" SASSY_AGENTS_SOLUTIONS="$solutions" \
557
+ SASSY_AGENTS_HANDBOOKS="$handbooks" \
558
+ awk -v openre="$AGENTS_OPEN_RE" -v closere="$AGENTS_CLOSE_RE" '
559
+ # Splice a value literally: no regex replacement, so an & or a backslash in
560
+ # a configured path survives. Scanning resumes past the inserted value, so a
561
+ # value that itself contains the placeholder cannot loop.
562
+ function put(line, ph, val, i, from) {
563
+ from = 1
564
+ while ((i = index(substr(line, from), ph)) > 0) {
565
+ i = from + i - 1
566
+ line = substr(line, 1, i-1) val substr(line, i+length(ph))
567
+ from = i + length(val)
568
+ }
569
+ return line
570
+ }
571
+ BEGIN {
572
+ strategy = ENVIRON["SASSY_AGENTS_STRATEGY"]
573
+ concepts = ENVIRON["SASSY_AGENTS_CONCEPTS"]
574
+ plans = ENVIRON["SASSY_AGENTS_PLANS"]
575
+ solutions = ENVIRON["SASSY_AGENTS_SOLUTIONS"]
576
+ handbooks = ENVIRON["SASSY_AGENTS_HANDBOOKS"]
577
+ }
578
+ $0 ~ openre { f = 1 }
579
+ f {
580
+ line = $0
581
+ line = put(line, "{{artifacts.strategy}}", strategy)
582
+ line = put(line, "{{artifacts.concepts}}", concepts)
583
+ line = put(line, "{{artifacts.plans}}", plans)
584
+ line = put(line, "{{artifacts.solutions}}", solutions)
585
+ line = put(line, "{{artifacts.handbooks}}", handbooks)
586
+ print line
587
+ }
588
+ f && $0 ~ closere { exit }' "$AGENTS_ASSET"
589
+ }
590
+
591
+ # agents_md_block FILE — the block exactly as it sits in FILE, on stdout.
592
+ agents_md_block() {
593
+ awk -v openre="$AGENTS_OPEN_RE" -v closere="$AGENTS_CLOSE_RE" '
594
+ $0 ~ openre { f = 1 }
595
+ f { print }
596
+ f && $0 ~ closere { exit }' "$1"
597
+ }
598
+
599
+ # agents_md_plan — what --sync --write would do to AGENTS.md:
600
+ # create | append | replace | current | newer | unterminated | mismatch | unreadable
601
+ agents_md_plan() {
602
+ local target="$ROOT/AGENTS.md" open_no close_no v cv shipped
603
+ shipped="$(agents_md_shipped_version)"
604
+ [[ -n "$shipped" ]] || { printf 'unreadable'; return; }
605
+ [[ -f "$target" ]] || { printf 'create'; return; }
606
+ open_no="$(agents_md_open_no "$target")"
607
+ [[ -n "$open_no" ]] || { printf 'append'; return; }
608
+ close_no="$(agents_md_close_no "$target")"
609
+ if [[ -z "$close_no" ]] || (( close_no < open_no )); then printf 'unterminated'; return; fi
610
+ v="$(agents_md_version "$target")"
611
+ cv="$(agents_md_close_version "$target")"
612
+ [[ -n "$v" && "$v" == "$cv" ]] || { printf 'mismatch'; return; }
613
+ if (( 10#$v < 10#$shipped )); then printf 'replace'; return; fi
614
+ if (( 10#$v > 10#$shipped )); then printf 'newer'; return; fi
615
+ if diff -q <(agents_md_block "$target") <(agents_md_render) >/dev/null 2>&1; then
616
+ printf 'current'
617
+ else
618
+ printf 'replace'
619
+ fi
620
+ }
621
+
622
+ # agents_md_write ACTION RENDERED — the block is the only region touched. The
623
+ # file is replaced through a temp in the project root, so a failure never leaves
624
+ # a half-written AGENTS.md.
625
+ agents_md_write() {
626
+ local action="$1" rendered="$2" target="$ROOT/AGENTS.md" tmp mode rendered_file
627
+ case "$target" in "$ROOT"/*) ;; *) echo "sync: refusing to write outside the project root: $target" >&2; return 1 ;; esac
628
+ tmp="$(mktemp "$ROOT/.AGENTS.md.XXXXXX")" || return 1
629
+ case "$action" in
630
+ create)
631
+ printf '%s\n' "$rendered" > "$tmp"
632
+ ;;
633
+ append)
634
+ cat "$target" > "$tmp"
635
+ # Every byte the file already carried is kept; only a separator is added.
636
+ if [[ -n "$(tail -c 1 "$target")" ]]; then printf '\n' >> "$tmp"; fi
637
+ printf '\n%s\n' "$rendered" >> "$tmp"
638
+ ;;
639
+ replace)
640
+ # The rendered block is passed as a file, not -v: awk's -v would try to
641
+ # interpret the block's newlines and backslashes as escapes.
642
+ rendered_file="$(mktemp "${TMPDIR:-/tmp}/sassy-agents-block.XXXXXX")" || { rm -f "$tmp"; return 1; }
643
+ printf '%s\n' "$rendered" > "$rendered_file"
644
+ if ! awk -v openre="$AGENTS_OPEN_RE" -v closere="$AGENTS_CLOSE_RE" -v replf="$rendered_file" '
645
+ FILENAME == replf { a[++n] = $0; next }
646
+ $0 ~ openre { for (i = 1; i <= n; i++) print a[i]; skip = 1; next }
647
+ skip && $0 ~ closere { skip = 0; next }
648
+ !skip { print }
649
+ ' "$rendered_file" "$target" > "$tmp"; then
650
+ rm -f "$tmp" "$rendered_file"; return 1
651
+ fi
652
+ rm -f "$rendered_file"
653
+ ;;
654
+ *) rm -f "$tmp"; return 1 ;;
655
+ esac
656
+ if [[ -f "$target" ]]; then
657
+ mode="$(stat -f '%Lp' "$target" 2>/dev/null || stat -c '%a' "$target" 2>/dev/null || true)"
658
+ [[ -z "$mode" ]] || chmod "$mode" "$tmp" 2>/dev/null || true
659
+ fi
660
+ mv "$tmp" "$target"
661
+ }
662
+
663
+ # agents_md_sync DRY — create, append, or replace the block; a second run is a
664
+ # no-op that says so. DRY 1 only reports what a write would do.
665
+ agents_md_sync() {
666
+ local dry="$1" action shipped v
667
+ action="$(agents_md_plan)"
668
+ shipped="$(agents_md_shipped_version)"
669
+ case "$action" in
670
+ create|append|replace)
671
+ if (( dry )); then
672
+ case "$action" in
673
+ create) echo "sync: AGENTS.md would be created with routing block v${shipped} — nothing written; rerun with --sync --write" >&2 ;;
674
+ append) echo "sync: AGENTS.md would get routing block v${shipped} appended — nothing written; rerun with --sync --write" >&2 ;;
675
+ replace) echo "sync: AGENTS.md routing block would be replaced with v${shipped} — nothing written; rerun with --sync --write" >&2 ;;
676
+ esac
677
+ return 0
678
+ fi
679
+ agents_md_write "$action" "$(agents_md_render)" || { echo "sync: could not write AGENTS.md" >&2; return 1; }
680
+ case "$action" in
681
+ create) echo "sync: wrote AGENTS.md (routing block v${shipped} created)" >&2 ;;
682
+ append) echo "sync: wrote AGENTS.md (routing block v${shipped} appended)" >&2 ;;
683
+ replace) echo "sync: wrote AGENTS.md (routing block replaced with v${shipped})" >&2 ;;
684
+ esac
685
+ ;;
686
+ current)
687
+ echo "sync: AGENTS.md is already current" >&2
688
+ ;;
689
+ newer)
690
+ v="$(agents_md_version "$ROOT/AGENTS.md")"
691
+ echo "sync: AGENTS.md routing block is v${v}, newer than this skill ships (v${shipped}) — left alone" >&2
692
+ ;;
693
+ unterminated)
694
+ echo "sync: AGENTS.md has an opening sassywares:skills marker with no matching closing marker — fix it by hand, nothing written" >&2
695
+ ;;
696
+ mismatch)
697
+ echo "sync: AGENTS.md routing block markers disagree on the version — fix it by hand, nothing written" >&2
698
+ ;;
699
+ *)
700
+ echo "sync: no routing-block asset found — AGENTS.md untouched" >&2
701
+ ;;
702
+ esac
703
+ return 0
704
+ }
494
705
 
495
706
  MIRROR_REMOTE=""
496
707
  MIRROR_BRANCH="main"
@@ -529,10 +740,12 @@ leaf_ok() { # PATH VALUE — PATH joined with US, value comment- and quote-strip
529
740
  local path="$1" v="$2" key kind rest pat point entry name
530
741
  key="${path//$US/.}"
531
742
  case "$key" in
532
- artifacts.plans|artifacts.solutions|artifacts.handbooks|artifacts.concepts)
743
+ artifacts.plans|artifacts.solutions|artifacts.handbooks|artifacts.concepts|artifacts.strategy)
533
744
  case "$v" in ""|/*|~*|.|./) return 1 ;; esac
534
745
  escapes_root "$v" && return 1
535
- [[ "$key" == "artifacts.concepts" && "$v" == */ ]] && return 1
746
+ case "$key" in
747
+ artifacts.concepts|artifacts.strategy) [[ "$v" == */ ]] && return 1 ;;
748
+ esac
536
749
  return 0 ;;
537
750
  knowledge.read)
538
751
  case "$v" in \[*\]) ;; *) return 1 ;; esac
@@ -857,6 +1070,7 @@ kv plans "$PLANS" 34 '# sassy-plan writes plans here'
857
1070
  kv solutions "$SOLUTIONS" 34 '# sassy-compound writes learnings here'
858
1071
  kv handbooks "$HANDBOOKS" 34 '# sassy-docs writes handbooks here'
859
1072
  kv concepts "$CONCEPTS" 34 '# the glossary sassy-compound maintains (a file)'
1073
+ kv strategy "$STRATEGY" 34 '# the direction sassy-strategy writes (a file)'
860
1074
  cat <<EOF
861
1075
 
862
1076
  # --- Knowledge ------------------------------------------------------------
@@ -947,7 +1161,7 @@ cat <<'EOF'
947
1161
  # --- Commit ---------------------------------------------------------------
948
1162
  # current: commit on the checked-out branch, even on a base branch, then push
949
1163
  # it to its upstream. No PR: pr.* and hooks.pr are ignored; hooks.push runs.
950
- # new: never commit on a base branch — sassy-work, sassy-lfg, and sassy-debug
1164
+ # new: never commit on a base branch — sassy-work and sassy-debug
951
1165
  # cut a branch at the start of the run and stay on it.
952
1166
  commit:
953
1167
  EOF
@@ -1102,7 +1316,7 @@ if (( CHECK )); then
1102
1316
  [[ -n "$kpath" ]] || continue
1103
1317
  key="${kpath//$US/.}"
1104
1318
  case "$key" in
1105
- artifacts.plans|artifacts.solutions|artifacts.handbooks|artifacts.concepts) ;;
1319
+ artifacts.plans|artifacts.solutions|artifacts.handbooks|artifacts.concepts|artifacts.strategy) ;;
1106
1320
  knowledge.read|knowledge.write) ;;
1107
1321
  git.repo|git.remote|git.mirror_branch) ;;
1108
1322
  git.default_branch) ;; # has its own message below
@@ -1375,7 +1589,7 @@ if (( CHECK )); then
1375
1589
  # artifacts is the one block that fails closed everywhere it is read, so a
1376
1590
  # bad value here is drift, not a note: a typo must not write docs outside the
1377
1591
  # project. Existence is not drift — the directory is created on first write.
1378
- for key in plans solutions handbooks concepts; do
1592
+ for key in plans solutions handbooks concepts strategy; do
1379
1593
  val="$(block_value artifacts "$key" || true)"
1380
1594
  [[ -n "$val" ]] || continue
1381
1595
  case "$val" in
@@ -1384,8 +1598,8 @@ if (( CHECK )); then
1384
1598
  *)
1385
1599
  if escapes_root "$val"; then
1386
1600
  bad "artifacts.$key '$val' walks outside the project"
1387
- elif [[ "$key" == "concepts" && "$val" == */ ]]; then
1388
- bad "artifacts.concepts '$val' is a directory — concepts is one file"
1601
+ elif [[ "$val" == */ ]] && [[ "$key" == concepts || "$key" == strategy ]]; then
1602
+ bad "artifacts.$key '$val' is a directory — $key is one file (default docs/$key.md)"
1389
1603
  elif path_exists "$val"; then
1390
1604
  note " artifacts.$key: $val (exists)"
1391
1605
  else
@@ -1399,7 +1613,7 @@ if (( CHECK )); then
1399
1613
  # broken value has to be visible here: nothing else will ever complain.
1400
1614
  while IFS= read -r kline; do
1401
1615
  [[ -n "$kline" ]] || continue
1402
- bad "knowledge.read must be an inline list — write read: [docs/solutions, CONCEPTS.md]"
1616
+ bad "knowledge.read must be an inline list — write read: [docs/solutions, docs/concepts.md]"
1403
1617
  done < <(sed -n '/^knowledge:/,/^[a-z]/p' "$CONFIG" | grep -E '^[[:space:]]*-[[:space:]]' || true)
1404
1618
  readv="$(yflat "knowledge${US}read" || true)"
1405
1619
  while IFS= read -r kpath; do
@@ -1673,6 +1887,34 @@ if (( CHECK )); then
1673
1887
  fi
1674
1888
  fi
1675
1889
 
1890
+ # The routing block: AGENTS.md is what an agent reads before any skill is
1891
+ # invoked. A missing or stale block is a note, never drift — the config is
1892
+ # complete without it, and --sync --write is the updater.
1893
+ shipped_agents="$(agents_md_shipped_version)"
1894
+ case "$(agents_md_plan)" in
1895
+ create)
1896
+ note " agents-md: AGENTS.md is missing — --sync --write would create it with routing block v${shipped_agents}" ;;
1897
+ append)
1898
+ note " agents-md: AGENTS.md has no routing block — --sync --write would append v${shipped_agents}" ;;
1899
+ replace)
1900
+ agents_v="$(agents_md_version "$ROOT/AGENTS.md")"
1901
+ if [[ "$agents_v" == "$shipped_agents" ]]; then
1902
+ note " agents-md: routing block v${agents_v} differs from this skill's copy — --sync --write replaces it in place"
1903
+ else
1904
+ note " agents-md: routing block is v${agents_v}, this skill ships v${shipped_agents} — --sync --write replaces it in place"
1905
+ fi ;;
1906
+ current)
1907
+ note " agents-md: routing block v${shipped_agents}" ;;
1908
+ newer)
1909
+ note " agents-md: routing block is v$(agents_md_version "$ROOT/AGENTS.md"), newer than this skill ships (v${shipped_agents}) — left alone" ;;
1910
+ unterminated)
1911
+ note " agents-md: AGENTS.md has an opening sassywares:skills marker with no matching closing marker — fix it by hand" ;;
1912
+ mismatch)
1913
+ note " agents-md: AGENTS.md routing block markers disagree on the version — fix it by hand" ;;
1914
+ *)
1915
+ note " agents-md: routing-block asset not found — AGENTS.md unchecked" ;;
1916
+ esac
1917
+
1676
1918
  if (( drift )); then exit 1; fi
1677
1919
  note " config matches the tree"
1678
1920
  exit 0
@@ -1680,7 +1922,7 @@ fi
1680
1922
 
1681
1923
  # --- Branch decision -------------------------------------------------------
1682
1924
  # Read-only. Resolves commit.branch into the single decision the entry skills
1683
- # (sassy-work, sassy-lfg, sassy-debug) make before they start: cut a branch,
1925
+ # (sassy-work, sassy-debug) make before they start: cut a branch,
1684
1926
  # reuse the one checked out, or commit where you stand.
1685
1927
  #
1686
1928
  # Every base_map VALUE counts as a base branch, not just the remote default.
@@ -1882,27 +2124,36 @@ fi
1882
2124
  # says so.
1883
2125
  if (( SYNC )); then
1884
2126
  [[ -n "$CONFIG" ]] || { echo "no .sassywares/config.yaml found — run sassy-setup" >&2; exit 1; }
1885
- merged="$(merged_config)"
1886
- current="$(cat "$CONFIG")"
1887
- if [[ "$merged" == "$current" ]]; then
1888
- (( SINGLE )) || printf '%s\n' "$merged"
1889
- echo "sync: $CONFIG is already current" >&2
1890
- exit 0
1891
- fi
1892
- before="$(mktemp "${TMPDIR:-/tmp}/sassy-sync-before.XXXXXX")"
1893
- after="$(mktemp "${TMPDIR:-/tmp}/sassy-sync-after.XXXXXX")"
1894
- printf '%s\n' "$current" > "$before"
1895
- printf '%s\n' "$merged" > "$after"
1896
- changed="$(diff -u "$before" "$after" 2>/dev/null | awk '/^\+[^+]|^-[^-]/{n++} END{print n+0}' || true)"
1897
- rm -f "$before" "$after"
1898
- if (( SINGLE )); then
1899
- printf '%s\n' "$merged" > "$CONFIG"
1900
- echo "sync: wrote $CONFIG ($changed line(s) changed)" >&2
1901
- else
1902
- printf '%s\n' "$merged"
1903
- echo "sync: $CONFIG would change ($changed line(s)) — nothing written; rerun with --sync --write" >&2
2127
+ # --agents scopes the run to AGENTS.md: the config merge is skipped, not printed.
2128
+ if (( ! AGENTS_ONLY )); then
2129
+ merged="$(merged_config)"
2130
+ current="$(cat "$CONFIG")"
2131
+ if [[ "$merged" == "$current" ]]; then
2132
+ (( SINGLE )) || printf '%s\n' "$merged"
2133
+ echo "sync: $CONFIG is already current" >&2
2134
+ else
2135
+ before="$(mktemp "${TMPDIR:-/tmp}/sassy-sync-before.XXXXXX")"
2136
+ after="$(mktemp "${TMPDIR:-/tmp}/sassy-sync-after.XXXXXX")"
2137
+ printf '%s\n' "$current" > "$before"
2138
+ printf '%s\n' "$merged" > "$after"
2139
+ changed="$(diff -u "$before" "$after" 2>/dev/null | awk '/^\+[^+]|^-[^-]/{n++} END{print n+0}' || true)"
2140
+ rm -f "$before" "$after"
2141
+ if (( SINGLE )); then
2142
+ printf '%s\n' "$merged" > "$CONFIG"
2143
+ echo "sync: wrote $CONFIG ($changed line(s) changed)" >&2
2144
+ else
2145
+ printf '%s\n' "$merged"
2146
+ echo "sync: $CONFIG would change ($changed line(s)) — nothing written; rerun with --sync --write" >&2
2147
+ fi
2148
+ fi
1904
2149
  fi
1905
- exit 0
2150
+ # AGENTS.md is the second thing --sync owns. Its block is independent of the
2151
+ # config merge, so a run whose config is already current still refreshes it,
2152
+ # and an untouched project is a no-op that says so.
2153
+ if (( NO_AGENTS )); then
2154
+ echo "sync: AGENTS.md untouched (--no-agents)" >&2
2155
+ elif (( SINGLE )); then agents_md_sync 0; else agents_md_sync 1; fi
2156
+ exit $?
1906
2157
  fi
1907
2158
 
1908
2159
  emit_proposal
@@ -1,4 +1,7 @@
1
1
  ---
2
+ suite: sassy-skills
3
+ artifact: skill
4
+ generated_by: sassy-ship
2
5
  name: sassy-ship
3
6
  description: >-
4
7
  Close out approved work: capture learnings, bring the docs in line with the
@@ -32,11 +35,11 @@ What is being closed out is decided once, at the start, and every later step tak
32
35
 
33
36
  | Target | Detected by | Read | Writes back |
34
37
  |---|---|---|---|
35
- | Brief or topic | the argument is not a `.md` file under `artifacts.plans` | `references/brief.md` | nothing |
36
- | Plan | a plan file with no `slice`/`goal` frontmatter keys | `references/plan.md` | the plan's `status: done` |
38
+ | Brief or topic | the argument resolves to no plan under `artifacts.plans`, per the `sassy-setup` skill's `references/plan-resolution.md` | `references/brief.md` | nothing |
39
+ | Plan | a resolved plan with no `slice`/`goal` frontmatter keys | `references/plan.md` | the plan's `status: done` |
37
40
  | Slice | a plan whose frontmatter carries `slice` and `goal` | `references/slice.md` | `status: done`, and that slice → `Shipped` in the parent `goal.md` |
38
41
 
39
- The frontmatter keys are the answer; the directory convention — a plan sitting next to a `goal.md` — is only the fallback for a plan written before those keys existed. The caller never has to declare the target, and a `kind:` token is not a thing this skill accepts. Read exactly one of those three references, and only that one.
42
+ The frontmatter keys are the answer; the directory convention — a plan inside a goal folder — is only the fallback for a plan written before those keys existed. The caller never has to declare the target, and a `kind:` token is not a thing this skill accepts. Read exactly one of those three references, and only that one.
40
43
 
41
44
  **What a document target writes back.** The close-out sets the plan's `status: done` in the same edit that step 4 commits, so the status is part of that commit and lands in history beside the work it closes. It is written before the commit runs, so that commit carries it. A commit or snapshot that fails leaves the edit uncommitted on disk: report the failure, stop, and never report the plan as closed on a commit that did not land — the on-disk `done` is a leftover to be re-committed by the next run, not a state to trust. Ship is the sole writer of `done`, not of the key. It writes it only when every phase row in the plan's tracking table is `Done`: a mid-plan close-out — two phases shipped of five — leaves the plan `active`, which is the honest reading. The precondition comes from the table, never from the caller's say-so. A plan whose phases are all `Done` but which was never closed out therefore stays `active` until someone ships it, and the next `sassy-ship` closes it out.
42
45
 
@@ -50,7 +53,7 @@ The frontmatter keys are the answer; the directory convention — a plan sitting
50
53
  4. **Commit or snapshot.** After the review gate — never before it — the docs and any remaining code become durable.
51
54
 
52
55
  **Before anything is persisted, check the plan's `Auto` QA rows.** If the plan carries any and one is not `Done` from a passing `sassy-dogfood` report, stop here: report the outstanding rows, the report path, and what it would take to prove them. Ship never commits, pushes, or opens a PR behind an unproven automated row, and never runs the recipe itself — proving is `sassy-work`'s step, and re-running it here would let a red row reach a commit by being retried instead of fixed. A brief and a plan with only `Manual` rows skip this entirely.
53
- - **`git.repo` is a remote.** Dispatch a `worker`: *load the `sassy-commit` skill and follow it with `branch:current`*, naming that the commit must include the plan and its `status` change, any new solutions docs, the concepts file, `AGENTS.md`, and any doc step 3 wrote — resolved from `artifacts.*`, never hardcoded. The branch already exists: `sassy-work` or `sassy-lfg` cut it before the first change, so the docs belong on it with the phase commits. It returns the hash and subject.
56
+ - **`git.repo` is a remote.** Dispatch a `worker`: *load the `sassy-commit` skill and follow it with `branch:current`*, naming that the commit must include the plan and its `status` change, any new solutions docs, the concepts file, `AGENTS.md`, and any doc step 3 wrote — resolved from `artifacts.*`, never hardcoded. The branch already exists: `sassy-work` cut it before the first change, so the docs belong on it with the phase commits. It returns the hash and subject.
54
57
 
55
58
  **Ship never creates the branch.** Outside `commit.branch: current`, a head on a base branch with unpublished commits is a mis-run — `sassy-work` was supposed to cut before touching code. Ask the commit worker to return `state` and `unpublished` from the `sassy-setup` skill's `scripts/detect.sh --branch`, and stop and ask if they show a base with a non-zero count. Never relocate commits silently, never push to the base. Under `commit.branch: current` this check does not fire: unpublished commits on the head are simply pushed along with the close-out commit.
56
59
  - **`git.repo: workspace`.** Commit code inside each affected repo on the run's shared branch — cut once at the start of the run, `branch:current` from then on — then run `.sassywares/workspace/snapshot`. The snapshot is the workspace's commit and it runs every time, right after approval. A missing or outdated `.sassywares/workspace/snapshot` is a blocker: report it and say to run `sassy-setup`.
@@ -77,7 +80,7 @@ The frontmatter keys are the answer; the directory convention — a plan sitting
77
80
  | One target | The target is resolved once, from the plan's frontmatter, and its reference is the only one read. Never re-decide it mid-run, and never ask the caller to declare it. |
78
81
  | Never close out a draft | A `draft` plan is refused and sent back to `sassy-plan`. `done` is written only when every phase row is `Done`, in the step 4 edit so it is part of that commit. |
79
82
  | Docs in the commit | New docs and pointer lines ship in the same change. |
80
- | One branch | The branch is cut once, before the first change, by `sassy-work` or `sassy-lfg` (unless `commit.branch: current`). Ship and its docs commit land on it. |
83
+ | One branch | The branch is cut once, before the first change, by `sassy-work` (unless `commit.branch: current`). Ship and its docs commit land on it. |
81
84
  | Never create the branch | Ship never cuts a branch. Outside `commit.branch: current`, a head on a base branch with unpublished commits is a stop-and-ask, decided from the commit worker's `state` and `unpublished`. |
82
85
  | Never default | Never push directly to the repo base branch — except under `commit.branch: current`, an explicit opt-in, where ship pushes the checked-out branch (base or not) to its upstream, never forced. |
83
86
  | Current policy | `commit.branch: current` means commit + push, no PR: no `sassy-commit-push-pr`, no `hooks.pr.*`, no babysit, no merge; `hooks.push.after_push` still runs (step 5). A non-fast-forward push is a stop-and-report; in a workspace the push stops at the first rejected repo. |
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-ship
5
+ ---
6
+
1
7
  # Target: brief
2
8
 
3
9
  The argument is a topic or a settled brief, not a plan file. Nothing is written back: there is no document to close out. Writing one now — after the work, from memory — is exactly the plan the run deliberately did without.
@@ -1,6 +1,12 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-ship
5
+ ---
6
+
1
7
  # Target: plan
2
8
 
3
- A standalone plan — a file under `artifacts.plans` with no `slice` or `goal` key. The shared write-back rule is in the body: `status: done` goes in the step 4 edit, and only when every phase row in the tracking table is `Done`.
9
+ A standalone plan — a plan under `artifacts.plans` with no `slice` or `goal` key, resolved per the `sassy-setup` skill's `references/plan-resolution.md`. The shared write-back rule is in the body: `status: done` goes in the step 4 edit, and only when every phase row in the tracking table is `Done`.
4
10
 
5
11
  ## Gate summary lines
6
12
 
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-ship
5
+ ---
6
+
1
7
  # Target: slice
2
8
 
3
9
  A plan whose frontmatter carries `slice` (the slice ID) and `goal` (the path to the parent `goal.md`) — one slice of a `sassy-goal` goal. The goal itself is never closed here: `goal.md`'s `status: done` belongs to `sassy-goal mode:close` alone, after every slice has been checked.
@@ -1,4 +1,7 @@
1
1
  ---
2
+ suite: sassy-skills
3
+ artifact: skill
4
+ generated_by: sassy-simplify
2
5
  name: sassy-simplify
3
6
  description: >-
4
7
  Find behavior-preserving simplifications in changed code — reuse, quality,
@@ -1,4 +1,7 @@
1
1
  ---
2
+ suite: sassy-skills
3
+ artifact: skill
4
+ generated_by: sassy-skill
2
5
  name: sassy-skill
3
6
  description: >-
4
7
  Create, retune, or improve an Agent Skill for the user. Places it in the
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-skill
5
+ ---
6
+
1
7
  # Mode: create — write a new skill
2
8
 
3
9
  Read the skill's shared sections first (locations, Agent Skills rules, shape rule, checklist). This file is the write side only.
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-skill
5
+ ---
6
+
1
7
  # Mode: retune — the smallest fix for one named failure
2
8
 
3
9
  Read the skill's shared sections first (locations, Agent Skills rules, shape rule, checklist). This file is the failure map.
@@ -1,3 +1,9 @@
1
+ ---
2
+ suite: sassy-skills
3
+ artifact: reference
4
+ generated_by: sassy-skill
5
+ ---
6
+
1
7
  # Mode: verify — read, judge, report, change nothing
2
8
 
3
9
  Read the skill's shared sections first (locations, Agent Skills rules, shape rule, checklist). This file is the read-only sweep.