Skip to content

Commit 80271fc

Browse files
Fix documentation and CLI error messages based on skill execution analysis (#10)
Documentation: - Update session file location from "working directory" to home directory (~/) in agent-guide.md, troubleshooting.md, and reference.md - Add "Exporting Session Content to Files" section explaining slice vs next - Clarify parallel processing workflow requires chunking before next command - Add Claude Code integration setup instructions to README.md CLI: - Add helpful error message to stderr when `rlm next --raw` fails due to missing chunks: "Error: No chunks available. Run 'rlm chunk' first." - Use assembly version instead of hardcoded version string in Program.cs
1 parent 291052b commit 80271fc

File tree

8 files changed

+89
-27
lines changed

8 files changed

+89
-27
lines changed

.claude/skills/rlm/SKILL.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,26 @@ rlm load massive.pdf --session parent
153153
rlm chunk --strategy uniform --size 30000 --session parent
154154

155155
# 2. Parent extracts chunks and spawns workers
156+
# IMPORTANT: Chunking (step 1) must complete before using `next`
156157
rlm next --raw --session parent > chunk_0.txt
157158
# SPAWN: rlm-worker with "Process chunk_0.txt, session=child_0"
158159

160+
rlm next --raw --session parent > chunk_1.txt
161+
# SPAWN: rlm-worker with "Process chunk_1.txt, session=child_1"
162+
# ... continue for all chunks
163+
159164
# 3. After workers complete, import and aggregate
160165
rlm import "rlm-session-child_*.json" --session parent
161166
rlm aggregate --session parent
162167
```
163168

169+
**Alternative: Use `slice` for exporting content without chunking:**
170+
```bash
171+
# Export content by character position (no chunking required)
172+
rlm slice 0:30000 --session parent --raw > chunk_0.txt
173+
rlm slice 30000:60000 --session parent --raw > chunk_1.txt
174+
```
175+
164176
**Key Rules:**
165177
- Parent uses `--session parent`
166178
- Each worker uses unique `--session child_N`

.claude/skills/rlm/agent-guide.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ rlm clear --all
142142

143143
### File Locations
144144

145-
| Session Type | File Name | Location |
146-
|--------------|-------------------------|-------------------|
147-
| Default | `.rlm-session.json` | Working directory |
148-
| Named | `rlm-session-{id}.json` | Working directory |
145+
| Session Type | File Name | Location |
146+
|--------------|-------------------------|-----------------------|
147+
| Default | `.rlm-session.json` | Home directory (`~/`) |
148+
| Named | `rlm-session-{id}.json` | Home directory (`~/`) |
149149

150150
### Recommended Naming Patterns
151151

@@ -166,7 +166,7 @@ rlm import "rlm-session-child_*.json" --session parent
166166
rlm import "rlm-session-search_*.json" --session parent
167167

168168
# Verify glob matches expected files
169-
ls rlm-session-child_*.json
169+
ls ~/rlm-session-child_*.json
170170
```
171171

172172
---
@@ -193,6 +193,33 @@ rlm next --raw --session parent
193193
echo "$SUMMARY" | rlm store summary - --session child_1
194194
```
195195

196+
### Exporting Session Content to Files
197+
198+
Use `slice` when you need to export session content to files (e.g., for parallel worker input). Use `next` for iterative chunk-by-chunk processing within a single agent.
199+
200+
**For entire content (parallel worker input):**
201+
```bash
202+
# Export first 200k chars to a file for a worker
203+
rlm slice 0:200000 --session parent --raw > chunk_0.txt
204+
205+
# Export specific ranges
206+
rlm slice 200000:400000 --session parent --raw > chunk_1.txt
207+
```
208+
209+
**For chunk-by-chunk iteration (single agent):**
210+
```bash
211+
# First chunk the document
212+
rlm chunk --strategy uniform --size 50000 --session parent
213+
214+
# Then iterate through chunks
215+
rlm next --raw --session parent > chunk_0.txt
216+
rlm next --raw --session parent > chunk_1.txt
217+
```
218+
219+
**Key Difference:**
220+
- `slice` works on the raw document content by character position
221+
- `next` requires chunking first and iterates through the chunk buffer
222+
196223
### Nested Recursion (Worker-Spawns-Worker)
197224

198225
Workers can spawn child workers for true recursive parallel decomposition. This enables processing of arbitrarily large documents through hierarchical delegation.

.claude/skills/rlm/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,9 @@ With `--final` flag:
500500

501501
## Session File Format
502502

503-
Session files are stored at:
503+
Session files are stored in the home directory (`~/`):
504504
- Default: `~/.rlm-session.json`
505-
- Named: `rlm-session-{id}.json`
505+
- Named: `~/rlm-session-{id}.json`
506506

507507
**Structure:**
508508

.claude/skills/rlm/troubleshooting.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ Quick reference for common issues and solutions when using the RLM CLI.
44

55
## Quick Reference Table
66

7-
| Issue | Cause | Solution |
8-
|------------------------|---------------------------|----------------------------------------------|
9-
| "rlm: command not found" | RLM not installed | `dotnet tool install -g rlm` |
10-
| "Session locked" | Concurrent access | Use unique `--session` IDs |
11-
| "No chunks available" | Missing `load` or `chunk` | Run `rlm load` then `rlm chunk` |
12-
| "No more chunks" | Reached end of buffer | Use `rlm aggregate` to combine results |
13-
| Output has formatting | Default output mode | Use `--raw` for clean text |
14-
| Too many small chunks | Granular semantic split | Add `--min-size 5000 --merge-small` |
15-
| Session file not found | Wrong session ID | Check `ls rlm-session-*.json` |
16-
| Pattern not matching | Regex escaping | Escape special chars: `\\[`, `\\]` |
17-
| Import finds no files | Glob pattern wrong | Test glob with `ls rlm-session-child_*.json` |
7+
| Issue | Cause | Solution |
8+
|--------------------------|---------------------------|------------------------------------------------|
9+
| "rlm: command not found" | RLM not installed | `dotnet tool install -g rlm` |
10+
| "Session locked" | Concurrent access | Use unique `--session` IDs |
11+
| "No chunks available" | Missing `load` or `chunk` | Run `rlm load` then `rlm chunk` |
12+
| "No more chunks" | Reached end of buffer | Use `rlm aggregate` to combine results |
13+
| Output has formatting | Default output mode | Use `--raw` for clean text |
14+
| Too many small chunks | Granular semantic split | Add `--min-size 5000 --merge-small` |
15+
| Session file not found | Wrong session ID | Check `ls ~/rlm-session-*.json` |
16+
| Pattern not matching | Regex escaping | Escape special chars: `\\[`, `\\]` |
17+
| Import finds no files | Glob pattern wrong | Test glob with `ls ~/rlm-session-child_*.json` |
1818

1919
---
2020

@@ -140,8 +140,8 @@ rlm filter "ERROR"
140140

141141
**Solution:**
142142
```bash
143-
# Verify files exist
144-
ls rlm-session-*.json
143+
# Verify files exist (sessions are stored in home directory)
144+
ls ~/rlm-session-*.json
145145

146146
# Match the exact naming pattern used by workers
147147
rlm import "rlm-session-child_*.json" --session parent
@@ -183,7 +183,7 @@ rlm import "rlm-session-child_0_*.json" --session child_0
183183
# Matches: child_0_0, child_0_1 (NOT child_0_0_0)
184184

185185
# Verify pattern before importing
186-
ls rlm-session-child_0_*.json
186+
ls ~/rlm-session-child_0_*.json
187187
```
188188

189189
---
@@ -260,11 +260,11 @@ rlm info --progress
260260
# List stored results
261261
rlm results
262262

263-
# View session file directly
264-
cat rlm-session-{id}.json | jq .
263+
# View session file directly (sessions are stored in home directory)
264+
cat ~/rlm-session-{id}.json | jq .
265265

266266
# List all session files
267-
ls -la rlm-session-*.json
267+
ls -la ~/rlm-session-*.json
268268
```
269269

270270
---

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@ dotnet tool install -g rlm
2828
dotnet tool update -g rlm
2929
```
3030

31+
### Setup Claude Code Integration
32+
33+
To use RLM with Claude Code, copy the skills and agent files to your project:
34+
35+
```bash
36+
# Clone the repository (or download the .claude folder)
37+
git clone https://github.com/endjin/RLM.git
38+
39+
# Copy the .claude folder to your project
40+
cp -r RLM/.claude /path/to/your/project/
41+
```
42+
43+
This provides:
44+
- **Skill** (`.claude/skills/rlm/`) - Invoke with `/rlm` to process large documents
45+
- **Agent** (`.claude/agents/rlm-worker/`) - Parallel chunk processing worker for Claude Code
46+
3147
### Build and Run
3248

3349
```bash

Solutions/Rlm.Cli/Commands/NextCommand.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public override async Task<int> ExecuteAsync(CommandContext context, Settings se
3535

3636
if (!session.HasChunks)
3737
{
38-
if (settings.Raw) return 1;
38+
if (settings.Raw)
39+
{
40+
Console.Error.WriteLine("Error: No chunks available. Run 'rlm chunk' first.");
41+
return 1;
42+
}
3943

4044
if (settings.Json)
4145
{

Solutions/Rlm.Cli/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Copyright (c) Endjin Limited. All rights reserved.
33
// </copyright>
44

5+
using System.Reflection;
56
using Microsoft.Extensions.DependencyInjection;
67
using Rlm.Cli.Commands;
78
using Rlm.Cli.Infrastructure;
@@ -23,7 +24,10 @@
2324
app.Configure(config =>
2425
{
2526
config.SetApplicationName("rlm");
26-
config.SetApplicationVersion("1.0.0");
27+
config.SetApplicationVersion(
28+
typeof(Program).Assembly
29+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
30+
?.InformationalVersion ?? "0.0.0");
2731

2832
// Load command - loads a document into the session
2933
config.AddCommand<LoadCommand>("load")

Solutions/Rlm.Cli/Rlm.Cli.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
<PropertyGroup>
5252
<PackageId>rlm</PackageId>
53-
<Version>1.0.0</Version>
5453
<Authors>endjin</Authors>
5554
<Description>A .NET CLI tool for processing large documents that exceed LLM context windows. Implements streaming content decomposition, multi-turn processing, and result aggregation.</Description>
5655
<PackageProjectUrl>https://github.com/endjin/RLM</PackageProjectUrl>

0 commit comments

Comments
 (0)