empirical-sdd 0.20.1 → 0.20.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/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Empirical SDD
2
2
 
3
- Empirical is an agent-neutral spec-driven development engine for Codex, Claude
3
+ Empirical is an agent-neutral, spec-driven development engine for Codex, Claude
4
4
  Code, Cursor, Gemini CLI, Windsurf, and MCP clients. It turns a coding request
5
- into an exact, resumable workflow with observable contracts, evidence, review,
6
- living capability specifications, and safe Git worktree isolation.
5
+ into a durable contract, exact workflow revisions, verification evidence,
6
+ review, and living capability specifications.
7
7
 
8
- Empirical `0.20.1` is an alpha release. It uses one active feature per checkout
9
- and real Git worktrees for parallel work.
8
+ Empirical `0.20.2` is an alpha release. It supports one active feature per
9
+ checkout and uses real Git worktrees for isolated parallel work.
10
10
 
11
11
  ## Install
12
12
 
@@ -15,17 +15,26 @@ npm install -g empirical-sdd
15
15
  empirical install
16
16
  ```
17
17
 
18
- `empirical install` opens a multi-select list of every supported coding agent.
19
- Detected agents and existing Empirical installations are labeled and selected
20
- by default. Use the arrow keys to move, Space to select, `a` to toggle all, and
21
- Enter to install.
18
+ `empirical install` opens a multi-select list of supported coding agents.
19
+ Detected agents and existing managed installations are selected by default.
20
+ Use Up/Down, Space, `a`, and Enter to submit the exact selection.
22
21
 
23
- The selection is exact: Empirical installs one global entrypoint in every
24
- selected agent and removes only Empirical-managed entrypoints from agents you
25
- deselect. Unmanaged files are never overwritten or deleted. The installer works
26
- from any directory and neither creates repository state nor launches an agent.
22
+ Every selected agent receives five global skills:
27
23
 
28
- For scripts and unattended setup, choose agents explicitly:
24
+ | Intent | Skill |
25
+ | --- | --- |
26
+ | Automatic setup, routing, and execution | `empirical` |
27
+ | Initialize or repair this repository only | `empirical-init` |
28
+ | Draft a concrete specification and stop | `empirical-spec` |
29
+ | Run the five-pass interview, draft, and stop | `empirical-socratic` |
30
+ | Resume the approved specification to completion | `empirical-loop` |
31
+
32
+ The installer removes only marker-owned Empirical skills from agents you
33
+ deselect. It preserves unmanaged files, directories, symbolic links, and
34
+ unrelated settings. It works from any directory and does not create repository
35
+ state or launch an agent.
36
+
37
+ For unattended installation:
29
38
 
30
39
  ```bash
31
40
  # Exact selection; repeat -a/--agent
@@ -38,66 +47,75 @@ empirical install --all
38
47
  empirical install --yes
39
48
  ```
40
49
 
41
- Then open your repository in a coding agent and use its one Empirical entrypoint:
50
+ Restart or reload the selected agent after installation. Native invocations are:
42
51
 
43
- | Agent | Invocation |
44
- | --- | --- |
45
- | Codex | `$empirical` |
46
- | Claude Code | `/empirical` |
47
- | Cursor Agent chat | `empirical` |
48
- | Gemini CLI | `empirical` |
49
- | Windsurf Cascade | `@empirical` |
52
+ | Agent | Automatic | Init | Spec | Socratic | Loop |
53
+ | --- | --- | --- | --- | --- | --- |
54
+ | Codex | `$empirical` | `$empirical-init` | `$empirical-spec` | `$empirical-socratic` | `$empirical-loop` |
55
+ | Claude Code | `/empirical` | `/empirical-init` | `/empirical-spec` | `/empirical-socratic` | `/empirical-loop` |
56
+ | Cursor Agent | `empirical` | `empirical-init` | `empirical-spec` | `empirical-socratic` | `empirical-loop` |
57
+ | Gemini CLI | `empirical` | `empirical-init` | `empirical-spec` | `empirical-socratic` | `empirical-loop` |
58
+ | Windsurf Cascade | `@empirical` | `@empirical-init` | `@empirical-spec` | `@empirical-socratic` | `@empirical-loop` |
50
59
 
51
- To upgrade both the package and installed entrypoints:
60
+ To upgrade the package and refresh every selected skill:
52
61
 
53
62
  ```bash
54
63
  empirical update
55
64
  ```
56
65
 
57
66
  `empirical install` and `empirical update` are the entire public terminal CLI.
58
- Repository setup and feature work happen inside the current coding agent; old
59
- terminal verbs such as `init`, `config`, `explore`, `fast`, `complex`, and
60
- `loop` are rejected.
61
-
62
- ## One entrypoint owns the workflow
67
+ Init, Spec, Socratic, and Loop are coding-agent skills, not shell commands.
68
+ Internal workflow operations remain available to installed skills through MCP
69
+ and a private compatibility transport.
63
70
 
64
- Ask the installed Empirical entrypoint for repository work in ordinary language.
65
- It deterministically:
71
+ ## Choose automatic or deliberate mode
66
72
 
67
- 1. initializes an uninitialized repository in the current runtime;
68
- 2. builds or refreshes compact repository knowledge;
69
- 3. resumes non-terminal work already owned by this checkout;
70
- 4. uses the original five-pass Socratic interview only when the request is
71
- genuinely vague;
72
- 5. routes an approved, concrete request internally to Fast or Complex;
73
- 6. executes exact revisions through evidence, review, and living-spec archive;
74
- 7. offers an explicit agent handoff only after a Complex specification exists.
73
+ Both modes use the same state machine, artifacts, evidence gates, and safety
74
+ rules.
75
75
 
76
76
  ```text
77
- one Empirical invocation
78
-
79
- ├─ repository uninitialized ──> first-run setup + compact context
80
- ├─ active feature found ──────> resume exact revision
81
- └─ new request
82
- ├─ genuinely vague ────> five Socratic passes ──> approval
83
- └─ concrete ───────────> internal Fast / Complex routing
84
-
85
- approved Complex spec exists?
86
-
87
- Continue here | Save | Continue in agent
77
+ Automatic
78
+ empirical request
79
+ └─ setup/repair resume or discover/route execute → verify → review → done
80
+
81
+ Deliberate SDD
82
+ empirical-init
83
+ └─ empirical-spec request ──────────────┐
84
+ └─ empirical-socratic idea → interview ├─ review contract → empirical-loop → done
85
+
88
86
  ```
89
87
 
90
- Fast is only for explicit, tiny, localized, reversible, low-risk, non-UI work.
91
- Everything else—including UI, architecture, public APIs, security, migrations,
92
- and cross-cutting changes—uses Complex.
88
+ Use `empirical` when you want the agent to choose the right path and keep going.
89
+ Use the explicit skills when you want to inspect the specification before any
90
+ implementation begins. Fast and Complex are internal profiles; users do not
91
+ need separate skills for them.
92
+
93
+ ## Initialize a repository
94
+
95
+ Inside the repository, invoke the Init skill in your coding agent. For Codex:
96
+
97
+ > `$empirical-init`
98
+
99
+ Init inspects manifests, documentation, source, tests, Git state, existing
100
+ Empirical configuration, and living capabilities. It asks one focused question
101
+ at a time only when the answer changes:
93
102
 
94
- ## First use and repository knowledge
103
+ - whether unrelated active work should use a sibling Git worktree;
104
+ - the base branch, worktree path, and branch pattern;
105
+ - whether Complex decisions require reviewable decision records.
95
106
 
96
- On first use, the agent initializes `.empirical/`. It applies safe defaults or
97
- asks only questions that materially change Git isolation or Complex decision
98
- policy. It does not install project-local workflow skills.
107
+ It then creates or repairs `.empirical/`, installs repository MCP bridges,
108
+ refreshes compact context, confirms `setupComplete: true`, and stops. It does not
109
+ create a feature or specification.
99
110
 
100
- Initialization also creates a compact, committed context set:
111
+ You can skip explicit Init and invoke `$empirical` directly; the automatic skill
112
+ performs the same preflight first. A partial schema-4 repository—such as one with
113
+ `setupComplete: false` or missing `.empirical/context/`—is repaired rather than
114
+ mistaken for a complete setup. Marker-owned old project-local skills are removed
115
+ so they cannot shadow global updates; unmanaged collisions are preserved and
116
+ reported.
117
+
118
+ Initialization creates:
101
119
 
102
120
  ```text
103
121
  .empirical/context/
@@ -109,119 +127,135 @@ Initialization also creates a compact, committed context set:
109
127
  └── conventions.md
110
128
  ```
111
129
 
112
- The deterministic manifest contains bounded path, size, and content-digest
113
- metadata—not source contents. Dependency trees, build output, ignored files,
114
- secret-like paths, credentials, binary files, and large files are excluded.
115
- Topic pages are maintained from repository evidence and are not overwritten by
116
- a routine refresh. There are no embeddings, hosted services, or vector database.
130
+ The deterministic manifest contains bounded path, size, and digest metadata,
131
+ not source contents. Dependencies, build output, ignored files, secret-like
132
+ paths, credentials, binaries, and large files are excluded. There are no
133
+ embeddings, hosted RAG services, or vector databases.
134
+
135
+ ## Explicit Spec: a small concrete feature
136
+
137
+ In Codex:
138
+
139
+ > `$empirical-spec` Add a keyboard shortcut that opens the existing command
140
+ > palette with Cmd/Ctrl+K. Do not change the palette design.
141
+
142
+ Spec ensures the repository is initialized, starts internal Complex Specify,
143
+ inspects the relevant code and living capabilities, and writes observable
144
+ acceptance criteria, scope, non-goals, risks, verification, and capability
145
+ deltas. It then stops. No implementation code is written and the pending
146
+ Specify revision is not completed.
147
+
148
+ Review the files under `.empirical/specs/<feature>/`. When the contract is right:
149
+
150
+ > `$empirical-loop`
151
+
152
+ That invocation is explicit approval to complete Specify and continue through
153
+ Design, Plan, Implement, Verify, Review, and Archive.
117
154
 
118
- ## Socratic discovery
155
+ ## Explicit Socratic: a complex or vague feature
119
156
 
120
- For a vague idea such as “make onboarding better,” Empirical asks one question
121
- at a time across five passes:
157
+ In Codex:
158
+
159
+ > `$empirical-socratic` Build a team notification center that works well across
160
+ > desktop and mobile.
161
+
162
+ Socratic asks one question at a time across the original five passes:
122
163
 
123
164
  1. primary user and observed problem;
124
165
  2. smallest observable outcome;
125
166
  3. boundaries, constraints, and explicit non-goals;
126
- 4. failures and solution-changing risks;
167
+ 4. failure behavior and solution-changing risks;
127
168
  5. concrete verification.
128
169
 
129
- It adds only material follow-ups, saves the answers, presents the complete
130
- refined contract, and waits for explicit approval before creating workflow
131
- state. A concrete request does not pay this discovery cost.
170
+ It reflects each answer, asks only a material follow-up, and saves progress after
171
+ every pass. After all five, it displays one exact refined request. Rejecting or
172
+ saving creates no workflow state. Approving binds that exact request to Complex
173
+ Specify, drafts the specification and capability deltas, and stops again for
174
+ contract review.
132
175
 
133
- ## Small feature demo
176
+ After reviewing the draft:
134
177
 
135
- In your coding agent:
136
-
137
- > `$empirical` Add a health command that prints `ok`.
178
+ > `$empirical-loop`
138
179
 
139
- Empirical recognizes an explicit, localized, low-risk non-UI change and routes
140
- it internally to Fast. The agent inspects only relevant files, implements the
141
- generated observable criterion, runs one focused test, reviews the diff, and
142
- completes the exact revision. The durable result is:
180
+ ## Automatic demos
143
181
 
144
- ```text
145
- .empirical/specs/add-a-health-command-that-prints-ok/
146
- ├── spec.md
147
- ├── state.json
148
- ├── events/
149
- └── evidence.json
150
- ```
182
+ For a tiny, localized, reversible, low-risk, non-UI change:
151
183
 
152
- You do not choose or invoke a separate Fast command.
184
+ > `$empirical` Add a health command that prints `ok`.
153
185
 
154
- ## Complex feature demo
186
+ Empirical routes internally to Fast, implements the criterion, runs focused
187
+ tests, reviews the diff, and completes the exact revision.
155
188
 
156
- In your coding agent:
189
+ For a substantial feature:
157
190
 
158
191
  > `$empirical` Add team invitations with expiration, revocation, and audit
159
192
  > history. Existing members must keep access during rollout.
160
193
 
161
- Empirical routes the request to Complex and drives seven gates:
194
+ Empirical routes to Complex and drives seven gates:
162
195
 
163
- 1. Specify observable criteria, scope, risks, verification, and capability
164
- deltas.
165
- 2. Design the architecture and record accepted evidence-backed decisions.
196
+ 1. Specify observable behavior and capability deltas.
197
+ 2. Design the solution and record accepted evidence-backed decisions.
166
198
  3. Plan an executable implementation sequence.
167
199
  4. Implement the approved contract.
168
- 5. Verify every criterion; UI work requires real-browser evidence.
169
- 6. Review the diff against criteria and accepted decisions.
200
+ 5. Verify every criterion; UI work requires real-browser and screenshot evidence.
201
+ 6. Review the diff against criteria and decisions.
170
202
  7. Archive reviewed deltas into living capability specifications.
171
203
 
172
- After Specify passes, the agent offers:
204
+ For a genuinely vague automatic request, Empirical uses the same durable
205
+ five-pass Socratic operation before routing. A concrete request does not pay that
206
+ discovery cost.
173
207
 
174
- - Continue here.
175
- - Save for later.
176
- - Continue in a detected agent.
208
+ ## Resume safely with Loop
209
+
210
+ `empirical-loop` takes no new feature request. It asks Empirical for the selected
211
+ action, completes its exact revision with required artifacts and evidence, and
212
+ continues until Done, Blocked, or Awaiting Human.
213
+
214
+ If no feature is selected, Loop creates nothing and points to Automatic, Spec,
215
+ or Socratic. Attached text never replaces active work. If another feature is
216
+ already active, starting unrelated work returns a read-only worktree proposal
217
+ instead of overwriting state.
177
218
 
178
- For an external handoff, Empirical displays the target, whether it accepts a
179
- prompt or only a workspace, the exact working directory, and exact argument
180
- array. Detection and Save launch nothing. The command is revalidated and
181
- authorized only after you explicitly approve that exact option.
219
+ ## Worktrees and agent handoff
182
220
 
183
- Decision records store reviewable evidence, options, the selected approach,
184
- trade-offs, risks, and verification—not private chain-of-thought, prompts,
185
- scratchpads, tokens, or credentials.
221
+ An isolation proposal shows its base and immutable base commit, branch, sibling
222
+ path, exact Git argument array, and approval token. Empirical waits for explicit
223
+ approval, requires a clean source checkout, revalidates every field, rejects
224
+ collisions, and creates the linked checkout without force. It never stashes,
225
+ commits, moves local changes, deletes worktrees, or deletes branches.
186
226
 
187
- ## Parallel work uses Git worktrees
227
+ After a Complex specification passes, Automatic or Loop offers:
188
228
 
189
- If a different feature is active, the single entrypoint returns a read-only
190
- worktree proposal instead of overwriting state. It shows the base and immutable
191
- base commit, branch, sibling path, exact Git argument array, and approval token.
229
+ - Continue here.
230
+ - Save for later.
231
+ - Continue in a detected agent.
192
232
 
193
- After explicit approval Empirical requires a clean source checkout, revalidates
194
- every field, rejects collisions, creates the linked checkout without force, and
195
- starts the exact request there. It never stashes, commits, moves local changes,
196
- deletes worktrees, or deletes branches.
233
+ Detection and Save launch nothing. Before external handoff, Empirical displays
234
+ the agent, its prompt/workspace capability, cwd, and exact argv; it authorizes
235
+ only the unchanged option after explicit approval.
197
236
 
198
- Active selection lives in checkout-local Git metadata while portable feature
199
- contracts remain committed under `.empirical/specs/`. A linked checkout therefore
200
- does not accidentally inherit a blocked feature owned by another checkout.
237
+ Active selection lives in checkout-local Git metadata. Portable feature
238
+ contracts remain under `.empirical/specs/`, so a linked checkout does not inherit
239
+ a blocked feature owned by another checkout.
201
240
 
202
241
  ## Internal automation API
203
242
 
204
- The TypeScript API and MCP tools remain available for agent runtimes and
205
- programmatic integrations. They include setup, context refresh, discovery,
206
- Fast/Complex routing, resume, exact completion, verification, review, archive,
207
- status/explain, handoff, capability projection, and worktree proposal/creation.
208
- They are automation primitives, not additional user-facing terminal commands.
209
-
210
- The stdio MCP server exposes these groups:
211
-
212
- - setup/context: `empirical_init`, `empirical_adopt`, `empirical_configure`,
213
- `empirical_context`;
214
- - routing/workflow: `empirical_explore`, `empirical_fast`,
215
- `empirical_complex`, `empirical_loop`, `empirical_next`,
216
- `empirical_complete`, `empirical_retry`, `empirical_verify`,
217
- `empirical_archive`;
218
- - handoff/isolation: `empirical_handoff`, `empirical_worktree_propose`,
219
- `empirical_worktree_create`;
220
- - understanding: `empirical_explain`, `empirical_status`,
243
+ The TypeScript API and MCP server expose the primitives used by installed
244
+ skills. They are not additional public terminal commands.
245
+
246
+ - Setup/context: `empirical_init`, `empirical_adopt`, `empirical_configure`,
247
+ `empirical_context`.
248
+ - Discovery/routing: `empirical_explore`, `empirical_discovery`,
249
+ `empirical_fast`, `empirical_complex`.
250
+ - Workflow: `empirical_loop`, `empirical_next`, `empirical_complete`,
251
+ `empirical_retry`, `empirical_verify`, `empirical_archive`.
252
+ - Handoff/isolation: `empirical_handoff`, `empirical_worktree_propose`,
253
+ `empirical_worktree_create`.
254
+ - Understanding: `empirical_explain`, `empirical_status`,
221
255
  `empirical_capabilities`, `empirical_policy`, `empirical_doctor`.
222
256
 
223
- Only explicitly approved worktree creation mutates Git. Agent handoff returns an
224
- approval-bound command but never launches it itself.
257
+ Generated skills use MCP first and `empirical __internal` only as a private
258
+ fallback when MCP is unavailable. Humans should not invoke that namespace.
225
259
 
226
260
  ## Committed layout
227
261
 
@@ -246,28 +280,26 @@ approval-bound command but never launches it itself.
246
280
  └── evidence.json
247
281
  ```
248
282
 
249
- Feature contracts, journals, context, capability specs, configuration, and
250
- policy are committed. The checkout's selected feature is stored in its own Git
251
- metadata and is not shared across linked worktrees.
283
+ Specifications, decisions, journals, context, capabilities, configuration, and
284
+ policy are durable, reviewable state. Decision records contain evidence,
285
+ options, the chosen approach, trade-offs, risks, and verification—not private
286
+ chain-of-thought, prompts, tokens, credentials, or scratchpads.
252
287
 
253
- ## Migration and the 0.20 alpha
288
+ ## Migration and development
254
289
 
255
- Running the installer again is the migration: it removes only marker-owned old
256
- global and project-local Empirical workflow artifacts, preserves unmanaged
257
- content and existing runtime configuration, and converges without unnecessary
258
- second-run changes. Existing schema-4 projects and discovery records remain
259
- readable.
290
+ Running `empirical install` again migrates global integrations. Repository Init
291
+ removes only marker-owned old local skills and repairs partial setup. Both
292
+ operations converge, preserve unmanaged content, and keep schema-4 projects and
293
+ discovery records readable.
260
294
 
261
- Schema-1, schema-2, and schema-3 default root state migrates idempotently into
262
- the matching feature directory. Historical alternate parallel-state data is
263
- left untouched and unsupported.
295
+ Schema-1 through schema-3 root state migrates idempotently into feature-local
296
+ state. Empirical v1 `ai/` adoption remains available through agent automation.
264
297
 
265
- See [migration details](docs/migration-v1.md), the [architecture](docs/architecture.md),
266
- the [MCP guide](docs/mcp.md), the [security model](docs/security.md), and the
298
+ See [migration details](docs/migration-v1.md), the
299
+ [architecture](docs/architecture.md), [MCP guide](docs/mcp.md),
300
+ [security model](docs/security.md), [demos](docs/demo.md), and
267
301
  [OpenSpec comparison](docs/openspec-comparison.md).
268
302
 
269
- ## Development
270
-
271
303
  ```bash
272
304
  bun install
273
305
  bun run ci