specrails-core 1.7.0 → 1.7.2
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.
- package/bin/specrails-core.js +24 -7
- package/docs/README.md +37 -0
- package/docs/agents.md +273 -0
- package/docs/api-reference.md +266 -0
- package/docs/changelog.md +151 -0
- package/docs/concepts.md +183 -0
- package/docs/customization.md +320 -0
- package/docs/deployment.md +217 -0
- package/docs/getting-started.md +107 -0
- package/docs/installation.md +243 -0
- package/docs/playbook-oss-maintainer.md +112 -0
- package/docs/playbook-parallel-dev.md +124 -0
- package/docs/playbook-product-discovery.md +115 -0
- package/docs/updating.md +96 -0
- package/docs/workflows.md +410 -0
- package/install.sh +6 -0
- package/package.json +2 -1
- package/update.sh +11 -11
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to SpecRails are listed here, newest first.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## [1.7.0](https://github.com/fjpulidop/specrails-core/compare/v1.6.1...v1.7.0) — 2026-03-20
|
|
8
|
+
|
|
9
|
+
### New commands
|
|
10
|
+
|
|
11
|
+
- **`/sr:merge-conflict`** — Smart merge conflict resolver. Analyzes conflict context, understands intent of both sides, and proposes the correct resolution with an explanation.
|
|
12
|
+
- **`/sr:refactor-recommender` (enhanced)** — Now includes VPC context-aware scoring: debt items are ranked against persona Jobs/Pains/Gains for product-aligned prioritization.
|
|
13
|
+
|
|
14
|
+
### Agents
|
|
15
|
+
|
|
16
|
+
- **Performance Regression Detector** — New agent with CI workflow integration. Automatically detects performance regressions across runs and annotates PRs with regression reports.
|
|
17
|
+
|
|
18
|
+
### Pipeline Monitor
|
|
19
|
+
|
|
20
|
+
- **Zombie job detection and auto-termination** — The web-manager now detects stalled jobs and terminates them automatically to keep the queue healthy.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## [1.6.1](https://github.com/fjpulidop/specrails-core/compare/v1.6.0...v1.6.1) — 2026-03-20
|
|
25
|
+
|
|
26
|
+
### Bug fixes
|
|
27
|
+
|
|
28
|
+
- **Docs cleanup** — Removed DeckDex-contaminated documentation files that had been incorrectly included in the package.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## [1.6.0](https://github.com/fjpulidop/specrails-core/compare/v1.5.0...v1.6.0) — 2026-03-20
|
|
33
|
+
|
|
34
|
+
### Improvements
|
|
35
|
+
|
|
36
|
+
- **`/setup --update` template checksums** — The update command now checks command template checksums before overwriting, so manual customizations are detected and preserved rather than silently clobbered.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## [1.5.0](https://github.com/fjpulidop/specrails-core/compare/v1.4.0...v1.5.0) — 2026-03-20
|
|
41
|
+
|
|
42
|
+
### New commands
|
|
43
|
+
|
|
44
|
+
- **`/sr:opsx-diff`** — Change diff visualizer. Shows a structured, human-readable diff of what changed between two points in time across agents, commands, and templates.
|
|
45
|
+
- **`/sr:telemetry`** — Agent telemetry and cost tracking. Reports per-agent token usage, run counts, and cost estimates with trend analysis.
|
|
46
|
+
|
|
47
|
+
### Agents
|
|
48
|
+
|
|
49
|
+
- **OSS Maintainer persona Kai** — Formalized the OSS Maintainer persona. Kai helps you think through open-source positioning, community management, and contributor onboarding.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## [1.4.0](https://github.com/fjpulidop/specrails-core/compare/v1.3.0...v1.4.0) — 2026-03-20
|
|
54
|
+
|
|
55
|
+
### New commands
|
|
56
|
+
|
|
57
|
+
- **`/sr:vpc-drift`** — Detects when your VPC personas have drifted from what your product actually delivers. Compares persona Jobs/Pains/Gains against the backlog and agent memory; produces per-persona alignment scores and concrete update recommendations.
|
|
58
|
+
- **`/sr:memory-inspect`** — Inspect and manage agent memory directories. Shows per-agent stats, recent entries, and stale file detection with optional pruning.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## [1.3.0](https://github.com/fjpulidop/specrails-core/compare/v1.2.0...v1.3.0) — 2026-03-20
|
|
63
|
+
|
|
64
|
+
### New commands
|
|
65
|
+
|
|
66
|
+
- **`/sr:retry`** — Smart failure recovery. Resumes a failed `/sr:implement` pipeline from the last successful phase without restarting from scratch. Reads saved pipeline state to identify what completed, then re-executes only the remaining phases.
|
|
67
|
+
|
|
68
|
+
### Agents
|
|
69
|
+
|
|
70
|
+
- **Agent personality customization** — Edit agent prompts after installation to tune tone, priorities, and decision-making for your team's style. See [Customization](customization.md).
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## [1.2.0](https://github.com/fjpulidop/specrails-core/compare/v1.1.0...v1.2.0) — 2026-03-20
|
|
75
|
+
|
|
76
|
+
### Improvements
|
|
77
|
+
|
|
78
|
+
- **`/sr:health-check` extended with static code analysis** — Now includes complexity metrics, dead code detection, and architectural pattern analysis in addition to test coverage and dependency health.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## [1.1.0](https://github.com/fjpulidop/specrails-core/compare/v1.0.1...v1.1.0) — 2026-03-20
|
|
83
|
+
|
|
84
|
+
### Agents
|
|
85
|
+
|
|
86
|
+
- **Doc Sync agent enhanced** — Added drift detection with severity levels. The agent now classifies documentation drift as `critical`, `major`, or `minor` and prioritizes accordingly.
|
|
87
|
+
- **Test Writer wired into `/setup`** — New installations now include the Test Writer agent by default.
|
|
88
|
+
- **Security Reviewer wired into `/setup`** — New installations now include the Security Reviewer agent by default.
|
|
89
|
+
|
|
90
|
+
### Onboarding
|
|
91
|
+
|
|
92
|
+
- **Onboarding v1 (RFC-001)** — Formalized the setup wizard flow and agent installation sequence.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## [1.0.1](https://github.com/fjpulidop/specrails-core/compare/v1.0.0...v1.0.1) — 2026-03-19
|
|
97
|
+
|
|
98
|
+
### Bug fixes
|
|
99
|
+
|
|
100
|
+
- Updated README and CLAUDE.md for the `specrails-core` rename.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## [1.0.0](https://github.com/fjpulidop/specrails-core/releases/tag/v1.0.0) — 2026-03-19
|
|
105
|
+
|
|
106
|
+
Initial stable release.
|
|
107
|
+
|
|
108
|
+
### ⚠ Breaking changes
|
|
109
|
+
|
|
110
|
+
All commands renamed from `/<name>` to `/sr:<name>`. All agent files renamed from `<name>.md` to `sr-<name>.md`. Existing installations are auto-migrated by `update.sh`.
|
|
111
|
+
|
|
112
|
+
### What shipped in 1.0
|
|
113
|
+
|
|
114
|
+
**12 specialized agents**
|
|
115
|
+
- Product Manager, Architect, Developer, Backend Developer, Frontend Developer
|
|
116
|
+
- Test Writer, Reviewer, Backend Reviewer, Frontend Reviewer
|
|
117
|
+
- Security Reviewer, Doc Sync, Product Analyst
|
|
118
|
+
|
|
119
|
+
**11 commands**
|
|
120
|
+
- `/sr:implement` — full 8-phase pipeline (architecture → code → tests → docs → review → PR)
|
|
121
|
+
- `/sr:batch-implement` — parallel multi-feature orchestrator using git worktrees
|
|
122
|
+
- `/sr:health-check` — codebase quality dashboard with regression detection
|
|
123
|
+
- `/sr:compat-check` — backwards compatibility analyzer and migration guide generator
|
|
124
|
+
- `/sr:product-backlog` — VPC-scored backlog view with safe implementation ordering
|
|
125
|
+
- `/sr:update-product-driven-backlog` — AI-powered product discovery via personas
|
|
126
|
+
- `/sr:refactor-recommender` — tech debt scanner ranked by impact/effort
|
|
127
|
+
- `/sr:why` — semantic search over agent decision records
|
|
128
|
+
- `/sr:retry` — smart failure recovery (added in 1.3)
|
|
129
|
+
- `/sr:vpc-drift` — persona drift detection (added in 1.4)
|
|
130
|
+
- `/sr:propose-spec` — structured feature proposal generator
|
|
131
|
+
|
|
132
|
+
**Pipeline Monitor (web-manager)**
|
|
133
|
+
- Real-time job queue dashboard
|
|
134
|
+
- Live log streaming via WebSocket
|
|
135
|
+
- Analytics: daily throughput, status breakdown, job history
|
|
136
|
+
- Chat panel for in-context help
|
|
137
|
+
|
|
138
|
+
**Update system**
|
|
139
|
+
- Content-aware selective updates — only changed files are overwritten
|
|
140
|
+
- Customizations (agent prompts, personas, layer rules) are preserved across updates
|
|
141
|
+
- `update.sh` auto-migrates command namespace changes
|
|
142
|
+
|
|
143
|
+
**Distribution**
|
|
144
|
+
- `npx specrails@latest init`
|
|
145
|
+
- `curl | bash` installer
|
|
146
|
+
- `--root-dir` flag for monorepo support
|
|
147
|
+
- `--yes` flag for non-interactive CI installs
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
[← Updating](updating.md)
|
package/docs/concepts.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Core Concepts
|
|
2
|
+
|
|
3
|
+
Before diving into commands and agents, it helps to understand the ideas behind SpecRails.
|
|
4
|
+
|
|
5
|
+
## The pipeline
|
|
6
|
+
|
|
7
|
+
SpecRails organizes development as a **linear pipeline** where each phase produces artifacts for the next:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Discovery → Architecture → Implementation → Quality → Ship
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
| Phase | Agent | Input | Output |
|
|
14
|
+
|-------|-------|-------|--------|
|
|
15
|
+
| Discovery | Product Manager | User personas, market research | Feature ideas with VPC scores |
|
|
16
|
+
| Architecture | Architect | Feature spec | Design doc + task breakdown |
|
|
17
|
+
| Implementation | Developer(s) | Tasks + conventions | Production code |
|
|
18
|
+
| Quality | Test Writer → Doc Sync → Security → Reviewer | Code changes | Tests, docs, security report, CI pass |
|
|
19
|
+
| Ship | Reviewer | Verified code | Pull Request |
|
|
20
|
+
|
|
21
|
+
Each phase has a **dedicated agent** with a narrow scope. Agents don't step on each other — the architect never writes code, the developer never runs CI, the reviewer never designs architecture.
|
|
22
|
+
|
|
23
|
+
## Product-driven development
|
|
24
|
+
|
|
25
|
+
Most AI coding tools start from code. SpecRails starts from **users**.
|
|
26
|
+
|
|
27
|
+
### Value Proposition Canvas (VPC)
|
|
28
|
+
|
|
29
|
+
Every feature is evaluated against user personas using the [Value Proposition Canvas](https://www.strategyzer.com/library/the-value-proposition-canvas) framework:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
┌─────────────────────────────────┐
|
|
33
|
+
│ Customer Segment │
|
|
34
|
+
│ ┌─────────┬────────┬────────┐ │
|
|
35
|
+
│ │ Jobs │ Pains │ Gains │ │
|
|
36
|
+
│ └─────────┴────────┴────────┘ │
|
|
37
|
+
└─────────────────────────────────┘
|
|
38
|
+
↕ fit
|
|
39
|
+
┌─────────────────────────────────┐
|
|
40
|
+
│ Value Proposition │
|
|
41
|
+
│ ┌─────────┬────────┬────────┐ │
|
|
42
|
+
│ │Products │ Pain │ Gain │ │
|
|
43
|
+
│ │& Svc │Relievers│Creators│ │
|
|
44
|
+
│ └─────────┴────────┴────────┘ │
|
|
45
|
+
└─────────────────────────────────┘
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- **Customer Jobs** — what your users need to accomplish (functional, social, emotional)
|
|
49
|
+
- **Pains** — frustrations, risks, and obstacles they face
|
|
50
|
+
- **Gains** — outcomes and benefits they desire
|
|
51
|
+
|
|
52
|
+
Each persona scores features 0–5 on how well they address their needs. Features with high scores across multiple personas get prioritized.
|
|
53
|
+
|
|
54
|
+
### Personas
|
|
55
|
+
|
|
56
|
+
During setup, SpecRails generates **user personas** based on competitive research. Each persona has a complete VPC profile. When the Product Manager proposes features, they're evaluated against these personas — not gut feelings.
|
|
57
|
+
|
|
58
|
+
See [Customization → Personas](customization.md#personas) for how to edit and add personas.
|
|
59
|
+
|
|
60
|
+
## Agents, not prompts
|
|
61
|
+
|
|
62
|
+
SpecRails doesn't use generic prompts. It uses **specialized agents** — each with:
|
|
63
|
+
|
|
64
|
+
- A **narrow role** (architect designs, developer codes, reviewer validates)
|
|
65
|
+
- A **persistent memory** that grows across sessions
|
|
66
|
+
- **Layer-aware conventions** loaded per file path
|
|
67
|
+
- A specific **AI model** matched to the task complexity
|
|
68
|
+
|
|
69
|
+
This specialization means each agent is optimized for its job. The architect thinks in terms of systems and trade-offs. The developer thinks in terms of implementation patterns. The reviewer thinks in terms of CI pipelines and edge cases.
|
|
70
|
+
|
|
71
|
+
See [Agents](agents.md) for the full roster.
|
|
72
|
+
|
|
73
|
+
## OpenSpec
|
|
74
|
+
|
|
75
|
+
SpecRails uses [OpenSpec](https://openspec.dev) as its specification system. OpenSpec provides a structured way to go from idea to implementation:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Spec (source of truth)
|
|
79
|
+
└── Change
|
|
80
|
+
├── Proposal — what and why
|
|
81
|
+
├── Design — how (technical approach)
|
|
82
|
+
├── Tasks — ordered implementation steps
|
|
83
|
+
├── Context Bundle — files the developer needs
|
|
84
|
+
└── Delta Spec — spec updates after implementation
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The architect reads specs before designing. The developer reads the design before coding. After shipping, the change is archived and the spec is updated.
|
|
88
|
+
|
|
89
|
+
This creates a **paper trail** from product decision to shipped code.
|
|
90
|
+
|
|
91
|
+
## Layer conventions
|
|
92
|
+
|
|
93
|
+
Different parts of your codebase have different rules. Your backend might use snake_case while your frontend uses camelCase. Your API layer might require OpenAPI annotations while your tests just need clear naming.
|
|
94
|
+
|
|
95
|
+
SpecRails detects your **architecture layers** during setup and generates per-layer convention files:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
.claude/rules/
|
|
99
|
+
├── backend.md # Loaded for backend/**
|
|
100
|
+
├── frontend.md # Loaded for frontend/**
|
|
101
|
+
└── shared.md # Loaded for shared/**
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Agents automatically load the right conventions based on which files they're modifying. No manual context-switching needed.
|
|
105
|
+
|
|
106
|
+
## Agent memory
|
|
107
|
+
|
|
108
|
+
Each agent maintains a **persistent memory** at `.claude/agent-memory/<agent>/MEMORY.md`. This memory survives across sessions, so agents learn from past work:
|
|
109
|
+
|
|
110
|
+
- The architect remembers architectural decisions and trade-offs
|
|
111
|
+
- The developer remembers patterns and gotchas in your codebase
|
|
112
|
+
- The reviewer remembers common CI failures and fixes
|
|
113
|
+
|
|
114
|
+
Memory is automatic — agents write observations as they work and read them in future sessions.
|
|
115
|
+
|
|
116
|
+
In addition to per-agent memory, two shared directories accumulate institutional knowledge over time:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
.claude/agent-memory/
|
|
120
|
+
├── failures/ # Structured failure records (see Failure Learning Loop)
|
|
121
|
+
└── explanations/ # Decision rationale records (see Explanation Recording)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Confidence Scoring
|
|
125
|
+
|
|
126
|
+
After every review cycle, the Reviewer outputs a **confidence score** (0–100%) across five quality aspects:
|
|
127
|
+
|
|
128
|
+
| Aspect | What it measures |
|
|
129
|
+
|--------|-----------------|
|
|
130
|
+
| Correctness | Does the implementation match the spec? |
|
|
131
|
+
| Test Coverage | Are edge cases and failure modes covered? |
|
|
132
|
+
| Security | No secrets, injections, or OWASP vulnerabilities? |
|
|
133
|
+
| Performance | No obvious bottlenecks introduced? |
|
|
134
|
+
| Maintainability | Is the code readable, consistent, and well-structured? |
|
|
135
|
+
|
|
136
|
+
The pipeline behavior at Phase 4b-conf is controlled by `.claude/confidence-config.json`. Scores below the configured threshold can warn, block, or require an explicit override. See [Confidence thresholds](customization.md#confidence-thresholds).
|
|
137
|
+
|
|
138
|
+
## Failure Learning Loop
|
|
139
|
+
|
|
140
|
+
When the Reviewer finds a non-trivial issue during Phase 4b, it writes a structured failure record to `.claude/agent-memory/failures/`. Each record captures:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"error_type": "missing-index",
|
|
145
|
+
"root_cause": "Foreign key column added without a corresponding index",
|
|
146
|
+
"prevention_rule": "Always create an index for every new foreign key column"
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Before starting implementation, the Developer reads matching failure records as **guardrails** — so the same class of mistake is not repeated. Over time this creates an institutional memory of what has gone wrong and how to avoid it.
|
|
151
|
+
|
|
152
|
+
## Explanation Recording
|
|
153
|
+
|
|
154
|
+
The Architect, Developer, and Reviewer record **decision rationale** in `.claude/agent-memory/explanations/` as they work. These records capture the "why" behind implementation choices — which library was chosen and why, which trade-off was accepted, which alternative was rejected.
|
|
155
|
+
|
|
156
|
+
Use `/sr:why` to search this memory in plain language:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
/sr:why "why did we switch to event sourcing"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
This gives you an audit trail from product decision to implementation choice, without digging through git history or asking the original author.
|
|
163
|
+
|
|
164
|
+
## Dependency-Aware Ordering
|
|
165
|
+
|
|
166
|
+
When `/sr:product-backlog` is run, the Product Analyst parses `Prerequisites:` fields from GitHub Issue bodies and builds a **dependency DAG** (directed acyclic graph). It then:
|
|
167
|
+
|
|
168
|
+
1. Detects cycles and reports them as errors (circular dependencies block ordering)
|
|
169
|
+
2. Computes a safe implementation order via topological sort
|
|
170
|
+
3. Presents the top 3 Wave 1 issues — features with no unimplemented prerequisites
|
|
171
|
+
|
|
172
|
+
This prevents shipping features that depend on other features not yet built, and makes sprint planning safe by default.
|
|
173
|
+
|
|
174
|
+
## What's next?
|
|
175
|
+
|
|
176
|
+
Now that you understand the concepts, meet the agents:
|
|
177
|
+
|
|
178
|
+
- [Agents](agents.md) — every agent explained in detail
|
|
179
|
+
- [Workflows & Commands](workflows.md) — the commands that orchestrate the pipeline
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
[← Getting Started](getting-started.md) · [Agents →](agents.md)
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
# Customization
|
|
2
|
+
|
|
3
|
+
Everything SpecRails generates is editable markdown. Here's how to adapt it to your project.
|
|
4
|
+
|
|
5
|
+
## What gets generated
|
|
6
|
+
|
|
7
|
+
After running `/setup`, your `.claude/` directory looks like this:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
.claude/
|
|
11
|
+
├── agents/ # Agent prompts (one per agent)
|
|
12
|
+
├── commands/ # Workflow commands
|
|
13
|
+
├── rules/ # Per-layer conventions
|
|
14
|
+
├── skills/ # OpenSpec skills
|
|
15
|
+
├── agent-memory/ # Persistent agent memory
|
|
16
|
+
├── settings.json # Permissions
|
|
17
|
+
└── security-exemptions.yaml
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
All files are standard Markdown or JSON/YAML. Edit them directly — no special tools needed.
|
|
21
|
+
|
|
22
|
+
## Agents
|
|
23
|
+
|
|
24
|
+
Agent prompts live in `.claude/agents/<name>.md`. Each file is the full system prompt for that agent.
|
|
25
|
+
|
|
26
|
+
### Editing an agent
|
|
27
|
+
|
|
28
|
+
Open any agent file and modify it. Common customizations:
|
|
29
|
+
|
|
30
|
+
- **Add domain knowledge** — tell the architect about your microservice boundaries, or the developer about your ORM patterns
|
|
31
|
+
- **Change behavior** — make the reviewer stricter, or the test writer target a different coverage threshold
|
|
32
|
+
- **Add constraints** — "never use library X", "always use repository pattern for data access"
|
|
33
|
+
|
|
34
|
+
Example — adding a constraint to the developer:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
## Additional Rules
|
|
38
|
+
- Always use the repository pattern for database access
|
|
39
|
+
- Never import directly from internal packages — use the public API
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Agent model selection
|
|
43
|
+
|
|
44
|
+
Each agent specifies its model in YAML frontmatter:
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
---
|
|
48
|
+
model: sonnet
|
|
49
|
+
---
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Available models:
|
|
53
|
+
- `opus` — best for creative/strategic tasks (Product Manager)
|
|
54
|
+
- `sonnet` — balanced for implementation tasks (most agents)
|
|
55
|
+
- `haiku` — fast and cheap for analysis tasks (Product Analyst)
|
|
56
|
+
|
|
57
|
+
Change the model by editing the frontmatter.
|
|
58
|
+
|
|
59
|
+
### Adding a new agent
|
|
60
|
+
|
|
61
|
+
Create a new file in `.claude/agents/`:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
---
|
|
65
|
+
model: sonnet
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
# My Custom Agent
|
|
69
|
+
|
|
70
|
+
You are a specialized agent for [your purpose].
|
|
71
|
+
|
|
72
|
+
## Role
|
|
73
|
+
[What this agent does]
|
|
74
|
+
|
|
75
|
+
## Rules
|
|
76
|
+
[What this agent must follow]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Reference it from a command using the Agent tool with `subagent_type: "your-agent-name"`.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Layer conventions
|
|
84
|
+
|
|
85
|
+
Convention files live in `.claude/rules/<layer>.md`. They're loaded automatically based on file paths.
|
|
86
|
+
|
|
87
|
+
### How rules are scoped
|
|
88
|
+
|
|
89
|
+
Each rule file has a `paths` field in its frontmatter:
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
---
|
|
93
|
+
paths:
|
|
94
|
+
- "backend/**"
|
|
95
|
+
---
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
When an agent modifies a file matching `backend/**`, this rule is automatically loaded into its context. No manual loading needed.
|
|
99
|
+
|
|
100
|
+
### Editing conventions
|
|
101
|
+
|
|
102
|
+
Add or modify rules for any layer:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
---
|
|
106
|
+
paths:
|
|
107
|
+
- "src/api/**"
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
# API Layer Conventions
|
|
111
|
+
|
|
112
|
+
- All endpoints must return JSON with `{ data, error, meta }` envelope
|
|
113
|
+
- Use middleware for authentication — never check tokens in handlers
|
|
114
|
+
- Rate limiting is handled at the gateway level — don't implement it per-endpoint
|
|
115
|
+
- Error responses must include a machine-readable `code` field
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Adding a new layer
|
|
119
|
+
|
|
120
|
+
Create a new file in `.claude/rules/`:
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
---
|
|
124
|
+
paths:
|
|
125
|
+
- "infrastructure/**"
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
# Infrastructure Conventions
|
|
129
|
+
|
|
130
|
+
- Use Terraform for all cloud resources
|
|
131
|
+
- Never hardcode region or account IDs
|
|
132
|
+
- All resources must be tagged with `team` and `environment`
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Personas
|
|
138
|
+
|
|
139
|
+
Persona files live in `.claude/agents/` (generated during setup). Each persona is a complete VPC profile used for feature evaluation.
|
|
140
|
+
|
|
141
|
+
### Editing a persona
|
|
142
|
+
|
|
143
|
+
Personas have three key sections for feature scoring:
|
|
144
|
+
|
|
145
|
+
```markdown
|
|
146
|
+
### Customer Jobs
|
|
147
|
+
| Type | Job |
|
|
148
|
+
|------|-----|
|
|
149
|
+
| Functional | Deploy changes without downtime |
|
|
150
|
+
| Social | Be seen as technically competent by the team |
|
|
151
|
+
| Emotional | Feel confident that deploys won't break production |
|
|
152
|
+
|
|
153
|
+
### Pains
|
|
154
|
+
| Severity | Pain |
|
|
155
|
+
|----------|------|
|
|
156
|
+
| High | Manual deploys take 2+ hours |
|
|
157
|
+
| Medium | Rollback process is undocumented |
|
|
158
|
+
|
|
159
|
+
### Gains
|
|
160
|
+
| Impact | Gain |
|
|
161
|
+
|--------|------|
|
|
162
|
+
| High | Zero-downtime deployments |
|
|
163
|
+
| Medium | Automated rollback on failure |
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Edit jobs, pains, and gains to match your actual users. The more accurate these are, the better the Product Manager's recommendations.
|
|
167
|
+
|
|
168
|
+
### Adding a persona
|
|
169
|
+
|
|
170
|
+
Create a new persona file following the template structure. Include:
|
|
171
|
+
|
|
172
|
+
1. **Profile** — name, role, age range, behaviors
|
|
173
|
+
2. **Customer Jobs** — functional, social, and emotional jobs
|
|
174
|
+
3. **Pains** — graded by severity (High/Medium/Low)
|
|
175
|
+
4. **Gains** — graded by impact (High/Medium/Low)
|
|
176
|
+
5. **Key Insight** — the single most important unmet need
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Confidence thresholds
|
|
181
|
+
|
|
182
|
+
The confidence gate at Phase 4b-conf is controlled by `.claude/confidence-config.json`:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"thresholds": {
|
|
187
|
+
"overall": 80,
|
|
188
|
+
"correctness": 85,
|
|
189
|
+
"test_coverage": 75,
|
|
190
|
+
"security": 90,
|
|
191
|
+
"performance": 70,
|
|
192
|
+
"maintainability": 75
|
|
193
|
+
},
|
|
194
|
+
"on_failure": "block"
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
| `on_failure` value | Behavior |
|
|
199
|
+
|--------------------|---------|
|
|
200
|
+
| `"block"` | Pipeline stops; fix required before PR creation |
|
|
201
|
+
| `"warn"` | Pipeline continues; warning added to PR description |
|
|
202
|
+
| `"override"` | Always continue regardless of score |
|
|
203
|
+
|
|
204
|
+
Adjust thresholds per aspect to match your team's quality bar. Set `"on_failure": "warn"` during initial rollout if you want visibility without blocking.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Layer reviewers
|
|
209
|
+
|
|
210
|
+
The Frontend Reviewer and Backend Reviewer agents live in `.claude/agents/`:
|
|
211
|
+
|
|
212
|
+
- `.claude/agents/frontend-reviewer.md`
|
|
213
|
+
- `.claude/agents/backend-reviewer.md`
|
|
214
|
+
|
|
215
|
+
Customize them the same way as any other agent — add domain-specific checks, change what's flagged as a finding, or adjust severity thresholds.
|
|
216
|
+
|
|
217
|
+
Example — adding a project-specific frontend rule:
|
|
218
|
+
|
|
219
|
+
```markdown
|
|
220
|
+
## Additional Checks
|
|
221
|
+
- Flag any component that fetches data directly (use React Query hooks instead)
|
|
222
|
+
- Warn on inline styles with more than 3 properties (extract to CSS module)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Both agents run in parallel during Phase 4b and feed their findings into the generalist Reviewer's final report.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Backwards compatibility baseline
|
|
230
|
+
|
|
231
|
+
Use `/sr:compat-check --save` to snapshot your current API surface as a baseline:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
/sr:compat-check --save
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
This writes the current API surface to `.claude/compat-baseline.json`. Future runs of `/sr:compat-check` and the Architect's Phase 6 auto-check compare against this baseline to detect breaking changes. Re-run `--save` after any intentional breaking release to advance the baseline.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Security exemptions
|
|
242
|
+
|
|
243
|
+
The Security Reviewer can produce false positives. Suppress known safe patterns in `.claude/security-exemptions.yaml`:
|
|
244
|
+
|
|
245
|
+
```yaml
|
|
246
|
+
exemptions:
|
|
247
|
+
- pattern: "NEXT_PUBLIC_.*"
|
|
248
|
+
reason: "Next.js public env vars are intentionally client-exposed"
|
|
249
|
+
- file: "tests/fixtures/mock-keys.json"
|
|
250
|
+
reason: "Test fixtures with fake keys"
|
|
251
|
+
- severity_override:
|
|
252
|
+
pattern: "console\\.log"
|
|
253
|
+
from: "medium"
|
|
254
|
+
to: "info"
|
|
255
|
+
reason: "Dev-only logging, stripped in production build"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Settings
|
|
261
|
+
|
|
262
|
+
`.claude/settings.json` controls tool permissions:
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"permissions": {
|
|
267
|
+
"allow": [
|
|
268
|
+
"Read", "Write", "Edit",
|
|
269
|
+
"Glob", "Grep", "Agent",
|
|
270
|
+
"Skill", "ToolSearch"
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Add or remove tools to control what agents can do. The update system preserves your permission customizations when pulling new versions.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Agent memory
|
|
281
|
+
|
|
282
|
+
Agent memory at `.claude/agent-memory/<agent>/MEMORY.md` is automatic but editable.
|
|
283
|
+
|
|
284
|
+
### Clearing memory
|
|
285
|
+
|
|
286
|
+
Delete entries from an agent's `MEMORY.md` to reset specific knowledge:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Clear all architect memory
|
|
290
|
+
> .claude/agent-memory/architect/MEMORY.md
|
|
291
|
+
|
|
292
|
+
# Or edit selectively
|
|
293
|
+
code .claude/agent-memory/architect/MEMORY.md
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Seeding memory
|
|
297
|
+
|
|
298
|
+
Pre-populate agent memory with project knowledge:
|
|
299
|
+
|
|
300
|
+
```markdown
|
|
301
|
+
# Memory Index
|
|
302
|
+
|
|
303
|
+
## Architecture decisions
|
|
304
|
+
- [adr-001.md](adr-001.md) — We use event sourcing for the order domain
|
|
305
|
+
|
|
306
|
+
## Known gotchas
|
|
307
|
+
- [gotcha-db.md](gotcha-db.md) — PostgreSQL connection pool maxes at 20 in dev
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
This is useful when onboarding SpecRails to a complex project.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## What's next?
|
|
315
|
+
|
|
316
|
+
- [Updating](updating.md) — keep SpecRails up to date without losing your customizations
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
[← Workflows & Commands](workflows.md) · [Updating →](updating.md)
|