@yasaswy.nagavolu/agents 0.36.2 → 0.37.1

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 (155) hide show
  1. package/README.md +12 -0
  2. package/bin/cli.js +41 -5
  3. package/content/global/code-mode/README.md +10 -0
  4. package/content/manifest.json +74 -11
  5. package/content/manifest.schema.json +1 -1
  6. package/content/mcps/chrome_devtools_final_actions.json +2 -2
  7. package/content/mods/handoff/tests/e2e/keepwarm_e2e.py +2 -3
  8. package/content/mods/handoff/tests/e2e/run_e2e.py +9 -2
  9. package/content/mods/handoff/tests/e2e/run_real_prep.py +2 -1
  10. package/content/mods/handoff/tests/e2e/tui_driver.py +2 -2
  11. package/content/mods/model-routing/tests/e2e/run_e2e.py +1 -1
  12. package/content/mods/model-routing/tests/e2e/run_routing_e2e.py +1 -1
  13. package/content/mods/model-routing/tests/e2e/run_workflow_e2e.py +1 -1
  14. package/content/proxy/README.md +1 -1
  15. package/content/proxy/git_shell_parse.py +5 -0
  16. package/content/proxy/html_mocker_monitor_guard.py +101 -3
  17. package/content/proxy/publish_guard.py +114 -4
  18. package/content/proxy/shared_worktree_revert_guard.py +101 -15
  19. package/content/proxy/shell_parse.py +102 -1
  20. package/content/scripts/spend_parse.py +163 -0
  21. package/content/scripts/spend_prices.json +13 -0
  22. package/content/scripts/spend_report.py +364 -0
  23. package/content/skills/code-is-law/lint_skill.py +19 -0
  24. package/content/skills/disk-cleanup/SKILL.md +1 -1
  25. package/content/skills/gmail-reader/SKILL.md +1 -0
  26. package/content/skills/gmail-reader/gmail_reader/purchases/__init__.py +2 -2
  27. package/content/skills/gmail-reader/gmail_reader/purchases/parse.py +29 -6
  28. package/content/skills/gmail-reader/gmail_reader/version.py +1 -1
  29. package/content/skills/gmail-reader/tests/test_amazon_recommendations.py +86 -0
  30. package/content/skills/gmail-reader/tests/test_durable.py +1 -1
  31. package/content/skills/low-ram-advisor/SKILL.md +1 -1
  32. package/content/skills/publish-article/SKILL.md +1 -1
  33. package/content/skills/resale/CONTRACTS.md +23 -5
  34. package/content/skills/resale/README.md +83 -8
  35. package/content/skills/resale/SKILL.md +8 -4
  36. package/content/skills/resale/resale/analysis/bundle.py +31 -9
  37. package/content/skills/resale/resale/analysis/gather.py +6 -3
  38. package/content/skills/resale/resale/analysis/package_terms.py +61 -0
  39. package/content/skills/resale/resale/analysis/runner.py +1 -1
  40. package/content/skills/resale/resale/analysis/stats.py +11 -5
  41. package/content/skills/resale/resale/comps/depreciation.json +20 -1
  42. package/content/skills/resale/resale/comps/depreciation.py +8 -1
  43. package/content/skills/resale/resale/comps/estimate.py +119 -0
  44. package/content/skills/resale/resale/comps/market_value.py +15 -14
  45. package/content/skills/resale/resale/comps/specs.py +1 -1
  46. package/content/skills/resale/resale/comps/trusted_retailers.json +19 -0
  47. package/content/skills/resale/resale/conditions.py +16 -0
  48. package/content/skills/resale/resale/contracts/__init__.py +11 -1
  49. package/content/skills/resale/resale/contracts/fbgroup_batch.schema.json +67 -0
  50. package/content/skills/resale/resale/contracts/fbgroup_targets.schema.json +44 -0
  51. package/content/skills/resale/resale/contracts/item_specs.schema.json +4 -1
  52. package/content/skills/resale/resale/db/migrations/0028_site_draft_url.sql +1 -0
  53. package/content/skills/resale/resale/db/migrations/0029_fb_groups.sql +37 -0
  54. package/content/skills/resale/resale/db/migrations/0030_estimate_basis.sql +14 -0
  55. package/content/skills/resale/resale/inventory/paid.py +3 -2
  56. package/content/skills/resale/resale/inventory/private_sale.py +37 -0
  57. package/content/skills/resale/resale/portal/bundles.py +22 -11
  58. package/content/skills/resale/resale/portal/layout.py +73 -24
  59. package/content/skills/resale/resale/portal/market_cells.py +3 -3
  60. package/content/skills/resale/resale/portal/panel.py +14 -3
  61. package/content/skills/resale/resale/portal/pieces.py +96 -0
  62. package/content/skills/resale/resale/portal/posted.py +73 -0
  63. package/content/skills/resale/resale/portal/views_analysis.py +23 -3
  64. package/content/skills/resale/resale/portal/views_items.py +24 -15
  65. package/content/skills/resale/resale/portal/views_postkit.py +36 -11
  66. package/content/skills/resale/resale/poster/adapters.py +88 -14
  67. package/content/skills/resale/resale/poster/commands.py +93 -18
  68. package/content/skills/resale/resale/poster/confirm_step.py +76 -0
  69. package/content/skills/resale/resale/poster/driver.py +250 -6
  70. package/content/skills/resale/resale/poster/edit_verify.py +95 -0
  71. package/content/skills/resale/resale/poster/own_tabs.py +50 -0
  72. package/content/skills/resale/resale/poster/preflight.py +67 -0
  73. package/content/skills/resale/resale/poster/review_window.py +78 -1
  74. package/content/skills/resale/resale/poster/runner.py +288 -70
  75. package/content/skills/resale/resale/poster/tabs.py +167 -0
  76. package/content/skills/resale/resale/postkit/fill.py +45 -2
  77. package/content/skills/resale/resale/postkit/groups.py +9 -6
  78. package/content/skills/resale/resale/postkit/post_edit.py +65 -0
  79. package/content/skills/resale/resale/postkit/pricing.py +5 -1
  80. package/content/skills/resale/resale/postkit/specs.py +7 -1
  81. package/content/skills/resale/resale/postkit/text.py +39 -0
  82. package/content/skills/resale/resale/publisher/login_watch.py +57 -0
  83. package/content/skills/resale/resale/receipts/amazon_history.py +1 -1
  84. package/content/skills/resale/resale/receipts/charges.py +8 -4
  85. package/content/skills/resale/resale/receipts/commands.py +3 -2
  86. package/content/skills/resale/resale/receipts/intake.py +2 -0
  87. package/content/skills/resale/resale/receipts/store.py +42 -8
  88. package/content/skills/resale/resale/service/commands.py +30 -3
  89. package/content/skills/resale/resale/service/comps_review.py +2 -1
  90. package/content/skills/resale/resale/service/comps_service.py +8 -2
  91. package/content/skills/resale/resale/service/fb_groups.py +157 -0
  92. package/content/skills/resale/resale/service/inventory_ops.py +8 -3
  93. package/content/skills/resale/resale/service/market.py +35 -11
  94. package/content/skills/resale/resale/service/new_price_plan.py +81 -0
  95. package/content/skills/resale/resale/service/package_terms_plan.py +31 -0
  96. package/content/skills/resale/resale/service/server.py +64 -5
  97. package/content/skills/resale/resale/service/store.py +1 -0
  98. package/content/skills/resale/resale/sources/__init__.py +8 -0
  99. package/content/skills/resale/resale/sources/client.py +34 -0
  100. package/content/skills/resale/resale/sources/commands.py +2 -1
  101. package/content/skills/resale/resale/sources/fbgroup_commands.py +94 -0
  102. package/content/skills/resale/resale/sources/fbgroup_parse.py +449 -0
  103. package/content/skills/resale/resale/sources/fbgroup_reader.py +346 -0
  104. package/content/skills/resale/resale/sources/login_window.py +7 -2
  105. package/content/skills/resale/resale/sources/logins.py +2 -1
  106. package/content/skills/resale/tasks/reader_task.py +8 -0
  107. package/content/skills/resale/tests/fixtures/reader/fbgroup_joins.html +7 -0
  108. package/content/skills/resale/tests/fixtures/reader/fbgroup_post.html +6 -0
  109. package/content/skills/resale/tests/fixtures/reader/fbgroup_post_page.html +7 -0
  110. package/content/skills/resale/tests/fixtures/reader/fbgroup_private.html +3 -0
  111. package/content/skills/resale/tests/fixtures/reader/fbgroup_search.html +29 -0
  112. package/content/skills/resale/tests/fixtures/reader/fbgroup_story_search.html +5 -0
  113. package/content/skills/resale/tests/test_bundle_full_list.py +85 -0
  114. package/content/skills/resale/tests/test_condition_refresh.py +14 -0
  115. package/content/skills/resale/tests/test_fbgroup_parse.py +157 -0
  116. package/content/skills/resale/tests/test_fbgroup_reader.py +202 -0
  117. package/content/skills/resale/tests/test_fbgroups_service.py +191 -0
  118. package/content/skills/resale/tests/test_login_window_autoclose.py +71 -0
  119. package/content/skills/resale/tests/test_market_service.py +1 -1
  120. package/content/skills/resale/tests/test_market_value.py +1 -1
  121. package/content/skills/resale/tests/test_portal_bundle_fold.py +1 -1
  122. package/content/skills/resale/tests/test_portal_bundle_pieces_browser.py +121 -0
  123. package/content/skills/resale/tests/test_portal_bundles.py +1 -1
  124. package/content/skills/resale/tests/test_portal_collapse_browser.py +180 -0
  125. package/content/skills/resale/tests/test_portal_market.py +1 -1
  126. package/content/skills/resale/tests/test_portal_posted_pill.py +164 -0
  127. package/content/skills/resale/tests/test_portal_postkit.py +16 -0
  128. package/content/skills/resale/tests/test_portal_split.py +7 -5
  129. package/content/skills/resale/tests/test_portal_text_audit.py +77 -0
  130. package/content/skills/resale/tests/test_poster.py +464 -7
  131. package/content/skills/resale/tests/test_poster_confirm_step.py +176 -0
  132. package/content/skills/resale/tests/test_poster_contract.py +262 -0
  133. package/content/skills/resale/tests/test_poster_own_tabs.py +348 -0
  134. package/content/skills/resale/tests/test_poster_preflight.py +65 -0
  135. package/content/skills/resale/tests/test_poster_review_window.py +6 -6
  136. package/content/skills/resale/tests/test_poster_tabs.py +580 -0
  137. package/content/skills/resale/tests/test_postkit.py +1 -1
  138. package/content/skills/resale/tests/test_postkit_fill.py +91 -2
  139. package/content/skills/resale/tests/test_postkit_post_edit.py +147 -0
  140. package/content/skills/resale/tests/test_pricing_estimate.py +319 -0
  141. package/content/skills/resale/tests/test_private_sale_tax.py +124 -0
  142. package/content/skills/resale/tests/test_receipts_intake.py +2 -2
  143. package/content/skills/resale/tests/test_receipts_recommendations.py +117 -0
  144. package/content/skills/ship-the-code/ship.py +39 -0
  145. package/content/skills/ship-the-code/tests/test_ship_poster_contract.py +79 -0
  146. package/lib/claudeProfile.js +60 -4
  147. package/lib/claudeVersion.js +17 -1
  148. package/lib/codeMode.js +106 -0
  149. package/lib/deployment.js +2 -0
  150. package/lib/doctor.js +6 -0
  151. package/lib/downgradeGuard.js +45 -0
  152. package/lib/shellProfile.js +14 -5
  153. package/lib/update.js +2 -0
  154. package/lib/wiring.js +31 -5
  155. package/package.json +1 -1
package/README.md CHANGED
@@ -96,6 +96,18 @@ agents-cli install
96
96
  [Updating](#updating) below.
97
97
  Run from a git checkout, `update` refuses (exit 1, nothing deployed) when HEAD is behind origin's default branch,
98
98
  because it would deploy older files over newer ones; `--allow-stale` overrides, and an unreachable remote only warns.
99
+ `update` also refuses (exit 1, nothing written, no project, profile or bypass step run) when the install record
100
+ (`agents-ledger.json`, `cliVersion`) was written by a newer agents-cli than the one running, since it would write older
101
+ guard files over newer ones and remove newer settings items; `--allow-downgrade` overrides. The Codex record is checked
102
+ the same way. Equal or older records are unaffected. `doctor` prints the install record version against the running one
103
+ and warns when the record is newer.
104
+ - **Hook failure policy.** A hook registration in `manifest.json` may carry `timeout` (seconds) and `onFailure`
105
+ (`"continue"` or `"block"`, read by Claude Code 2.1.295 and later). The two every-call `PreToolUse` helpers
106
+ (`permission_mode_enforce.js`, `chat_inbox_hook.py`) carry `timeout: 15` and `onFailure: "continue"`, so a helper that
107
+ cannot start under memory pressure never refuses a tool call; safety guards carry neither and keep refusing when they
108
+ cannot run. `update` also sets a declared `timeout`/`onFailure` on a handler that is already wired (no new entry, handlers
109
+ the manifest does not own untouched). An older Claude Code ignores `onFailure` without any settings error. A registration
110
+ with `platforms` is wired only on those `process.platform` values.
99
111
  `doctor` checks ledger hashes, not source drift, so it cannot detect a stale deploy.
100
112
  - `agents-cli runner install --group-id <id> | --project-id <id>` — install a
101
113
  ready GitLab CI runner on this machine (`linux-docker`, or `macos-shell` on
package/bin/cli.js CHANGED
@@ -50,9 +50,11 @@ const litellmHealth = require('../lib/litellmHealth');
50
50
  const pyDeps = require('../lib/pyDeps');
51
51
  const pwshStore = require('../lib/pwshStore');
52
52
  const { staleCheckoutGate } = require('../lib/staleCheckout');
53
+ const { downgradeGate } = require('../lib/downgradeGuard');
53
54
  const releaseLock = require('../lib/releaseLock');
54
55
  const claudeProfile = require('../lib/claudeProfile');
55
56
  const shellProfile = require('../lib/shellProfile');
57
+ const codeMode = require('../lib/codeMode');
56
58
  const devRootHooks = require('../lib/devRootHooks');
57
59
  const { promptBundleSettingsStep, activateBundlesStep } = require('../lib/bundleRuntimeStep');
58
60
  const secretFiles = require('../lib/secretFiles');
@@ -169,6 +171,8 @@ Flags for update:
169
171
  --no-secrets Skip secret and settings prompting for a dependency bundle this update installs
170
172
  --allow-stale Update even when this checkout is behind origin's default branch (default: refused;
171
173
  doctor checks ledger hashes, not source drift, so it cannot catch a stale deploy)
174
+ --allow-downgrade Update even when the install record was written by a newer agents-cli than this one
175
+ (default: refused, since older files would overwrite newer ones)
172
176
 
173
177
  Update compares each installed file's source hash, ledger hash, and on-disk
174
178
  hash: a file no one has touched since install is silently overwritten when
@@ -878,6 +882,7 @@ async function runUninstall(argv) {
878
882
  `${result.filesKeptUserEdited.join(', ')}`
879
883
  );
880
884
  }
885
+ printClaudeProfileReport(claudeProfileStep(result.targetBase, true, { codeModeOnly: true }), { fixRequested: true });
881
886
  printShellProfileReport(shellProfileStep(result.targetBase, true), { fixRequested: true });
882
887
  if (result.filesKeptShared.length > 0) {
883
888
  console.log(
@@ -1169,6 +1174,8 @@ function parseUpdateArgs(argv) {
1169
1174
  args.noSecrets = true;
1170
1175
  } else if (arg === '--allow-stale') {
1171
1176
  args.allowStale = true;
1177
+ } else if (arg === '--allow-downgrade') {
1178
+ // consumed by the gate in main() before update runs
1172
1179
  } else if (arg === '--repair') {
1173
1180
  args.repair = true;
1174
1181
  } else {
@@ -1197,6 +1204,7 @@ function summarizeBundleUpdate(b) {
1197
1204
  if (b.conflictsResolved.length) parts.push(`${b.conflictsResolved.length} conflict(s) resolved`);
1198
1205
  if (b.unresolvedConflicts.length) parts.push(`${b.unresolvedConflicts.length} conflict(s) unresolved`);
1199
1206
  if (b.hooksWired.length) parts.push(`${b.hooksWired.length} hook(s) rewired`);
1207
+ if ((b.hooksRetuned || []).length) parts.push(`${b.hooksRetuned.length} hook(s) given the manifest timeout/onFailure`);
1200
1208
  if ((b.hooksSkipped || []).length) parts.push(`${b.hooksSkipped.length} hook(s) waiting for a repo clone (${[...new Set(b.hooksSkipped.map((s) => s.requires))].join(', ')})`);
1201
1209
  if (b.mcpWired.length) parts.push(`${b.mcpWired.length} MCP server(s) rewired`);
1202
1210
  if ((b.keybindingsWired || []).length) parts.push(`${b.keybindingsWired.length} keybinding(s) bound`);
@@ -1450,15 +1458,15 @@ Project hooks (${step.findings.length} finding(s), ${step.repos.length} repo(s)
1450
1458
  }
1451
1459
 
1452
1460
  function printClaudeProfileReport(report, { fixRequested }) {
1453
- for (const f of report.fixed) console.log(`\nInstalled the claude shim launcher in ${f.file} (backup: ${f.backup}); open a new terminal tab or run \`. $PROFILE\` to load it.`);
1461
+ for (const f of report.fixed) console.log(`\nUpdated the PowerShell profile ${f.file} (backup: ${f.backup}); open a new terminal tab or run \`. $PROFILE\` to load it.`);
1454
1462
  if (report.findings.length === 0 || report.fixed.length > 0) return;
1455
1463
  console.log(`\nPowerShell profile claude command (${report.findings.length} finding(s)):`);
1456
1464
  for (const f of report.findings) console.log(` ${claudeProfile.describeProfileFinding(f)}`);
1457
1465
  if (!fixRequested) console.log(` Fix: ${claudeProfile.FIX_COMMAND}`);
1458
1466
  }
1459
1467
 
1460
- function claudeProfileStep(targetBase, fix) {
1461
- return claudeProfile.checkClaudeProfile({ home: path.dirname(targetBase), fix });
1468
+ function claudeProfileStep(targetBase, fix, extra = {}) {
1469
+ return claudeProfile.checkClaudeProfile({ home: path.dirname(targetBase), fix, withCodeMode: codeMode.installed(targetBase), ...extra });
1462
1470
  }
1463
1471
 
1464
1472
  function printShellProfileReport(report, { fixRequested }) {
@@ -1545,6 +1553,17 @@ function splitProjectHookFlags(argv) {
1545
1553
  return { rest, opts };
1546
1554
  }
1547
1555
 
1556
+ /** Refuse an update that would roll the install record back, before any step (project hooks, profile, bypass) writes to the target. */
1557
+ function updateDowngradeGate(argv) {
1558
+ const { opts } = splitProjectHookFlags(argv);
1559
+ try {
1560
+ return downgradeGate({ targetBase: opts.targetDir || defaultTargetBase(), running: pkg.version, allowDowngrade: argv.includes('--allow-downgrade') });
1561
+ } catch (err) {
1562
+ if (err instanceof LedgerError) return null;
1563
+ throw err;
1564
+ }
1565
+ }
1566
+
1548
1567
  async function withProjectHookStep(argv, run, { healBypass = false } = {}) {
1549
1568
  const { rest, opts } = splitProjectHookFlags(argv);
1550
1569
  const code = await run(rest);
@@ -1624,12 +1643,13 @@ function runDoctor(argv) {
1624
1643
  let result = checkHealth({
1625
1644
  packageRoot: PACKAGE_ROOT,
1626
1645
  targetBase: args.targetDir,
1646
+ cliVersion: pkg.version,
1627
1647
  });
1628
1648
  const fixedPython = args.fix ? fixPythonDeps(result, { json: args.json }) : null;
1629
- if (fixedPython) result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir });
1649
+ if (fixedPython) result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir, cliVersion: pkg.version });
1630
1650
  const fixedRuntimes = args.fix ? fixBundleRuntimes(result, { json: args.json }) : [];
1631
1651
  if (fixedRuntimes.length > 0 || fixedPython) {
1632
- result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir });
1652
+ result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir, cliVersion: pkg.version });
1633
1653
  if (fixedRuntimes.length > 0) result.runtimeFixed = fixedRuntimes;
1634
1654
  if (fixedPython) result.pythonDepsFixed = fixedPython;
1635
1655
  }
@@ -1693,6 +1713,8 @@ Hooks that run a script from another repo (${devHooks.findings.length} finding(s
1693
1713
  printRuleMigrationReport(rules);
1694
1714
  };
1695
1715
 
1716
+ const printCliVersions = () => console.log(`\nagents-cli: ${result.cliVersions.line}`);
1717
+
1696
1718
  const printModVersions = () => {
1697
1719
  if (result.modVersions.length === 0) return;
1698
1720
  console.log('\nClaude Code version vs. installed mods:');
@@ -1750,6 +1772,14 @@ Hooks that run a script from another repo (${devHooks.findings.length} finding(s
1750
1772
  for (const f of p.findings) console.log(` ${mark('skip')} ${f}`);
1751
1773
  };
1752
1774
 
1775
+ const printCodeMode = () => {
1776
+ const c = result.codeMode;
1777
+ if (!c) return;
1778
+ console.log(`\nCode Mode (experimental; warnings only, see ${codeMode.DOC}):`);
1779
+ for (const line of codeMode.describeCodeMode(c)) console.log(` ${line}`);
1780
+ for (const w of c.warnings) console.log(` ${mark('skip')} ${w}`);
1781
+ };
1782
+
1753
1783
  const printBundleRuntimes = () => {
1754
1784
  for (const b of result.bundleRuntimes || []) {
1755
1785
  console.log(`\nBundle "${b.bundle}" runtime:`);
@@ -1788,6 +1818,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
1788
1818
  printPythonLaunchReport(py);
1789
1819
  console.log(`${result.targetBase}: healthy — no orphans, no missing files, no drift.`);
1790
1820
  printClaudeManaged();
1821
+ printCliVersions();
1791
1822
  printModVersions();
1792
1823
  printModValidation();
1793
1824
  printMemoryIndex();
@@ -1796,6 +1827,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
1796
1827
  printPortal();
1797
1828
  printLiteLLM();
1798
1829
  printPwshStore();
1830
+ printCodeMode();
1799
1831
  printBundleRuntimes();
1800
1832
  printPythonDeps();
1801
1833
  printModeDrift();
@@ -1816,6 +1848,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
1816
1848
  for (const d of result.drifted) console.log(` ${d.relTarget} (${ownerLabel(d)})`);
1817
1849
  }
1818
1850
  printClaudeManaged();
1851
+ printCliVersions();
1819
1852
  printModVersions();
1820
1853
  printModValidation();
1821
1854
  printMemoryIndex();
@@ -1824,6 +1857,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
1824
1857
  printPortal();
1825
1858
  printLiteLLM();
1826
1859
  printPwshStore();
1860
+ printCodeMode();
1827
1861
  printBundleRuntimes();
1828
1862
  printPythonDeps();
1829
1863
  printProjectHooks();
@@ -1925,6 +1959,8 @@ async function main(argv, { captureSelection = false } = {}) {
1925
1959
  }
1926
1960
 
1927
1961
  if (command === 'update') {
1962
+ const downgraded = updateDowngradeGate(rest);
1963
+ if (downgraded !== null) return downgraded;
1928
1964
  return withProjectHookStep(rest, runUpdate, { healBypass: true });
1929
1965
  }
1930
1966
 
@@ -0,0 +1,10 @@
1
+ # Code Mode launcher (experimental)
2
+
3
+ This folder exists while the `code-mode` bundle is installed. It marks the machine as opted in.
4
+
5
+ - `claude` starts a normal chat with Remote Control, as always.
6
+ - `claudecm` starts a Code Mode chat. It runs `claude` with `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1` for that one process only and passes every argument through, so `claudecm --resume <id>` works. A Code Mode chat has no Remote Control and resumes only through `claudecm`; plain `claude --resume` is refused.
7
+
8
+ Remove it: `agents-cli uninstall --bundle code-mode --yes`. The `claudecm` command leaves your shell profiles with it.
9
+
10
+ Full guide: `docs/code-mode.md` in the my-agents repository.
@@ -857,7 +857,9 @@
857
857
  {
858
858
  "event": "PreToolUse",
859
859
  "type": "command",
860
- "command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/chat_inbox_hook.py"
860
+ "command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/chat_inbox_hook.py",
861
+ "timeout": 15,
862
+ "onFailure": "continue"
861
863
  },
862
864
  {
863
865
  "event": "SessionEnd",
@@ -1178,7 +1180,9 @@
1178
1180
  "wiring": {
1179
1181
  "event": "PreToolUse",
1180
1182
  "type": "command",
1181
- "command": "node ~/.claude/hooks/permission_mode_enforce.js"
1183
+ "command": "node ~/.claude/hooks/permission_mode_enforce.js",
1184
+ "timeout": 15,
1185
+ "onFailure": "continue"
1182
1186
  }
1183
1187
  },
1184
1188
  {
@@ -1538,7 +1542,16 @@
1538
1542
  },
1539
1543
  {
1540
1544
  "path": "proxy/autostart_hook.py",
1541
- "kind": "infra"
1545
+ "kind": "hook",
1546
+ "wiring": {
1547
+ "event": "UserPromptSubmit",
1548
+ "type": "command",
1549
+ "command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/autostart_hook.py",
1550
+ "platforms": [
1551
+ "win32"
1552
+ ]
1553
+ },
1554
+ "note": "Warns when the model router (a Windows scheduled task) is down or a model override is left active; wired on Windows only."
1542
1555
  },
1543
1556
  {
1544
1557
  "path": "proxy/capture_proxy.py",
@@ -1555,13 +1568,25 @@
1555
1568
  },
1556
1569
  {
1557
1570
  "path": "proxy/publish_guard.py",
1558
- "kind": "infra",
1559
- "note": "Registered PreToolUse Bash hook in settings.json."
1571
+ "kind": "hook",
1572
+ "note": "PreToolUse Bash hook.",
1573
+ "wiring": {
1574
+ "event": "PreToolUse",
1575
+ "matcher": "Bash",
1576
+ "type": "command",
1577
+ "command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/publish_guard.py"
1578
+ }
1560
1579
  },
1561
1580
  {
1562
1581
  "path": "proxy/credential_mutation_guard.py",
1563
- "kind": "infra",
1564
- "note": "Registered PreToolUse Bash hook in settings.json, unscoped like publish_guard.py — blocks credential mutation/exposure for main session and every subagent."
1582
+ "kind": "hook",
1583
+ "note": "PreToolUse Bash hook, unscoped like publish_guard.py — blocks credential mutation/exposure for main session and every subagent.",
1584
+ "wiring": {
1585
+ "event": "PreToolUse",
1586
+ "matcher": "Bash",
1587
+ "type": "command",
1588
+ "command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/credential_mutation_guard.py"
1589
+ }
1565
1590
  },
1566
1591
  {
1567
1592
  "path": "proxy/shell_parse.py",
@@ -1570,8 +1595,14 @@
1570
1595
  },
1571
1596
  {
1572
1597
  "path": "proxy/headless_spawn_guard.py",
1573
- "kind": "infra",
1574
- "note": "Registered PreToolUse Bash|PowerShell hook in settings.json, unscoped like publish_guard.py — denies visible-window spawns (start/Start-Process without -WindowStyle Hidden/-NoNewWindow, -Verb RunAs, wt, GUI apps, non-headless browsers, playwright --headed/headless=False); escape hatch is ALLOW_VISIBLE_WINDOW=1 or the time-boxed ~/.claude/.allow_visible_window.json marker (--allow-visible CLI), html-mocker/mocker.py allowlisted. On macOS it also denies open, osascript beyond display notification, Terminal/iTerm and other terminal apps, .app/Contents/MacOS executables, Safari and headed browsers, and qlmanage -p, with the same escape hatch."
1598
+ "kind": "hook",
1599
+ "wiring": {
1600
+ "event": "PreToolUse",
1601
+ "matcher": "Bash|PowerShell",
1602
+ "type": "command",
1603
+ "command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/headless_spawn_guard.py"
1604
+ },
1605
+ "note": "PreToolUse Bash|PowerShell hook, unscoped like publish_guard.py — denies visible-window spawns (start/Start-Process without -WindowStyle Hidden/-NoNewWindow, -Verb RunAs, wt, GUI apps, non-headless browsers, playwright --headed/headless=False); escape hatch is ALLOW_VISIBLE_WINDOW=1 or the time-boxed ~/.claude/.allow_visible_window.json marker (--allow-visible CLI), html-mocker/mocker.py allowlisted. On macOS it also denies open, osascript beyond display notification, Terminal/iTerm and other terminal apps, .app/Contents/MacOS executables, Safari and headed browsers, and qlmanage -p, with the same escape hatch."
1575
1606
  },
1576
1607
  {
1577
1608
  "path": "proxy/headless_process.py",
@@ -1595,8 +1626,14 @@
1595
1626
  },
1596
1627
  {
1597
1628
  "path": "proxy/gitlab_mutation_guard.py",
1598
- "kind": "infra",
1599
- "note": "Registered PreToolUse Bash|PowerShell|Write|Edit hook in settings.json — denies raw scribe_runner GitLab-mutation calls outside ship.py/gitlab_phase.py, redirecting to those wrappers instead of letting an agent route around a blocked skill invocation."
1629
+ "kind": "hook",
1630
+ "wiring": {
1631
+ "event": "PreToolUse",
1632
+ "matcher": "Bash|PowerShell|Write|Edit",
1633
+ "type": "command",
1634
+ "command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/gitlab_mutation_guard.py"
1635
+ },
1636
+ "note": "PreToolUse Bash|PowerShell|Write|Edit hook — denies raw scribe_runner GitLab-mutation calls outside ship.py/gitlab_phase.py, redirecting to those wrappers instead of letting an agent route around a blocked skill invocation."
1600
1637
  },
1601
1638
  {
1602
1639
  "path": "proxy/agent_model_guard.py",
@@ -2479,6 +2516,15 @@
2479
2516
  ]
2480
2517
  }
2481
2518
  }
2519
+ },
2520
+ {
2521
+ "path": "global/CLAUDE.md",
2522
+ "kind": "setting",
2523
+ "note": "Subagents, workflows, in-process teammates, compaction and session-title requests write the prompt cache with the one-hour lifetime instead of the five-minute default (Claude Code 2.1.242 or later; FORCE_PROMPT_CACHING_5M and CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL override it per session). Cache writes cost more per token than at five minutes, so the item is maintainer-only. Rollback: delete this item and run `node packages\\cli\\bin\\cli.js update --yes`.",
2524
+ "wiring": {
2525
+ "settingsKey": "subagentPromptCacheTtl",
2526
+ "value": "1h"
2527
+ }
2482
2528
  }
2483
2529
  ],
2484
2530
  "deps": [],
@@ -2691,6 +2737,23 @@
2691
2737
  "deps": [],
2692
2738
  "secrets": []
2693
2739
  },
2740
+ {
2741
+ "key": "code-mode",
2742
+ "title": "Code Mode launcher (maintainer-only, experimental)",
2743
+ "summary": "Adds the claudecm command to the PowerShell, zsh and bash profiles: it starts one Code Mode chat (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 for that chat's process only) and passes every argument through. claude itself is unchanged and keeps Remote Control. Off by default; uninstall removes the command. Needs Claude Code 2.1.323 or later",
2744
+ "profile": "self",
2745
+ "advanced": true,
2746
+ "items": [
2747
+ {
2748
+ "path": "global/code-mode/README.md",
2749
+ "targetPath": "code-mode/README.md",
2750
+ "kind": "infra",
2751
+ "note": "Carries the opt-in: while this file is tracked in the ledger, update and doctor --fix keep the claudecm function in the profiles (packages/cli/lib/claudeProfile.js for PowerShell, shellProfile.js for zsh and bash); uninstalling the bundle removes it and the function. No settings item: the flag is set per process by the function."
2752
+ }
2753
+ ],
2754
+ "deps": [],
2755
+ "secrets": []
2756
+ },
2694
2757
  {
2695
2758
  "key": "self-model-routing-mod",
2696
2759
  "title": "Model Routing Mod (maintainer-only)",
@@ -180,7 +180,7 @@
180
180
  "description": "\"infra\" (added npx distribution slice #28) tags a self-profile-only proxy asset that is deployed but never registered as a settings.json hook event — a daemon script, PowerShell launcher, or config/asset directory (e.g. claude_router.py, litellm/config.yaml, portal/). \"hook\" stays reserved for items that either carry a wiring block or are a shared library a wired hook imports (see agents_env.py's existing convention). \"setting\" (added npx distribution slice #29) tags a declarative-only item that sets one plain top-level settings.json key ({settingsKey, value} wiring) with no file of its own to install — `path` typically points at a real file another item in the same bundle already claims/copies (e.g. the hook whose behavior the setting complements), purely to satisfy prepack.js's \"every claimed path must exist\" staging check; it is never independently copied (see install.js's file-copy loop, which skips kind:\"setting\" the same way it skips kind:\"mcp\"). \"mod\" tags a Claude Code mod (plugin with a hooks module) copied to targetPath like a skill directory; its deployed directory is also added to settings.json env.CLAUDE_CODE_PLUGIN_DIRS (packages/cli/lib/modWiring.js), the sideload path that loads while the installed-plugin rollout flag is off. \"container\" and \"task\" (added with the resale bundle) are wiring-only like \"setting\": `path` names a file another item of the bundle ships (the compose file, or the script a task runs) and nothing is copied for them. A container item's wiring is {project, containers[], envFile?, healthTimeoutS?}: after install, `docker compose -p <project> up -d --build` runs on the deployed copy of `path` (the compose file must set a restart policy so it returns after a reboot), uninstall runs `down` and keeps named volumes, doctor checks the named containers. A task item's wiring is {name, exe, args[], workingDirectory?, description?, logonDelay?, repeat?, keepRunning?}: a hidden Windows logon task (conhost --headless, no window) is registered by lib/hiddenTask/register_hidden_task.ps1; exe is an absolute path or a PATH name; args and workingDirectory accept {{TARGET}} and {{HOME}}. Neither kind starts while the bundle's required secrets or required settings values are missing. A mod's wiring may also carry keybindings: {context, bindings:{<key>: <command>}}, merged into <target>/keybindings.json by packages/cli/lib/keybindingWiring.js (absent keys appended to the context block, existing user bindings kept and reported, uninstall removes only what was added)."
181
181
  },
182
182
  "wiring": {
183
- "description": "Optional wiring spec. For hooks: {event, matcher?, if?, type, command[, timeout][, shell][, requires]} mirroring the settings.json shape documented in proxy/README.md (`if` is one permission rule for a tool event whose matcher selects that tool, written on the hook handler and never on the matcher group, and tools/manifest_lint.py rejects the group shape; shell is copied onto the handler; a `~/dev/...` path in command resolves to the dev root at install time, and requires names a `~/dev/...` file that must exist before the hook is wired, so a hook that runs a script from a separate repo waits for the clone and doctor reports it) — or an array of such objects when one item must be registered under more than one matcher block (e.g. a guard hook wired under both \"Bash\" and \"Monitor\"). For the statusline item: {settingsKey: \"statusLine\", type, command[, refreshInterval][, platforms]} — the whole object minus settingsKey and platforms is the settings.json value, `command` resolved like a hook command; `platforms` (process.platform values) limits the wiring to those platforms, so one settingsKey is wired by the PowerShell script on win32 and by the Python port through pyrun.js on darwin and linux. For kind:\"setting\" items: {settingsKey, value} — settingsKey is the top-level settings.json key to keep in sync with value (any JSON type), independent of the statusline shape above (no type/command). For mcp items: {name, ...serverDef} — \"name\" is the mcpServers key to write, and the rest is the mcpServers server-entry object itself (type/url/headers, or type/command/args/env for stdio), copied from mcps/mcps.json. \"scope\" may be present (documentation-only convention shared with mcps.json) but is stripped before writing — only \"user\" scope is supported by the executor. A string value of the form \"${VAR_NAME}\" anywhere in the entry is a secret placeholder, resolved at wire time via the shared agentsEnv contract (real env var, else agents.env); an unresolved placeholder is dropped rather than written literally, so an optional secret degrades gracefully instead of blocking install. Execution (packages/cli/lib/wiring.js landed slice #23; packages/cli/lib/mcpWiring.js landed slice #25; kind:\"setting\" landed slice #29, also in packages/cli/lib/wiring.js) acts on kind:\"hook\" items whose wiring object(s) carry {event, type, command}, on kind:\"mcp\" items whose wiring carries {name, ...}, and on kind:\"setting\" items whose wiring carries {settingsKey, value}; on kind:\"statusline\" items whose wiring carries {settingsKey, type, command} (same executor; an existing statusLine whose command runs a different script is left alone, and unrelated keys inside the object are preserved).",
183
+ "description": "Optional wiring spec. For hooks: {event, matcher?, if?, type, command[, timeout][, onFailure][, shell][, platforms][, requires]} mirroring the settings.json shape documented in proxy/README.md (`if` is one permission rule for a tool event whose matcher selects that tool, written on the hook handler and never on the matcher group, and tools/manifest_lint.py rejects the group shape; shell is copied onto the handler; timeout (seconds) and onFailure (\"continue\" or \"block\", read by Claude Code 2.1.295 and later, ignored by older ones) are copied onto the handler and, on update, set on an already-wired handler whose key the manifest declares; platforms (process.platform values) wires the hook only on those platforms; a `~/dev/...` path in command resolves to the dev root at install time, and requires names a `~/dev/...` file that must exist before the hook is wired, so a hook that runs a script from a separate repo waits for the clone and doctor reports it) — or an array of such objects when one item must be registered under more than one matcher block (e.g. a guard hook wired under both \"Bash\" and \"Monitor\"). For the statusline item: {settingsKey: \"statusLine\", type, command[, refreshInterval][, platforms]} — the whole object minus settingsKey and platforms is the settings.json value, `command` resolved like a hook command; `platforms` (process.platform values) limits the wiring to those platforms, so one settingsKey is wired by the PowerShell script on win32 and by the Python port through pyrun.js on darwin and linux. For kind:\"setting\" items: {settingsKey, value} — settingsKey is the top-level settings.json key to keep in sync with value (any JSON type), independent of the statusline shape above (no type/command). For mcp items: {name, ...serverDef} — \"name\" is the mcpServers key to write, and the rest is the mcpServers server-entry object itself (type/url/headers, or type/command/args/env for stdio), copied from mcps/mcps.json. \"scope\" may be present (documentation-only convention shared with mcps.json) but is stripped before writing — only \"user\" scope is supported by the executor. A string value of the form \"${VAR_NAME}\" anywhere in the entry is a secret placeholder, resolved at wire time via the shared agentsEnv contract (real env var, else agents.env); an unresolved placeholder is dropped rather than written literally, so an optional secret degrades gracefully instead of blocking install. Execution (packages/cli/lib/wiring.js landed slice #23; packages/cli/lib/mcpWiring.js landed slice #25; kind:\"setting\" landed slice #29, also in packages/cli/lib/wiring.js) acts on kind:\"hook\" items whose wiring object(s) carry {event, type, command}, on kind:\"mcp\" items whose wiring carries {name, ...}, and on kind:\"setting\" items whose wiring carries {settingsKey, value}; on kind:\"statusline\" items whose wiring carries {settingsKey, type, command} (same executor; an existing statusLine whose command runs a different script is left alone, and unrelated keys inside the object are preserved).",
184
184
  "oneOf": [
185
185
  { "type": "object" },
186
186
  { "type": "array", "items": { "type": "object" }, "minItems": 1 }
@@ -24,10 +24,10 @@
24
24
  ]
25
25
  },
26
26
  "sites": [
27
- { "host": "(^|\\.)facebook\\.com$", "exact": ["publish", "post"], "nextIsFinal": false },
27
+ { "host": "(^|\\.)facebook\\.com$", "exact": ["publish", "post", "update"], "nextIsFinal": false },
28
28
  { "host": "(^|\\.)offerup\\.com$", "exact": ["post", "post item", "list item"], "nextIsFinal": false },
29
29
  { "host": "(^|\\.)craigslist\\.org$", "exact": ["publish", "done"], "nextIsFinal": false },
30
- { "host": "(^|\\.)astromart\\.com$", "exact": ["submit", "place ad", "post ad", "post"], "nextIsFinal": false },
30
+ { "host": "(^|\\.)astromart\\.com$", "exact": ["submit", "place ad", "place classified", "post ad", "post"], "nextIsFinal": false },
31
31
  { "host": "(^|\\.)ebay\\.com$", "exact": ["list it", "list item", "list", "submit", "relist"], "nextIsFinal": false },
32
32
  { "host": "(^|\\.)cloudynights\\.com$", "exact": ["submit", "post", "post topic", "submit reply"], "nextIsFinal": false },
33
33
  { "host": "(^|\\.)nextdoor\\.com$", "exact": ["post", "publish"], "nextIsFinal": false }
@@ -17,7 +17,7 @@ import threading
17
17
  import time
18
18
  from pathlib import Path
19
19
 
20
- from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, STUBS, claude_exe
20
+ from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, STUBS, claude_env, claude_exe
21
21
 
22
22
  NUDGE_HEAD = "Keep-warm check."
23
23
  STUB_TAIL = " Stub nudge for a headless test. Do exactly this and nothing else: "
@@ -46,8 +46,7 @@ class Run:
46
46
  cache.mkdir()
47
47
  self.cache = cache
48
48
  self.log = self.work / "observer.log"
49
- env = dict(
50
- os.environ,
49
+ env = claude_env(
51
50
  MSYS_NO_PATHCONV="1",
52
51
  OBSERVER_LOG=str(self.log),
53
52
  HANDOFF_DIR=str(self.work / "handoffs"),
@@ -20,6 +20,7 @@ MOD = HERE.parent.parent
20
20
  OBSERVER = HERE / "observer"
21
21
  CREATE_NO_WINDOW = 0x08000000
22
22
  ISOLATE = json.dumps({"env": {"CLAUDE_CODE_PLUGIN_DIRS": ""}})
23
+ CODE_MODE_FLAG = "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"
23
24
 
24
25
  HANDOFF_BODY = """# Session handoff
25
26
 
@@ -80,6 +81,13 @@ def make_dirty_repo(cwd):
80
81
  (cwd / "tracked.txt").write_text("two" + chr(10), encoding="utf-8")
81
82
 
82
83
 
84
+ def claude_env(**extra):
85
+ """Child env without Code Mode; a test opts in by passing the flag in `extra`."""
86
+ env = {k: v for k, v in os.environ.items() if k != CODE_MODE_FLAG}
87
+ env.update(extra)
88
+ return env
89
+
90
+
83
91
  def claude_exe():
84
92
  override = os.environ.get("HANDOFF_E2E_CLAUDE_EXE")
85
93
  if override:
@@ -116,8 +124,7 @@ def run(scenario, timeout=150):
116
124
  if scenario == "dirty":
117
125
  make_dirty_repo(cwd)
118
126
  log = work / "observer.log"
119
- env = dict(
120
- os.environ,
127
+ env = claude_env(
121
128
  MSYS_NO_PATHCONV="1",
122
129
  HANDOFF_DIR=str(work / "handoffs"),
123
130
  OBSERVER_LOG=str(log),
@@ -24,6 +24,7 @@ OBSERVER = HERE / "observer"
24
24
  CREATE_NO_WINDOW = 0x08000000 if os.name == "nt" else 0
25
25
  SECRET_PATTERN = re.compile(r"GITLAB|GLAB|GITHUB|^GH_|TOKEN|SECRET|PASSWORD|API_KEY", re.I)
26
26
  KEEP_PREFIX = ("CLAUDE_CODE_", "ANTHROPIC_")
27
+ CODE_MODE_FLAG = "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"
27
28
 
28
29
  CALC = "def add(a, b):\n return a - b\n"
29
30
  TEST = (
@@ -115,7 +116,7 @@ def clipboard_set(text):
115
116
 
116
117
 
117
118
  def sandbox_env(work, log):
118
- env = {k: v for k, v in os.environ.items() if k.startswith(KEEP_PREFIX) or not SECRET_PATTERN.search(k)}
119
+ env = {k: v for k, v in os.environ.items() if k != CODE_MODE_FLAG and (k.startswith(KEEP_PREFIX) or not SECRET_PATTERN.search(k))}
119
120
  env.update(MSYS_NO_PATHCONV="1", HANDOFF_DIR=str(work / "handoffs"), OBSERVER_LOG=str(log),
120
121
  )
121
122
  return env
@@ -28,7 +28,7 @@ import pyte
28
28
  from winpty import PtyProcess
29
29
 
30
30
  sys.path.insert(0, str(Path(__file__).resolve().parent))
31
- from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, claude_exe # noqa: E402,F401
31
+ from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, claude_env, claude_exe # noqa: E402,F401
32
32
 
33
33
  KEYS = {
34
34
  "Enter": "\r", "Esc": "\x1b", "Up": "\x1b[A", "Down": "\x1b[B", "Right": "\x1b[C",
@@ -55,7 +55,7 @@ class Tui:
55
55
  for d in plugin_dirs:
56
56
  argv += ["--plugin-dir", str(d)]
57
57
  argv += ["--model", model, *extra_args]
58
- full_env = dict(os.environ, MSYS_NO_PATHCONV="1", **env)
58
+ full_env = claude_env(MSYS_NO_PATHCONV="1", **env)
59
59
  self.proc = PtyProcess.spawn(argv, cwd=str(cwd) if cwd else None, env=full_env, dimensions=(ROWS, COLS))
60
60
  self.pid = self.proc.pid
61
61
  threading.Thread(target=self._pump, daemon=True).start()
@@ -60,7 +60,7 @@ def build_prompt():
60
60
 
61
61
 
62
62
  def run_claude(project, out_dir, with_guard):
63
- env = dict(os.environ)
63
+ env = {k: v for k, v in os.environ.items() if k != "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"}
64
64
  env.update({
65
65
  "CLAUDE_CODE_PLUGIN_DIRS": str(MOD),
66
66
  "CLAUDE_MODELS_CONFIG": str(CONFIG),
@@ -71,7 +71,7 @@ def settings(sandbox: Path) -> Path:
71
71
 
72
72
 
73
73
  def env_for(sandbox: Path, with_mod: bool, fork: bool = False) -> dict:
74
- env = dict(os.environ)
74
+ env = {k: v for k, v in os.environ.items() if k != "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"}
75
75
  if fork:
76
76
  env["CLAUDE_CODE_FORK_SUBAGENT"] = "1"
77
77
  env.update({
@@ -61,7 +61,7 @@ def run_claude(sandbox: Path, claude: str, with_mod: bool) -> subprocess.Complet
61
61
  (project / ".claude" / "workflows").mkdir(parents=True)
62
62
  (project / ".claude" / "workflows" / "routing-e2e.js").write_text(WORKFLOW, encoding="utf-8")
63
63
  cfg = json.loads(CONFIG.read_text(encoding="utf-8"))
64
- env = dict(os.environ)
64
+ env = {k: v for k, v in os.environ.items() if k != "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"}
65
65
  env.update({
66
66
  "CLAUDE_CODE_PLUGIN_DIRS": str(MOD) if with_mod else "",
67
67
  "CLAUDE_MODELS_CONFIG": str(CONFIG),
@@ -163,7 +163,7 @@ Emits a `permissionDecision`-equivalent denial (exit code 2, reason on stderr) w
163
163
  **Time-boxed marker override**
164
164
  For a founder-approved snapshotted-dirt discard, drop a `<repo-root>/.claude/.allow_shared_revert.json` marker (`{"until", "reason", "paths", "created_by"}`, max 1h lifetime) instead of exporting `ALLOW_SHARED_REVERT=1`; the repo root resolves to the superproject for submodules, and an expired/malformed marker is ignored (fails CLOSED back to the normal deny).
165
165
 
166
- Tests: `proxy/tests/test_shared_worktree_revert_guard.py` (real temp git repos, subprocess-driven — no mocking of `git status` itself). Repo-wide: `proxy/tests/test_no_syntax_warnings.py` compiles every `proxy/*.py` hook module with warnings-as-errors — catches a non-raw docstring documenting shell syntax (`\;`, `\s`, `\p`, ...) emitting a `SyntaxWarning` on stderr on EVERY hook invocation, a class of bug found in three modules on 2026-09-02.
166
+ Tests: `proxy/tests/test_shared_worktree_revert_guard.py` (real temp git repos, subprocess-driven — no mocking of `git status` itself). Repo-wide: `proxy/tests/test_no_syntax_warnings.py` compiles every `proxy/*.py` hook module with warnings-as-errors — catches a non-raw docstring documenting shell syntax (`\;`, `\s`, `\p`, ...) emitting a `SyntaxWarning` on stderr on EVERY hook invocation, a class of bug found in three modules on 2026-09-02. Directory tracking shared by the Bash guards (`cd`/`pushd`/`popd`, PowerShell location cmdlets, `~`, `mkdir x && cd x`, and `publish_guard.py`'s stack-apply resolution): `proxy/tests/test_guard_cd_tracking.py`.
167
167
 
168
168
  ---
169
169
 
@@ -34,10 +34,14 @@ from shell_parse import ( # noqa: F401 - re-exported for existing callers
34
34
  _quote_balanced,
35
35
  apply_cd,
36
36
  binary_name,
37
+ dir_command,
37
38
  is_shell_like_binary,
38
39
  leading_env_assignments,
39
40
  mentions_heredoc,
41
+ home_for,
40
42
  normalize_msys_path,
43
+ parse_cd,
44
+ resolve_cd,
41
45
  resolve_dir,
42
46
  split_pipe_stages,
43
47
  split_segments,
@@ -45,6 +49,7 @@ from shell_parse import ( # noqa: F401 - re-exported for existing callers
45
49
  strip_env_assignments,
46
50
  strip_quotes,
47
51
  unwind_shell_wrapper,
52
+ wrapper_shell,
48
53
  )
49
54
 
50
55
  # Global git options that consume a SEPARATE following token as their