@sabaiway/agent-workflow-kit 19.5.0 → 20.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +18 -10
  3. package/SKILL.md +6 -6
  4. package/bin/install.mjs +1 -1
  5. package/capability.json +1 -1
  6. package/migrations/1.1.0-communication-language.md +2 -4
  7. package/migrations/1.2.0-agent-attribution.md +1 -3
  8. package/migrations/5.0.0-kit-text-in-kit-files.md +30 -0
  9. package/migrations/README.md +2 -2
  10. package/package.json +1 -1
  11. package/references/advisor-writers.md +1 -1
  12. package/references/contracts.md +9 -11
  13. package/references/modes/bootstrap.md +2 -4
  14. package/references/modes/hook.md +1 -1
  15. package/references/modes/procedures.md +1 -1
  16. package/references/modes/recommendations.md +1 -1
  17. package/references/modes/rules.md +4 -3
  18. package/references/modes/upgrade.md +23 -49
  19. package/references/modes/velocity.md +1 -1
  20. package/references/reference-profile.json +0 -6
  21. package/references/rules/communication.md +22 -0
  22. package/references/rules/project-layout.md +2 -0
  23. package/references/rules/story-sessions.md +14 -0
  24. package/references/shared/composition-handoff.md +24 -59
  25. package/references/shared/deploy-tail.md +2 -2
  26. package/references/templates/AGENTS.md +0 -10
  27. package/references/templates/agent_rules.md +0 -33
  28. package/tools/cheap-agents-read.mjs +1 -1
  29. package/tools/delegation.mjs +5 -8
  30. package/tools/engine-source.mjs +13 -11
  31. package/tools/family-registry.mjs +4 -5
  32. package/tools/inject-methodology.mjs +153 -493
  33. package/tools/migration-blocks.mjs +0 -6
  34. package/tools/orchestration-readme.mjs +1 -1
  35. package/tools/payload-prune.mjs +48 -8
  36. package/tools/profile-gap-screen.mjs +2 -6
  37. package/tools/profile-gaps.mjs +19 -100
  38. package/tools/project-rules/index.mjs +1 -2
  39. package/tools/project-rules/rules-ensure.mjs +37 -6
  40. package/tools/project-rules/rules-priors.mjs +1 -0
  41. package/tools/project-rules/themes.mjs +13 -5
  42. package/tools/transition/index.mjs +214 -0
  43. package/tools/upgrade-runlist.mjs +2 -17
  44. package/tools/velocity-profile.mjs +1 -1
  45. package/tools/lens-region.mjs +0 -281
  46. package/tools/project-rules/memory-map-row.mjs +0 -81
  47. package/tools/rules-insert.mjs +0 -203
  48. package/tools/rules-regions.mjs +0 -190
@@ -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 lens region runs AFTER the substrate deploy (its own precondition: the file exists)
91
- // — it converges a stale-memory seed to the installed engine's canon (AD-041).
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 now ships the kit's OWN AGENTS.md carrying the EMPTY pointer slots (Plan 2);
101
- // the kit reconciles them (ensure-slot + inject-because-empty) exactly like the delegate
102
- // path — so both paths end with FILLED slots, not inline methodology. The lens region
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',
@@ -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 agent-rules lens pair — the canonical lens block + its append-only prior store (engine
41
- // >= 1.13.0; an older engine ships neither). The kit's lens-region reconcile live-reads BOTH via
42
- // readEngineFragment({ rel }); detectEngine({ rel }) lets it soft-skip a too-old engine (and
43
- // `status` caveat it) instead of failing the whole reconcile.
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
- try {
138
- return read(join(engineDir, fragmentRel), 'utf8');
139
- } catch (err) {
140
- throw installMe(`a required engine file is unreadable (${fragmentRel}): ${err.message}`);
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, LENS_FRAGMENT_REL, LENS_PRIORS_REL } from './engine-source.mjs';
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(s) its consumer actually needs: the lens reconcile requires the
185
- // fragment AND its prior store as a PAIR (lens-region soft-skips when either is missing), so its
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: [LENS_FRAGMENT_REL, LENS_PRIORS_REL], caveat: 'engine present but does not ship the agent-rules lens canon (the fragment + its prior store; too old / incomplete — engine >= 1.13.0) — run `npx @sabaiway/agent-workflow-engine@latest init`' },
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