@sabaiway/agent-workflow-kit 1.30.0 → 1.32.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/CHANGELOG.md +75 -0
- package/README.md +5 -2
- package/SKILL.md +31 -551
- package/capability.json +1 -1
- package/launchers/windsurf-workflow.md +4 -2
- package/package.json +1 -1
- package/references/hooks/gate-approve.mjs +13 -0
- package/references/modes/agents.md +11 -0
- package/references/modes/backends.md +9 -0
- package/references/modes/bootstrap.md +49 -0
- package/references/modes/gates.md +17 -0
- package/references/modes/grounding.md +12 -0
- package/references/modes/help.md +7 -0
- package/references/modes/hook.md +24 -0
- package/references/modes/procedures.md +18 -0
- package/references/modes/recipes.md +18 -0
- package/references/modes/review-state.md +13 -0
- package/references/modes/set-recipe.md +24 -0
- package/references/modes/setup.md +30 -0
- package/references/modes/status.md +22 -0
- package/references/modes/uninstall.md +18 -0
- package/references/modes/upgrade.md +46 -0
- package/references/modes/velocity.md +33 -0
- package/references/shared/composition-handoff.md +39 -0
- package/references/shared/deploy-tail.md +61 -0
- package/references/shared/report-footer.md +116 -0
- package/tools/engine-source.mjs +2 -1
- package/tools/velocity-profile.mjs +253 -32
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
## Gotchas
|
|
2
|
+
|
|
3
|
+
The non-obvious traps — scan these before bootstrapping or upgrading. Each is also enforced inline in the bootstrap/upgrade procedures (`${CLAUDE_SKILL_DIR}/references/modes/bootstrap.md`, `${CLAUDE_SKILL_DIR}/references/modes/upgrade.md`); this is the consolidated high-signal list.
|
|
4
|
+
|
|
5
|
+
- **Source vs target directory.** Templates and scripts are read from the skill's own dir (`${CLAUDE_SKILL_DIR}/` in Claude Code, the `SKILL.md` folder elsewhere). The **working directory is the target project** — never write kernel files back into the skill.
|
|
6
|
+
- **The `Co-Authored-By` trailer is added by the harness, not by prose.** When attribution is `off`, a doc directive alone won't stop it — for Claude Code you **must** also set `"includeCoAuthoredBy": false` in the project's `.claude/settings.json` (create it if absent). Other tools: disable their equivalent co-author/footer setting.
|
|
7
|
+
- **Hidden mode must never touch `package.json`.** Editing it is a *tracked* change and leaks the whole system. Hidden mode wires nothing into `package.json`; the pre-commit hook (untracked in `.git/hooks/`) calls `node scripts/<x>.mjs` directly. After hiding, **verify `git status` shows the artifacts as ignored**.
|
|
8
|
+
- **Hidden mode is project-local, and the hide tool owns the known footprint.** `tools/hide-footprint.mjs` writes **one managed block** in the **project-local `.git/info/exclude`** — never the machine-global `core.excludesFile` (which would silently affect every repo on the host; **AD-014** amends **AD-006**). It hides the kit's own artifacts **and** the known external AI/agent footprint (the `KNOWN_FOOTPRINT` table in [contracts](${CLAUDE_SKILL_DIR}/references/contracts.md#visibility-contract)). A **tracked** file is **never silently un-tracked** — the tool prints the `git rm --cached` it will not run. Never leak its internal marker / asks terms to the user; translate every outcome to plain language.
|
|
9
|
+
- **`CLAUDE.md` is a symlink, not a copy.** `ln -s AGENTS.md CLAUDE.md` — single source, no duplication. A copy drifts; a symlink can't.
|
|
10
|
+
- **Never overwrite an existing entry point or hook.** If `AGENTS.md` / `CLAUDE.md` already exist, or the installer reports a pre-existing non-marker git hook, **stop and ask** the user to merge vs replace — don't clobber.
|
|
11
|
+
- **Unrecognized invocations are read-only.** Only a **known** subcommand reaches its mode; the **bare** invocation bootstraps (and an existing `docs/ai/` makes it ask upgrade-vs-bootstrap first, never overwrite); **any other / ambiguous** token routes to `help` (read-only). A garbage invocation never writes. The mapping is pinned by `tools/commands.mjs` `routeInvocation` (unit-tested) — don't hand-route around it.
|
|
12
|
+
- **No Node runtime → skip enforcement.** If the project has no Node (recon step 1), skip bootstrap steps 8–9 (scripts + hook) and follow the cap/archive/index policy manually, or port the scripts to the project's language.
|
|
13
|
+
- **Conversational language never translates artifacts.** It governs *dialogue only*. Code, identifiers, paths, commands, log output, abbreviations, and every deployed `docs/ai/` / `AGENTS.md` file stay in their source language. See [Communication contract](${CLAUDE_SKILL_DIR}/references/contracts.md#communication-contract).
|
|
14
|
+
- **Never auto-commit.** Report quality-gate results and wait for explicit approval — in both modes.
|
|
15
|
+
- **Never leak kit internals to the user.** No ADR ids, tool / function / operation names (`reconcile`, `inject`, `ensureSlot`), marker / slot / fragment / anchor terminology, or verbatim tool stderr in anything the user reads. Translate every tool outcome into plain language a third-party user — who has never read this `SKILL.md` — can understand and act on (e.g. the cap-refusal report in `${CLAUDE_SKILL_DIR}/references/modes/upgrade.md` step 3).
|
|
16
|
+
- **Uninstall never deletes user-authored content, and dry-runs first.** `/agent-workflow-kit uninstall` removes only what is **provably ours** (a managed skill dir / wrapper symlink / fenced block / marker hook) and **prints — never runs** the `rm` / `git rm --cached` for `docs/ai` and the entry-point docs, and an **edit** instruction (not an `rm`) for `.claude/settings.json`. Always run `--dry-run` first, show the plan, get consent, then `--yes`. A skill dir or symlink that is not provably ours is a STOP, never a clobber (the `setup` posture, inverted). Removing a shared global (memory/engine/a bridge) may affect another project — say so.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Setup contracts
|
|
21
|
+
|
|
22
|
+
The three setup choices — **visibility** (step 2), **conversational language** (step 3), and **agent attribution** (step 4) — each have a full contract in [`references/contracts.md`](${CLAUDE_SKILL_DIR}/references/contracts.md). Load it when you need the complete rule (e.g. while filling the matching `AGENTS.md` block, or when an `upgrade` migration touches one). Defaults, in brief: visibility = `visible` (committed); language = whatever the user is already writing in; attribution = `off`. Ask each as a structured multiple-choice prompt where supported (`AskUserQuestion` in Claude Code), otherwise in prose.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## System principles (encode these into the project's `AGENTS.md`)
|
|
27
|
+
|
|
28
|
+
1. **Single entry point.** `AGENTS.md` is the only entry point (tool aliases like `CLAUDE.md` symlink to it); it never bloats — details live in `docs/ai/`.
|
|
29
|
+
2. **Memory Map.** A "read-when / update-when" table for every file. Without it agents get lost.
|
|
30
|
+
3. **Three protocols.** Start of Session → During Work → Task Completion, each a short checklist.
|
|
31
|
+
4. **Update docs BEFORE code.** Page behaviour changing? Update `pages/<page>.md` first, then the code.
|
|
32
|
+
5. **No silent failures.** Every internal validation/guard that rejects an action logs structured context (component, action, ids, inputs); user-facing failures also surface in the UI.
|
|
33
|
+
6. **TDD by default.** Test before code (unit for functions, E2E for user flows).
|
|
34
|
+
7. **ADR for strategic choices.** Long-term-consequence decisions get a `decisions.md` entry.
|
|
35
|
+
8. **Hard Constraints are tool-enforced.** Style rules live in linter/type-checker configs, not prose.
|
|
36
|
+
9. **Ask before commit.** The agent reports quality-gate results and waits for explicit approval; it never auto-commits.
|
|
37
|
+
10. **Honest `known_issues.md`.** Every bug with a workaround gets Impact + Plan so it isn't re-discovered later.
|
|
38
|
+
11. **One conversational language.** Talk to the user in the language chosen at bootstrap; keep code, paths, commands, and abbreviations in their source language. See *Communication contract*.
|
|
39
|
+
12. **Attribution is opt-in.** Honour the *Attribution* block: by default no agent/AI/model mention anywhere (commits, PRs, code, comments, docs), and no `Co-Authored-By` trailer. See *Attribution contract*.
|
|
40
|
+
13. **Orchestrate via a named recipe.** Compose execution through a named recipe (Solo / Reviewed / Council / Delegated) and **always commit yourself** — backends are advisory or delegated, never autonomous. Encoded via the reconciled `workflow:orchestration` pointer (it routes to `/agent-workflow-kit recipes` + the engine canon), not by bloating the entry point.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Hard Constraints (template — adapt to the stack)
|
|
45
|
+
|
|
46
|
+
Deploy these into `AGENTS.md`; remove rows that don't apply to the stack.
|
|
47
|
+
|
|
48
|
+
| Rule | Enforcement |
|
|
49
|
+
|------|-------------|
|
|
50
|
+
| No `export default` (named exports only) | Linter |
|
|
51
|
+
| No `any` / no unsafe casts | Linter / type-checker |
|
|
52
|
+
| Functional style (no mutation in app code) | Linter |
|
|
53
|
+
| No single-letter variables | Code review |
|
|
54
|
+
| Interactive elements semantic (button/link, not div+onClick) | Linter / a11y |
|
|
55
|
+
| No hardcoded colors — design tokens only | Code review |
|
|
56
|
+
| No business logic in components → hooks/services | Architecture review |
|
|
57
|
+
| No changes without tests (TDD) | Required |
|
|
58
|
+
| Check page docs before changes; update them after | Process |
|
|
59
|
+
| Ask user before committing | Process |
|
|
60
|
+
| Every page has an HTML-validity / a11y E2E test | Required |
|
|
61
|
+
| **No silent failures** — structured logging on every rejected action | Required |
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
### The one-line backend-status line (shared by bootstrap + upgrade)
|
|
2
|
+
|
|
3
|
+
Bootstrap (step 11) and **every** successful `upgrade` exit (steps 4 + 8) print the **same**
|
|
4
|
+
read-only, one-line summary of the optional execution-backends. The line is **machine-composed** —
|
|
5
|
+
run the status-line composer and **paste its single emitted line verbatim**:
|
|
6
|
+
`node ${CLAUDE_SKILL_DIR}/tools/recipes.mjs --status-line`
|
|
7
|
+
The tool runs the backend detector and appends the recipe recommendation itself
|
|
8
|
+
(`composeStatusLine`); the agent **composes nothing factual** — no readiness token, no glyph, no
|
|
9
|
+
recipe clause of its own, ever.
|
|
10
|
+
|
|
11
|
+
- **Placeholder template (structure only — never copy this example; paste the tool's line):**
|
|
12
|
+
`backends: <alias> <✓|✗> <readiness> · <alias> <✓|✗> <readiness> — run /agent-workflow-kit backends · recipes: <recommendation clause> — see /agent-workflow-kit recipes`
|
|
13
|
+
- The **`recipes:` clause is appended after** the `— run /agent-workflow-kit backends` pointer (never
|
|
14
|
+
replacing it) and routes to the read-only `recipes` mode (`see /agent-workflow-kit recipes`). It is
|
|
15
|
+
**never blank**: both backends ready → *"Council available, Reviewed the everyday default"*; one
|
|
16
|
+
ready → *"Reviewed available (via …)"*; **none installed → *"Solo — run /agent-workflow-kit setup to
|
|
17
|
+
add a backend"***; a backend present-but-not-ready → Solo with that backend's specific remedy.
|
|
18
|
+
(Composed by `recommendRecipe` inside the same tool run — never by the agent.)
|
|
19
|
+
- **Invariants:** **read-only · never blocks the commit gate · never runs a subscription CLI · the
|
|
20
|
+
pointer is the in-agent `backends` mode, never a network fetch · the appended `recipes:` clause
|
|
21
|
+
routes to the in-agent `recipes` mode the same way · `init`/npx never *places* bridges (it
|
|
22
|
+
refreshes only what `setup` already placed, AD-011 §5).**
|
|
23
|
+
- **Composer unavailable → skip with a stated reason, never silently.** The composer is a Node script
|
|
24
|
+
the **agent host** runs (not the target project), so the only skip condition is "**the agent host
|
|
25
|
+
can't run it**" — `node` is not on the agent's PATH, or the tool itself errors — **not** "the
|
|
26
|
+
project has no Node runtime". On that condition, skip the line and say so **with the concrete
|
|
27
|
+
reason**, e.g. *"Couldn't run the backend status-line composer here (node is not on the agent host
|
|
28
|
+
PATH), so I'm skipping the backend-status line."* — never a silent skip (Hard Constraint — no
|
|
29
|
+
silent failures).
|
|
30
|
+
|
|
31
|
+
### The version block + welcome mat (shared by bootstrap + upgrade)
|
|
32
|
+
|
|
33
|
+
Bootstrap (step 11) and **every** successful `upgrade` exit (steps 4 + 8) close with the same
|
|
34
|
+
**report footer**, in this **canonical order**: success state → **version block** → the **one-line
|
|
35
|
+
backend-status line** → **welcome mat**. Only the version block comes from
|
|
36
|
+
`node ${CLAUDE_SKILL_DIR}/tools/family-registry.mjs --json` (add `--dir <project>` for the deploy
|
|
37
|
+
axis) — **never hardcoded semver**; the backend-status line is its own shared contract (above), and
|
|
38
|
+
the welcome mat **composes signals already gathered** (the version block's notes + the backend-status
|
|
39
|
+
line), not a fresh helper call. **Beside the backend-status line**, when the target project carries a
|
|
40
|
+
`docs/ai/orchestration.json`, also paste the one-line **configured-recipe line** verbatim from
|
|
41
|
+
`node ${CLAUDE_SKILL_DIR}/tools/recipes.mjs --active-line` (run from the project root; `${CLAUDE_SKILL_DIR}/references/modes/recipes.md`
|
|
42
|
+
documents it; same agent-host skip-with-reason contract as the status line). Present everything in the
|
|
43
|
+
user's conversational language; never paste the JSON or any internal field name.
|
|
44
|
+
|
|
45
|
+
**Success state — the happy path never leads with a structure number.** No happy-path report surfaces
|
|
46
|
+
the project's internal `docs/ai` structure version, the stamp filename, or the internal versioning
|
|
47
|
+
vocabulary — that number is inert here and only confuses; it belongs to *Version disclosure* (below).
|
|
48
|
+
Frame the success itself plainly, in the **user's conversational language** (never hardcode a phrase):
|
|
49
|
+
- a **zero-diff no-op `upgrade`** (step 4) → **settings already current — no update is required**
|
|
50
|
+
(illustrative tone for a Russian-speaking user, an example of the meaning, not a literal string to
|
|
51
|
+
embed: *«Настройки уже актуальны — обновление не требуется»*);
|
|
52
|
+
- a **fresh `bootstrap`** → its normal "deployed and ready" success, minus the number.
|
|
53
|
+
|
|
54
|
+
**Version block — the installed package versions, fed from `--json`** (the `docs/ai` structure version
|
|
55
|
+
is shown on demand only — see *Version disclosure* below, **not** here):
|
|
56
|
+
- **`Installed on this machine — package versions:`** `kit <v> · memory <v> · engine <v> ·
|
|
57
|
+
codex-bridge <v> · antigravity-bridge <v>` — one per `installed[]` entry, labelled by its `display`
|
|
58
|
+
and showing its `version`, or, when there is no version, the plain phrase for its `state` (map
|
|
59
|
+
below). Append any `installed[].notes` **in plain words** (e.g. the memory-behind refresh+restart
|
|
60
|
+
line).
|
|
61
|
+
|
|
62
|
+
**`state` → plain language** (map the envelope's `installed[].state` token; never show the raw token):
|
|
63
|
+
`installed` → its version · `absent` → "not installed" · `other-tool` → "a different tool occupies
|
|
64
|
+
that skill slot" · `placeholder` → "a placeholder, not a working install" · `invalid` → "installed
|
|
65
|
+
but its manifest didn't validate" · `unsupported` → "installed but its manifest schema is too new for
|
|
66
|
+
this kit" · `uncheckable` → "couldn't be checked (a permission error)".
|
|
67
|
+
|
|
68
|
+
**Helper-failure contract (mirror the backend-status line).** The version block needs the
|
|
69
|
+
family-registry helper, which the **agent host** runs. If the host can't run it (`node` not on the
|
|
70
|
+
agent's PATH, or the helper errors), **skip the version block and say so with the concrete reason** —
|
|
71
|
+
e.g. *"Couldn't run the family-registry helper here (node is not on the agent host PATH), so I'm
|
|
72
|
+
skipping the installed-versions block."* — never a silent skip (Hard Constraint). It is non-essential:
|
|
73
|
+
the rest of the report — and the commit gate — proceeds.
|
|
74
|
+
|
|
75
|
+
**Welcome mat — the last line(s) of the footer.** After the version block and the backend-status
|
|
76
|
+
line, print *"Run `/agent-workflow-kit help` to see every command."* then **one** recommended next
|
|
77
|
+
step, chosen **caveat-aware** from signals already in hand (the version block's notes + the
|
|
78
|
+
backend-status line — no new helper call) in this priority order:
|
|
79
|
+
1. a member is **behind** (a behind-class `installed[].notes` caveat fired — any member, the bridges
|
|
80
|
+
included) → *refresh the behind member first*, quoting **that note's own recovery command
|
|
81
|
+
verbatim** (a memory/engine note carries its `npx …@latest init` + restart the session; a bridge
|
|
82
|
+
note carries `/agent-workflow-kit setup`). An **uncheckable** member ("couldn't be checked" — an
|
|
83
|
+
unknown-freshness note) is **never** a refresh trigger: only a behind note fires this step — the
|
|
84
|
+
uncheckable note already appears in the version block, add nothing more;
|
|
85
|
+
2. else **no backend is ready** (the backend-status line shows none ready) → *set one up with
|
|
86
|
+
`/agent-workflow-kit setup`*;
|
|
87
|
+
3. else **a backend is ready but the orchestration config is still all-Solo** (no `reviewed` /
|
|
88
|
+
`council` / `delegated` slot anywhere — inspect `docs/ai/orchestration.json`, or read the
|
|
89
|
+
procedures advisor's resolved recipes) → *put it to work with `/agent-workflow-kit recipes`*;
|
|
90
|
+
4. else (a backend is ready **and** a backend-backed recipe is already selected) → the optional
|
|
91
|
+
*`/agent-workflow-kit velocity`* opt-in (never run it without a yes).
|
|
92
|
+
|
|
93
|
+
Keep it compact — a few short lines, plain language, no kit-internal terms.
|
|
94
|
+
|
|
95
|
+
### Version disclosure — the `docs/ai` structure version, on demand only
|
|
96
|
+
|
|
97
|
+
The deployment carries an internal **`docs/ai` structure version** (the envelope's `deploymentHead`) —
|
|
98
|
+
the number `upgrade` compares the project's stamp against to decide whether a migration is due. The
|
|
99
|
+
happy path deliberately **hides** it: a user cannot act on it, and because it advances far more slowly
|
|
100
|
+
than the published package version, it reads as *"why is this smaller than what GitHub shows?"* Surface
|
|
101
|
+
it in exactly **three** places, and nowhere else:
|
|
102
|
+
1. the **never-downgrade STOP** (`${CLAUDE_SKILL_DIR}/references/modes/upgrade.md` step 2) — the stamp is ahead of what this kit knows,
|
|
103
|
+
so the number IS the message;
|
|
104
|
+
2. the **explicit version-status view** (`${CLAUDE_SKILL_DIR}/references/modes/status.md`) the user deliberately opens;
|
|
105
|
+
3. when the **user explicitly asks** about versions.
|
|
106
|
+
|
|
107
|
+
When you show it, **name what it versions — "the `docs/ai` structure version"** (render that meaning in
|
|
108
|
+
the user's conversational language) — **never** "lineage head", "deployment head", or any raw internal
|
|
109
|
+
token. Pair it with **one plain-language line** telling the two axes apart, on demand only:
|
|
110
|
+
|
|
111
|
+
> the number your project carries versions its `docs/ai` **structure**; the (usually larger) number on
|
|
112
|
+
> npm/GitHub is the **tool's own package version** — the two advance independently, so a bigger package
|
|
113
|
+
> number is **not** a newer deployment.
|
|
114
|
+
|
|
115
|
+
**Never** print this two-axes line on a successful equal-head exit — only at the STOP, the status view,
|
|
116
|
+
or on an explicit ask.
|
package/tools/engine-source.mjs
CHANGED
|
@@ -107,7 +107,8 @@ export const detectEngine = (engineDir, { source, rel } = {}, deps = {}) => {
|
|
|
107
107
|
// on the happy path; THROWS a loud Error naming the resolved dir + the reason + the exact
|
|
108
108
|
// remediation on absent/invalid/unreadable — never a fallback (fail-closed). The "methodology engine
|
|
109
109
|
// not found/invalid" prefix is a stable contract: the agent classifies the reconcile STOP by it
|
|
110
|
-
// (distinct from the cap-skip message), so do not reword it without updating
|
|
110
|
+
// (distinct from the cap-skip message), so do not reword it without updating the upgrade mode file
|
|
111
|
+
// (references/modes/upgrade.md, step 3 exit classification).
|
|
111
112
|
export const readEngineFragment = (engineDir, deps = {}) => {
|
|
112
113
|
const detection = detectEngine(engineDir, { source: deps.source, rel: deps.rel }, deps);
|
|
113
114
|
const installHint = `npx @sabaiway/agent-workflow-engine@latest init (or set ${ENGINE_ENV})`;
|