@shipfast-ai/shipfast 1.1.0 → 1.3.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.
Files changed (44) hide show
  1. package/README.md +166 -201
  2. package/agents/architect.md +7 -7
  3. package/agents/builder.md +9 -10
  4. package/agents/critic.md +3 -3
  5. package/agents/scout.md +1 -1
  6. package/agents/scribe.md +9 -13
  7. package/bin/install.js +250 -9
  8. package/brain/index.cjs +38 -80
  9. package/brain/indexer.cjs +6 -9
  10. package/brain/schema.sql +4 -2
  11. package/commands/sf/brain.md +4 -0
  12. package/commands/sf/check-plan.md +3 -4
  13. package/commands/sf/config.md +1 -0
  14. package/commands/sf/cost.md +83 -0
  15. package/commands/sf/diff.md +53 -0
  16. package/commands/sf/discuss.md +115 -68
  17. package/commands/sf/do.md +140 -72
  18. package/commands/sf/help.md +10 -5
  19. package/commands/sf/map.md +16 -24
  20. package/commands/sf/plan.md +6 -9
  21. package/commands/sf/project.md +4 -4
  22. package/commands/sf/rollback.md +70 -0
  23. package/commands/sf/ship.md +13 -0
  24. package/commands/sf/status.md +1 -3
  25. package/commands/sf/verify.md +4 -9
  26. package/commands/sf/worktree.md +286 -0
  27. package/core/ambiguity.cjs +229 -125
  28. package/core/architecture.cjs +5 -8
  29. package/core/autopilot.cjs +1 -0
  30. package/core/budget.cjs +5 -11
  31. package/core/constants.cjs +63 -0
  32. package/core/context-builder.cjs +1 -58
  33. package/core/executor.cjs +18 -4
  34. package/core/guardrails.cjs +6 -5
  35. package/core/model-selector.cjs +5 -48
  36. package/core/retry.cjs +5 -1
  37. package/core/session.cjs +2 -2
  38. package/core/skip-logic.cjs +5 -1
  39. package/core/verify.cjs +11 -14
  40. package/hooks/sf-first-run.js +2 -2
  41. package/mcp/server.cjs +135 -4
  42. package/package.json +18 -4
  43. package/scripts/postinstall.js +1 -1
  44. package/commands/sf/workstream.md +0 -51
package/README.md CHANGED
@@ -4,7 +4,12 @@
4
4
 
5
5
  **Autonomous context-engineered development system with SQLite brain.**
6
6
 
7
- **5 agents. 17 commands. Per-task fresh context. 70-90% fewer tokens.**
7
+ **5 agents. 20 commands. Per-task fresh context. 70-90% fewer tokens.**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@shipfast-ai/shipfast)](https://www.npmjs.com/package/@shipfast-ai/shipfast)
10
+ [![npm downloads](https://img.shields.io/npm/dw/@shipfast-ai/shipfast)](https://www.npmjs.com/package/@shipfast-ai/shipfast)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
12
+ [![Tests](https://github.com/shipfast-ai/shipfast/actions/workflows/test.yml/badge.svg)](https://github.com/shipfast-ai/shipfast/actions/workflows/test.yml)
8
13
 
9
14
  Claude Code, OpenCode, Gemini CLI, Kilo, Codex, Copilot, Cursor, Windsurf, Antigravity, Augment, Trae, Qwen Code, CodeBuddy, Cline
10
15
 
@@ -20,19 +25,19 @@ Works on Mac, Windows, and Linux.
20
25
 
21
26
  ## Why ShipFast?
22
27
 
23
- Context rot kills AI coding quality. As the context window fills up, output degrades.
28
+ Context rot kills AI coding quality. As the context window fills up, output degrades — Task 5 is worse than Task 1.
24
29
 
25
30
  ShipFast fixes this with a **SQLite knowledge graph** that gives each agent fresh context and gets smarter every session.
26
31
 
27
- - **17 commands, 5 composable agents** — simple to learn, covers the full workflow
28
- - **SQLite brain** — queryable knowledge graph, no per-task state files
32
+ - **SQLite brain** — queryable knowledge graph replaces markdown state files
33
+ - **Fresh context per task** — each Builder agent starts clean, quality stays consistent
29
34
  - **3K-40K tokens per feature** — 70-90% less than typical AI dev workflows
30
- - **Fresh context per task** no accumulated garbage between tasks
31
- - **Cross-session learning** — records decisions and patterns, gets cheaper over time
32
- - **Codebase indexing in <1 second** 973 files indexed in 636ms
33
- - **Graph-derived architecture** — auto-detects layers from import graph
34
- - **Cross-repo linking** — search across multiple repos with `shipfast link`
35
- - **17 MCP tools** — structured brain access, no SQL improvisation
35
+ - **Self-improving** records patterns and decisions, gets cheaper over time
36
+ - **Smart model selection** — dynamically picks haiku/sonnet/opus based on task + feedback loop
37
+ - **Domain-aware questioning** 6 domains, 20+ question templates, zero LLM cost
38
+ - **Wave-based execution** — independent tasks run in parallel, dependent tasks run sequentially
39
+ - **Cross-repo support** — link repos, search across brains, cross-repo blast radius
40
+ - **22 languages indexed** in <1 second architecture layers auto-derived from import graph
36
41
  - **Works with 14 AI coding tools** — auto-detects and installs for all
37
42
 
38
43
  ---
@@ -41,45 +46,64 @@ ShipFast fixes this with a **SQLite knowledge graph** that gives each agent fres
41
46
 
42
47
  ```bash
43
48
  npm i -g @shipfast-ai/shipfast
44
- ```
45
-
46
- Auto-detects your AI tools and installs for all of them. Then index your repo:
47
-
48
- ```bash
49
49
  cd your-project
50
50
  shipfast init
51
51
  ```
52
52
 
53
- Verify: run `/sf-help` in your AI tool.
54
-
55
- ### Staying Updated
56
-
57
- ```bash
58
- shipfast update
59
- ```
60
-
61
- Updates the package and re-detects runtimes (catches newly installed AI tools).
53
+ Auto-detects your AI tools and installs for all of them. Verify: run `/sf-help` in your AI tool.
62
54
 
63
55
  ### Terminal Commands
64
56
 
65
57
  ```bash
66
- shipfast init # Index current repo into .shipfast/brain.db
58
+ shipfast init # Index repo + auto-configure permissions (no --dangerously-skip-permissions needed)
67
59
  shipfast init --fresh # Full reindex (clears existing brain)
68
60
  shipfast link <path> # Link another repo for cross-repo search
69
61
  shipfast unlink [path] # Unlink a repo (or all)
62
+ shipfast doctor # Check brain.db health + diagnose issues
63
+ shipfast permissions # Show configured permission allowlist
70
64
  shipfast status # Show installed runtimes + brain + links
71
65
  shipfast update # Update + re-detect runtimes
72
66
  shipfast uninstall # Remove from all AI tools
73
- shipfast help # Show all commands
74
67
  ```
75
68
 
69
+ ### Permissions (Zero Prompts)
70
+
71
+ `shipfast init` auto-configures safe permission rules in `.claude/settings.json`. ShipFast operations (Read, Edit, Write, git, build, test, grep) run without permission prompts. Destructive commands (rm, curl, ssh, sudo) still require approval.
72
+
73
+ No `--dangerously-skip-permissions` needed. Run `shipfast permissions` to view the allowlist.
74
+
75
+ If auto-configured permissions don't work for your setup, you can fall back to:
76
+ ```bash
77
+ claude --dangerously-skip-permissions
78
+ ```
79
+ This skips ALL permission checks — use only in trusted environments.
80
+
76
81
  ---
77
82
 
78
83
  ## How It Works
79
84
 
80
- Already have code? `shipfast init` indexes your codebase in under 1 second — functions, types, imports, git history. All stored in a SQLite database.
85
+ ### 1. Discuss (when needed)
86
+
87
+ ```
88
+ /sf-discuss Add authentication
89
+ ```
81
90
 
82
- ### 1. Plan Phase
91
+ **Domain-aware** ambiguity detection — zero LLM tokens:
92
+
93
+ | Domain | Example Questions |
94
+ |--------|-------------------|
95
+ | **UI** | Layout density? Interaction pattern? Empty state? Responsive approach? |
96
+ | **API** | Response format? Error handling? Auth mechanism? Versioning? |
97
+ | **Database** | ORM? Migration strategy? Data access pattern? |
98
+ | **Auth** | JWT/session/OAuth? Token storage? Role model? |
99
+ | **Content** | Markdown/rich text? Tone? i18n? |
100
+ | **Infra** | Deploy target? CI/CD pipeline? |
101
+
102
+ Auto-detects domain from task keywords. Answers stored as locked decisions — never asked again, even across sessions.
103
+
104
+ **Flags**: `--batch` (group questions), `--chain` (auto-run discuss → plan → check → execute), `--assume` (auto-resolve from brain.db patterns)
105
+
106
+ ### 2. Plan
83
107
 
84
108
  ```
85
109
  /sf-plan Add Stripe billing with webhooks
@@ -87,112 +111,103 @@ Already have code? `shipfast init` indexes your codebase in under 1 second — f
87
111
 
88
112
  Spawns two agents in fresh contexts:
89
113
 
90
- **Scout** — Researches the codebase. Finds relevant files, functions, consumers. Tags findings with confidence levels: [VERIFIED], [CITED], [ASSUMED].
114
+ **Scout** — Researches the codebase. Finds relevant files, functions, consumers. Tags findings: [VERIFIED], [CITED], [ASSUMED].
91
115
 
92
- **Architect** — Creates a precise task list using goal-backward methodology. Starts from "what does done look like" and works backward to tasks. Each task has exact file paths, consumer lists, verify commands, and measurable done criteria.
116
+ **Architect** — Creates tasks using goal-backward methodology. Each task has exact file paths, consumer lists, verify commands, and done criteria. Sets dependency graph for wave grouping.
93
117
 
94
- Tasks are stored in brain.db. No PLAN.md files.
118
+ Tasks stored in brain.db.
95
119
 
96
- ### 2. Execute
120
+ ### 3. Execute
97
121
 
98
122
  ```
99
123
  /sf-do
100
124
  ```
101
125
 
102
- Reads tasks from brain.db and executes them.
126
+ **Complexity auto-detection** routes to the right workflow:
103
127
 
104
- **Trivial tasks** (fix a typo, add an import) — executes inline. No agents, no planning. ~3K tokens.
128
+ **Trivial** (fix a typo) — executes inline, no agents. ~3K tokens.
105
129
 
106
- **Medium tasks** (add a component, refactor a module) — one Builder agent with all tasks batched. ~15K tokens.
130
+ **Medium** (add a component) — one Builder agent with all tasks batched. ~15K tokens.
107
131
 
108
- **Complex tasks** (new feature across multiple files) — **per-task Builder agents with fresh context each.** No accumulated garbage between tasks. Each Builder:
132
+ **Complex** (new feature across files) — per-task Builder agents with **fresh context each**:
109
133
 
110
- 1. Reads files + greps for consumers of anything it'll change
111
- 2. Implements following existing patterns
112
- 3. Runs build/typecheck fixes errors before committing
113
- 4. Commits with conventional format
114
- 5. Updates task status in brain.db
134
+ ```
135
+ [1/6] Building: Split LocationList into layouts...
136
+ [1/6] Split LocationList (commit: a1b2c3d)
115
137
 
116
- After all tasks: Critic reviews the diff. Scribe records decisions and learnings to brain.db.
138
+ [2/6] Building: Extract RectangleTile sub-components...
139
+ [2/6] ✓ Extract RectangleTile (commit: e4f5g6h)
117
140
 
118
- ### 3. Verify
141
+ ...
119
142
 
120
- ```
121
- /sf-verify
143
+ [6/6] ✓ Extract Featured hooks (commit: m7n8o9p)
122
144
  ```
123
145
 
124
- Separate verification in fresh context:
146
+ Each Builder gets fresh context — no accumulated garbage from previous tasks. Quality stays consistent from Task 1 to Task 6.
125
147
 
126
- - **3-level artifact validation**: exists → substantive (not stubs) → wired (imported and used)
127
- - **Data flow tracing**: components receive real data, not hardcoded empty arrays
128
- - **Consumer integrity**: removed exports have zero remaining consumers
129
- - **Stub detection**: TODO, FIXME, placeholder, empty handlers, console.log, debugger
130
- - **Build verification**: runs build command, reports pass/fail
131
-
132
- Scores: PASS / PASS_WITH_WARNINGS / FAIL with specific failure details.
133
-
134
- ### 4. Discuss (when needed)
148
+ **Wave-based parallel execution:**
135
149
 
136
150
  ```
137
- /sf-discuss Add authentication
151
+ Independent tasks (no shared files) → same wave → run in parallel
152
+ Dependent tasks (shared files/imports) → separate waves → run sequentially
138
153
  ```
139
154
 
140
- Detects ambiguity before planning (zero LLM tokensrule-based):
155
+ The Architect sets the dependency graph. `groupIntoWaves()` computes waves. Independent tasks in the same wave launch simultaneously multiple Builder agents at once.
141
156
 
142
- - **WHERE**: No file paths mentioned
143
- - **WHAT**: No behavior described
144
- - **HOW**: Multiple approaches possible
145
- - **RISK**: Touches auth/payment/data
146
- - **SCOPE**: Broad request with conjunctions
157
+ **After all tasks complete:**
158
+ - **Critic** agent (fresh context) reviews the entire `git diff` — checks consumer integrity, import consistency, security
159
+ - **Scribe** agent (fresh context) records decisions + learnings to brain.db
160
+ - **Branch audit** (automatic on non-default branches) — reports MIGRATED / MISSING / SAFELY REMOVED vs default branch
147
161
 
148
- Asks 2-5 targeted questions. Stores answers as locked decisions in brain.db. Never asks the same question twice (even across sessions).
162
+ **Dynamic model selection** per agent:
149
163
 
150
- ### 5. Ship
164
+ | Condition | Model |
165
+ |-----------|-------|
166
+ | Well-known domain (2+ high-confidence learnings) | **Haiku** (cheapest) |
167
+ | Standard task | **Sonnet** (default) |
168
+ | Complex multi-area, no prior patterns | **Opus** (best reasoning) |
169
+ | Budget low (<40%) | **All Haiku** (degradation) |
170
+ | `--cheap` flag | **All Haiku** |
171
+ | `--quality` flag | **Sonnet/Opus** |
151
172
 
152
- ```
153
- /sf-ship
154
- ```
173
+ Models auto-adjust via feedback loop — tracks success/failure rates per model+domain, upgrades haiku→sonnet when failing, downgrades when consistently succeeding.
155
174
 
156
- Creates branch, generates PR description from brain.db (decisions, tasks, changes), pushes, outputs PR link.
175
+ **All execution flags**: `--tdd` (test-first), `--research` (force Scout), `--verify` (force verification), `--no-plan` (skip planning), `--discuss` (force discussion), `--cheap` (all haiku), `--quality` (sonnet/opus)
157
176
 
158
- ### 6. Repeat → Complete → Next Milestone
177
+ ### 4. Verify
159
178
 
160
179
  ```
161
- /sf-discuss Phase 2
162
- /sf-plan Phase 2: Payment webhooks
163
- /sf-do
164
180
  /sf-verify
165
- /sf-ship
166
- ...
167
- /sf-milestone complete
168
- /sf-milestone new v2.0
169
181
  ```
170
182
 
171
- Or for simple tasks, just run directly:
183
+ Fresh context verification:
172
184
 
173
- ```
174
- /sf-do fix the login bug
175
- ```
185
+ - **3-level artifact validation**: exists → substantive (not stubs) → wired (imported and used)
186
+ - **Data flow tracing**: components receive real data, not hardcoded empty arrays
187
+ - **Consumer integrity**: removed exports have zero remaining consumers
188
+ - **Stub detection**: TODO, FIXME, placeholder, empty handlers, console.log, debugger
189
+ - **Schema drift detection**: warns when ORM models change without migrations (Prisma, Drizzle, TypeORM, Django, Rails, Knex)
190
+ - **TDD sequence check**: verifies test(...) commits before feat(...) commits
191
+ - **Build verification**: runs build command, reports pass/fail
192
+ - **Branch audit**: compares changes vs default branch, flags missing migrations
176
193
 
177
- ShipFast auto-detects complexity and runs the right workflow.
194
+ Scores: **PASS** / **PASS_WITH_WARNINGS** / **FAIL** with specific details.
178
195
 
179
- ---
180
-
181
- ## Why Fresh Context Matters
196
+ ### 5. Ship
182
197
 
183
- Context rot is the #1 quality killer. As the context window fills with file reads, error messages, and previous task artifacts, Claude's output quality degrades.
198
+ ```
199
+ /sf-ship
200
+ ```
184
201
 
185
- ShipFast solves this:
202
+ Creates branch, generates PR description from brain.db (decisions, tasks, changes), pushes, outputs PR link. Runs configurable post-ship hook if set.
186
203
 
187
- | Phase | Agent | Context |
188
- |---|---|---|
189
- | Research | Scout (Haiku) | Fresh — only brain.db context |
190
- | Planning | Architect (Sonnet) | Fresh — Scout findings + brain.db |
191
- | Execution | Builder (Sonnet) × N | Fresh per task — task plan + brain.db |
192
- | Review | Critic (Haiku) | Fresh — git diff only |
193
- | Documentation | Scribe (Haiku) | Fresh — session summary |
204
+ ### 6. Workflows
194
205
 
195
- Each agent starts clean. No accumulated garbage. Quality stays consistent from first task to last.
206
+ ```
207
+ Simple: /sf-do fix the typo in header
208
+ Standard: /sf-plan add dark mode → /sf-check-plan → /sf-do → /sf-verify
209
+ Complex: /sf-project Build billing → /sf-discuss → /sf-plan → /sf-do → /sf-verify → /sf-ship
210
+ ```
196
211
 
197
212
  ---
198
213
 
@@ -202,154 +217,102 @@ All state lives in `.shipfast/brain.db`. Zero markdown files.
202
217
 
203
218
  | Table | What it stores |
204
219
  |---|---|
205
- | `nodes` | Functions, types, classes, components (auto-extracted) |
220
+ | `nodes` | Functions, types, classes, components (auto-extracted, 22 languages) |
206
221
  | `edges` | Import/call/dependency relationships + git co-change patterns |
207
- | `decisions` | Compact Q&A pairs (~40 tokens each, not ~500 like markdown) |
208
- | `learnings` | Error→fix patterns with confidence scoring |
209
- | `tasks` | Execution history with commit SHAs |
210
- | `requirements` | REQ-IDs mapped to phases for tracing |
222
+ | `decisions` | Locked Q&A pairs with domain tags (~40 tokens each) |
223
+ | `learnings` | Error→fix patterns with confidence scoring (0.0-1.0) |
224
+ | `tasks` | Execution history with commit SHAs, tokens used, duration |
225
+ | `seeds` | Forward ideas captured during work for future milestones |
226
+ | `model_performance` | Success/failure tracking per model+domain (feedback loop) |
211
227
  | `checkpoints` | Git stash refs for rollback |
212
- | `hot_files` | Most frequently changed files from git history |
228
+ | `requirements` | REQ-IDs mapped to phases for tracing |
213
229
  | `architecture` | Auto-computed layers from import graph (zero hardcoding) |
214
- | `folders` | Directory roles auto-detected from import patterns |
215
-
216
- **Incremental indexing**: only re-indexes changed files (~300ms). Deleted files auto-cleaned.
217
-
218
- **MCP Server**: brain.db is exposed as 17 structured MCP tools. LLMs call these instead of improvising SQL.
219
-
220
- ---
221
-
222
- ## Architecture Intelligence
223
-
224
- ShipFast auto-derives architecture layers from the import graph — **zero hardcoded folder patterns**. Works with any project structure, any language.
225
-
226
- **How it works**:
227
- 1. BFS from entry points (files nothing imports) assigns layer depth
228
- 2. Fuzzy import resolution handles `@/`, `~/`, and alias paths
229
- 3. Folder roles detected from aggregate import/export ratios
230
- 4. Recomputed on every `shipfast init` (instant)
231
-
232
- **What it produces**:
233
-
234
- - **Layer 0** (entry): files nothing imports — pages, routes, App.tsx
235
- - **Layer 1-N** (deeper): each layer imported by the layer above
236
- - **Leaf layer**: files that import nothing — types, constants
237
- - **Folder roles**: entry (imports many), shared (imported by many), consumer, leaf, foundation
230
+ | `folders` | Directory roles: entry, shared, consumer, leaf, foundation |
231
+ | `hot_files` | Most frequently changed files from git history |
232
+ | `config` | Token budget, model tiers, post-ship hooks, default branch |
238
233
 
239
- **Why it matters**: Scout knows which layer a file lives in. Builder knows to check upstream consumers before modifying a shared layer. Critic can detect skip-layer violations. Verifier traces data flow from entry to data source.
234
+ **Incremental indexing**: ~300ms for changed files. Deleted files auto-cleaned. Stale learnings auto-pruned.
240
235
 
241
- All exposed as MCP tools: `brain_arch_layers`, `brain_arch_folders`, `brain_arch_file`, `brain_arch_data_flow`, `brain_arch_most_connected`.
236
+ **MCP Server**: 23 structured tools for IDE integration. Commands and agents use MCP tools no raw SQL.
242
237
 
243
238
  ---
244
239
 
245
240
  ## Agents
246
241
 
247
- 5 composable agents with compressed behavioral rules.
248
-
249
- | Agent | Role | Model | Key Rules |
242
+ | Agent | Role | Default Model | Key Behaviors |
250
243
  |---|---|---|---|
251
- | **Scout** | Research | Haiku | Confidence tagging, 12-call limit, architecture mapping, consumer lists |
252
- | **Architect** | Planning | Sonnet | Goal-backward, exact file paths, consumer checks, scope prohibition, must-haves |
253
- | **Builder** | Execution | Sonnet | Impact analysis before every change, per-task build verify, 3-attempt limit, deviation tracking, threat scan |
254
- | **Critic** | Review | Haiku | 3 depths (quick/standard/deep), import graph tracing, consumer integrity check |
255
- | **Scribe** | Documentation | Haiku | Records decisions + learnings to brain.db via sqlite3, PR descriptions |
256
-
257
- ### Builder's Rule Zero
258
-
259
- Before deleting, removing, or modifying ANY function, type, or export:
244
+ | **Scout** | Research | Haiku | 6-direction flow tracing, confidence tagging, consumer discovery |
245
+ | **Architect** | Planning | Sonnet (Opus for complex) | Goal-backward, dependency graph, STRIDE threats, scope guard |
246
+ | **Builder** | Execution | Sonnet (Haiku if learned) | Impact analysis before every change, per-task build verify, 3-attempt limit |
247
+ | **Critic** | Review | Haiku (Sonnet for security) | Auto-depth (quick/standard/deep), import graph tracing, consumer integrity |
248
+ | **Scribe** | Documentation | Haiku | Records decisions + learnings to brain.db, generates PR descriptions |
260
249
 
261
- ```bash
262
- grep -r "functionName" --include="*.ts" --include="*.tsx" .
263
- ```
264
-
265
- If other files use it → update them or keep it. **NEVER remove without checking consumers.** This single rule prevents 80% of refactoring bugs.
250
+ Models are **dynamically selected** — not fixed. The feedback loop tracks which model succeeds for which domain and auto-adjusts.
266
251
 
267
252
  ---
268
253
 
269
254
  ## Commands
270
255
 
271
- ### Core Workflow
272
-
273
- | Command | What it does |
274
- |---|---|
275
- | `/sf-do <task>` | Execute a task. Auto-detects complexity: trivial → medium → complex |
276
- | `/sf-plan <task>` | Research (Scout) + Plan (Architect). Stores tasks in brain.db |
277
- | `/sf-check-plan` | Verify plan before execution: scope, consumers, deps, STRIDE threats |
278
- | `/sf-verify` | Verify completed work: artifacts, data flow, stubs, build, consumers |
279
- | `/sf-discuss <task>` | Detect ambiguity, ask targeted questions, lock decisions |
280
-
281
- ### Projects
256
+ ### Core
282
257
 
283
258
  | Command | What it does |
284
259
  |---|---|
285
- | `/sf-project <desc>` | Decompose large project into phases with REQ-ID tracing + 4 parallel researchers |
286
- | `/sf-milestone [complete\|new]` | Complete current milestone or start next version |
287
- | `/sf-workstream <action>` | Parallel feature branches: create, list, switch, complete |
260
+ | `/sf-do <task>` | The one command. Auto-detects complexity, runs the right workflow. |
261
+ | `/sf-plan <task>` | Research (Scout) + Plan (Architect). Stores tasks in brain.db. |
262
+ | `/sf-discuss <task>` | Domain-aware questioning. 6 domains, 20+ templates, zero LLM cost. |
263
+ | `/sf-check-plan` | Validate plan: scope, consumers, dependencies, STRIDE threats. |
264
+ | `/sf-verify` | Verify: artifacts, data flow, stubs, schema drift, build, consumers. |
288
265
 
289
- ### Shipping
266
+ ### Projects & Worktrees
290
267
 
291
268
  | Command | What it does |
292
269
  |---|---|
293
- | `/sf-ship` | Create branch, push, output PR link with auto-generated description |
270
+ | `/sf-project <desc>` | Decompose large project into phases with REQ-ID tracing. |
271
+ | `/sf-milestone` | Complete current milestone or start next version. |
272
+ | `/sf-worktree create` | Create isolated worktree with smart branch naming + multi-repo support. |
273
+ | `/sf-worktree check` | Migration audit: MIGRATED / MISSING / SAFELY REMOVED / MODIFIED / ADDED. |
274
+ | `/sf-worktree list\|switch\|status\|complete` | Manage parallel worktrees. |
294
275
 
295
- ### Session
276
+ ### Shipping & Session
296
277
 
297
278
  | Command | What it does |
298
279
  |---|---|
299
- | `/sf-status` | Show brain stats, tasks, checkpoints, version |
300
- | `/sf-resume` | Resume from previous session (loads state from brain.db) |
301
- | `/sf-undo [task-id]` | Rollback a completed task via git revert |
280
+ | `/sf-ship` | Create branch, push, PR link + post-ship hook. |
281
+ | `/sf-status` | Brain stats, tasks, checkpoints, version. |
282
+ | `/sf-resume` | Resume from previous session. |
283
+ | `/sf-undo [task-id]` | Rollback a specific task. |
284
+ | `/sf-rollback [last\|all\|N]` | Rollback last task, last N, or entire session. |
302
285
 
303
- ### Knowledge
286
+ ### Knowledge & Analysis
304
287
 
305
288
  | Command | What it does |
306
289
  |---|---|
307
- | `/sf-brain <query>` | Query knowledge graph: files, decisions, learnings, hot files |
308
- | `/sf-learn <pattern>` | Teach a reusable pattern (persists across sessions) |
309
- | `/sf-map` | Generate codebase report: architecture layers, hot files, co-change clusters |
290
+ | `/sf-brain <query>` | Query knowledge graph: files, decisions, learnings, seeds, hot files. |
291
+ | `/sf-learn <pattern>` | Teach a reusable pattern (persists across sessions). |
292
+ | `/sf-map` | Codebase report: architecture layers, hot files, co-change clusters. |
293
+ | `/sf-cost` | Token usage breakdown by agent, domain, model + success rates. |
294
+ | `/sf-diff` | Smart diff — changes grouped by task with file stats. |
310
295
 
311
296
  ### Config
312
297
 
313
298
  | Command | What it does |
314
299
  |---|---|
315
- | `/sf-config` | View or set model tiers and preferences |
316
- | `/sf-help` | Show all commands with workflows |
317
-
318
- ---
319
-
320
- ## Workflows
321
-
322
- ```
323
- Simple: /sf-do fix the typo in header
324
- Standard: /sf-plan add dark mode → /sf-check-plan → /sf-do → /sf-verify
325
- Complex: /sf-project Build billing → /sf-discuss → /sf-plan → /sf-check-plan → /sf-do → /sf-verify → /sf-ship
326
- ```
300
+ | `/sf-config` | View or set model tiers, token budget, post-ship hooks. |
301
+ | `/sf-help` | Show all commands. |
327
302
 
328
303
  ---
329
304
 
330
305
  ## Self-Improving Memory
331
306
 
332
- ShipFast gets cheaper and smarter every session:
333
-
334
- 1. **First time** doing X → full pipeline (scout + architect + builder + critic)
335
- 2. **Second time** → skip scout + architect (brain has the patterns)
336
- 3. **Third time** → skip critic too (high confidence learnings)
337
-
338
- Learnings are confidence-weighted (0.0-1.0). Boost on successful reuse. Auto-prune after 30 days of non-use. Users teach directly with `/sf-learn`.
339
-
340
- ---
307
+ ShipFast gets cheaper every session:
341
308
 
342
- ## Configuration
309
+ 1. **First time** doing X → full pipeline (scout + architect + builder + critic). ~30K tokens.
310
+ 2. **Second time** → skip scout + architect (brain has the patterns). ~15K tokens.
311
+ 3. **Third time** → skip critic too (high confidence). ~8K tokens.
343
312
 
344
- Model tiers per agent (configurable with `/sf-config`):
313
+ Learnings are confidence-weighted (0.0-1.0). Boosted on successful reuse. Auto-pruned after 30 days of non-use.
345
314
 
346
- ```
347
- Scout: haiku (reading is cheap)
348
- Architect: sonnet (planning needs reasoning)
349
- Builder: sonnet (coding needs quality)
350
- Critic: haiku (diff review is pattern matching)
351
- Scribe: haiku (writing commit msgs is simple)
352
- ```
315
+ **Seeds**: Ideas surfaced during work are captured for future milestones — not lost, not distracting.
353
316
 
354
317
  ---
355
318
 
@@ -357,9 +320,7 @@ Scribe: haiku (writing commit msgs is simple)
357
320
 
358
321
  22 languages indexed: JavaScript, TypeScript, Rust, Python, Go, Java, Kotlin, Swift, C, C++, Ruby, PHP, Dart, Elixir, Scala, Zig, Lua, R, Julia, C#, F#, Vue/Svelte/Astro.
359
322
 
360
- 50+ directories skipped (node_modules, dist, target, __pycache__, .venv, Pods, etc.) sourced from GitHub's official gitignore templates.
361
-
362
- 25+ lock files skipped (package-lock.json, Cargo.lock, poetry.lock, go.sum, etc.).
323
+ 50+ directories skipped. 25+ lock files skipped.
363
324
 
364
325
  ---
365
326
 
@@ -370,7 +331,11 @@ shipfast uninstall
370
331
  npm uninstall -g @shipfast-ai/shipfast
371
332
  ```
372
333
 
373
- Auto-detects and removes from all runtimes. Cleans settings.json hooks.
334
+ ---
335
+
336
+ ## Contributing
337
+
338
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for architecture overview, code style, and how to help.
374
339
 
375
340
  ---
376
341
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sf-architect
3
3
  description: Planning agent. Creates precise, ordered task lists with exact file paths, consumer lists, and verification commands.
4
- model: sonnet
4
+ model: sonnet # default — overridden by applyGuardrails() (may use opus for complex multi-area tasks)
5
5
  tools: Read, Glob, Grep, Bash
6
6
  ---
7
7
 
@@ -34,7 +34,7 @@ Must-haves:
34
34
  </methodology>
35
35
 
36
36
  <task_rules>
37
- ## Task Anatomy — 4 required fields (gap #13)
37
+ ## Task Anatomy — 4 required fields
38
38
 
39
39
  Every task MUST have:
40
40
 
@@ -52,7 +52,7 @@ Every task MUST have:
52
52
  </task_rules>
53
53
 
54
54
  <consumer_checking>
55
- ## CRITICAL: Consumer list per task (gap #13)
55
+ ## CRITICAL: Consumer list per task
56
56
 
57
57
  For every task that modifies/removes a function, type, selector, export, or component:
58
58
 
@@ -64,13 +64,13 @@ This prevents cascading breaks. GSD's planner embeds interface context. We list
64
64
  </consumer_checking>
65
65
 
66
66
  <ordering>
67
- ## Interface-first ordering (gap #18)
67
+ ## Interface-first ordering
68
68
 
69
69
  1. **First task**: Define types, interfaces, exports (contracts)
70
70
  2. **Middle tasks**: Implement against defined contracts
71
71
  3. **Last task**: Wire implementations to consumers
72
72
 
73
- ## Dependency ordering (gap #15)
73
+ ## Dependency ordering
74
74
 
75
75
  Tasks are ordered by dependency:
76
76
  - Task B depends on Task A if: B reads files A creates, B calls functions A implements
@@ -86,7 +86,7 @@ If tasks touch the SAME file → they MUST be sequential (not parallel).
86
86
  </ordering>
87
87
 
88
88
  <scope_guard>
89
- ## Scope reduction prohibition (gap #16)
89
+ ## Scope reduction prohibition
90
90
 
91
91
  BANNED language in task descriptions:
92
92
  - "v1", "v2", "simplified version", "hardcoded for now"
@@ -126,7 +126,7 @@ Only include for tasks that create/modify security-relevant code. Skip for pure
126
126
  </threat_model>
127
127
 
128
128
  <user_decisions>
129
- ## Honor locked decisions (gap #20)
129
+ ## Honor locked decisions
130
130
 
131
131
  If brain.db has decisions for this area:
132
132
  - User said "use library X" → task MUST use X, not alternative
package/agents/builder.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sf-builder
3
3
  description: Execution agent. Checks consumers before changing. Builds and verifies per task. Follows existing patterns exactly.
4
- model: sonnet
4
+ model: sonnet # default — overridden by applyGuardrails() (may use haiku for well-known domains)
5
5
  tools: Read, Write, Edit, Bash, Glob, Grep
6
6
  ---
7
7
 
@@ -54,16 +54,15 @@ Track every deviation: `[Tier N] Fixed: [what] in [file]`
54
54
  **Tier 4 — Architecture**: New DB tables, schema changes, library swaps, breaking APIs
55
55
  → STOP. Report: "This requires [change]. Proceed?"
56
56
 
57
- ## Scope boundary (gap #2)
57
+ ## Scope boundary
58
58
 
59
59
  Only fix issues DIRECTLY caused by your current task.
60
60
  Pre-existing problems in other files → do NOT fix. Output:
61
61
  `OUT_OF_SCOPE: [file:line] [issue]`
62
62
 
63
63
  For each out-of-scope issue, also record it as a seed for future work:
64
- ```bash
65
- sqlite3 .shipfast/brain.db "INSERT INTO seeds (idea, source_task, domain, priority) VALUES ('[improvement idea]', '[current task id]', '[domain]', 'someday');"
66
- ```
64
+
65
+ Use the `brain_seeds` MCP tool with: `{ "action": "add", "idea": "[improvement idea]", "source_task": "[current task id]", "domain": "[domain]", "priority": "someday" }`
67
66
  </deviation_tiers>
68
67
 
69
68
  <patterns>
@@ -91,11 +90,11 @@ State blocker in one sentence. Write code or report what's missing.
91
90
  - Attempt 2: Re-read relevant code, different approach
92
91
  - Attempt 3: STOP. `DEFERRED: [task] — [error] — [tried]`
93
92
 
94
- ## Auth Gate Detection (gap #11)
93
+ ## Auth Gate Detection
95
94
  401, 403, "Not authenticated", "Please login" = NOT a bug.
96
95
  STOP. Report: `AUTH_GATE: [service] needs [action]`
97
96
 
98
- ## Continuation Protocol (gap #10)
97
+ ## Continuation Protocol
99
98
  If resuming from a previous session:
100
99
  1. `git log --oneline -10` — verify previous commits exist
101
100
  2. Do NOT redo completed tasks
@@ -123,7 +122,7 @@ NEVER: `git add .`, `--no-verify`, `--force`, `git clean`, `git reset --hard`, a
123
122
  </commit_protocol>
124
123
 
125
124
  <quality_checks>
126
- ## Before EVERY commit (gap #3, #9, #12)
125
+ ## Before EVERY commit
127
126
 
128
127
  1. **Build passes** — `tsc --noEmit` / `npm run build` / `cargo check`. Fix first.
129
128
  2. **Task verify passes** — run the verify command from the plan
@@ -135,7 +134,7 @@ If stubs found: complete them or `STUB: [what's incomplete]`
135
134
  </quality_checks>
136
135
 
137
136
  <self_check>
138
- ## Before reporting done (gap #7)
137
+ ## Before reporting done
139
138
 
140
139
  1. Verify every file you claimed to create EXISTS: `[ -f path ] && echo OK || echo MISSING`
141
140
  2. Verify every commit exists: `git log --oneline -5`
@@ -145,7 +144,7 @@ Output: `SELF_CHECK: [PASSED/FAILED] [details]`
145
144
  </self_check>
146
145
 
147
146
  <threat_scan>
148
- ## Before reporting done (gap #8)
147
+ ## Threat scan before reporting done
149
148
 
150
149
  Check if your changes introduced:
151
150
  - New API endpoints not in original plan