@ryuenn3123/agentic-senior-core 2.0.27 → 2.5.3

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-04-17T03:27:46.024Z",
2
+ "generatedAt": "2026-04-17T03:41:09.595Z",
3
3
  "reportName": "memory-continuity-benchmark",
4
4
  "schemaVersion": "1.0.0",
5
5
  "passed": true,
package/.cursorrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v2.0.27
3
+ Generated by Agentic-Senior-Core CLI v2.5.3
4
4
  Timestamp: 2026-04-15T00:14:51.184Z
5
5
  Selected profile: beginner
6
6
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
package/.windsurfrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v2.0.27
3
+ Generated by Agentic-Senior-Core CLI v2.5.3
4
4
  Timestamp: 2026-04-15T00:14:51.184Z
5
5
  Selected profile: beginner
6
6
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
package/README.md CHANGED
@@ -235,6 +235,27 @@ npx @ryuenn3123/agentic-senior-core init --no-token-optimize
235
235
  When enabled, the CLI writes `.agent-context/state/token-optimization.json`, regenerates compiled rules, and adds compact command guidance to `.cursorrules` and `.windsurfrules`.
236
236
  If an external token proxy is available, the CLI prints setup hints. If not, native fallback guidance stays active, so outside users are not forced to install extra tooling.
237
237
 
238
+ ### Memory Continuity Mode (Enabled by Default on Init)
239
+
240
+ By default, every `init` flow also enables memory continuity automatically.
241
+ This allows cross-session context carryover through compact index-first retrieval plus selective hydration.
242
+
243
+ Quick start:
244
+
245
+ ```bash
246
+ # Default behavior (explicit flag optional)
247
+ npx @ryuenn3123/agentic-senior-core init --memory-continuity
248
+
249
+ # Opt out when needed
250
+ npx @ryuenn3123/agentic-senior-core init --no-memory-continuity
251
+ ```
252
+
253
+ When enabled, the CLI writes `.agent-context/state/memory-continuity.json`, regenerates compiled rules, and injects `MEMORY CONTINUITY PROFILE` guidance into `.cursorrules` and `.windsurfrules`.
254
+
255
+ Compatibility note:
256
+ - Works for local IDE, CLI, and cloud IDE chat runtimes that support the adapter contract or MCP retrieval path.
257
+ - Generic web chat runtimes without repository tool hooks cannot auto-hydrate memory at runtime and should use manual summary handoff.
258
+
238
259
  ### Token Efficiency Benchmark Snapshot
239
260
 
240
261
  Latest local benchmark (2026-04-11) from `.agent-context/state/token-optimization-benchmark.json`:
@@ -56,6 +56,10 @@ import {
56
56
  normalizeAgentName,
57
57
  writeTokenOptimizationState,
58
58
  } from '../token-optimization.mjs';
59
+ import {
60
+ createMemoryContinuityState,
61
+ writeMemoryContinuityState,
62
+ } from '../memory-continuity.mjs';
59
63
  import { evaluateSkillDomainCompatibility } from '../compatibility.mjs';
60
64
 
61
65
  export { REPO_ROOT } from '../constants.mjs';
@@ -71,6 +75,7 @@ export function parseInitArguments(commandArguments) {
71
75
  ci: undefined,
72
76
  newbie: false,
73
77
  tokenOptimize: true,
78
+ memoryContinuity: true,
74
79
  tokenAgent: 'copilot',
75
80
  includeMcpTemplate: false,
76
81
  scaffoldDocs: undefined,
@@ -166,6 +171,11 @@ export function parseInitArguments(commandArguments) {
166
171
  continue;
167
172
  }
168
173
 
174
+ if (currentArgument === '--memory-continuity') {
175
+ parsedInitOptions.memoryContinuity = true;
176
+ continue;
177
+ }
178
+
169
179
  if (currentArgument === '--token-agent') {
170
180
  parsedInitOptions.tokenAgent = commandArguments[argumentIndex + 1] || 'copilot';
171
181
  argumentIndex += 1;
@@ -182,6 +192,11 @@ export function parseInitArguments(commandArguments) {
182
192
  continue;
183
193
  }
184
194
 
195
+ if (currentArgument === '--no-memory-continuity') {
196
+ parsedInitOptions.memoryContinuity = false;
197
+ continue;
198
+ }
199
+
185
200
  if (currentArgument === '--mcp-template') {
186
201
  parsedInitOptions.includeMcpTemplate = true;
187
202
  continue;
@@ -408,6 +423,9 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
408
423
  const isTokenOptimizationEnabled = typeof initOptions.tokenOptimize === 'boolean'
409
424
  ? initOptions.tokenOptimize
410
425
  : true;
426
+ const isMemoryContinuityEnabled = typeof initOptions.memoryContinuity === 'boolean'
427
+ ? initOptions.memoryContinuity
428
+ : true;
411
429
  const shouldIncludeMcpTemplate = initOptions.includeMcpTemplate === true;
412
430
  const selectedTokenAgentName = normalizeAgentName(initOptions.tokenAgent || 'copilot');
413
431
  const isInteractiveSession = Boolean(stdin.isTTY && stdout.isTTY);
@@ -729,9 +747,20 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
729
747
  includeMcpTemplate: shouldIncludeMcpTemplate,
730
748
  });
731
749
 
750
+ let memoryContinuityState = null;
751
+ if (isMemoryContinuityEnabled) {
752
+ memoryContinuityState = createMemoryContinuityState({
753
+ isEnabled: true,
754
+ });
755
+
756
+ await writeMemoryContinuityState(resolvedTargetDirectoryPath, memoryContinuityState);
757
+ console.log(`Memory continuity policy enabled (${memoryContinuityState.hydrationMode}).`);
758
+ }
759
+
760
+ let tokenOptimizationState = null;
732
761
  if (isTokenOptimizationEnabled) {
733
762
  const detectedExternalProxy = detectRtkBinary();
734
- const tokenOptimizationState = createTokenOptimizationState({
763
+ tokenOptimizationState = createTokenOptimizationState({
735
764
  isEnabled: true,
736
765
  selectedAgentName: selectedTokenAgentName,
737
766
  rtkDetection: detectedExternalProxy,
@@ -862,6 +891,18 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
862
891
  detectionSource: detectedRuntimeEnvironment.source,
863
892
  },
864
893
  operationMode: 'init',
894
+ tokenOptimization: {
895
+ enabled: isTokenOptimizationEnabled,
896
+ selectedAgent: selectedTokenAgentName,
897
+ preferredShellProxy: tokenOptimizationState?.preferredShellProxy || null,
898
+ stateFile: isTokenOptimizationEnabled ? '.agent-context/state/token-optimization.json' : null,
899
+ },
900
+ memoryContinuity: {
901
+ enabled: isMemoryContinuityEnabled,
902
+ hydrationMode: memoryContinuityState?.hydrationMode || null,
903
+ adapters: memoryContinuityState?.adapters || [],
904
+ stateFile: isMemoryContinuityEnabled ? '.agent-context/state/memory-continuity.json' : null,
905
+ },
865
906
  });
866
907
 
867
908
  console.log('\nInitialization complete.');
@@ -892,6 +933,11 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
892
933
  }
893
934
  console.log(`- Repository workflows copied: no (workflows remain source-repo assets)`);
894
935
  console.log(`- MCP template file: ${shouldIncludeMcpTemplate ? 'created (.vscode/mcp.json)' : 'not created by default (use --mcp-template)'}`);
936
+ if (isMemoryContinuityEnabled) {
937
+ console.log('- Memory continuity policy: enabled (index + selective hydration)');
938
+ } else {
939
+ console.log('- Memory continuity policy: disabled (--no-memory-continuity)');
940
+ }
895
941
  if (isTokenOptimizationEnabled) {
896
942
  console.log(`- Token optimization policy: enabled for ${selectedTokenAgentName}`);
897
943
  } else {
@@ -25,6 +25,10 @@ import {
25
25
  readTokenOptimizationState,
26
26
  buildTokenOptimizationGuidanceBlock,
27
27
  } from './token-optimization.mjs';
28
+ import {
29
+ readMemoryContinuityState,
30
+ buildMemoryContinuityGuidanceBlock,
31
+ } from './memory-continuity.mjs';
28
32
 
29
33
  export async function writeSelectedPolicy(targetDirectoryPath, selectedProfileName) {
30
34
  const policyFilePath = path.join(targetDirectoryPath, '.agent-context', 'policies', POLICY_FILE_NAME);
@@ -49,8 +53,16 @@ export async function writeOnboardingReport({
49
53
  compatibilityWarnings = [],
50
54
  runtimeEnvironment = null,
51
55
  operationMode = 'init',
56
+ tokenOptimization = undefined,
57
+ memoryContinuity = undefined,
52
58
  }) {
53
59
  const onboardingReportPath = path.join(targetDirectoryPath, '.agent-context', 'state', 'onboarding-report.json');
60
+ const resolvedTokenOptimization = typeof tokenOptimization === 'undefined'
61
+ ? await readTokenOptimizationState(targetDirectoryPath)
62
+ : tokenOptimization;
63
+ const resolvedMemoryContinuity = typeof memoryContinuity === 'undefined'
64
+ ? await readMemoryContinuityState(targetDirectoryPath)
65
+ : memoryContinuity;
54
66
  const onboardingReport = {
55
67
  cliVersion: CLI_VERSION,
56
68
  generatedAt: new Date().toISOString(),
@@ -72,6 +84,8 @@ export async function writeOnboardingReport({
72
84
  selectedSkillDomains,
73
85
  compatibilityWarnings,
74
86
  runtimeEnvironment,
87
+ tokenOptimization: resolvedTokenOptimization,
88
+ memoryContinuity: resolvedMemoryContinuity,
75
89
  autoDetection: {
76
90
  recommendedStack: projectDetection.recommendedStackFileName,
77
91
  recommendedAdditionalStacks: projectDetection.secondaryStackFileNames || [],
@@ -267,6 +281,14 @@ export async function buildCompiledRulesContent({
267
281
  `## TOKEN OPTIMIZATION PROFILE\nSource: .agent-context/state/token-optimization.json\n\n${buildTokenOptimizationGuidanceBlock(tokenOptimizationState).trim()}`
268
282
  );
269
283
  }
284
+
285
+ const memoryContinuityState = await readMemoryContinuityState(resolvedTargetDirectoryPath);
286
+ if (memoryContinuityState?.enabled) {
287
+ contextBlocks.push(
288
+ `## MEMORY CONTINUITY PROFILE\nSource: .agent-context/state/memory-continuity.json\n\n${buildMemoryContinuityGuidanceBlock(memoryContinuityState).trim()}`
289
+ );
290
+ }
291
+
270
292
  contextBlocks.push(
271
293
  [
272
294
  '## LAYER 7: STATE AWARENESS (MANDATORY)',
@@ -4,6 +4,11 @@
4
4
  * lightweight indexing, and selective hydration helpers.
5
5
  */
6
6
 
7
+ import fs from 'node:fs/promises';
8
+ import path from 'node:path';
9
+
10
+ import { pathExists } from './utils.mjs';
11
+
7
12
  const PRIVATE_BLOCK_PATTERN = /<private>[\s\S]*?<\/private>/gi;
8
13
 
9
14
  const INLINE_SENSITIVE_PATTERNS = [
@@ -30,6 +35,9 @@ const INLINE_SENSITIVE_PATTERNS = [
30
35
  ];
31
36
 
32
37
  export const MEMORY_SCHEMA_VERSION = '1.0.0';
38
+ export const MEMORY_CONTINUITY_STATE_FILE_NAME = 'memory-continuity.json';
39
+
40
+ const MEMORY_CONTINUITY_STATE_SCHEMA_VERSION = 'memory-continuity-v1';
33
41
 
34
42
  export const SUPPORTED_MEMORY_ADAPTER_IDS = Object.freeze([
35
43
  'claude-code',
@@ -84,6 +92,32 @@ function normalizeTags(rawTags) {
84
92
  return Array.from(tagSet);
85
93
  }
86
94
 
95
+ function normalizeMemoryAdapterIds(rawAdapterIds) {
96
+ if (!Array.isArray(rawAdapterIds) || rawAdapterIds.length === 0) {
97
+ return [...SUPPORTED_MEMORY_ADAPTER_IDS];
98
+ }
99
+
100
+ const normalizedAdapterIdSet = new Set();
101
+ for (const rawAdapterId of rawAdapterIds) {
102
+ const normalizedAdapterId = toNonEmptyString(String(rawAdapterId || '')).toLowerCase();
103
+ if (!normalizedAdapterId) {
104
+ continue;
105
+ }
106
+
107
+ if (!SUPPORTED_MEMORY_ADAPTER_IDS.includes(normalizedAdapterId)) {
108
+ continue;
109
+ }
110
+
111
+ normalizedAdapterIdSet.add(normalizedAdapterId);
112
+ }
113
+
114
+ if (normalizedAdapterIdSet.size === 0) {
115
+ return [...SUPPORTED_MEMORY_ADAPTER_IDS];
116
+ }
117
+
118
+ return Array.from(normalizedAdapterIdSet);
119
+ }
120
+
87
121
  export function estimateTokenUsage(rawText = '') {
88
122
  const normalizedText = String(rawText || '');
89
123
  return Math.max(1, Math.ceil(normalizedText.length / 4));
@@ -264,3 +298,98 @@ export function hydrateIndexedObservations(indexEntries, normalizedObservations,
264
298
  hydrationTokenEstimate,
265
299
  };
266
300
  }
301
+
302
+ export function createMemoryContinuityState(options = {}) {
303
+ const isEnabled = options.isEnabled !== false;
304
+ const sessionStartIndexLimit = Number.isFinite(Number(options.sessionStartIndexLimit))
305
+ ? Math.max(1, Number(options.sessionStartIndexLimit))
306
+ : 8;
307
+ const fullHydrationLimit = Number.isFinite(Number(options.fullHydrationLimit))
308
+ ? Math.max(1, Number(options.fullHydrationLimit))
309
+ : 2;
310
+
311
+ return {
312
+ schemaVersion: MEMORY_CONTINUITY_STATE_SCHEMA_VERSION,
313
+ enabled: isEnabled,
314
+ hydrationMode: 'progressive-disclosure',
315
+ adapters: normalizeMemoryAdapterIds(options.adapterIds),
316
+ retrieval: {
317
+ sessionStartIndexLimit,
318
+ fullHydrationLimit,
319
+ },
320
+ privacy: {
321
+ redactPrivateTags: true,
322
+ redactInlineSensitivePatterns: true,
323
+ },
324
+ generatedAt: new Date().toISOString(),
325
+ };
326
+ }
327
+
328
+ export async function readMemoryContinuityState(targetDirectoryPath) {
329
+ const stateFilePath = path.join(
330
+ targetDirectoryPath,
331
+ '.agent-context',
332
+ 'state',
333
+ MEMORY_CONTINUITY_STATE_FILE_NAME
334
+ );
335
+
336
+ if (!(await pathExists(stateFilePath))) {
337
+ return null;
338
+ }
339
+
340
+ try {
341
+ const stateContent = await fs.readFile(stateFilePath, 'utf8');
342
+ const parsedState = JSON.parse(stateContent);
343
+ if (typeof parsedState.enabled !== 'boolean') {
344
+ return null;
345
+ }
346
+
347
+ parsedState.adapters = normalizeMemoryAdapterIds(parsedState.adapters);
348
+ return parsedState;
349
+ } catch {
350
+ return null;
351
+ }
352
+ }
353
+
354
+ export async function writeMemoryContinuityState(targetDirectoryPath, memoryContinuityState) {
355
+ const stateDirectoryPath = path.join(targetDirectoryPath, '.agent-context', 'state');
356
+ const stateFilePath = path.join(stateDirectoryPath, MEMORY_CONTINUITY_STATE_FILE_NAME);
357
+
358
+ await fs.mkdir(stateDirectoryPath, { recursive: true });
359
+ await fs.writeFile(stateFilePath, JSON.stringify(memoryContinuityState, null, 2) + '\n', 'utf8');
360
+ }
361
+
362
+ export function buildMemoryContinuityGuidanceBlock(memoryContinuityState) {
363
+ if (!memoryContinuityState?.enabled) {
364
+ return [
365
+ 'Memory continuity mode is disabled for this repository.',
366
+ 'Use explicit session summaries when handing off context across tools.',
367
+ ].join('\n');
368
+ }
369
+
370
+ const adapterGuidanceLine = memoryContinuityState.adapters?.length
371
+ ? `Supported adapters: ${memoryContinuityState.adapters.join(', ')}.`
372
+ : `Supported adapters: ${SUPPORTED_MEMORY_ADAPTER_IDS.join(', ')}.`;
373
+
374
+ const sessionStartIndexLimit = Number.isFinite(Number(memoryContinuityState.retrieval?.sessionStartIndexLimit))
375
+ ? Number(memoryContinuityState.retrieval.sessionStartIndexLimit)
376
+ : 8;
377
+ const fullHydrationLimit = Number.isFinite(Number(memoryContinuityState.retrieval?.fullHydrationLimit))
378
+ ? Number(memoryContinuityState.retrieval.fullHydrationLimit)
379
+ : 2;
380
+
381
+ return [
382
+ 'Memory continuity mode is enabled.',
383
+ 'Hydration mode: progressive-disclosure.',
384
+ adapterGuidanceLine,
385
+ '',
386
+ 'Session-start retrieval policy:',
387
+ `- Load compact index first (limit: ${sessionStartIndexLimit} entries).`,
388
+ `- Hydrate full detail only for highest-value entries (limit: ${fullHydrationLimit}).`,
389
+ '- Always redact sensitive text before persistence (<private> blocks and inline secret-like fields).',
390
+ '',
391
+ 'Host compatibility scope:',
392
+ '- Works for local IDE, CLI, and cloud IDE chat hosts that implement the memory adapter contract or MCP retrieval path.',
393
+ '- Generic web chat sessions without repository tools cannot auto-hydrate runtime memory and should rely on manual summary export/import.',
394
+ ].join('\n');
395
+ }
package/lib/cli/utils.mjs CHANGED
@@ -28,7 +28,7 @@ export function printUsage() {
28
28
  console.log('');
29
29
  console.log('Usage:');
30
30
  console.log(' agentic-senior-core launch');
31
- console.log(' agentic-senior-core init [target-directory] [--preset <name>] [--profile <beginner|balanced|strict>] [--profile-pack <name>] [--stack <name>] [--blueprint <name>] [--ci <true|false>] [--newbie] [--token-optimize] [--no-token-optimize] [--token-agent <name>] [--scaffold-docs] [--no-scaffold-docs] [--docs-lang <en|id>] [--project-config <path>] [--runtime-env <auto|linux-wsl|linux|windows|macos>]');
31
+ console.log(' agentic-senior-core init [target-directory] [--preset <name>] [--profile <beginner|balanced|strict>] [--profile-pack <name>] [--stack <name>] [--blueprint <name>] [--ci <true|false>] [--newbie] [--token-optimize] [--no-token-optimize] [--token-agent <name>] [--memory-continuity] [--no-memory-continuity] [--scaffold-docs] [--no-scaffold-docs] [--docs-lang <en|id>] [--project-config <path>] [--runtime-env <auto|linux-wsl|linux|windows|macos>]');
32
32
  console.log(' agentic-senior-core upgrade [target-directory] [--dry-run] [--yes] [--mcp-template]');
33
33
  console.log(' agentic-senior-core optimize [target-directory] [--agent <copilot|claude|cursor|windsurf|gemini|codex|cline>] [--enable|--disable] [--show]');
34
34
  console.log(' agentic-senior-core mcp');
@@ -49,6 +49,8 @@ export function printUsage() {
49
49
  console.log(' --token-optimize Explicitly enable token optimization policy during init (default behavior)');
50
50
  console.log(' --token-agent Set token optimization agent target (copilot, claude, cursor, windsurf, gemini, codex, cline)');
51
51
  console.log(' --no-token-optimize Disable token optimization policy during init');
52
+ console.log(' --memory-continuity Explicitly enable cross-session memory continuity policy during init (default behavior)');
53
+ console.log(' --no-memory-continuity Disable memory continuity policy during init');
52
54
  console.log(' --mcp-template Create .vscode/mcp.json workspace template (MCP trust/start remains manual in IDE)');
53
55
  console.log(' --scaffold-docs Force project documentation scaffolding (architecture, database, API, flow)');
54
56
  console.log(' --no-scaffold-docs Skip project documentation scaffolding');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "2.0.27",
3
+ "version": "2.5.3",
4
4
  "type": "module",
5
5
  "description": "Force your AI Agent to code like a Staff Engineer, not a Junior.",
6
6
  "bin": {