@jaybeeuu/agent-cortex 1.42.0 → 2.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.
Files changed (83) hide show
  1. package/.agents/skills/style-versioning/SKILL.md +78 -8
  2. package/.github/workflows/ci.yml +51 -38
  3. package/AGENTS.md +32 -17
  4. package/CHANGELOG.md +182 -0
  5. package/README.md +167 -126
  6. package/agents/README.md +26 -27
  7. package/agents/ralph/agent.md +7 -10
  8. package/agents/ralph/claude/polling.md +1 -1
  9. package/bin/agent-cortex.mjs +46 -44
  10. package/bin/installers/claude.mjs +2 -2
  11. package/bin/installers/pi.mjs +885 -237
  12. package/docs/claude-hooks.md +5 -4
  13. package/docs/commit-signing.md +231 -0
  14. package/docs/ideas/enable-signed-commit-enforcement-changesets-bot-commits-must-be-signed.md +10 -1
  15. package/docs/ideas/extension-manifests.md +5 -0
  16. package/docs/research/disable-model-invocation.md +82 -0
  17. package/docs/research/skill-design-research.md +2 -2
  18. package/docs/skills/skill-anatomy.md +5 -2
  19. package/docs/technical-direction/harness-config.md +30 -14
  20. package/docs/technical-direction/migration-execution-labels.md +17 -9
  21. package/docs/user-preferences.md +2 -2
  22. package/extensions/agent-modes/README.md +3 -3
  23. package/extensions/agent-modes/discover.test.ts +19 -0
  24. package/extensions/agent-modes/discover.ts +31 -9
  25. package/extensions/session-start/README.md +38 -0
  26. package/extensions/session-start/index.test.ts +122 -0
  27. package/extensions/session-start/index.ts +27 -0
  28. package/extensions/session-start/package.json +19 -0
  29. package/extensions/session-start/tsconfig.json +12 -0
  30. package/extensions/skill-stats/pnpm-lock.yaml +329 -0
  31. package/extensions/subagent/README.md +3 -3
  32. package/extensions/subagent/agents.test.ts +176 -0
  33. package/extensions/subagent/agents.ts +101 -11
  34. package/extensions/subagent/index.ts +2 -1
  35. package/extensions/subagent/package.json +1 -1
  36. package/lib/cli.mjs +40 -16
  37. package/package.json +8 -9
  38. package/pi/settings.json +1 -7
  39. package/pnpm-workspace.yaml +6 -0
  40. package/scripts/check-changeset.mjs +42 -0
  41. package/scripts/lib/compose-agent.mjs +10 -10
  42. package/scripts/lib/release-gates.mjs +61 -0
  43. package/scripts/lib/verify-worker-tree.mjs +107 -0
  44. package/scripts/resolve-publish-command.mjs +17 -0
  45. package/skills/planning/create-task/scripts/pnpm-lock.yaml +342 -0
  46. package/skills/productivity/validate-agent-dir/scripts/pnpm-lock.yaml +329 -0
  47. package/skills/workflow/git-workflow/SKILL.md +35 -1
  48. package/skills/workflow/ralph/REFERENCE.md +20 -4
  49. package/skills/workflow/ralph/SKILL.md +9 -6
  50. package/skills/workflow/run-pipeline-stage/SKILL.md +11 -4
  51. package/skills/workflow/run-pipeline-stage/playbooks/code.md +2 -0
  52. package/skills/workflow/run-pipeline-stage/playbooks/document.md +3 -0
  53. package/skills/workflow/run-pipeline-stage/playbooks/fix.md +2 -0
  54. package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +11 -0
  55. package/skills/workflow/run-pipeline-stage/scripts/pnpm-lock.yaml +342 -0
  56. package/test/cli.test.mjs +37 -39
  57. package/test/helpers/fake-pi.mjs +132 -0
  58. package/test/pi-installer.test.mjs +345 -286
  59. package/test/pi-register.test.mjs +342 -0
  60. package/test/pi-sweep.test.mjs +619 -0
  61. package/test/release-gates.test.mjs +190 -0
  62. package/test/verify-worker-tree.test.mjs +120 -0
  63. package/token-map.README.md +16 -18
  64. package/token-map.json +29 -33
  65. package/agents/plan/copilot/frontmatter.json +0 -6
  66. package/agents/plan.agent.md +0 -59
  67. package/agents/ralph/copilot/frontmatter.json +0 -6
  68. package/agents/ralph/copilot/polling.md +0 -62
  69. package/agents/ralph-plan/copilot/frontmatter.json +0 -6
  70. package/agents/ralph-plan.agent.md +0 -126
  71. package/agents/ralph.agent.md +0 -331
  72. package/agents/strategy/copilot/frontmatter.json +0 -6
  73. package/agents/strategy.agent.md +0 -112
  74. package/bin/installers/copilot.mjs +0 -124
  75. package/extensions/session-start.ts +0 -44
  76. package/hooks.json +0 -10
  77. package/lib/pi-packages.mjs +0 -169
  78. package/plugin.json +0 -35
  79. package/scripts/build-copilot-agents.mjs +0 -30
  80. package/scripts/install-instructions.sh +0 -82
  81. package/scripts/sync-plugin-version.sh +0 -17
  82. package/test/copilot-installer.test.mjs +0 -308
  83. package/test/pi-packages.test.mjs +0 -295
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { parseArgs, buildHelpText, validateHarness } from "../lib/cli.mjs";
4
- import { installPi } from "./installers/pi.mjs";
4
+ import { join, dirname } from "node:path";
5
+ import { installPi, registerPi, sweepLegacyPiUserDirs } from "./installers/pi.mjs";
5
6
 
6
7
  const argv = process.argv.slice(2);
7
8
  const parsed = parseArgs(argv);
@@ -29,18 +30,41 @@ if (parsed.command === "install") {
29
30
  }
30
31
 
31
32
  if (parsed.harness === "pi") {
33
+ // A plain `agent-cortex install pi` stages the package into the home
34
+ // install root (~/.agent-cortex/pi) and registers that directory with pi
35
+ // through pi's own `pi install` (idempotent by state: a re-run is a no-op
36
+ // update); `--output <dir>` is the stage-only form (tests/CI) and prints
37
+ // the registration command instead.
32
38
  try {
33
39
  const result = await installPi({
34
40
  dryRun: parsed.dryRun ?? false,
35
- // Third-party pi packages are only provisioned for a real install:
36
- // --output is the generate-only form, --no-provision opts an offline
37
- // machine out explicitly.
38
- provisionPackages: parsed.output === undefined && !parsed.noProvision,
39
41
  warn: () => {}, // warnings surface once in the printed summary
40
42
  ...(parsed.output ? { output: parsed.output } : {}),
41
43
  ...(parsed.pluginRoot ? { pluginRoot: parsed.pluginRoot } : {}),
42
44
  });
43
45
  printPiInstall(result);
46
+ if (parsed.output === undefined) {
47
+ const registration = await registerPi({
48
+ output: result.output,
49
+ dryRun: parsed.dryRun ?? false,
50
+ requireRegister: parsed.requireRegister ?? false,
51
+ warn: (msg) => process.stdout.write(` ⚠ ${msg}\n`),
52
+ });
53
+ // The old installer's rendered copies are only stale once the staged
54
+ // package is what pi loads — and nothing is deleted on a dry run. The
55
+ // flag is passed through as well, so the sweep's own guarantee does not
56
+ // depend on this guard staying in place.
57
+ if (registration.registered && !(parsed.dryRun ?? false)) {
58
+ printPiSweep(
59
+ await sweepLegacyPiUserDirs({
60
+ piUserDir: dirname(registration.settingsPath),
61
+ dryRun: parsed.dryRun ?? false,
62
+ }),
63
+ );
64
+ }
65
+ } else {
66
+ process.stdout.write(` → register it with pi: pi install ${result.output}\n`);
67
+ }
44
68
  } catch (err) {
45
69
  process.stderr.write(`Install failed: ${err.message}\n`);
46
70
  process.exit(1);
@@ -88,38 +112,34 @@ if (parsed.command === "install") {
88
112
  process.exit(1);
89
113
  }
90
114
  }
115
+ }
91
116
 
92
- // copilot regenerates the flat agents/*.agent.md files the Copilot plugin
93
- // loads via plugin.json ("agents": "agents/") — the same code path
94
- // `pnpm build:copilot` runs.
95
- if (parsed.harness === "copilot") {
96
- const { installCopilot } = await import("./installers/copilot.mjs");
97
- try {
98
- await installCopilot({ output: parsed.output, dryRun: parsed.dryRun });
99
- process.exit(0);
100
- } catch (err) {
101
- process.stderr.write(`Install failed: ${err.message}\n`);
102
- process.exit(1);
103
- }
117
+ function printPiSweep({ removed }) {
118
+ if (removed.length === 0) return;
119
+ process.stdout.write(
120
+ ` ✓ Removed ${removed.length} artifact(s) the pre-staged-model installer rendered into pi's user directory (one-time migration — the staged package is the source from now on)\n`,
121
+ );
122
+ for (const path of removed) {
123
+ process.stdout.write(` - ${path}\n`);
104
124
  }
105
-
106
- process.exit(0);
107
125
  }
108
126
 
109
127
  function printPiInstall(result) {
110
128
  process.stdout.write(`Installing agent-cortex for "pi" harness…\n`);
129
+ process.stdout.write(` ✓ Staged pi package → ${result.output}\n`);
111
130
  for (const agent of result.agents) {
112
131
  process.stdout.write(` ✓ ${agent.name}.agent.md → ${agent.filePath}\n`);
113
132
  }
114
133
  process.stdout.write(` ✓ Substituted ${result.skills.md} markdown file(s) across ${result.skills.skills} skill(s) → ${result.skills.dir}\n`);
115
- printManagedConfig("settings.json", result.settings);
116
- printManagedConfig("keybindings.json", result.keybindings);
117
- // A dry run installs nothing, so report the plan — otherwise the documented
118
- // "show what would be installed" contract prints no packages at all.
119
- const packages = result.packages ?? { planned: [], installed: [] };
120
- for (const source of result.dryRun ? packages.planned : packages.installed) {
121
- process.stdout.write(` ✓ ${result.dryRun ? "Would install" : "Installed"} pi package ${source}\n`);
134
+ process.stdout.write(` ✓ Copied ${result.extensions.files} extension file(s) → ${result.extensions.dir}\n`);
135
+ for (const name of result.packages.bundled) {
136
+ process.stdout.write(` ✓ Bundled pi package ${name} → ${join(result.packages.dir, name)}\n`);
137
+ }
138
+ const transitive = result.packages.staged.length - result.packages.bundled.length;
139
+ if (transitive > 0) {
140
+ process.stdout.write(` ✓ Copied ${transitive} transitive dependency tree(s) → ${result.packages.dir}\n`);
122
141
  }
142
+ process.stdout.write(` ✓ ${result.dryRun ? "Would write" : "Wrote"} ${result.manifest.path} (version ${result.manifest.manifest.version})\n`);
123
143
  for (const warning of result.warnings) {
124
144
  process.stdout.write(` ⚠ ${warning}\n`);
125
145
  }
@@ -127,21 +147,3 @@ function printPiInstall(result) {
127
147
  process.stdout.write("(dry-run — nothing written)\n");
128
148
  }
129
149
  }
130
-
131
- /** Report one managed pi config file (settings.json / keybindings.json). */
132
- function printManagedConfig(label, info) {
133
- if (!info) return;
134
- if (info.action === "would-remove-symlink") {
135
- process.stdout.write(` → would remove symlink ${info.path} and write ${label}\n`);
136
- } else if (info.action === "would-write") {
137
- process.stdout.write(` → would write ${label} → ${info.path}\n`);
138
- } else if (info.action === "unchanged") {
139
- process.stdout.write(` · ${label} → ${info.path} (unchanged)\n`);
140
- } else if (info.action === "skipped") {
141
- process.stdout.write(` ⚠ ${label} modified after install — left untouched → ${info.path}\n`);
142
- } else if (info.action === "removed-symlink") {
143
- process.stdout.write(` ✓ ${label} → ${info.path} (removed legacy symlink)\n`);
144
- } else {
145
- process.stdout.write(` ✓ ${label} → ${info.path}\n`);
146
- }
147
- }
@@ -97,8 +97,8 @@ const DEFAULT_WARN = (msg) => console.warn(`[claude-installer] ${msg}`);
97
97
  // section composition from the poll-loop sources.
98
98
  const DEFER = new Set(["ralph"]);
99
99
 
100
- // Ralph-coupled Copilot skills that don't apply to the lean Claude Ralph (and carry dead
101
- // ~/.copilot orchestration paths). Not copied into the Claude plugin.
100
+ // Ralph-coupled pipeline skills that don't apply to the lean Claude Ralph (its completion
101
+ // handling is event-driven, not the pi orchestrator's). Not copied into the Claude plugin.
102
102
  const SKILL_EXCLUDE = new Set(["ralph", "run-pipeline-stage"]);
103
103
 
104
104
  const NAME_PREFIX = "agent-cortex:";