Skip to content

Commit a9fed25

Browse files
jwaldripclaude
andcommitted
feat(plugin): improve cowork mode with CLAUDE_CODE_IS_COWORK detection and Explore subagents
Detect cowork mode via CLAUDE_CODE_IS_COWORK env var instead of just checking for git repo presence. Add local folder option for devs who already have the repo cloned, with clone-from-URL fallback for product folk. Support gh/glab auth and home dir credential passthrough for private repos. Delegate all codebase exploration to Explore subagents to keep the main elaboration context focused on user conversation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8931968 commit a9fed25

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

plugin/skills/elaborate/SKILL.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,43 @@ Then you'll write these as files in `.ai-dlc/{intent-slug}/` for the constructio
5757

5858
Before any elaboration, verify the working environment:
5959

60-
1. Check if you are in a git repository: `git rev-parse --git-dir`
61-
2. If **yes**: proceed to Phase 0 (Existing Intent Check) below.
62-
3. If **no** (cowork mode):
63-
a. **Get the repo URL** — Ask the user: "What repository should this work target?" If VCS MCP tools are available (e.g., GitHub MCP), offer discovered repos as options.
64-
b. **Clone immediately**: `git clone <url> /tmp/ai-dlc-workspace-<slug>/`
65-
c. **Enter the clone**: `cd /tmp/ai-dlc-workspace-<slug>/`
66-
d. **Proceed normally** — The clone has `.ai-dlc/settings.yml`, providers config, and all project context. No special cowork paths needed from this point forward.
60+
1. **Detect cowork mode**: Check `$CLAUDE_CODE_IS_COWORK` environment variable.
61+
```bash
62+
IS_COWORK="${CLAUDE_CODE_IS_COWORK:-}"
63+
IN_REPO=$(git rev-parse --git-dir 2>/dev/null && echo "true" || echo "false")
64+
```
65+
2. If **not cowork** (`IS_COWORK` is empty) **and in a repo** (`IN_REPO` is `true`): proceed to Phase 0 (Existing Intent Check) below.
66+
3. If **cowork** (`IS_COWORK=1`) **or not in a repo**:
67+
a. **Ask how to access the project**:
68+
```json
69+
{
70+
"questions": [{
71+
"question": "How would you like to connect to the project repository?",
72+
"header": "Repo access",
73+
"options": [
74+
{"label": "Local folder", "description": "I have the repo cloned on this machine already — I'll provide the path"},
75+
{"label": "Clone from URL", "description": "Clone the repository from a remote URL (GitHub, GitLab, etc.)"}
76+
],
77+
"multiSelect": false
78+
}]
79+
}
80+
```
81+
b. **If local folder**:
82+
- Ask the user: "What's the path to the project?" (free text input via "Other" or they can type it directly).
83+
- Verify it's a git repo: `git -C <path> rev-parse --git-dir 2>/dev/null`
84+
- If valid: `cd <path>` and proceed normally.
85+
- If not a valid git repo: tell the user and re-ask.
86+
c. **If clone from URL**:
87+
- Ask the user: "What repository should this work target?" If VCS MCP tools are available (e.g., GitHub MCP), offer discovered repos as options.
88+
- Clone directly — the user's home directory credentials (SSH keys, git credential helpers, `gh`/`glab` auth) are typically available:
89+
```bash
90+
WORKSPACE="/tmp/ai-dlc-workspace-<slug>"
91+
git clone <url> "$WORKSPACE" 2>&1
92+
```
93+
- **If clone fails** (authentication error, permission denied) — tell the user the clone failed and show the error output. Ask them to ensure their git credentials are configured (e.g., SSH keys in `~/.ssh`, `gh auth login`, `glab auth login`, or a git credential helper) and to grant the cowork session access to their home directory if they haven't already. Then retry once.
94+
- If it still fails, surface the error clearly and let the user troubleshoot. Do not loop.
95+
- **Enter the clone**: `cd "$WORKSPACE"`
96+
d. **Proceed normally** — from this point the working directory is a git repo with `.ai-dlc/settings.yml`, providers config, and all project context. No special cowork paths needed.
6797

6898
**Key principle:** Cloning the repo eliminates the cowork problem surface. Once cloned, all hooks, config loading, and provider discovery work identically to being in a real repo.
6999

@@ -165,7 +195,7 @@ Based on what the user described in Phase 2, identify every relevant technical s
165195

166196
1. **APIs and Schemas**: If the intent involves an API, query it. Run introspection queries. Read the actual schema. Map every type, field, query, mutation, and subscription. Don't guess what data is available — verify it.
167197

168-
2. **Existing Codebases**: If the intent builds on or integrates with existing code, read it. Use `Glob` and `Grep` to find relevant files. Read source code, not just file names. Understand existing patterns, conventions, and architecture.
198+
2. **Existing Codebases**: If the intent builds on or integrates with existing code, explore it via Explore subagents. Have them find relevant files, read source code, and report back on existing patterns, conventions, and architecture.
169199

170200
3. **Data Sources**: If the intent involves data, understand where it lives. Query for real sample data. Understand what fields are populated, what's empty, what's missing. Identify gaps between what's available and what's needed.
171201

@@ -205,11 +235,9 @@ Task({
205235

206236
3. **Web research for external context**: Use `WebSearch` for library docs, design patterns, API references, prior art. Use `WebFetch` to read specific documentation pages.
207237

208-
4. **Direct exploration**: Use `Read`, `Glob`, `Grep`, and `Bash` (for curl, CLI tools, introspection queries) directly when you know what you're looking for.
209-
210238
**Spawn multiple research paths in parallel.** Don't serialize explorations that are independent — launch all of them at once and synthesize when results return.
211239

212-
If a VCS MCP is available (e.g., GitHub MCP), use it for code browsing alongside or instead of local `Glob`/`Grep`.
240+
If a VCS MCP is available (e.g., GitHub MCP), use it for code browsing alongside or instead of local file tools.
213241

214242
### Communicate Findings as You Go
215243

0 commit comments

Comments
 (0)