Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 10 additions & 5 deletions instructions/r2/core/skills/init-workspace-context/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@ Initialization must behave differently for fresh, existing, or plugin workspaces

<core_concepts>
- 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)
</core_concepts>

<process>
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
</process>

</init_workspace_context>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Determines workspace state before any changes occur. Without accurate mode detec
<workflow_context>
- 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)
</workflow_context>

Expand Down Expand Up @@ -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)
</validation_checklist>

<pitfalls>
- 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
</pitfalls>
Expand Down
11 changes: 8 additions & 3 deletions instructions/r2/core/workflows/init-workspace-flow-shells.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Generates shell config files so subsequent sessions can load context and invoke

<workflow_context>
- 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
</workflow_context>
Expand All @@ -26,7 +26,10 @@ Generates shell config files so subsequent sessions can load context and invoke

<check_mode step="2.1">
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
</check_mode>

Expand All @@ -45,7 +48,9 @@ Generates shell config files so subsequent sessions can load context and invoke
</update_state>

<validation_checklist>
- 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
Expand Down
10 changes: 9 additions & 1 deletion instructions/r2/core/workflows/init-workspace-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scappuccino-grid Why do we need further?

- 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."
Expand Down