Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down
2 changes: 1 addition & 1 deletion devenv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 12 additions & 1 deletion flake-parts/homeModules/agents/agents.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions tests/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 *";
Expand All @@ -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";
Expand Down
Loading