@ryuenn3123/agentic-senior-core 3.0.46 → 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 (58) hide show
  1. package/.agent-context/prompts/init-project.md +9 -7
  2. package/.agent-context/prompts/refactor.md +1 -1
  3. package/.agent-context/prompts/review-code.md +1 -1
  4. package/.agent-context/review-checklists/pr-checklist.md +3 -0
  5. package/.agent-context/rules/api-docs.md +4 -0
  6. package/.agent-context/rules/architecture.md +16 -2
  7. package/.agent-context/state/architecture-map.md +3 -3
  8. package/.agent-context/state/dependency-map.md +2 -2
  9. package/AGENTS.md +170 -35
  10. package/CLAUDE.md +1 -44
  11. package/CONTRIBUTING.md +2 -3
  12. package/GEMINI.md +1 -44
  13. package/README.md +28 -22
  14. package/lib/cli/backup.mjs +37 -0
  15. package/lib/cli/commands/init.mjs +15 -29
  16. package/lib/cli/commands/optimize.mjs +2 -48
  17. package/lib/cli/commands/upgrade.mjs +14 -52
  18. package/lib/cli/compiler.mjs +25 -95
  19. package/lib/cli/constants.mjs +1 -9
  20. package/lib/cli/detector.mjs +0 -1
  21. package/lib/cli/init-options.mjs +1 -1
  22. package/lib/cli/project-scaffolder/constants.mjs +1 -0
  23. package/lib/cli/project-scaffolder/discovery.mjs +2 -0
  24. package/lib/cli/project-scaffolder/prompt-builders.mjs +9 -5
  25. package/lib/cli/utils/filesystem.mjs +2 -0
  26. package/lib/cli/utils/managed-surface.mjs +45 -2
  27. package/lib/cli/utils.mjs +19 -4
  28. package/package.json +1 -10
  29. package/scripts/bump-version.mjs +1 -16
  30. package/scripts/docs-quality-drift-report.mjs +0 -6
  31. package/scripts/frontend-usability-audit.mjs +2 -2
  32. package/scripts/governance-weekly-report.mjs +2 -2
  33. package/scripts/single-source-lazy-loading-audit.mjs +13 -126
  34. package/scripts/sync-thin-adapters.mjs +13 -121
  35. package/scripts/validate/config.mjs +20 -27
  36. package/scripts/validate/coverage-checks.mjs +9 -76
  37. package/scripts/validate.mjs +12 -97
  38. package/.agent-override.md +0 -36
  39. package/.agents/workflows/init-project.md +0 -12
  40. package/.agents/workflows/refactor.md +0 -12
  41. package/.agents/workflows/review-code.md +0 -11
  42. package/.cursor/mcp.json +0 -10
  43. package/.cursor/rules/agentic-senior-core.mdc +0 -49
  44. package/.cursorrules +0 -26
  45. package/.gemini/instructions.md +0 -44
  46. package/.github/copilot-instructions.md +0 -44
  47. package/.github/instructions/agentic-senior-core.instructions.md +0 -48
  48. package/.github/workflows/benchmark-detection.yml +0 -45
  49. package/.github/workflows/benchmark-intelligence.yml +0 -50
  50. package/.github/workflows/docs-quality-drift-report.yml +0 -37
  51. package/.github/workflows/frontend-usability-gate.yml +0 -36
  52. package/.github/workflows/governance-weekly-report.yml +0 -43
  53. package/.github/workflows/publish.yml +0 -32
  54. package/.github/workflows/release-gate.yml +0 -32
  55. package/.github/workflows/sbom-compliance.yml +0 -32
  56. package/.instructions.md +0 -186
  57. package/.windsurf/rules/agentic-senior-core.md +0 -44
  58. package/.windsurfrules +0 -26
@@ -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
 
@@ -422,8 +388,10 @@ export async function buildCompiledRulesContent({
422
388
  '3. .agent-context/prompts/review-code.md -> review, audit, check, analyze',
423
389
  '4. .agent-context/prompts/bootstrap-design.md -> ui, ux, layout, screen, tailwind, frontend, redesign',
424
390
  'Documentation-first policy:',
425
- '- Create or refine required project docs before implementation: README.md for every fresh or existing project; docs/project-brief.md; docs/architecture-decision-record.md; docs/flow-overview.md; docs/api-contract.md when APIs, firmware endpoints, CLI commands, or web application flows exist; docs/database-schema.md when persistent data exists; and docs/DESIGN.md plus docs/design-intent.json for UI scope.',
391
+ '- Create or refine required project docs before implementation: README.md for every fresh or existing project; docs/doc-index.md whenever docs/ exists; docs/project-brief.md; docs/architecture-decision-record.md; docs/flow-overview.md; docs/api-contract.md when APIs, firmware endpoints, CLI commands, or web application flows exist; docs/database-schema.md when persistent data exists; and docs/DESIGN.md plus docs/design-intent.json for UI scope.',
426
392
  '- Keep README.md public and developer friendly, including for private projects: explain what the project is, who it is for, setup, usage, configuration, and links to deeper docs. Do not put secrets, internal agent notes, private reasoning, or governance policy dumps in it.',
393
+ '- Use docs/doc-index.md as the compact read-routing map before selecting deeper docs. Do not broad-read docs/*.md by default.',
394
+ '- Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.',
427
395
  '- Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
428
396
  '- Write formal project docs in English by default unless the user explicitly asks for another documentation language.',
429
397
  '- For docs-only/docs-first requests, do not write application, firmware, or UI code until the user asks or approves an implementation plan.',
@@ -546,14 +514,22 @@ export async function buildCompiledRulesContent({
546
514
 
547
515
  if (await pathExists(projectBriefPath)) {
548
516
  const hasRootReadme = await pathExists(path.join(resolvedTargetDirectoryPath, 'README.md'));
549
- const projectDocsEntries = ['project-brief.md'];
517
+ const projectDocsEntries = [];
550
518
  const candidateDocFileNames = [
519
+ 'doc-index.md',
520
+ 'project-brief.md',
551
521
  'architecture-decision-record.md',
522
+ 'technical-design.md',
523
+ 'prd.md',
524
+ 'srs.md',
552
525
  'database-schema.md',
526
+ 'erd.md',
553
527
  'api-contract.md',
554
528
  'flow-overview.md',
555
529
  'DESIGN.md',
556
530
  'design-intent.json',
531
+ 'runbook.md',
532
+ 'troubleshooting.md',
557
533
  ];
558
534
 
559
535
  for (const candidateFileName of candidateDocFileNames) {
@@ -573,6 +549,7 @@ export async function buildCompiledRulesContent({
573
549
  '',
574
550
  'Universal SOP hard block policy:',
575
551
  '- README.md must exist and read as a public and developer entrypoint.',
552
+ '- docs/doc-index.md must exist whenever docs/ exists and act as the compact read-routing map.',
576
553
  '- Stop implementation if docs/project-brief.md is missing.',
577
554
  '- Stop implementation if docs/architecture-decision-record.md (alias: docs/Architecture-Decision-Record.md) is missing.',
578
555
  '- Stop implementation if docs/flow-overview.md is missing.',
@@ -580,6 +557,8 @@ export async function buildCompiledRulesContent({
580
557
  '- If the product exposes API or web application flows, docs/api-contract.md must exist before coding continues.',
581
558
  '- For UI scope, stop implementation if docs/DESIGN.md or docs/design-intent.json is missing.',
582
559
  '- Keep README.md overview-level, public, and developer friendly; do not put secrets, internal agent notes, private reasoning, or governance policy dumps in it.',
560
+ '- Use README.md plus docs/doc-index.md to choose the smallest relevant read set before loading deeper docs.',
561
+ '- Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.',
583
562
  '- Materialize missing docs first, then continue coding.',
584
563
  '- Bootstrap missing docs from real repo evidence and the latest user request. Do not write generic placeholder templates.',
585
564
  '- Separate confirmed facts from assumptions and end each major explanation with the next validation action.',
@@ -612,10 +591,12 @@ export async function buildCompiledRulesContent({
612
591
  '',
613
592
  'Bootstrap policy:',
614
593
  '- Create README.md as a public and developer entrypoint before coding continues.',
594
+ '- Create docs/doc-index.md as the compact read-routing map whenever docs/ exists.',
615
595
  '- Hard block: do not write application code until docs/project-brief.md and docs/architecture-decision-record.md exist.',
616
596
  '- docs/flow-overview.md must also exist before coding continues.',
617
597
  '- Add docs/database-schema.md when persistent data is involved.',
618
598
  '- Add docs/api-contract.md when API or web application flows are involved.',
599
+ '- Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.',
619
600
  '- For docs-only/docs-first requests, stop after docs unless the user asks for implementation or approves an implementation plan.',
620
601
  '- If docs/project-brief.md is missing, execute bootstrap-project-context prompt immediately.',
621
602
  hasBootstrapDesignPrompt
@@ -644,62 +625,11 @@ export async function buildCompiledRulesContent({
644
625
  `Selected policy file: .agent-context/policies/${POLICY_FILE_NAME}`,
645
626
  '',
646
627
  '## GOVERNANCE PRECEDENCE',
647
- '1. Follow this compiled rulebook as the primary source.',
648
- '2. Resolve exceptions from .agent-override.md only when explicitly defined.',
649
- '3. Use architecture-map.md and dependency-map.md as change safety boundaries.',
650
- '4. Enforce pr-checklist.md before declaring completion.',
651
- '',
652
- '## OVERRIDE PROTOCOL',
653
- '- Default: strict compliance with this file.',
654
- '- Exception path: .agent-override.md may explicitly allow narrow deviations.',
655
- '- 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.',
656
631
  '',
657
632
  ...contextBlocks,
658
633
  '',
659
634
  ].join('\n');
660
635
  }
661
-
662
- export async function compileDynamicContext({
663
- targetDirectoryPath,
664
- selectedStackFileName,
665
- selectedAdditionalStackFileNames = [],
666
- selectedBlueprintFileName,
667
- selectedAdditionalBlueprintFileNames = [],
668
- includeCiGuardrails,
669
- preserveUserOwnedEntrypoints = true,
670
- }) {
671
- const resolvedTargetDirectoryPath = path.resolve(targetDirectoryPath);
672
- const compiledRules = await buildCompiledRulesContent({
673
- targetDirectoryPath: resolvedTargetDirectoryPath,
674
- selectedStackFileName,
675
- selectedAdditionalStackFileNames,
676
- selectedBlueprintFileName,
677
- selectedAdditionalBlueprintFileNames,
678
- includeCiGuardrails,
679
- });
680
- const preservedEntrypoints = [];
681
-
682
- async function writeGeneratedEntrypointFile(relativeFilePath, content) {
683
- const targetFilePath = path.join(resolvedTargetDirectoryPath, relativeFilePath);
684
-
685
- if (preserveUserOwnedEntrypoints && await pathExists(targetFilePath)) {
686
- const existingContent = await fs.readFile(targetFilePath, 'utf8');
687
- if (!isAgenticManagedContent(existingContent)) {
688
- preservedEntrypoints.push(relativeFilePath);
689
- return;
690
- }
691
- }
692
-
693
- await fs.mkdir(path.dirname(targetFilePath), { recursive: true });
694
- await fs.writeFile(targetFilePath, content, 'utf8');
695
- }
696
-
697
- await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.agent-instructions.md'), compiledRules, 'utf8');
698
- await writeGeneratedEntrypointFile('.cursorrules', buildLegacyRootAdapterContent('.cursorrules', 'Cursor'));
699
- await writeGeneratedEntrypointFile('.windsurfrules', buildLegacyRootAdapterContent('.windsurfrules', 'Windsurf'));
700
- await writeGeneratedEntrypointFile('.clauderc', buildLegacyRootAdapterContent('.clauderc', 'Claude'));
701
-
702
- return {
703
- preservedEntrypoints,
704
- };
705
- }
@@ -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,
@@ -6,6 +6,7 @@ export const PROJECT_DOC_FILE_NAMES = [
6
6
  'api-contract.md',
7
7
  'flow-overview.md',
8
8
  ];
9
+ export const DOC_INDEX_FILE_NAME = 'doc-index.md';
9
10
  export const UI_DESIGN_CONTRACT_FILE_NAMES = ['DESIGN.md', 'design-intent.json'];
10
11
 
11
12
  // Legacy project docs may still carry this version header; keep for upgrade staleness checks.
@@ -3,6 +3,7 @@ import fs from 'node:fs/promises';
3
3
  import { askChoice, askYesNo } from '../utils.mjs';
4
4
  import {
5
5
  ARCHITECTURE_STYLE_CHOICES,
6
+ DOC_INDEX_FILE_NAME,
6
7
  DOCKER_STRATEGY_CHOICES,
7
8
  SUPPORTED_DOC_LANGUAGES,
8
9
  } from './constants.mjs';
@@ -169,6 +170,7 @@ export function resolveProjectDocTargets(discoveryAnswers) {
169
170
  || discoveryAnswers.primaryDomain.toLowerCase().includes('fullstack');
170
171
 
171
172
  const requiredDocFileNames = [
173
+ DOC_INDEX_FILE_NAME,
172
174
  'project-brief.md',
173
175
  'architecture-decision-record.md',
174
176
  'flow-overview.md',
@@ -78,7 +78,9 @@ export function buildProjectContextBootstrapPrompt({
78
78
  '12. Treat topology as an agent decision unless the user explicitly constrained it. If monolith fits, explain why. If a service split fits, document the evidence and service boundary logic.',
79
79
  '13. Required docs coverage must include a public and developer README entrypoint, feature plan, architecture rationale, flow, public API or integration contracts when relevant, data model when relevant, UI/design when relevant, security assumptions, testing strategy, runtime/deployment notes, and next validation actions.',
80
80
  '14. README.md must be public and developer friendly, including for private projects: what it is, who it is for, setup, core workflow, configuration, and links to deeper docs. Do not include secrets, internal agent notes, private reasoning, or governance policy dumps.',
81
- '15. Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
81
+ '15. docs/doc-index.md is the low-token routing map for docs/*. Keep it short, list each active doc, and explain when an agent should read it. Do not make it the source of truth for requirements or architecture.',
82
+ '16. Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
83
+ '17. Add SRS, PRD, technical-design, or ERD docs only when project evidence triggers them. Use PRD for product-roadmap/user-story ownership, SRS for contractual or multi-stakeholder acceptance criteria, technical-design for non-trivial architecture decisions, and ERD only as a separate file when the schema is too complex for docs/database-schema.md.',
82
84
  '',
83
85
  '## Project Inputs',
84
86
  `- Project name: ${discoveryAnswers.projectName}`,
@@ -105,10 +107,12 @@ export function buildProjectContextBootstrapPrompt({
105
107
  '## Required Execution',
106
108
  '1. Create all required docs files listed above with complete Markdown content.',
107
109
  '2. Make the docs adaptive to the real repo and prompt context. These are living references, not frozen templates.',
108
- '3. In docs/project-brief.md and docs/architecture-decision-record.md, include explicit sections for confirmed facts, assumptions to validate, and next validation actions whenever context is incomplete.',
109
- '4. Before implementation, use the docs to confirm stack, runtime, architecture, public contracts, data, validation, and delivery assumptions.',
110
- '5. Keep content original, specific to this project, and actionable for implementation.',
111
- '6. After writing docs, continue coding tasks using these docs as living project context.',
110
+ '3. In docs/doc-index.md, include a compact table with document path, purpose, reads-when triggers, status, and last-updated date.',
111
+ '4. In docs/project-brief.md and docs/architecture-decision-record.md, include explicit sections for confirmed facts, assumptions to validate, and next validation actions whenever context is incomplete.',
112
+ '5. Before implementation, use README.md plus docs/doc-index.md to select only the relevant docs for the current task instead of broad-reading docs/*.md.',
113
+ '6. Before implementation, use the docs to confirm stack, runtime, architecture, public contracts, data, validation, and delivery assumptions.',
114
+ '7. Keep content original, specific to this project, and actionable for implementation.',
115
+ '8. After writing docs, continue coding tasks using these docs as living project context.',
112
116
  '',
113
117
  ].join('\n');
114
118
  }
@@ -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.46",
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
  ],