grok-session-cwd-rebind

command
v0.0.236 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

grok-session-cwd-rebind

Experiment / inspect: can a Grok session’s tool cwd be rebound after the original workspace directory is deleted?

Setup

  • grok on PATH
  • ~/.grok/auth.json (copied into an isolated GROK_HOME)

Run

# REPRO: delete old workspace, resume with --cwd NEW, no meta patch → exit 1 + REPRO:
go run ./script/debug/grok-session-cwd-rebind --expect=repro

# VERIFY: apply patches then resume → exit 0 + PASS:/VERIFY:
go run ./script/debug/grok-session-cwd-rebind --expect=healthy --patch=move_dir

Findings (2026-07-13)

Patch Tool cwd rebounds?
summary only no
prompt_context only no
summary,prompt_context no
move_dir only yes
summary,move_dir / prompt_context,move_dir / full set yes

Root cause: sessions live under
$GROK_HOME/sessions/<url-encoded-cwd>/<session-id>/.
Grok keys session storage by cwd. Renaming/moving that directory to the encoded new cwd is what rebinds tools. Editing info.cwd / working_directory in place (without move) is insufficient.

Loop doc: doc/LOOP_2026-07-13_grok-session-cwd-rebind-meta.md

Documentation

Overview

grok-session-cwd-rebind: experiment whether Grok session tool cwd can be rebound after the original workspace directory is deleted, by editing session meta files under a custom GROK_HOME.

Modes:

(default) repro  — delete old workspace, resume with --cwd NEW, no meta
                   patch. Expect sticky/broken cwd (exit non-zero + REPRO:).
--expect=healthy — apply --patch set, then expect pwd tool cwd == NEW
                   (exit 0 + VERIFY:).

Usage:

go run ./script/debug/grok-session-cwd-rebind
go run ./script/debug/grok-session-cwd-rebind --expect=healthy --patch=move_dir
go run ./script/debug/grok-session-cwd-rebind --keep-root /tmp/my-exp

Minimal working patch (2026-07-13 experiment): **move_dir alone** rebinds tool cwd. Editing summary.json / prompt_context.json without moving the session directory under sessions/<url-encoded-cwd>/ is NOT enough.

Prerequisites: `grok` on PATH; ~/.grok/auth.json (copied into custom GROK_HOME).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL