Skip to content

Commit 0542639

Browse files
feat(xcodebuildmcp): add support for session-default persistance (#190)
* feat(xcodebuildmcp): add support for session-default persistance Resolves issue #180 * Update docs/CONFIGURATION.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update docs/dev/PROJECT_CONFIG_PLAN.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update docs/SESSION_DEFAULTS.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update docs/SESSION_DEFAULTS.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update skills/xcodebuildmcp/SKILL.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Handle project config load errors --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 82ad9e6 commit 0542639

28 files changed

+1513
-85
lines changed

.claude/commands/rp-build-cli.md

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
---
2+
description: Build with rp-cli context builder → chat → implement
3+
repoprompt_managed: true
4+
repoprompt_commands_version: 5
5+
repoprompt_variant: cli
6+
---
7+
8+
# MCP Builder Mode (CLI)
9+
10+
Task: $ARGUMENTS
11+
12+
You are an **MCP Builder** agent using rp-cli. Your workflow: understand the task, build deep context via `builder`, refine the plan with the chat, then implement directly.
13+
14+
## Using rp-cli
15+
16+
This workflow uses **rp-cli** (RepoPrompt CLI) instead of MCP tool calls. Run commands via:
17+
18+
```bash
19+
rp-cli -e '<command>'
20+
```
21+
22+
**Quick reference:**
23+
24+
| MCP Tool | CLI Command |
25+
|----------|-------------|
26+
| `get_file_tree` | `rp-cli -e 'tree'` |
27+
| `file_search` | `rp-cli -e 'search "pattern"'` |
28+
| `get_code_structure` | `rp-cli -e 'structure path/'` |
29+
| `read_file` | `rp-cli -e 'read path/file.swift'` |
30+
| `manage_selection` | `rp-cli -e 'select add path/'` |
31+
| `context_builder` | `rp-cli -e 'builder "instructions" --response-type plan'` |
32+
| `chat_send` | `rp-cli -e 'chat "message" --mode plan'` |
33+
| `apply_edits` | `rp-cli -e 'call apply_edits {"path":"...","search":"...","replace":"..."}'` |
34+
| `file_actions` | `rp-cli -e 'call file_actions {"action":"create","path":"..."}'` |
35+
36+
Chain commands with `&&`:
37+
```bash
38+
rp-cli -e 'select set src/ && context'
39+
```
40+
41+
Use `rp-cli -e 'describe <tool>'` for help on a specific tool, or `rp-cli --help` for CLI usage.
42+
43+
---
44+
## The Workflow
45+
46+
1. **Quick scan** – Understand how the task relates to the codebase
47+
2. **Context builder** – Call `builder` with a clear prompt to get deep context + an architectural plan
48+
3. **Refine with chat** – Use `chat` to clarify the plan if needed
49+
4. **Implement directly** – Use editing tools to make changes
50+
51+
---
52+
53+
## CRITICAL REQUIREMENT
54+
55+
⚠️ **DO NOT START IMPLEMENTATION** until you have:
56+
1. Completed Phase 1 (Quick Scan)
57+
2. **Called `builder`** and received its plan
58+
59+
Skipping `builder` results in shallow implementations that miss architectural patterns, related code, and edge cases. The quick scan alone is NOT sufficient for implementation.
60+
61+
---
62+
63+
## Phase 1: Quick Scan (LIMITED - 2-3 tool calls max)
64+
65+
⚠️ **This phase is intentionally brief.** Do NOT do extensive exploration here—that's what `builder` is for.
66+
67+
Start by getting a lay of the land with the file tree:
68+
```bash
69+
rp-cli -e 'tree'
70+
```
71+
72+
Then use targeted searches to understand how the task maps to the codebase:
73+
```bash
74+
rp-cli -e 'search "<key term from task>"'
75+
rp-cli -e 'structure RootName/likely/relevant/area/'
76+
```
77+
78+
Use what you learn to **reformulate the user's prompt** with added clarity—reference specific modules, patterns, or terminology from the codebase.
79+
80+
**STOP exploring after 2-3 searches.** Your goal is orientation, not deep understanding. `builder` will do the heavy lifting.
81+
82+
---
83+
84+
## Phase 2: Context Builder
85+
86+
Call `builder` with your informed prompt. Use `response_type: "plan"` to get an actionable architectural plan.
87+
88+
```bash
89+
rp-cli -e 'builder "<reformulated prompt with codebase context>" --response-type plan'
90+
```
91+
92+
**What you get back:**
93+
- Smart file selection (automatically curated within token budget)
94+
- Architectural plan grounded in actual code
95+
- Chat session for follow-up conversation
96+
- `tab_id` for targeting the same tab in subsequent CLI invocations
97+
98+
**Tab routing:** Each `rp-cli` invocation is a fresh connection. To continue working in the same tab across separate invocations, pass `-t <tab_id>` (the tab ID returned by builder).
99+
**Trust `builder`** – it explores deeply and selects intelligently. You shouldn't need to add many files afterward.
100+
101+
---
102+
103+
## Phase 3: Refine with Chat
104+
105+
The chat is a **seer** – it sees selected files **completely** (full content, not summaries), but it **only sees what's in the selection**. Nothing else.
106+
107+
Use the chat to:
108+
- Review the plan and clarify ambiguities
109+
- Ask about patterns across the selected files
110+
- Validate your understanding before implementing
111+
112+
```bash
113+
rp-cli -t '<tab_id>' -e 'chat "How does X connect to Y in these files? Any edge cases I should watch for?" --mode plan'
114+
```
115+
116+
> **Note:** Pass `-t <tab_id>` to target the same tab across separate CLI invocations.
117+
118+
**The chat excels at:**
119+
- Revealing architectural patterns across files
120+
- Spotting connections that piecemeal reading might miss
121+
- Answering "how does this all fit together" questions
122+
123+
**Don't expect:**
124+
- Knowledge of files outside the selection
125+
- Implementation—that's your job
126+
127+
---
128+
129+
## Phase 4: Direct Implementation
130+
131+
**STOP** - Before implementing, verify you have:
132+
- [ ] An architectural plan from the builder
133+
- [ ] An architectural plan grounded in actual code
134+
135+
If anything is unclear, use `chat` to clarify before proceeding.
136+
137+
Implement the plan directly. **Do not use `chat` with `mode:"edit"`** – you implement directly.
138+
139+
**Primary tools:**
140+
```bash
141+
# Modify existing files (search/replace) - JSON format required
142+
rp-cli -e 'call apply_edits {"path":"Root/File.swift","search":"old","replace":"new"}'
143+
144+
# Multiline edits
145+
rp-cli -e 'call apply_edits {"path":"Root/File.swift","search":"old\ntext","replace":"new\ntext"}'
146+
147+
# Create new files
148+
rp-cli -e 'file create Root/NewFile.swift "content..."'
149+
150+
# Read specific sections during implementation
151+
rp-cli -e 'read Root/File.swift --start-line 50 --limit 30'
152+
```
153+
154+
**Ask the chat when stuck:**
155+
```bash
156+
rp-cli -t '<tab_id>' -e 'chat "I'\''m implementing X but unsure about Y. What pattern should I follow?" --mode chat'
157+
```
158+
159+
---
160+
161+
## Key Guidelines
162+
163+
**Token limit:** Stay under ~160k tokens. Check with `select get` if unsure. Context builder manages this, but be aware if you add files.
164+
165+
**Selection management:**
166+
- Add files as needed, but `builder` should have most of what you need
167+
- Use slices for large files when you only need specific sections
168+
- New files created are automatically selected
169+
170+
```bash
171+
# Check current selection and tokens
172+
rp-cli -e 'select get'
173+
174+
# Add a file if needed
175+
rp-cli -e 'select add Root/path/to/file.swift'
176+
177+
# Add a slice of a large file
178+
rp-cli -e 'select add Root/large/file.swift:100-200'
179+
```
180+
181+
**Chat sees only the selection:** If you need the chat's insight on a file, it must be selected first.
182+
183+
---
184+
185+
## Anti-patterns to Avoid
186+
187+
- 🚫 Using `chat` with `mode:"edit"` – implement directly with editing tools
188+
- 🚫 Asking the chat about files not in the selection – it can't see them
189+
- 🚫 Skipping `builder` and going straight to implementation – you'll miss context
190+
- 🚫 Removing files from selection unnecessarily – prefer adding over removing
191+
- 🚫 Using `manage_selection` with `op:"clear"` – this undoes `builder`'s work; only remove specific files when over token budget
192+
- 🚫 Exceeding ~160k tokens – use slices if needed
193+
- 🚫 **CRITICAL:** Doing extensive exploration (5+ tool calls) before calling `builder` – the quick scan should be 2-3 calls max
194+
- 🚫 Reading full file contents during Phase 1 – save that for after `builder` builds context
195+
- 🚫 Convincing yourself you understand enough to skip `builder` – you don't
196+
197+
---
198+
199+
**Your job:** Build understanding through `builder`, refine the plan with the chat's holistic view, then execute the implementation directly and completely.
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
description: Deep codebase investigation and architecture research with rp-cli commands
3+
repoprompt_managed: true
4+
repoprompt_commands_version: 5
5+
repoprompt_variant: cli
6+
---
7+
8+
# Deep Investigation Mode (CLI)
9+
10+
Investigate: $ARGUMENTS
11+
12+
You are now in deep investigation mode for the issue described above. Follow this protocol rigorously.
13+
14+
## Using rp-cli
15+
16+
This workflow uses **rp-cli** (RepoPrompt CLI) instead of MCP tool calls. Run commands via:
17+
18+
```bash
19+
rp-cli -e '<command>'
20+
```
21+
22+
**Quick reference:**
23+
24+
| MCP Tool | CLI Command |
25+
|----------|-------------|
26+
| `get_file_tree` | `rp-cli -e 'tree'` |
27+
| `file_search` | `rp-cli -e 'search "pattern"'` |
28+
| `get_code_structure` | `rp-cli -e 'structure path/'` |
29+
| `read_file` | `rp-cli -e 'read path/file.swift'` |
30+
| `manage_selection` | `rp-cli -e 'select add path/'` |
31+
| `context_builder` | `rp-cli -e 'builder "instructions" --response-type plan'` |
32+
| `chat_send` | `rp-cli -e 'chat "message" --mode plan'` |
33+
| `apply_edits` | `rp-cli -e 'call apply_edits {"path":"...","search":"...","replace":"..."}'` |
34+
| `file_actions` | `rp-cli -e 'call file_actions {"action":"create","path":"..."}'` |
35+
36+
Chain commands with `&&`:
37+
```bash
38+
rp-cli -e 'select set src/ && context'
39+
```
40+
41+
Use `rp-cli -e 'describe <tool>'` for help on a specific tool, or `rp-cli --help` for CLI usage.
42+
43+
---
44+
## Investigation Protocol
45+
46+
### Core Principles
47+
1. **Don't stop until confident** - pursue every lead until you have solid evidence
48+
2. **Document findings as you go** - create/update a report file with observations
49+
3. **Question everything** - if something seems off, investigate it
50+
4. **Use `builder` aggressively** - it's designed for deep exploration
51+
52+
### Phase 1: Initial Assessment
53+
54+
1. Read any provided files/reports (traces, logs, error reports)
55+
2. Summarize the symptoms and constraints
56+
3. Form initial hypotheses
57+
58+
### Phase 2: Systematic Exploration (via `builder` - REQUIRED)
59+
60+
⚠️ **Do NOT skip this step.** You MUST call `builder` to get proper context before drawing conclusions.
61+
62+
Use `builder` with detailed instructions:
63+
64+
```bash
65+
rp-cli -e 'builder "Investigate: <specific area>
66+
67+
Symptoms observed:
68+
- <symptom 1>
69+
- <symptom 2>
70+
71+
Hypotheses to test:
72+
- <theory 1>
73+
- <theory 2>
74+
75+
Areas to explore:
76+
- <files/patterns/subsystems>
77+
" --response-type plan'
78+
```
79+
80+
### Phase 3: Follow-up Deep Dives
81+
82+
After `builder` returns, continue with targeted questions:
83+
84+
```bash
85+
rp-cli -t '<tab_id>' -e 'chat "<specific follow-up based on findings>" --mode plan'
86+
```
87+
88+
> Pass `-t <tab_id>` to target the same tab across separate CLI invocations.
89+
90+
### Phase 4: Evidence Gathering
91+
92+
- Check git history for recent relevant changes
93+
- Look for patterns across similar files
94+
- Trace data/control flow through the codebase
95+
- Identify any leaks, retained references, or improper cleanup
96+
97+
### Phase 5: Conclusions
98+
99+
Document:
100+
- Root cause identification (with evidence)
101+
- Eliminated hypotheses (and why)
102+
- Recommended fixes
103+
- Preventive measures for the future
104+
105+
---
106+
107+
## Context Builder Tips
108+
109+
The `builder` operates in two phases:
110+
1. **Discovery**: Intelligently explores the codebase
111+
2. **Analysis**: A capable model analyzes the captured context
112+
113+
**Give it good guidance:**
114+
- Be specific about what parts of the codebase to investigate
115+
- Describe symptoms precisely
116+
- List specific technical questions to answer
117+
- Mention any relevant constraints or context
118+
119+
---
120+
121+
## Report Template
122+
123+
Create a findings report as you investigate:
124+
125+
```markdown
126+
# Investigation: [Title]
127+
128+
## Summary
129+
[1-2 sentence summary of findings]
130+
131+
## Symptoms
132+
- [Observed symptom 1]
133+
- [Observed symptom 2]
134+
135+
## Investigation Log
136+
137+
### [Timestamp/Phase] - [Area Investigated]
138+
**Hypothesis:** [What you were testing]
139+
**Findings:** [What you found]
140+
**Evidence:** [File:line references]
141+
**Conclusion:** [Confirmed/Eliminated/Needs more investigation]
142+
143+
## Root Cause
144+
[Detailed explanation with evidence]
145+
146+
## Recommendations
147+
1. [Fix 1]
148+
2. [Fix 2]
149+
150+
## Preventive Measures
151+
- [How to prevent this in future]
152+
```
153+
154+
---
155+
156+
## Anti-patterns to Avoid
157+
158+
- 🚫 **CRITICAL:** Skipping `builder` and attempting to investigate by reading files manually – you'll miss critical context
159+
- 🚫 Doing extensive exploration (5+ tool calls) before calling `builder` – initial assessment should be brief
160+
- 🚫 Drawing conclusions before `builder` has built proper context
161+
- 🚫 Reading many full files during Phase 1 – save deep reading for after `builder`
162+
- 🚫 Assuming you understand the issue without systematic exploration via `builder`
163+
- 🚫 Using only chat follow-ups without an initial `builder` call
164+
165+
---
166+
167+
Now begin the investigation. Read any provided context, then **immediately** use `builder` to start systematic exploration. Do not attempt manual exploration first.

0 commit comments

Comments
 (0)