ultra-builder-pro-cli 0.11.0 → 0.12.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.
- package/.ultra-template/specs/architecture.md +54 -223
- package/.ultra-template/specs/discovery.md +34 -231
- package/.ultra-template/specs/product.md +44 -200
- package/.ultra-template/tasks/contexts/TEMPLATE.md +36 -0
- package/.ultra-template/tasks/tasks.json +6 -0
- package/CHANGELOG.md +42 -1
- package/README.md +21 -9
- package/adapters/_shared/codex-assets.cjs +1 -1
- package/adapters/_shared/handbook.cjs +4 -3
- package/adapters/_shared/tests/handbook.test.cjs +4 -0
- package/adapters/opencode.js +8 -2
- package/adapters/tests/codex.test.cjs +2 -2
- package/adapters/tests/kimi-hook.test.cjs +1 -1
- package/adapters/tests/opencode.test.cjs +36 -1
- package/commands/ultra-init.md +3 -3
- package/docs/AGENT-CONTEXT.md +16 -8
- package/docs/ARCHITECTURE.md +32 -5
- package/docs/PLAN.zh-CN.md +7 -5
- package/docs/ROADMAP.md +4 -2
- package/docs/RUNTIME-COMPAT-MATRIX.md +8 -5
- package/docs/STATE-DB-ACCESS-POLICY.md +17 -11
- package/docs/USER-HANDBOOK-CONTRACT.md +8 -5
- package/hooks/README.md +4 -3
- package/hooks/adapters/codex.py +1 -1
- package/hooks/adapters/kimi.py +1 -1
- package/hooks/context_spine.py +120 -16
- package/hooks/health_check.py +11 -0
- package/hooks/pre_stop_check.py +6 -5
- package/mcp-server/lib/baseline-workflow.cjs +415 -0
- package/mcp-server/lib/baseline-workflow.test.cjs +225 -0
- package/mcp-server/lib/change-workflow.cjs +24 -27
- package/mcp-server/lib/change-workflow.test.cjs +202 -6
- package/mcp-server/lib/context-spine.cjs +74 -9
- package/mcp-server/lib/context-spine.test.cjs +15 -0
- package/mcp-server/lib/doctor.cjs +14 -0
- package/mcp-server/lib/doctor.test.cjs +25 -1
- package/mcp-server/lib/init-project.cjs +49 -14
- package/mcp-server/lib/provider-refs.cjs +42 -0
- package/mcp-server/lib/spec-learning.test.cjs +5 -0
- package/mcp-server/lib/state-db.cjs +63 -4
- package/mcp-server/lib/state-db.test.cjs +8 -3
- package/mcp-server/server.cjs +48 -3
- package/mcp-server/tests/init-project.test.cjs +54 -8
- package/mcp-server/tests/server-contract.test.cjs +99 -2
- package/mcp-server/tests/state-db.test.cjs +11 -2
- package/package.json +1 -1
- package/skills/ultra-change/SKILL.md +24 -13
- package/skills/ultra-deliver/SKILL.md +15 -5
- package/skills/ultra-dev/SKILL.md +4 -0
- package/skills/ultra-doctor/SKILL.md +8 -2
- package/skills/ultra-init/SKILL.md +46 -50
- package/skills/ultra-init/references/brownfield-adoption.md +65 -0
- package/skills/ultra-plan/SKILL.md +9 -2
- package/skills/ultra-research/SKILL.md +10 -5
- package/skills/ultra-status/SKILL.md +13 -6
- package/spec/cli-protocol.md +4 -0
- package/spec/mcp-tools.yaml +223 -4
- package/spec/schemas/mcp-tools.schema.json +1 -1
- package/spec/schemas/state-db.sql +33 -2
- package/ultra-tools/commands/status.cjs +20 -2
- package/ultra-tools/commands/task.cjs +4 -1
- package/ultra-tools/status-command.test.cjs +20 -0
- package/ultra-tools/system-command.test.cjs +5 -0
|
@@ -1,70 +1,66 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ultra-init
|
|
3
|
-
description: Initialize
|
|
3
|
+
description: Initialize Ultra Builder Pro or resume greenfield and brownfield baseline adoption. Use when a repository lacks Ultra state or its project baseline is missing, draft, adopting, or blocked.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Initialize
|
|
6
|
+
# Initialize or adopt a project
|
|
7
7
|
|
|
8
|
-
Create
|
|
9
|
-
|
|
8
|
+
Create project-local Ultra state, then route the repository according to its actual
|
|
9
|
+
baseline status. Do not treat an existing codebase as a new product.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Preflight
|
|
12
12
|
|
|
13
|
-
Use the current working directory unless the user names another target. Inspect
|
|
14
|
-
|
|
13
|
+
Use the current working directory unless the user names another target. Inspect the
|
|
14
|
+
root, project manifests, Git state, and `.ultra/` without mutation.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- project type;
|
|
18
|
-
- primary technologies;
|
|
19
|
-
- whether Git and `.ultra/` already exist.
|
|
16
|
+
If `.ultra/` exists, call `baseline.get` and `system.doctor`:
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
- a healthy `ready` baseline routes to `ultra-change` or `ultra-status`;
|
|
19
|
+
- `draft`, `adopting`, or baseline-blocked state resumes this workflow;
|
|
20
|
+
- state integrity or migration failure routes to `ultra-doctor`;
|
|
21
|
+
- recreation requires explicit authorization and must preserve the returned backup.
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
Never overwrite `.ultra/` merely because the repository is old or its documents are
|
|
24
|
+
incomplete.
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
2. Derive the project metadata from repository evidence. Treat user-provided values
|
|
28
|
-
as authoritative when they conflict with inference.
|
|
29
|
-
3. If `.ultra/` exists, stop and ask whether to keep it, cancel, or recreate it with
|
|
30
|
-
`overwrite: true`. Explain that recreation first preserves a timestamped backup.
|
|
31
|
-
4. Call `task.init_project` with the smallest complete input:
|
|
26
|
+
## Bootstrap
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"project_name": "example",
|
|
37
|
-
"project_type": "fullstack",
|
|
38
|
-
"stack": "react,node,postgres",
|
|
39
|
-
"overwrite": false
|
|
40
|
-
}
|
|
41
|
-
```
|
|
28
|
+
When `.ultra/` is absent, derive project name, type, and stack from repository evidence,
|
|
29
|
+
then call `task.init_project` with `mode: "auto"`. Use an explicit `greenfield` or
|
|
30
|
+
`brownfield` mode only when the user has made that classification authoritative.
|
|
42
31
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
6. If the user requested Git setup, initialize Git only when needed and add narrowly
|
|
46
|
-
scoped ignore rules. Do not stage or commit without explicit authorization.
|
|
32
|
+
Verify the returned mode, baseline id and status, state database path, initial
|
|
33
|
+
projection, and copied specification files.
|
|
47
34
|
|
|
48
|
-
|
|
49
|
-
`ultra-tools task init-project` command only when it is available. The CLI and MCP
|
|
50
|
-
must use the same initializer. Do not simulate initialization by creating projection
|
|
51
|
-
files manually.
|
|
35
|
+
## Route by mode
|
|
52
36
|
|
|
53
|
-
|
|
37
|
+
### Greenfield
|
|
38
|
+
|
|
39
|
+
The new baseline begins as `draft`. Route unresolved product or architecture intent to
|
|
40
|
+
`ultra-research`. That workflow records evidence and converges the baseline before
|
|
41
|
+
planning. Do not create implementation tasks during initialization.
|
|
42
|
+
|
|
43
|
+
### Brownfield
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
Read `references/brownfield-adoption.md` completely. Adopt current behavior from the
|
|
46
|
+
checkout, tests, maintained documentation, and runtime evidence. Use `baseline.record`
|
|
47
|
+
for the bounded snapshot and `baseline.converge` only after the owner approves the
|
|
48
|
+
captured baseline and any accepted known-red verification.
|
|
49
|
+
|
|
50
|
+
## Failure handling
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
- `ULTRA_DIR_EXISTS`: inspect and resume; do not retry with overwrite automatically.
|
|
53
|
+
- `BASELINE_EXISTS`: keep the ready baseline unless explicit re-adoption is required.
|
|
54
|
+
- `BASELINE_IN_PROGRESS`: resume the named baseline rather than creating another.
|
|
55
|
+
- `TEMPLATE_MISSING`: report a package-integrity failure and route to installer doctor.
|
|
56
|
+
- `TARGET_NOT_DIR`, `VALIDATION_ERROR`, or `IO_ERROR`: correct only the evidenced input;
|
|
57
|
+
preserve any backup and partial diagnostic.
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
projections or workflow artifacts and must not be edited to create state.
|
|
59
|
+
## Output
|
|
64
60
|
|
|
65
|
-
Report
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
Report target path, detected mode, baseline id/status/revision, state health, known-red
|
|
62
|
+
verification, blocking unknowns, and one next action. `.ultra/state.db` is authoritative;
|
|
63
|
+
JSON and Markdown projections do not create state.
|
|
68
64
|
|
|
69
|
-
Do not
|
|
70
|
-
of initialization.
|
|
65
|
+
Do not browse by default, invent missing behavior, rewrite application code, create
|
|
66
|
+
business tasks, stage files, or commit as part of initialization.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Brownfield adoption
|
|
2
|
+
|
|
3
|
+
Use this procedure only after `task.init_project` selects `brownfield`, or when an
|
|
4
|
+
existing baseline remains `adopting` or `blocked`.
|
|
5
|
+
|
|
6
|
+
## Establish the snapshot boundary
|
|
7
|
+
|
|
8
|
+
Bind the repository root, current Git HEAD when available, included paths, excluded
|
|
9
|
+
generated or vendored paths, project manifests, and the user-visible or public seams.
|
|
10
|
+
Use the revision returned by `baseline.record`; non-Git projects receive a deterministic
|
|
11
|
+
workspace revision from the recorded evidence.
|
|
12
|
+
|
|
13
|
+
## Read current behavior
|
|
14
|
+
|
|
15
|
+
Inspect only the evidence needed to explain the maintained system:
|
|
16
|
+
|
|
17
|
+
- entry points and consumers;
|
|
18
|
+
- persisted state and its writers;
|
|
19
|
+
- external interfaces, events, permissions, and failure paths;
|
|
20
|
+
- tests and their live seams;
|
|
21
|
+
- deployment, migration, and recovery paths when present;
|
|
22
|
+
- maintained documents and their relationship to source.
|
|
23
|
+
|
|
24
|
+
Classify every statement as observed, verified, decided, or unknown. Source and runtime
|
|
25
|
+
evidence outrank stale prose. External memory and code-graph providers may supply
|
|
26
|
+
references, but their content remains outside Ultra state.
|
|
27
|
+
|
|
28
|
+
## Capture the baseline
|
|
29
|
+
|
|
30
|
+
Update `.ultra/specs/product.md` with confirmed behavior, actors, entry points, failures,
|
|
31
|
+
and acceptance. Update `.ultra/specs/architecture.md` with actual boundaries, authority,
|
|
32
|
+
runtime paths, dependencies, permissions, and recovery. Use `discovery.md` only for
|
|
33
|
+
evidence or decisions that affect scope.
|
|
34
|
+
|
|
35
|
+
Do not redesign the project, normalize it to a preferred architecture, manufacture
|
|
36
|
+
personas or alternatives, or convert every source file into documentation.
|
|
37
|
+
|
|
38
|
+
Run the repository's existing verification commands. Record each result as `pass`,
|
|
39
|
+
`known_red`, or `not_run`. A known-red item needs evidence and a rationale; a missing
|
|
40
|
+
command is not a passing result. Mark an unknown blocking when it can change accepted
|
|
41
|
+
behavior, authority, security, data integrity, or the next implementation plan.
|
|
42
|
+
|
|
43
|
+
Call `baseline.record` with full replacement arrays for:
|
|
44
|
+
|
|
45
|
+
- scope and repository revision;
|
|
46
|
+
- product and architecture specification paths;
|
|
47
|
+
- bounded source, documentation, runtime, test, deployment, or external references;
|
|
48
|
+
- verification results;
|
|
49
|
+
- blocking and non-blocking unknowns;
|
|
50
|
+
- external provider metadata references, when supplied.
|
|
51
|
+
|
|
52
|
+
The server computes specification digests. Do not send prompt, transcript, memory, or
|
|
53
|
+
code-graph payloads.
|
|
54
|
+
|
|
55
|
+
## Converge
|
|
56
|
+
|
|
57
|
+
Present the observed behavior, known-red verification, blocking unknowns, and material
|
|
58
|
+
decisions to the project owner. After explicit approval, call `baseline.converge` with
|
|
59
|
+
the recorded revision, approver, approval note, and `accept_known_red` only when the
|
|
60
|
+
owner accepted those failures.
|
|
61
|
+
|
|
62
|
+
Resolve returned blockers through evidence or an owner decision, record the replacement
|
|
63
|
+
snapshot, and retry. Adoption is complete only when `baseline.get` and `system.doctor`
|
|
64
|
+
report the baseline ready and current. Route the first new outcome to `ultra-change`, or
|
|
65
|
+
route planning of already accepted work to `ultra-plan`.
|
|
@@ -13,6 +13,11 @@ Markdown are generated projections.
|
|
|
13
13
|
|
|
14
14
|
Start with a state-backed MCP read. If state or schema health blocks access, stop and
|
|
15
15
|
route to `ultra-doctor`. Never read or write `.ultra/tasks/tasks.json` as a fallback.
|
|
16
|
+
Call `baseline.get`. Initial product planning is blocked until the baseline is
|
|
17
|
+
`ready` and current; route its missing, adopting, blocked, or stale state to
|
|
18
|
+
`ultra-init`. Planning an already active bounded change may continue with the
|
|
19
|
+
baseline condition recorded as a warning. Convergence still requires approved
|
|
20
|
+
adoption, and archive atomically reconciles and verifies revision/spec drift.
|
|
16
21
|
|
|
17
22
|
Choose one input:
|
|
18
23
|
|
|
@@ -30,8 +35,10 @@ current evidence. A material unresolved assumption blocks persistence.
|
|
|
30
35
|
2. Prefer a walking skeleton or `tracer_bullet` before horizontal layers.
|
|
31
36
|
3. Give each task one outcome, bounded ownership, explicit dependencies, required
|
|
32
37
|
references, and one deterministic verification command.
|
|
33
|
-
4. Use the context budget
|
|
34
|
-
|
|
38
|
+
4. Use the context budget as an attention signal. Prefer bounded excerpts, direct
|
|
39
|
+
reads, or a smaller slice, but keep necessary files when correctness requires them.
|
|
40
|
+
Budget overflow is a warning, never a reason to inflate a threshold or manufacture
|
|
41
|
+
a smaller but incomplete contract.
|
|
35
42
|
5. Add integration checkpoints at actual boundaries, not after arbitrary task counts.
|
|
36
43
|
6. Put validation, errors, recovery, documentation, and migrations in the task that
|
|
37
44
|
owns the behavior.
|
|
@@ -10,8 +10,8 @@ decision. Do not force a fixed discovery ceremony onto a well-defined change.
|
|
|
10
10
|
|
|
11
11
|
## Preflight
|
|
12
12
|
|
|
13
|
-
1. Require an initialized `.ultra/specs/` directory
|
|
14
|
-
absent.
|
|
13
|
+
1. Require an initialized `.ultra/specs/` directory and call `baseline.get`. Route to
|
|
14
|
+
`ultra-init` when state or the baseline is absent. Preserve its mode and id.
|
|
15
15
|
2. Read the current specification files and repository evidence before asking the
|
|
16
16
|
user to repeat known facts.
|
|
17
17
|
3. Define the intended deliverable, unresolved decisions, and evidence standard.
|
|
@@ -50,7 +50,12 @@ default.
|
|
|
50
50
|
open questions. Do not duplicate the same narrative across several files.
|
|
51
51
|
5. Validate cross-document consistency and trace each required behavior from problem
|
|
52
52
|
or constraint to acceptance and architecture.
|
|
53
|
-
6. Use `references/synthesis.md` for the completion check
|
|
53
|
+
6. Use `references/synthesis.md` for the completion check.
|
|
54
|
+
7. Call `baseline.record` with the complete current specification list, bounded evidence
|
|
55
|
+
references, actual verification results, provider metadata, and explicit unknowns.
|
|
56
|
+
Use the returned repository revision for convergence.
|
|
57
|
+
8. Present the baseline and any known-red verification to the owner. After explicit
|
|
58
|
+
approval, call `baseline.converge`. Resolve deterministic blockers before routing.
|
|
54
59
|
|
|
55
60
|
## Completion gate
|
|
56
61
|
|
|
@@ -59,5 +64,5 @@ material decision is recorded, required acceptance is testable, architecture res
|
|
|
59
64
|
known constraints, and unresolved items are either blocking or explicitly outside the
|
|
60
65
|
accepted scope.
|
|
61
66
|
|
|
62
|
-
Route a
|
|
63
|
-
|
|
67
|
+
Route a converged baseline to `ultra-plan`. Do not create business tasks, write raw
|
|
68
|
+
SQLite, or maintain a second condensed specification that can drift from the baseline.
|
|
@@ -12,12 +12,14 @@ authoritative; reports and Markdown are evidence or projections.
|
|
|
12
12
|
|
|
13
13
|
1. Call `system.doctor` in read-only mode. If authority is unhealthy, route only to
|
|
14
14
|
`ultra-doctor` and include the blocking diagnostic.
|
|
15
|
-
2. Call `
|
|
16
|
-
|
|
17
|
-
3. Call `
|
|
18
|
-
|
|
15
|
+
2. Call `baseline.get` for mode, lifecycle status, repository revision, specification
|
|
16
|
+
digest health, known warnings, and adoption blockers.
|
|
17
|
+
3. Call `change.breadcrumb` for the active change, task, role, gate, readiness,
|
|
18
|
+
blockers, advisory warnings, staleness, and next action.
|
|
19
|
+
4. Call `task.list` and `session.list` for progress and active execution details.
|
|
20
|
+
5. Read test and delivery reports only when present, and mark a report stale when its
|
|
19
21
|
HEAD differs from the current checkout.
|
|
20
|
-
|
|
22
|
+
6. Read Git branch, HEAD, and worktree status without mutation.
|
|
21
23
|
|
|
22
24
|
If MCP task or change state is unavailable, label that panel unavailable. Never fall
|
|
23
25
|
back to generated task JSON, context frontmatter, or raw SQLite.
|
|
@@ -28,7 +30,10 @@ Follow the breadcrumb's primary route and return one action, not a menu:
|
|
|
28
30
|
|
|
29
31
|
- unhealthy authority: `ultra-doctor`;
|
|
30
32
|
- missing Ultra project: `ultra-init`;
|
|
31
|
-
- missing baseline evidence
|
|
33
|
+
- missing baseline evidence with no active change: `ultra-init`, then
|
|
34
|
+
`ultra-research` or `ultra-plan` according to the gap;
|
|
35
|
+
- baseline or context-budget warning during an active change: keep the current route
|
|
36
|
+
and surface the warning; do not turn it into a refusal;
|
|
32
37
|
- blocked or stale context: the workflow named by the breadcrumb;
|
|
33
38
|
- ready implementation task: `ultra-dev <task-id>`;
|
|
34
39
|
- completed tasks with missing or stale test evidence: `ultra-test`;
|
|
@@ -45,7 +50,9 @@ Use a compact shape:
|
|
|
45
50
|
```text
|
|
46
51
|
Ultra: <healthy|degraded> · <branch>@<head> · worktree <clean|dirty>
|
|
47
52
|
Position: change=<id|none> task=<id|none> role=<role> gate=<gate>
|
|
53
|
+
Baseline: <greenfield|brownfield|migrated>/<status> revision=<revision|none>
|
|
48
54
|
Readiness: <ready|blocked|stale> — <blockers or none>
|
|
55
|
+
Warnings: <advisory conditions or none>
|
|
49
56
|
Progress: <completed>/<total>; sessions=<active count>
|
|
50
57
|
Evidence: tests=<fresh|stale|missing>; delivery=<fresh|stale|missing>
|
|
51
58
|
Next: <one exact action>
|
package/spec/cli-protocol.md
CHANGED
|
@@ -100,6 +100,10 @@ as a fallback unless `ultra-tools <family> --help` lists it.
|
|
|
100
100
|
| `session.admission_check` | `session admission` | 4.5 | any |
|
|
101
101
|
| `session.heartbeat` | `session heartbeat` | 4.5 | mcp |
|
|
102
102
|
| `session.subscribe_events`| `session subscribe` | 4.5 | any |
|
|
103
|
+
| `baseline.start` | `baseline start` | 11 | mcp |
|
|
104
|
+
| `baseline.record` | `baseline record` | 11 | mcp |
|
|
105
|
+
| `baseline.get` | `baseline get` | 11 | any |
|
|
106
|
+
| `baseline.converge` | `baseline converge` | 11 | mcp |
|
|
103
107
|
| `change.create` | `change create` | 9 | mcp |
|
|
104
108
|
| `change.update` | `change update` | 9 | mcp |
|
|
105
109
|
| `change.get` | `change get` | 9 | any |
|
package/spec/mcp-tools.yaml
CHANGED
|
@@ -23,6 +23,7 @@ families:
|
|
|
23
23
|
- { name: task, description: 'authoritative task lifecycle on state.db', phase: '2' }
|
|
24
24
|
- { name: session, description: 'execution-unit lifecycle with single-active-lease admission (D33)', phase: '4.5' }
|
|
25
25
|
- { name: plan, description: 'execution-plan artifact export and query (D34)', phase: '8a' }
|
|
26
|
+
- { name: baseline, description: 'project adoption, baseline evidence, convergence, and drift authority', phase: '11' }
|
|
26
27
|
- { name: change, description: 'continuous post-delivery change lifecycle and convergence', phase: '9' }
|
|
27
28
|
- { name: system, description: 'read-only diagnostics and explicit backup-first repair', phase: '9' }
|
|
28
29
|
|
|
@@ -217,9 +218,9 @@ tools:
|
|
|
217
218
|
- name: task.init_project
|
|
218
219
|
family: task
|
|
219
220
|
description: |
|
|
220
|
-
Bootstrap
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
Bootstrap `.ultra/` and start an authoritative greenfield or brownfield
|
|
222
|
+
baseline. Auto mode detects meaningful existing project content before
|
|
223
|
+
copying specification templates and creating state.db.
|
|
223
224
|
phase: '3'
|
|
224
225
|
writer_role: mcp
|
|
225
226
|
input_schema:
|
|
@@ -240,6 +241,11 @@ tools:
|
|
|
240
241
|
stack:
|
|
241
242
|
type: string
|
|
242
243
|
description: optional tech stack descriptor (comma-separated for fullstack)
|
|
244
|
+
mode:
|
|
245
|
+
type: string
|
|
246
|
+
enum: [auto, greenfield, brownfield]
|
|
247
|
+
default: auto
|
|
248
|
+
description: auto detects whether meaningful project content already exists
|
|
243
249
|
overwrite:
|
|
244
250
|
type: boolean
|
|
245
251
|
default: false
|
|
@@ -249,7 +255,7 @@ tools:
|
|
|
249
255
|
description: override path to the template root (defaults to bundled templates/.ultra/)
|
|
250
256
|
output_schema:
|
|
251
257
|
type: object
|
|
252
|
-
required: [created_path, state_db_path, status, copied_files]
|
|
258
|
+
required: [created_path, state_db_path, status, mode, baseline, copied_files]
|
|
253
259
|
additionalProperties: false
|
|
254
260
|
properties:
|
|
255
261
|
created_path:
|
|
@@ -261,6 +267,13 @@ tools:
|
|
|
261
267
|
status:
|
|
262
268
|
type: string
|
|
263
269
|
enum: [created, overwritten]
|
|
270
|
+
mode:
|
|
271
|
+
type: string
|
|
272
|
+
enum: [greenfield, brownfield]
|
|
273
|
+
baseline:
|
|
274
|
+
type: object
|
|
275
|
+
required: [id, mode, status]
|
|
276
|
+
additionalProperties: true
|
|
264
277
|
copied_files:
|
|
265
278
|
type: array
|
|
266
279
|
items: { type: string }
|
|
@@ -629,6 +642,210 @@ tools:
|
|
|
629
642
|
emits_events: []
|
|
630
643
|
trace_to: '§7.3, D31'
|
|
631
644
|
|
|
645
|
+
# ───────────────────────── baseline family ─────────────────────────────
|
|
646
|
+
- name: baseline.start
|
|
647
|
+
family: baseline
|
|
648
|
+
description: Start a greenfield baseline or brownfield adoption without overwriting a ready baseline implicitly.
|
|
649
|
+
phase: '11'
|
|
650
|
+
writer_role: mcp
|
|
651
|
+
input_schema:
|
|
652
|
+
type: object
|
|
653
|
+
required: [project_name, mode]
|
|
654
|
+
additionalProperties: false
|
|
655
|
+
properties:
|
|
656
|
+
id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$', default: project-baseline }
|
|
657
|
+
project_name: { type: string, minLength: 1 }
|
|
658
|
+
project_type: { type: string, enum: [web, api, cli, fullstack, other] }
|
|
659
|
+
stack: { type: string }
|
|
660
|
+
mode: { type: string, enum: [greenfield, brownfield] }
|
|
661
|
+
scope: { type: array, minItems: 1, items: { type: string, minLength: 1 }, default: ['.'] }
|
|
662
|
+
repository_revision: { type: string, minLength: 1 }
|
|
663
|
+
replace_ready: { type: boolean, default: false }
|
|
664
|
+
provider_refs:
|
|
665
|
+
type: object
|
|
666
|
+
additionalProperties: false
|
|
667
|
+
properties:
|
|
668
|
+
memory:
|
|
669
|
+
type: object
|
|
670
|
+
required: [provider]
|
|
671
|
+
additionalProperties: false
|
|
672
|
+
properties:
|
|
673
|
+
provider: { type: string }
|
|
674
|
+
project: { type: string }
|
|
675
|
+
reference: { type: string }
|
|
676
|
+
revision: { type: string }
|
|
677
|
+
indexed_head: { type: string }
|
|
678
|
+
status: { type: string, enum: [available, unavailable, fresh, stale, unknown] }
|
|
679
|
+
code_graph:
|
|
680
|
+
type: object
|
|
681
|
+
required: [provider]
|
|
682
|
+
additionalProperties: false
|
|
683
|
+
properties:
|
|
684
|
+
provider: { type: string }
|
|
685
|
+
project: { type: string }
|
|
686
|
+
reference: { type: string }
|
|
687
|
+
revision: { type: string }
|
|
688
|
+
indexed_head: { type: string }
|
|
689
|
+
status: { type: string, enum: [available, unavailable, fresh, stale, unknown] }
|
|
690
|
+
output_schema:
|
|
691
|
+
type: object
|
|
692
|
+
required: [baseline]
|
|
693
|
+
additionalProperties: false
|
|
694
|
+
properties:
|
|
695
|
+
baseline: { type: object }
|
|
696
|
+
errors:
|
|
697
|
+
- { code: BASELINE_EXISTS, description: 'a ready baseline requires explicit replacement' }
|
|
698
|
+
- { code: BASELINE_IN_PROGRESS, description: 'another adoption is already active' }
|
|
699
|
+
- { code: PROVIDER_CONTENT_FORBIDDEN, description: 'provider payload content must remain external' }
|
|
700
|
+
cli_subcommand: baseline start
|
|
701
|
+
emits_events: [baseline_started]
|
|
702
|
+
|
|
703
|
+
- name: baseline.record
|
|
704
|
+
family: baseline
|
|
705
|
+
description: Replace the current adoption snapshot with bounded specification digests, evidence references, verification, unknowns, and provider metadata.
|
|
706
|
+
phase: '11'
|
|
707
|
+
writer_role: mcp
|
|
708
|
+
input_schema:
|
|
709
|
+
type: object
|
|
710
|
+
required: [id]
|
|
711
|
+
additionalProperties: false
|
|
712
|
+
properties:
|
|
713
|
+
id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
|
|
714
|
+
repository_revision: { type: string, minLength: 1 }
|
|
715
|
+
scope: { type: array, minItems: 1, items: { type: string, minLength: 1 } }
|
|
716
|
+
spec_refs:
|
|
717
|
+
type: array
|
|
718
|
+
items:
|
|
719
|
+
type: object
|
|
720
|
+
required: [kind, path]
|
|
721
|
+
additionalProperties: false
|
|
722
|
+
properties:
|
|
723
|
+
kind: { type: string, enum: [discovery, product, architecture, quality, delivery, other] }
|
|
724
|
+
path: { type: string, minLength: 1 }
|
|
725
|
+
evidence:
|
|
726
|
+
type: array
|
|
727
|
+
items:
|
|
728
|
+
type: object
|
|
729
|
+
required: [kind, ref, summary]
|
|
730
|
+
additionalProperties: false
|
|
731
|
+
properties:
|
|
732
|
+
kind: { type: string, enum: [source, docs, runtime, test, deploy, external] }
|
|
733
|
+
ref: { type: string, minLength: 1 }
|
|
734
|
+
summary: { type: string, minLength: 1 }
|
|
735
|
+
verification:
|
|
736
|
+
type: array
|
|
737
|
+
items:
|
|
738
|
+
type: object
|
|
739
|
+
required: [name, command, status, evidence]
|
|
740
|
+
additionalProperties: false
|
|
741
|
+
properties:
|
|
742
|
+
name: { type: string, minLength: 1 }
|
|
743
|
+
command: { type: string, minLength: 1 }
|
|
744
|
+
status: { type: string, enum: [pass, known_red, not_run] }
|
|
745
|
+
evidence: { type: string, minLength: 1 }
|
|
746
|
+
rationale: { type: string, minLength: 1 }
|
|
747
|
+
unknowns:
|
|
748
|
+
type: array
|
|
749
|
+
items:
|
|
750
|
+
type: object
|
|
751
|
+
required: [summary, blocking]
|
|
752
|
+
additionalProperties: false
|
|
753
|
+
properties:
|
|
754
|
+
summary: { type: string, minLength: 1 }
|
|
755
|
+
blocking: { type: boolean }
|
|
756
|
+
owner: { type: string, minLength: 1 }
|
|
757
|
+
provider_refs:
|
|
758
|
+
type: object
|
|
759
|
+
additionalProperties: false
|
|
760
|
+
properties:
|
|
761
|
+
memory:
|
|
762
|
+
type: object
|
|
763
|
+
required: [provider]
|
|
764
|
+
additionalProperties: false
|
|
765
|
+
properties:
|
|
766
|
+
provider: { type: string }
|
|
767
|
+
project: { type: string }
|
|
768
|
+
reference: { type: string }
|
|
769
|
+
revision: { type: string }
|
|
770
|
+
indexed_head: { type: string }
|
|
771
|
+
status: { type: string, enum: [available, unavailable, fresh, stale, unknown] }
|
|
772
|
+
code_graph:
|
|
773
|
+
type: object
|
|
774
|
+
required: [provider]
|
|
775
|
+
additionalProperties: false
|
|
776
|
+
properties:
|
|
777
|
+
provider: { type: string }
|
|
778
|
+
project: { type: string }
|
|
779
|
+
reference: { type: string }
|
|
780
|
+
revision: { type: string }
|
|
781
|
+
indexed_head: { type: string }
|
|
782
|
+
status: { type: string, enum: [available, unavailable, fresh, stale, unknown] }
|
|
783
|
+
output_schema:
|
|
784
|
+
type: object
|
|
785
|
+
required: [baseline]
|
|
786
|
+
additionalProperties: false
|
|
787
|
+
properties:
|
|
788
|
+
baseline: { type: object }
|
|
789
|
+
errors:
|
|
790
|
+
- { code: BASELINE_NOT_FOUND, description: 'baseline id does not exist' }
|
|
791
|
+
- { code: BASELINE_NOT_MUTABLE, description: 'ready and superseded baselines are immutable' }
|
|
792
|
+
- { code: BASELINE_SPEC_MISSING, description: 'a declared specification file does not exist' }
|
|
793
|
+
- { code: PROVIDER_CONTENT_FORBIDDEN, description: 'provider payload content must remain external' }
|
|
794
|
+
cli_subcommand: baseline record
|
|
795
|
+
emits_events: [baseline_recorded]
|
|
796
|
+
|
|
797
|
+
- name: baseline.get
|
|
798
|
+
family: baseline
|
|
799
|
+
description: Read the current or named authoritative baseline with live digest and repository-revision health.
|
|
800
|
+
phase: '11'
|
|
801
|
+
readonly: true
|
|
802
|
+
input_schema:
|
|
803
|
+
type: object
|
|
804
|
+
additionalProperties: false
|
|
805
|
+
properties:
|
|
806
|
+
id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
|
|
807
|
+
output_schema:
|
|
808
|
+
type: object
|
|
809
|
+
required: [baseline, health]
|
|
810
|
+
additionalProperties: false
|
|
811
|
+
properties:
|
|
812
|
+
baseline: { type: object }
|
|
813
|
+
health: { type: object }
|
|
814
|
+
errors:
|
|
815
|
+
- { code: BASELINE_NOT_FOUND, description: 'no matching baseline exists' }
|
|
816
|
+
cli_subcommand: baseline get
|
|
817
|
+
emits_events: []
|
|
818
|
+
|
|
819
|
+
- name: baseline.converge
|
|
820
|
+
family: baseline
|
|
821
|
+
description: Approve a baseline only when its revision, specification digests, evidence, verification, and blocking unknowns satisfy deterministic gates.
|
|
822
|
+
phase: '11'
|
|
823
|
+
writer_role: mcp
|
|
824
|
+
input_schema:
|
|
825
|
+
type: object
|
|
826
|
+
required: [id, expected_revision, approved_by, approval_note]
|
|
827
|
+
additionalProperties: false
|
|
828
|
+
properties:
|
|
829
|
+
id: { type: string, pattern: '^[a-zA-Z0-9_\-]+$' }
|
|
830
|
+
expected_revision: { type: string, minLength: 1 }
|
|
831
|
+
approved_by: { type: string, minLength: 1 }
|
|
832
|
+
approval_note: { type: string, minLength: 3 }
|
|
833
|
+
accept_known_red: { type: boolean, default: false }
|
|
834
|
+
output_schema:
|
|
835
|
+
type: object
|
|
836
|
+
required: [ready, status, blockers, baseline]
|
|
837
|
+
additionalProperties: false
|
|
838
|
+
properties:
|
|
839
|
+
ready: { type: boolean }
|
|
840
|
+
status: { type: string, enum: [blocked, ready] }
|
|
841
|
+
blockers: { type: array, items: { type: string } }
|
|
842
|
+
baseline: { type: object }
|
|
843
|
+
errors:
|
|
844
|
+
- { code: BASELINE_NOT_FOUND, description: 'baseline id does not exist' }
|
|
845
|
+
- { code: BASELINE_NOT_CONVERGEABLE, description: 'baseline lifecycle does not allow convergence' }
|
|
846
|
+
cli_subcommand: baseline converge
|
|
847
|
+
emits_events: [baseline_blocked, baseline_converged]
|
|
848
|
+
|
|
632
849
|
# ────────────────────────── change family ──────────────────────────────
|
|
633
850
|
- name: change.create
|
|
634
851
|
family: change
|
|
@@ -1048,6 +1265,8 @@ tools:
|
|
|
1048
1265
|
errors:
|
|
1049
1266
|
- { code: CHANGE_NOT_READY, description: 'change has not passed convergence' }
|
|
1050
1267
|
- { code: BASELINE_RECONCILIATION_REQUIRED, description: 'baseline update or explicit no-change reason required' }
|
|
1268
|
+
- { code: BASELINE_FILE_MISSING, description: 'a declared baseline update does not exist' }
|
|
1269
|
+
- { code: BASELINE_RECONCILIATION_INCOMPLETE, description: 'repository revision or tracked specification digests remain stale after reconciliation' }
|
|
1051
1270
|
- { code: ARCHIVE_EXISTS, description: 'archive target already exists' }
|
|
1052
1271
|
cli_subcommand: change archive
|
|
1053
1272
|
emits_events: [change_archived]
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"family": {
|
|
62
62
|
"type": "string",
|
|
63
|
-
"enum": ["task", "memory", "review", "impact", "skill", "session", "ask", "plan", "change", "system"]
|
|
63
|
+
"enum": ["task", "memory", "review", "impact", "skill", "session", "ask", "plan", "baseline", "change", "system"]
|
|
64
64
|
},
|
|
65
65
|
"description": { "type": "string", "minLength": 10 },
|
|
66
66
|
"phase": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
-- Ultra Builder Pro — authoritative state schema
|
|
2
2
|
-- Phase 2 builds .ultra/state.db from this file. Source of truth for all
|
|
3
|
-
-- task / session / event / telemetry data. tasks.json and context md status
|
|
3
|
+
-- baseline / change / task / session / event / telemetry data. tasks.json and context md status
|
|
4
4
|
-- header are projections (PLAN §7.1, D18, D32).
|
|
5
5
|
--
|
|
6
|
-
-- Trace: docs/PLAN.zh-CN.md §7.1; decisions D18/D30/D31/D32/D37.
|
|
6
|
+
-- Trace: docs/PLAN.zh-CN.md §7.1; decisions D18/D30/D31/D32/D37/D52/D54.
|
|
7
7
|
--
|
|
8
8
|
-- PRAGMAs are applied by mcp-server/lib/state-db.ts on connection open;
|
|
9
9
|
-- they cannot be persisted in CREATE statements but are documented here.
|
|
@@ -12,6 +12,35 @@
|
|
|
12
12
|
-- PRAGMA busy_timeout=5000; -- block up to 5s on lock (R25)
|
|
13
13
|
-- PRAGMA foreign_keys=ON; -- enforce FK constraints
|
|
14
14
|
|
|
15
|
+
-- ──────────────────────────── project baseline ─────────────────────────────
|
|
16
|
+
-- The baseline is the approved, repository-scoped snapshot that every change
|
|
17
|
+
-- is measured against. It stores digests and evidence references, never source,
|
|
18
|
+
-- prompt, transcript, memory, or code-graph payloads.
|
|
19
|
+
CREATE TABLE IF NOT EXISTS baselines (
|
|
20
|
+
id TEXT PRIMARY KEY,
|
|
21
|
+
project_name TEXT NOT NULL,
|
|
22
|
+
project_type TEXT,
|
|
23
|
+
stack TEXT,
|
|
24
|
+
mode TEXT NOT NULL CHECK (mode IN ('greenfield', 'brownfield', 'migrated')),
|
|
25
|
+
status TEXT NOT NULL DEFAULT 'draft'
|
|
26
|
+
CHECK (status IN ('draft', 'adopting', 'blocked', 'ready', 'superseded')),
|
|
27
|
+
repository_root TEXT NOT NULL DEFAULT '.',
|
|
28
|
+
scope_json TEXT NOT NULL DEFAULT '["."]',
|
|
29
|
+
repository_revision TEXT,
|
|
30
|
+
spec_refs_json TEXT NOT NULL DEFAULT '[]',
|
|
31
|
+
evidence_json TEXT NOT NULL DEFAULT '[]',
|
|
32
|
+
verification_json TEXT NOT NULL DEFAULT '[]',
|
|
33
|
+
unknowns_json TEXT NOT NULL DEFAULT '[]',
|
|
34
|
+
provider_refs_json TEXT NOT NULL DEFAULT '{}',
|
|
35
|
+
approved_by TEXT,
|
|
36
|
+
approval_note TEXT,
|
|
37
|
+
started_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
38
|
+
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
39
|
+
converged_at TEXT
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
CREATE INDEX IF NOT EXISTS baselines_status ON baselines(status, updated_at);
|
|
43
|
+
|
|
15
44
|
-- ──────────────────────────── changes ─────────────────────────────────────
|
|
16
45
|
-- A project baseline is continuous; each feature, fix, incident, or redesign
|
|
17
46
|
-- is an independently converged change unit. Only changes become terminal.
|
|
@@ -305,3 +334,5 @@ INSERT OR IGNORE INTO schema_version (version, description)
|
|
|
305
334
|
VALUES ('9.1', 'Kimi runtime support in durable events and sessions');
|
|
306
335
|
INSERT OR IGNORE INTO schema_version (version, description)
|
|
307
336
|
VALUES ('10.0', 'Role-scoped context snapshots, deterministic breadcrumbs, and approval-gated specification learning');
|
|
337
|
+
INSERT OR IGNORE INTO schema_version (version, description)
|
|
338
|
+
VALUES ('11.0', 'Greenfield and brownfield baseline adoption, convergence, and drift authority');
|