From 58b49d9247098dde644375aa44bbf1a592908e39 Mon Sep 17 00:00:00 2001 From: Salvo Date: Sun, 22 Mar 2026 16:44:31 +0100 Subject: [PATCH] chore: handle lightweight vs full plugin in shell file generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Distinguish between lightweight (rosetta@rosetta) and full (core@rosetta, grid@rosetta) plugins when deciding whether to generate shell files in Phase 2 of init-workspace-flow. Full plugins ship all instructions bundled so shells are not needed; lightweight plugins require shells to enable skills, agents, and workflows. When plugin type cannot be detected, ask the user with an explanation and suggest lightweight (the recommended install) as the default. Also fixes inconsistent sentinel phrase used for plugin mode detection ("Rosetta plugin is already active" → "RUNNING AS A PLUGIN"). Co-Authored-By: Claude Sonnet 4.6 --- .../core/skills/init-workspace-context/SKILL.md | 15 ++++++++++----- .../core/workflows/init-workspace-flow-context.md | 5 +++-- .../core/workflows/init-workspace-flow-shells.md | 11 ++++++++--- .../r2/core/workflows/init-workspace-flow.md | 10 +++++++++- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/instructions/r2/core/skills/init-workspace-context/SKILL.md b/instructions/r2/core/skills/init-workspace-context/SKILL.md index afe7468..df271f6 100644 --- a/instructions/r2/core/skills/init-workspace-context/SKILL.md +++ b/instructions/r2/core/skills/init-workspace-context/SKILL.md @@ -18,16 +18,21 @@ Initialization must behave differently for fresh, existing, or plugin workspaces - Rosetta prep steps completed -- Three modes: install (no files per `bootstrap_rosetta_files`), upgrade (some files per `bootstrap_rosetta_files` exist), plugin (LLM context contains "Rosetta plugin is already active") +- Three modes: install (no files per `bootstrap_rosetta_files`), upgrade (some files per `bootstrap_rosetta_files` exist), plugin (LLM context contains "RUNNING AS A PLUGIN") +- Two plugin types: full (core@rosetta or grid@rosetta — all instructions bundled, no shells needed), lightweight (rosetta@rosetta — bootstrap + MCP only, shells required) -1. Check LLM context for "Rosetta plugin is already active" — if found, set mode = plugin +1. Check LLM context for "RUNNING AS A PLUGIN" — if found, set mode = plugin 2. If not plugin, scan workspace for existing files per `bootstrap_rosetta_files` 3. Any found → mode = upgrade; none → mode = install -4. Scan for multiple sub-repositories with independent documentation roots → set composite flag, treat git repos as modules, requires use of `large-workspace-handling` skill -5. Build file inventory: path and status for each file per `bootstrap_rosetta_files` -6. Return: mode (install|upgrade|plugin), plugin_active, composite, existing_files list +4. If mode = plugin, detect plugin_type: + - Context contains "core@rosetta" or "grid@rosetta" → plugin_type = full + - Context contains "rosetta@rosetta" → plugin_type = lightweight + - Neither found → plugin_type = unknown +5. Scan for multiple sub-repositories with independent documentation roots → set composite flag, treat git repos as modules, requires use of `large-workspace-handling` skill +6. Build file inventory: path and status for each file per `bootstrap_rosetta_files` +7. Return: mode (install|upgrade|plugin), plugin_active, plugin_type (full|lightweight|unknown|null), composite, existing_files list diff --git a/instructions/r2/core/workflows/init-workspace-flow-context.md b/instructions/r2/core/workflows/init-workspace-flow-context.md index 2d6480e..7408644 100644 --- a/instructions/r2/core/workflows/init-workspace-flow-context.md +++ b/instructions/r2/core/workflows/init-workspace-flow-context.md @@ -14,7 +14,7 @@ Determines workspace state before any changes occur. Without accurate mode detec - Phase 1 of 8 in init-workspace-flow - Input: filesystem, LLM context (bootstrap markers) -- Output: state.mode, state.plugin_active, state.composite, state.existing_files +- Output: state.mode, state.plugin_active, state.plugin_type, state.composite, state.existing_files - Prerequisite: state file created by workflow orchestrator (empty template) @@ -45,10 +45,11 @@ Determines workspace state before any changes occur. Without accurate mode detec - State file contains non-empty `mode` field - `composite` flag is explicitly set (not left blank) - Every file per `bootstrap_rosetta_files` has a status entry in the inventory +- If mode = plugin: `plugin_type` is set to full, lightweight, or unknown (never null) -- Plugin mode is a context-sentence check, not filesystem detection +- Plugin mode is a context-sentence check for "RUNNING AS A PLUGIN", not filesystem detection - Do not assume install if state file is fresh — files may exist on disk - Composite requires sub-repository docs, not just multiple directories diff --git a/instructions/r2/core/workflows/init-workspace-flow-shells.md b/instructions/r2/core/workflows/init-workspace-flow-shells.md index c0d2bec..03caa51 100644 --- a/instructions/r2/core/workflows/init-workspace-flow-shells.md +++ b/instructions/r2/core/workflows/init-workspace-flow-shells.md @@ -13,7 +13,7 @@ Generates shell config files so subsequent sessions can load context and invoke - Phase 2 of 8 in init-workspace-flow -- Input: state.mode, state.plugin_active +- Input: state.mode, state.plugin_active, state.plugin_type - Output: shell configs, bootstrap rule, load-context shell - Prerequisite: Phase 1 complete, state.mode set @@ -26,7 +26,10 @@ Generates shell config files so subsequent sessions can load context and invoke 1. Read `agents/init-workspace-flow-state.md` -2. If `state.plugin_active == true`: mark Phase 2 skipped, proceed to Phase 3 +2. If `state.plugin_active == true`: + - If `state.plugin_type == full`: mark Phase 2 skipped (full plugin ships all instructions, no shells needed), proceed to Phase 3 + - If `state.plugin_type == lightweight`: continue to step 2.2 (shells required for lightweight plugin to function) + - If `state.plugin_type == unknown`: halt — orchestrator must resolve via HITL before Phase 2 can proceed 3. If upgrade mode: check which shells already exist @@ -45,7 +48,9 @@ Generates shell config files so subsequent sessions can load context and invoke -- Plugin mode: phase marked skipped, no shell files modified +- Full plugin mode: phase marked skipped, no shell files modified +- Lightweight plugin mode: shell generation executed, all expected shell files exist on disk +- Unknown plugin mode: phase halted, HITL question issued, no files written until resolved - Install mode: all expected shell files exist on disk - Upgrade mode: only missing shells created, existing preserved - Bootstrap rule file exists with ACQUIRE instruction for load-context diff --git a/instructions/r2/core/workflows/init-workspace-flow.md b/instructions/r2/core/workflows/init-workspace-flow.md index 9e73cba..a2211ee 100644 --- a/instructions/r2/core/workflows/init-workspace-flow.md +++ b/instructions/r2/core/workflows/init-workspace-flow.md @@ -26,9 +26,17 @@ Validation: State file tracks every phase with file inventory; verification conf - IF state.file_count >= 50 (set by Phase 3): pass "ACQUIRE `large-workspace-handling/SKILL.md` FROM KB" to Phase 5, 6, 8 subagents. - Before Phase 1: create `agents/init-workspace-flow-state.md`. - Conditional phases: - - If you have already in context "RUNNING AS A PLUGIN": MUST NOT EXECUTE "shells" phase 2 AND "rules" phase 4 + - If you have already in context "RUNNING AS A PLUGIN": + - If plugin_type = full (core@rosetta or grid@rosetta): MUST NOT EXECUTE "shells" phase 2 AND "rules" phase 4 + - If plugin_type = lightweight (rosetta@rosetta): MUST EXECUTE "shells" phase 2, MUST NOT EXECUTE "rules" phase 4 + - If plugin_type = unknown: MUST ASK USER before Phase 2 using the HITL question below, then apply the matched branch above - Else if user explicitly requested to HAVE ALL RULES LOCALLY: MUST NOT EXECUTE "shells" phase 2, BUT MUST EXECUTE "rules" phase 4 - Else MUST EXECUTE "shells" phase 2, BUT MUST NOT EXECUTE "rules" phase 4 +- HITL question when plugin_type = unknown: + "Rosetta detected that you're running with a plugin, but couldn't determine which type. This affects whether shell files need to be created. + - **Full plugin** (`core@rosetta` or `grid@rosetta`): ships all built-in skills, agents, and workflows — shell files are NOT needed. + - **Lightweight plugin** (`rosetta@rosetta`): includes only the bootstrap rule and MCP connection — shell files ARE required to enable skills, agents, and workflows in your IDE. + Which plugin did you install? If you followed the standard Rosetta installation (lightweight, recommended), the suggested answer is **lightweight plugin** (`rosetta@rosetta`) — shell files will be created." - If user says to initialize rules, subagents, agents, workflows, commands it still means to execute "shells" phase 2. - Upgrade from R1 to R2 is exactly the same process as define here, but you already have some files available, which you can reuse. - Additionally tell subagents: "If you want to use shell commands, prefer to combine individual shell commands into single **simple** shell script in `agents/TEMP` and execute it, but already available tools ALWAYS take precedence."