@ryuenn3123/agentic-senior-core 3.0.47 → 3.0.48

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 (50) hide show
  1. package/.agent-context/prompts/init-project.md +2 -2
  2. package/.agent-context/rules/architecture.md +2 -2
  3. package/.agent-context/state/architecture-map.md +3 -3
  4. package/.agent-context/state/dependency-map.md +2 -2
  5. package/AGENTS.md +170 -35
  6. package/CLAUDE.md +1 -44
  7. package/CONTRIBUTING.md +2 -3
  8. package/GEMINI.md +1 -44
  9. package/README.md +24 -22
  10. package/lib/cli/commands/init.mjs +10 -28
  11. package/lib/cli/commands/optimize.mjs +2 -48
  12. package/lib/cli/commands/upgrade.mjs +9 -51
  13. package/lib/cli/compiler.mjs +8 -93
  14. package/lib/cli/constants.mjs +1 -9
  15. package/lib/cli/detector.mjs +0 -1
  16. package/lib/cli/init-options.mjs +1 -1
  17. package/lib/cli/utils/filesystem.mjs +2 -0
  18. package/lib/cli/utils/managed-surface.mjs +45 -2
  19. package/lib/cli/utils.mjs +19 -4
  20. package/package.json +1 -10
  21. package/scripts/bump-version.mjs +1 -16
  22. package/scripts/docs-quality-drift-report.mjs +0 -6
  23. package/scripts/frontend-usability-audit.mjs +2 -2
  24. package/scripts/governance-weekly-report.mjs +2 -2
  25. package/scripts/single-source-lazy-loading-audit.mjs +13 -126
  26. package/scripts/sync-thin-adapters.mjs +13 -121
  27. package/scripts/validate/config.mjs +14 -25
  28. package/scripts/validate/coverage-checks.mjs +9 -76
  29. package/scripts/validate.mjs +12 -97
  30. package/.agent-override.md +0 -36
  31. package/.agents/workflows/init-project.md +0 -12
  32. package/.agents/workflows/refactor.md +0 -12
  33. package/.agents/workflows/review-code.md +0 -11
  34. package/.cursor/mcp.json +0 -10
  35. package/.cursor/rules/agentic-senior-core.mdc +0 -49
  36. package/.cursorrules +0 -26
  37. package/.gemini/instructions.md +0 -44
  38. package/.github/copilot-instructions.md +0 -44
  39. package/.github/instructions/agentic-senior-core.instructions.md +0 -48
  40. package/.github/workflows/benchmark-detection.yml +0 -45
  41. package/.github/workflows/benchmark-intelligence.yml +0 -50
  42. package/.github/workflows/docs-quality-drift-report.yml +0 -37
  43. package/.github/workflows/frontend-usability-gate.yml +0 -36
  44. package/.github/workflows/governance-weekly-report.yml +0 -43
  45. package/.github/workflows/publish.yml +0 -32
  46. package/.github/workflows/release-gate.yml +0 -32
  47. package/.github/workflows/sbom-compliance.yml +0 -32
  48. package/.instructions.md +0 -187
  49. package/.windsurf/rules/agentic-senior-core.md +0 -44
  50. package/.windsurfrules +0 -26
@@ -2,11 +2,7 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
 
4
4
  import { ensureDirectory, formatDuration } from '../utils.mjs';
5
- import { compileDynamicContext, loadOnboardingReportIfExists } from '../compiler.mjs';
6
- import {
7
- AGENT_DECISION_STACK_FILE_NAME,
8
- AGENT_DECISION_BLUEPRINT_FILE_NAME,
9
- } from '../constants.mjs';
5
+ import { loadOnboardingReportIfExists } from '../compiler.mjs';
10
6
  import {
11
7
  TOKEN_OPTIMIZATION_REPORT_FILE_NAME,
12
8
  normalizeAgentName,
@@ -18,17 +14,6 @@ import {
18
14
  writeTokenOptimizationState,
19
15
  } from '../token-optimization.mjs';
20
16
 
21
- function normalizeMarkdownFileName(rawFileName, fallbackFileName) {
22
- if (typeof rawFileName !== 'string' || rawFileName.trim().length === 0) {
23
- return fallbackFileName;
24
- }
25
-
26
- const normalizedFileName = rawFileName.trim();
27
- return normalizedFileName.endsWith('.md')
28
- ? normalizedFileName
29
- : `${normalizedFileName}.md`;
30
- }
31
-
32
17
  export function parseOptimizeArguments(commandArguments) {
33
18
  const parsedOptimizeOptions = {
34
19
  targetDirectory: '.',
@@ -119,37 +104,6 @@ export async function runOptimizeCommand(targetDirectoryArgument, optimizeOption
119
104
 
120
105
  await writeTokenOptimizationState(resolvedTargetDirectoryPath, tokenOptimizationState);
121
106
 
122
- const hasExplicitRuntimeConstraint = onboardingReport?.runtimeDecision?.mode === 'explicit-constraint';
123
- const hasExplicitArchitectureConstraint = onboardingReport?.architectureDecision?.mode === 'explicit-constraint';
124
- const selectedStackFileName = hasExplicitRuntimeConstraint
125
- ? normalizeMarkdownFileName(onboardingReport.selectedStack, AGENT_DECISION_STACK_FILE_NAME)
126
- : AGENT_DECISION_STACK_FILE_NAME;
127
- const selectedAdditionalStackFileNames = hasExplicitRuntimeConstraint && Array.isArray(onboardingReport.selectedAdditionalStacks)
128
- ? onboardingReport.selectedAdditionalStacks
129
- .map((stackFileName) => normalizeMarkdownFileName(stackFileName, ''))
130
- .filter((stackFileName) => stackFileName && stackFileName !== selectedStackFileName)
131
- : [];
132
- const selectedBlueprintFileName = hasExplicitArchitectureConstraint
133
- ? normalizeMarkdownFileName(onboardingReport.selectedBlueprint, AGENT_DECISION_BLUEPRINT_FILE_NAME)
134
- : AGENT_DECISION_BLUEPRINT_FILE_NAME;
135
- const selectedAdditionalBlueprintFileNames = hasExplicitArchitectureConstraint && Array.isArray(onboardingReport.selectedAdditionalBlueprints)
136
- ? onboardingReport.selectedAdditionalBlueprints
137
- .map((blueprintFileName) => normalizeMarkdownFileName(blueprintFileName, ''))
138
- .filter((blueprintFileName) => blueprintFileName && blueprintFileName !== selectedBlueprintFileName)
139
- : [];
140
- const includeCiGuardrails = typeof onboardingReport.ciGuardrailsEnabled === 'boolean'
141
- ? onboardingReport.ciGuardrailsEnabled
142
- : true;
143
-
144
- await compileDynamicContext({
145
- targetDirectoryPath: resolvedTargetDirectoryPath,
146
- selectedStackFileName,
147
- selectedAdditionalStackFileNames,
148
- selectedBlueprintFileName,
149
- selectedAdditionalBlueprintFileNames,
150
- includeCiGuardrails,
151
- });
152
-
153
107
  const optimizationDurationMs = Date.now() - optimizationStartedAt;
154
108
  const tokenOptimizationReport = {
155
109
  generatedAt: new Date().toISOString(),
@@ -174,7 +128,7 @@ export async function runOptimizeCommand(targetDirectoryArgument, optimizeOption
174
128
  console.log(`- Agent profile: ${tokenOptimizationState.selectedAgent}`);
175
129
  console.log(`- Preferred shell proxy: ${tokenOptimizationState.preferredShellProxy}`);
176
130
  console.log(`- Setup time: ${formatDuration(optimizationDurationMs)}`);
177
- console.log('- Updated files: .agent-instructions.md, legacy thin adapters, and .agent-context/state/token-optimization.json');
131
+ console.log('- Updated files: .agent-context/state/token-optimization.json and .agent-context/state/token-optimization-report.json');
178
132
 
179
133
  if (tokenOptimizationState.enabled) {
180
134
  if (rtkDetection.isAvailable) {
@@ -33,8 +33,6 @@ import {
33
33
  detectUiScopeSignals,
34
34
  } from '../detector.mjs';
35
35
  import {
36
- buildCompiledRulesContent,
37
- compileDynamicContext,
38
36
  writeSelectedPolicy,
39
37
  writeOnboardingReport,
40
38
  loadOnboardingReportIfExists,
@@ -55,7 +53,7 @@ export function parseUpgradeArguments(commandArguments) {
55
53
  targetDirectory: '.',
56
54
  dryRun: false,
57
55
  skipConfirmation: false,
58
- includeMcpTemplate: true,
56
+ includeMcpTemplate: false,
59
57
  pruneManagedSurface: true,
60
58
  };
61
59
 
@@ -243,19 +241,10 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
243
241
  declarationShown: true,
244
242
  detectionSummary: buildDetectionSummary(projectDetection),
245
243
  activeRulesSummary: {
246
- canonicalSource: '.instructions.md',
247
- compiledRulebook: '.agent-instructions.md',
248
- legacyThinAdapters: ['.cursorrules', '.windsurfrules', '.clauderc'],
249
- generatedBridgeAdapters: [
250
- 'AGENTS.md',
251
- 'CLAUDE.md',
252
- 'GEMINI.md',
253
- '.cursor/rules/agentic-senior-core.mdc',
254
- '.windsurf/rules/agentic-senior-core.md',
255
- '.github/copilot-instructions.md',
256
- '.github/instructions/agentic-senior-core.instructions.md',
257
- '.gemini/instructions.md',
258
- ],
244
+ canonicalSource: 'AGENTS.md',
245
+ compiledRulebook: null,
246
+ legacyThinAdapters: [],
247
+ generatedBridgeAdapters: ['CLAUDE.md', 'GEMINI.md'],
259
248
  stackLoadingMode: 'lazy',
260
249
  domainRuleLoadingMode: 'lazy',
261
250
  selectedProfile: selectedProfileName,
@@ -285,7 +274,7 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
285
274
  } else {
286
275
  console.log('- Detected stack: unresolved (insufficient markers).');
287
276
  }
288
- console.log('- Active rules baseline: canonical .instructions.md -> compiled .agent-instructions.md + legacy thin root adapters');
277
+ console.log('- Active rules baseline: canonical AGENTS.md + .agent-context/ lazy rule library');
289
278
  console.log(
290
279
  `- Active review thresholds: ${(
291
280
  PROFILE_PRESETS[selectedProfileName]?.blockingSeverities || []
@@ -300,24 +289,6 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
300
289
 
301
290
  const projectDocStalenessReport = await detectProjectDocTemplateStaleness(resolvedTargetDirectoryPath);
302
291
 
303
- const currentRulesPath = path.join(resolvedTargetDirectoryPath, '.agent-instructions.md');
304
- const currentRulesContent = await pathExists(currentRulesPath)
305
- ? await fs.readFile(currentRulesPath, 'utf8')
306
- : '';
307
-
308
- const plannedRulesContent = await buildCompiledRulesContent({
309
- targetDirectoryPath: resolvedTargetDirectoryPath,
310
- selectedStackFileName,
311
- selectedAdditionalStackFileNames,
312
- selectedBlueprintFileName,
313
- selectedAdditionalBlueprintFileNames,
314
- includeCiGuardrails,
315
- });
316
-
317
- const isRulesContentChanged = currentRulesContent !== plannedRulesContent;
318
- const currentRuleLineCount = currentRulesContent ? currentRulesContent.split(/\r?\n/).length : 0;
319
- const plannedRuleLineCount = plannedRulesContent.split(/\r?\n/).length;
320
-
321
292
  console.log('\nUpgrade preview:');
322
293
  console.log(`- Target directory: ${resolvedTargetDirectoryPath}`);
323
294
  console.log(`- Runtime decision: ${selectedStackFileName === AGENT_DECISION_STACK_FILE_NAME ? 'agent recommendation required from repo evidence' : toTitleCase(selectedStackFileName)}`);
@@ -329,14 +300,12 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
329
300
  console.log(`- Additional blueprints: ${selectedAdditionalBlueprintFileNames.map((blueprintFileName) => toTitleCase(blueprintFileName)).join(', ')}`);
330
301
  }
331
302
  console.log(`- CI/CD quality checks (guardrails): ${includeCiGuardrails ? 'enabled' : 'disabled'}`);
332
- console.log(`- Existing rules lines: ${currentRuleLineCount}`);
333
- console.log(`- Planned rules lines: ${plannedRuleLineCount}`);
334
- console.log(`- Rules changed: ${isRulesContentChanged ? 'yes' : 'no'}`);
303
+ console.log('- Instruction surface: AGENTS.md canonical with CLAUDE.md and GEMINI.md import bridges');
335
304
  console.log(`- Managed surface stale files: ${managedSurfacePlan.staleFiles.length}`);
336
305
  console.log(`- Managed surface stale directories: ${managedSurfacePlan.staleDirectories.length}`);
337
306
  console.log(`- Managed surface sync mode: 1:1 (prune enabled)`);
338
307
  console.log(`- Managed surface prune mode: ${upgradeOptions.pruneManagedSurface === true ? 'enabled (default)' : 'disabled (--no-prune)'}`);
339
- console.log(`- MCP config write mode: ${upgradeOptions.includeMcpTemplate === true ? 'enabled (default)' : 'disabled (--no-mcp-template)'}`);
308
+ console.log(`- MCP config write mode: ${upgradeOptions.includeMcpTemplate === true ? 'enabled (--mcp-template)' : 'disabled (default)'}`);
340
309
  if (projectDocStalenessReport.hasProjectDocs) {
341
310
  console.log(`- Project docs detected: ${projectDocStalenessReport.checkedFileNames.length}`);
342
311
  console.log(`- Project docs expected template version: ${projectDocStalenessReport.expectedTemplateVersion}`);
@@ -431,15 +400,6 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
431
400
  }
432
401
  }
433
402
 
434
- const compileResult = await compileDynamicContext({
435
- targetDirectoryPath: resolvedTargetDirectoryPath,
436
- selectedStackFileName,
437
- selectedAdditionalStackFileNames,
438
- selectedBlueprintFileName,
439
- selectedAdditionalBlueprintFileNames,
440
- includeCiGuardrails,
441
- preserveUserOwnedEntrypoints: true,
442
- });
443
403
  await writeSelectedPolicy(resolvedTargetDirectoryPath, selectedProfileName);
444
404
 
445
405
  const setupDurationMs = Date.now() - setupStartedAt;
@@ -462,10 +422,8 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
462
422
 
463
423
  console.log('\nUpgrade complete.');
464
424
  console.log(`- Governance surface sync: 1:1 (${governanceSyncResult.updatedFiles.length} updated, ${governanceSyncResult.createdFiles.length} new, ${governanceSyncResult.deletedManagedFiles.length} deleted, ${governanceSyncResult.unchangedFiles.length} unchanged)`);
465
- console.log(`- Rules rewritten: ${isRulesContentChanged ? 'yes' : 'no (metadata refreshed)'}`);
466
425
  const preservedInstructionEntrypoints = Array.from(new Set([
467
426
  ...(governanceSyncResult.preservedFiles || []),
468
- ...(compileResult.preservedEntrypoints || []),
469
427
  ])).sort();
470
428
  if (preservedInstructionEntrypoints.length > 0) {
471
429
  console.log(`- User-owned instruction entrypoints preserved: ${preservedInstructionEntrypoints.length}`);
@@ -494,7 +452,7 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
494
452
  supplementalCreatedFileNames.forEach((fileName) => console.log(` [NEW] ${fileName} (seed)`));
495
453
  }
496
454
 
497
- console.log('\nRefreshed files: .instructions.md, .agent-instructions.md, legacy thin adapters, generated bridge adapters, and .agent-context/state/onboarding-report.json');
455
+ console.log('\nRefreshed files: AGENTS.md, CLAUDE.md, GEMINI.md, .agent-context/, and .agent-context/state/onboarding-report.json');
498
456
  } catch (error) {
499
457
  console.error('\n[FATAL] An error occurred during upgrade. Attempting automatic rollback...');
500
458
  try {
@@ -15,7 +15,6 @@ import {
15
15
  import {
16
16
  pathExists,
17
17
  collectFileNames,
18
- isAgenticManagedContent,
19
18
  } from './utils.mjs';
20
19
 
21
20
  import {
@@ -106,38 +105,6 @@ function buildAnchorCommitmentHeader(designIntent) {
106
105
  ].join('\n');
107
106
  }
108
107
 
109
- function buildLegacyRootAdapterContent(adapterFileName, toolLabel) {
110
- return [
111
- `# ${adapterFileName} - Legacy Thin Adapter`,
112
- '',
113
- `Generated by Agentic-Senior-Core CLI v${CLI_VERSION}`,
114
- 'Adapter Mode: legacy-thin',
115
- 'Adapter Source: .agent-instructions.md when present; fallback .instructions.md',
116
- 'Canonical baseline: .instructions.md',
117
- '',
118
- `This file is kept only for older ${toolLabel} discovery.`,
119
- 'Read .agent-instructions.md for the compiled rulebook when present.',
120
- 'Use .instructions.md as the canonical policy source.',
121
- '',
122
- 'Mandatory load floor:',
123
- '1. Read .agent-instructions.md when present; otherwise read .instructions.md.',
124
- '2. Load only relevant .agent-context/rules/ by task scope.',
125
- '3. Apply matching .agent-context/prompts/ contracts.',
126
- '4. Enforce .agent-context/review-checklists/ before completion.',
127
- '5. Use .agent-context/state/ and .agent-context/policies/ only when relevant.',
128
- '6. Resolve Runtime Decision Signals from repo evidence and live official docs.',
129
- '7. Resolve Structural Planning Signals from constraints and architecture boundaries.',
130
- '',
131
- 'Current bridges:',
132
- '- Cursor: .cursor/rules/agentic-senior-core.mdc',
133
- '- Windsurf: .windsurf/rules/agentic-senior-core.md',
134
- '- Claude: CLAUDE.md',
135
- '- Gemini: GEMINI.md and .gemini/instructions.md',
136
- '- Copilot: .github/copilot-instructions.md and .github/instructions/agentic-senior-core.instructions.md',
137
- '',
138
- ].join('\n');
139
- }
140
-
141
108
  function buildContainerizationStrategySnapshot(dockerStrategy) {
142
109
  const selectedDockerStrategy = String(dockerStrategy || '').trim();
143
110
  const normalizedDockerStrategy = selectedDockerStrategy.toLowerCase();
@@ -220,7 +187,7 @@ export async function writeOnboardingReport({
220
187
  selectedBlueprint: hasExplicitArchitectureDecision ? selectedBlueprintFileName : null,
221
188
  selectedAdditionalBlueprints: hasExplicitArchitectureDecision ? selectedAdditionalBlueprintFileNames : [],
222
189
  ruleLoadingPolicy: {
223
- canonicalSource: '.instructions.md',
190
+ canonicalSource: 'AGENTS.md',
224
191
  stackLoadingMode: 'lazy',
225
192
  domainRuleLoadingMode: 'lazy',
226
193
  loadedOnDemand: true,
@@ -330,11 +297,10 @@ export async function buildCompiledRulesContent({
330
297
  `6. .agent-context/policies/${POLICY_FILE_NAME}`,
331
298
  '7. docs/ project context (or bootstrap prompts when docs are not materialized)',
332
299
  '',
333
- 'Project-specific compiled snapshot: .agent-instructions.md',
334
- 'Compiled rulebook: .agent-instructions.md',
335
- 'Legacy thin root adapters: .cursorrules, .windsurfrules, .clauderc',
336
- 'Generated bridge adapters: AGENTS.md, CLAUDE.md, GEMINI.md, .cursor/rules/agentic-senior-core.mdc, .windsurf/rules/agentic-senior-core.md, .github/copilot-instructions.md, .github/instructions/agentic-senior-core.instructions.md, .gemini/instructions.md',
337
- 'Canonical baseline: .instructions.md',
300
+ 'Canonical instruction source: AGENTS.md',
301
+ 'Native import bridges: CLAUDE.md, GEMINI.md',
302
+ 'Managed rule library: .agent-context/',
303
+ 'Project decisions and dynamic state: .agent-context/state/onboarding-report.json',
338
304
  ].join('\n')
339
305
  );
340
306
 
@@ -659,62 +625,11 @@ export async function buildCompiledRulesContent({
659
625
  `Selected policy file: .agent-context/policies/${POLICY_FILE_NAME}`,
660
626
  '',
661
627
  '## GOVERNANCE PRECEDENCE',
662
- '1. Follow this compiled rulebook as the primary source.',
663
- '2. Resolve exceptions from .agent-override.md only when explicitly defined.',
664
- '3. Use architecture-map.md and dependency-map.md as change safety boundaries.',
665
- '4. Enforce pr-checklist.md before declaring completion.',
666
- '',
667
- '## OVERRIDE PROTOCOL',
668
- '- Default: strict compliance with this file.',
669
- '- Exception path: .agent-override.md may explicitly allow narrow deviations.',
670
- '- Scope policy: every override must include module scope, rationale, and expiry date.',
628
+ '1. Follow AGENTS.md as the primary source.',
629
+ '2. Use architecture-map.md and dependency-map.md as change safety boundaries.',
630
+ '3. Enforce pr-checklist.md before declaring completion.',
671
631
  '',
672
632
  ...contextBlocks,
673
633
  '',
674
634
  ].join('\n');
675
635
  }
676
-
677
- export async function compileDynamicContext({
678
- targetDirectoryPath,
679
- selectedStackFileName,
680
- selectedAdditionalStackFileNames = [],
681
- selectedBlueprintFileName,
682
- selectedAdditionalBlueprintFileNames = [],
683
- includeCiGuardrails,
684
- preserveUserOwnedEntrypoints = true,
685
- }) {
686
- const resolvedTargetDirectoryPath = path.resolve(targetDirectoryPath);
687
- const compiledRules = await buildCompiledRulesContent({
688
- targetDirectoryPath: resolvedTargetDirectoryPath,
689
- selectedStackFileName,
690
- selectedAdditionalStackFileNames,
691
- selectedBlueprintFileName,
692
- selectedAdditionalBlueprintFileNames,
693
- includeCiGuardrails,
694
- });
695
- const preservedEntrypoints = [];
696
-
697
- async function writeGeneratedEntrypointFile(relativeFilePath, content) {
698
- const targetFilePath = path.join(resolvedTargetDirectoryPath, relativeFilePath);
699
-
700
- if (preserveUserOwnedEntrypoints && await pathExists(targetFilePath)) {
701
- const existingContent = await fs.readFile(targetFilePath, 'utf8');
702
- if (!isAgenticManagedContent(existingContent)) {
703
- preservedEntrypoints.push(relativeFilePath);
704
- return;
705
- }
706
- }
707
-
708
- await fs.mkdir(path.dirname(targetFilePath), { recursive: true });
709
- await fs.writeFile(targetFilePath, content, 'utf8');
710
- }
711
-
712
- await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.agent-instructions.md'), compiledRules, 'utf8');
713
- await writeGeneratedEntrypointFile('.cursorrules', buildLegacyRootAdapterContent('.cursorrules', 'Cursor'));
714
- await writeGeneratedEntrypointFile('.windsurfrules', buildLegacyRootAdapterContent('.windsurfrules', 'Windsurf'));
715
- await writeGeneratedEntrypointFile('.clauderc', buildLegacyRootAdapterContent('.clauderc', 'Claude'));
716
-
717
- return {
718
- preservedEntrypoints,
719
- };
720
- }
@@ -126,19 +126,11 @@ export const RUNTIME_ENVIRONMENT_CHOICES = [
126
126
  ];
127
127
 
128
128
  export const entryPointFiles = [
129
- '.instructions.md',
130
- '.cursorrules',
131
- '.windsurfrules',
132
129
  'AGENTS.md',
133
130
  'CLAUDE.md',
134
131
  'GEMINI.md',
135
- '.cursor/rules/agentic-senior-core.mdc',
136
- '.github/copilot-instructions.md',
137
- '.github/instructions/agentic-senior-core.instructions.md',
138
- '.windsurf/rules/agentic-senior-core.md',
139
- '.agent-override.md',
140
132
  ];
141
133
 
142
- export const directoryCopies = ['.agent-context', '.gemini', '.agents'];
134
+ export const directoryCopies = ['.agent-context'];
143
135
 
144
136
  export const BACKUP_DIR_NAME = '.agentic-backup';
@@ -102,7 +102,6 @@ const PROJECT_MARKER_FILE_NAMES = new Set([
102
102
  const INTERNAL_GOVERNANCE_SURFACE_NAMES = new Set([
103
103
  '.agent-context',
104
104
  '.agent-instructions.md',
105
- '.agent-override.md',
106
105
  '.agentic-backup',
107
106
  '.agents',
108
107
  '.clauderc',
@@ -23,7 +23,7 @@ export function parseInitArguments(commandArguments) {
23
23
  tokenOptimize: true,
24
24
  memoryContinuity: true,
25
25
  tokenAgent: 'copilot',
26
- includeMcpTemplate: true,
26
+ includeMcpTemplate: false,
27
27
  scaffoldDocs: undefined,
28
28
  docsLang: 'en',
29
29
  docsLangProvided: false,
@@ -51,6 +51,8 @@ export function isAgenticManagedContent(content) {
51
51
  'Adapter Mode: legacy-thin',
52
52
  'Canonical Snapshot SHA256',
53
53
  'Canonical baseline: .instructions.md',
54
+ 'canonical instruction source for this repository',
55
+ '@AGENTS.md',
54
56
  ].some((managedSignal) => normalizedContent.includes(managedSignal));
55
57
  }
56
58
 
@@ -6,7 +6,10 @@ import {
6
6
  entryPointFiles,
7
7
  directoryCopies,
8
8
  } from '../constants.mjs';
9
- import { pathExists } from './filesystem.mjs';
9
+ import {
10
+ isAgenticManagedContent,
11
+ pathExists,
12
+ } from './filesystem.mjs';
10
13
 
11
14
  function toPosixRelativePath(relativePath) {
12
15
  return relativePath.split(path.sep).join('/');
@@ -29,6 +32,34 @@ const localOnlyGovernanceFiles = new Set([
29
32
  '.agent-context/state/v3-purge-audit.json',
30
33
  ]);
31
34
 
35
+ const legacyManagedInstructionFiles = [
36
+ '.instructions.md',
37
+ '.agent-instructions.md',
38
+ '.cursorrules',
39
+ '.windsurfrules',
40
+ '.clauderc',
41
+ '.cursor/rules/agentic-senior-core.mdc',
42
+ '.windsurf/rules/agentic-senior-core.md',
43
+ '.github/copilot-instructions.md',
44
+ '.github/instructions/agentic-senior-core.instructions.md',
45
+ '.gemini/instructions.md',
46
+ '.agents/workflows/init-project.md',
47
+ '.agents/workflows/refactor.md',
48
+ '.agents/workflows/review-code.md',
49
+ ];
50
+
51
+ export const legacyManagedInstructionDirectories = [
52
+ '.agents/workflows',
53
+ '.agents',
54
+ '.cursor/rules',
55
+ '.cursor',
56
+ '.windsurf/rules',
57
+ '.windsurf',
58
+ '.github/instructions',
59
+ '.github',
60
+ '.gemini',
61
+ ];
62
+
32
63
  function isLocalOnlyGovernanceFile(relativePath) {
33
64
  return localOnlyGovernanceFiles.has(toPosixRelativePath(relativePath));
34
65
  }
@@ -171,6 +202,18 @@ async function collectManagedTargetManifest(resolvedTargetDirectoryPath, options
171
202
  targetDirectories.add(targetDirectoryPath);
172
203
  }
173
204
 
205
+ for (const legacyManagedFile of legacyManagedInstructionFiles) {
206
+ const targetFilePath = path.join(resolvedTargetDirectoryPath, ...legacyManagedFile.split('/'));
207
+ if (!(await pathExists(targetFilePath))) {
208
+ continue;
209
+ }
210
+
211
+ const targetFileContent = await fs.readFile(targetFilePath);
212
+ if (isAgenticManagedContent(targetFileContent)) {
213
+ targetFiles.add(legacyManagedFile);
214
+ }
215
+ }
216
+
174
217
  return {
175
218
  files: targetFiles,
176
219
  directories: targetDirectories,
@@ -183,7 +226,7 @@ export async function analyzeManagedGovernanceSurface(
183
226
  ) {
184
227
  const preservePathPrefixes = Array.isArray(options.preservePathPrefixes)
185
228
  ? options.preservePathPrefixes
186
- : ['.agent-context/state', '.gemini'];
229
+ : ['.agent-context/state'];
187
230
 
188
231
  const sourceManifest = await buildManagedSourceManifest(options);
189
232
  const targetManifest = await collectManagedTargetManifest(resolvedTargetDirectoryPath, options);
package/lib/cli/utils.mjs CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  import {
23
23
  collectRelativeTreeEntries,
24
24
  analyzeManagedGovernanceSurface,
25
+ legacyManagedInstructionDirectories,
25
26
  } from './utils/managed-surface.mjs';
26
27
  export {
27
28
  pathExists,
@@ -32,6 +33,7 @@ export {
32
33
  } from './utils/filesystem.mjs';
33
34
  export {
34
35
  analyzeManagedGovernanceSurface,
36
+ legacyManagedInstructionDirectories,
35
37
  } from './utils/managed-surface.mjs';
36
38
  export {
37
39
  askChoice,
@@ -71,8 +73,8 @@ export function printUsage() {
71
73
  console.log(' --no-token-optimize Disable token optimization policy during init');
72
74
  console.log(' --memory-continuity Explicitly enable cross-session memory continuity policy during init (default behavior)');
73
75
  console.log(' --no-memory-continuity Disable memory continuity policy during init');
74
- console.log(' --mcp-template Explicitly enable cross-IDE MCP auto-configuration (default behavior)');
75
- console.log(' --no-mcp-template Disable automatic MCP configuration across your IDEs');
76
+ console.log(' --mcp-template Explicitly enable cross-IDE MCP auto-configuration (opt-in)');
77
+ console.log(' --no-mcp-template Keep MCP configuration disabled (default behavior)');
76
78
  console.log(' --scaffold-docs Force project documentation scaffolding (architecture, database, API, flow)');
77
79
  console.log(' --no-scaffold-docs Skip project documentation scaffolding');
78
80
  console.log(' --docs-lang Optional override for bootstrap docs synthesis language (default: en)');
@@ -83,8 +85,8 @@ export function printUsage() {
83
85
  console.log(' --prune Keep managed governance files synchronized 1:1 (default in upgrade)');
84
86
  console.log(' --no-prune Do not remove stale managed governance files during upgrade');
85
87
  console.log(' --agent Target agent integration for token optimization mode');
86
- console.log(' --enable Enable token optimization policy and rebuild compiled rules');
87
- console.log(' --disable Disable token optimization policy and rebuild compiled rules');
88
+ console.log(' --enable Enable token optimization policy state');
89
+ console.log(' --disable Disable token optimization policy state');
88
90
  console.log(' --show Print current token optimization state as JSON');
89
91
  }
90
92
 
@@ -125,6 +127,17 @@ async function syncMcpConfig(mcpJsonPath, templateConfig) {
125
127
  }
126
128
  }
127
129
 
130
+ async function pruneEmptyLegacyInstructionDirectories(resolvedTargetDirectoryPath) {
131
+ for (const relativeDirectoryPath of legacyManagedInstructionDirectories) {
132
+ const directoryPath = path.join(resolvedTargetDirectoryPath, ...relativeDirectoryPath.split('/'));
133
+ try {
134
+ await fs.rmdir(directoryPath);
135
+ } catch {
136
+ // Keep non-empty or missing directories. They may contain user-owned files.
137
+ }
138
+ }
139
+ }
140
+
128
141
  export async function copyGovernanceAssetsToTarget(
129
142
  resolvedTargetDirectoryPath,
130
143
  options = {}
@@ -205,6 +218,8 @@ export async function copyGovernanceAssetsToTarget(
205
218
  await fs.rm(staleDirectoryPath, { recursive: true, force: true });
206
219
  deletedManagedDirectories.push(staleDirectoryRelativePath);
207
220
  }
221
+
222
+ await pruneEmptyLegacyInstructionDirectories(resolvedTargetDirectoryPath);
208
223
  }
209
224
 
210
225
  if (shouldIncludeMcpTemplate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "3.0.47",
3
+ "version": "3.0.48",
4
4
  "type": "module",
5
5
  "description": "Force your AI Agent to code like a Staff Engineer, not a Junior.",
6
6
  "bin": {
@@ -10,7 +10,6 @@
10
10
  "bin/",
11
11
  "lib/",
12
12
  "scripts/",
13
- ".instructions.md",
14
13
  ".agent-context/policies/",
15
14
  ".agent-context/prompts/",
16
15
  ".agent-context/review-checklists/",
@@ -24,17 +23,9 @@
24
23
  ".agent-context/state/benchmark-writer-judge-config.json",
25
24
  ".agent-context/state/memory-adapter-contract.json",
26
25
  ".agent-context/state/memory-schema-v1.json",
27
- ".agents/",
28
- ".cursor/",
29
- ".github/",
30
- ".gemini/",
31
- ".windsurf/",
32
- ".cursorrules",
33
- ".windsurfrules",
34
26
  "AGENTS.md",
35
27
  "CLAUDE.md",
36
28
  "GEMINI.md",
37
- ".agent-override.md",
38
29
  "mcp.json",
39
30
  "README.md",
40
31
  "LICENSE",
@@ -71,22 +71,7 @@ async function bumpVersion() {
71
71
  console.log('Updated docs/deep-analysis-and-roadmap-backlog.md');
72
72
  }
73
73
 
74
- // 4. Update legacy root adapters that carry release metadata.
75
- const legacyAdapterFiles = ['.cursorrules', '.windsurfrules'];
76
- for (const legacyAdapterFile of legacyAdapterFiles) {
77
- const legacyAdapterPath = path.join(ROOT_DIR, legacyAdapterFile);
78
- if (await fileExists(legacyAdapterPath)) {
79
- const legacyAdapterContent = await readTextFile(legacyAdapterPath);
80
- const updatedLegacyAdapterContent = legacyAdapterContent.replace(
81
- /Generated by Agentic-Senior-Core CLI v\d+\.\d+\.\d+/,
82
- `Generated by Agentic-Senior-Core CLI v${newVersion}`
83
- );
84
- await writeTextFile(legacyAdapterPath, updatedLegacyAdapterContent);
85
- console.log(`Updated ${legacyAdapterFile}`);
86
- }
87
- }
88
-
89
- // 5. Update CHANGELOG.md
74
+ // 4. Update CHANGELOG.md
90
75
  const changelogPath = path.join(ROOT_DIR, 'CHANGELOG.md');
91
76
  if (await fileExists(changelogPath)) {
92
77
  let changelogContent = await readTextFile(changelogPath);
@@ -24,15 +24,9 @@ const LONG_SENTENCE_WORD_THRESHOLD = 28;
24
24
  const MONITORED_STATIC_FILE_PATHS = [
25
25
  'README.md',
26
26
  'CHANGELOG.md',
27
- '.instructions.md',
28
27
  'AGENTS.md',
29
28
  'CLAUDE.md',
30
29
  'GEMINI.md',
31
- '.github/copilot-instructions.md',
32
- '.github/instructions/agentic-senior-core.instructions.md',
33
- '.gemini/instructions.md',
34
- '.cursor/rules/agentic-senior-core.mdc',
35
- '.windsurf/rules/agentic-senior-core.md',
36
30
  'docs/deep-analysis-and-roadmap-backlog.md',
37
31
  ];
38
32
 
@@ -20,7 +20,7 @@ const REQUIRED_FILES = [
20
20
  'docs/roadmap.md',
21
21
  'docs/archive/v1.7-issue-breakdown.md',
22
22
  'docs/archive/v1.7-execution-playbook.md',
23
- '.instructions.md',
23
+ 'AGENTS.md',
24
24
  '.agent-context/prompts/bootstrap-design.md',
25
25
  'scripts/ui-design-judge.mjs',
26
26
  'scripts/ui-rubric-calibration.mjs',
@@ -173,7 +173,7 @@ function runAudit() {
173
173
  const roadmapPath = 'docs/roadmap.md';
174
174
  const frontendRulePath = '.agent-context/rules/frontend-architecture.md';
175
175
  const bootstrapDesignPromptPath = '.agent-context/prompts/bootstrap-design.md';
176
- const instructionsPath = '.instructions.md';
176
+ const instructionsPath = 'AGENTS.md';
177
177
  const prChecklistPath = '.agent-context/review-checklists/pr-checklist.md';
178
178
  const architectureChecklistPath = '.agent-context/review-checklists/architecture-review.md';
179
179
  const designEvidenceExtractorPath = 'lib/cli/detector/design-evidence.mjs';
@@ -44,7 +44,7 @@ const REQUIRED_VERIFIED_DOMAINS = new Set([
44
44
  'state-continuity',
45
45
  ]);
46
46
  const GOVERNANCE_SURFACE_PATHS = {
47
- 'canonical-instructions': '.instructions.md',
47
+ 'canonical-instructions': 'AGENTS.md',
48
48
  'frontend-design-contract': '.agent-context/prompts/bootstrap-design.md',
49
49
  'frontend-architecture': '.agent-context/rules/frontend-architecture.md',
50
50
  'backend-architecture': '.agent-context/rules/architecture.md',
@@ -75,7 +75,7 @@ const BACKEND_GOVERNANCE_COVERAGE = [
75
75
  constraint: 'Global backend/API rule routing',
76
76
  status: 'strengthened',
77
77
  sourcePaths: [
78
- '.instructions.md',
78
+ 'AGENTS.md',
79
79
  '.agent-context/rules/architecture.md',
80
80
  '.agent-context/prompts/refactor.md',
81
81
  ],