@ryuenn3123/agentic-senior-core 2.5.22 → 3.0.2

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 (174) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +22 -0
  2. package/.agent-context/prompts/init-project.md +55 -39
  3. package/.agent-context/prompts/refactor.md +2 -1
  4. package/.agent-context/prompts/review-code.md +3 -2
  5. package/.agent-context/review-checklists/pr-checklist.md +8 -1
  6. package/.agent-context/rules/architecture.md +11 -0
  7. package/.agent-context/rules/frontend-architecture.md +2 -2
  8. package/.agent-context/state/architecture-map.md +1 -1
  9. package/.agent-context/state/memory-continuity-benchmark.json +1 -1
  10. package/.agents/workflows/init-project.md +3 -3
  11. package/.agents/workflows/refactor.md +1 -1
  12. package/.agents/workflows/review-code.md +4 -5
  13. package/.cursorrules +27 -71
  14. package/.gemini/instructions.md +6 -7
  15. package/.github/copilot-instructions.md +5 -6
  16. package/.windsurfrules +27 -71
  17. package/AGENTS.md +7 -9
  18. package/CONTRIBUTING.md +18 -31
  19. package/README.md +17 -43
  20. package/bin/agentic-senior-core.js +0 -6
  21. package/lib/cli/commands/init.mjs +113 -650
  22. package/lib/cli/commands/launch.mjs +1 -23
  23. package/lib/cli/commands/rollback.mjs +1 -1
  24. package/lib/cli/commands/upgrade.mjs +47 -28
  25. package/lib/cli/compiler.mjs +77 -72
  26. package/lib/cli/constants.mjs +84 -26
  27. package/lib/cli/init-architecture-flow.mjs +231 -0
  28. package/lib/cli/init-detection-flow.mjs +123 -0
  29. package/lib/cli/init-options.mjs +344 -0
  30. package/lib/cli/init-selection.mjs +100 -0
  31. package/lib/cli/preflight.mjs +1 -1
  32. package/lib/cli/profile-packs.mjs +15 -1
  33. package/lib/cli/project-scaffolder.mjs +18 -154
  34. package/lib/cli/utils.mjs +224 -13
  35. package/mcp.json +19 -19
  36. package/package.json +5 -2
  37. package/scripts/context-triggered-audit.mjs +18 -18
  38. package/scripts/documentation-boundary-audit.mjs +92 -5
  39. package/scripts/forbidden-content-check.mjs +1 -1
  40. package/scripts/frontend-usability-audit.mjs +21 -28
  41. package/scripts/governance-weekly-report.mjs +29 -15
  42. package/scripts/llm-judge.mjs +2 -5
  43. package/scripts/mcp-server.mjs +389 -5
  44. package/scripts/release-gate.mjs +121 -145
  45. package/scripts/sync-thin-adapters.mjs +161 -0
  46. package/scripts/v3-purge-audit.mjs +231 -0
  47. package/scripts/validate-evidence-bundle.mjs +1 -1
  48. package/scripts/validate.mjs +224 -272
  49. package/.agent-context/blueprints/api-nextjs.md +0 -184
  50. package/.agent-context/blueprints/aspnet-api.md +0 -247
  51. package/.agent-context/blueprints/ci-github-actions.md +0 -226
  52. package/.agent-context/blueprints/ci-gitlab.md +0 -200
  53. package/.agent-context/blueprints/fastapi-service.md +0 -210
  54. package/.agent-context/blueprints/go-service.md +0 -217
  55. package/.agent-context/blueprints/graphql-grpc-api.md +0 -51
  56. package/.agent-context/blueprints/infrastructure-as-code.md +0 -62
  57. package/.agent-context/blueprints/kubernetes-manifests.md +0 -76
  58. package/.agent-context/blueprints/laravel-api.md +0 -233
  59. package/.agent-context/blueprints/mobile-app.md +0 -91
  60. package/.agent-context/blueprints/nestjs-logic.md +0 -247
  61. package/.agent-context/blueprints/observability.md +0 -227
  62. package/.agent-context/blueprints/spring-boot-api.md +0 -218
  63. package/.agent-context/profiles/platform.md +0 -13
  64. package/.agent-context/profiles/regulated.md +0 -13
  65. package/.agent-context/profiles/startup.md +0 -13
  66. package/.agent-context/review-checklists/frontend-excellence-rubric.md +0 -73
  67. package/.agent-context/review-checklists/frontend-skill-parity.md +0 -29
  68. package/.agent-context/review-checklists/frontend-usability.md +0 -35
  69. package/.agent-context/review-checklists/marketplace-acceptance.md +0 -60
  70. package/.agent-context/review-checklists/performance-audit.md +0 -71
  71. package/.agent-context/review-checklists/release-operations.md +0 -33
  72. package/.agent-context/review-checklists/security-audit.md +0 -119
  73. package/.agent-context/skills/README.md +0 -63
  74. package/.agent-context/skills/backend/README.md +0 -68
  75. package/.agent-context/skills/backend/architecture.md +0 -361
  76. package/.agent-context/skills/backend/compatibility-manifest.json +0 -8
  77. package/.agent-context/skills/backend/data-access.md +0 -231
  78. package/.agent-context/skills/backend/errors.md +0 -138
  79. package/.agent-context/skills/backend/validation.md +0 -117
  80. package/.agent-context/skills/backend.md +0 -29
  81. package/.agent-context/skills/cli/.evidence/compatibility-manifest.json +0 -5
  82. package/.agent-context/skills/cli/.evidence/sbom-excerpt.json +0 -10
  83. package/.agent-context/skills/cli/.evidence/test-report.json +0 -8
  84. package/.agent-context/skills/cli/CHANGELOG.md +0 -6
  85. package/.agent-context/skills/cli/README.md +0 -56
  86. package/.agent-context/skills/cli/compatibility-manifest.json +0 -8
  87. package/.agent-context/skills/cli/init.md +0 -38
  88. package/.agent-context/skills/cli/output.md +0 -36
  89. package/.agent-context/skills/cli/package.json +0 -5
  90. package/.agent-context/skills/cli/safety-telemetry.md +0 -39
  91. package/.agent-context/skills/cli/tests/.gitkeep +0 -1
  92. package/.agent-context/skills/cli/upgrade.md +0 -38
  93. package/.agent-context/skills/cli.md +0 -32
  94. package/.agent-context/skills/distribution/.evidence/compatibility-manifest.json +0 -9
  95. package/.agent-context/skills/distribution/.evidence/sbom-excerpt.json +0 -6
  96. package/.agent-context/skills/distribution/.evidence/test-report.json +0 -8
  97. package/.agent-context/skills/distribution/CHANGELOG.md +0 -7
  98. package/.agent-context/skills/distribution/README.md +0 -27
  99. package/.agent-context/skills/distribution/compatibility-manifest.json +0 -8
  100. package/.agent-context/skills/distribution/compatibility.md +0 -32
  101. package/.agent-context/skills/distribution/package.json +0 -5
  102. package/.agent-context/skills/distribution/provenance-attestation.md +0 -47
  103. package/.agent-context/skills/distribution/publish.md +0 -37
  104. package/.agent-context/skills/distribution/rollback.md +0 -32
  105. package/.agent-context/skills/distribution/tests/.gitkeep +0 -1
  106. package/.agent-context/skills/distribution.md +0 -32
  107. package/.agent-context/skills/frontend/.evidence/compatibility-manifest.json +0 -9
  108. package/.agent-context/skills/frontend/.evidence/sbom-excerpt.json +0 -6
  109. package/.agent-context/skills/frontend/.evidence/test-report.json +0 -8
  110. package/.agent-context/skills/frontend/CHANGELOG.md +0 -7
  111. package/.agent-context/skills/frontend/README.md +0 -50
  112. package/.agent-context/skills/frontend/accessibility.md +0 -107
  113. package/.agent-context/skills/frontend/compatibility-manifest.json +0 -8
  114. package/.agent-context/skills/frontend/conversion-clarity.md +0 -51
  115. package/.agent-context/skills/frontend/motion.md +0 -67
  116. package/.agent-context/skills/frontend/package.json +0 -5
  117. package/.agent-context/skills/frontend/performance.md +0 -63
  118. package/.agent-context/skills/frontend/responsive-delivery.md +0 -41
  119. package/.agent-context/skills/frontend/tests/.gitkeep +0 -1
  120. package/.agent-context/skills/frontend/ui-architecture.md +0 -128
  121. package/.agent-context/skills/frontend.md +0 -40
  122. package/.agent-context/skills/fullstack/.evidence/compatibility-manifest.json +0 -9
  123. package/.agent-context/skills/fullstack/.evidence/sbom-excerpt.json +0 -6
  124. package/.agent-context/skills/fullstack/.evidence/test-report.json +0 -8
  125. package/.agent-context/skills/fullstack/CHANGELOG.md +0 -7
  126. package/.agent-context/skills/fullstack/README.md +0 -27
  127. package/.agent-context/skills/fullstack/compatibility-manifest.json +0 -8
  128. package/.agent-context/skills/fullstack/contracts.md +0 -53
  129. package/.agent-context/skills/fullstack/end-to-end.md +0 -42
  130. package/.agent-context/skills/fullstack/feature-slicing.md +0 -65
  131. package/.agent-context/skills/fullstack/package.json +0 -5
  132. package/.agent-context/skills/fullstack/release-coordination.md +0 -51
  133. package/.agent-context/skills/fullstack/tests/.gitkeep +0 -1
  134. package/.agent-context/skills/fullstack.md +0 -30
  135. package/.agent-context/skills/index.json +0 -107
  136. package/.agent-context/skills/review-quality/.evidence/compatibility-manifest.json +0 -9
  137. package/.agent-context/skills/review-quality/.evidence/sbom-excerpt.json +0 -6
  138. package/.agent-context/skills/review-quality/.evidence/test-report.json +0 -8
  139. package/.agent-context/skills/review-quality/CHANGELOG.md +0 -7
  140. package/.agent-context/skills/review-quality/README.md +0 -27
  141. package/.agent-context/skills/review-quality/benchmark.md +0 -30
  142. package/.agent-context/skills/review-quality/compatibility-manifest.json +0 -8
  143. package/.agent-context/skills/review-quality/package.json +0 -5
  144. package/.agent-context/skills/review-quality/planning.md +0 -38
  145. package/.agent-context/skills/review-quality/release-decision.md +0 -49
  146. package/.agent-context/skills/review-quality/security.md +0 -34
  147. package/.agent-context/skills/review-quality/tests/.gitkeep +0 -1
  148. package/.agent-context/skills/review-quality.md +0 -34
  149. package/.agent-context/stacks/csharp.md +0 -149
  150. package/.agent-context/stacks/flutter.md +0 -16
  151. package/.agent-context/stacks/go.md +0 -181
  152. package/.agent-context/stacks/java.md +0 -135
  153. package/.agent-context/stacks/php.md +0 -192
  154. package/.agent-context/stacks/python.md +0 -153
  155. package/.agent-context/stacks/react-native.md +0 -16
  156. package/.agent-context/stacks/ruby.md +0 -80
  157. package/.agent-context/stacks/rust.md +0 -86
  158. package/.agent-context/stacks/typescript.md +0 -317
  159. package/.agent-context/state/skill-platform.json +0 -38
  160. package/lib/cli/skill-selector.mjs +0 -232
  161. package/lib/cli/templates/api-contract.md.id.tmpl +0 -143
  162. package/lib/cli/templates/api-contract.md.tmpl +0 -143
  163. package/lib/cli/templates/architecture-decision-record.md.id.tmpl +0 -106
  164. package/lib/cli/templates/architecture-decision-record.md.tmpl +0 -145
  165. package/lib/cli/templates/database-schema.md.id.tmpl +0 -74
  166. package/lib/cli/templates/database-schema.md.tmpl +0 -74
  167. package/lib/cli/templates/flow-overview.md.id.tmpl +0 -118
  168. package/lib/cli/templates/flow-overview.md.tmpl +0 -131
  169. package/lib/cli/templates/project-brief.md.id.tmpl +0 -55
  170. package/lib/cli/templates/project-brief.md.tmpl +0 -79
  171. package/scripts/init-project.ps1 +0 -105
  172. package/scripts/init-project.sh +0 -131
  173. package/scripts/skill-tier-policy.mjs +0 -76
  174. package/scripts/trust-scorer.mjs +0 -119
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Launch Command — Numbered interactive launcher.
3
- * Depends on: constants, utils, init command, skill-selector
3
+ * Depends on: constants, utils, init command
4
4
  */
5
5
  import { createInterface } from 'node:readline/promises';
6
6
  import { stdin, stdout } from 'node:process';
@@ -8,7 +8,6 @@ import { stdin, stdout } from 'node:process';
8
8
  import { CLI_VERSION, INIT_PRESETS } from '../constants.mjs';
9
9
  import { askChoice, normalizeChoiceInput } from '../utils.mjs';
10
10
  import { runInitCommand } from './init.mjs';
11
- import { runSkillCommand } from '../skill-selector.mjs';
12
11
  import { runOptimizeCommand } from './optimize.mjs';
13
12
 
14
13
  export async function runLaunchCommand() {
@@ -21,24 +20,15 @@ export async function runLaunchCommand() {
21
20
  const launchChoice = await askChoice(
22
21
  'How do you want to start?',
23
22
  [
24
- 'GitHub template (zero install)',
25
23
  'npm / npx path',
26
- 'Bootstrap scripts',
27
24
  'Preset starter',
28
25
  'Interactive init wizard',
29
26
  'Enable token optimization',
30
- 'Skill selector',
31
27
  'Exit',
32
28
  ],
33
29
  userInterface
34
30
  );
35
31
 
36
- if (launchChoice === 'GitHub template (zero install)') {
37
- console.log('\nOpen the GitHub template here:');
38
- console.log('https://github.com/fatidaprilian/Agentic-Senior-Core/generate');
39
- return;
40
- }
41
-
42
32
  if (launchChoice === 'npm / npx path') {
43
33
  console.log('\nChoose one of these package paths:');
44
34
  console.log('npm exec --yes @ryuenn3123/agentic-senior-core init');
@@ -47,13 +37,6 @@ export async function runLaunchCommand() {
47
37
  return;
48
38
  }
49
39
 
50
- if (launchChoice === 'Bootstrap scripts') {
51
- console.log('\nUse the repository bootstrap scripts:');
52
- console.log('Windows: powershell -ExecutionPolicy Bypass -File .\\scripts\\init-project.ps1 -TargetDirectory .');
53
- console.log('Linux/macOS: bash ./scripts/init-project.sh .');
54
- return;
55
- }
56
-
57
40
  if (launchChoice === 'Preset starter') {
58
41
  const presetNames = Object.keys(INIT_PRESETS);
59
42
  const selectedPresetName = await askChoice(
@@ -86,11 +69,6 @@ export async function runLaunchCommand() {
86
69
  return;
87
70
  }
88
71
 
89
- if (launchChoice === 'Skill selector') {
90
- await runSkillCommand([]);
91
- return;
92
- }
93
-
94
72
  console.log('Exit selected.');
95
73
  } finally {
96
74
  userInterface.close();
@@ -25,7 +25,7 @@ export async function runRollbackCommand(commandArguments) {
25
25
 
26
26
  try {
27
27
  await ensureDirectory(resolvedTargetDirectoryPath);
28
- } catch (err) {
28
+ } catch {
29
29
  console.error(`[FATAL] Cannot access target directory: ${resolvedTargetDirectoryPath}`);
30
30
  process.exit(1);
31
31
  }
@@ -21,6 +21,7 @@ import {
21
21
  collectFileNames,
22
22
  formatDuration,
23
23
  pathExists,
24
+ analyzeManagedGovernanceSurface,
24
25
  copyGovernanceAssetsToTarget,
25
26
  } from '../utils.mjs';
26
27
 
@@ -39,8 +40,6 @@ import {
39
40
  import { runPreflightChecks } from '../preflight.mjs';
40
41
  import { createBackup } from '../backup.mjs';
41
42
  import { performRollback } from '../rollback.mjs';
42
- import { inferSkillDomainNamesFromSelection } from '../skill-selector.mjs';
43
- import { evaluateSkillDomainCompatibility } from '../compatibility.mjs';
44
43
  import { detectProjectDocTemplateStaleness } from '../project-scaffolder.mjs';
45
44
 
46
45
  export function parseUpgradeArguments(commandArguments) {
@@ -48,7 +47,8 @@ export function parseUpgradeArguments(commandArguments) {
48
47
  targetDirectory: '.',
49
48
  dryRun: false,
50
49
  skipConfirmation: false,
51
- includeMcpTemplate: false,
50
+ includeMcpTemplate: true,
51
+ pruneManagedSurface: true,
52
52
  };
53
53
 
54
54
  for (let argumentIndex = 0; argumentIndex < commandArguments.length; argumentIndex++) {
@@ -74,6 +74,21 @@ export function parseUpgradeArguments(commandArguments) {
74
74
  continue;
75
75
  }
76
76
 
77
+ if (currentArgument === '--no-mcp-template') {
78
+ parsedUpgradeOptions.includeMcpTemplate = false;
79
+ continue;
80
+ }
81
+
82
+ if (currentArgument === '--prune') {
83
+ parsedUpgradeOptions.pruneManagedSurface = true;
84
+ continue;
85
+ }
86
+
87
+ if (currentArgument === '--no-prune') {
88
+ parsedUpgradeOptions.pruneManagedSurface = false;
89
+ continue;
90
+ }
91
+
77
92
  throw new Error(`Unknown option: ${currentArgument}`);
78
93
  }
79
94
 
@@ -114,9 +129,7 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
114
129
  console.log(`\nAgentic-Senior-Core CLI v${CLI_VERSION}`);
115
130
  console.log('Running rules operations upgrade assistant (Federated Governance baseline) for an existing repository.');
116
131
 
117
- await copyGovernanceAssetsToTarget(resolvedTargetDirectoryPath, {
118
- includeMcpTemplate: upgradeOptions.includeMcpTemplate === true,
119
- });
132
+ const managedSurfacePlan = await analyzeManagedGovernanceSurface(resolvedTargetDirectoryPath);
120
133
 
121
134
  const stackFileNames = await collectFileNames(path.join(AGENT_CONTEXT_DIR, 'stacks'));
122
135
  const blueprintFileNames = await collectFileNames(path.join(AGENT_CONTEXT_DIR, 'blueprints'));
@@ -205,26 +218,8 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
205
218
  console.log(` - ${majorConstraint}`);
206
219
  }
207
220
 
208
- const selectedSkillDomainNames = inferSkillDomainNamesFromSelection(
209
- selectedStackFileName,
210
- selectedBlueprintFileName,
211
- selectedAdditionalStackFileNames,
212
- selectedAdditionalBlueprintFileNames
213
- );
214
- const compatibilityWarnings = await evaluateSkillDomainCompatibility(
215
- resolvedTargetDirectoryPath,
216
- selectedSkillDomainNames
217
- );
218
221
  const projectDocStalenessReport = await detectProjectDocTemplateStaleness(resolvedTargetDirectoryPath);
219
222
 
220
- if (compatibilityWarnings.length > 0) {
221
- console.log('\n[WARN] Compatibility checks reported potential issues for this environment:');
222
- for (const compatibilityWarning of compatibilityWarnings) {
223
- console.log(`- ${compatibilityWarning}`);
224
- }
225
- console.log('Upgrade will continue, but review these warnings before production use.');
226
- }
227
-
228
223
  const currentRulesPath = path.join(resolvedTargetDirectoryPath, '.cursorrules');
229
224
  const currentRulesContent = await pathExists(currentRulesPath)
230
225
  ? await fs.readFile(currentRulesPath, 'utf8')
@@ -259,12 +254,30 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
259
254
  console.log(`- Existing rules lines: ${currentRuleLineCount}`);
260
255
  console.log(`- Planned rules lines: ${plannedRuleLineCount}`);
261
256
  console.log(`- Rules changed: ${isRulesContentChanged ? 'yes' : 'no'}`);
257
+ console.log(`- Managed surface stale files: ${managedSurfacePlan.staleFiles.length}`);
258
+ console.log(`- Managed surface stale directories: ${managedSurfacePlan.staleDirectories.length}`);
259
+ console.log(`- Managed surface prune mode: ${upgradeOptions.pruneManagedSurface === true ? 'enabled (default)' : 'disabled (--no-prune)'}`);
260
+ console.log(`- MCP config write mode: ${upgradeOptions.includeMcpTemplate === true ? 'enabled (default)' : 'disabled (--no-mcp-template)'}`);
262
261
  if (projectDocStalenessReport.hasProjectDocs) {
263
262
  console.log(`- Project docs detected: ${projectDocStalenessReport.checkedFileNames.length}`);
264
263
  console.log(`- Project docs expected template version: ${projectDocStalenessReport.expectedTemplateVersion}`);
265
264
  console.log(`- Project docs stale files: ${projectDocStalenessReport.staleFiles.length}`);
266
265
  }
267
266
 
267
+ if (managedSurfacePlan.staleFiles.length > 0 || managedSurfacePlan.staleDirectories.length > 0) {
268
+ console.log('\nManaged surface stale paths preview (up to 5):');
269
+ const previewPaths = [
270
+ ...managedSurfacePlan.staleFiles,
271
+ ...managedSurfacePlan.staleDirectories,
272
+ ].slice(0, 5);
273
+ for (const previewPath of previewPaths) {
274
+ console.log(`- ${previewPath}`);
275
+ }
276
+ if (managedSurfacePlan.staleFiles.length + managedSurfacePlan.staleDirectories.length > previewPaths.length) {
277
+ console.log('- ...');
278
+ }
279
+ }
280
+
268
281
  if (projectDocStalenessReport.staleFiles.length > 0) {
269
282
  console.log('\n[WARN] Some project docs were generated from older template versions:');
270
283
  for (const staleDoc of projectDocStalenessReport.staleFiles) {
@@ -281,16 +294,22 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
281
294
 
282
295
  const shouldApplyUpgrade = upgradeOptions.skipConfirmation
283
296
  ? true
284
- : await askYesNo('Apply upgrade and write migrated files?', userInterface, true);
297
+ : await askYesNo('Apply upgrade and synchronize managed files?', userInterface, true);
285
298
 
286
299
  if (!shouldApplyUpgrade) {
287
300
  console.log('Upgrade cancelled by user.');
288
301
  return;
289
302
  }
290
303
 
291
- const backup = await createBackup(resolvedTargetDirectoryPath);
304
+ await createBackup(resolvedTargetDirectoryPath);
292
305
 
293
306
  try {
307
+ const governanceSyncResult = await copyGovernanceAssetsToTarget(resolvedTargetDirectoryPath, {
308
+ includeMcpTemplate: upgradeOptions.includeMcpTemplate === true,
309
+ pruneManagedSurface: upgradeOptions.pruneManagedSurface === true,
310
+ managedSurfacePlan,
311
+ });
312
+
294
313
  await fs.writeFile(currentRulesPath, plannedRulesContent, 'utf8');
295
314
  await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.windsurfrules'), plannedRulesContent, 'utf8');
296
315
  await writeSelectedPolicy(resolvedTargetDirectoryPath, selectedProfileName);
@@ -307,8 +326,6 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
307
326
  includeCiGuardrails,
308
327
  setupDurationMs,
309
328
  projectDetection,
310
- selectedSkillDomains: selectedSkillDomainNames,
311
- compatibilityWarnings,
312
329
  runtimeEnvironment: existingOnboardingReport?.runtimeEnvironment || null,
313
330
  operationMode: 'upgrade',
314
331
  detectionTransparency,
@@ -316,6 +333,8 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
316
333
 
317
334
  console.log('\nUpgrade complete.');
318
335
  console.log(`- Rules rewritten: ${isRulesContentChanged ? 'yes' : 'no (metadata refreshed)'}`);
336
+ console.log(`- Managed stale files removed: ${governanceSyncResult.deletedManagedFiles.length}`);
337
+ console.log(`- Managed stale directories removed: ${governanceSyncResult.deletedManagedDirectories.length}`);
319
338
  console.log(`- Setup time: ${formatDuration(setupDurationMs)}`);
320
339
  console.log('- Updated files: .cursorrules, .windsurfrules, .agent-context/state/onboarding-report.json');
321
340
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Context Compiler — Rulebook compilation and state persistence.
3
- * Depends on: constants.mjs, utils.mjs, skill-selector.mjs
3
+ * Depends on: constants.mjs, utils.mjs
4
4
  */
5
5
  import fs from 'node:fs/promises';
6
6
  import path from 'node:path';
@@ -8,7 +8,6 @@ import path from 'node:path';
8
8
  import {
9
9
  CLI_VERSION,
10
10
  POLICY_FILE_NAME,
11
- SKILL_PLATFORM_INDEX_PATH,
12
11
  BLUEPRINT_RECOMMENDATIONS,
13
12
  } from './constants.mjs';
14
13
 
@@ -17,10 +16,6 @@ import {
17
16
  collectFileNames,
18
17
  } from './utils.mjs';
19
18
 
20
- import {
21
- inferSkillDomainNamesFromSelection,
22
- } from './skill-selector.mjs';
23
-
24
19
  import {
25
20
  readTokenOptimizationState,
26
21
  buildTokenOptimizationGuidanceBlock,
@@ -49,8 +44,6 @@ export async function writeOnboardingReport({
49
44
  includeCiGuardrails,
50
45
  setupDurationMs,
51
46
  projectDetection,
52
- selectedSkillDomains = [],
53
- compatibilityWarnings = [],
54
47
  runtimeEnvironment = null,
55
48
  operationMode = 'init',
56
49
  tokenOptimization = undefined,
@@ -90,8 +83,6 @@ export async function writeOnboardingReport({
90
83
  },
91
84
  ciGuardrailsEnabled: includeCiGuardrails,
92
85
  setupDurationMs,
93
- selectedSkillDomains,
94
- compatibilityWarnings,
95
86
  runtimeEnvironment,
96
87
  tokenOptimization: resolvedTokenOptimization,
97
88
  memoryContinuity: resolvedMemoryContinuity,
@@ -141,7 +132,6 @@ export async function buildCompiledRulesContent({
141
132
  const selectedRulesDirectoryPath = path.join(resolvedTargetDirectoryPath, '.agent-context', 'rules');
142
133
  const selectedStacksDirectoryPath = path.join(resolvedTargetDirectoryPath, '.agent-context', 'stacks');
143
134
  const selectedBlueprintsDirectoryPath = path.join(resolvedTargetDirectoryPath, '.agent-context', 'blueprints');
144
- const skillPlatformIndex = JSON.parse(await fs.readFile(SKILL_PLATFORM_INDEX_PATH, 'utf8'));
145
135
  const normalizedAdditionalStackFileNames = Array.isArray(selectedAdditionalStackFileNames)
146
136
  ? Array.from(new Set(selectedAdditionalStackFileNames.filter((stackFileName) => stackFileName && stackFileName !== selectedStackFileName)))
147
137
  : [];
@@ -150,22 +140,12 @@ export async function buildCompiledRulesContent({
150
140
  (blueprintFileName) => blueprintFileName && blueprintFileName !== selectedBlueprintFileName
151
141
  )))
152
142
  : [];
153
- const selectedSkillDomainNames = inferSkillDomainNamesFromSelection(
154
- selectedStackFileName,
155
- selectedBlueprintFileName,
156
- normalizedAdditionalStackFileNames,
157
- normalizedAdditionalBlueprintFileNames
158
- );
159
143
 
160
144
  const universalRuleFileNames = await collectFileNames(selectedRulesDirectoryPath);
145
+ const availableStackProfileFileNames = new Set(await collectFileNames(selectedStacksDirectoryPath));
146
+ const availableBlueprintProfileFileNames = new Set(await collectFileNames(selectedBlueprintsDirectoryPath));
161
147
  const contextBlocks = [];
162
148
 
163
- function resolveSkillPackFileName(skillDomainEntry, selectedTierName) {
164
- return skillDomainEntry.tierToPackFileNames?.[selectedTierName]
165
- || skillDomainEntry.tierToPackFileNames?.[skillDomainEntry.defaultTier]
166
- || skillDomainEntry.defaultPackFileName;
167
- }
168
-
169
149
  function firstMarkdownHeading(content, fallbackLabel) {
170
150
  const headingLine = content
171
151
  .split(/\r?\n/)
@@ -178,21 +158,27 @@ export async function buildCompiledRulesContent({
178
158
  return headingLine.replace(/^#+\s*/, '').trim();
179
159
  }
180
160
 
161
+ function humanizeProfileName(fileName) {
162
+ return String(fileName || '')
163
+ .replace(/\.md$/i, '')
164
+ .replace(/[-_]/g, ' ')
165
+ .trim();
166
+ }
167
+
181
168
  contextBlocks.push(
182
169
  [
183
170
  '## BOOTSTRAP CHAIN (MANDATORY)',
184
171
  'Load every layer before responding. Do not skip steps:',
185
172
  '1. .agent-context/rules/',
186
- '2. .agent-context/stacks/ (lazy by task scope)',
187
- '3. .agent-context/blueprints/',
188
- '4. .agent-context/skills/',
189
- '5. .agent-context/prompts/',
190
- '6. .agent-context/profiles/',
191
- '7. .agent-context/state/',
192
- `8. .agent-context/policies/${POLICY_FILE_NAME}`,
173
+ '2. Resolve architecture and stack signals from project context and live evidence.',
174
+ '3. .agent-context/prompts/',
175
+ '4. Dynamic architecture and stack signals (from project context + research evidence)',
176
+ '5. .agent-context/state/',
177
+ `6. .agent-context/policies/${POLICY_FILE_NAME}`,
178
+ '7. docs/ project context (or bootstrap prompts when docs are not materialized)',
193
179
  '',
194
- 'Primary entrypoint: .cursorrules',
195
- 'Mirror entrypoint: .windsurfrules',
180
+ 'Primary entrypoint: .agent-instructions.md',
181
+ 'Adapter entrypoints: .cursorrules, .windsurfrules, .clauderc, .gemini/instructions.md, .github/copilot-instructions.md',
196
182
  'Canonical baseline: .instructions.md',
197
183
  ].join('\n')
198
184
  );
@@ -208,12 +194,16 @@ export async function buildCompiledRulesContent({
208
194
  );
209
195
 
210
196
  const stackFilePath = path.join(selectedStacksDirectoryPath, selectedStackFileName);
211
- const stackContent = await fs.readFile(stackFilePath, 'utf8');
212
- const stackSummary = firstMarkdownHeading(stackContent, selectedStackFileName);
197
+ const hasStackProfileFile = availableStackProfileFileNames.has(selectedStackFileName);
198
+ const stackSummary = hasStackProfileFile
199
+ ? firstMarkdownHeading(await fs.readFile(stackFilePath, 'utf8'), selectedStackFileName)
200
+ : `Dynamic stack strategy signal for ${humanizeProfileName(selectedStackFileName)}.`;
213
201
  contextBlocks.push(
214
202
  [
215
203
  `## LAYER 2: STACK PROFILE (${selectedStackFileName})`,
216
- `Source: .agent-context/stacks/${selectedStackFileName}`,
204
+ hasStackProfileFile
205
+ ? `Source: stack-profile:${selectedStackFileName}`
206
+ : 'Source: dynamic-research-signal (static stack profile file not required)',
217
207
  `Summary: ${stackSummary}`,
218
208
  'Load this stack profile to enforce language-specific conventions.',
219
209
  ].join('\n')
@@ -224,7 +214,13 @@ export async function buildCompiledRulesContent({
224
214
  [
225
215
  '## LAYER 2B: ADDITIONAL STACK PROFILES',
226
216
  'This project uses multiple stacks. Load all additional stack profiles below:',
227
- ...normalizedAdditionalStackFileNames.map((stackFileName, stackIndex) => `${stackIndex + 1}. .agent-context/stacks/${stackFileName}`),
217
+ ...normalizedAdditionalStackFileNames.map((stackFileName, stackIndex) => {
218
+ if (availableStackProfileFileNames.has(stackFileName)) {
219
+ return `${stackIndex + 1}. stack-profile:${stackFileName}`;
220
+ }
221
+
222
+ return `${stackIndex + 1}. ${stackFileName} (dynamic stack signal)`;
223
+ }),
228
224
  ].join('\n')
229
225
  );
230
226
  }
@@ -232,9 +228,17 @@ export async function buildCompiledRulesContent({
232
228
  contextBlocks.push(
233
229
  [
234
230
  '## LAYER 2 POLICY: LAZY RULE LOADING',
235
- `Primary stack profile is always loaded for this project: .agent-context/stacks/${selectedStackFileName}`,
231
+ hasStackProfileFile
232
+ ? `Primary stack profile is always loaded for this project: stack-profile:${selectedStackFileName}`
233
+ : `Primary stack strategy is always loaded for this project: ${selectedStackFileName} (dynamic mode)`,
236
234
  normalizedAdditionalStackFileNames.length > 0
237
- ? `Additional stack profiles load on demand: ${normalizedAdditionalStackFileNames.map((stackFileName) => `.agent-context/stacks/${stackFileName}`).join(', ')}`
235
+ ? `Additional stack profiles load on demand: ${normalizedAdditionalStackFileNames.map((stackFileName) => {
236
+ if (availableStackProfileFileNames.has(stackFileName)) {
237
+ return `stack-profile:${stackFileName}`;
238
+ }
239
+
240
+ return `${stackFileName} (dynamic signal)`;
241
+ }).join(', ')}`
238
242
  : 'Additional stack profiles load only when explicitly selected or detected.',
239
243
  'Load stack guidance only when task scope touches that stack.',
240
244
  'Avoid eager loading unrelated stack profiles to prevent instruction conflicts.',
@@ -242,12 +246,16 @@ export async function buildCompiledRulesContent({
242
246
  );
243
247
 
244
248
  const blueprintFilePath = path.join(selectedBlueprintsDirectoryPath, selectedBlueprintFileName);
245
- const blueprintContent = await fs.readFile(blueprintFilePath, 'utf8');
246
- const blueprintSummary = firstMarkdownHeading(blueprintContent, selectedBlueprintFileName);
249
+ const hasBlueprintProfileFile = availableBlueprintProfileFileNames.has(selectedBlueprintFileName);
250
+ const blueprintSummary = hasBlueprintProfileFile
251
+ ? firstMarkdownHeading(await fs.readFile(blueprintFilePath, 'utf8'), selectedBlueprintFileName)
252
+ : `Dynamic architecture strategy signal for ${humanizeProfileName(selectedBlueprintFileName)}.`;
247
253
  contextBlocks.push(
248
254
  [
249
255
  `## LAYER 3: BLUEPRINT PROFILE (${selectedBlueprintFileName})`,
250
- `Source: .agent-context/blueprints/${selectedBlueprintFileName}`,
256
+ hasBlueprintProfileFile
257
+ ? `Source: architecture-profile:${selectedBlueprintFileName}`
258
+ : 'Source: dynamic-research-signal (static blueprint profile file not required)',
251
259
  `Summary: ${blueprintSummary}`,
252
260
  'Load this blueprint when scaffolding or changing architecture boundaries.',
253
261
  ].join('\n')
@@ -258,42 +266,31 @@ export async function buildCompiledRulesContent({
258
266
  [
259
267
  '## LAYER 3A: ADDITIONAL BLUEPRINT PROFILES',
260
268
  'This project uses multiple architecture blueprints. Load all additional blueprint profiles below:',
261
- ...normalizedAdditionalBlueprintFileNames.map(
262
- (blueprintFileName, blueprintIndex) => `${blueprintIndex + 1}. .agent-context/blueprints/${blueprintFileName}`
263
- ),
264
- ].join('\n')
265
- );
266
- }
269
+ ...normalizedAdditionalBlueprintFileNames.map((blueprintFileName, blueprintIndex) => {
270
+ if (availableBlueprintProfileFileNames.has(blueprintFileName)) {
271
+ return `${blueprintIndex + 1}. architecture-profile:${blueprintFileName}`;
272
+ }
267
273
 
268
- if (includeCiGuardrails) {
269
- contextBlocks.push(
270
- [
271
- '## LAYER 3B: CI/CD GUARDRAILS',
272
- 'Load these CI blueprints when pipeline or release logic is touched:',
273
- '1. .agent-context/blueprints/ci-github-actions.md',
274
- '2. .agent-context/blueprints/ci-gitlab.md',
274
+ return `${blueprintIndex + 1}. ${blueprintFileName} (dynamic architecture signal)`;
275
+ }),
275
276
  ].join('\n')
276
277
  );
277
278
  }
278
279
 
279
- for (const selectedSkillDomainName of selectedSkillDomainNames) {
280
- const skillDomainEntry = skillPlatformIndex.domains?.[selectedSkillDomainName];
281
- if (!skillDomainEntry) {
282
- continue;
283
- }
280
+ if (includeCiGuardrails) {
281
+ const ciBlueprintEntries = ['ci-github-actions.md', 'ci-gitlab.md'].map((ciBlueprintFileName, ciBlueprintIndex) => {
282
+ if (availableBlueprintProfileFileNames.has(ciBlueprintFileName)) {
283
+ return `${ciBlueprintIndex + 1}. architecture-profile:${ciBlueprintFileName}`;
284
+ }
284
285
 
285
- const selectedTierName = skillPlatformIndex.defaultTier || 'advance';
286
- const resolvedPackFileName = resolveSkillPackFileName(skillDomainEntry, selectedTierName);
286
+ return `${ciBlueprintIndex + 1}. ${ciBlueprintFileName} (dynamic CI policy signal)`;
287
+ });
287
288
 
288
289
  contextBlocks.push(
289
290
  [
290
- `## SKILL PACK: ${skillDomainEntry.displayName}`,
291
- `Source: .agent-context/skills/${resolvedPackFileName}`,
292
- `Default tier: ${skillDomainEntry.defaultTier}`,
293
- `Selected tier: ${selectedTierName}`,
294
- `Evidence: ${skillDomainEntry.evidence}`,
295
- `Purpose: ${skillDomainEntry.description}`,
296
- 'Load this skill pack and apply every Must-Have Check.',
291
+ '## LAYER 3B: CI/CD GUARDRAILS',
292
+ 'Load these CI blueprints when pipeline or release logic is touched:',
293
+ ...ciBlueprintEntries,
297
294
  ].join('\n')
298
295
  );
299
296
  }
@@ -325,8 +322,8 @@ export async function buildCompiledRulesContent({
325
322
  [
326
323
  '## REVIEW CHECKLISTS (MANDATORY)',
327
324
  '1. .agent-context/review-checklists/pr-checklist.md',
328
- '2. .agent-context/review-checklists/security-audit.md (when security-sensitive)',
329
- '3. .agent-context/review-checklists/performance-audit.md (when perf-critical)',
325
+ '2. .agent-context/review-checklists/architecture-review.md',
326
+ 'Security and performance checks are consolidated inside these two checklist files.',
330
327
  'Do not claim done before checklist pass.',
331
328
  ].join('\n')
332
329
  );
@@ -370,6 +367,11 @@ export async function buildCompiledRulesContent({
370
367
  'Read them before writing any application code:',
371
368
  ...projectDocsEntries.map((docFileName, docIndex) => `${docIndex + 1}. docs/${docFileName}`),
372
369
  '',
370
+ 'Universal SOP hard block policy:',
371
+ '- Stop implementation if docs/architecture-decision-record.md (alias: docs/Architecture-Decision-Record.md) is missing.',
372
+ '- For UI scope, stop implementation if docs/DESIGN.md is missing.',
373
+ '- Materialize missing docs first, then continue coding.',
374
+ '',
373
375
  'These docs were generated during project initialization and reflect the architecture,',
374
376
  'database design, API contracts, and application flows chosen for this project.',
375
377
  'Latest user prompt defines current feature scope and product direction.',
@@ -397,10 +399,11 @@ export async function buildCompiledRulesContent({
397
399
  ...bootstrapPromptEntries.map((promptFilePath, promptIndex) => `${promptIndex + 1}. ${promptFilePath}`),
398
400
  '',
399
401
  'Bootstrap policy:',
402
+ '- Hard block: do not write application code until docs/project-brief.md and docs/architecture-decision-record.md exist.',
400
403
  '- If docs/project-brief.md is missing, execute bootstrap-project-context prompt immediately.',
401
404
  hasBootstrapDesignPrompt
402
- ? '- If docs/DESIGN.md is missing, execute bootstrap-design prompt before implementing UI surfaces.'
403
- : '- If UI scope is later introduced, add a design bootstrap prompt before implementing UI surfaces.',
405
+ ? '- For UI scope: if docs/DESIGN.md is missing, execute bootstrap-design prompt before implementing UI surfaces.'
406
+ : '- For UI scope: add a design bootstrap prompt before implementing UI surfaces.',
404
407
  '- Save generated docs under docs/ and keep them updated when feature scope changes.',
405
408
  'Latest user prompt defines current feature scope and product direction.',
406
409
  'Treat synthesized docs as living references, then continue implementation with those docs as source of truth.',
@@ -452,8 +455,10 @@ export async function compileDynamicContext({
452
455
  includeCiGuardrails,
453
456
  });
454
457
 
458
+ await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.agent-instructions.md'), compiledRules, 'utf8');
455
459
  await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.cursorrules'), compiledRules, 'utf8');
456
460
  await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.windsurfrules'), compiledRules, 'utf8');
461
+ await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.clauderc'), compiledRules, 'utf8');
457
462
 
458
463
  // Gemini (Antigravity Editor) instructions
459
464
  const geminiDir = path.join(resolvedTargetDirectoryPath, '.gemini');
@@ -13,8 +13,6 @@ export const REPO_ROOT = resolve(currentDirectoryPath, '..', '..');
13
13
  export const PACKAGE_JSON_PATH = join(REPO_ROOT, 'package.json');
14
14
  export const CLI_VERSION = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8')).version;
15
15
  export const AGENT_CONTEXT_DIR = join(REPO_ROOT, '.agent-context');
16
- export const SKILL_PLATFORM_DIRECTORY = join(AGENT_CONTEXT_DIR, 'skills');
17
- export const SKILL_PLATFORM_INDEX_PATH = join(SKILL_PLATFORM_DIRECTORY, 'index.json');
18
16
  export const POLICY_FILE_NAME = 'llm-judge-threshold.json';
19
17
  export const PROFILE_PACKS_DIRECTORY_NAME = 'profiles';
20
18
 
@@ -43,6 +41,81 @@ export const BLUEPRINT_RECOMMENDATIONS = {
43
41
  'flutter.md': 'mobile-app.md',
44
42
  };
45
43
 
44
+ export const FALLBACK_STACK_FILE_NAMES = [
45
+ 'typescript.md',
46
+ 'python.md',
47
+ 'go.md',
48
+ 'java.md',
49
+ 'php.md',
50
+ 'csharp.md',
51
+ 'rust.md',
52
+ 'ruby.md',
53
+ 'react-native.md',
54
+ 'flutter.md',
55
+ ];
56
+
57
+ export const FALLBACK_BLUEPRINT_FILE_NAMES = [
58
+ 'api-nextjs.md',
59
+ 'nestjs-logic.md',
60
+ 'fastapi-service.md',
61
+ 'spring-boot-api.md',
62
+ 'go-service.md',
63
+ 'aspnet-api.md',
64
+ 'laravel-api.md',
65
+ 'graphql-grpc-api.md',
66
+ 'ci-github-actions.md',
67
+ 'ci-gitlab.md',
68
+ 'kubernetes-manifests.md',
69
+ 'infrastructure-as-code.md',
70
+ 'observability.md',
71
+ 'mobile-app.md',
72
+ ];
73
+
74
+ export const FALLBACK_PROFILE_PACK_DEFINITIONS = [
75
+ {
76
+ fileName: 'startup.md',
77
+ slug: 'startup',
78
+ displayName: 'Startup Team',
79
+ description: 'Fast iteration with balanced guardrails and quick onboarding defaults.',
80
+ defaultProfileName: 'balanced',
81
+ defaultStackFileName: 'typescript.md',
82
+ defaultBlueprintFileName: 'api-nextjs.md',
83
+ defaultCi: true,
84
+ lockCi: false,
85
+ blockingSeverities: ['critical', 'high'],
86
+ owner: 'product-engineering',
87
+ lastUpdated: '2026-03-19',
88
+ },
89
+ {
90
+ fileName: 'regulated.md',
91
+ slug: 'regulated',
92
+ displayName: 'Regulated Team',
93
+ description: 'Compliance-first defaults with strict policy and locked CI guardrails.',
94
+ defaultProfileName: 'strict',
95
+ defaultStackFileName: 'typescript.md',
96
+ defaultBlueprintFileName: 'api-nextjs.md',
97
+ defaultCi: true,
98
+ lockCi: true,
99
+ blockingSeverities: ['critical', 'high', 'medium'],
100
+ owner: 'governance-office',
101
+ lastUpdated: '2026-03-19',
102
+ },
103
+ {
104
+ fileName: 'platform.md',
105
+ slug: 'platform',
106
+ displayName: 'Platform Team',
107
+ description: 'Reliability-oriented defaults for shared platform modules across teams.',
108
+ defaultProfileName: 'balanced',
109
+ defaultStackFileName: 'go.md',
110
+ defaultBlueprintFileName: 'go-service.md',
111
+ defaultCi: true,
112
+ lockCi: false,
113
+ blockingSeverities: ['critical', 'high'],
114
+ owner: 'platform-foundation',
115
+ lastUpdated: '2026-03-19',
116
+ },
117
+ ];
118
+
46
119
  export const INIT_PRESETS = {
47
120
  'frontend-web': {
48
121
  profile: 'balanced',
@@ -164,38 +237,23 @@ export const GOLDEN_STANDARD_PROFILE_NAME = 'balanced';
164
237
 
165
238
  export const PROJECT_SCOPE_CHOICES = [
166
239
  {
167
- key: 'api-service',
168
- label: 'API service',
169
- },
170
- {
171
- key: 'web-application',
172
- label: 'Web application',
173
- },
174
- {
175
- key: 'mobile-app',
176
- label: 'Mobile app',
177
- },
178
- {
179
- key: 'cli-tool',
180
- label: 'CLI tool',
240
+ key: 'frontend-only',
241
+ label: 'Frontend only',
181
242
  },
182
243
  {
183
- key: 'library-sdk',
184
- label: 'Library / SDK',
244
+ key: 'backend-only',
245
+ label: 'Backend only',
185
246
  },
186
247
  {
187
- key: 'other',
188
- label: 'Other',
248
+ key: 'both',
249
+ label: 'Both (frontend + backend)',
189
250
  },
190
251
  ];
191
252
 
192
253
  export const PROJECT_SCOPE_STACK_FILTERS = {
193
- 'api-service': ['typescript.md', 'python.md', 'go.md', 'java.md', 'php.md', 'csharp.md', 'ruby.md', 'rust.md'],
194
- 'web-application': ['typescript.md', 'python.md', 'go.md', 'java.md', 'php.md', 'csharp.md', 'ruby.md', 'rust.md'],
195
- 'mobile-app': ['react-native.md', 'flutter.md'],
196
- 'cli-tool': ['typescript.md', 'python.md', 'go.md', 'rust.md', 'ruby.md', 'java.md', 'csharp.md'],
197
- 'library-sdk': ['typescript.md', 'python.md', 'go.md', 'rust.md', 'java.md', 'csharp.md', 'php.md', 'ruby.md'],
198
- other: null,
254
+ 'frontend-only': ['typescript.md'],
255
+ 'backend-only': ['typescript.md', 'python.md', 'go.md', 'java.md', 'php.md', 'csharp.md', 'ruby.md', 'rust.md'],
256
+ both: ['typescript.md', 'python.md', 'go.md', 'java.md', 'php.md', 'csharp.md', 'ruby.md', 'rust.md'],
199
257
  };
200
258
 
201
259
  export const WEB_FRONTEND_STACK_CANDIDATES = ['typescript.md'];