# journeyman — Cursor integration (legacy)

> Prefer the modern rule at `templates/journeyman.mdc` → `.cursor/rules/journeyman.mdc`.
> This file is kept for projects still using a root `.cursorrules`.

Paste this snippet into your project's `.cursorrules` file.

---

## journeyman — economical worker model

Use the `journeyman` CLI tool to offload implementation-heavy tasks (writing a
complete file from a spec, applying a known patch, fixing a scoped bug) to a
local or economical model. You write the spec and review the result; journeyman handles
model selection and syntax validation.

### Trigger conditions
- User asks to implement a specific file or function with clear requirements
- A diff or patch is well-understood and can be expressed as a numbered spec
- Debugging a specific issue with a clear fix direction

### Do NOT use journeyman
- For architecture or design decisions
- For exploratory or uncertain tasks
- When you would need to reason through the problem before knowing the answer

### Command

```bash
# Pipe spec directly (no temp files):
journeyman worker --task - --out <output-file> --expect '<symbol>' <<'SPEC'
# Task: <one sentence>
## Output file
<relative path from project root>
## Language & Runtime
<e.g. Python 3.11+, stdlib only>
## Signatures / Interface
def foo(x: int) -> str: ...
## Behavior
1. <requirement>
2. <requirement>
## Allowed Dependencies
- <module (stdlib or third-party)>
## Expected Pattern
<function or class name that must appear>
## Context
<paste snippets of existing code the worker needs>
SPEC
```

### After exit 0: review before accepting

Check: spec requirements covered · signatures exact · no TODOs or stubs ·
only allowed imports · no secrets or injection · edge cases handled.

If review fails: add `## Corrections` to spec, re-run once. If still fails, fix directly.

### Exit codes
- `0` → success, review output
- `1` → tighten spec, re-run
- `2` → run `journeyman setup --list`, do NOT retry
- `3` → fix file directly
- `4` → re-run
- `5` → expected pattern missing; tighten `--expect`, re-run
