Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1c1c5a7
feat(profiles): add /gentle:profiles card on|off visibility setting
cheranthony Nov 18, 2026
566add7
feat(profiles): add pure profile card renderer with wrap navigation
cheranthony Nov 18, 2026
75354b3
feat(shell): show the profile card in the sidebar rail
cheranthony Nov 18, 2026
218ee5f
feat(profiles): use the shown profile in this session from the card
cheranthony Nov 18, 2026
96c1075
fix(profiles): start the profile card on the profile in effect
cheranthony Nov 18, 2026
57c327b
feat(profiles): add Alt+, Alt+. and Alt+M profile card shortcuts
cheranthony Nov 18, 2026
3c73b03
fix(shell): give the profile card header hover and collapse
cheranthony Nov 18, 2026
4c6e77c
feat(profiles): add Ctrl+Shift+E to collapse the profile card
cheranthony Nov 18, 2026
e2f0745
Merge remote-tracking branch 'origin/main' into feat/profile-card
cheranthony Nov 25, 2026
d2e4501
fix(profiles): adapt profile card test helpers to Pi 1.6 readonly ren…
cheranthony Nov 25, 2026
5b51e2a
fix(profiles): confirm the card use action, start and reset on the se…
cheranthony Nov 25, 2026
d3501a2
docs(odd): record the PR review round in the profile-card feature log
cheranthony Nov 25, 2026
76bda80
fix(profiles): expand a collapsed profile card at the session boundar…
cheranthony Nov 25, 2026
c176ddb
docs(odd): record the second review round in the profile-card feature…
cheranthony Nov 25, 2026
cd46601
Merge remote-tracking branch 'origin/main' into feat/profile-card
cheranthony Nov 25, 2026
c234bd6
docs(odd): record the second upstream integration in the profile-card…
cheranthony Nov 25, 2026
0cacadb
fix(profiles): exclude failed session profile records from the card's…
cheranthony Nov 25, 2026
3d26641
docs(odd): record the finding-5 fix decision in the profile-card log
cheranthony Nov 25, 2026
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
4 changes: 4 additions & 0 deletions docs/gentle-shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ The [v2.6.0 release](https://github.com/Gentleman-Programming/gentle-pi/releases
- Fullscreen pointer navigation and the responsive sidebar keep changes, agents, and TODO usable at changing terminal widths; cached frames avoid redrawing inactive sidebar content while live status still updates.
- The Agents List and Details views preserve the orchestrator/session hierarchy and completion, abort, and lost-exit history. Parent-child queries and notifications have an explicit handoff path, while model, effort, and usage stay observable per task.
- Named `/gentle:profiles` atomically route the orchestrator separately from packaged and review roles, and carry a per-profile orchestrator workflow mode (`w` on the models screen: organic, where the orchestrator may implement inline, or full delegation, where every implementation goes to a subagent); see the [technical reference](readme-reference.md#agent-model-profiles) for the profile model. Full delegation pays off with an expensive orchestrator and light workers; on small tasks it costs a few times the wall time of organic, so see [Orchestrator workflow mode](readme-reference.md#orchestrator-workflow-mode) for the measured cost and which mode to pick. A profile can also turn on [Controlled Engineering](readme-reference.md#controlled-engineering) (`c` on the models screen, off by default), which adds authoring rules against unrequested machinery to the sessions that write or verify code.
- `/gentle:profiles card on|off` shows or hides the sidebar profile card. It is hidden by default, the choice is persisted globally (`~/.pi/gentle-ai/profile-card.json`), and it takes effect live without `/reload`; any other argument prints the usage and changes nothing.
- The card's `✓ Use in session` action asks for confirmation before it binds anything: declining leaves the session profile, the live model and the thinking level untouched, and a profile apply already running says so without asking. It binds the shown profile to this session only (never the shared defaults) under the same single-apply gate `/gentle:profiles` uses.
- The profile card has three shortcuts: `alt+,` shows the previous profile, `alt+.` the next one (both wrap around, like the card's `◀` / `▶` arrows) and `alt+m` uses the shown profile in this session, exactly like clicking the card's use action (same confirmation, same single-apply gate). `GENTLE_PI_PROFILE_CARD_PREVIOUS_KEY`, `GENTLE_PI_PROFILE_CARD_NEXT_KEY` and `GENTLE_PI_PROFILE_CARD_USE_KEY` rebind them (`off` or empty leaves one unbound), and `/gentle:customize` → Keymaps can reassign them; a saved change applies after `/reload`. While the card is hidden they change nothing and show one notice naming `/gentle:profiles card on`; with no saved profiles the notice names `/gentle:profiles`.
- `ctrl+shift+e` collapses or expands the profile card to its header, toggling the same in-memory state as clicking its title (like `ctrl+shift+a`, `ctrl+shift+j` and `ctrl+shift+t` for the agents, jobs and todo cards). `GENTLE_PI_PROFILE_CARD_COLLAPSE_KEY` rebinds it (`off` or empty leaves it unbound), `/gentle:customize` → Keymaps can reassign it, and a saved change applies after `/reload`. While the card is hidden it changes nothing and shows one notice naming `/gentle:profiles card on`.

The source checkout declares `gentle-pi` `5.0.0` with a package-local Gentle AI `v5.0.0` pin; the source manifest does not establish whether that version is published. The mirror uses the signed provider bundle published with v5.0.0. Its bundle version stays `1.6.0`, and the native review CLI still advertises `capabilities/v2.6` without legacy authority.

Expand Down
7 changes: 5 additions & 2 deletions docs/readme-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ Synthetic tests prove the observer's behavior, not the cause of issue #213. A ne
```text
/gentle:status Check package assets and global model config.
/gentle:doctor Run read-only diagnostics for assets, config, tools, guards, and Herdr setup.
/gentle:profiles Open the models screen on this repository's profile. Subcommands: export <name>, import, publish <name>, export-routing, restore-routing, clear.
/gentle:profiles Open the models screen on this repository's profile. Subcommands: export <name>, import, publish <name>, export-routing, restore-routing, clear, card on|off.
/gentle:persona Switch between gentleman and neutral persona modes.
/gentle:background-subagents Show or set the managed background-subagents policy, with its deciding source.
/gentle:rdd Open the interactive RDD selector for this repository or an explicit machine-wide choice.
Expand Down Expand Up @@ -1205,6 +1205,9 @@ The file operations are subcommands:
| ------------------------------------ | ------ |
| `/gentle:profiles export <name>` | Export a profile to `~/.pi/gentle-ai/profiles.export.json`. |
| `/gentle:profiles import` | Import the profile in `~/.pi/gentle-ai/profiles.export.json`, asking before it replaces one with the same name. |
| `/gentle:profiles card on\|off` | Show or hide the sidebar profile card. Hidden by default, persisted globally in `~/.pi/gentle-ai/profile-card.json`, and applied live without `/reload`. Any other argument prints the usage and changes nothing. |
| `alt+,` / `alt+.` / `alt+m` | Profile card shortcuts: previous profile, next profile (both wrap), and use the shown profile in this session (the same action as the card's use click, so it asks for the same confirmation first). Rebind with `GENTLE_PI_PROFILE_CARD_PREVIOUS_KEY`, `GENTLE_PI_PROFILE_CARD_NEXT_KEY` and `GENTLE_PI_PROFILE_CARD_USE_KEY` (`off` or empty disables one). Hidden card or no saved profiles: no change and one notice naming `/gentle:profiles card on` or `/gentle:profiles`. |
| `ctrl+shift+e` | Collapse or expand the profile card (the same in-memory state as clicking its title, like `ctrl+shift+a` / `ctrl+shift+j` / `ctrl+shift+t` for agents, jobs and todo). Rebind with `GENTLE_PI_PROFILE_CARD_COLLAPSE_KEY` (`off` or empty disables it). Hidden card: no change and one notice naming `/gentle:profiles card on`. |
| `/gentle:profiles publish <name>` | Publish the shared repository declaration at `<worktree-root>/.pi/gentle-ai/profile.json` so the whole team starts from that profile; run it again to remove the declaration. |

The binding made by **Use in this session** writes no shared routing: not `models.json`, Pi's global `settings.json`, agent frontmatter, `subagents.json`, or repository pins. When the table has unsaved edits, they are saved to the profile in `profiles.json` first, exactly as **Save** would, and the screen says so; with no pending edits nothing is written at all. Other open sessions keep their own bindings and live orchestrators. The session binding overrides pins and global routing as a complete snapshot, including reviewer routing; omitted roles do not fall back to another profile. The selection is appended to the session file as its own record, so start, resume, reload, fork and tree navigation restore it from the current branch without selecting it again. Re-selecting re-copies the profile definition from `profiles.json`; later edits to `subagents.json` or agent frontmatter never reach a bound session, in that session or through a re-selection.
Expand Down Expand Up @@ -1422,7 +1425,7 @@ The notice appears once per distinct change: further launches stay quiet until t
| -------------------------------- | ------------------------------------------------------------------- |
| `/gentle:status` | Shows package assets and global model config status. |
| `/gentle:doctor` | Runs read-only diagnostics for assets, model/persona config, memory tools, safety guards, and (inside Herdr) the task-summary sidebar setup. |
| `/gentle:profiles` | Opens the models screen on this repository's profile. `export <name>`, `import`, and `publish <name>` handle profile files and the repository declaration; `export-routing` and `restore-routing` move the saved global routing through `models.export.json`. |
| `/gentle:profiles` | Opens the models screen on this repository's profile. `export <name>`, `import`, and `publish <name>` handle profile files and the repository declaration; `export-routing` and `restore-routing` move the saved global routing through `models.export.json`; `card on\|off` shows or hides the sidebar profile card (hidden by default, persisted globally, live). |
| `/gentle:commands` | Opens the command palette (default `alt+k`): a curated, grouped menu (Configuration, Session, Diagnostics, Skills) of registered Gentle commands; search and run by label. |
| `/gentle:persona` | Switches global persona mode, with project override support. |
| `/gentle:background-subagents` | Shows or sets the managed background-subagents policy (`status\|enable\|disable`), naming the source that decided it. |
Expand Down
104 changes: 101 additions & 3 deletions extensions/gentle-ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import { ReviewContinuationRegistry, type RetainedReviewContinuation, type Retai
import { boundedFindingClaims, parseReviewCoordinatorInput, runReviewCoordinator } from "../lib/review-coordinator.ts";
import { StatusTimingDiagnostics } from "../lib/status-timing-diagnostics.ts";
import { isOddPhase, oddPhaseRegistry, ODD_PHASES } from "../lib/odd-phase.ts";
import { PROFILE_CARD_SETTINGS_CHANGED, writeProfileCard } from "../lib/profile-card-policy.ts";
import { loadKeymaps } from "../lib/keymaps.ts";
import { createProfileCardOwner, createProfileCardReader, createProfileCardUseHandler, mountProfileCard, PROFILE_CARD_USE_CONFIRM_TITLE, profileCardUseConfirmMessage, registerProfileCardShortcuts } from "../lib/profile-card-sidebar.ts";
import { shellEnabled } from "../lib/shell-bar.ts";
import { resolveSessionWorktree, SessionWorktreeRegistry, toolWorktreePath } from "../lib/session-worktree-registry.ts";
import { canonicalizeTarget, clearPathConsentSkills, isIndexedSkillTarget, isTempTarget, isWithinPath, setPathConsentSkills } from "../lib/path-consent-fence.ts";
Expand Down Expand Up @@ -3702,6 +3705,31 @@ function sessionProfileAuthorityAvailable(ctx: ExtensionContext): boolean {
return readSessionProfileAuthority(manager).available;
}

/**
* The card's use action: asks the user to confirm, then runs the owner's "Use in
* this session" with the real session context so its binding notices appear. The
* confirmation lives on this path and not in the shared action: the
* `/gentle:profiles` `use-session` branch applies without asking (a maintainer
* follow-up), while the card must bind nothing and move no live model or
* thinking level until the user approves. Declining changes nothing; a busy
* apply gate never prompts. Reads the store (never seeds or writes it) and runs
* only for a profile that still exists.
*/
async function useProfileFromCard(ctx: ExtensionContext, live: LiveSession, name: string): Promise<void> {
const path = profilesFilePath(gentleAiConfigHome());
const read = readProfilesFileResult(path);
if (read.status !== "valid") {
ctx.ui.notify(`el Gentleman cannot use profile "${name}": ${path} is missing or invalid. Run /gentle:profiles.`, "warning");
return;
}
if (!hasOwnProfile(read.file.profiles, name)) {
ctx.ui.notify(`el Gentleman cannot use profile "${name}": it is no longer in profiles.json.`, "warning");
return;
}
const config = normalizeModelConfig(read.file.profiles[name]) ?? {};
await runProfilesPanelAction(ctx, live, path, read.file, { type: "use-session", name, config });
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}

/** The routing this session's launches use: its profile, or the global effective routing. */
async function readSessionLaunchModelConfigAsync(ctx: ExtensionContext, authorityAvailable: boolean): Promise<AgentModelConfig> {
return sessionLaunchProfile(ctx, authorityAvailable)?.modelProfiles
Expand Down Expand Up @@ -7102,7 +7130,7 @@ async function runProfilesPanelAction(
}

/** `/gentle:profiles`: seed or open the store, then loop the panel over one action at a time until it closes. */
const PROFILES_COMMAND_USAGE = "Usage: /gentle:profiles [export <name> | import | publish <name> | export-routing | restore-routing | clear]";
const PROFILES_COMMAND_USAGE = "Usage: /gentle:profiles [export <name> | import | publish <name> | export-routing | restore-routing | clear | card on|off]";

/**
* `/gentle:profiles` opens the models screen. File operations live in
Expand All @@ -7111,7 +7139,8 @@ const PROFILES_COMMAND_USAGE = "Usage: /gentle:profiles [export <name> | import
* profile through `profiles.export.json`, `publish <name>` toggles the
* committed repository declaration, and `export-routing` / `restore-routing`
* move the saved global routing (models.json, not a profile) through
* `models.export.json`. The routing verbs carry their own names so a profile
* `models.export.json`. `card on|off` shows or hides the sidebar profile card
* (a global flag, hidden by default, live). The routing verbs carry their own names so a profile
* can never be mistaken for them.
*/
async function handleProfilesCommand(ctx: ExtensionContext, live: LiveSession, args = ""): Promise<void> {
Expand All @@ -7120,6 +7149,25 @@ async function handleProfilesCommand(ctx: ExtensionContext, live: LiveSession, a
await openModelsScreen(ctx, live);
return;
}
if (verb === "card") {
const choice = rest.length === 1 ? rest[0] : undefined;
if (choice !== "on" && choice !== "off") {
ctx.ui.notify(PROFILES_COMMAND_USAGE, "warning");
return;
}
try {
writeProfileCard(choice === "on");
} catch (error) {
ctx.ui.notify(`Could not save the profile card setting: ${profilesErrorMessage(error)}`, "warning");
return;
}
live.events?.emit(PROFILE_CARD_SETTINGS_CHANGED, { visible: choice === "on" });
ctx.ui.notify(
choice === "on" ? "Profile card shown. Turn it off with /gentle:profiles card off." : "Profile card hidden. Turn it on with /gentle:profiles card on.",
"info",
);
return;
}
if (verb === "export-routing" || verb === "restore-routing" || verb === "clear") {
if (rest.length > 0) {
ctx.ui.notify(PROFILES_COMMAND_USAGE, "warning");
Expand Down Expand Up @@ -12466,6 +12514,36 @@ function createGentleAiExtensionForTesting(
const statusTiming = new StatusTimingDiagnostics();
const reviewSidebar = createReviewSidebarPublisher(pi);
const sessionProfiles = createSessionProfileIntegration();
// The sidebar profile card: one owner holds the card state (visibility, shown
// profile) so the use action and keyboard shortcuts act on the same selection.
let profileCardCtx: ExtensionContext | undefined;
let stopProfileCardEvents: (() => void) | undefined;
const profileCardReader = createProfileCardReader();
const profileCard = createProfileCardOwner({
loadItems: () => {
if (!profileCardCtx) throw new Error("no session");
return profileCardReader.items({ configHome: gentleAiConfigHome(), sessionId: profileCardCtx.sessionManager?.getSessionId?.(), cwd: profileCardCtx.cwd, ...(typeof profileCardCtx.sessionManager?.getBranch === "function" ? { session: profileCardCtx.sessionManager } : {}) });
},
});
profileCard.setUseHandler(createProfileCardUseHandler({
begin: beginDesktopProfileApply,
end: endDesktopProfileApply,
notify: (message, level) => { profileCardCtx?.ui.notify(message, level); },
// /gentle:profiles `use-session` applies without asking; the card binds nothing
// before the user approves. An unanswerable dialog is never an approval.
confirm: async (name) => {
const current = profileCardCtx;
if (!current) return false;
try { return (await current.ui.confirm(PROFILE_CARD_USE_CONFIRM_TITLE, profileCardUseConfirmMessage(name))) === true; }
catch { return false; }
},
run: async (name) => {
if (!profileCardCtx) throw new Error("no active session");
await useProfileFromCard(profileCardCtx, pi, name);
},
// A use just changed the session record: drop what the reader cached so the markers re-read.
refresh: () => { profileCardReader.invalidate(); profileCard.refreshItems(); },
}));
pi.on("session_before_fork", async (event, ctx) => {
await waitCurrentSessionProfileSelection(ctx.sessionManager);
sessionProfiles.beforeFork(ctx.sessionManager, { entryId: event.entryId, position: event.position });
Expand Down Expand Up @@ -12519,6 +12597,9 @@ function createGentleAiExtensionForTesting(
statusTiming.reset();
reminderSessionActive = false;
reminderEpoch += 1;
stopProfileCardEvents?.();
stopProfileCardEvents = undefined;
profileCardCtx = undefined;
activeRddContext = undefined;
unbindPreparation?.();
unbindPreparation = undefined;
Expand Down Expand Up @@ -13013,6 +13094,12 @@ function createGentleAiExtensionForTesting(
});
}

// Pi reads extension shortcuts at startup and /reload; the keys resolve like every Gentle keymap.
{
const keymapEnv = dependencies.processEnv ?? process.env;
registerProfileCardShortcuts(pi, profileCard, keymapEnv, loadKeymaps(keymapEnv).bindings);
}

pi.on("session_start", async (event, ctx) => {
const startupEpoch = reminderEpoch;
const profileSessionId = ctx.sessionManager?.getSessionId?.();
Expand Down Expand Up @@ -13057,6 +13144,17 @@ function createGentleAiExtensionForTesting(
}
}
readSessionProfileAuthority(ctx.sessionManager);
// The card's first read comes after this session recorded its startup profile
// and published it as the session profile, so the card starts on the profile in
// effect for this session (S2/T4b), not on the store's active one. A session
// boundary resets a card that stayed visible across a session replacement.
// The card re-reads its visibility store on the settings event (the payload is not trusted).
profileCardCtx = ctx;
stopProfileCardEvents?.();
stopProfileCardEvents = pi.events?.on?.(PROFILE_CARD_SETTINGS_CHANGED, () => profileCard.refreshVisibility());
profileCard.refreshVisibility();
profileCard.resetForSession();
if (ctx.hasUI && typeof ctx.ui.setWidget === "function") ctx.ui.setWidget("gentle-profile-card", (tui, theme) => mountProfileCard(tui, theme, profileCard));
if (ctx.hasUI) notifySessionProfileProblem(ctx);
auto.reset();
yolo.reset(ctx);
Expand Down Expand Up @@ -13633,7 +13731,7 @@ function createGentleAiExtensionForTesting(
}

pi.registerCommand("gentle:profiles", {
description: "Open the models screen (profiles as tabs). Subcommands: export <name>, import, publish <name>, export-routing, restore-routing, clear.",
description: "Open the models screen (profiles as tabs). Subcommands: export <name>, import, publish <name>, export-routing, restore-routing, clear, card on|off.",
handler: async (args, ctx) => {
await handleProfilesCommand(ctx, pi, typeof args === "string" ? args : "");
},
Expand Down
4 changes: 4 additions & 0 deletions lib/keymaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export const KEYMAP_ACTIONS: readonly KeymapAction[] = [
{ id: "jobs.collapse", label: "Collapse the jobs card", env: "GENTLE_PI_JOBS_KEY", defaultKey: "ctrl+shift+j" },
{ id: "todo.collapse", label: "Collapse the todo list", env: "GENTLE_PI_TODO_KEY", defaultKey: "ctrl+shift+t" },
{ id: "stats.view", label: "Usage stats", env: "GENTLE_PI_STATS_VIEW_KEY", command: "gentle:stats" },
{ id: "profileCard.previous", label: "Previous profile (profile card)", env: "GENTLE_PI_PROFILE_CARD_PREVIOUS_KEY", defaultKey: "alt+," },
{ id: "profileCard.next", label: "Next profile (profile card)", env: "GENTLE_PI_PROFILE_CARD_NEXT_KEY", defaultKey: "alt+." },
{ id: "profileCard.use", label: "Use the shown profile in this session (profile card)", env: "GENTLE_PI_PROFILE_CARD_USE_KEY", defaultKey: "alt+m" },
{ id: "profileCard.collapse", label: "Collapse the profile card", env: "GENTLE_PI_PROFILE_CARD_COLLAPSE_KEY", defaultKey: "ctrl+shift+e" },
];

// Pi refuses extension shortcuts on these editor-global keybindings
Expand Down
Loading