Skip to content

v1.3.2

@keshrath keshrath tagged this 08 Apr 20:48
Addresses the multi-terminal scenario the file-coord hook can't solve:
two Claude sessions in two terminals editing the same project at different
times, neither aware of the other, conflict surfaces only at git commit
when one session sees the other's WIP and has to figure out what's whose.

NEW scripts/hooks/workspace-awareness.mjs

  Fires on SessionStart. Registers this session in comm_state namespace
  workspace-agents (TTL 4h) and queries the same namespace for OTHER
  active sessions in the same workspace. If any exist, injects a banner
  into the agent's startup context: 'WARNING: N other Claude session(s)
  active in this workspace; recently edited foo.ts, bar.ts; coordinate
  via comm_send.' The agent starts already aware it's not alone.

NEW scripts/hooks/bash-guard.mjs

  Fires on PreToolUse matched on Bash. Single hook with a RULES table
  that intercepts workspace-wide commands and checks them against the
  files-edited world model. Initial rules:

    git commit          BLOCK if staged files were recently edited by
                        another session in this workspace
    git push            BLOCK with similar check on locally-changed files
    npm/pnpm/yarn       BLOCK if package.json or lockfiles were edited
      install/add/rm    by another session
    npm/pnpm/yarn test  WARN (allow) if any WIP from another session
    vitest/jest/pytest  WARN
    npm run build/tsc   WARN
    prisma migrate      BLOCK if migration files or schema were edited
    rails db:migrate    by another session — destructive operation
    npm run dev/vite    WARN if another session active (port collision)

  Adding a new rule is one entry in the RULES table inside the file.
  Bypassable for emergencies via AGENT_COMM_GUARD_BYPASS=1 env var.

  Validated end-to-end with a self-contained test that:
    1. Spawns the dashboard via the lib
    2. Sets up a git repo with one staged file
    3. Records a recent edit by session-A in files-edited
    4. Confirms session-B's git commit BLOCKS (exit 2 with helpful msg)
    5. Confirms session-A's git commit ALLOWS (its own edit)
    6. Confirms session-B's npm test WARNS (exit 0 with stderr note)
    7. Confirms unrelated 'ls -la' is not intercepted
    8. Confirms BYPASS env var skips the check
  All 5 cases pass.

NEW scripts/hooks/_agent-comm-rest.mjs

  Shared library for hook scripts. REST helpers, identity resolution,
  age formatting, workspace detection, file-edits / workspace-agents
  queries with case- and separator-insensitive matching for Windows.
  New hooks reuse the primitives instead of duplicating boilerplate.

REMOVED bench dashboard panel UI (the v1.3.1 'Bench' tab)

  The static results display didn't earn its place — same info is in
  bench/README.md in a more readable form. Kept GET /api/bench REST
  endpoint and bench/_results/latest.json for programmatic consumers.

Setup changes

  scripts/setup.js installs both new hooks alongside the existing five.
  ~/.claude/settings.json updated to wire workspace-awareness into
  SessionStart and bash-guard into PreToolUse(Bash) alongside existing
  hooks. JSON validates clean.

288/288 tests pass.
Assets 2
Loading