From 6dbe8cd7c9461ebc11bd95ac1163b8d8a7401ad1 Mon Sep 17 00:00:00 2001 From: andrewthomaslee Date: Fri, 13 Nov 2026 18:37:25 -0600 Subject: [PATCH] Claude-only ugrep note in CLAUDE.md; bump org-pkgs and skills Claude Code's Bash tool replaces `grep` with its bundled ugrep, so a PCRE lookaround silently failed a check in the retro session. The note goes only into ~/.claude/CLAUDE.md (pi, kimi and opencode do not have the wrapper); agents-wiring asserts that CLAUDE.md is the shared machine context plus that note. org-pkgs 2fa0b28 (pkgs#33: eval-warning gate, vm-test --resume, runner self-test, grep -q lint) and skills d6f59bf (#20); sync-locks in the same commit. Co-Authored-By: Claude Opus 5.5 --- devenv.lock | 8 ++++---- devenv.yaml | 2 +- flake-parts/homeModules/agents/agents.nix | 13 ++++++++++++- flake.lock | 12 ++++++------ tests/flake-module.nix | 8 ++++++-- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/devenv.lock b/devenv.lock index b4fea74..716821c 100644 --- a/devenv.lock +++ b/devenv.lock @@ -199,17 +199,17 @@ "zen-browser": "zen-browser" }, "locked": { - "lastModified": 1794603603, - "narHash": "sha256-+EbxuvE6g0DjEvDKfdd6PKK4FGfXAURJpqKn9r+DJMc=", + "lastModified": 1794610832, + "narHash": "sha256-w8VjGRD/wZuw6EDvzoutINJs779PNEzq/8VzRQ56ccs=", "owner": "external-systems", "repo": "pkgs", - "rev": "633204181356034961fe1db7f23cbc756ebc2970", + "rev": "2fa0b282493c68d0d80bef224064c7cdfa6e30a4", "type": "github" }, "original": { "owner": "external-systems", "repo": "pkgs", - "rev": "633204181356034961fe1db7f23cbc756ebc2970", + "rev": "2fa0b282493c68d0d80bef224064c7cdfa6e30a4", "type": "github" } }, diff --git a/devenv.yaml b/devenv.yaml index de8ec2a..71a86b3 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -6,7 +6,7 @@ # pkgs ("attribute 'bash' missing"). inputs: org-pkgs: - url: github:external-systems/pkgs/633204181356034961fe1db7f23cbc756ebc2970 + url: github:external-systems/pkgs/2fa0b282493c68d0d80bef224064c7cdfa6e30a4 nixpkgs: follows: org-pkgs/nixpkgs imports: diff --git a/flake-parts/homeModules/agents/agents.nix b/flake-parts/homeModules/agents/agents.nix index 553a3ff..19fa39a 100644 --- a/flake-parts/homeModules/agents/agents.nix +++ b/flake-parts/homeModules/agents/agents.nix @@ -106,6 +106,13 @@ claudeLib = import ./_claude.nix {inherit pkgs;}; + # Appended to the default ~/.claude/CLAUDE.md only: Claude Code's Bash + # tool replaces `grep` with its bundled ugrep. + claudeShellNote = '' + + Shell: `grep` is Claude Code's bundled ugrep: use `grep -E` (no PCRE lookarounds such as `(?!...)`). + ''; + # ---- Nix workflow (homeSpec.agents.nixWorkflow) ---- # # One set of defaults, rendered per agent in _nix-workflow.nix. wf = cfg.nixWorkflow; @@ -784,8 +791,12 @@ }) # User-level memory (~/.claude/CLAUDE.md), loaded into every # session; claude.claudeMd overrides the machine context. + # Claude Code runs Bash with its own `grep` function (bundled + # ugrep), which every agent there trips over; no other agent has it. (lib.mkIf (cfg.claude.claudeMd != null || machineContext.enable) { - ".claude/CLAUDE.md".text = lib.defaultTo machineContext.text cfg.claude.claudeMd; + ".claude/CLAUDE.md".text = + lib.defaultTo machineContext.text cfg.claude.claudeMd + + lib.optionalString (cfg.claude.claudeMd == null) claudeShellNote; }) # settings.json carries no mcpServers: current claude-code # ignores them there (`claude mcp list`, 2026-10); the live diff --git a/flake.lock b/flake.lock index fef36d4..67430a8 100644 --- a/flake.lock +++ b/flake.lock @@ -322,11 +322,11 @@ "zen-browser": "zen-browser" }, "locked": { - "lastModified": 1794603603, - "narHash": "sha256-+EbxuvE6g0DjEvDKfdd6PKK4FGfXAURJpqKn9r+DJMc=", + "lastModified": 1794610832, + "narHash": "sha256-w8VjGRD/wZuw6EDvzoutINJs779PNEzq/8VzRQ56ccs=", "owner": "external-systems", "repo": "pkgs", - "rev": "633204181356034961fe1db7f23cbc756ebc2970", + "rev": "2fa0b282493c68d0d80bef224064c7cdfa6e30a4", "type": "github" }, "original": { @@ -529,11 +529,11 @@ "skills-terraform": "skills-terraform" }, "locked": { - "lastModified": 1794607319, - "narHash": "sha256-N2syJQTuyIpDtnfnHODMoNpDfCx85d7u8Dsv7UkPd0s=", + "lastModified": 1794614196, + "narHash": "sha256-eB2IGmOVJHlXVwEFUy+aJ5//ioSfUpxmIZu41gM7feg=", "owner": "external-systems", "repo": "skills", - "rev": "1eb44d043d638810b1e20cbbe0c987368c493a01", + "rev": "d6f59bff3c9625177994c8d253c3f408bbf08cac", "type": "github" }, "original": { diff --git a/tests/flake-module.nix b/tests/flake-module.nix index 179acc1..0633e81 100644 --- a/tests/flake-module.nix +++ b/tests/flake-module.nix @@ -236,7 +236,9 @@ files = hm.home.file; json = name: builtins.fromJSON (builtins.unsafeDiscardStringContext files.${name}.text); claude = json ".claude/settings.json"; - context = files.".claude/CLAUDE.md".text; + # The shared machine context; claude's CLAUDE.md adds its shell note. + context = files.".pi/agent/AGENTS.md".text; + claudeContext = files.".claude/CLAUDE.md".text; opencodeNixEval = { action = "shell"; resource = "nix eval *"; @@ -256,7 +258,9 @@ assert expect (hm.home.sessionVariables.ANTHROPIC_BASE_URL == "http://127.0.0.1:8787") "claude not routed to the headroom proxy root (claude appends /v1 itself)"; assert expect (lib.hasPrefix "Machine: eval (NixOS " context) "no Machine line"; assert expect (lib.hasInfix "Repo: github.com/example/home (local: /home/alice/home)" context) "no Repo line"; - assert expect (lib.all (f: files.${f}.text == context) [".pi/agent/AGENTS.md" ".kimi-code/AGENTS.md"]) "agents disagree on the machine context"; + assert expect (files.".kimi-code/AGENTS.md".text == context) "agents disagree on the machine context"; + assert expect (lib.hasPrefix context claudeContext) "claude's CLAUDE.md does not start with the machine context"; + assert expect (lib.hasInfix "Claude Code's bundled ugrep" claudeContext && !(lib.hasInfix "ugrep" context)) "the ugrep note is not claude-only"; assert expect (hm.xdg.configFile."opencode/AGENTS.md".text == context) "opencode has another machine context"; assert expect (lib.hasInfix "Nix builds and VM tests run long" context) "no timeout advice in the machine context"; assert expect (lib.elem opencodeNixEval hm.programs.opencode.settings.permissions) "opencode does not allow nix eval";