specrails-core 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,217 @@
1
+ # Deployment
2
+
3
+ SpecRails runs locally — no cloud infrastructure required. Choose the setup that fits your workflow.
4
+
5
+ ## Options at a glance
6
+
7
+ | Option | Best for | Setup time |
8
+ |--------|----------|------------|
9
+ | [Local (npx)](#local-npx) | Quick start, individual developers | ~2 minutes |
10
+ | [Local (git clone)](#local-git-clone) | Customization, contributing | ~5 minutes |
11
+ | [Docker](#docker) | Reproducible environments, teams | ~5 minutes |
12
+ | [CI/CD](#cicd-github-actions) | Automated workflows, GitHub Actions | ~10 minutes |
13
+
14
+ ---
15
+
16
+ ## Local — npx
17
+
18
+ The fastest way to get started. No install required.
19
+
20
+ ```bash
21
+ npx specrails@latest setup
22
+ ```
23
+
24
+ This will:
25
+ 1. Scaffold a `.claude/` directory in your project
26
+ 2. Install the default agent set
27
+ 3. Run the `/setup` wizard to configure your preferences
28
+
29
+ **Requirements:** Node.js ≥18, Claude API key
30
+
31
+ ---
32
+
33
+ ## Local — git clone
34
+
35
+ Clone the repository for full control and the ability to customize agents.
36
+
37
+ ```bash
38
+ git clone https://github.com/specrails-ai/specrails-core
39
+ cd specrails-core
40
+ npm install
41
+ npm run setup
42
+ ```
43
+
44
+ ### Updating
45
+
46
+ ```bash
47
+ git pull origin main
48
+ npm install
49
+ ```
50
+
51
+ See [Updating](./updating.md) for details on preserving local customizations during updates.
52
+
53
+ ---
54
+
55
+ ## Docker
56
+
57
+ Run SpecRails in a container for portable, reproducible environments.
58
+
59
+ ### Quick start
60
+
61
+ ```bash
62
+ docker run -it \
63
+ -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
64
+ -v $(pwd):/workspace \
65
+ ghcr.io/specrails-ai/specrails:latest \
66
+ setup
67
+ ```
68
+
69
+ ### docker-compose
70
+
71
+ Create a `docker-compose.yml` in your project root:
72
+
73
+ ```yaml
74
+ services:
75
+ specrails:
76
+ image: ghcr.io/specrails-ai/specrails:latest
77
+ environment:
78
+ - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
79
+ volumes:
80
+ - .:/workspace
81
+ working_dir: /workspace
82
+ ```
83
+
84
+ Then run:
85
+
86
+ ```bash
87
+ docker compose run specrails setup
88
+ ```
89
+
90
+ ### Building locally
91
+
92
+ ```bash
93
+ git clone https://github.com/specrails-ai/specrails-core
94
+ cd specrails-core
95
+ docker build -t specrails:local .
96
+ docker run -it \
97
+ -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
98
+ -v $(pwd):/workspace \
99
+ specrails:local setup
100
+ ```
101
+
102
+ ---
103
+
104
+ ## CI/CD — GitHub Actions
105
+
106
+ Automate SpecRails workflows in your GitHub Actions pipeline.
107
+
108
+ ### Prerequisites
109
+
110
+ 1. Add `ANTHROPIC_API_KEY` to your repository secrets
111
+ 2. (Optional) Add `GITHUB_TOKEN` with write access for PR creation
112
+
113
+ ### Basic workflow
114
+
115
+ ```yaml
116
+ # .github/workflows/specrails.yml
117
+ name: SpecRails AI Review
118
+
119
+ on:
120
+ pull_request:
121
+ types: [opened, synchronize]
122
+
123
+ jobs:
124
+ review:
125
+ runs-on: ubuntu-latest
126
+ steps:
127
+ - uses: actions/checkout@v4
128
+
129
+ - name: Setup Node.js
130
+ uses: actions/setup-node@v4
131
+ with:
132
+ node-version: '20'
133
+
134
+ - name: Install SpecRails
135
+ run: npm install -g specrails
136
+
137
+ - name: Run AI review
138
+ env:
139
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
140
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141
+ run: specrails review --pr ${{ github.event.pull_request.number }}
142
+ ```
143
+
144
+ ### Scheduled batch implementation
145
+
146
+ ```yaml
147
+ name: SpecRails Batch Implement
148
+
149
+ on:
150
+ schedule:
151
+ - cron: '0 9 * * 1-5' # Weekdays at 9am UTC
152
+ workflow_dispatch:
153
+
154
+ jobs:
155
+ implement:
156
+ runs-on: ubuntu-latest
157
+ steps:
158
+ - uses: actions/checkout@v4
159
+ with:
160
+ token: ${{ secrets.GITHUB_TOKEN }}
161
+
162
+ - name: Setup Node.js
163
+ uses: actions/setup-node@v4
164
+ with:
165
+ node-version: '20'
166
+
167
+ - name: Install SpecRails
168
+ run: npm install -g specrails
169
+
170
+ - name: Run batch implementation
171
+ env:
172
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
173
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174
+ run: specrails sr:batch-implement --max 3
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Environment variables
180
+
181
+ | Variable | Required | Description |
182
+ |----------|----------|-------------|
183
+ | `ANTHROPIC_API_KEY` | Yes | Your Claude API key |
184
+ | `GITHUB_TOKEN` | For PR creation | GitHub personal access token or Actions token |
185
+ | `SPECRAILS_LOG_LEVEL` | No | `debug`, `info` (default), `warn`, `error` |
186
+ | `SPECRAILS_MODEL` | No | Override default model (e.g. `claude-opus-4-6`) |
187
+
188
+ ---
189
+
190
+ ## Troubleshooting
191
+
192
+ ### Permission errors on macOS
193
+
194
+ ```bash
195
+ sudo npm install -g specrails
196
+ # or use a node version manager (nvm, volta) to avoid sudo
197
+ ```
198
+
199
+ ### Docker volume permissions
200
+
201
+ If agents cannot write files inside the container:
202
+
203
+ ```bash
204
+ docker run -it \
205
+ --user $(id -u):$(id -g) \
206
+ -v $(pwd):/workspace \
207
+ ghcr.io/specrails-ai/specrails:latest
208
+ ```
209
+
210
+ ### API key not found
211
+
212
+ Ensure `ANTHROPIC_API_KEY` is exported in your shell:
213
+
214
+ ```bash
215
+ export ANTHROPIC_API_KEY=sk-ant-...
216
+ # Add to ~/.zshrc or ~/.bashrc to persist
217
+ ```
@@ -0,0 +1,107 @@
1
+ # Getting Started
2
+
3
+ Get SpecRails running in your project in under 5 minutes.
4
+
5
+ ## What is SpecRails?
6
+
7
+ SpecRails installs a **product-driven development workflow** into any repository. It gives Claude Code a team of **12 specialized AI agents** — an architect, developers, layer reviewers, a reviewer, a product manager — that work together to go from idea to shipped PR automatically.
8
+
9
+ Think of it as hiring a full engineering team that lives inside your CLI.
10
+
11
+ ## Prerequisites
12
+
13
+ You only need two things:
14
+
15
+ - **Git** — your project must be a git repository
16
+ - **[Claude Code](https://claude.ai/claude-code)** — Anthropic's CLI tool
17
+
18
+ Optional (recommended):
19
+
20
+ - **npm** — for installing the Pipeline Monitor dashboard
21
+ - **[GitHub CLI](https://cli.github.com/)** (`gh`) — for automatic PR creation and issue tracking
22
+
23
+ ## Install
24
+
25
+ Pick your preferred method:
26
+
27
+ **npx (recommended)**
28
+
29
+ ```bash
30
+ npx specrails@latest init --root-dir <your-project>
31
+ ```
32
+
33
+ **git clone**
34
+
35
+ ```bash
36
+ git clone https://github.com/fjpulidop/specrails.git
37
+ ./specrails/install.sh --root-dir <your-project>
38
+ ```
39
+
40
+ The installer will:
41
+
42
+ 1. Check your prerequisites
43
+ 2. Copy templates and commands into `.claude/`
44
+ 3. Initialize OpenSpec (if available)
45
+ 4. Track the installed version for future updates
46
+
47
+ > **Note:** Run this from the repo where you want SpecRails — not from the SpecRails source repo itself.
48
+
49
+ ## Run the Setup Wizard
50
+
51
+ Open Claude Code in your project and run:
52
+
53
+ ```
54
+ /setup
55
+ ```
56
+
57
+ The wizard walks you through 5 phases:
58
+
59
+ | Phase | What happens |
60
+ |-------|-------------|
61
+ | **1. Analyze** | Detects your tech stack, architecture layers, CI commands, and conventions |
62
+ | **2. Personas** | Researches your competitive landscape and generates user personas (VPC profiles) |
63
+ | **3. Configure** | Asks about your backlog provider, git workflow, and which agents/commands to enable |
64
+ | **4. Generate** | Fills all templates with your project-specific context |
65
+ | **5. Cleanup** | Removes the wizard and templates, leaving only your tailored workflow files |
66
+
67
+ After setup, your `.claude/` directory contains fully adapted agents, commands, and rules — ready to use.
68
+
69
+ ## Your first feature
70
+
71
+ Let's implement something. Pick an issue from your backlog, or describe a feature:
72
+
73
+ ```
74
+ /sr:implement "add a health check endpoint"
75
+ ```
76
+
77
+ SpecRails will:
78
+
79
+ 1. **Architect** analyzes the request and designs the implementation
80
+ 2. **Developer** writes the code across all layers
81
+ 3. **Test Writer** generates tests for the new code
82
+ 4. **Doc Sync** updates your changelog and docs
83
+ 5. **Security Reviewer** scans for secrets and vulnerabilities
84
+ 6. **Reviewer** runs your full CI suite and fixes any issues
85
+ 7. Creates a **Pull Request** ready for human review
86
+
87
+ That's it. One command, full pipeline.
88
+
89
+ ## Useful commands for newcomers
90
+
91
+ Once you have a feature running, a few commands help you understand what's happening and why:
92
+
93
+ - `/sr:why "question"` — search agent explanation records in plain language. Ask why a design decision was made, why a library was chosen, or why a particular pattern is used. Agents record their reasoning as they work.
94
+ - `/sr:product-backlog` — see your prioritized backlog with safe implementation ordering. Good first stop before picking what to build next.
95
+ - `/sr:compat-check #N` — check whether an issue's implementation would break existing API consumers before you commit to it.
96
+
97
+ ## What's next?
98
+
99
+ Now that you're running, learn how the system thinks:
100
+
101
+ - [Core Concepts](concepts.md) — understand the pipeline architecture and product-driven approach
102
+ - [Agents](agents.md) — meet each agent and understand their role
103
+ - [Workflows & Commands](workflows.md) — master the full command set
104
+
105
+ ---
106
+
107
+ [← Back to Docs](README.md) · [Core Concepts →](concepts.md)
@@ -0,0 +1,243 @@
1
+ # Installation & Setup
2
+
3
+ This guide covers the complete installation process in detail. For the quick version, see [Getting Started](getting-started.md).
4
+
5
+ ## Prerequisites
6
+
7
+ ### Required
8
+
9
+ | Tool | Why | Install |
10
+ |------|-----|---------|
11
+ | **Git** | SpecRails operates on git repositories | [git-scm.com](https://git-scm.com/) |
12
+ | **Claude Code** | The AI CLI that runs the agents | `npm install -g @anthropic-ai/claude-code` |
13
+
14
+ ### Recommended
15
+
16
+ | Tool | Why | Install |
17
+ |------|-----|---------|
18
+ | **npm** | Pipeline Monitor dashboard, OpenSpec CLI | Via [nvm](https://github.com/nvm-sh/nvm) |
19
+ | **GitHub CLI** | Auto-create PRs, manage issues | `brew install gh` or [cli.github.com](https://cli.github.com/) |
20
+ | **OpenSpec CLI** | Structured spec workflow | `npm install -g @openspec/cli` |
21
+
22
+ ### Optional
23
+
24
+ | Tool | Why |
25
+ |------|-----|
26
+ | **JIRA CLI** | If using JIRA for backlog instead of GitHub Issues |
27
+
28
+ The installer checks for all of these and offers to install missing tools.
29
+
30
+ ## Installation
31
+
32
+ ### From npx (recommended)
33
+
34
+ ```bash
35
+ npx specrails@latest init --root-dir <your-project>
36
+ ```
37
+
38
+ No cloning required. Downloads the latest version and runs the installer automatically.
39
+
40
+ ### From a local clone
41
+
42
+ If you prefer to clone the repo first:
43
+
44
+ ```bash
45
+ git clone https://github.com/fjpulidop/specrails.git
46
+ ./specrails/install.sh --root-dir <your-project>
47
+ ```
48
+
49
+ ### From curl
50
+
51
+ Alternatively, pipe the installer directly:
52
+
53
+ ```bash
54
+ curl -sL https://raw.githubusercontent.com/fjpulidop/specrails/main/install.sh | bash
55
+ ```
56
+
57
+ > **Important:** Always run the installer from the **target repository** — the project where you want SpecRails installed. If you run it from inside the SpecRails source repo, the installer will detect this and prompt you for the correct target path.
58
+
59
+ ### What the installer does
60
+
61
+ 1. **Checks prerequisites** — validates Git, Claude Code; optionally installs npm, gh, OpenSpec
62
+ 2. **Detects existing setup** — warns if `.claude/agents/`, `.claude/commands/`, or `openspec/` already exist
63
+ 3. **Installs artifacts:**
64
+ - `.claude/commands/setup.md` — the `/setup` wizard
65
+ - `.claude/setup-templates/` — all template files
66
+ - `.claude/web-manager/` — Pipeline Monitor dashboard
67
+ - `.claude/security-exemptions.yaml` — security scanner config
68
+ - OpenSpec initialization (if CLI available)
69
+ 4. **Tracks version** — writes `.specrails-version` and `.specrails-manifest.json`
70
+
71
+ ### What it does NOT do
72
+
73
+ The installer only copies files. It does not:
74
+
75
+ - Modify your existing code
76
+ - Create commits
77
+ - Push to any remote
78
+ - Install npm dependencies (you do this manually for the web manager)
79
+
80
+ ---
81
+
82
+ ## The Setup Wizard
83
+
84
+ After installation, open Claude Code in your project and run:
85
+
86
+ ```
87
+ /setup
88
+ ```
89
+
90
+ ### Phase 1: Codebase Analysis
91
+
92
+ The wizard scans your project to detect:
93
+
94
+ - **Languages & frameworks** — from file extensions, dependency files, imports
95
+ - **Architecture layers** — name, path, tech stack, tags (e.g., `backend/` → Python/FastAPI)
96
+ - **CI/CD commands** — lint, format, test, build, type-check commands
97
+ - **Conventions** — naming, imports, error handling, testing patterns
98
+ - **Warnings** — concurrency issues, auth patterns, state management
99
+
100
+ **Output:** A YAML analysis used by all subsequent phases.
101
+
102
+ ### Phase 2: User Personas
103
+
104
+ The wizard researches your project's domain and generates **user personas** with complete VPC profiles. It:
105
+
106
+ 1. Identifies your target user segments
107
+ 2. Researches competitors and alternatives via web search
108
+ 3. Creates 2–4 personas with jobs, pains, and gains
109
+ 4. Extracts a key insight per persona
110
+
111
+ You can edit these later (see [Customization → Personas](customization.md#personas)).
112
+
113
+ ### Phase 3: Configuration
114
+
115
+ Interactive prompts for:
116
+
117
+ | Setting | Options |
118
+ |---------|---------|
119
+ | **Backlog provider** | GitHub Issues, JIRA, or none |
120
+ | **Access mode** | Read-write or read-only |
121
+ | **Git workflow** | Trunk-based, Git Flow, or custom |
122
+ | **Agents** | Which agents to enable |
123
+ | **Commands** | Which commands to install |
124
+
125
+ ### Phase 4: File Generation
126
+
127
+ The wizard fills all templates with your project-specific context:
128
+
129
+ - `{{STACK_OVERVIEW}}` → your detected tech stack
130
+ - `{{CI_COMMANDS}}` → your actual CI command list
131
+ - `{{LAYER_CONVENTIONS}}` → conventions per layer
132
+ - `{{BACKEND_TECH_LIST}}` → your backend technologies
133
+ - Every `{{PLACEHOLDER}}` resolved with real data
134
+
135
+ **Generated files:**
136
+
137
+ ```
138
+ .claude/
139
+ ├── agents/
140
+ │ ├── sr-architect.md # Adapted to your stack
141
+ │ ├── sr-developer.md # Knows your CI commands
142
+ │ ├── sr-reviewer.md # Runs your specific checks
143
+ │ ├── sr-product-manager.md # Knows your domain
144
+ │ ├── sr-product-analyst.md # Reads your backlog
145
+ │ ├── sr-test-writer.md # Uses your test framework
146
+ │ ├── sr-security-reviewer.md # Scans your patterns
147
+ │ ├── sr-doc-sync.md # Updates your doc format
148
+ │ └── [personas].md # Your user personas
149
+ ├── commands/
150
+ │ └── sr/
151
+ │ ├── implement.md
152
+ │ ├── product-backlog.md
153
+ │ ├── batch-implement.md
154
+ │ └── ...
155
+ ├── rules/
156
+ │ ├── backend.md
157
+ │ ├── frontend.md
158
+ │ └── ...
159
+ └── settings.json
160
+ ```
161
+
162
+ ### Phase 5: Cleanup
163
+
164
+ The wizard removes itself:
165
+
166
+ - Deletes `.claude/commands/setup.md`
167
+ - Deletes `.claude/setup-templates/`
168
+ - Leaves only the final generated files
169
+
170
+ After this phase, `/setup` is no longer available — your workflow is ready.
171
+
172
+ ---
173
+
174
+ ## Pipeline Monitor (optional)
175
+
176
+ SpecRails includes a web dashboard for visualizing pipeline execution.
177
+
178
+ ### Install
179
+
180
+ ```bash
181
+ cd .claude/web-manager && npm install
182
+ cd client && npm install
183
+ ```
184
+
185
+ ### Run
186
+
187
+ ```bash
188
+ cd .claude/web-manager && npm run dev
189
+ ```
190
+
191
+ Opens at `http://localhost:4201` by default.
192
+
193
+ ---
194
+
195
+ ## Verify installation
196
+
197
+ After setup, verify everything is in place:
198
+
199
+ ```bash
200
+ # Check generated agents
201
+ ls .claude/agents/
202
+
203
+ # Check for unresolved placeholders (should return nothing)
204
+ grep -r '{{[A-Z_]*}}' .claude/agents/ .claude/commands/ .claude/rules/
205
+
206
+ # Check version
207
+ cat .specrails-version
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Troubleshooting
213
+
214
+ ### "This appears to be the specrails source repository"
215
+
216
+ You're running the installer from inside the SpecRails repo. Run it from your target project instead:
217
+
218
+ ```bash
219
+ cd /path/to/your-project
220
+ bash /path/to/specrails/install.sh
221
+ ```
222
+
223
+ ### Existing `.claude/` directory detected
224
+
225
+ The installer warns if SpecRails artifacts already exist. You can:
226
+
227
+ - **Merge** — install alongside existing files (may overwrite conflicts)
228
+ - **Abort** — cancel and review manually
229
+
230
+ ### Placeholders not resolved
231
+
232
+ If you see `{{PLACEHOLDER}}` in generated files, the `/setup` wizard didn't complete. Re-run `/setup` or manually fill the values.
233
+
234
+ ---
235
+
236
+ ## What's next?
237
+
238
+ - [Core Concepts](concepts.md) — understand the pipeline and agent architecture
239
+ - [Getting Started](getting-started.md) — run your first feature implementation
240
+
241
+ ---
242
+
243
+ [← Getting Started](getting-started.md) · [Core Concepts →](concepts.md)
@@ -0,0 +1,112 @@
1
+ # OSS Maintainer Workflow
2
+
3
+ > For maintainers who want to merge AI-generated PRs quickly without sacrificing quality — and who want to define the conditions under which they trust the pipeline's output.
4
+
5
+ ## The review burden problem
6
+
7
+ Without guardrails, AI-generated code requires the same review depth as human code. You read every file, verify every edge case, and check every type. The throughput advantage of automation disappears at review time.
8
+
9
+ specrails adds observable quality signals to every PR: a confidence score from the Reviewer, a security scan from the Security Reviewer, CI results (lint, typecheck, tests), and structured reviewer annotations. These signals are machine-generated and reproducible — not "it looks fine to me."
10
+
11
+ The goal is not to eliminate code review. It is to define the conditions under which you can trust those signals and reduce manual review to **intent verification**: does this PR do what the original issue asked for? Everything else — correctness, type safety, test coverage, security posture — is covered by the pipeline.
12
+
13
+ ## Setting confidence thresholds
14
+
15
+ The Reviewer agent scores its own output on a 0–100 scale before creating the PR. You control what happens when that score falls below your threshold via `.claude/confidence-config.json`:
16
+
17
+ ```json
18
+ {
19
+ "threshold": 85,
20
+ "on_below_threshold": "block",
21
+ "aspects": {
22
+ "security": { "threshold": 90, "on_below_threshold": "block" },
23
+ "correctness": { "threshold": 80, "on_below_threshold": "warn" }
24
+ }
25
+ }
26
+ ```
27
+
28
+ The three modes for `on_below_threshold`:
29
+
30
+ - **`block`** — the pipeline stops before creating the PR. The Reviewer surfaces its concerns and waits. You review the specific low-confidence areas, then add an override comment to the issue to resume.
31
+ - **`warn`** — the pipeline continues and creates the PR, but the PR description includes a prominently flagged section listing the low-confidence aspects and the Reviewer's reasoning.
32
+ - **`override`** — used by the maintainer at runtime. Add a comment to the issue to explicitly bypass a block for a specific run.
33
+
34
+ **Recommended starting thresholds for OSS projects**: overall 85 with `block`, security aspect 90 with `block`. The correctness aspect at 80 with `warn` is a reasonable starting point — correctness issues are easier to catch in review than security issues.
35
+
36
+ Set thresholds based on your risk tolerance, not aspirationally. A threshold of 95 that constantly blocks the pipeline trains you to lower it. A threshold of 85 that rarely blocks but surfaces genuine concerns trains you to trust it.
37
+
38
+ ## Layer convention files as policy
39
+
40
+ `.claude/rules/frontend.md` is read by the Frontend Reviewer before every review pass. The equivalent files exist for other layers your setup detected. These files are not documentation — they are review policy that the Reviewer enforces on every PR.
41
+
42
+ Put rules in convention files that you would enforce in a human code review:
43
+ - Naming conventions that aren't captured by ESLint (`PascalCase` for component files, `use-` prefix for hook files)
44
+ - Required patterns (`cn()` for class merging, `@/` path alias for all imports)
45
+ - Forbidden patterns (inline styles, hardcoded color values, `any` types)
46
+ - Structural requirements (exported functions must have explicit return types)
47
+
48
+ What doesn't belong in convention files:
49
+ - Style preferences that ESLint or Prettier already enforce (semicolons, trailing commas, quote style)
50
+ - Rules that require runtime context to evaluate ("don't use this API in production environments")
51
+ - Aspirational guidelines that you don't actually enforce on every PR
52
+
53
+ The distinction matters because the Reviewer treats convention files as hard rules. A rule in `.claude/rules/frontend.md` that you don't actually enforce in human review creates noise — the Reviewer will flag violations that you approve anyway, eroding trust in the signal.
54
+
55
+ ## The Failure Learning Loop
56
+
57
+ When the Reviewer finds a non-trivial issue — a pattern that will recur if not captured — it writes a failure record to `.claude/agent-memory/`. Before implementing, the Developer reads failure records matching the current domain and uses them as guardrails.
58
+
59
+ Over time, systematic mistakes stop appearing in PRs. If the Developer consistently produces type errors in a specific module, the Reviewer notes it, and the next Developer run avoids the pattern. This is not perfect — agents have context limits and memory records are text, not code — but it measurably reduces repeating defects in long-running projects.
60
+
61
+ As a maintainer, you can seed this loop manually. When you reject a PR for a repeating issue, write a brief failure record in `.claude/agent-memory/` describing the pattern and the correct approach. The Developer will read it on the next relevant implementation. This is particularly effective for project-specific patterns that don't appear in training data — unusual framework choices, internal library conventions, domain-specific invariants.
62
+
63
+ The memory directory is part of your repository. Reviewing and pruning it periodically keeps the signal quality high. Outdated failure records from refactored code should be removed so they don't mislead future Developers.
64
+
65
+ ## What CI and specrails don't catch
66
+
67
+ The confidence gate and CI verify quality — not intent. A PR that scores 92 on confidence and passes all CI checks can still be wrong in ways that require human judgment. As a maintainer, the things that remain your responsibility are:
68
+
69
+ - **Product intent**: does this implementation match what the original issue asked for? The Reviewer verifies the implementation against the spec, but the spec may not have captured the full product intent.
70
+ - **UX feel**: for UI features, does the result look and behave right? Automated checks don't evaluate visual weight, interaction feel, or whether the layout works in realistic data conditions.
71
+ - **Business logic edge cases**: are there edge cases the spec didn't cover that would produce incorrect behavior for real users? Specs are written before implementation — they capture known cases, not unknown ones.
72
+ - **PR description accuracy**: does the PR description accurately describe what changed? This matters for changelog generation and future developers reading git history.
73
+
74
+ These checks are fast when the pipeline is working well. A PR where the confidence score is high, CI is green, and the implementation is clearly scoped should take 5–10 minutes to verify for intent. That is the target review cost for a well-specced, well-pipelined feature.
75
+
76
+ ## The safe-to-merge checklist
77
+
78
+ A PR from specrails is safe to merge without deep review when all of the following hold:
79
+
80
+ - [ ] Overall confidence score is at or above your configured threshold
81
+ - [ ] Security aspect score is at or above your configured threshold
82
+ - [ ] CI is green: lint, typecheck, and tests all pass
83
+ - [ ] No `TODO` or `FIXME` markers were introduced by the implementation
84
+ - [ ] PR description matches the original issue intent (read the issue, then the PR — do they describe the same thing?)
85
+ - [ ] No new dependencies added without justification in the PR body
86
+
87
+ When any of these conditions fails, do not skip the review — investigate the specific failure. A `TODO` introduced by the Developer is a signal that it encountered a constraint it couldn't resolve. A CI failure that the Reviewer didn't fix is a signal that the pipeline exited early. A PR description that doesn't match the issue is a signal that scope drifted during implementation.
88
+
89
+ ## Patterns & Anti-patterns
90
+
91
+ | Pattern | Why it works |
92
+ |---------|-------------|
93
+ | Setting `security` threshold higher than `overall` | Security issues are harder to catch in a quick review pass — the pipeline should surface them before the PR is created |
94
+ | Putting naming conventions in `.claude/rules/` files | The Reviewer enforces them consistently on every PR, so you never see naming violations in review |
95
+ | Seeding `.claude/agent-memory/` with project-specific failure records | Prevents the same class of defect from appearing repeatedly; teaches the pipeline your codebase's specific constraints |
96
+ | Using `warn` for `correctness` and `block` for `security` | Lets low-stakes correctness issues through for quick human review while stopping security concerns cold |
97
+
98
+ | Anti-pattern | Why it fails |
99
+ |-------------|-------------|
100
+ | Treating a high confidence score as a substitute for intent review | Confidence measures implementation quality against the spec, not the spec's alignment with product intent |
101
+ | Adding aspirational rules to `.claude/rules/` files | Reviewer flags violations you'd approve anyway, creating noise that erodes trust in the rule set |
102
+ | Never pruning `.claude/agent-memory/` | Outdated failure records from refactored code mislead future Developers, causing them to avoid patterns that are now correct |
103
+ | Raising thresholds after every blocked PR instead of investigating | The block exists because the pipeline found something; raising the threshold to get the PR through skips the investigation |
104
+
105
+ ## What's next?
106
+
107
+ - [Customization](customization.md) — configure agents, rules, personas, and confidence thresholds for your project
108
+ - [Core Concepts](concepts.md) — understand the pipeline phases and the agent roles that produce the quality signals you're reviewing
109
+
110
+ ---
111
+
112
+ [← Parallel Development](playbook-parallel-dev.md)