@technomoron/agent-run 0.99.12 → 0.99.13

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.
package/CHANGES CHANGED
@@ -1,8 +1,9 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
- Unreleased (2026-04-24)
5
- -----------------------
4
+ Version 0.99.13 (2026-04-27)
5
+ ----------------------------
6
+ * Render each profile's generated files and runtime state under `live/`, leaving the profile root for source config and templates.
6
7
 
7
8
  Version 0.99.12 (2026-04-27)
8
9
  ----------------------------
package/dist/agent-run.js CHANGED
@@ -22,28 +22,13 @@ const CONFIG_DIR_ENV = 'AGENT_CONFIG_DIR';
22
22
  const VERBOSE_ENV = 'AGENT_RUN_VERBOSE';
23
23
  const MANIFEST_FILE_NAME = 'agent-run.jsonc';
24
24
  const LOCAL_TEMPLATE_FILE_NAME = 'local.md.njk';
25
+ const LIVE_DIR_NAME = 'live';
25
26
  const PACKAGE_VERSION = '0.99.10';
26
27
  const UNEXPANDED_TEMPLATE_RE = /\{\{[^}]+\}\}|\{%[^%]+%\}/;
27
28
  const agentRunEnvCache = new Map();
28
29
  const GENERATED_GITIGNORE_ENTRIES = [
29
- '# Generated agent-run files',
30
- '**/AGENTS.md',
31
- '**/CLAUDE.md',
32
- '**/GEMINI.md',
33
- '**/config.toml',
34
- '',
35
- '# Generated native agent homes',
36
- '**/.agents/',
37
- '**/.claude/',
38
- '**/.codex/',
39
- '',
40
- '# Generated runtime files',
41
- '**/bin/',
42
- '**/reviews/',
43
- '**/memories/',
44
- '',
45
- '# Generated review reports',
46
- '**/REVIEW-*.md',
30
+ '# Generated agent-run live profiles',
31
+ '**/live/',
47
32
  '',
48
33
  '# Optional generated caches',
49
34
  '**/.agent-run-cache/'
@@ -670,7 +655,8 @@ function runCheck(parsed) {
670
655
  }
671
656
  function printUpdateSummary(rendered) {
672
657
  process.stdout.write(`OK profile ${rendered.profile}\n`);
673
- process.stdout.write(`Agent dir: ${rendered.agentDir}\n`);
658
+ process.stdout.write(`Profile dir: ${rendered.agentDir}\n`);
659
+ process.stdout.write(`Live dir: ${rendered.context.paths.liveDir}\n`);
674
660
  process.stdout.write(`Generated files: ${rendered.files.length}\n`);
675
661
  process.stdout.write(`Installed skills: ${rendered.skills.map((skill) => skill.name).join(', ') || '(none)'}\n`);
676
662
  }
@@ -992,29 +978,33 @@ function createNunjucksEnv(configRoot) {
992
978
  throwOnUndefined: true
993
979
  });
994
980
  }
995
- function buildRenderContext(projectRoot, agentDir, configRoot, manifest, env) {
981
+ function buildRenderContext(projectRoot, profileDir, configRoot, manifest, env) {
996
982
  const date = localDateString();
983
+ const liveDir = path.join(profileDir, LIVE_DIR_NAME);
997
984
  const baseContext = {
998
985
  profile: manifest.profile,
999
986
  kind: manifest.kind,
1000
987
  projectRoot,
1001
- agentDir,
988
+ agentDir: liveDir,
989
+ profileDir,
1002
990
  configRoot,
1003
991
  date,
1004
992
  checks: manifest.checks,
1005
993
  guardrails: manifest.guardrails
1006
994
  };
1007
995
  const paths = {
996
+ profileDir,
997
+ liveDir,
1008
998
  changesFile: resolveRuntimePath(configRoot, manifest.paths.changesFile, env, baseContext),
1009
999
  reviewDir: resolveRuntimePath(configRoot, manifest.paths.reviewDir, env, baseContext),
1010
1000
  reviewFile: resolveRuntimePath(configRoot, manifest.paths.reviewFile, env, baseContext),
1011
1001
  memoriesDir: resolveRuntimePath(configRoot, manifest.paths.memoriesDir, env, baseContext),
1012
1002
  globalMemoryDir: globalMemoryDir(configRoot),
1013
1003
  codexHomeDir: path.join(resolveRuntimePath(configRoot, manifest.paths.memoriesDir, env, baseContext), 'codex-home'),
1014
- overridesDir: path.join(agentDir, 'overrides'),
1015
- codexSkillsDir: path.join(agentDir, '.agents', 'skills'),
1016
- claudeSkillsDir: path.join(agentDir, '.claude', 'skills'),
1017
- binDir: path.join(agentDir, 'bin')
1004
+ overridesDir: path.join(profileDir, 'overrides'),
1005
+ codexSkillsDir: path.join(liveDir, '.agents', 'skills'),
1006
+ claudeSkillsDir: path.join(liveDir, '.claude', 'skills'),
1007
+ binDir: path.join(liveDir, 'bin')
1018
1008
  };
1019
1009
  return {
1020
1010
  ...baseContext,
@@ -1135,11 +1125,14 @@ function renderProfile(projectRoot, agentDir, checkOnly = false) {
1135
1125
  const files = [];
1136
1126
  const agentsContent = renderToolInstructions('AGENTS.md', env, configRoot, context, false);
1137
1127
  const claudeContent = renderToolInstructions('CLAUDE.md', env, configRoot, context, true);
1138
- files.push({ path: path.join(agentDir, 'AGENTS.md'), content: agentsContent });
1139
- files.push({ path: path.join(agentDir, 'CLAUDE.md'), content: claudeContent });
1140
- files.push({ path: path.join(agentDir, '.claude', 'CLAUDE.md'), content: claudeContent });
1141
- files.push({ path: path.join(agentDir, 'config.toml'), content: renderCodexConfig(env, configRoot, context) });
1142
- files.push({ path: path.join(agentDir, '.claude', 'agent-run-settings.json'), content: renderClaudeSettings(env, configRoot, context) });
1128
+ files.push({ path: path.join(context.paths.liveDir, 'AGENTS.md'), content: agentsContent });
1129
+ files.push({ path: path.join(context.paths.liveDir, 'CLAUDE.md'), content: claudeContent });
1130
+ files.push({ path: path.join(context.paths.liveDir, '.claude', 'CLAUDE.md'), content: claudeContent });
1131
+ files.push({ path: path.join(context.paths.liveDir, 'config.toml'), content: renderCodexConfig(env, configRoot, context) });
1132
+ files.push({
1133
+ path: path.join(context.paths.liveDir, '.claude', 'agent-run-settings.json'),
1134
+ content: renderClaudeSettings(env, configRoot, context)
1135
+ });
1143
1136
  files.push(...renderNativeSkillFiles(context));
1144
1137
  files.push(...renderGuardShims(context));
1145
1138
  return {
@@ -1161,15 +1154,22 @@ function syncAgentProfile(projectRoot, agentDir) {
1161
1154
  return rendered;
1162
1155
  }
1163
1156
  function removeLegacyGeneratedClaudeSettings(context) {
1164
- const legacyPath = path.join(context.agentDir, '.claude', 'settings.json');
1165
- if (!fs.existsSync(legacyPath)) {
1166
- return;
1167
- }
1168
- const actual = fs.readFileSync(legacyPath, 'utf8').replace(/\r\n/g, '\n');
1169
- const legacyGeneratedContent = legacyDefaultClaudeSettingsContent(context);
1170
- if (actual === legacyGeneratedContent) {
1171
- fs.rmSync(legacyPath);
1172
- verbose(`removed legacy generated Claude settings ${legacyPath}`);
1157
+ for (const legacyPath of [
1158
+ path.join(context.paths.liveDir, '.claude', 'settings.json'),
1159
+ path.join(context.profileDir, '.claude', 'settings.json')
1160
+ ]) {
1161
+ if (!fs.existsSync(legacyPath)) {
1162
+ continue;
1163
+ }
1164
+ const actual = fs.readFileSync(legacyPath, 'utf8').replace(/\r\n/g, '\n');
1165
+ const legacyGeneratedContents = [
1166
+ legacyDefaultClaudeSettingsContent(context, context.agentDir),
1167
+ legacyDefaultClaudeSettingsContent(context, context.profileDir)
1168
+ ];
1169
+ if (legacyGeneratedContents.includes(actual)) {
1170
+ fs.rmSync(legacyPath);
1171
+ verbose(`removed legacy generated Claude settings ${legacyPath}`);
1172
+ }
1173
1173
  }
1174
1174
  }
1175
1175
  function checkRenderedProfile(projectRoot, agentDir) {
@@ -1191,6 +1191,7 @@ function checkRenderedProfile(projectRoot, agentDir) {
1191
1191
  rendered.context.paths.reviewDir,
1192
1192
  rendered.context.paths.memoriesDir,
1193
1193
  rendered.context.paths.codexHomeDir,
1194
+ rendered.context.paths.liveDir,
1194
1195
  rendered.context.paths.overridesDir,
1195
1196
  rendered.context.paths.codexSkillsDir,
1196
1197
  rendered.context.paths.claudeSkillsDir,
@@ -1312,7 +1313,7 @@ function syncRuntimeDirs(context) {
1312
1313
  context.paths.codexSkillsDir,
1313
1314
  context.paths.claudeSkillsDir,
1314
1315
  context.paths.binDir,
1315
- path.join(context.agentDir, '.claude')
1316
+ path.join(context.paths.liveDir, '.claude')
1316
1317
  ]) {
1317
1318
  fs.mkdirSync(dir, { recursive: true });
1318
1319
  }
@@ -1522,17 +1523,19 @@ function formatError(error) {
1522
1523
  return error instanceof Error ? error.message : String(error);
1523
1524
  }
1524
1525
  function runCodex(realBinary, permissionArgs, agentDir, configRoot, args, projectRoot, wrapperArgs) {
1525
- const agentsPath = path.join(agentDir, 'AGENTS.md');
1526
+ const liveDir = profileLiveDir(agentDir);
1527
+ const agentsPath = path.join(liveDir, 'AGENTS.md');
1526
1528
  if (!fs.existsSync(agentsPath)) {
1527
1529
  failMissingConfig('codex', agentDir);
1528
1530
  }
1529
- const guardBin = path.join(agentDir, 'bin');
1530
- const codexHomeDir = path.join(agentDir, 'memories', 'codex-home');
1531
+ const guardBin = path.join(liveDir, 'bin');
1532
+ const codexHomeDir = path.join(liveDir, 'memories', 'codex-home');
1531
1533
  fs.mkdirSync(codexHomeDir, { recursive: true });
1532
1534
  const env = {
1533
1535
  ...process.env,
1534
1536
  CODEX_HOME: codexHomeDir,
1535
- AGENT_DIR: agentDir,
1537
+ AGENT_DIR: liveDir,
1538
+ AGENT_PROFILE_DIR: agentDir,
1536
1539
  AGENT_RUN_PROJECT_ROOT: projectRoot,
1537
1540
  PATH: `${guardBin}${path.delimiter}${process.env.PATH ?? ''}`
1538
1541
  };
@@ -1561,16 +1564,18 @@ function buildCodexRuntimeArgs(wrapperArgs) {
1561
1564
  return ['-a', 'never', '-s', 'danger-full-access'];
1562
1565
  }
1563
1566
  function runClaude(realBinary, permissionArgs, agentDir, configRoot, args, projectRoot, wrapperArgs) {
1564
- const claudePath = path.join(agentDir, 'CLAUDE.md');
1567
+ const liveDir = profileLiveDir(agentDir);
1568
+ const claudePath = path.join(liveDir, 'CLAUDE.md');
1565
1569
  if (!fs.existsSync(claudePath)) {
1566
1570
  failMissingConfig('claude', agentDir);
1567
1571
  }
1568
- const guardBin = path.join(agentDir, 'bin');
1569
- const claudeConfigDir = path.join(agentDir, '.claude');
1572
+ const guardBin = path.join(liveDir, 'bin');
1573
+ const claudeConfigDir = path.join(liveDir, '.claude');
1570
1574
  const env = {
1571
1575
  ...process.env,
1572
1576
  CLAUDE_CONFIG_DIR: claudeConfigDir,
1573
- AGENT_DIR: agentDir,
1577
+ AGENT_DIR: liveDir,
1578
+ AGENT_PROFILE_DIR: agentDir,
1574
1579
  AGENT_RUN_PROJECT_ROOT: projectRoot,
1575
1580
  PATH: `${guardBin}${path.delimiter}${process.env.PATH ?? ''}`
1576
1581
  };
@@ -1581,11 +1586,14 @@ function runClaude(realBinary, permissionArgs, agentDir, configRoot, args, proje
1581
1586
  '--add-dir',
1582
1587
  projectRoot,
1583
1588
  '--add-dir',
1584
- agentDir,
1589
+ liveDir,
1585
1590
  ...globalMemoryArgs(configRoot),
1586
1591
  ...args
1587
1592
  ], shouldUseShell(realBinary), env, projectRoot, (code) => postflightProjectCheck(projectRoot, agentDir, wrapperArgs.local, code));
1588
1593
  }
1594
+ function profileLiveDir(agentDir) {
1595
+ return path.join(agentDir, LIVE_DIR_NAME);
1596
+ }
1589
1597
  function globalMemoryArgs(configRoot) {
1590
1598
  const memoryDir = globalMemoryDir(configRoot);
1591
1599
  return fs.existsSync(memoryDir) ? ['--add-dir', memoryDir] : [];
@@ -2135,6 +2143,12 @@ function defaultLocalTemplate(_profile) {
2135
2143
  '{{ agentDir }}',
2136
2144
  '```',
2137
2145
  '',
2146
+ 'Profile source directory:',
2147
+ '',
2148
+ '```text',
2149
+ '{{ profileDir }}',
2150
+ '```',
2151
+ '',
2138
2152
  'Add project-specific rules here.',
2139
2153
  ''
2140
2154
  ].join('\n');
@@ -2177,7 +2191,8 @@ function defaultNoAiFilesSnippet() {
2177
2191
  '## Agent File Storage',
2178
2192
  '',
2179
2193
  'Do not create AGENTS.md, CLAUDE.md, .agents, .claude, .codex, or other agent runtime files inside the project repository.',
2180
- 'Agent-only files belong under {{ agentDir }}.',
2194
+ 'Generated agent-only files belong under {{ paths.liveDir }}.',
2195
+ 'Source config files belong under {{ profileDir }}.',
2181
2196
  ''
2182
2197
  ].join('\n');
2183
2198
  }
@@ -2249,8 +2264,8 @@ function defaultToolInstructionsTemplate(isClaude) {
2249
2264
  'Do not edit this file directly. Edit:',
2250
2265
  '',
2251
2266
  '```text',
2252
- '{{ agentDir }}/agent-run.jsonc',
2253
- '{{ agentDir }}/local.md.njk',
2267
+ '{{ profileDir }}/agent-run.jsonc',
2268
+ '{{ profileDir }}/local.md.njk',
2254
2269
  '```',
2255
2270
  '',
2256
2271
  '{% for section in renderedAgentSections %}',
@@ -2271,6 +2286,12 @@ function defaultToolInstructionsTemplate(isClaude) {
2271
2286
  '{{ agentDir }}',
2272
2287
  '```',
2273
2288
  '',
2289
+ 'Profile source directory:',
2290
+ '',
2291
+ '```text',
2292
+ '{{ profileDir }}',
2293
+ '```',
2294
+ '',
2274
2295
  'Review directory:',
2275
2296
  '',
2276
2297
  '```text',
@@ -2310,13 +2331,14 @@ function defaultToolInstructionsTemplate(isClaude) {
2310
2331
  '## Tool Note',
2311
2332
  '',
2312
2333
  isClaude
2313
- ? 'Claude uses the generated config directory under {{ agentDir }}/.claude and may read {{ agentDir }} via `--add-dir`.'
2334
+ ? 'Claude uses the generated config directory under {{ paths.liveDir }}/.claude and may read {{ paths.liveDir }} via `--add-dir`.'
2314
2335
  : 'Codex uses {{ agentDir }}/AGENTS.md as `system_prompt_file` and {{ paths.codexHomeDir }} as CODEX_HOME.',
2315
2336
  '',
2316
2337
  '## Mandatory Path Rule',
2317
2338
  '',
2318
2339
  'Do not create AGENTS.md, CLAUDE.md, .agents, .claude, .codex, or AI-related files inside the project repository.',
2319
- 'Agent-only files must be stored under the agent directory shown above.',
2340
+ 'Generated agent-only files must be stored under the agent directory shown above.',
2341
+ 'Source config files must be stored under the profile source directory shown above.',
2320
2342
  ''
2321
2343
  ].join('\n');
2322
2344
  }
@@ -2331,6 +2353,7 @@ function defaultCodexConfigTemplate() {
2331
2353
  'writable_roots = [',
2332
2354
  ' "{{ projectRoot }}",',
2333
2355
  ' "{{ agentDir }}",',
2356
+ ' "{{ profileDir }}",',
2334
2357
  ' "{{ paths.globalMemoryDir }}"',
2335
2358
  ']',
2336
2359
  'network_access = false',
@@ -2341,6 +2364,7 @@ function defaultClaudeSettingsTemplate() {
2341
2364
  const envBlock = [
2342
2365
  ' "env": {',
2343
2366
  ' "AGENT_DIR": "{{ agentDir }}",',
2367
+ ' "AGENT_PROFILE_DIR": "{{ profileDir }}",',
2344
2368
  ' "AGENT_RUN_PROJECT_ROOT": "{{ projectRoot }}",',
2345
2369
  ' "AGENT_GLOBAL_MEMORY_DIR": "{{ paths.globalMemoryDir }}"',
2346
2370
  ' }'
@@ -2371,6 +2395,7 @@ function defaultCodexConfigContent(context) {
2371
2395
  'writable_roots = [',
2372
2396
  ` ${jsonString(context.projectRoot)},`,
2373
2397
  ` ${jsonString(context.agentDir)},`,
2398
+ ` ${jsonString(context.profileDir)},`,
2374
2399
  ` ${jsonString(context.paths.globalMemoryDir)}`,
2375
2400
  ']',
2376
2401
  'network_access = false',
@@ -2381,6 +2406,7 @@ function defaultClaudeSettingsContent(context) {
2381
2406
  const settings = {
2382
2407
  env: {
2383
2408
  AGENT_DIR: context.agentDir,
2409
+ AGENT_PROFILE_DIR: context.profileDir,
2384
2410
  AGENT_RUN_PROJECT_ROOT: context.projectRoot,
2385
2411
  AGENT_GLOBAL_MEMORY_DIR: context.paths.globalMemoryDir
2386
2412
  }
@@ -2390,10 +2416,10 @@ function defaultClaudeSettingsContent(context) {
2390
2416
  }
2391
2417
  return `${JSON.stringify(settings, null, 2)}\n`;
2392
2418
  }
2393
- function legacyDefaultClaudeSettingsContent(context) {
2419
+ function legacyDefaultClaudeSettingsContent(context, agentDir) {
2394
2420
  return `${JSON.stringify({
2395
2421
  env: {
2396
- AGENT_DIR: context.agentDir,
2422
+ AGENT_DIR: agentDir,
2397
2423
  AGENT_RUN_PROJECT_ROOT: context.projectRoot,
2398
2424
  AGENT_GLOBAL_MEMORY_DIR: context.paths.globalMemoryDir
2399
2425
  }
@@ -1,21 +1,5 @@
1
- # Generated agent-run files
2
- **/AGENTS.md
3
- **/CLAUDE.md
4
- **/GEMINI.md
5
- **/config.toml
6
-
7
- # Generated native agent homes
8
- **/.agents/
9
- **/.claude/
10
- **/.codex/
11
-
12
- # Generated runtime files
13
- **/bin/
14
- **/reviews/
15
- **/memories/
16
-
17
- # Generated review reports
18
- **/REVIEW-*.md
1
+ # Generated agent-run live profiles
2
+ **/live/
19
3
 
20
4
  # Optional generated caches
21
5
  **/.agent-run-cache/
@@ -7,3 +7,9 @@ Agent directory:
7
7
  ```text
8
8
  {{ agentDir }}
9
9
  ```
10
+
11
+ Profile source directory:
12
+
13
+ ```text
14
+ {{ profileDir }}
15
+ ```
@@ -10,6 +10,7 @@ Do not edit this generated file. Edit `agent-run.jsonc` and `local.md.njk`.
10
10
 
11
11
  - projectRoot: `{{ projectRoot }}`
12
12
  - agentDir: `{{ agentDir }}`
13
+ - profileDir: `{{ profileDir }}`
13
14
  - reviewFile: `{{ paths.reviewFile }}`
14
15
  - memoriesDir: `{{ paths.memoriesDir }}`
15
16
  - globalMemoryDir: `{{ paths.globalMemoryDir }}`
@@ -1,6 +1,7 @@
1
1
  {% if permissionsAllow.length %}{
2
2
  "env": {
3
3
  "AGENT_DIR": "{{ agentDir }}",
4
+ "AGENT_PROFILE_DIR": "{{ profileDir }}",
4
5
  "AGENT_RUN_PROJECT_ROOT": "{{ projectRoot }}",
5
6
  "AGENT_GLOBAL_MEMORY_DIR": "{{ paths.globalMemoryDir }}",
6
7
  "STARTER_PROFILE": "{{ profile }}"
@@ -14,6 +15,7 @@
14
15
  {% else %}{
15
16
  "env": {
16
17
  "AGENT_DIR": "{{ agentDir }}",
18
+ "AGENT_PROFILE_DIR": "{{ profileDir }}",
17
19
  "AGENT_RUN_PROJECT_ROOT": "{{ projectRoot }}",
18
20
  "AGENT_GLOBAL_MEMORY_DIR": "{{ paths.globalMemoryDir }}",
19
21
  "STARTER_PROFILE": "{{ profile }}"
@@ -6,6 +6,7 @@ sandbox_mode = "workspace-write"
6
6
  writable_roots = [
7
7
  "{{ projectRoot }}",
8
8
  "{{ agentDir }}",
9
+ "{{ profileDir }}",
9
10
  "{{ paths.memoriesDir }}",
10
11
  "{{ paths.globalMemoryDir }}"
11
12
  ]
@@ -3,3 +3,4 @@
3
3
  This starter profile belongs to `{{ profile }}`.
4
4
 
5
5
  Use the project root at `{{ projectRoot }}` and keep generated files in `{{ agentDir }}`.
6
+ Keep source profile edits in `{{ profileDir }}`.
@@ -1,6 +1,7 @@
1
1
  {% if permissionsAllow.length %}{
2
2
  "env": {
3
3
  "AGENT_DIR": "{{ agentDir }}",
4
+ "AGENT_PROFILE_DIR": "{{ profileDir }}",
4
5
  "AGENT_RUN_PROJECT_ROOT": "{{ projectRoot }}",
5
6
  "AGENT_GLOBAL_MEMORY_DIR": "{{ paths.globalMemoryDir }}",
6
7
  "STARTER_PROFILE": "{{ profile }}",
@@ -15,6 +16,7 @@
15
16
  {% else %}{
16
17
  "env": {
17
18
  "AGENT_DIR": "{{ agentDir }}",
19
+ "AGENT_PROFILE_DIR": "{{ profileDir }}",
18
20
  "AGENT_RUN_PROJECT_ROOT": "{{ projectRoot }}",
19
21
  "AGENT_GLOBAL_MEMORY_DIR": "{{ paths.globalMemoryDir }}",
20
22
  "STARTER_PROFILE": "{{ profile }}",
@@ -6,6 +6,7 @@ sandbox_mode = "workspace-write"
6
6
  writable_roots = [
7
7
  "{{ projectRoot }}",
8
8
  "{{ agentDir }}",
9
+ "{{ profileDir }}",
9
10
  "{{ paths.memoriesDir }}",
10
11
  "{{ paths.globalMemoryDir }}"
11
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@technomoron/agent-run",
3
- "version": "0.99.12",
3
+ "version": "0.99.13",
4
4
  "packageManager": "pnpm@10.28.1",
5
5
  "bin": {
6
6
  "agent-run": "dist/agent-run.js"