@sabaiway/agent-workflow-kit 19.4.0 → 20.0.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 +64 -0
- package/README.md +17 -9
- package/SKILL.md +6 -6
- package/capability.json +1 -1
- package/migrations/1.1.0-communication-language.md +2 -4
- package/migrations/1.2.0-agent-attribution.md +1 -3
- package/migrations/5.0.0-kit-text-in-kit-files.md +30 -0
- package/migrations/README.md +2 -2
- package/package.json +1 -1
- package/references/advisor-writers.md +1 -1
- package/references/contracts.md +9 -11
- package/references/modes/bootstrap.md +2 -4
- package/references/modes/hook.md +1 -1
- package/references/modes/procedures.md +1 -1
- package/references/modes/recommendations.md +1 -1
- package/references/modes/rules.md +4 -3
- package/references/modes/upgrade.md +23 -49
- package/references/modes/velocity.md +1 -1
- package/references/reference-profile.json +0 -6
- package/references/rules/communication.md +22 -0
- package/references/rules/project-layout.md +2 -0
- package/references/rules/story-sessions.md +14 -0
- package/references/scripts/spec-schema.mjs +1 -3
- package/references/scripts/spec-schema.test.mjs +6 -6
- package/references/shared/composition-handoff.md +24 -59
- package/references/shared/deploy-tail.md +2 -2
- package/references/templates/AGENTS.md +0 -10
- package/references/templates/agent_rules.md +0 -33
- package/references/templates/specs/index.md +1 -1
- package/tools/cheap-agents-read.mjs +1 -1
- package/tools/delegation.mjs +5 -8
- package/tools/engine-source.mjs +13 -11
- package/tools/family-registry.mjs +4 -5
- package/tools/inject-methodology.mjs +153 -493
- package/tools/migration-blocks.mjs +0 -6
- package/tools/orchestration-readme.mjs +1 -1
- package/tools/profile-gap-screen.mjs +2 -6
- package/tools/profile-gaps.mjs +19 -100
- package/tools/project-rules/index.mjs +1 -2
- package/tools/project-rules/rules-ensure.mjs +37 -6
- package/tools/project-rules/rules-priors.mjs +1 -0
- package/tools/project-rules/themes.mjs +13 -5
- package/tools/script-priors.mjs +2 -0
- package/tools/transition/index.mjs +214 -0
- package/tools/upgrade-runlist.mjs +2 -17
- package/tools/velocity-profile.mjs +1 -1
- package/tools/lens-region.mjs +0 -281
- package/tools/project-rules/memory-map-row.mjs +0 -81
- package/tools/rules-insert.mjs +0 -203
- package/tools/rules-regions.mjs +0 -190
|
@@ -63,39 +63,6 @@ Before proposing changes or committing, review against:
|
|
|
63
63
|
### 2.4. Quality Gates
|
|
64
64
|
- Always run type-checker, linter, and all tests before committing.
|
|
65
65
|
|
|
66
|
-
### 2.5. Communication (user-facing messages)
|
|
67
|
-
Apply this as part of §2 before any user-facing summary:
|
|
68
|
-
- **Plain language.** User-facing narration is short, clear, plain words of the dialogue language; when the dialogue language is not English, transliterated English jargon is banned — an English term survives only as the NAME of a thing (a flag / command / file / test), glossed in plain words when helpful; plain English stays plain for English-dialogue users.
|
|
69
|
-
- **Deliver the artifact IN the message** — paste the prompt / diff / version / command inline; never "see §X / open the file / run it and you'll see" as a *substitute* for showing what was asked.
|
|
70
|
-
- **Lead with the result**, then the details; show exactly what was asked — no deflection, no "almost done" when the ask was the finished thing.
|
|
71
|
-
- **No condescension, no filler.** Own a miss plainly and fix it in the same message.
|
|
72
|
-
- **Large artifact (≈>100 lines):** deliver a real summary or the key excerpt inline **and** link the file — never flood the reader with a 2000-line paste, never hide the answer behind a bare pointer.
|
|
73
|
-
- **Live host/session facts are tool-composed only.** Any claim about the current host or session state (prompts fired, sandbox scope, whether a bypass was needed, network reachability, approval counts) must trace to **live tool output** from **this session**; a memory/handover snapshot is **context, never report facts**, and a claim with no live signal is **omitted or explicitly marked unverified** — never asserted from recollection.
|
|
74
|
-
- **The closing state block answers three DIFFERENT questions.** Close a user-facing message with three labelled slots — *now* · *what I need from you* · *what's next*. The slot LABELS stay ENGLISH — an English label is what lets a state-block checker FIND the block and its slots at all; everything written INTO a slot is in the project's dialogue language; when that language is not English, the checker's English phrase sets do not judge those values. **Now** = the state at this instant: what is RUNNING, or what the work is stopped on. It is **never a report of finished work** — what you completed goes in the message BODY, above the block. **From you** = the real unblocker, named; a turn that is ENDING always has one. **Next** = what follows. A *now* slot that opens with what was completed buries the one fact the reader opened the message for, and the three slots collapse into one restatement.
|
|
75
|
-
- **A skip that contradicts the tree is a finding.** A tool-composed `skipped-*` line whose stated reason the observed tree disproves (a "no Node" skip beside deployed Node scripts) is raised as a FINDING in the report, never pasted as a neutral outcome — and a tool may not emit a skip whose reason it could itself disprove.
|
|
76
|
-
- **Two blocks for the user.** At a plan's approval, at a release and at every session close, the message BODY — above the closing state block — carries two short blocks in the dialogue language. *What was done, and for what*: per item the user-facing problem, then what now exists; a command name is allowed, an internal id is not. *What is next, and why*: each proposal names its benefit, plus the one hand step if any. No internal ids, no review-round tallies. The same two blocks are the handover's `## For the user` section, which the kit's `session-close-check` checker judges at the close, where the kit is installed.
|
|
77
|
-
|
|
78
|
-
### 2.6. Planning, review & process-fidelity invariants
|
|
79
|
-
Apply these when authoring a plan, reviewing, folding a finding, or editing code — the layer read **before any code change**. (Full canon: the project's planning / workflow-methodology + orchestration canon. This section is rendered from that canon and written current on every upgrade; text of your own goes under a ### heading of its own, titled unlike the kit's sections.)
|
|
80
|
-
- **Fold by code, not prose.** Before folding a code-touching finding into a plan or change, read the cited `file:line` and cite it — a prose fold drifts from the code and seeds the next bug.
|
|
81
|
-
- **Finding scope (plan-execution) — name the invariant BEFORE the edit.** During EXECUTION only — a spec and its plan under authoring have no shipped behaviour to call a live defect in, so the spec review carries none of this. Every finding names the invariant its fix would enforce, and where that invariant already lives decides the disposition: already an acceptance criterion of the phase → **fold here**; it would have to be ADDED → ship the **narrow fix** for the found site (red first, then green) and queue ONLY the generalization — a deferral row carries the invariant, the origin `file:line`, the narrow fix, its proof and a residual exposure declared NOT live; no correct narrow fix → **blocking**: the phase does not close, and it is **never queued**. Two bars declared before each round: a finding counts only if it changes a **WRITE/REMOVE decision** or is a false statement in shipped text; a repeat finding in one subarea **routes to SUBTRACTION**, not a fourth patch.
|
|
82
|
-
- **Right altitude.** Pin intent + invariants + acceptance criteria (named tests); leave fine code-mechanics to Execute, where prose cannot diverge from reality.
|
|
83
|
-
- **Spec-first.** A plan names its GOVERNING spec(s) — zero, one or many, one per touched spec-covered slice (the feature spec under `docs/ai/specs/`; page-only coverage governs as an ADOPTION SHIM, with Out of scope + Revision stated inline in the plan). A ZERO names the adoption state it relies on — `not adopted` (no store) or `adopting` (a store with no live contract), either with a recorded decline, or `nothing spec-covered touched` (a store with live contracts) — a bare zero is never a licence; the store's own state is what `status` and the upgrade advisor report. Each cited spec's Out of scope bounds that slice's work and the plan's non-goals restate it per slice — no global union; a cross-spec conflict is resolved by a spec revision BEFORE approval, never by silent precedence. A NEW feature's draft spec exists AT the spec review (a `create` row); a change to a governed contract rides the plan as its proposed revision (a `modify` row); approval confirms plan and contract atomically, and the revision lands with the code. Scenario bindings are per scenario: a new scenario is `unbound` until its test lands in the same plan, and a status never regresses for an extension.
|
|
84
|
-
- **No code-mechanics in the plan.** A ledger row carries its path and anchor, and Verification carries the exact commands (the plan-shape canon) — checked syntax: the plan's own Verification runs them against an explicit expected outcome or gate; the only other syntax a plan may carry is a literal fixture/schema fragment a named test copies or validates. Un-run, logic-bearing syntax — control-flow, a regex, a glob, a grammar, an algorithm body, a mini-DSL — never lives in plan prose, however plausible or shell-verified it looks: a fold or draft that wants one is the trigger to write the test instead.
|
|
85
|
-
- **Test-as-spec.** Fold a code-touching finding into a red→green TEST, not a prose paragraph — the gate is the only deterministic checker; a paragraph cannot self-check.
|
|
86
|
-
- **Characterize-first.** Before editing UNCOVERED code, pin its current behavior in a green test, then edit — any unintended change goes red. Never edit what has no checker; first give it one. Keep edits atomic/reversible; prefer SUBTRACTIVE folds.
|
|
87
|
-
- **State table BEFORE the guard — enumerate by PROOF, never by exclusion.** The subtraction rule above fires on a repeat finding, which is a LATE signal: by then the review has paid for each miss. The EARLY signal is structural — a decision whose input has **several independent state dimensions** (is it tracked? do the bytes still match the source? does the neighbouring file exist?). Write the table first, admit the write with **ONE conjunction of proven facts**, and funnel every other cell into a single refusal; the table is then the table-driven test. An exclusion list (`if (bad1) return; if (bad2) return;`) fails **OPEN** on the first state nobody enumerated — and "unreadable" is a state, distinct from "absent". A reviewer cannot save you here: it judges the patch in front of it and can only name the NEXT missing state, one round at a time.
|
|
88
|
-
- **Fold minimally — prose has no checker.** A spec under the spec review, like the ephemeral plan beside it, is prose with no executable checker; fold **minimally, in ONE place** and run a **self-consistency** read across the spec before every re-review — a fold that drifts several prose spots is what turns a 2-round review into churn.
|
|
89
|
-
- **Heavy review at the diff.** The spec review settles the contract and reads the plan's ledger in the same rounds (≤2 rounds, stop at the pre-existing→fold-induced crossover); the plan has no rounds of its own and is checked by its shape gate, that reading and the approval; the exhaustive review runs against the staged diff of real compiling code + the full suite, where a regression fails a gate immediately. **Backend divergence** (one backend grounded-ships while another keeps revising mechanics) IS that crossover — resolve at altitude, don't exhaust the strictest backend; route an all-mechanics/CI or prose-only artifact to a **thin plan + diff-review**.
|
|
90
|
-
- **Convergence bar.** A review loop is CLEAN only when one round returns **0 blockers + 0 majors** from EVERY backend the recipe names (nits + a ship verdict is the stop). Folding ≠ convergence — re-review after folding.
|
|
91
|
-
- **Per-round emission.** Every review round emits **{round N · finding-origin tally · per-backend verdict}** so the crossover is a computed, visible signal, not a remembered rule.
|
|
92
|
-
- **Recipe fidelity.** Council runs every backend the recipe names, **every round**; silently dropping a ready backend for quota/convenience is a forbidden downgrade — an unavailable backend is a LOUD, stated degrade, never a quiet drop.
|
|
93
|
-
- **ExitPlanMode ≠ execute.** A harness "approved — start coding" prompt authorizes the PLAN only; this methodology overrides it. Continue into execution only as a DELIBERATE transition after the plan + cold-start prompt exist, never an implicit slide.
|
|
94
|
-
- **Cost lanes.** Route every step to the **cheapest adequate executor** — L0 deterministic script (the batched gate matrix over `gates.json`, the rotation `--check`s) · L1 cheap subagent (extraction/drafting only; the orchestrator verifies) · L2 subscription bridge · L3 frontier judgment. A step with **no named guardrail does not move down** a lane, and the **red lines never move down** (council review models · real code · ADR/handover/changelog-entry wording · persuasive copy · go/no-go · the approval asks). Own-error repair: salvage recorded state first (L0/L1, batched), never frontier re-derivation. **Prompt economy:** read-only fan-out (research/sweeps/extraction) runs ONLY on restricted-tool vehicles — a full-tool subagent for read-only work is a forbidden lane downgrade (invisible prompt-flood + blast radius), and a subagent is never told to shell out for facts obtainable read-only; the orchestrator's own shell form is ONE plain pipeline per call (a `;`/`&&` chain or env-prefixed invocation never matches a prefix allow rule); a fan-out launcher that gates per call yields to the agent-spawn lane — capability-gated: without restricted-tool vehicles (generic full-tool spawning does not count), read-only research stays in the orchestrator's own context, never a vehicle mandate a host cannot satisfy. Judgment, code, synthesis stay at the frontier lane (a task that genuinely runs/writes keeps a full-tool subagent); honest limit: no deterministic gate classifies a dispatch — canon at the point of use + placed vehicles + the retro loop. **Writer economy:** a stage's repeated WRITER commands batch — evidence declarations ride consecutive plain invocations of ONE allow-listed tool, other stage writers combine via one launcher per stage; never an unbatched writer scatter (each gated write is its own prompt).
|
|
95
|
-
|
|
96
|
-
### 2.7. Story sessions
|
|
97
|
-
A story — one row of an epic's ledger, carried by one plan — runs as four sessions, each step in them giving one checked result: **spec and plan** (every contract the story creates or revises and the plan's ledger beside them, checked by the spec gate, the plan-shape gate and one review of at most two rounds that reads both, then the plan's approval), **tests** (only tests, each new one failing for the reason its scenario or acceptance bullet states, or on the absence of a name the plan adds, imported inside the test; no code and no prototype), **code** (code until the tests and the pre-review gates pass; a wrong test is changed only back to what its scenario states), and **diff review, release and record** (every committable output, tracked records included, staged first, the review of the staged diff in at most two rounds, the final gates and the release where the story ships one, then the plan's Phase: Cleanup). Tests and code never share a session. A storyless plan runs the same four. **Exception — a split:** moving code and its existing cases into modules, with no new logic and no new case, is one session: a short spec (the Module list), the split, the diff review, the release, Cleanup. A bridge executor gets a task only when it writes new tests or code, from one prompt of the orchestrator; a file the orchestrator already wrote is laid down by the orchestrator, never relayed through a bridge.
|
|
98
|
-
|
|
99
66
|
---
|
|
100
67
|
|
|
101
68
|
## 3. Token & Session Optimization
|
|
@@ -13,7 +13,7 @@ kind: index
|
|
|
13
13
|
> Up: [technical_specification.md](../technical_specification.md)
|
|
14
14
|
|
|
15
15
|
The top spec is the system root; this store holds the per-feature contracts under it. Every folder's
|
|
16
|
-
`index.md` lists ONLY its immediate children
|
|
16
|
+
`index.md` lists ONLY its immediate children; a spec over 150 lines is promoted to
|
|
17
17
|
`<slug>/index.md` + parts. Author a new spec from the skill's `SPEC_TEMPLATE.md`; the canon is the
|
|
18
18
|
engine's `references/specs.md`.
|
|
19
19
|
|
|
@@ -15,7 +15,7 @@ const HERE = dirname(fileURLToPath(import.meta.url));
|
|
|
15
15
|
export const AGENTS_DIR = '.claude/agents';
|
|
16
16
|
export const CLAUDE_DIR = '.claude';
|
|
17
17
|
export const WORKFLOW_STAMP = 'docs/ai/.workflow-version';
|
|
18
|
-
export const EXPECTED_WORKFLOW_VERSION = '
|
|
18
|
+
export const EXPECTED_WORKFLOW_VERSION = '5.0.0';
|
|
19
19
|
export const BUNDLED_AGENTS_DIR = resolve(HERE, '..', 'references', 'agents');
|
|
20
20
|
|
|
21
21
|
export const UTF8 = 'utf8';
|
package/tools/delegation.mjs
CHANGED
|
@@ -87,9 +87,8 @@ export const handoffPlan = (delegate) =>
|
|
|
87
87
|
? {
|
|
88
88
|
mode: 'delegate',
|
|
89
89
|
memoryWrites: ['docs/ai/', 'AGENTS.md', 'docs/ai/.memory-version'],
|
|
90
|
-
// The
|
|
91
|
-
|
|
92
|
-
kitWrites: ['AGENTS.md pointer slots (methodology / orchestration / autonomy)', 'docs/ai/agent_rules.md Communication, story-sessions and lens regions', 'docs/ai/.workflow-version'],
|
|
90
|
+
// The kit block and the rules themes run AFTER the substrate deploy, over memory's seed.
|
|
91
|
+
kitWrites: ['AGENTS.md kit block', 'docs/ai/rules/ theme files', 'docs/ai/.workflow-version'],
|
|
93
92
|
stampsPresent: ['.memory-version', '.workflow-version'],
|
|
94
93
|
memoryRaisesCommitGate: false,
|
|
95
94
|
commitGate: 'kit-only-after-injection',
|
|
@@ -97,11 +96,9 @@ export const handoffPlan = (delegate) =>
|
|
|
97
96
|
: {
|
|
98
97
|
mode: 'fallback',
|
|
99
98
|
memoryWrites: [],
|
|
100
|
-
// Fallback
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
// runs after the fallback-template copy of docs/ai (same reconcile, both paths — AD-041).
|
|
104
|
-
kitWrites: ['docs/ai/', 'AGENTS.md', 'AGENTS.md pointer slots (methodology / orchestration / autonomy)', 'docs/ai/agent_rules.md Communication, story-sessions and lens regions', 'docs/ai/.workflow-version'],
|
|
99
|
+
// Fallback ships the kit's OWN AGENTS.md; the kit block is written into it exactly as on the
|
|
100
|
+
// delegate path, so both paths end with the same block.
|
|
101
|
+
kitWrites: ['docs/ai/', 'AGENTS.md', 'AGENTS.md kit block', 'docs/ai/rules/ theme files', 'docs/ai/.workflow-version'],
|
|
105
102
|
stampsPresent: ['.workflow-version'],
|
|
106
103
|
memoryRaisesCommitGate: false,
|
|
107
104
|
commitGate: 'kit-only-after-injection',
|
package/tools/engine-source.mjs
CHANGED
|
@@ -37,12 +37,10 @@ export const PROCEDURES_FRAGMENT_REL = 'references/procedures.md';
|
|
|
37
37
|
// `status` caveat it) instead of discarding the methodology/orchestration fills. readEngineFragment
|
|
38
38
|
// accepts an arbitrary `rel`, so no further plumbing is needed beyond this constant.
|
|
39
39
|
export const AUTONOMY_FRAGMENT_REL = 'references/autonomy-slot.md';
|
|
40
|
-
// The
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
export const LENS_FRAGMENT_REL = 'references/agent-rules-lens.md';
|
|
45
|
-
export const LENS_PRIORS_REL = 'references/agent-rules-lens-priors.md';
|
|
40
|
+
// The lens rules theme — the template of the engine-homed project-rules theme `lens`. The rules op
|
|
41
|
+
// lays it down as docs/ai/rules/lens.md and the kit block's table names its effective file; an engine that lacks it leaves the
|
|
42
|
+
// theme unlaid with a line, and `status` caveats it.
|
|
43
|
+
export const LENS_THEME_REL = 'references/rules/lens.md';
|
|
46
44
|
const ENGINE_DEFAULT_REL = '.claude/skills/agent-workflow-engine';
|
|
47
45
|
|
|
48
46
|
const defaultStatType = (path) => {
|
|
@@ -134,9 +132,13 @@ export const readEngineFragment = (engineDir, deps = {}) => {
|
|
|
134
132
|
if (!detection.ok) throw installMe(detection.reason);
|
|
135
133
|
const read = deps.readFileSync ?? readFileSync;
|
|
136
134
|
const fragmentRel = deps.rel ?? ENGINE_FRAGMENT_REL;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
const text = (() => {
|
|
136
|
+
try {
|
|
137
|
+
return read(join(engineDir, fragmentRel), 'utf8');
|
|
138
|
+
} catch (err) {
|
|
139
|
+
throw installMe(`a required engine file is unreadable (${fragmentRel}): ${err.message}`);
|
|
140
|
+
}
|
|
141
|
+
})();
|
|
142
|
+
if (text.trim() === '') throw installMe(`a required engine file is blank (${fragmentRel})`);
|
|
143
|
+
return text;
|
|
142
144
|
};
|
|
@@ -27,7 +27,7 @@ import { isDirectRun } from './direct-run.mjs';
|
|
|
27
27
|
import { parseSemver, compareSemver } from './semver-lite.mjs';
|
|
28
28
|
import { validateManifest, readAuthoritativeVersion, UNSUPPORTED, INVALID } from './manifest/validate.mjs';
|
|
29
29
|
import { START_MARKER, excludePath, inferVisibility } from './hide-footprint.mjs';
|
|
30
|
-
import { readEngineFragment, ORCHESTRATION_FRAGMENT_REL, PROCEDURES_FRAGMENT_REL, AUTONOMY_FRAGMENT_REL,
|
|
30
|
+
import { readEngineFragment, ORCHESTRATION_FRAGMENT_REL, PROCEDURES_FRAGMENT_REL, AUTONOMY_FRAGMENT_REL, LENS_THEME_REL } from './engine-source.mjs';
|
|
31
31
|
import { ACTIVITIES, resolveActivityRecipe, composeReadiness, safeLine } from './recipes.mjs';
|
|
32
32
|
// The config reader lives in orchestration-config.mjs (the single config contract). The read-only status
|
|
33
33
|
// settings-survey reuses THIS reader (one strict-JSON + loud-on-malformed contract), not a second copy.
|
|
@@ -181,14 +181,13 @@ export const classifyMember = (member, deps = {}) => {
|
|
|
181
181
|
// the manifest AND reads the fragment — so an absent, non-file, OR present-but-unreadable fragment all
|
|
182
182
|
// surface (status never claims "ok" for a fragment a reconcile / the procedures CLI would STOP on), and
|
|
183
183
|
// a current, readable fragment never gets the caveat. Read-only, best-effort.
|
|
184
|
-
// Each caveat names the rel
|
|
185
|
-
//
|
|
186
|
-
// caveat keys on both — an engine missing only the prior store must never report healthy.
|
|
184
|
+
// Each caveat names the rel its consumer actually needs: the lens caveat keys on the lens rules theme
|
|
185
|
+
// the rules op lays down, so an engine lacking it never reports healthy.
|
|
187
186
|
const ENGINE_FRAGMENT_CAVEATS = [
|
|
188
187
|
{ rels: [ORCHESTRATION_FRAGMENT_REL], caveat: 'engine present but does not supply the recipes pointer (too old / incomplete) — run `npx @sabaiway/agent-workflow-engine@latest init`' },
|
|
189
188
|
{ rels: [AUTONOMY_FRAGMENT_REL], caveat: 'engine present but does not supply the autonomy pointer (too old / incomplete) — run `npx @sabaiway/agent-workflow-engine@latest init`' },
|
|
190
189
|
{ rels: [PROCEDURES_FRAGMENT_REL], caveat: 'engine present but does not ship the activity-procedures canon (too old / incomplete) — run `npx @sabaiway/agent-workflow-engine@latest init`' },
|
|
191
|
-
{ rels: [
|
|
190
|
+
{ rels: [LENS_THEME_REL], caveat: 'engine present but does not ship the lens rules theme (too old / incomplete) — run `npx @sabaiway/agent-workflow-engine@latest init`' },
|
|
192
191
|
];
|
|
193
192
|
|
|
194
193
|
// The orchestration-config TEMPLATE a current memory ships (added in memory 1.2.0; absent in older
|