Skip to content

Commit b2c90ea

Browse files
committed
chore: added strand context
1 parent 498b6b0 commit b2c90ea

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

.claude/context/strand.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Strand: Local Rust Code Generation
2+
3+
Strand wraps a local Ollama model (Strand-Rust-Coder-14B) as a stateless, read-only code generation tool. A higher-level agent orchestrates the workflow — reading projects, calling strand for code generation, writing files, running tests.
4+
5+
## CLI Usage
6+
7+
```bash
8+
# Basic
9+
mcptools strand generate "Write a function that adds two numbers"
10+
11+
# With file context
12+
mcptools strand generate "Add error handling" --files src/lib.rs src/types.rs
13+
14+
# Custom model/URL
15+
mcptools strand generate "Write a hello world" \
16+
--model codellama \
17+
--ollama-url http://localhost:11434
18+
```
19+
20+
## MCP Tool
21+
22+
Tool name: `generate_code`
23+
24+
| Argument | Type | Required | Default |
25+
|----------|------|----------|---------|
26+
| `instruction` | string | yes ||
27+
| `context` | string | no ||
28+
| `files` | string[] | no | [] |
29+
| `ollama_url` | string | no | `http://localhost:11434` |
30+
| `model` | string | no | `strand-rust-coder` |
31+
32+
## Architecture
33+
34+
Follows the Functional Core - Imperative Shell pattern:
35+
36+
- **Core** (`crates/core/src/strand/`): Pure functions — `build_prompt()`, `extract_code()`, types
37+
- **Shell** (`crates/mcptools/src/strand/`): Ollama client via `rig-core`, file I/O, CLI
38+
- **MCP** (`crates/mcptools/src/mcp/tools/strand.rs`): Tool handler bridging MCP to strand module
39+
40+
## Environment Variables
41+
42+
| Variable | Default | Description |
43+
|----------|---------|-------------|
44+
| `OLLAMA_URL` | `http://localhost:11434` | Ollama API base URL |
45+
| `STRAND_MODEL` | `strand-rust-coder` | Default model name |
46+
47+
## Dependencies
48+
49+
- `rig-core` 0.31.0 — Ollama provider via `CompletionClient` trait
50+
- Requires a running Ollama instance with the target model
51+
52+
## System Preamble
53+
54+
The model is instructed to output only raw Rust code — no markdown fences, no explanations, no commentary. The `extract_code()` function in core provides a safety net to strip any accidental fences or leading text from the response.

0 commit comments

Comments
 (0)