# Project Rules (Claude Code Worker)

<!--
  This file is auto-generated by `sps project init` / `sps doctor --fix`.
  Edit it to add project-specific rules. SPS will not overwrite it once it exists.
-->

## Scope

- Work only in the current project directory.
- Do NOT read or modify files outside this directory.
- Do NOT explore `~/.coral/projects/...` or other system paths.

## SPS Pipeline Context

This project is driven by SPS (Smart Pipeline System). Each card is a task.
When you are launched as a worker, two env vars identify your stable context:

- `$SPS_PROJECT` — project name (stable across card reuse)
- `$SPS_WORKER_SLOT` — worker slot name (stable across card reuse)

Per-card information (card id, stage name, title) is **not** in env. POSIX
freezes env at spawn, so any per-card value would go stale once the claude
process is reused for the next card. If you need the current card info,
read the marker file or use the `sps` CLI:

- Marker file: `~/.coral/projects/$SPS_PROJECT/runtime/worker-$SPS_WORKER_SLOT-current.json`
- CLI: `sps card dashboard $SPS_PROJECT` (or the command your task prompt already passed to you)

## Card lifecycle labels (for reference — all managed automatically)

Each card moves through these labels during its pipeline run:

- `AI-PIPELINE` — added at `sps card add`; the pipeline admission mark
- `CLAIMED` — added when SPS claims a worker slot for this card
- `STARTED-<stage>` — added automatically on each prompt submit via the
  **UserPromptSubmit** hook. This is the "ACK signal" that proves Claude
  received the prompt. If this label doesn't appear within
  `WORKER_ACK_TIMEOUT_S` seconds after dispatch, SPS's MonitorEngine flags
  `ACK-TIMEOUT` and StageEngine kills the worker + retries.
- `COMPLETED-<stage>` — added on turn end via the **Stop hook**. Tells SPS
  to advance the card to the next stage (or Done).

You do NOT need to manually update card state, move the card between
columns, or commit on behalf of the pipeline. The hooks do it all.

**Honesty note**: If you declare "done" without actually implementing the
work, the pipeline will still advance (the Stop hook fires regardless). The
user relies on your honesty here.

## Memory

- Claude's **auto memory** is enabled and stored under
  `~/.coral/projects/$SPS_PROJECT/memory/`. You write to `MEMORY.md` there
  to persist knowledge across sessions.
- Use `sps memory add $SPS_PROJECT --type ...` to write structured SPS memories
  (conventions, decisions, lessons) for the human to curate.

## Git (if the project uses git)

- Claude handles all git operations itself (commit, push, etc.).
- SPS does NOT intervene in git workflows or conflict resolution.

## Project-specific rules

<!-- Add your own conventions, architecture notes, and constraints below. -->
