@jaimevalasek/aioson 1.20.0 → 1.21.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/docs/pt/living-memory/reflexao-in-harness.md +2 -0
  3. package/package.json +1 -1
  4. package/src/cli.js +5 -0
  5. package/src/commands/context-health.js +35 -2
  6. package/src/commands/feature-close.js +36 -0
  7. package/src/commands/install.js +5 -0
  8. package/src/commands/memory-archive.js +193 -193
  9. package/src/commands/memory-reflect-commit.js +28 -4
  10. package/src/commands/memory-restore.js +177 -177
  11. package/src/commands/memory-search.js +135 -135
  12. package/src/commands/memory-trim.js +191 -0
  13. package/src/constants.js +1 -0
  14. package/src/current-state-trim.js +170 -0
  15. package/src/doctor.js +17 -0
  16. package/src/i18n/messages/en.js +16 -0
  17. package/src/i18n/messages/es.js +16 -0
  18. package/src/i18n/messages/fr.js +16 -0
  19. package/src/i18n/messages/pt-BR.js +16 -0
  20. package/src/install-wizard.js +3 -2
  21. package/src/lib/tool-capabilities.js +67 -64
  22. package/src/memory-reflect-engine.js +10 -4
  23. package/src/permissions-generator.js +3 -0
  24. package/template/.aioson/agents/architect.md +3 -0
  25. package/template/.aioson/agents/committer.md +1 -1
  26. package/template/.aioson/agents/dev.md +2 -2
  27. package/template/.aioson/agents/deyvin.md +2 -1
  28. package/template/.aioson/agents/pentester.md +1 -0
  29. package/template/.aioson/agents/qa.md +4 -0
  30. package/template/.aioson/agents/sheldon.md +1 -0
  31. package/template/.aioson/agents/tester.md +2 -0
  32. package/template/.aioson/config/autonomy-protocol.json +1 -0
  33. package/template/.aioson/design-docs/agent-loading-contract.md +138 -0
  34. package/template/.aioson/docs/quality/code-health-analysis.md +79 -0
@@ -73,6 +73,18 @@ module.exports = {
73
73
  dry_run_summary: 'memory:restore [dry-run]: would move {source} → {dest}.',
74
74
  restored_success: 'memory:restore ✓ {kind} "{slug}" restored to {dest}.'
75
75
  },
76
+ help_memory_trim:
77
+ 'aioson memory:trim [path] [--keep=<N>] [--archive=<path>] [--dry-run] [--json] [--locale=en]',
78
+ memory_trim: {
79
+ hook_blocked: 'memory:trim cannot be invoked from a runtime hook (tier-2 requires human action).',
80
+ no_current_state: 'memory:trim: {path} not found (nothing to trim).',
81
+ archive_path_escape: 'memory:trim: refused --archive outside the project: {path}',
82
+ section_not_found: 'memory:trim: "## What the system already has" section not found — nothing to do.',
83
+ nothing_to_archive: 'memory:trim: {kept} entries within keep={keep} window — nothing to archive.',
84
+ dry_run_summary: 'memory:trim [dry-run]: would archive {archived}/{total} entries (keep={keep}, active-slug exempt). {before_kb}KB → {after_kb}KB (saves {saved_kb}KB). No files written.',
85
+ notify_template: 'trimming current-state.md: archiving {archived} cold entries',
86
+ trimmed_success: 'memory:trim ✓ archived {archived} entries (kept {kept}). {before_kb}KB → {after_kb}KB. Archive: {archive}'
87
+ },
76
88
  memory_search: {
77
89
  query_empty: 'memory:search requires a non-empty query string.',
78
90
  query_too_long: 'memory:search query exceeds {max} characters.',
@@ -327,6 +339,7 @@ module.exports = {
327
339
  files_skipped: 'Files skipped: {count}',
328
340
  dry_run_header: '⚠ DRY RUN — no files were written. Showing what install would do:',
329
341
  dry_run_done_at: 'DRY RUN: nothing was written to {targetDir}',
342
+ gemini_deprecation_notice: '[DEPRECATED] Gemini CLI free/personal tier will be discontinued on 2026-06-18. Consider Codex or OpenCode for new projects. Enterprise (Code Assist Standard/Enterprise) continues to work.',
330
343
  dry_run_files_copied: 'Files that would be copied: {count}',
331
344
  dry_run_files_skipped: 'Files that would be skipped: {count}',
332
345
  next_steps: 'Next steps:',
@@ -399,6 +412,9 @@ module.exports = {
399
412
  context_conversation_language_format: '`conversation_language` is not a valid BCP-47 tag',
400
413
  context_conversation_language_format_hint: 'Use values like en, en-US, pt-BR.',
401
414
  node_version: 'Node.js >= 18 (current: {version})',
415
+ gemini_deprecation: 'Gemini CLI in use - free tier ends 2026-06-18 (enterprise unaffected)',
416
+ gemini_deprecation_hint:
417
+ 'Run `aioson permissions-generator --tool=codex` (or --tool=opencode) to migrate. Enterprise (Code Assist Standard/Enterprise) keeps working; pre-existing .gemini/permissions.toml is preserved.',
402
418
  gateway_claude_pointer: 'CLAUDE gateway references shared AIOSON files',
403
419
  gateway_claude_pointer_hint:
404
420
  'Ensure CLAUDE.md references .aioson/config.md and .aioson/agents/setup.md.',
@@ -74,6 +74,18 @@ module.exports = {
74
74
  dry_run_summary: 'memory:restore [dry-run]: movería {source} → {dest}.',
75
75
  restored_success: 'memory:restore ✓ {kind} "{slug}" restaurado a {dest}.'
76
76
  },
77
+ help_memory_trim:
78
+ 'aioson memory:trim [ruta] [--keep=<N>] [--archive=<path>] [--dry-run] [--json] [--locale=es]',
79
+ memory_trim: {
80
+ hook_blocked: 'memory:trim no puede invocarse desde un hook de runtime (tier-2 requiere acción humana).',
81
+ no_current_state: 'memory:trim: {path} no encontrado (nada que recortar).',
82
+ archive_path_escape: 'memory:trim: --archive fuera del proyecto rechazado: {path}',
83
+ section_not_found: 'memory:trim: sección "## What the system already has" no encontrada — nada que hacer.',
84
+ nothing_to_archive: 'memory:trim: {kept} entradas dentro de la ventana keep={keep} — nada que archivar.',
85
+ dry_run_summary: 'memory:trim [dry-run]: archivaría {archived}/{total} entradas (keep={keep}, slug activo exento). {before_kb}KB → {after_kb}KB (ahorra {saved_kb}KB). No se escribió ningún archivo.',
86
+ notify_template: 'recortando current-state.md: archivando {archived} entradas frías',
87
+ trimmed_success: 'memory:trim ✓ {archived} entradas archivadas (conservadas {kept}). {before_kb}KB → {after_kb}KB. Archivo: {archive}'
88
+ },
77
89
  memory_search: {
78
90
  query_empty: 'memory:search requiere una consulta no vacía.',
79
91
  query_too_long: 'memory:search consulta supera {max} caracteres.',
@@ -198,6 +210,7 @@ module.exports = {
198
210
  files_skipped: 'Archivos omitidos: {count}',
199
211
  dry_run_header: '⚠ DRY RUN — no se escribio ningun archivo. Mostrando lo que haria el install:',
200
212
  dry_run_done_at: 'DRY RUN: no se escribio nada en {targetDir}',
213
+ gemini_deprecation_notice: '[DEPRECATED] El tier gratuito/personal de Gemini CLI se descontinuara el 2026-06-18. Considera Codex u OpenCode para nuevos proyectos. Enterprise (Code Assist Standard/Enterprise) sigue funcionando.',
201
214
  dry_run_files_copied: 'Archivos que se copiarian (would be copied): {count}',
202
215
  dry_run_files_skipped: 'Archivos que se omitirian (would be skipped): {count}',
203
216
  next_steps: 'Siguientes pasos:',
@@ -278,6 +291,9 @@ module.exports = {
278
291
  context_conversation_language_format: '`conversation_language` no es una etiqueta BCP-47 valida',
279
292
  context_conversation_language_format_hint: 'Usa valores como en, en-US, pt-BR.',
280
293
  node_version: 'Node.js >= 18 (actual: {version})',
294
+ gemini_deprecation: 'Gemini CLI en uso - el tier gratuito termina el 2026-06-18 (enterprise no afectado)',
295
+ gemini_deprecation_hint:
296
+ 'Ejecuta `aioson permissions-generator --tool=codex` (o --tool=opencode) para migrar. Enterprise (Code Assist Standard/Enterprise) sigue funcionando; el .gemini/permissions.toml preexistente se conserva.',
281
297
  gateway_claude_pointer: 'El gateway de CLAUDE referencia archivos compartidos de AIOSON',
282
298
  gateway_claude_pointer_hint:
283
299
  'Asegura que CLAUDE.md referencie .aioson/config.md y .aioson/agents/setup.md.',
@@ -74,6 +74,18 @@ module.exports = {
74
74
  dry_run_summary: 'memory:restore [dry-run] : déplacerait {source} → {dest}.',
75
75
  restored_success: 'memory:restore ✓ {kind} « {slug} » restauré vers {dest}.'
76
76
  },
77
+ help_memory_trim:
78
+ 'aioson memory:trim [chemin] [--keep=<N>] [--archive=<path>] [--dry-run] [--json] [--locale=fr]',
79
+ memory_trim: {
80
+ hook_blocked: 'memory:trim ne peut pas être invoqué depuis un hook de runtime (tier-2 exige une action humaine).',
81
+ no_current_state: 'memory:trim : {path} introuvable (rien à élaguer).',
82
+ archive_path_escape: 'memory:trim : --archive hors du projet refusé : {path}',
83
+ section_not_found: 'memory:trim : section "## What the system already has" introuvable — rien à faire.',
84
+ nothing_to_archive: 'memory:trim : {kept} entrées dans la fenêtre keep={keep} — rien à archiver.',
85
+ dry_run_summary: 'memory:trim [dry-run] : archiverait {archived}/{total} entrées (keep={keep}, slug actif exempté). {before_kb}KB → {after_kb}KB (économise {saved_kb}KB). Aucun fichier écrit.',
86
+ notify_template: 'élagage de current-state.md : archivage de {archived} entrées froides',
87
+ trimmed_success: 'memory:trim ✓ {archived} entrées archivées (conservées {kept}). {before_kb}KB → {after_kb}KB. Archive : {archive}'
88
+ },
77
89
  memory_search: {
78
90
  query_empty: 'memory:search exige une requête non-vide.',
79
91
  query_too_long: 'memory:search requête dépasse {max} caractères.',
@@ -198,6 +210,7 @@ module.exports = {
198
210
  files_skipped: 'Fichiers ignores : {count}',
199
211
  dry_run_header: '⚠ DRY RUN — aucun fichier ecrit. Apercu de ce que install ferait :',
200
212
  dry_run_done_at: 'DRY RUN : rien n a ete ecrit dans {targetDir}',
213
+ gemini_deprecation_notice: '[DEPRECATED] Le palier gratuit/personnel de Gemini CLI sera supprime le 2026-06-18. Envisagez Codex ou OpenCode pour les nouveaux projets. Enterprise (Code Assist Standard/Enterprise) continue de fonctionner.',
201
214
  dry_run_files_copied: 'Fichiers qui seraient copies (would be copied) : {count}',
202
215
  dry_run_files_skipped: 'Fichiers qui seraient ignores (would be skipped) : {count}',
203
216
  next_steps: 'Etapes suivantes :',
@@ -277,6 +290,9 @@ module.exports = {
277
290
  context_conversation_language_format: '`conversation_language` n est pas une balise BCP-47 valide',
278
291
  context_conversation_language_format_hint: 'Utilisez des valeurs comme en, en-US, pt-BR.',
279
292
  node_version: 'Node.js >= 18 (actuel : {version})',
293
+ gemini_deprecation: 'Gemini CLI utilise - le palier gratuit se termine le 2026-06-18 (enterprise non affecte)',
294
+ gemini_deprecation_hint:
295
+ 'Lancez `aioson permissions-generator --tool=codex` (ou --tool=opencode) pour migrer. Enterprise (Code Assist Standard/Enterprise) continue de fonctionner; le .gemini/permissions.toml preexistant est conserve.',
280
296
  gateway_claude_pointer: 'La passerelle CLAUDE reference les fichiers partages AIOSON',
281
297
  gateway_claude_pointer_hint:
282
298
  'Assurez-vous que CLAUDE.md reference .aioson/config.md et .aioson/agents/setup.md.',
@@ -74,6 +74,18 @@ module.exports = {
74
74
  dry_run_summary: 'memory:restore [dry-run]: moveria {source} → {dest}.',
75
75
  restored_success: 'memory:restore ✓ {kind} "{slug}" restaurado para {dest}.'
76
76
  },
77
+ help_memory_trim:
78
+ 'aioson memory:trim [caminho] [--keep=<N>] [--archive=<path>] [--dry-run] [--json] [--locale=pt-BR]',
79
+ memory_trim: {
80
+ hook_blocked: 'memory:trim não pode ser invocado por um hook de runtime (tier-2 exige ação humana).',
81
+ no_current_state: 'memory:trim: {path} não encontrado (nada a aparar).',
82
+ archive_path_escape: 'memory:trim: --archive fora do projeto recusado: {path}',
83
+ section_not_found: 'memory:trim: seção "## What the system already has" não encontrada — nada a fazer.',
84
+ nothing_to_archive: 'memory:trim: {kept} entradas dentro da janela keep={keep} — nada a arquivar.',
85
+ dry_run_summary: 'memory:trim [dry-run]: arquivaria {archived}/{total} entradas (keep={keep}, slug ativo isento). {before_kb}KB → {after_kb}KB (economiza {saved_kb}KB). Nenhum arquivo escrito.',
86
+ notify_template: 'aparando current-state.md: arquivando {archived} entradas frias',
87
+ trimmed_success: 'memory:trim ✓ {archived} entradas arquivadas (mantidas {kept}). {before_kb}KB → {after_kb}KB. Arquivo: {archive}'
88
+ },
77
89
  memory_search: {
78
90
  query_empty: 'memory:search requer uma consulta não-vazia.',
79
91
  query_too_long: 'memory:search consulta excede {max} caracteres.',
@@ -292,6 +304,7 @@ module.exports = {
292
304
  files_skipped: 'Arquivos ignorados: {count}',
293
305
  dry_run_header: '⚠ DRY RUN — nenhum arquivo foi escrito. Mostrando o que o install faria:',
294
306
  dry_run_done_at: 'DRY RUN: nada foi escrito em {targetDir}',
307
+ gemini_deprecation_notice: '[DEPRECATED] O tier free/pessoal do Gemini CLI sera descontinuado em 2026-06-18. Considere Codex ou OpenCode para novos projetos. Enterprise (Code Assist Standard/Enterprise) continua funcionando.',
295
308
  dry_run_files_copied: 'Arquivos que seriam copiados (would be copied): {count}',
296
309
  dry_run_files_skipped: 'Arquivos que seriam ignorados (would be skipped): {count}',
297
310
  next_steps: 'Proximos passos:',
@@ -372,6 +385,9 @@ module.exports = {
372
385
  '`conversation_language` nao e uma tag BCP-47 valida',
373
386
  context_conversation_language_format_hint: 'Use valores como en, en-US, pt-BR.',
374
387
  node_version: 'Node.js >= 18 (atual: {version})',
388
+ gemini_deprecation: 'Gemini CLI em uso - tier free encerra em 2026-06-18 (enterprise nao afetado)',
389
+ gemini_deprecation_hint:
390
+ 'Rode `aioson permissions-generator --tool=codex` (ou --tool=opencode) para migrar. Enterprise (Code Assist Standard/Enterprise) continua funcionando; .gemini/permissions.toml pre-existente e preservado.',
375
391
  gateway_claude_pointer: 'Gateway do CLAUDE referencia arquivos compartilhados do AIOSON',
376
392
  gateway_claude_pointer_hint:
377
393
  'Garanta que CLAUDE.md referencie .aioson/config.md e .aioson/agents/setup.md.',
@@ -6,7 +6,7 @@ const { getCliVersionSync } = require('./version');
6
6
  const TOOLS = [
7
7
  { id: 'claude', label: 'Claude Code', desc: 'Slash commands, CLAUDE.md, .claude/' },
8
8
  { id: 'codex', label: 'Codex (OpenAI)', desc: 'AGENTS.md protocol' },
9
- { id: 'gemini', label: 'Gemini CLI', desc: 'GEMINI.md + .gemini/commands/' },
9
+ { id: 'gemini', label: 'Gemini CLI', desc: 'GEMINI.md + .gemini/commands/', deprecated: true },
10
10
  { id: 'opencode', label: 'OpenCode', desc: 'OPENCODE.md protocol' }
11
11
  ];
12
12
 
@@ -112,7 +112,8 @@ function renderScreen1(cursor, selected, warn, stdout) {
112
112
  const tool = TOOLS[i];
113
113
  const pointer = i === cursor ? '►' : ' ';
114
114
  const check = selected.has(tool.id) ? '✓' : ' ';
115
- stdout.write(` ${pointer} [${check}] ${tool.label.padEnd(20)} ${tool.desc}\n`);
115
+ const deprNote = tool.deprecated ? ' [DEPRECATED] free tier ends 2026-06-18' : '';
116
+ stdout.write(` ${pointer} [${check}] ${tool.label.padEnd(20)} ${tool.desc}${deprNote}\n`);
116
117
  }
117
118
  if (warn) stdout.write('\n ⚠ Select at least one tool to continue.\n');
118
119
  stdout.write('\n');
@@ -5,11 +5,11 @@
5
5
  // "continue last conversation" is achieved by passing the right resume flag
6
6
  // at spawn time — AIOSON never has to track an internal session ID.
7
7
  //
8
- // Used by:
9
- // - `aioson live:start --resume[=last|<id>]` to map to the correct argv
10
- // - `aioson live:start --permission-mode=yolo` to map to the correct argv
11
- // - `aioson tool:capabilities` to expose this map as JSON to UI clients
12
- // (e.g. AIOSON Play) so they don't duplicate the lookup.
8
+ // Used by:
9
+ // - `aioson live:start --resume[=last|<id>]` to map to the correct argv
10
+ // - `aioson live:start --permission-mode=yolo` to map to the correct argv
11
+ // - `aioson tool:capabilities` to expose this map as JSON to UI clients
12
+ // (e.g. AIOSON Play) so they don't duplicate the lookup.
13
13
  //
14
14
  // Keep entries minimal and source-of-truth here. Adding a new CLI = one entry.
15
15
  const TOOL_CAPS = {
@@ -18,50 +18,53 @@ const TOOL_CAPS = {
18
18
  binary: 'claude',
19
19
  supports_resume: true,
20
20
  resume_last: ['--continue'],
21
- supports_session_id: true,
22
- resume_session_id: ['--resume', '<id>'],
23
- supports_session_picker: true,
24
- session_picker: ['--resume'],
25
- supports_yolo: true,
26
- yolo_args: ['--dangerously-skip-permissions'],
27
- },
28
- codex: {
21
+ supports_session_id: true,
22
+ resume_session_id: ['--resume', '<id>'],
23
+ supports_session_picker: true,
24
+ session_picker: ['--resume'],
25
+ supports_yolo: true,
26
+ yolo_args: ['--dangerously-skip-permissions'],
27
+ },
28
+ codex: {
29
29
  install_command: 'npm install -g @openai/codex',
30
30
  binary: 'codex',
31
31
  supports_resume: true,
32
32
  resume_last: ['resume', '--last'],
33
- supports_session_id: true,
34
- resume_session_id: ['resume', '<id>'],
35
- supports_session_picker: true,
36
- session_picker: ['resume'],
37
- supports_yolo: true,
38
- yolo_args: ['--dangerously-bypass-approvals-and-sandbox'],
39
- },
40
- opencode: {
33
+ supports_session_id: true,
34
+ resume_session_id: ['resume', '<id>'],
35
+ supports_session_picker: true,
36
+ session_picker: ['resume'],
37
+ supports_yolo: true,
38
+ yolo_args: ['--dangerously-bypass-approvals-and-sandbox'],
39
+ },
40
+ opencode: {
41
41
  install_command: 'npm install -g opencode-ai',
42
42
  binary: 'opencode',
43
43
  supports_resume: true,
44
44
  resume_last: ['--continue'],
45
- supports_session_id: true,
46
- resume_session_id: ['--session', '<id>'],
47
- supports_session_picker: false,
48
- session_picker: null,
49
- supports_yolo: false,
50
- yolo_args: null,
51
- },
52
- gemini: {
45
+ supports_session_id: true,
46
+ resume_session_id: ['--session', '<id>'],
47
+ supports_session_picker: false,
48
+ session_picker: null,
49
+ supports_yolo: false,
50
+ yolo_args: null,
51
+ },
52
+ // DEPRECATED: Gemini CLI free/personal tier ends 2026-06-18. Enterprise
53
+ // (Code Assist Standard/Enterprise) unaffected. Hard removal in v1.22.
54
+ // See gemini-phaseout / CHANGELOG v1.21.x.
55
+ gemini: {
53
56
  install_command: 'npm install -g @google/gemini-cli',
54
57
  binary: 'gemini',
55
58
  supports_resume: false,
56
59
  resume_last: null,
57
- supports_session_id: false,
58
- resume_session_id: null,
59
- supports_session_picker: false,
60
- session_picker: null,
61
- supports_yolo: false,
62
- yolo_args: null,
63
- },
64
- };
60
+ supports_session_id: false,
61
+ resume_session_id: null,
62
+ supports_session_picker: false,
63
+ session_picker: null,
64
+ supports_yolo: false,
65
+ yolo_args: null,
66
+ },
67
+ };
65
68
 
66
69
  function getToolCapabilities(tool) {
67
70
  const key = String(tool || '').trim().toLowerCase();
@@ -80,7 +83,7 @@ function listSupportedTools() {
80
83
  // - '' / undefined / null / false → no resume
81
84
  // - any other string → treat as session id
82
85
  // Returns [] when the tool doesn't support resume or resumeOpt is falsy.
83
- function resolveResumeArgs(tool, resumeOpt) {
86
+ function resolveResumeArgs(tool, resumeOpt) {
84
87
  if (resumeOpt === undefined || resumeOpt === null || resumeOpt === '' || resumeOpt === false) {
85
88
  return [];
86
89
  }
@@ -101,29 +104,29 @@ function resolveResumeArgs(tool, resumeOpt) {
101
104
  }
102
105
 
103
106
  return Array.isArray(caps.resume_last) ? [...caps.resume_last] : [];
104
- }
105
-
106
- function resolvePermissionModeArgs(tool, permissionMode) {
107
- const mode = String(permissionMode || '').trim().toLowerCase();
108
- if (!mode || mode === 'default') return [];
109
- if (mode !== 'yolo') {
110
- throw new Error(`permission_mode_unknown:${permissionMode}`);
111
- }
112
-
113
- const caps = getToolCapabilities(tool);
114
- if (!caps) {
115
- throw new Error(`tool_unknown:${tool}`);
116
- }
117
- if (!caps.supports_yolo || !Array.isArray(caps.yolo_args)) {
118
- throw new Error(`permission_mode_unsupported:${tool}:yolo`);
119
- }
120
- return [...caps.yolo_args];
121
- }
122
-
123
- module.exports = {
124
- TOOL_CAPS,
125
- getToolCapabilities,
126
- listSupportedTools,
127
- resolveResumeArgs,
128
- resolvePermissionModeArgs,
129
- };
107
+ }
108
+
109
+ function resolvePermissionModeArgs(tool, permissionMode) {
110
+ const mode = String(permissionMode || '').trim().toLowerCase();
111
+ if (!mode || mode === 'default') return [];
112
+ if (mode !== 'yolo') {
113
+ throw new Error(`permission_mode_unknown:${permissionMode}`);
114
+ }
115
+
116
+ const caps = getToolCapabilities(tool);
117
+ if (!caps) {
118
+ throw new Error(`tool_unknown:${tool}`);
119
+ }
120
+ if (!caps.supports_yolo || !Array.isArray(caps.yolo_args)) {
121
+ throw new Error(`permission_mode_unsupported:${tool}:yolo`);
122
+ }
123
+ return [...caps.yolo_args];
124
+ }
125
+
126
+ module.exports = {
127
+ TOOL_CAPS,
128
+ getToolCapabilities,
129
+ listSupportedTools,
130
+ resolveResumeArgs,
131
+ resolvePermissionModeArgs,
132
+ };
@@ -248,12 +248,18 @@ async function buildPrompt({ targetDir, agent, evaluation, sessionId }) {
248
248
 
249
249
  function buildInstructions(targets) {
250
250
  const names = targets.map((t) => `bootstrap/${t}`).join(', ');
251
- return [
251
+ const parts = [
252
252
  `Edit only: ${names}.`,
253
253
  'Remove obsolete entries. Add new capabilities. Preserve YAML frontmatter.',
254
- 'Update the `generated_at` field in each touched file.',
255
- 'When done, write the result via `aioson memory:reflect-commit` (do not edit other files).'
256
- ].join(' ');
254
+ 'Update the `generated_at` field in each touched file.'
255
+ ];
256
+ if (targets.includes('current-state.md')) {
257
+ // Tag entries so the feature:close / memory:trim rollup can attribute and
258
+ // date them (agent-loading-contract P0).
259
+ parts.push('In current-state.md, prefix each new entry under "## What the system already has" with `[{feature-slug} · {YYYY-MM-DD}]`.');
260
+ }
261
+ parts.push('When done, write the result via `aioson memory:reflect-commit` (do not edit other files).');
262
+ return parts.join(' ');
257
263
  }
258
264
 
259
265
  function hasFrontmatter(text) {
@@ -195,6 +195,9 @@ function tomlString(value) {
195
195
  function buildGeminiToml({ shellPatterns, aiosonCommands, denyShellPatterns = [], denyAiosonCommands = [] }, tool) {
196
196
  const lines = [];
197
197
  lines.push('# Generated by aioson permissions-generator. Do not edit by hand.');
198
+ lines.push('# WARNING: Gemini CLI free tier ends 2026-06-18. This file remains');
199
+ lines.push('# functional for enterprise users (Code Assist Standard/Enterprise).');
200
+ lines.push('# See AIOSON CHANGELOG v1.21.x for migration guidance.');
198
201
  lines.push('version = "1.1"');
199
202
  lines.push(`mode = ${tomlString(tool.mode || 'guarded')}`);
200
203
  lines.push(`requires_tty = ${Boolean(tool.requires_tty)}`);
@@ -33,6 +33,8 @@ Also read when present:
33
33
 
34
34
  This gives you full semantic understanding of the system without reading the codebase directly.
35
35
 
36
+ > `current-state.md` is the **hot log** (recent + active-feature entries only). Older shipped capabilities are in `current-state-archive.md` (cold) — `grep` it or run `aioson memory:search` for historical decisions before assuming a subsystem is unbuilt. Never load the archive at activation. See `.aioson/design-docs/agent-loading-contract.md`.
37
+
36
38
  ## Feature dossier
37
39
 
38
40
  Before loading per-slug PRD/spec, check `.aioson/context/features/{slug}/dossier.md`. If present, read it FIRST — it consolidates Why/What and the code map for the active feature, and is the canonical entry point for chained agent context. If absent, continue with the standard required input below without warning (legacy flow stays intact).
@@ -145,6 +147,7 @@ Action: /pm or /dev
145
147
  - If a decision is deferred, document why.
146
148
  - If `readiness.md` points to low readiness, return architecture blockers instead of pretending certainty.
147
149
  - Load architecture docs and skills on demand, not as a giant context bundle.
150
+ - For maintainability / performance / componentization assessment of existing code, load the shared lens `.aioson/docs/quality/code-health-analysis.md` on demand.
148
151
 
149
152
  ## Responsibilities
150
153
  - Define folder/module structure by stack and classification size.
@@ -146,7 +146,7 @@ type(scope): short description in imperative mood
146
146
  - run `aioson git:guard . --json` again immediately before commit
147
147
  - if still safe, execute the commit
148
148
  - if not safe, stop and explain why
149
- - **after a successful commit**: if `.aioson/context/bootstrap/current-state.md` exists, append one line under `## What the system already has` summarizing what the commit added (use the commit subject — keep append-only, never replace); then delete `.aioson/context/commit-prep.json` so it is never reused accidentally
149
+ - **after a successful commit**: if `.aioson/context/bootstrap/current-state.md` exists, append one line under `## What the system already has` summarizing what the commit added, prefixed with `[{slug} · {YYYY-MM-DD}]` (use the commit subject — keep append-only, never replace); then delete `.aioson/context/commit-prep.json` so it is never reused accidentally
150
150
  4. If the user does **not** approve the draft, do **not** delete `commit-prep.json` — keep it for the next attempt.
151
151
 
152
152
  ## Observability
@@ -48,7 +48,7 @@ Read `.aioson/context/dev-state.md` if it exists.
48
48
 
49
49
  **dev-state.md NOT found (cold start):**
50
50
  - Read only: `project.context.md` + `features.md` (if present). Stop there.
51
- - **Bootstrap:** read `bootstrap/how-it-works.md` + `bootstrap/current-state.md` if present.
51
+ - **Bootstrap:** read `bootstrap/how-it-works.md` + `bootstrap/current-state.md` (hot log) if present. Older shipped work is in `bootstrap/current-state-archive.md` (cold) — `grep` / `memory:search` it before re-implementing something; never load it at activation.
52
52
  - Ask what feature/task to work on.
53
53
  - Run `aioson memory:summary . --last=5`, then `aioson context:pack . --agent=dev --goal="<goal>"`.
54
54
  - Tags: run `aioson brain:query . --tags=<tags> --min-quality=4`.
@@ -241,7 +241,7 @@ These rules apply even if no extra dev doc was loaded:
241
241
  5. Run the actual verification command before marking any step done
242
242
  6. Keep `skeleton-system.md` current when files materially change
243
243
  7. If repeated debugging stalls, load the debugging protocol instead of guessing
244
- 8. After a significant slice or phase lands, append one line to `.aioson/context/bootstrap/current-state.md` under `## What the system already has` describing the new capability. Append-only; never replace existing entries. Skip if `bootstrap/` does not exist.
244
+ 8. After a significant slice or phase lands, append one line to `.aioson/context/bootstrap/current-state.md` under `## What the system already has` describing the new capability, prefixed with `[{slug} · {YYYY-MM-DD}]` so it can be archived precisely later. Append-only; never replace existing entries. Skip if `bootstrap/` does not exist.
245
245
 
246
246
  ## Motor AIOSON — hardening rules (must respect)
247
247
 
@@ -24,7 +24,7 @@ Beyond the bootstrap gate, `@deyvin` operates with 9 memory layers. Load each **
24
24
 
25
25
  | Layer | Path | When to consult |
26
26
  |-------|------|-----------------|
27
- | Bootstrap (Living Memory) | `.aioson/context/bootstrap/*.md` | Always — first, before reasoning |
27
+ | Bootstrap (Living Memory) | `.aioson/context/bootstrap/*.md` | Always — first, before reasoning. `current-state.md` is the hot log; `current-state-archive.md` is cold (grep / `memory:search` on demand, never at activation) — see `.aioson/design-docs/agent-loading-contract.md` |
28
28
  | Project pulse | `.aioson/context/project-pulse.md` | Session start; learn last agent + active feature + blockers |
29
29
  | Dev-state | `.aioson/context/dev-state.md` | If a feature is in progress (continuity case) |
30
30
  | Feature dossier | `.aioson/context/features/{slug}/dossier.md` | If a feature slug is known — Why/What + code map |
@@ -77,6 +77,7 @@ The detailed pair-programming protocol is split into on-demand framework docs:
77
77
  - `.aioson/docs/deyvin/pair-execution.md`
78
78
  - `.aioson/docs/deyvin/runtime-handoffs.md`
79
79
  - `.aioson/docs/deyvin/debugging-escalation.md`
80
+ - `.aioson/docs/quality/code-health-analysis.md` (shared improvement lens — apply to a slice; escalate if the analysis spans the whole system)
80
81
 
81
82
  ## Deterministic preflight
82
83
 
@@ -285,6 +285,7 @@ The framework playbooks above cover the AIOSON-internal review surface. For app-
285
285
 
286
286
  | Doc | Load when |
287
287
  |---|---|
288
+ | `.aioson/docs/quality/code-health-analysis.md` | Tracing the **execution chain** of a sensitive flow, or judging where test/regression coverage of an attack-relevant path is weak — shared improvement lens (coverage · regression · execution-chain · perf · componentization) |
288
289
  | `.aioson/docs/pentester/app-playbooks.md` | `review_contract.target_mode = app_target` — full step-by-step methodology for TS-A01..A07 with OWASP ASVS 5.0 mapping, multi-identity setup for IDOR/BOLA, last-byte sync for race conditions, SSRF probe set, auth/MFA bypass tests |
289
290
  | `.aioson/docs/pentester/browser-dast-playbook.md` | `review_contract.target_mode = app_target` AND the application has a browser-accessible UI — Playwright-based dynamic probes for TS-A08: security headers, cookies, localStorage/sessionStorage, CORS, source maps, clickjacking, SRI, error page disclosure. **Mandatory Phase 0:** run `aioson qa:run --persona=hacker` + `aioson qa:scan` as automated baseline before manual probes |
290
291
  | `.aioson/docs/pentester/llm-supplychain.md` | Feature touches LLM prompts, RAG, tool invocation, `package.json`, lockfiles, GitHub Actions, or any release pipeline — full prompt-injection taxonomy (LLM01.1/.2/.3), supply-chain incidents, SAST/DAST/secrets tool catalog, SLSA + Sigstore |
@@ -26,6 +26,8 @@ If `.aioson/context/bootstrap/` exists, read these files before starting review:
26
26
  - `.aioson/context/bootstrap/what-is.md` — system identity and current state
27
27
  - `.aioson/context/bootstrap/current-state.md` — capabilities already shipped (so the review does not flag implemented features as missing or scope-creep recently-landed work)
28
28
 
29
+ > `current-state.md` is the **hot log** (recent + active-feature entries only). Older shipped capabilities are in `current-state-archive.md` (cold) — `grep` it or run `aioson memory:search` before flagging a capability as missing/unbuilt. Never load the archive at activation. See `.aioson/design-docs/agent-loading-contract.md`.
30
+
29
31
  Use this knowledge to evaluate the feature in the context of the system around it, not in isolation. Skip silently when `bootstrap/` is absent.
30
32
 
31
33
  **Bootstrap gate (Living Memory):** before starting, run `aioson memory:status .` if available. If `Bootstrap < 4/4` or the files are older than 30 days, surface a warning at the top of your QA report:
@@ -169,6 +171,8 @@ When AIOSON CLI is available and feature mode is MEDIUM, prefer the tracked invo
169
171
  3. **Write missing tests** — for Critical/High findings, write the test. Do not just describe it.
170
172
  4. **Deliver report** — ordered by severity, each finding: location + risk + fix.
171
173
 
174
+ > For deeper improvement analysis — coverage gaps, regression need, execution-chain, performance, componentization/maintainability — load the shared lens `.aioson/docs/quality/code-health-analysis.md` on demand (routes coverage→@tester, structure/perf→@architect).
175
+
172
176
  ## Risk-first checklist
173
177
 
174
178
  ### Business rules
@@ -214,6 +214,7 @@ The detailed Sheldon protocol is split into on-demand framework docs:
214
214
  - `.aioson/docs/sheldon/web-intelligence.md`
215
215
  - `.aioson/docs/sheldon/quality-lens.md`
216
216
  - `.aioson/docs/sheldon/enrichment-paths.md`
217
+ - `.aioson/docs/quality/code-health-analysis.md` (shared improvement lens — coverage · regression · execution-chain · performance · componentization/maintainability)
217
218
 
218
219
  ## Deterministic preflight
219
220
 
@@ -456,6 +456,8 @@ Run the security regression tests. If any fail, it means the fix is incomplete
456
456
 
457
457
  Don't auto-load. Add only when the trigger fires. Full details: `.aioson/docs/tester/coverage-quality.md` § 6.
458
458
 
459
+ > Scoping **where** the code needs more/better tests, a regression guard, or tracing the execution chain before writing them? Load the shared improvement lens `.aioson/docs/quality/code-health-analysis.md` (plan → investigate → refine → operate → test → adjust).
460
+
459
461
  | Layer | Trigger | Tooling |
460
462
  |---|---|---|
461
463
  | Snapshot | Stable UI/DOM/JSON output | vitest/jest snapshots; sanitize timestamps + IDs first |
@@ -45,6 +45,7 @@
45
45
  "memory:refresh",
46
46
  "memory:archive",
47
47
  "memory:restore",
48
+ "memory:trim",
48
49
  "workflow:next",
49
50
  "workflow:heal",
50
51
  "live:handoff",