@sassywares/skills 0.14.0 → 0.15.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.
- package/README.md +20 -6
- package/package.json +1 -2
- package/skills/sassy-compound/SKILL.md +1 -1
- package/skills/sassy-compound/references/concepts.md +2 -2
- package/skills/sassy-docs/references/review.md +5 -2
- package/skills/sassy-goal/references/close.md +5 -4
- package/skills/sassy-goal/references/write.md +2 -0
- package/skills/sassy-plan/SKILL.md +1 -1
- package/skills/sassy-plan/references/interview.md +2 -2
- package/skills/sassy-setup/SKILL.md +19 -11
- package/skills/sassy-setup/assets/agents-md.md +71 -0
- package/skills/sassy-setup/assets/roster +1 -0
- package/skills/sassy-setup/references/anchors.md +122 -0
- package/skills/sassy-setup/references/check.md +14 -2
- package/skills/sassy-setup/references/config.md +11 -6
- package/skills/sassy-setup/references/init.md +4 -0
- package/skills/sassy-setup/references/workspace.md +23 -0
- package/skills/sassy-setup/scripts/detect.sh +280 -29
- package/skills/sassy-strategy/SKILL.md +66 -0
- package/skills/sassy-strategy/references/check.md +81 -0
- package/skills/sassy-strategy/references/strategy-format.md +84 -0
- package/skills/sassy-strategy/references/write.md +180 -0
- package/CONCEPTS.md +0 -178
|
@@ -51,9 +51,10 @@ artifacts:
|
|
|
51
51
|
plans: docs/plans
|
|
52
52
|
solutions: docs/solutions
|
|
53
53
|
handbooks: docs/handbooks
|
|
54
|
-
concepts:
|
|
54
|
+
concepts: docs/concepts.md
|
|
55
|
+
strategy: docs/strategy.md
|
|
55
56
|
knowledge:
|
|
56
|
-
read: [docs/solutions,
|
|
57
|
+
read: [docs/solutions, docs/concepts.md]
|
|
57
58
|
write: true
|
|
58
59
|
git:
|
|
59
60
|
repo: origin # <remote name> | workspace | none
|
|
@@ -102,8 +103,9 @@ dogfood:
|
|
|
102
103
|
| `artifacts.plans` | `docs/plans` | Where `sassy-plan` writes plans, and where `sassy-goal` keeps goal folders (`<type>-<slug>/goal.md` plus slice plans) |
|
|
103
104
|
| `artifacts.solutions` | `docs/solutions` | Where `sassy-compound` writes learnings |
|
|
104
105
|
| `artifacts.handbooks` | `docs/handbooks` | Where `sassy-docs` writes handbooks, and one of the document sets its review walks |
|
|
105
|
-
| `artifacts.concepts` | `
|
|
106
|
-
| `
|
|
106
|
+
| `artifacts.concepts` | `docs/concepts.md` | The glossary file compound maintains. When the config is silent and a root `CONCEPTS.md` exists, that root file is the glossary |
|
|
107
|
+
| `artifacts.strategy` | `docs/strategy.md` | The strategy file `sassy-strategy` writes and revises — where direction is decided. Absent is not drift: the file appears on the first write |
|
|
108
|
+
| `knowledge.read` | `[docs/solutions, docs/concepts.md]` | Paths scouted for prior learnings |
|
|
107
109
|
| `knowledge.write` | `true` | `false` = this project takes no learnings |
|
|
108
110
|
| `git.repo` | `origin` | Remote name, or a reserved value (below) |
|
|
109
111
|
| `git.base_map` | probed `"*"` | Head branch → the base it targets. `"*"` is required |
|
|
@@ -571,7 +573,8 @@ report layout, the verdict classes, and the lint are in
|
|
|
571
573
|
## Validation rules
|
|
572
574
|
|
|
573
575
|
- `artifacts.*` values are repo-relative directories (or one file for
|
|
574
|
-
`concepts`), must resolve inside the project, and must not be
|
|
576
|
+
`concepts` and `strategy`), must resolve inside the project, and must not be
|
|
577
|
+
the root itself.
|
|
575
578
|
- `git.repo` is `workspace`, `none`, or one existing remote name.
|
|
576
579
|
- `git.remote` is required when `git.repo: workspace`; forbidden otherwise.
|
|
577
580
|
`git.mirror_branch` and `repos` are workspace-only too.
|
|
@@ -626,4 +629,6 @@ note, never as drift; [`check.md`](check.md) has the outcomes. The merge that
|
|
|
626
629
|
closes it is `detect.sh --root <path> --sync --write`: it keeps every leaf the
|
|
627
630
|
check accepts, value and same-line trailing comment byte for byte, and takes the
|
|
628
631
|
rest from the template, so a comment carries the project's confirmation forward
|
|
629
|
-
and a malformed value is replaced.
|
|
632
|
+
and a malformed value is replaced. The same command also creates, appends, or
|
|
633
|
+
replaces the `AGENTS.md` routing block; `--no-agents` scopes it to this config,
|
|
634
|
+
and `--agents` to the block alone.
|
|
@@ -19,6 +19,7 @@ Never re-ask what the tree already said.
|
|
|
19
19
|
- **`workspace`** — the snapshot mirror: create a **private** GitHub repo, or connect an existing one? Creating it needs explicit approval and a named slug first.
|
|
20
20
|
- **`none`** — confirm the intent: this folder is deliberately outside git, so commit, PR, and babysit refuse here.
|
|
21
21
|
- **Artifacts** — offer the detected paths as the default; take overrides.
|
|
22
|
+
- **Strategy** — offer to run the strategy interview in this same run, the way the dogfood bullet offers `mode:discover`. Say what the file is for: the one document that says what the product is for, who it is for, and what it refuses, read where direction is decided and written only by `sassy-strategy`. Yes means dispatch `sassy-strategy` now, in its own run; no means hand over `/sassy-strategy` and say the project is wired either way. **Never author a word of the interview yourself** — the model, the questions, the six sections, and the `draft`→`active` read-back are `sassy-strategy`'s alone. See the `sassy-setup` skill's [`anchors.md`](anchors.md) for where the file lives and why an absent one is not a failure.
|
|
22
23
|
- **Knowledge** — `knowledge.read` defaults to the solutions dir plus the concepts file. Ask whether there are extra folders to read (a hand-written `notes/learnings/`, a `docs/adr/`).
|
|
23
24
|
- **Base map** — detection proposes `"*"` from the probed remote default. Ask where ordinary work branches from, and whether the default branch itself releases to another branch (a `staging: main` rung). Never write `main` as a guess. In `workspace` mode, show the `repos` map and get a yes on every row — a probed base is only the remote's default.
|
|
24
25
|
- **`commit.branch`** — default `new`: the run cuts a branch before the first change and never commits on a base branch. Offer `current` for a repo that genuinely wants work committed where it stands, and say plainly that `current` lets a run commit onto its base branch and push it, with no PR (`pr.*` and `hooks.pr` are ignored; `hooks.push` runs), and that a later `sassy-ship` run in `mode:auto` will then push to that base with no gate.
|
|
@@ -50,6 +51,7 @@ Both install the same way: report the scope if the pieces are present, otherwise
|
|
|
50
51
|
**Do not wire updates.** How and when the suite is refreshed is the user's or the project's decision, not setup's: no `skills:*` scripts, no `postinstall` edit. Mention the update command for the chosen scope and stop there. Note for yourself that `npx skills check` is an alias of `update` — it is not a validator, and running it here would silently move the pin.
|
|
51
52
|
|
|
52
53
|
- **Write `.sassywares/README.md`** from `assets/sassywares-readme.md` when absent. Never overwrite it — it may carry project notes.
|
|
54
|
+
- **Write the routing block into `AGENTS.md`.** It is the shipped `assets/agents-md.md`, written through `detect.sh --sync --write`, which renders the block's five `{{artifacts.*}}` placeholders — `strategy`, `concepts`, `plans`, `solutions`, `handbooks` — from the config step 4 wrote, never from the defaults the asset happens to carry. The file's own state picks the shape: no `AGENTS.md` means the whole template, and an `AGENTS.md` that already exists means the marked block alone — `<!-- sassywares:skills v1 -->` … — appended after its last line. The anchors are named whether or not they exist yet: the strategy route always appears, with `sassy-strategy` named as the command that writes one, because a route to a file that is not there yet is better than an agent that never learns the file exists. It is idempotent: an identical block is left alone and reported as already current. **Any difference is a diff and a question** — an older marker version, a hand-edited row, a block that no longer matches the config — run the sync without `--write` to see the action, show the diff, and write only on a yes; a no leaves every byte as it was, and any config fix then goes through `detect.sh --sync --write --no-agents`, which leaves the block untouched until the user asks for it. Only the bytes between the markers are ever written: the file's own lines are never rewritten, and `CLAUDE.md` and any per-harness agent file are never touched. In `workspace` topology the block goes to the root always and to a nested repo only where one already exists — read `references/workspace.md`; in `none` it lands at the root and is committed by nothing, by design.
|
|
53
55
|
- **Agents.** The skills dispatch five subagents by name — `scout`, `worker`, `reviewer`, `simplifier`, `validator` — from [`sassy-agents`](https://github.com/sassywares/sassy-agents), which keeps one folder per harness. Use the row for the harness you are running in:
|
|
54
56
|
|
|
55
57
|
| Harness | sassy-agents folder | User scope | Project scope |
|
|
@@ -99,7 +101,9 @@ Then return to `SKILL.md` for steps 7–9.
|
|
|
99
101
|
| Approval to create a remote | Creating the mirror repo needs an explicit yes and a named slug first. |
|
|
100
102
|
| Comments are part of the file | Every key keeps its description and allowed values. A stripped config is an incomplete config. |
|
|
101
103
|
| Hooks are named, not written | Setup records hook skill names. Creating those skills is the project's work. |
|
|
104
|
+
| The block is never a rewrite | `AGENTS.md` gets the marked block and nothing else. An existing file's own lines are never touched, a differing block is shown as a diff and asked about, and `CLAUDE.md` is never written. |
|
|
102
105
|
| Dogfood is a pointer | The block names a recipe, a reports path, a timeout, and whether Auto rows are allowed — four keys. Never a command and never a tool: a copied command duplicates the manifest and cannot express step order. |
|
|
106
|
+
| The strategy is offered, never authored | Setup names `sassy-strategy` and offers the interview. Every question, section, and status flip belongs to that skill's own run: a setup run that drafts a line has written an anchor nobody grilled. |
|
|
103
107
|
| The recipe is the project's | Setup scaffolds the skeleton and stops. Authoring or "fixing" a procedure is `sassy-dogfood mode:discover`'s job, and a run may never edit the recipe to make its own failure pass. |
|
|
104
108
|
| Worktrees need `new` | `worktrees.enabled: true` with `commit.branch: current` is refused, not written: nothing cuts a branch there, so the switch could never fire. |
|
|
105
109
|
| Stubs are inert | The interview writes labelled comments in the scaffolding slots, never executable code: an untouched pair behaves exactly like the git-only baseline. |
|
|
@@ -38,6 +38,29 @@ lives under one directory:
|
|
|
38
38
|
- Do **not** run the snapshot during setup. It clones and pushes; that is the
|
|
39
39
|
user's call. Offer `--dry-run` and run it only if they ask.
|
|
40
40
|
|
|
41
|
+
## The routing block
|
|
42
|
+
|
|
43
|
+
A workspace has one config, so it has one set of `artifacts.*` paths and one routing
|
|
44
|
+
block, and both belong to the root that holds `.sassywares/`. Render it from the
|
|
45
|
+
shipped `assets/agents-md.md` exactly as `references/init.md` step 5 says — resolved
|
|
46
|
+
paths, anchors named with the absent note, idempotent, a difference shown as a diff
|
|
47
|
+
and asked about. Where it goes is the one place a workspace differs:
|
|
48
|
+
|
|
49
|
+
- **The workspace root, always.** The root's `AGENTS.md` gets the block — the whole
|
|
50
|
+
template when there is none, the marked block appended when there is.
|
|
51
|
+
- **A nested repo, only when that repo already keeps an `AGENTS.md`.** The agent
|
|
52
|
+
working inside a repo reads that repo's file, not the root's, so a repo that has
|
|
53
|
+
one gets the same block appended. **Never invent an `AGENTS.md` in a repo that
|
|
54
|
+
never kept one**: a file created only to hold a block is a second document the
|
|
55
|
+
project maintains and the next reader has to explain, and a repo with none was
|
|
56
|
+
never an agent's entry point here.
|
|
57
|
+
- **The report names both lists** — the files written or appended, and the nested
|
|
58
|
+
repos skipped because they have no `AGENTS.md`. A skipped repo is not a gap.
|
|
59
|
+
- **Nothing is committed.** The root is not a repo, so the root block rides the next
|
|
60
|
+
`snapshot` with the rest of the glue. A nested repo's `AGENTS.md` is that repo's
|
|
61
|
+
own file: setup leaves it uncommitted, says so in the report, and never sweeps it
|
|
62
|
+
into a sync.
|
|
63
|
+
|
|
41
64
|
## Script aliases (optional)
|
|
42
65
|
|
|
43
66
|
The scripts are executable and tracked, so the whole contract is the path itself:
|
|
@@ -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="$(
|
|
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
|
-
|
|
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 ------------------------------------------------------------
|
|
@@ -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 [[ "$
|
|
1388
|
-
bad "artifacts
|
|
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,
|
|
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
|
|
@@ -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
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
(
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
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
|
-
|
|
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
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sassy-strategy
|
|
3
|
+
description: >-
|
|
4
|
+
Write and revise a project's strategy — what the product is for, who it is for,
|
|
5
|
+
and what it refuses — and judge whether work fits it. mode:write (default)
|
|
6
|
+
grounds in the repo, shows a model to correct, interviews with pushback,
|
|
7
|
+
stress-tests three to five metrics, and writes the strategy file one section at
|
|
8
|
+
a time; mode:check gives a read-only fit verdict on a plan, goal, proposal, or
|
|
9
|
+
diff and never writes. Use when asked for direction, positioning, what this
|
|
10
|
+
product is for, to write or revise a strategy, or whether a piece of work is on
|
|
11
|
+
strategy.
|
|
12
|
+
argument-hint: "[mode:write|check] [doc path] [section]"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Sassy Strategy
|
|
16
|
+
|
|
17
|
+
**Outcome:** one settled strategy document at the configured path — Purpose, Positioning, Users, Boundaries, Key metrics, Tracks — that a reader can take in under five minutes; and, in `mode:check`, a read-only verdict on whether a plan, goal, proposal, or diff fits it.
|
|
18
|
+
|
|
19
|
+
**The strategy is a question, never a veto.** A boundary it states changes what a run asks before it starts, and nothing a run does. The answer is always the user's.
|
|
20
|
+
|
|
21
|
+
**Direction only.** No roadmap, no dates, no feature list, no backlog, no status. A strategy that lists what is next has stopped being a strategy and become a plan that nothing owns.
|
|
22
|
+
|
|
23
|
+
**Config.** Resolve `.sassywares/config.yaml` (nearest, walking up) per the `sassy-setup` skill's `references/config.md`. The file's path is `artifacts.strategy` — never assume `docs/strategy.md`, and never hardcode a path. The shared anchor rules — what counts as a conflict, the three outs, the override record, and the `draft` rule — live in the `sassy-setup` skill's `references/anchors.md`; read it before offering an out.
|
|
24
|
+
|
|
25
|
+
**Harness.** Loading another skill, dispatching an agent, and any command you hand the user follow the `sassy-setup` skill's `references/harness.md`. Read it once per run, before the first of those.
|
|
26
|
+
|
|
27
|
+
## Modes
|
|
28
|
+
|
|
29
|
+
| Mode | Load | Runs | It ends with |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| `write` (default) | `references/write.md`, plus `references/strategy-format.md` for the format contract | no strategy on file, or a revision | the file written, or one section revised, `status: active` only after the read-back |
|
|
32
|
+
| `check` | `references/check.md`, plus `references/strategy-format.md` when it quotes the file | a plan, goal, proposal, or diff to test against the strategy | a verdict quoting the strategy line, and no file touched |
|
|
33
|
+
|
|
34
|
+
Resolve the mode: an explicit `mode:` token wins. With none, a question about whether something fits — "is this on strategy", "does this match the strategy" — is `check`; anything else is `write`. Read the one **mode** reference for that mode **and only that one** — `references/strategy-format.md` is the format contract, not a mode reference, and it comes with any run that writes, revises, or quotes the file.
|
|
35
|
+
|
|
36
|
+
`references/strategy-format.md` owns the six canonical section names, their locked order, the frontmatter, and the `draft`→`active` rule.
|
|
37
|
+
|
|
38
|
+
## Routing a `write` run
|
|
39
|
+
|
|
40
|
+
| The argument | It is |
|
|
41
|
+
|---|---|
|
|
42
|
+
| no file at `artifacts.strategy` | a new strategy — `write.md`, from the top |
|
|
43
|
+
| a file, no section | a revision, entered at the bare-invocation step in `write.md` |
|
|
44
|
+
| a section, with or without a doc path | a section revision — the section-argument contract in `write.md` |
|
|
45
|
+
| anything else after the path | a usage error: name the six canonical sections and stop |
|
|
46
|
+
|
|
47
|
+
A section name matches **case-insensitively against the six canonical headings and nothing else**; any other word is a usage error.
|
|
48
|
+
|
|
49
|
+
## Hard rules
|
|
50
|
+
|
|
51
|
+
| Rule | Requirement |
|
|
52
|
+
|------|-------------|
|
|
53
|
+
| Never a veto | A conflict is quoted from the file, then three outs are offered. No run blocks on the strategy, and no agent picks an out for the user. |
|
|
54
|
+
| Direction only | Nothing in the file schedules, lists, or tracks work. A date, a roadmap row, or a feature list is removed on sight. |
|
|
55
|
+
| One section at a time | A revision reopens exactly one canonical section and leaves every other byte of the file alone. |
|
|
56
|
+
| Grounded | Every user, metric, boundary, and product claim comes from the repo or from the user, with one exception: the model you show them before the interview, labelled as a guess. Never invent a command, a number, or a metric's source. |
|
|
57
|
+
| Draft is not settled | A `status: draft` strategy is reported as unsettled and never enforced — not by this skill, and not by a reader. |
|
|
58
|
+
| Five-minute read | If the file no longer reads inside five minutes, cut it. Detail belongs in the plan that the strategy guided. |
|
|
59
|
+
| Write boundary | `artifacts.strategy` (creating its directory when needed) and, only when no `README.md` exists at the project root, the seeded `README.md`. Nothing else: never `AGENTS.md`, plans, code, or an existing README. |
|
|
60
|
+
|
|
61
|
+
## Workflow
|
|
62
|
+
|
|
63
|
+
1. **Resolve the path.** `artifacts.strategy` from the config, or the doc path the user named. A path outside the project is a usage error — the strategy is the project's, not a machine's.
|
|
64
|
+
2. **Resolve the mode and the entry point** from the routing table above, and read that one reference. `references/strategy-format.md` comes with any run that touches the file's bytes.
|
|
65
|
+
3. **Do the run** the reference lays out.
|
|
66
|
+
4. **Report** in the reference's shape: the path, what changed, `status`, and what is not settled — plus, after a `write`, the one command that revises a section.
|