From 758fc067220992daf48a04d1ba0e71a68373fc0d Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Fri, 26 Jun 2026 17:33:25 +0800 Subject: [PATCH 1/6] feat(claude-code): use nix packaged pi bridge --- flake.lock | 59 +++++++++++++ flake.nix | 4 + implementation/pi-claude-bridge-nix-work.md | 96 +++++++++++++++++++++ nix/modules/claude-code.nix | 7 +- progress.md | 13 +++ 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 implementation/pi-claude-bridge-nix-work.md create mode 100644 progress.md diff --git a/flake.lock b/flake.lock index a3a9b7c2..78221484 100644 --- a/flake.lock +++ b/flake.lock @@ -163,6 +163,27 @@ "type": "github" } }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "pi-claude-bridge", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1778716662, + "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": [ @@ -608,6 +629,21 @@ "type": "github" } }, + "import-tree_3": { + "locked": { + "lastModified": 1778781969, + "narHash": "sha256-Jjuz5CmSkur8KvLDoGa+vylEp+RkQtv4mt/qcMznpH0=", + "owner": "vic", + "repo": "import-tree", + "rev": "d321337efd0f23a9eb14a42adb7b2c29313ab274", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, "mac-app-util": { "inputs": { "cl-nix-lite": "cl-nix-lite", @@ -877,6 +913,28 @@ "type": "github" } }, + "pi-claude-bridge": { + "inputs": { + "flake-parts": "flake-parts_4", + "import-tree": "import-tree_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1782466286, + "narHash": "sha256-+Zc0b1fIydm0OZyh1AfDykRZBLQYR82I/93Q/mLKibk=", + "owner": "rrvsh", + "repo": "pi-claude-bridge-nix", + "rev": "f69bd3a63349d115db44a6360041df11444c222b", + "type": "github" + }, + "original": { + "owner": "rrvsh", + "repo": "pi-claude-bridge-nix", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", @@ -917,6 +975,7 @@ "nixpkgs-firefox-darwin": "nixpkgs-firefox-darwin", "nixpkgs-master": "nixpkgs-master", "pi": "pi", + "pi-claude-bridge": "pi-claude-bridge", "sops-nix": "sops-nix", "waybar-peek": "waybar-peek" } diff --git a/flake.nix b/flake.nix index 3d0e4908..1c1ba803 100644 --- a/flake.nix +++ b/flake.nix @@ -44,5 +44,9 @@ }; mac-app-util.url = "github:hraban/mac-app-util"; pi.url = "github:rrvsh/pi-coding-agent-nix"; + pi-claude-bridge = { + url = "github:rrvsh/pi-claude-bridge-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; } diff --git a/implementation/pi-claude-bridge-nix-work.md b/implementation/pi-claude-bridge-nix-work.md new file mode 100644 index 00000000..b95f3852 --- /dev/null +++ b/implementation/pi-claude-bridge-nix-work.md @@ -0,0 +1,96 @@ +# pi-claude-bridge-nix implementation + +## Summary + +Created and published `rrvsh/pi-claude-bridge-nix`, a pinned Nix flake packaging `@vanillagreen/pi-claude-bridge` 1.5.0 from `vanillagreencom/vstack` source. The tools repo now consumes that flake and configures Pi on the Darwin `claude-code` module to load the Nix-built bridge from the store instead of the npm registry spec. + +## Upstream pin + +- Source root: `pi-extensions/pi-claude-bridge` +- Lockfile source: upstream subdirectory `package-lock.json` +- Version: `1.5.0` +- Upstream rev/gitHead: `d70c86ff9302ddecb7e2ae9d833bacb0544d6ecd` +- Source hash: `sha256-VmGea5gTfD3KgkX6/nongGVcRwM96uSmLKq0RxeL0zY=` +- npm deps hash: `sha256-Mcr6n1SgVoN+XiI+sArROnUmkGN9soaWtPRFCA4LjY4=` + +## Bridge repo + +Changed files: + +- `/home/rafiq/1_repos/pi-claude-bridge-nix/flake.nix` +- `/home/rafiq/1_repos/pi-claude-bridge-nix/flake.lock` +- `/home/rafiq/1_repos/pi-claude-bridge-nix/VERSION.json` +- `/home/rafiq/1_repos/pi-claude-bridge-nix/nix/pi-claude-bridge.nix` +- `/home/rafiq/1_repos/pi-claude-bridge-nix/nix/update.nix` +- `/home/rafiq/1_repos/pi-claude-bridge-nix/patches/fix-multi-tool-results.patch` +- `/home/rafiq/1_repos/pi-claude-bridge-nix/.github/workflows/build.yml` +- `/home/rafiq/1_repos/pi-claude-bridge-nix/.github/workflows/update.yml` + +The package builds from source with Node 22, runs upstream typecheck and `tests/unit-import.mjs`, applies a local patch adding a focused multi-tool interleaving regression test, and verifies install output metadata for Pi extension loading. + +Committed and pushed: + +- `f69bd3a feat(nix): package pi claude bridge` +- Remote: `git@github.com:rrvsh/pi-claude-bridge-nix.git` + +## Tools repo + +Changed files: + +- `/home/rafiq/1_repos/tools/flake.nix` +- `/home/rafiq/1_repos/tools/flake.lock` +- `/home/rafiq/1_repos/tools/nix/modules/claude-code.nix` +- `/home/rafiq/1_repos/tools/progress.md` +- `/home/rafiq/1_repos/tools/implementation/pi-claude-bridge-nix-work.md` + +`claude-code.nix` now uses: + +- `inputs.pi-claude-bridge.packages.${system}.pi-claude-bridge` +- `bridge.passthru.packagePath` as an absolute Nix store package directory + +This is consistent with Pi package docs indicating absolute local package directories are accepted in settings. + +## Validation run + +Passed: + +- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && nix build --print-build-logs .#pi-claude-bridge` +- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && nix flake show --all-systems` +- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && nix run .#update` +- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && git diff --check` +- `cd /home/rafiq/1_repos/tools && nix flake lock --update-input pi-claude-bridge` +- `cd /home/rafiq/1_repos/tools && nix develop -c just format-nix` +- `cd /home/rafiq/1_repos/tools && nix develop -c just check-nix` +- `cd /home/rafiq/1_repos/tools && nix develop -c just test-nix` +- `cd /home/rafiq/1_repos/tools && nix eval --json .#darwinConfigurations.auto.config.home-manager.users.binmohm.programs.pi-coding-agent.settings.packages` +- `cd /home/rafiq/1_repos/tools && nix build .#darwinConfigurations.auto.config.system.build.toplevel --dry-run` + +Key eval output: + +```json +["npm:pi-mcp-adapter","npm:pi-subagents","npm:pi-web-access","npm:pi-hermes-memory","/nix/store/sdl9s2naq0201887m4iffpyridjkfnsl-pi-claude-bridge-1.5.0/lib/node_modules/@vanillagreen/pi-claude-bridge"] +``` + +The bridge package unit test output included the added regression: + +- `interleaved Pi user text is held until all parallel tool results are adjacent` +- `tests 28`, `pass 28`, `fail 0` + +## Tools commit/push + +Committed locally: + +- `feat(claude-code): use nix packaged pi bridge` (current branch HEAD) + +Push status: + +- `git push origin gtnh-server` was rejected because the remote branch is ahead/non-fast-forward. +- Pushed the same commit to `origin/pi-claude-bridge-nix-integration` for transfer/review without forcing or rewriting remote history. + +## Deployment status + +Not deployed from this session. Current host is `nemesis`, while the affected host is Darwin `auto`. The dry-run for `auto` succeeded and showed the Darwin bridge derivation would be built. `ssh -o BatchMode=yes auto ...` failed with `Permission denied (publickey)`, so I could not pull/rebuild on `auto`. Deploy by pulling `origin/pi-claude-bridge-nix-integration` on `auto` and running `nix develop -c just rb` there. + +## Rollback + +Revert the tools integration commit or restore `programs.pi-coding-agent.settings.packages = [ "npm:@vanillagreen/pi-claude-bridge" ];`, remove/ignore the new `pi-claude-bridge` flake input, run `nix develop -c just check-nix`, and rebuild `auto`. diff --git a/nix/modules/claude-code.nix b/nix/modules/claude-code.nix index 1f8796ee..b1a37d0d 100644 --- a/nix/modules/claude-code.nix +++ b/nix/modules/claude-code.nix @@ -1,12 +1,17 @@ +{ inputs, ... }: { config.flake.allowedUnfreePackages = [ "claude-code" ]; config.flake.modules.darwin.claude-code = { pkgs, ... }: + let + system = pkgs.stdenv.hostPlatform.system; + bridge = inputs.pi-claude-bridge.packages.${system}.pi-claude-bridge; + in { home-manager.sharedModules = [ { home.packages = [ pkgs.claude-code ]; - programs.pi-coding-agent.settings.packages = [ "npm:@vanillagreen/pi-claude-bridge" ]; + programs.pi-coding-agent.settings.packages = [ bridge.passthru.packagePath ]; } ]; }; diff --git a/progress.md b/progress.md new file mode 100644 index 00000000..7789e9f0 --- /dev/null +++ b/progress.md @@ -0,0 +1,13 @@ +# pi-claude-bridge-nix progress + +- Created `/home/rafiq/1_repos/pi-claude-bridge-nix` as a flake-parts/import-tree package flake. +- Confirmed upstream `vanillagreencom/vstack/pi-extensions/pi-claude-bridge` has `package-lock.json`, `package.json` version 1.5.0, tests, and source. +- Pinned npm 1.5.0 to upstream gitHead `d70c86ff9302ddecb7e2ae9d833bacb0544d6ecd` with source hash and npm deps hash in `VERSION.json`. +- Added Nix package, update app, CI workflows, and local test patch for grouped multi-tool results. +- Built and checked the bridge package on x86_64-linux; package contains `package.json` and `bundle/index.js` under the npm package path. +- Created/pushed GitHub repo `rrvsh/pi-claude-bridge-nix`; commit `f69bd3a feat(nix): package pi claude bridge`. +- Wired `/home/rafiq/1_repos/tools` to consume the bridge flake and point Pi at the Nix store package directory instead of `npm:@vanillagreen/pi-claude-bridge`. +- Ran tools Nix format/check/test, package-list eval, and Darwin dry-run successfully. +- Committed tools integration as `feat(claude-code): use nix packaged pi bridge` on the current branch HEAD. +- `git push origin gtnh-server` was rejected as non-fast-forward; pushed the commit to `origin/pi-claude-bridge-nix-integration` without rewriting remote history. +- Auto rebuild not run: this host is `nemesis`, and SSH to `auto` failed with `Permission denied (publickey)`. Deploy should be run on `auto`/Darwin after pulling the tools commit. From 290d1631c331fcf78d384138a3a6509bf108c0a0 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Fri, 26 Jun 2026 17:38:04 +0800 Subject: [PATCH 2/6] chore(implementation): remove subagent artifacts --- implementation/pi-claude-bridge-nix-work.md | 96 --------------------- progress.md | 13 --- 2 files changed, 109 deletions(-) delete mode 100644 implementation/pi-claude-bridge-nix-work.md delete mode 100644 progress.md diff --git a/implementation/pi-claude-bridge-nix-work.md b/implementation/pi-claude-bridge-nix-work.md deleted file mode 100644 index b95f3852..00000000 --- a/implementation/pi-claude-bridge-nix-work.md +++ /dev/null @@ -1,96 +0,0 @@ -# pi-claude-bridge-nix implementation - -## Summary - -Created and published `rrvsh/pi-claude-bridge-nix`, a pinned Nix flake packaging `@vanillagreen/pi-claude-bridge` 1.5.0 from `vanillagreencom/vstack` source. The tools repo now consumes that flake and configures Pi on the Darwin `claude-code` module to load the Nix-built bridge from the store instead of the npm registry spec. - -## Upstream pin - -- Source root: `pi-extensions/pi-claude-bridge` -- Lockfile source: upstream subdirectory `package-lock.json` -- Version: `1.5.0` -- Upstream rev/gitHead: `d70c86ff9302ddecb7e2ae9d833bacb0544d6ecd` -- Source hash: `sha256-VmGea5gTfD3KgkX6/nongGVcRwM96uSmLKq0RxeL0zY=` -- npm deps hash: `sha256-Mcr6n1SgVoN+XiI+sArROnUmkGN9soaWtPRFCA4LjY4=` - -## Bridge repo - -Changed files: - -- `/home/rafiq/1_repos/pi-claude-bridge-nix/flake.nix` -- `/home/rafiq/1_repos/pi-claude-bridge-nix/flake.lock` -- `/home/rafiq/1_repos/pi-claude-bridge-nix/VERSION.json` -- `/home/rafiq/1_repos/pi-claude-bridge-nix/nix/pi-claude-bridge.nix` -- `/home/rafiq/1_repos/pi-claude-bridge-nix/nix/update.nix` -- `/home/rafiq/1_repos/pi-claude-bridge-nix/patches/fix-multi-tool-results.patch` -- `/home/rafiq/1_repos/pi-claude-bridge-nix/.github/workflows/build.yml` -- `/home/rafiq/1_repos/pi-claude-bridge-nix/.github/workflows/update.yml` - -The package builds from source with Node 22, runs upstream typecheck and `tests/unit-import.mjs`, applies a local patch adding a focused multi-tool interleaving regression test, and verifies install output metadata for Pi extension loading. - -Committed and pushed: - -- `f69bd3a feat(nix): package pi claude bridge` -- Remote: `git@github.com:rrvsh/pi-claude-bridge-nix.git` - -## Tools repo - -Changed files: - -- `/home/rafiq/1_repos/tools/flake.nix` -- `/home/rafiq/1_repos/tools/flake.lock` -- `/home/rafiq/1_repos/tools/nix/modules/claude-code.nix` -- `/home/rafiq/1_repos/tools/progress.md` -- `/home/rafiq/1_repos/tools/implementation/pi-claude-bridge-nix-work.md` - -`claude-code.nix` now uses: - -- `inputs.pi-claude-bridge.packages.${system}.pi-claude-bridge` -- `bridge.passthru.packagePath` as an absolute Nix store package directory - -This is consistent with Pi package docs indicating absolute local package directories are accepted in settings. - -## Validation run - -Passed: - -- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && nix build --print-build-logs .#pi-claude-bridge` -- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && nix flake show --all-systems` -- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && nix run .#update` -- `cd /home/rafiq/1_repos/pi-claude-bridge-nix && git diff --check` -- `cd /home/rafiq/1_repos/tools && nix flake lock --update-input pi-claude-bridge` -- `cd /home/rafiq/1_repos/tools && nix develop -c just format-nix` -- `cd /home/rafiq/1_repos/tools && nix develop -c just check-nix` -- `cd /home/rafiq/1_repos/tools && nix develop -c just test-nix` -- `cd /home/rafiq/1_repos/tools && nix eval --json .#darwinConfigurations.auto.config.home-manager.users.binmohm.programs.pi-coding-agent.settings.packages` -- `cd /home/rafiq/1_repos/tools && nix build .#darwinConfigurations.auto.config.system.build.toplevel --dry-run` - -Key eval output: - -```json -["npm:pi-mcp-adapter","npm:pi-subagents","npm:pi-web-access","npm:pi-hermes-memory","/nix/store/sdl9s2naq0201887m4iffpyridjkfnsl-pi-claude-bridge-1.5.0/lib/node_modules/@vanillagreen/pi-claude-bridge"] -``` - -The bridge package unit test output included the added regression: - -- `interleaved Pi user text is held until all parallel tool results are adjacent` -- `tests 28`, `pass 28`, `fail 0` - -## Tools commit/push - -Committed locally: - -- `feat(claude-code): use nix packaged pi bridge` (current branch HEAD) - -Push status: - -- `git push origin gtnh-server` was rejected because the remote branch is ahead/non-fast-forward. -- Pushed the same commit to `origin/pi-claude-bridge-nix-integration` for transfer/review without forcing or rewriting remote history. - -## Deployment status - -Not deployed from this session. Current host is `nemesis`, while the affected host is Darwin `auto`. The dry-run for `auto` succeeded and showed the Darwin bridge derivation would be built. `ssh -o BatchMode=yes auto ...` failed with `Permission denied (publickey)`, so I could not pull/rebuild on `auto`. Deploy by pulling `origin/pi-claude-bridge-nix-integration` on `auto` and running `nix develop -c just rb` there. - -## Rollback - -Revert the tools integration commit or restore `programs.pi-coding-agent.settings.packages = [ "npm:@vanillagreen/pi-claude-bridge" ];`, remove/ignore the new `pi-claude-bridge` flake input, run `nix develop -c just check-nix`, and rebuild `auto`. diff --git a/progress.md b/progress.md deleted file mode 100644 index 7789e9f0..00000000 --- a/progress.md +++ /dev/null @@ -1,13 +0,0 @@ -# pi-claude-bridge-nix progress - -- Created `/home/rafiq/1_repos/pi-claude-bridge-nix` as a flake-parts/import-tree package flake. -- Confirmed upstream `vanillagreencom/vstack/pi-extensions/pi-claude-bridge` has `package-lock.json`, `package.json` version 1.5.0, tests, and source. -- Pinned npm 1.5.0 to upstream gitHead `d70c86ff9302ddecb7e2ae9d833bacb0544d6ecd` with source hash and npm deps hash in `VERSION.json`. -- Added Nix package, update app, CI workflows, and local test patch for grouped multi-tool results. -- Built and checked the bridge package on x86_64-linux; package contains `package.json` and `bundle/index.js` under the npm package path. -- Created/pushed GitHub repo `rrvsh/pi-claude-bridge-nix`; commit `f69bd3a feat(nix): package pi claude bridge`. -- Wired `/home/rafiq/1_repos/tools` to consume the bridge flake and point Pi at the Nix store package directory instead of `npm:@vanillagreen/pi-claude-bridge`. -- Ran tools Nix format/check/test, package-list eval, and Darwin dry-run successfully. -- Committed tools integration as `feat(claude-code): use nix packaged pi bridge` on the current branch HEAD. -- `git push origin gtnh-server` was rejected as non-fast-forward; pushed the commit to `origin/pi-claude-bridge-nix-integration` without rewriting remote history. -- Auto rebuild not run: this host is `nemesis`, and SSH to `auto` failed with `Permission denied (publickey)`. Deploy should be run on `auto`/Darwin after pulling the tools commit. From 5f50250dc3251e730ae1a2b7501816865f708c0f Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 27 Jun 2026 07:56:48 +0800 Subject: [PATCH 3/6] fix(flake.lock): update pi claude bridge --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 78221484..fe843ad2 100644 --- a/flake.lock +++ b/flake.lock @@ -922,11 +922,11 @@ ] }, "locked": { - "lastModified": 1782466286, - "narHash": "sha256-+Zc0b1fIydm0OZyh1AfDykRZBLQYR82I/93Q/mLKibk=", + "lastModified": 1782518187, + "narHash": "sha256-zI5k/1wA4sNGIYlQTuOk6MbtJKUpS9oMhL6aWEFjWXM=", "owner": "rrvsh", "repo": "pi-claude-bridge-nix", - "rev": "f69bd3a63349d115db44a6360041df11444c222b", + "rev": "85a4de18b3bbd5dfc8b05c71f403e1e1329aa9fb", "type": "github" }, "original": { From 1fdc8da0cbf3ce23abb2aecbe573795012e96cd7 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 27 Jun 2026 09:04:07 +0800 Subject: [PATCH 4/6] fix(flake.lock): update pi claude bridge --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index fe843ad2..7903649f 100644 --- a/flake.lock +++ b/flake.lock @@ -922,11 +922,11 @@ ] }, "locked": { - "lastModified": 1782518187, - "narHash": "sha256-zI5k/1wA4sNGIYlQTuOk6MbtJKUpS9oMhL6aWEFjWXM=", + "lastModified": 1782521032, + "narHash": "sha256-s8hrrD1cJVHDDBVjBqbDEwE3TP+Ihs5XV7ZjVOwV9ws=", "owner": "rrvsh", "repo": "pi-claude-bridge-nix", - "rev": "85a4de18b3bbd5dfc8b05c71f403e1e1329aa9fb", + "rev": "4b61075072b3e330a4a83aa79c07c8876657684c", "type": "github" }, "original": { From 87ee2e2ff718d66efd81708425a2bd8b504037d8 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 29 Jun 2026 10:01:03 +0800 Subject: [PATCH 5/6] fix(flake.lock): update pi claude bridge --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 7903649f..313d2594 100644 --- a/flake.lock +++ b/flake.lock @@ -922,11 +922,11 @@ ] }, "locked": { - "lastModified": 1782521032, - "narHash": "sha256-s8hrrD1cJVHDDBVjBqbDEwE3TP+Ihs5XV7ZjVOwV9ws=", + "lastModified": 1782698436, + "narHash": "sha256-SPWzWYqvcqQ9bjrbWYMNT+k0jr3PBOzjylQq3JSCxgI=", "owner": "rrvsh", "repo": "pi-claude-bridge-nix", - "rev": "4b61075072b3e330a4a83aa79c07c8876657684c", + "rev": "df4f8f10db3b4537190d1be871de64dffb66c0da", "type": "github" }, "original": { From 7cdaaaef03b6cbecf59fa8d41428a454e6855a63 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 29 Jun 2026 10:20:30 +0800 Subject: [PATCH 6/6] fix(flake.lock): update pi claude bridge --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 313d2594..a15ca46a 100644 --- a/flake.lock +++ b/flake.lock @@ -922,11 +922,11 @@ ] }, "locked": { - "lastModified": 1782698436, - "narHash": "sha256-SPWzWYqvcqQ9bjrbWYMNT+k0jr3PBOzjylQq3JSCxgI=", + "lastModified": 1782699420, + "narHash": "sha256-Cb57RECluc823CxuiLpEkkwfEZCp1fJmIvA+bpykKog=", "owner": "rrvsh", "repo": "pi-claude-bridge-nix", - "rev": "df4f8f10db3b4537190d1be871de64dffb66c0da", + "rev": "332eb2b3cbbbe8ff0b73acd53e46389bbd2d9fb8", "type": "github" }, "original": {