pi-odd-worktree 3.7.2 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,20 +15,20 @@ Two agent tools, four panels, one background-explorer command, one sidebar secti
15
15
  | `/files` | panel | Browses one checkout's files with a live, language-coloured preview: `enter` pastes the chosen paths into your prompt, `ctrl+e` opens the file in `$EDITOR`. |
16
16
  | `/issues` | panel | Reads this checkout's GitHub issues — the three scoped tabs on open, every open issue behind `g` — and, when your role allows it, edits them. |
17
17
  | `GITHUB` rail section | sidebar section | Lists the open issues of this checkout's repository assigned to you, seven at a time plus a count of the rest; a click opens that issue in `/issues` on `Assigned` and the overflow row opens `/issues`. Needs `gh` and gentle-shell-bridge with its rail; without `gh` on `PATH` it is never added to the rail at all. |
18
- | `activity` tags design | design on the bridge's `Card tags` line | Optional: `/gentle:customize` → `Cards` → `Card tags`, with `default` (the host's own card) and `activity`, which is selected for you on the first run. It covers `bash`, the read-only shell tools `grep`, `find`, `ls`, and `read`, `write` and `edit`: a bash card's heading names what the command does, each family in its own theme colour (`⌕ exploring`, `✓ checking`, …; an unnamed command reads `$ bash`), those three are always `⌕ exploring`, and a `read` — which runs no shell command — is left exactly as the host drew it. `read`, `write` and `edit` are covered so that the file card can ask about them too, `write` and `edit` through a scope limited to skill and ODD paths (gentle-shell-bridge 0.9.0): the design draws nothing of its own for any of the three, so a read, a write or an edit on a skill or an ODD artifact is the file card's row and everything else stays the host's. A finished call shows its duration on the closing rule and the frame turns `warning` while the call runs and `error` when it fails. Needs gentle-shell-bridge 0.6.0 or newer for the one `Card tags` row over the six tools, and 0.9.0 for `edit` and the scope that claims a write or an edit; on 0.5.0 the row is `Card bash`, covers bash alone and keeps everything above for bash cards. Registered through gentle-shell-bridge's `registerToolDesign`; the bridge owns the choice, remembers it and repaints cards already on screen. |
19
- | `color` diff design | design on the bridge's `Card diff` line | Optional: `/gentle:customize` → `Cards` → `Card diff`, with `default` (the host's own card) and `color`, which is selected for you on the first run. It covers `write` and `edit` and redraws them as an IDE pane: a write's content behind a line-number gutter, and an edit's diff, both in the active theme's own syntax roles from Pi's highlighter — the same one `/files` previews with. A write or an edit on a skill or an ODD artifact stays the file card's row, because the `Card tags` line claims exactly those calls and a specific claim wins over this generic one. Needs gentle-shell-bridge 0.9.0 or newer; on anything older nothing is registered and `Card diff` never appears. |
18
+ | `activity` tags design | design on the bridge's `Card activity` line | Optional: `/gentle:customize` → `Cards` → `Card activity`, with `default` (the host's own card) and `activity`, which is selected for you on the first run. It covers `bash`, the read-only shell tools `grep`, `find`, `ls`, and `read`, `write` and `edit`: a bash card's heading names what the command does, each family in its own theme colour (`⌕ exploring`, `✓ checking`, …; an unnamed command reads `$ bash`), those three are always `⌕ exploring`, and a `read` — which runs no shell command — is left exactly as the host drew it. `read`, `write` and `edit` are covered so that the file card can ask about them too, `write` and `edit` through a scope limited to skill and ODD paths (gentle-shell-bridge 0.9.0): the design draws nothing of its own for any of the three, so a read, a write or an edit on a skill or an ODD artifact is the file card's row and everything else stays the host's. A finished call shows its duration on the closing rule and the frame turns `warning` while the call runs and `error` when it fails. Needs gentle-shell-bridge 0.6.0 or newer for the one `Card activity` row over the six tools, and 0.9.0 for `edit` and the scope that claims a write or an edit; on 0.5.0 the row is `Card bash`, covers bash alone and keeps everything above for bash cards. Registered through gentle-shell-bridge's `registerToolDesign`; the bridge owns the choice, remembers it and repaints cards already on screen. |
19
+ | `color` diff design | design on the bridge's `Card diff` line | Optional: `/gentle:customize` → `Cards` → `Card diff`, with `default` (the host's own card) and `color`, which is selected for you on the first run. It covers `write` and `edit` and redraws them as an IDE pane: a write's content behind a line-number gutter, and an edit's diff, both in the active theme's own syntax roles from Pi's highlighter — the same one `/files` previews with. A write or an edit on a skill or an ODD artifact stays the file card's row, because the `Card activity` line claims exactly those calls and a specific claim wins over this generic one. Needs gentle-shell-bridge 0.9.0 or newer; on anything older nothing is registered and `Card diff` never appears. |
20
20
 
21
21
  Moving the session and removing a checkout are human actions: only `/warp` does either, and no agent tool can. A checkout has one identity, its ODD: the directory name is the ODD it serves, and `branch` is only the git branch.
22
22
 
23
- The `activity` design is not a preference of this package: it adds that value to the bridge's own line, `Card tags` on a bridge that can put several tools on one (0.6.0 and later) and `Card bash` on anything older, which keeps `default` (the host's own card, stored as `native`) available. The bridge names that row after the line's own key, so the grouped row was `Card tools` and is `Card tags` now — the older single row was always `Card bash`, and it was never renamed. The rename is one-time, and no choice is lost with it: a value you already stored on `Card tools` is carried over to `Card tags` before the design registers, so a `default` you picked stays `default` (a stored value the bridge could not read as a choice — anything but a non-empty, non-blank id string, `native` included — is left exactly where it is, and the document is not written at all). On the first run, and only when you have not chosen yet, the package selects `activity` once — before it registers the design, so a 0.6.0 bridge carries that choice over to the grouped line — and a later choice of `default` is never undone. The colours are theme roles, so a theme that gives two roles the same colour draws those two families alike. Load order does not matter. See [the cards the `activity` design paints](docs/reference.md#the-cards-the-activity-design-paints).
23
+ The `activity` design is not a preference of this package: it adds that value to the bridge's own line, `Card activity` on a bridge that can put several tools on one (0.6.0 and later) and `Card bash` on anything older, which keeps `default` (the host's own card, stored as `native`) available. The bridge names that row after the line's own key, so the grouped row was `Card tools` and is `Card activity` now — the older single row was always `Card bash`, and it was never renamed. The rename is one-time, and no choice is lost with it: a value you already stored on `Card tools` is carried over to `Card activity` before the design registers, so a `default` you picked stays `default` (a stored value the bridge could not read as a choice — anything but a non-empty, non-blank id string, `native` included — is left exactly where it is, and the document is not written at all). On the first run, and only when you have not chosen yet, the package selects `activity` once — before it registers the design, so a 0.6.0 bridge carries that choice over to the grouped line — and a later choice of `default` is never undone. The colours are theme roles, so a theme that gives two roles the same colour draws those two families alike. Load order does not matter. See [the cards the `activity` design paints](docs/reference.md#the-cards-the-activity-design-paints).
24
24
 
25
- The diff card is a design of the same kind, on a line of its own: `Card diff`, with `default` (the host's own card, stored as `native`) kept available and `color` selected once on the first run that finds no choice. It registers nothing at all on a bridge older than `0.9.0`, because its line needs the per-`(line, tool)` claim that release introduced, and the `Card tags` line claims a write and an edit on a skill or an ODD artifact through a scope, so that specific claim wins and those stay the file card's. See [the diff card](docs/reference.md#the-diff-card).
25
+ The diff card is a design of the same kind, on a line of its own: `Card diff`, with `default` (the host's own card, stored as `native`) kept available and `color` selected once on the first run that finds no choice. It registers nothing at all on a bridge older than `0.9.0`, because its line needs the per-`(line, tool)` claim that release introduced, and the `Card activity` line claims a write and an edit on a skill or an ODD artifact through a scope, so that specific claim wins and those stay the file card's. See [the diff card](docs/reference.md#the-diff-card).
26
26
 
27
- The file cards are not a preference of this package either: they belong to that same `activity` value. While the bridge answers that `activity` draws the tool being painted, a `read`, `edit` or `write` call on a skill or an ODD artifact heads as that file — its own mark and label, the tool, the path and a read's line range, each in the theme role the reference design gives it — instead of a bare tool row, and its Markdown body is drawn by Pi's own renderer with the theme's Markdown roles. Choosing `default` on `Card tags`, or any other design on that line, gives every one of those calls back to the host. The question is asked of the bridge on every paint, so a mid-session switch repaints cards already on screen, and a bridge older than 0.7.0 — which cannot answer it — keeps the card it always had. See [the file cards](docs/reference.md#the-file-cards).
27
+ The file cards are not a preference of this package either: they belong to that same `activity` value. While the bridge answers that `activity` draws the tool being painted, a `read`, `edit` or `write` call on a skill or an ODD artifact heads as that file — its own mark and label, the tool, the path and a read's line range, each in the theme role the reference design gives it — instead of a bare tool row, and its Markdown body is drawn by Pi's own renderer with the theme's Markdown roles. Choosing `default` on `Card activity`, or any other design on that line, gives every one of those calls back to the host. The question is asked of the bridge on every paint, so a mid-session switch repaints cards already on screen, and a bridge older than 0.7.0 — which cannot answer it — keeps the card it always had. See [the file cards](docs/reference.md#the-file-cards).
28
28
 
29
- The jobs card follows the same value. Gentle Shell registers `bash_background`, `monitor`, `job_stop` and `job_list` with no renderer of their own, so Pi draws them in a plain box and neither `neon` nor `float` ever reaches them. While the bridge answers that `activity` draws the tool being painted, they are drawn on the same card substrate in the style the shell has chosen: the job's mark and name (its label, else the first line of its command), the whole command when expanded, and the job's own answer below. Under the `minimal` card content level the call is drawn alone, and a failure still says why. Any other answer on `Card tags`, no bridge, or a bridge older than 0.7.0 leaves Pi's own box exactly as it was. Unlike the file cards, the answer is read when a job card is built, because there is no host drawing to hand back on a later paint: a switch made mid-session reaches the next job card. See [the jobs card](docs/reference.md#the-jobs-card).
29
+ The jobs card follows the same value. Gentle Shell registers `bash_background`, `monitor`, `job_stop` and `job_list` with no renderer of their own, so Pi draws them in a plain box and neither `neon` nor `float` ever reaches them. While the bridge answers that `activity` draws the tool being painted, they are drawn on the same card substrate in the style the shell has chosen: the job's mark and name (its label, else the first line of its command), the whole command when expanded, and the job's own answer below. Under the `minimal` card content level the call is drawn alone, and a failure still says why. Any other answer on `Card activity`, no bridge, or a bridge older than 0.7.0 leaves Pi's own box exactly as it was. Unlike the file cards, the answer is read when a job card is built, because there is no host drawing to hand back on a later paint: a switch made mid-session reaches the next job card. See [the jobs card](docs/reference.md#the-jobs-card).
30
30
 
31
- The two advisory messages Gentle Shell sends follow that same value, through the bridge's message-design surface rather than a tool renderer: `gentle-pi.exploration-budget` heads as `⌕ Exploration budget` and `gentle-pi.verifier-settle-reminder` as `⚑ Verifier reminder`, each with the numbers the message states as its detail, drawn on the same card substrate in the style the shell has chosen. Their body is never clipped — both are instructions the agent must read, so every row is drawn at any card content level, with no preview and no expand hint — and the bridge's own `[customType]` label row is dropped because the card's heading already names the alert. There is no second switch: each design FOLLOWS the `Card tags` line, so `activity` paints both alerts, live — flipping that line repaints the messages on screen and turns them off again — and `/gentle:customize` gains no row for them. A bridge older than `0.12.1` cannot keep that follow promise — `0.12.0` let a leftover stored value veto it — and gets no registration at all, so Pi's own box stays byte-identical; only a clean numeric release is trusted, and there is no capability probe. An inactive alert costs a registry walk and at most one tool-document read, and paints nothing. See [the message cards](docs/reference.md#the-message-cards).
31
+ The two advisory messages Gentle Shell sends follow that same value, through the bridge's message-design surface rather than a tool renderer: `gentle-pi.exploration-budget` heads as `⌕ Exploration budget` and `gentle-pi.verifier-settle-reminder` as `⚑ Verifier reminder`, each with the numbers the message states as its detail, drawn on the same card substrate in the style the shell has chosen. Their body is never clipped — both are instructions the agent must read, so every row is drawn at any card content level, with no preview and no expand hint — and the bridge's own `[customType]` label row is dropped because the card's heading already names the alert. There is no second switch: each design FOLLOWS the `Card activity` line, so `activity` paints both alerts, live — flipping that line repaints the messages on screen and turns them off again — and `/gentle:customize` gains no row for them. A bridge older than `0.12.1` cannot keep that follow promise — `0.12.0` let a leftover stored value veto it — and gets no registration at all, so Pi's own box stays byte-identical; only a clean numeric release is trusted, and there is no capability probe. An inactive alert costs a registry walk and at most one tool-document read, and paints nothing. See [the message cards](docs/reference.md#the-message-cards).
32
32
 
33
33
  ## Quick Start
34
34
 
@@ -38,7 +38,7 @@ The two advisory messages Gentle Shell sends follow that same value, through the
38
38
  | Node.js >= 18 and `git` | Every repository operation is a `git` child process. |
39
39
  | `gh`, authenticated (`gh auth login`) | `/issues` and the `GITHUB` rail section, and them alone. Without it neither is registered at all — `/issues` never loads and the section is never added to the rail, so there is nothing to refuse and no line to draw — and every other surface keeps working. |
40
40
  | Gentle Shell (recommended) | Supplies the session records the deletion guard reads to see other sessions. |
41
- | Gentle Shell with `gentle-shell-bridge` (and its rail, for the section) | Every surface this package registers. The `activity` value of the `Card tags` line (or `Card bash`, on a bridge older than 0.6.0) in `/gentle:customize` → `Cards` — which the skill/ODD file cards obey too — and the `GITHUB` rail section, which needs the rail too. The file picker's `alt+p` and the issues panel's `alt+i` are not the bridge's: both are bound directly on the host, and `GENTLE_PI_FILES_KEY` / `GENTLE_PI_ISSUES_KEY` override the keys. Install it with `pi install npm:gentle-shell-bridge`, or `gentle-shell install npm:gentle-shell-bridge` inside a Gentle Shell session. Without it the package loads nothing at all — no command, no tool, no card, no rail — and only names that install line, in a primary session. |
41
+ | Gentle Shell with `gentle-shell-bridge` (and its rail, for the section) | Every surface this package registers. The `activity` value of the `Card activity` line (or `Card bash`, on a bridge older than 0.6.0) in `/gentle:customize` → `Cards` — which the skill/ODD file cards obey too — and the `GITHUB` rail section, which needs the rail too. The file picker's `alt+p` and the issues panel's `alt+i` are not the bridge's: both are bound directly on the host, and `GENTLE_PI_FILES_KEY` / `GENTLE_PI_ISSUES_KEY` override the keys. Install it with `pi install npm:gentle-shell-bridge`, or `gentle-shell install npm:gentle-shell-bridge` inside a Gentle Shell session. Without it the package loads nothing at all — no command, no tool, no card, no rail — and only names that install line, in a primary session. |
42
42
 
43
43
  ```bash
44
44
  # plain Pi
@@ -51,7 +51,7 @@ gentle-shell install npm:pi-odd-worktree
51
51
 
52
52
  From a local clone, `pi install .` installs the working copy, and `gentle-shell install .` does the same from inside a Gentle Shell session.
53
53
 
54
- Expected result: `/warp`, `/odd`, `/files` and `/issues` are available as commands — `/issues` only where `gh` is on `PATH` — the agent is offered `worktree_create` and `worktree_list`, a Gentle Shell whose `gentle-shell-bridge` is installed and whose rail is drawn shows a `GITHUB` section for this checkout, and its `/gentle:customize` → `Cards` page offers `activity` on its `Card tags` line — `Card bash` on a bridge older than 0.6.0.
54
+ Expected result: `/warp`, `/odd`, `/files` and `/issues` are available as commands — `/issues` only where `gh` is on `PATH` — the agent is offered `worktree_create` and `worktree_list`, a Gentle Shell whose `gentle-shell-bridge` is installed and whose rail is drawn shows a `GITHUB` section for this checkout, and its `/gentle:customize` → `Cards` page offers `activity` on its `Card activity` line — `Card bash` on a bridge older than 0.6.0.
55
55
 
56
56
  ## Core Workflow
57
57
 
@@ -64,6 +64,7 @@ The full rules of each step, including every refusal, are in [Create, list, move
64
64
 
65
65
  ## Key Features You Should Know About
66
66
 
67
+ - **Two halves are optional.** With `gentle-shell-bridge`, `/gentle:customize` has a `Tools` page with an Off/On line for `Codegraph+` (the CodeGraph prompt text, reminders and wiring; its card follows the `Card activity` line like every other card) and one for `Worktrees+` (the worktree tools, `/warp`, the worktree guards and prompt text). Both are On by default; a change needs `/reload` and a new session. See [the module switches](docs/reference.md#the-module-switches).
67
68
  - **A create is instant and writes no state.** The directory is the whole record; there is no list file and no lock file.
68
69
  - **Deleting refuses on a live session.** The guard reads Gentle Shell's presence records, discloses what it could not resolve, and never auto-warps. Removal is `git worktree remove` and the branch is kept. See [the deletion guard](docs/reference.md#the-deletion-guard-and-its-honest-limit).
69
70
  - **A warp is queued, never dropped.** While this session's tools, agent tasks or background jobs are still running, `/warp` keeps the request pending and moves when they finish. See [the queued warp](docs/reference.md#a-warp-waits-for-this-sessions-own-tools-agent-tasks-and-background-jobs).
@@ -73,16 +74,16 @@ The full rules of each step, including every refusal, are in [Create, list, move
73
74
  - **`/issues` pins the repository.** Every read, mutation and browser open is bound to the repository that was loaded, and capabilities fail closed. See [the repository pin](docs/reference.md#issues-pins-the-repository).
74
75
  - **The issues rail is checkout-scoped and optional.** When a Gentle Shell has `gentle-shell-bridge` installed and draws its rail, a `GITHUB` rail section lists the open issues of this checkout's repository assigned to you — that one repository, not every issue across every repository you touch — seven at a time, with `and N more issues` for the rest and a pull-request mark on the issues that already have one. A click opens that issue in the `/issues` panel on `Assigned`, not in a browser: the click first proves the number belongs to this checkout, so a row left over from another checkout — or a checkout whose repository cannot be proven — opens nothing instead of guessing, and `/issues`' own `o` key is still the browser. The overflow row opens `/issues` with no number. While the rail's cache holds this repository, `/issues` paints its first frame from it and reads one tab at mount instead of three, the other two reading the first time you open them; the cache outlives both the session and the process — one document under `$XDG_CACHE_HOME/odd-worktree/` — so a warm checkout's first read is already a delta. A frame never waits on `gh`, and neither does a session start: the `gh` gate is dispatched, never awaited, so no child process and no network call sits on opening or switching a session. While the section is drawn it re-reads on its own 20 s timer, keeps no timer while hidden and stops the moment it is no longer drawn, and a `bash` command that mutates an issue or a pull request forces one read behind a 5 s cap; a failed refresh keeps the rows and marks them `stale` rather than emptying the list. Without `gh` on `PATH` neither the section nor `/issues` exists at all — the command is never registered and the section is never added to the rail — and every other surface keeps working. With no bridge the section simply never appears; the one thing you get is a single warning naming the install command, in a primary session only. See [the rail section](docs/reference.md#the-github-rail-section).
75
76
  - **Cards follow your shell.** Tool and warp cards use the card style Gentle Shell publishes, and a click expands that card only. See [card style](docs/reference.md#card-style-follows-your-shell).
76
- - **Tool headings can name the activity.** With `activity` chosen on the `Card tags` line, a bash card whose heading shows the whole command is headed with the family its command names (mark and word) instead of `$`, and a `grep`, `find` or `ls` card is headed `⌕ exploring` instead of its own glyph and name, while a `read` — which runs no shell command — keeps the host's own card, colour and width; a bash command the classifier cannot name, or a heading that hides part of it, keeps the host's `$`. See [the cards the `activity` design paints](docs/reference.md#the-cards-the-activity-design-paints).
77
- - **File calls on a skill or an ODD are cards too.** While `Card tags` answers with `activity` for the tool being painted, a `read`, `edit` or `write` call whose path names a skill (anything below a `skills` folder) or an ODD (anything below an `odd` folder) heads as that file, with the tool, the path and a read's line range; its Markdown body — the whole document when expanded, the first rows when collapsed — is drawn by Pi's own renderer in the theme's Markdown roles — for an `edit`, the fragment it leaves behind, never its diff, and a call that leaves no fragment falls back to its own rows. Any other file call, and every call while that line answers anything else, is the host's own row. See [the file cards](docs/reference.md#the-file-cards).
78
- - **Background-job tools are cards too.** While `Card tags` answers with `activity` for the tool being painted, `bash_background`, `monitor`, `job_stop` and `job_list` are drawn in the shell's own card style instead of Pi's plain box. Any other answer leaves Pi's box untouched. See [the jobs card](docs/reference.md#the-jobs-card).
79
- - **The two advisory messages are cards too.** While `Card tags` answers with `activity`, `gentle-pi.exploration-budget` and `gentle-pi.verifier-settle-reminder` are drawn as `⌕ Exploration budget` and `⚑ Verifier reminder` in the shell's own card style, the whole body at every content level. They follow that line — no second switch, no row added to `Cards`, and a flip repaints the messages on screen and turns them off again. Any other answer hands the message back as Pi drew it, for the price of a registry walk and at most one tool-document read, and a bridge older than `0.12.1` — or one whose release string is not a clean numeric release — registers nothing at all. See [the message cards](docs/reference.md#the-message-cards).
80
- - **`edit` and `write` cannot land in the principal checkout's default branch.** A write whose path is inside the principal checkout of the session's repository, while that checkout is on the default branch, is refused with one line pointing at `worktree_list` and `worktree_create`. Paths outside the repository, anything under the OS temp directories, other repositories and linked worktrees are never blocked. See [the guard](docs/reference.md#the-edit-and-write-guard).
81
- - **`bash` cannot leave the principal checkout's default branch.** A `git worktree add` or `git worktree list` is refused in any cwd and pointed at `worktree_create` and `worktree_list`; in the principal checkout, a switch that would leave the branch it is on is refused while that branch is the repository's default, and creating a branch is not blocked. See [the guards](docs/reference.md#the-bash-guards).
77
+ - **Tool headings can name the activity.** With `activity` chosen on the `Card activity` line, a bash card whose heading shows the whole command is headed with the family its command names (mark and word) instead of `$`, and a `grep`, `find` or `ls` card is headed `⌕ exploring` instead of its own glyph and name, while a `read` — which runs no shell command — keeps the host's own card, colour and width; a bash command the classifier cannot name, or a heading that hides part of it, keeps the host's `$`. See [the cards the `activity` design paints](docs/reference.md#the-cards-the-activity-design-paints).
78
+ - **File calls on a skill or an ODD are cards too.** While `Card activity` answers with `activity` for the tool being painted, a `read`, `edit` or `write` call whose path names a skill (anything below a `skills` folder) or an ODD (anything below an `odd` folder) heads as that file, with the tool, the path and a read's line range; its Markdown body — the whole document when expanded, the first rows when collapsed — is drawn by Pi's own renderer in the theme's Markdown roles — for an `edit`, the fragment it leaves behind, never its diff, and a call that leaves no fragment falls back to its own rows. Any other file call, and every call while that line answers anything else, is the host's own row. See [the file cards](docs/reference.md#the-file-cards).
79
+ - **Background-job tools are cards too.** While `Card activity` answers with `activity` for the tool being painted, `bash_background`, `monitor`, `job_stop` and `job_list` are drawn in the shell's own card style instead of Pi's plain box. Any other answer leaves Pi's box untouched. See [the jobs card](docs/reference.md#the-jobs-card).
80
+ - **The two advisory messages are cards too.** While `Card activity` answers with `activity`, `gentle-pi.exploration-budget` and `gentle-pi.verifier-settle-reminder` are drawn as `⌕ Exploration budget` and `⚑ Verifier reminder` in the shell's own card style, the whole body at every content level. They follow that line — no second switch, no row added to `Cards`, and a flip repaints the messages on screen and turns them off again. Any other answer hands the message back as Pi drew it, for the price of a registry walk and at most one tool-document read, and a bridge older than `0.12.1` — or one whose release string is not a clean numeric release — registers nothing at all. See [the message cards](docs/reference.md#the-message-cards).
81
+ - **`edit` and `write` cannot land in the principal checkout's default branch.** A write whose path is inside the principal checkout of the session's repository, while that checkout is on the default branch, is refused with one line pointing at `worktree_list` and `worktree_create`. Paths outside the repository, anything under the OS temp directories, ODD artifacts (any path below an `odd/` folder, on any branch), other repositories and linked worktrees are never blocked. See [the guard](docs/reference.md#the-edit-and-write-guard).
82
+ - **`bash` cannot leave the principal checkout's default branch.** A `git worktree add` is refused in any cwd and pointed at `worktree_create`; in the principal checkout, a switch that would leave the branch it is on is refused while that branch is the repository's default, and creating a branch is not blocked. See [the guards](docs/reference.md#the-bash-guards).
82
83
  - **Two blocks in the system prompt.** `## ODD worktrees` tells the agent how worktrees and ODDs work. `## CodeGraph` tells a session that already holds a CodeGraph tool how to use it, with one text per role. Both are appended after the host's own text, and `ODD_WORKTREE_PROMPT=0` suppresses them. See [the prompt blocks](docs/reference.md#the--odd-worktrees-block-in-the-system-prompt).
83
84
  - **CodeGraph stays fresh, only when its CLI is installed.** At session start the package creates or syncs the checkout's index and warms its daemon, and makes sure your global `mcp.json` has the `codegraph` entry (it adds it or fixes only the differing fields and keeps the rest). It also syncs after a compaction, after a native `codegraph init` and after an `edit` or `write`, in the background and without ever blocking you. See [CodeGraph](docs/reference.md#codegraph-index-daemon-and-mcp-entry). Its tool rows are drawn as a card.
84
85
  - **Two reminders keep a session on the CodeGraph rule.** The first `grep`, `find`, `ls`, `read` or `bash` search in a checkout gets one sentence appended to its result: use `codegraph` first, or — for another checkout — call `mcp__codegraph__codegraph_explore` with that path as `projectPath`. Each message that starts with a search instead of the graph gets the one about your own checkout once, on its first search, and no later search of it repeats it (a new request re-arms it, a compaction starts it from zero); the one about another checkout stays once per checkout; neither is ever a block. See [the reminders](docs/reference.md#the-two-codegraph-reminders).
85
- - **Deliberately absent.** No customize panel, no plugin-tools toggles, no companion-app integration and no worktree-to-issue association. There is nothing to configure here: the tools design — and, with it, the skill/ODD file cards — is chosen on the bridge's own `Card tags` line (or `Card bash`, on an older bridge), so this package owns no preference of its own.
86
+ - **Deliberately absent.** No customize panel, no plugin-tools toggles, no companion-app integration and no worktree-to-issue association. There is nothing to configure here: the tools design — and, with it, the skill/ODD file cards — is chosen on the bridge's own `Card activity` line (or `Card bash`, on an older bridge), so this package owns no preference of its own.
86
87
 
87
88
  ## Documentation
88
89
 
@@ -14,10 +14,10 @@
14
14
  //
15
15
  // The bash heading is not a preference of this package either: it contributes one DESIGN
16
16
  // (`activity`) to gentle-shell-bridge's `/gentle:customize` → `Cards` page, on its
17
- // `Card tags` line when the bridge can group tools (`default` | `activity`) and on
17
+ // `Card activity` line when the bridge can group tools (`default` | `activity`) and on
18
18
  // the per-tool `bash` line on anything older, which the bridge owns, persists and
19
19
  // repaints (lib/bash-design.js). The skill/ODD file card owns no preference at all: it
20
- // is painted while that same `Card tags` line answers with this design, asked of the
20
+ // is painted while that same `Card activity` line answers with this design, asked of the
21
21
  // bridge per paint (lib/file-card-resolver.js), and the host draws its own row for any
22
22
  // other value. Nothing of that is registered here.
23
23
  //
@@ -1996,7 +1996,7 @@ async function executeWorktreeClose(params, ctx, opts) {
1996
1996
  const worktreeListTool = defineTool({
1997
1997
  name: "worktree_list",
1998
1998
  label: "Worktree List",
1999
- description: "List this clone's Git worktrees: the main worktree first, then the checkouts this package created under <repo-name>-worktrees (each row is its directory's name, which is the ODD, and its branch). Use it to see whether an ODD already has a worktree. Read-only; it writes nothing.",
1999
+ description: "List this clone's Git worktrees: the main worktree first, then the checkouts this package created under <repo-name>-worktrees (each row is the checkout's absolute path, whose last segment is the ODD, and its branch). Use it to see whether an ODD already has a worktree. Read-only; it writes nothing.",
2000
2000
  parameters: Type.Object({
2001
2001
  all: opt(Type.Boolean({ description: "Omit it: the default lists the ODD checkouts, which is what finds an ODD's worktree. true also lists the worktrees Git knows outside <repo-name>-worktrees, which belong to no ODD; use it only to look for one of those." })),
2002
2002
  }),
@@ -9308,6 +9308,27 @@ function registerDiffDesignRows(api) {
9308
9308
  }
9309
9309
  }
9310
9310
 
9311
+ // modular-tools: the two module switches. `Codegraph+` and `Worktrees+` live on the
9312
+ // bridge's own `Tools` page as plain Off/On rows (`lib/modules.js`), persisted in this
9313
+ // package's store. They are read ONCE per registration episode, below: a change lands on
9314
+ // the next load, and the row says so through the session's own notifier.
9315
+ let oddModules = { codegraph: true, worktrees: true };
9316
+
9317
+ function notifyModulesChange(text) {
9318
+ const ui = issuesSidebarCtx && issuesSidebarCtx.ui;
9319
+ if (ui && typeof ui.notify === "function") ui.notify(text, "info");
9320
+ }
9321
+
9322
+ function registerModuleRows(api) {
9323
+ try {
9324
+ if (!api || typeof api.registerRows !== "function") return;
9325
+ const modules = libRequire("modules.js");
9326
+ api.registerRows(modules.moduleRowsProvider({ api, notify: notifyModulesChange }));
9327
+ } catch {
9328
+ // The page is optional: a bridge that refuses it keeps both modules on.
9329
+ }
9330
+ }
9331
+
9311
9332
  // S2 (issues-sidebar): the section reaches the rail ONLY through the bridge's
9312
9333
  // published object. A host without it is subscribed to the ready announcement
9313
9334
  // ONCE and nothing else happens: no notify, no throw, no other surface touched.
@@ -9324,6 +9345,7 @@ function registerIssuesSidebar(pi) {
9324
9345
  // its surfaces are registered on it and the previous binding is replaced,
9325
9346
  // with `mountIssuesSidebar` tearing the old section down first.
9326
9347
  if (api !== issuesSidebarApi) {
9348
+ registerModuleRows(api);
9327
9349
  registerBashDesignRows(api);
9328
9350
  registerDiffDesignRows(api);
9329
9351
  issuesSidebarApi = api;
@@ -9756,18 +9778,26 @@ function registerOddWorktreeSurfaceEntries(pi) {
9756
9778
  // `/warp` is the ONE entry point of the warp queue (S3): no agent surface
9757
9779
  // moves the session, so the command is where a handoff waits and lands.
9758
9780
  warpHandoffPi = pi;
9759
- registerWarpMessageRenderer(pi);
9781
+ // modular-tools: the two module switches are read ONCE, here. `Worktrees+` off leaves
9782
+ // out everything worktree below — the tools, `/warp` with its card and bookkeeping, the
9783
+ // guards and the prompt text; `Codegraph+` off leaves out the CodeGraph wiring and text.
9784
+ try {
9785
+ oddModules = libRequire("modules.js").readModules(issuesSidebarBridge());
9786
+ } catch {
9787
+ oddModules = { codegraph: true, worktrees: true };
9788
+ }
9789
+ if (oddModules.worktrees) registerWarpMessageRenderer(pi);
9760
9790
  // S5 (warp-queue-boundary): the durable fallback of the queued line needs a
9761
9791
  // renderer for its own entry type, exactly like Pi's `restored N messages`
9762
9792
  // line. A host without the seam simply never shows the fallback.
9763
- registerWarpQueueEntryRenderer(pi);
9793
+ if (oddModules.worktrees) registerWarpQueueEntryRenderer(pi);
9764
9794
  // S9 (T10): the issues-panel refusal's one visible fallback line.
9765
9795
  registerIssuesRefusalEntryRenderer(pi);
9766
9796
  // S2 (issues-sidebar): the rail section, only when gentle-shell-bridge
9767
9797
  // published its API; otherwise one ready-announcement subscription. The same
9768
9798
  // path contributes the bash activity design.
9769
9799
  registerIssuesSidebar(pi);
9770
- registerWarpCommand(pi);
9800
+ if (oddModules.worktrees) registerWarpCommand(pi);
9771
9801
  registerOddCommand(pi);
9772
9802
  // T7 (files-picker): the file picker is the fourth command. It mounts its own
9773
9803
  // overlays, reads Git through the package's async runner and adds no tool.
@@ -9780,8 +9810,10 @@ function registerOddWorktreeSurfaceEntries(pi) {
9780
9810
  // picker's — bound after its command exists, and therefore never when the
9781
9811
  // `gh`-absent gate left that command unregistered.
9782
9812
  bindIssuesShortcut(pi);
9783
- pi.registerTool(worktreeCreateTool);
9784
- pi.registerTool(worktreeListTool);
9813
+ if (oddModules.worktrees) {
9814
+ pi.registerTool(worktreeCreateTool);
9815
+ pi.registerTool(worktreeListTool);
9816
+ }
9785
9817
  if (typeof pi?.on !== "function") return;
9786
9818
  // S5: the cards follow the style chosen in Gentle Shell with no hook of their
9787
9819
  // own. The shell publishes the live value on a process-wide slot and the card
@@ -9886,24 +9918,24 @@ function registerOddWorktreeSurfaceEntries(pi) {
9886
9918
  pi.on("session_shutdown", () => {
9887
9919
  startupEpoch += 1;
9888
9920
  });
9889
- pi.on("tool_call", (event, ctx) => handleWorktreeOddEvent(event, ctx, pi));
9921
+ if (oddModules.worktrees) pi.on("tool_call", (event, ctx) => handleWorktreeOddEvent(event, ctx, pi));
9890
9922
  // S1/S3/S4/S9: the worktree guard, the first `tool_call` observation that refuses a
9891
9923
  // `bash` command instead of observing it. It sits beside the naming handler and is
9892
9924
  // one of the two handlers that return a `block` answer — the skill-read guard, below,
9893
9925
  // is the other; every other tool call is left exactly as the host proposed it. Nothing
9894
9926
  // about it is callable by the agent (S7).
9895
- pi.on("tool_call", (event, ctx) => guardWorktreeBashCall(event, ctx));
9927
+ if (oddModules.worktrees) pi.on("tool_call", (event, ctx) => guardWorktreeBashCall(event, ctx));
9896
9928
  // S4 (T3): the write guard, a second `tool_call` observation that refuses an `edit`
9897
9929
  // or `write` into the primary checkout while it sits on the default branch. It is a
9898
9930
  // sibling of the bash guard, not a part of it: the two read different inputs, and a
9899
9931
  // `bash` call and a file write are refused for different reasons.
9900
- pi.on("tool_call", (event, ctx) => guardWorktreeWriteCall(event, ctx));
9932
+ if (oddModules.worktrees) pi.on("tool_call", (event, ctx) => guardWorktreeWriteCall(event, ctx));
9901
9933
  // invariant 22: the skill-read guard, the second refusal and the guard registered LAST
9902
9934
  // of the two, so a call that would break both shows the worktree refusal. It reads the
9903
9935
  // command text only, shares the same `ODD_WORKTREE_GUARD=0` switch, and adds no
9904
9936
  // command, tool, option or setting of its own.
9905
9937
  pi.on("tool_call", (event) => guardSkillReadBashCall(event));
9906
- pi.on("tool_result", (event, ctx) => handleWorktreeOddEvent(event, ctx, pi, true));
9938
+ if (oddModules.worktrees) pi.on("tool_result", (event, ctx) => handleWorktreeOddEvent(event, ctx, pi, true));
9907
9939
  // S10 (T9): ONE `tool_result` observation for the rail's forced refresh. It
9908
9940
  // answers the `bash` tool only — every other tool returns before the classifier
9909
9941
  // is even loaded — and it is separate from the naming handler because the two
@@ -9911,8 +9943,10 @@ function registerOddWorktreeSurfaceEntries(pi) {
9911
9943
  pi.on("tool_result", (event, ctx) => forceIssuesSidebarRefreshForBash(event, ctx));
9912
9944
  // S10: the host's execution pair feeds the queue's in-flight tool counter for
9913
9945
  // EVERY tool of the session, not only this package's.
9914
- pi.on("tool_execution_start", (event) => warpNoteToolExecution(event, false));
9915
- pi.on("tool_execution_end", (event) => warpNoteToolExecution(event, true));
9946
+ if (oddModules.worktrees) {
9947
+ pi.on("tool_execution_start", (event) => warpNoteToolExecution(event, false));
9948
+ pi.on("tool_execution_end", (event) => warpNoteToolExecution(event, true));
9949
+ }
9916
9950
  // S1/S13/S17 (warp-queue-boundary): the turn boundary. Pi delivers a queued
9917
9951
  // input at the end of the current assistant turn, after its tool calls and
9918
9952
  // before the next model call; a pending warp takes effect at that SAME
@@ -9944,6 +9978,7 @@ function registerOddWorktreeSurfaceEntries(pi) {
9944
9978
  // T13: the read itself happens only while the section is drawn.
9945
9979
  rememberIssuesSidebarSession(ctx);
9946
9980
  refreshIssuesSidebarIfDrawn();
9981
+ if (!oddModules.worktrees) return;
9947
9982
  try {
9948
9983
  const lib = libRequire("worktree-warp-busy.js");
9949
9984
  if (!lib || typeof lib.pendingWarpTurnBoundary !== "function") return;
@@ -9963,7 +9998,7 @@ function registerOddWorktreeSurfaceEntries(pi) {
9963
9998
  // rejects. One tick per record: the record's own `dispatching` guard makes the
9964
9999
  // boundary and a concurrent poll dispatch it at most once, and a throwing
9965
10000
  // tick must never break the host.
9966
- pi.on("agent_settled", async () => {
10001
+ if (oddModules.worktrees) pi.on("agent_settled", async () => {
9967
10002
  try {
9968
10003
  const lib = libRequire("worktree-warp-busy.js");
9969
10004
  if (!lib || typeof lib.pendingWarpKeys !== "function" || typeof lib.pendingWarpTick !== "function") return;
@@ -9988,29 +10023,35 @@ function registerOddWorktreeSurfaceEntries(pi) {
9988
10023
  // T13: and like the turn boundary, it reads only while the section is drawn.
9989
10024
  rememberIssuesSidebarSession(ctx);
9990
10025
  refreshIssuesSidebarIfDrawn();
9991
- try {
9992
- libRequire("odd-worktrees-prompt.js").appendOddWorktreesSection(event);
9993
- } catch {
9994
- // The prompt block is best effort.
10026
+ if (oddModules.worktrees) {
10027
+ try {
10028
+ libRequire("odd-worktrees-prompt.js").appendOddWorktreesSection(event);
10029
+ } catch {
10030
+ // The prompt block is best effort.
10031
+ }
9995
10032
  }
9996
10033
  // The role's CodeGraph text rides the same append-only channel. It only
9997
10034
  // advises a session that already holds a CodeGraph tool.
9998
- try {
9999
- libRequire("codegraph-rules.js").appendCodegraphSection(event);
10000
- } catch {
10001
- // The prompt block is best effort.
10035
+ if (oddModules.codegraph) {
10036
+ try {
10037
+ libRequire("codegraph-rules.js").appendCodegraphSection(event);
10038
+ } catch {
10039
+ // The prompt block is best effort.
10040
+ }
10002
10041
  }
10003
10042
  });
10004
10043
  // CodeGraph, only with its CLI installed: the global MCP entry, create-or-sync at session
10005
10044
  // start, the compaction sync, the observed native init and the edit/write sync. Every
10006
10045
  // piece runs in the background and none can fail the host.
10007
- try {
10008
- libRequire("codegraph-session.js").registerCodegraph(pi, { metrics: () => resolveWorktreeToolCardMetrics() });
10009
- } catch {
10010
- // CodeGraph is best effort.
10046
+ if (oddModules.codegraph) {
10047
+ try {
10048
+ libRequire("codegraph-session.js").registerCodegraph(pi, { metrics: () => resolveWorktreeToolCardMetrics() });
10049
+ } catch {
10050
+ // CodeGraph is best effort.
10051
+ }
10011
10052
  }
10012
10053
  // S1 (T2): the file cards, through the same host hook. A `read`/`edit`/`write` call whose
10013
- // path names a skill or an ODD artifact heads as that file while the bridge's `Card tags`
10054
+ // path names a skill or an ODD artifact heads as that file while the bridge's `Card activity`
10014
10055
  // line answers with this package's activity design; every other call keeps the host's own
10015
10056
  // boxed row, which the card reproduces because the hook decides per tool name and never
10016
10057
  // sees the arguments. No preference of ours is registered: the gate is the bridge's own
@@ -10023,7 +10064,7 @@ function registerOddWorktreeSurfaceEntries(pi) {
10023
10064
  }
10024
10065
  // The jobs card, through the same host hook: `bash_background`, `monitor`, `job_stop` and
10025
10066
  // `job_list` have no renderer of their own, so Pi draws a plain box and the conversation's
10026
- // card style never reaches them. While the bridge's `Card tags` line answers with this
10067
+ // card style never reaches them. While the bridge's `Card activity` line answers with this
10027
10068
  // package's activity design for the tool, they are drawn on the card substrate in the
10028
10069
  // shell's own style; any other answer leaves Pi's drawing exactly as it was.
10029
10070
  try {
@@ -10031,9 +10072,22 @@ function registerOddWorktreeSurfaceEntries(pi) {
10031
10072
  } catch {
10032
10073
  // The card is cosmetic.
10033
10074
  }
10075
+ // The CodeGraph card, through the same host hook and OUTSIDE both module switches: it paints a
10076
+ // call, it does not run CodeGraph, so what decides it is the bridge's `Card activity` line — the
10077
+ // `activity` value the file cards, the jobs card and the two message cards already follow —
10078
+ // asked on every paint. `Codegraph+` turns the CodeGraph wiring off and leaves this card alone;
10079
+ // `native` leaves every one of these rows exactly as the chain drew it.
10080
+ try {
10081
+ libRequire("codegraph-card.js").registerCodegraphCard(pi, {
10082
+ metrics: () => resolveWorktreeToolCardMetrics(),
10083
+ cwd: () => toolCwd(issuesSidebarCtx),
10084
+ });
10085
+ } catch {
10086
+ // The card is cosmetic.
10087
+ }
10034
10088
  // The two ODD advisory MESSAGES, on the bridge's message-design surface: `gentle-pi.exploration-budget`
10035
10089
  // and `gentle-pi.verifier-settle-reminder` are custom messages no extension renders, so Pi draws its
10036
- // default box. Each design FOLLOWS the `Card tags` line above, so the `activity` value that already
10090
+ // default box. Each design FOLLOWS the `Card activity` line above, so the `activity` value that already
10037
10091
  // paints the jobs card paints both alerts too: no second switch, no row added to `Cards`, and the
10038
10092
  // follow is resolved on every pass, so a flip repaints — and turns off — what is already on screen.
10039
10093
  // A bridge that cannot express a follow registers nothing at all: an older one would create a
@@ -10050,7 +10104,7 @@ function registerOddWorktreeSurfaceEntries(pi) {
10050
10104
  // 483 ms → 72 ms of awaited `session_start`, and the rest of that 72 ms went with
10051
10105
  // the barrier. The task is still TRACKED, so `awaitPendingStartupTasks` and a
10052
10106
  // shutdown barrier can wait for it, and a failure still cannot break a session.
10053
- pi.on("session_start", (event, ctx) => {
10107
+ if (oddModules.worktrees) pi.on("session_start", (event, ctx) => {
10054
10108
  try {
10055
10109
  const cwd = ctx && typeof ctx.cwd === "string" && ctx.cwd.length > 0 ? ctx.cwd
10056
10110
  : event && typeof event.cwd === "string" && event.cwd.length > 0 ? event.cwd
@@ -8,7 +8,7 @@
8
8
  //
9
9
  // apply(lines, { width, tool, theme, part, render }) -> lines
10
10
  //
11
- // So the frame is the host's by construction, the choice is the bridge's own `Card tags` line in
11
+ // So the frame is the host's by construction, the choice is the bridge's own `Card activity` line in
12
12
  // `/gentle:customize` → `Cards` (`default` | `activity`), it is read on every paint so cards
13
13
  // already on screen repaint when it changes, and extension load order does not matter.
14
14
  //
@@ -49,15 +49,19 @@ const { fileCardIdentity, FILE_CARD_TOOLS } = require('./skill-odd-card.js');
49
49
  // The four background-job tools: the jobs card (`lib/jobs-card.js`) draws them, and it is painted
50
50
  // only while this line answers that this design draws the tool being drawn.
51
51
  const { JOB_TOOLS } = require('./jobs-card.js');
52
+ const { CODEGRAPH_MCP_PREFIXED_TOOL, CODEGRAPH_MCP_TOOL, CODEGRAPH_TOOL } = require('./codegraph-card.js');
53
+ // Both spellings the host reports for the same program, plus the native tool: one card, one line.
54
+ const CODEGRAPH_TOOLS = Object.freeze([CODEGRAPH_TOOL, CODEGRAPH_MCP_TOOL, CODEGRAPH_MCP_PREFIXED_TOOL]);
52
55
  const { cardElapsed, charColumns, elapsedRow, paintFrame, rowColumns, sgrBefore, textColumns, visibleChars } = require('./bash-frame.js');
53
56
 
54
57
  const TOOL_NAME = 'bash';
55
58
  // The bridge line every covered tool is switched by. The bridge names the row `Card <line>` — a line
56
- // has no label of its own — so this key IS the row, and S10's `Card tools` -> `Card tags` is a rename
57
- // of it (the stored choice follows in `carryOverLineSelection`).
58
- const TOOLS_LINE = 'tags';
59
- // The line key this package shipped before the rename. Read only by the one-time carry-over.
60
- const LEGACY_TOOLS_LINE = 'tools';
59
+ // has no label of its own — so this key IS the row: `Card tools` -> `Card activity` (S10) -> `Card activity`
60
+ // (S3 of modular-tools, the human's own call on the name). The stored choice follows in
61
+ // `carryOverLineSelection`, once per rename.
62
+ const TOOLS_LINE = 'activity';
63
+ // The line keys this package shipped before, newest first. Read only by the one-time carry-over.
64
+ const PREVIOUS_TOOLS_LINES = Object.freeze(['tags', 'tools']);
61
65
  // The bridge release that can take one line over several tools; earlier ones refuse a grouped
62
66
  // registration and record the refusal, so the shape is chosen BEFORE anything is registered.
63
67
  const TOOLS_LINE_VERSION = [0, 6, 0];
@@ -96,7 +100,7 @@ const EXPLORING = 'exploring';
96
100
  // untouched.
97
101
  const READ_TOOL = 'read';
98
102
  // S1: the file card draws `write` as a document too, and it is painted only while the bridge's
99
- // `Card tags` line answers that this design draws the tool being drawn — an answer the bridge
103
+ // `Card activity` line answers that this design draws the tool being drawn — an answer the bridge
100
104
  // derives from the line's own `tools`. So `write` is DECLARED here, for that question alone: the
101
105
  // design paints nothing for it, because `computeActivity` knows only bash and the read-only shell
102
106
  // marks and answers `undefined` for any other tool, which hands the host's rows back untouched.
@@ -111,7 +115,18 @@ const EDIT_TOOL = 'edit';
111
115
  // The background-job tools are declared for the same reason as `read` and `write`: the jobs card is the
112
116
  // only surface that draws them, and it is painted only while this line resolves to this design for them.
113
117
  // `computeActivity` knows no mark for them, so the design itself returns their rows exactly as drawn.
114
- const LINE_TOOLS = [TOOL_NAME, ...READ_TOOL_GLYPHS.keys(), READ_TOOL, WRITE_TOOL, ...JOB_TOOLS];
118
+ // The two CodeGraph tools are declared for the same reason (modular-tools S11): the CodeGraph card is a
119
+ // DESIGN, so the line is what claims the tool it paints, and `not-covered` would be a card nobody
120
+ // could ever switch on. `computeActivity` answers no mark for them either, so the design paints
121
+ // nothing of its own there.
122
+ const LINE_TOOLS = [
123
+ TOOL_NAME,
124
+ ...READ_TOOL_GLYPHS.keys(),
125
+ READ_TOOL,
126
+ WRITE_TOOL,
127
+ ...JOB_TOOLS,
128
+ ...CODEGRAPH_TOOLS,
129
+ ];
115
130
 
116
131
  // The bridge keeps ONE persisted value per tool, in its own store (`bridge-tool-designs` →
117
132
  // `selections` → `{ "bash": <design id> }`, documented in the bridge's contract), and one per LINE
@@ -574,11 +589,21 @@ function applyBashActivityHeading(lines, ctx) {
574
589
  }
575
590
 
576
591
  // The read-only picture `/gentle:customize` draws while `activity` is highlighted.
577
- const BASH_DESIGN_PREVIEW = {
578
- title: `Cards · ${BASH_DESIGN_LABEL}`,
592
+ // S4 (modular-tools): the preview's TITLE is the line's own name — what the bridge shows for the
593
+ // `default` value — so the two options of one line read as one line, and the SAMPLE is what tells
594
+ // them apart. The bridge derives the row from the line key (`Card <line>`), so the title is derived
595
+ // from the same key here and can never drift from it.
596
+ const cardRowName = (line) => `Card ${line}`;
597
+ const TOOLS_DESIGN_PREVIEW = {
598
+ title: `Cards · ${cardRowName(TOOLS_LINE)}`,
579
599
  // One row, like every other Cards preview: the families a heading can wear.
580
600
  sample: '⌕ exploring ✓ checking ⎇ versioning ↑ publishing ⚠ destructive',
581
601
  };
602
+ // The older single-tool registration names its own implicit line (`Card bash`).
603
+ const BASH_DESIGN_PREVIEW = {
604
+ title: `Cards · ${cardRowName(TOOL_NAME)}`,
605
+ sample: TOOLS_DESIGN_PREVIEW.sample,
606
+ };
582
607
 
583
608
  /** The single `bash` design an older bridge can take: one `Card bash` line, bash only. */
584
609
  function bashActivityDesign() {
@@ -594,9 +619,9 @@ function bashActivityDesign() {
594
619
  }
595
620
 
596
621
  /**
597
- * The grouped registration: ONE `Card tags` line over bash, the three read-only shell tools, `read`,
622
+ * The grouped registration: ONE `Card activity` line over bash, the three read-only shell tools, `read`,
598
623
  * `write` and, where the bridge can take a scope, `edit`. The bridge names the row after the line
599
- * (`Card tags`), keeps `default` first and stores the choice under its own reserved key, so the
624
+ * (`Card activity`), keeps `default` first and stores the choice under its own reserved key, so the
600
625
  * per-tool value stays where an older bridge put it.
601
626
  *
602
627
  * `read`, `write` and `edit` are on the line so the file card can ask about them (S1/S3): the card is
@@ -617,7 +642,7 @@ function toolsActivityDesign(options) {
617
642
  name: BASH_DESIGN_PLUGIN_NAME,
618
643
  label: BASH_DESIGN_LABEL,
619
644
  description: 'heads a tools card with the activity its call names; the read-only shell tools are always exploring',
620
- preview: () => ({ ...BASH_DESIGN_PREVIEW }),
645
+ preview: () => ({ ...TOOLS_DESIGN_PREVIEW }),
621
646
  apply: applyBashActivityHeading,
622
647
  };
623
648
  // The scope belongs to the `(line, tool)` claim, so it is added only where the bridge reads it and
@@ -722,9 +747,11 @@ function seedBashDesignSelection(api) {
722
747
  }
723
748
 
724
749
  /**
725
- * S10: carry a line value stored under the OLD line key over to the new one, ONCE, and report whether
726
- * it wrote. `Card tools` became `Card tags` with the row, because the bridge derives the row from the
727
- * line key and has no rename or alias path of its own.
750
+ * S10: carry a line value stored under an OLD line key over to the new one, ONCE, and report whether
751
+ * it wrote. `Card tools` became `Card activity` and `Card activity` became `Card activity`, because the bridge
752
+ * derives the row from the line key and has no rename or alias path of its own. The keys are read
753
+ * NEWEST FIRST: the most recent rename wins, and a present-but-invalid value is no migration at all
754
+ * rather than a reason to fall through to an older key.
728
755
  *
729
756
  * It cannot be left to the bridge's registration-time migration: that one runs only while the line has
730
757
  * NO value, and what it then copies is the legacy per-tool entry — the `bash` = `activity` this package
@@ -748,11 +775,13 @@ function carryOverLineSelection(api) {
748
775
  if (stored === null || typeof stored !== 'object' || Array.isArray(stored)) return false;
749
776
  const lines = stored[BRIDGE_LINES_KEY];
750
777
  if (lines === null || typeof lines !== 'object' || Array.isArray(lines)) return false;
751
- if (!Object.hasOwn(lines, LEGACY_TOOLS_LINE) || Object.hasOwn(lines, TOOLS_LINE)) return false;
752
- const chosen = lines[LEGACY_TOOLS_LINE];
778
+ if (Object.hasOwn(lines, TOOLS_LINE)) return false;
779
+ const previous = PREVIOUS_TOOLS_LINES.find((key) => Object.hasOwn(lines, key));
780
+ if (previous === undefined) return false;
781
+ const chosen = lines[previous];
753
782
  if (typeof chosen !== 'string' || chosen.trim().length === 0) return false;
754
783
  const others = { ...lines };
755
- delete others[LEGACY_TOOLS_LINE];
784
+ delete others[previous];
756
785
  bridge.set(BRIDGE_SELECTION_KEY, { ...stored, [BRIDGE_LINES_KEY]: { ...others, [TOOLS_LINE]: chosen } });
757
786
  return true;
758
787
  } catch {
@@ -767,7 +796,7 @@ let designDisposer = null;
767
796
  * Register the design on a bridge that can take one and hand back the idempotent disposer, or
768
797
  * `null` when the bridge is absent or older than `registerToolDesign`. Never throws.
769
798
  *
770
- * The shape is decided BEFORE anything is registered: one `Card tags` line on a bridge that can
799
+ * The shape is decided BEFORE anything is registered: one `Card activity` line on a bridge that can
771
800
  * take one, today's single `Card bash` design on anything older. The seed and the line-key carry-over
772
801
  * run BEFORE the registration too, because a 0.6.0 bridge inherits a joining tool's legacy per-tool
773
802
  * choice into the line's own value at REGISTRATION time — a choice written after would be missed, and a
@@ -52,6 +52,11 @@ const {
52
52
  // (lib/card-content.js): the process-wide slot gentle-pi publishes, read at paint
53
53
  // time. It is re-exported below so the callers of this module keep their imports.
54
54
  const { CARD_CONTENT, CARD_CONTENT_SLOT, cardContentLevel } = require('./card-content.js');
55
+ // S11 (modular-tools): this card is a DESIGN, so its switch is the `Card activity` line the
56
+ // activity design owns — the same reader the file cards and the jobs card ask, never a
57
+ // module switch of its own. It is asked on every paint and answered for this package's
58
+ // own design id, so `native` (and every other answer) hands the rows back untouched.
59
+ const { ACTIVITY_DESIGN_ID, bridgeApi } = require('./file-card-resolver.js');
55
60
  const {
56
61
  CODEGRAPH_MARK,
57
62
  CODEGRAPH_MCP_TOOL,
@@ -194,6 +199,27 @@ function isCodeGraphCardTool(toolName) {
194
199
  return toolName === CODEGRAPH_TOOL || toolName === CODEGRAPH_MCP_TOOL || toolName === CODEGRAPH_MCP_PREFIXED_TOOL;
195
200
  }
196
201
 
202
+ /**
203
+ * S11 (modular-tools): whether the activity design draws this call right now. The bridge's
204
+ * `Card activity` line is the card's ONLY switch, read through its published reader and never a
205
+ * store path: the answer must be a `design` carrying this package's activity id, so `native`,
206
+ * `not-covered`, `missing`, another plugin's design, an absent reader and a reader that throws
207
+ * all leave the chain's own drawing exactly as it resolved it. The line's claim on these
208
+ * tools is unscoped, so the question travels without a call's arguments.
209
+ */
210
+ function activityDesignDraws(tool, args) {
211
+ try {
212
+ const api = bridgeApi();
213
+ if (api === undefined || typeof api.resolveToolDesignSelection !== 'function') return false;
214
+ const answer = asObject(api.resolveToolDesignSelection(tool, args));
215
+ if (answer.kind !== 'design') return false;
216
+ const design = asObject(answer.design);
217
+ return typeof design.id === 'string' && design.id === ACTIVITY_DESIGN_ID;
218
+ } catch {
219
+ return false;
220
+ }
221
+ }
222
+
197
223
  // ---- the rows ----
198
224
 
199
225
  /**
@@ -475,6 +501,9 @@ function createCodegraphCardResolver(options) {
475
501
  // Every tool the card does not own goes back untouched: those rows are the
476
502
  // chain's, byte for byte, whatever this card would have drawn.
477
503
  if (!isCodeGraphCardTool(toolName) && toolName !== BASH_TOOL) return inherited;
504
+ // S11: the `Card activity` line decides. `activity` selected is the card; every other
505
+ // answer is the chain's own row, which is what Pi drew before this design existed.
506
+ if (!activityDesignDraws(toolName)) return inherited;
478
507
  // This card frames itself, so the host must not frame it too: the host wraps every tool whose definition does not say
479
508
  // `renderShell: 'self'` in its own filled box, and a card drawn inside that box is two designs at once.
480
509
  if (toolName === BASH_TOOL) {
@@ -498,6 +527,27 @@ function createCodegraphCardResolver(options) {
498
527
  }
499
528
  }
500
529
 
530
+ /**
531
+ * The extension's one-line wiring point, like `registerFileCard`: register through the host's
532
+ * hook when it has one, and report the outcome rather than throwing. It is NOT part of the
533
+ * `Codegraph+` module: the card paints a call, it does not run CodeGraph, so the switch that
534
+ * decides it is `Card activity` (`activity`), asked on every paint.
535
+ */
536
+ function registerCodegraphCard(pi, deps = {}) {
537
+ if (typeof pi?.registerToolRenderer !== 'function') return { registered: false, resolver: undefined };
538
+ try {
539
+ return createCodegraphCardResolver({
540
+ metrics: deps.metrics,
541
+ theme: deps.theme,
542
+ cwd: deps.cwd,
543
+ registerToolRenderer: (resolver) => pi.registerToolRenderer(resolver),
544
+ });
545
+ } catch {
546
+ // A host without a usable measurement seam draws its own row: the card is cosmetic.
547
+ return { registered: false, resolver: undefined };
548
+ }
549
+ }
550
+
501
551
  module.exports = {
502
552
  CARD_CONTENT,
503
553
  CARD_CONTENT_SLOT,
@@ -506,10 +556,12 @@ module.exports = {
506
556
  CODEGRAPH_MCP_TOOL,
507
557
  CODEGRAPH_TITLE_ROLE,
508
558
  CODEGRAPH_TOOL,
559
+ activityDesignDraws,
509
560
  cardContentLevel,
510
561
  codegraphCallRows,
511
562
  codegraphResultRows,
512
563
  codegraphShape,
513
564
  createCodegraphCardResolver,
514
565
  isCodeGraphCardTool,
566
+ registerCodegraphCard,
515
567
  };