ultra-builder-pro-cli 0.26.2 → 5.0.0

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 (82) hide show
  1. package/.ultra-template/contexts/TEMPLATE.md +70 -29
  2. package/.ultra-template/north-star.md +35 -18
  3. package/.ultra-template/tasks.json +1 -0
  4. package/.ultra-template/test-report.json +17 -1
  5. package/CHANGELOG.md +235 -1
  6. package/README.md +210 -50
  7. package/README.zh-CN.md +440 -0
  8. package/adapters/_shared/host-profile.cjs +3 -95
  9. package/adapters/_shared/plugin-core.cjs +61 -5
  10. package/adapters/_shared/runtime-assets.cjs +66 -5
  11. package/adapters/zcode.js +375 -0
  12. package/bin/delegate-worker.cjs +2 -325
  13. package/bin/delegate.cjs +3 -461
  14. package/bin/install.js +11 -6
  15. package/docs/ARCHITECTURE.md +133 -31
  16. package/docs/ARTIFACT-AUTHORITY.md +185 -24
  17. package/docs/DECISIONS.md +153 -18
  18. package/docs/PHILOSOPHY.md +58 -7
  19. package/docs/PLUGIN-ISOLATION-CONTRACT.md +34 -12
  20. package/docs/RUNTIME-COMPAT-MATRIX.md +195 -23
  21. package/docs/SKILL-AUTHORING.md +19 -6
  22. package/docs/WORKFLOW-LIFECYCLE.md +196 -44
  23. package/docs/evals/adversarial-review-2026-08-14.md +84 -0
  24. package/docs/evals/ultra-5-0-journey-results.md +62 -0
  25. package/docs/evals/ultra-5-0-live-acp-conformance.md +93 -0
  26. package/docs/evals/ultra-5-0-route-journeys.md +145 -0
  27. package/docs/evals/zcode-automation-2026-08-14.md +103 -0
  28. package/hooks/README.md +27 -4
  29. package/hooks/_common.py +1678 -61
  30. package/hooks/adapters/zcode.py +227 -0
  31. package/hooks/compact_context.py +176 -17
  32. package/hooks/mid_workflow_recall.py +27 -5
  33. package/hooks/post_edit_guard.py +133 -23
  34. package/hooks/session_context.py +707 -22
  35. package/package.json +7 -3
  36. package/skills/ultra-change/SKILL.md +69 -12
  37. package/skills/ultra-change/references/change-contract.md +93 -27
  38. package/skills/ultra-change/references/execution-grant.md +109 -0
  39. package/skills/ultra-change/references/primary-transfer.md +273 -0
  40. package/skills/ultra-change/scripts/validate_primary_transfer.cjs +1928 -0
  41. package/skills/ultra-delegate/SKILL.md +103 -8
  42. package/skills/ultra-delegate/patches/zcode-acp-0.1.0-zcode-0.16.5.patch +184 -0
  43. package/skills/ultra-delegate/references/delegation-contract.md +80 -1
  44. package/skills/ultra-delegate/scripts/acp-conformance.cjs +287 -0
  45. package/skills/ultra-delegate/scripts/acp-driver.cjs +762 -0
  46. package/skills/ultra-delegate/scripts/agent-execution-driver.cjs +320 -0
  47. package/skills/ultra-delegate/scripts/cli-driver.cjs +61 -0
  48. package/skills/ultra-delegate/scripts/delegate-worker.cjs +328 -0
  49. package/skills/ultra-delegate/scripts/delegate.cjs +690 -0
  50. package/skills/ultra-delegate/scripts/host-profile.cjs +267 -0
  51. package/skills/ultra-deliver/SKILL.md +98 -11
  52. package/skills/ultra-dev/SKILL.md +188 -42
  53. package/skills/ultra-grilling/SKILL.md +10 -7
  54. package/skills/ultra-grilling/references/reframing.md +7 -3
  55. package/skills/ultra-init/SKILL.md +56 -7
  56. package/skills/ultra-init/scripts/init_project.cjs +968 -21
  57. package/skills/ultra-plan/SKILL.md +91 -47
  58. package/skills/ultra-plan/references/task-evidence-v2.md +300 -0
  59. package/skills/ultra-plan/scripts/validate_task_evidence.cjs +859 -0
  60. package/skills/ultra-research/SKILL.md +70 -14
  61. package/skills/ultra-research/references/04-product-strategy.md +11 -2
  62. package/skills/ultra-research/references/21-features-scope.md +8 -0
  63. package/skills/ultra-research/references/22-success-metrics.md +4 -3
  64. package/skills/ultra-research/references/99-synthesis.md +19 -2
  65. package/skills/ultra-research/references/north-star-v2.md +168 -0
  66. package/skills/ultra-research/references/wayfinding.md +8 -0
  67. package/skills/ultra-research/scripts/validate_north_star.cjs +1174 -0
  68. package/skills/ultra-review/SKILL.md +201 -27
  69. package/skills/ultra-review/references/adversarial-evaluation.md +31 -0
  70. package/skills/ultra-review/references/spec.md +5 -0
  71. package/skills/ultra-review/references/unified-schema.md +146 -11
  72. package/skills/ultra-review/references/worker-packet.md +151 -8
  73. package/skills/ultra-review/scripts/review_wait.py +2653 -63
  74. package/skills/ultra-status/SKILL.md +129 -15
  75. package/skills/ultra-status/references/route-contract.md +100 -0
  76. package/skills/ultra-tdd/SKILL.md +11 -4
  77. package/skills/ultra-tdd/references/test-execution.md +6 -1
  78. package/skills/ultra-test/SKILL.md +161 -18
  79. package/skills/ultra-test/scripts/validate_review_transport.cjs +549 -0
  80. package/skills/ultra-test/scripts/worktree_digest.cjs +518 -30
  81. /package/{adapters/_shared → skills/ultra-delegate/scripts}/delegate-profiles/kimi-read-only.md +0 -0
  82. /package/{adapters/_shared → skills/ultra-delegate/scripts}/delegate-profiles/kimi-write.md +0 -0
@@ -5,26 +5,53 @@ description: Turn a raw Project Brief or scoped evidence gap into an accepted No
5
5
 
6
6
  # Mature a project outline into an evidence-backed baseline
7
7
 
8
- Research owns the first accepted baseline and later evidence-backed corrections. Web
8
+ Research is the first semantic writer of North Star v2 and owns the first accepted
9
+ baseline plus later evidence-backed corrections. Web
9
10
  search is one evidence source, not the workflow: repository files, Git, tests, runtime,
10
11
  maintained documentation, owner decisions, and current primary sources all count.
11
12
 
13
+ ## Route modes
14
+
15
+ | Mode | Entry | Observable exit | Next |
16
+ |---|---|---|---|
17
+ | `baseline` | Explicit owner invocation with a usable Project Brief and no accepted baseline for the boundary | Selected reports, synthesis, specifications, vocabulary, and accepted North Star are read back; unknowns and omissions remain explicit | Recommend `ultra-change` in `intake` mode for the next bounded request |
18
+ | `change-scoped` | Explicit invocation or a valid Execution Grant for one active Change's recorded Research Disposition | The named exit evidence exists and the selected canonical sections are refreshed without changing Change acceptance | Return to the same `ultra-change` in `reconcile` mode |
19
+
20
+ Follow `../ultra-status/references/route-contract.md`. At entry, name the mode, entry
21
+ question, selected coverage, observable stop condition, and return route. Refresh the
22
+ Route Card at each material checkpoint, pause, and exit; lens counts are navigation, not
23
+ proof that Research is semantically complete.
24
+
12
25
  ## Before you start
13
26
 
14
- 1. Resolve at most one active `change_id`, then read `.ultra/tasks.json` plus the
27
+ 1. Resolve `baseline` or `change-scoped` from the artifacts and invocation. A
28
+ model-selected run is valid only for `change-scoped` mode under the live execution
29
+ grant in `../ultra-change/references/execution-grant.md` — a current session-local
30
+ activation or a stably verified durable work-package grant covering the same Change;
31
+ without it, stop and recommend explicit invocation. Baseline adoption is always an
32
+ explicit-entry mode.
33
+ 2. Resolve at most one active `change_id`, then read `.ultra/tasks.json` plus the
15
34
  `context_file` and `## Resume Note` of unfinished tasks whose `change_id` matches it,
16
35
  if any. Archived or abandoned unfinished rows are history, not the current frontier.
17
- 2. Read `.ultra/project-brief.md`. For a legacy project without it, treat the exact
36
+ 3. Read `.ultra/project-brief.md`. For a legacy project without it, treat the exact
18
37
  `.ultra/north-star.md` `## One-line` as raw intake until a brief is preserved.
19
- 3. Read existing `.ultra/north-star.md`, specifications, `CONTEXT.md`, relevant
38
+ 4. Read existing `.ultra/north-star.md`, specifications, `CONTEXT.md`, relevant
20
39
  `.ultra/decisions/`, active Change intent, evidence, Git state, and maintained docs.
40
+ Run `node <ultra-research-skill-dir>/scripts/validate_north_star.cjs
41
+ .ultra/north-star.md`; this entry captures one bounded regular non-symlink snapshot
42
+ and returns a typed repair diagnostic instead of following, blocking on, or validating
43
+ a changing path. Treat `unresearched` as an empty destination and `legacy_unadopted`
44
+ as preserved intake for explicit adoption, not accepted v2 truth.
21
45
 
22
46
  ## Definition of done
23
47
 
24
48
  - Every selected lens has a cited `.ultra/research/<run-id>/<area>.md` report and its
25
- canonical specification section contains the current conclusion.
49
+ canonical specification section contains the current conclusion and North Star relation.
26
50
  - The accepted North Star, shared vocabulary, product baseline, and architecture
27
51
  baseline are sufficient for the current planning boundary; unknowns stay explicit.
52
+ - The North Star follows `references/north-star-v2.md`; all `FP-*`, `NS-*`, and `HC-*`
53
+ definitions and references pass the structural validator without making that result
54
+ a semantic verdict.
28
55
  - `99-synthesis.md` names what was promoted, overturned, deferred, or left blocking.
29
56
  - `.ultra/specs/research-distillate.md` stores the Git blob hash of each specification
30
57
  it summarizes. A mismatch makes the distillate stale, never authoritative.
@@ -36,9 +63,15 @@ When coverage spans several lenses or the path itself is unclear, read
36
63
  for one already-bounded evidence question. Wayfinding selects the smallest useful
37
64
  coverage; it does not create workflow state or another semantic authority.
38
65
 
66
+ The derived brief records the entry question, selected lenses, deliberate omissions,
67
+ dependencies, source plan, material checkpoints, observable stop condition, and return
68
+ route. Read it on a fresh session instead of restarting completed evidence collection.
69
+
39
70
  Map the brief and unresolved specification sections to seventeen focused evidence
40
- lenses. Confirm the proposed coverage once with the owner. Load one reference
41
- at a time; the parent holds the question map, not every step prompt.
71
+ lenses. Show the proposed coverage once. Pause only when it expands an accepted boundary
72
+ or creates another material checkpoint; a covering Change Research Disposition does not
73
+ need a duplicate confirmation. Load one reference at a time; the parent holds the
74
+ question map, not every step prompt.
42
75
 
43
76
  The first six lenses have real semantic dependencies:
44
77
 
@@ -50,6 +83,8 @@ The first six lenses have real semantic dependencies:
50
83
  The later groups turn that premise into product behavior (`10` through `22`), then an
51
84
  architecture and operating baseline (`30` through `41`). The three owner checkpoints
52
85
  remain `04-product-strategy`, `21-features-scope`, and `99-synthesis`.
86
+ At each checkpoint, use `../ultra-think/SKILL.md` for an adversarial challenge of the
87
+ working candidate before asking the owner to accept direction, scope, or synthesis.
53
88
 
54
89
  Only areas with satisfied inputs may fan out through native bounded subagents. Never
55
90
  parallelize a lens whose question depends on an unresolved earlier conclusion.
@@ -61,6 +96,8 @@ For each selected lens:
61
96
  1. Inspect reachable facts before asking. Search current primary sources when a claim
62
97
  depends on current external reality.
63
98
  2. Separate Observed, Verified, Decided, Inference, and Unknown; cite external claims.
99
+ Record `north_star_effect: supports | refines | contradicts | independent` and
100
+ `north_star_claim: <the evidenced causal relation>` in the area report.
64
101
  3. Follow `../ultra-grilling/SKILL.md` when a required owner field is missing. The lens
65
102
  supplies what to ask; Grilling supplies the one-question interaction loop.
66
103
  4. Follow `../ultra-think/SKILL.md` for one consequential trade-off, not for mapping the
@@ -74,23 +111,38 @@ For scoped Research inside an active Change, answer only its recorded `Research
74
111
  Disposition` question and produce the named exit evidence. Research writes reports and
75
112
  the mapped canonical baseline sections; it does not silently rewrite Change acceptance.
76
113
  Return the evidence paths so `ultra-change` can reconcile the accepted intent before
77
- planning when that contract must change.
114
+ planning when that contract must change. The scoped run's return route is always the
115
+ same stable Change, even when the evidence supports the original intent unchanged.
78
116
 
79
117
  If web access is unavailable, record `[UNVERIFIED: no web access]` and continue with
80
118
  other evidence. Missing tooling lowers confidence; it does not manufacture a blocker.
81
119
 
82
120
  ## Synthesize the accepted baseline
83
121
 
84
- `04-product-strategy` proposes the direction. `22-success-metrics` determines whether a
122
+ `04-product-strategy` proposes problem reality and falsifiable first-principle
123
+ propositions. `22-success-metrics` determines whether a
85
124
  single North Star metric is justified or whether an observable outcome plus guardrails
86
- is more honest. After the owner accepts `99-synthesis`, update `.ultra/north-star.md`,
87
- the three specifications, domain language, qualifying decisions, and the distillate for
88
- the first baseline. A scoped Research run updates only its mapped specification sections
89
- and then refreshes the distillate's three source hashes.
125
+ is more honest. Follow `references/north-star-v2.md`: validate a mutable candidate while
126
+ the last accepted revision remains current, show the owner the semantic delta and
127
+ unresolved contradictions, and preserve one stable `.ultra/decisions/<id>.md` acceptance
128
+ record with the owner's exact words, conversation scope, the model's responsibility for
129
+ final wording, and no invented timestamp or inheritance by a future revision. Only after
130
+ the owner accepts the candidate, atomically replace `.ultra/north-star.md`, then update the three
131
+ specifications, domain language, qualifying decisions, and distillate for the first
132
+ baseline. A scoped Research run updates only its mapped specification sections and then
133
+ refreshes the distillate's three source hashes.
134
+
135
+ When an accepted revision supersedes another, preserve prior evidence and report every
136
+ active Change whose recorded revision or digest differs as a stale observation requiring
137
+ Change reconciliation. Supersession never deletes evidence, rewrites a Change silently,
138
+ or grants execution.
90
139
 
91
140
  Load `references/99-synthesis.md` only after selected reports exist. Read every promoted
92
141
  file back, verify trace anchors and source hashes, and report exact unresolved gaps.
93
- Recommend the next explicit public workflow from the resulting files; do not invoke it.
142
+ For `baseline`, recommend `ultra-change/intake`; for `change-scoped`, return the named
143
+ evidence to `ultra-change/reconcile`. Invoke neither unless the latter continuation is
144
+ covered by the same valid Execution Grant; when it is covered, show the transition Route
145
+ Card first and let Change re-verify its own mode and grant.
94
146
 
95
147
  ## When the owner decides
96
148
 
@@ -108,4 +160,8 @@ selects methods, and updates accepted files inside that frame.
108
160
  - `references/30-architecture-context.md` through `references/41-quality-risks.md` —
109
161
  system boundary, implementation evidence, operations, and risk.
110
162
  - `references/99-synthesis.md` — load last, after selected reports exist.
163
+ - `references/north-star-v2.md` — exact semantic structure, adoption, validation, and
164
+ supersession contract.
165
+ - `../ultra-change/references/execution-grant.md` — read only for grant-activated continuation.
166
+ - `../ultra-status/references/route-contract.md` — owner-visible route, checkpoint, and recovery output.
111
167
  - `../ultra-think/references/autonomy-boundary.md` — read before reducing authority.
@@ -4,8 +4,8 @@ Use for workflow step `04-product-strategy`.
4
4
 
5
5
  ## Objective
6
6
 
7
- Turn accepted evidence into a product direction, target boundary, value proposition,
8
- and explicit tradeoffs.
7
+ Turn accepted evidence into problem reality, falsifiable first-principle propositions,
8
+ a product direction, target boundary, value proposition, and explicit tradeoffs.
9
9
 
10
10
  ## Evidence and decisions
11
11
 
@@ -13,6 +13,8 @@ and explicit tradeoffs.
13
13
  - Ask the owner when a scope, customer, business, or risk decision is load-bearing.
14
14
  - Do not infer an MVP, reduced scope, release phase, or commercial posture.
15
15
  - Record exclusions only when the owner or an accepted constraint establishes them.
16
+ - For each proposed `FP-*`, record evidence, causal consequence, and the falsifier or
17
+ revisit trigger. The ID becomes canonical only in an owner-accepted synthesis.
16
18
 
17
19
  ## Record
18
20
 
@@ -22,6 +24,7 @@ Update `discovery.md` with:
22
24
  - value delivered through observable behavior;
23
25
  - chosen tradeoffs and their rationale;
24
26
  - constraints, exclusions, and unresolved decisions;
27
+ - the candidate `FP-* -> capability -> behavior -> outcome` causal chain;
25
28
  - any defensibility claim with its supporting evidence.
26
29
 
27
30
  Complete the step with decision and evidence references plus the updated output path.
@@ -30,3 +33,9 @@ Complete the step with decision and evidence references plus the updated output
30
33
 
31
34
  In the area report, record `tradeoff` and `rationale`, then link the decision file or
32
35
  specification anchor to the problems, opportunities, or constraints that support it.
36
+
37
+ ## Adversarial challenge
38
+
39
+ Before the owner checkpoint, challenge whether the proposed direction follows from the
40
+ underlying problem and first principles, steel-man the best conflicting direction, and
41
+ name evidence that would overturn the working North Star candidate.
@@ -13,6 +13,8 @@ excluded, deferred, or unresolved.
13
13
  - Never infer an MVP, reduced version, phase label, or omission from implementation
14
14
  convenience.
15
15
  - Trace included capabilities to requirements and observable outcomes.
16
+ - Trace each included capability to candidate `FP-*` and `NS-*` IDs, and name every
17
+ candidate `HC-*` it could breach, without copying North Star prose.
16
18
  - Record dependencies, migrations, compatibility, and operational obligations inside
17
19
  the capability that owns them.
18
20
  - Keep speculative future ideas outside the active scope unless selected.
@@ -28,3 +30,9 @@ Complete the step with decision evidence and the updated output path.
28
30
 
29
31
  In the area report, record `requirement_ids`, `scope_status`, and `rationale`, then link
30
32
  the capability heading in `product.md`.
33
+
34
+ ## Adversarial challenge
35
+
36
+ Before the owner checkpoint, challenge whether every included capability causally serves
37
+ the working North Star, whether an exclusion breaks that outcome or a hard constraint,
38
+ and whether the proposed scope can optimize a proxy while missing delivered value.
@@ -12,8 +12,9 @@ including signals that would reveal harmful optimization.
12
12
  - Derive measurements from accepted outcomes and available instrumentation.
13
13
  - State definition, source, observation window, owner, and decision use.
14
14
  - Separate current measurements, target decisions, and unavailable telemetry.
15
- - Propose one North Star outcome or metric when justified by delivered value and a
16
- credible observation contract.
15
+ - Propose one or more stable `NS-*` outcomes when justified by delivered value and a
16
+ credible observation contract. Each records observation method, baseline, target or
17
+ expected change, horizon, and anti-metric.
17
18
  - Do not force a single metric, or invent baselines and targets, when guardrails plus an
18
19
  observable outcome represent the product more honestly.
19
20
 
@@ -21,7 +22,7 @@ including signals that would reveal harmful optimization.
21
22
 
22
23
  Update `product.md` with supporting outcome measures, operational measures, guardrails,
23
24
  evidence availability, and unresolved instrumentation needs. Propose the canonical
24
- `NS-01` entry for `north-star.md`; it becomes authority only through accepted synthesis.
25
+ `NS-*` entries for `north-star.md`; they become authority only through accepted synthesis.
25
26
  A metric that cannot be observed is a gap or explicit future Change.
26
27
 
27
28
  Complete the step with evidence references and the updated output path.
@@ -17,11 +17,22 @@ creating a second condensed authority.
17
17
  - Documentation conflicts, known failures, and load-bearing unknowns are in the gap
18
18
  ledger with owners or explicit decisions.
19
19
  - Verification commands and observed results are current.
20
+ - Every accepted `FP-*` has evidence, causal consequence, and a falsifier or revisit
21
+ trigger; every `NS-*` has an observation contract and anti-metric; every `HC-*` names
22
+ the protected value or threat, authority, and revisit condition.
20
23
 
21
24
  ## Record
22
25
 
23
- Update `.ultra/north-star.md` with the accepted project direction, North Star outcome or
24
- explicit no-single-metric decision, hard constraints, exclusions, and Research trace.
26
+ Follow `north-star-v2.md`. Validate the complete mutable candidate with
27
+ `scripts/validate_north_star.cjs` while the previous accepted revision remains current.
28
+ Only after the owner accepts this checkpoint and exact semantic delta, record the owner
29
+ acceptance source and atomically replace `.ultra/north-star.md` with accepted problem
30
+ reality, `FP-*` propositions, causal chains, `NS-*` outcomes, `HC-*` constraints,
31
+ exclusions, uncertainties, revisit triggers, and Research trace.
32
+
33
+ If this supersedes an accepted revision, preserve its Git and downstream evidence.
34
+ Report dependent active Change traces as stale observations until Change reconciliation;
35
+ do not silently rewrite intent or infer new execution authority.
25
36
  Keep raw owner wording in `project-brief.md`; do not process it in place.
26
37
 
27
38
  Write `research-distillate.md` as a navigation and traceability artifact containing
@@ -40,3 +51,9 @@ reporting convergence.
40
51
  Record one verified chain through `problem_id`, `scenario_id`, `requirement_ids`,
41
52
  `architecture_path_ids`, and `verification_refs`. Every referenced id must exist in an
42
53
  earlier selected area report or specification heading.
54
+
55
+ ## Adversarial challenge
56
+
57
+ Before acceptance, challenge the strongest premise, Goodhart or proxy failure, and a
58
+ scenario where every stated output passes while the claimed delivered value still fails.
59
+ Record what would change the conclusion and every unresolved contradiction.
@@ -0,0 +1,168 @@
1
+ # North Star v2 contract
2
+
3
+ Use this contract when Research proposes the first steering authority or a replacement
4
+ revision. Init creates only the packaged `unresearched` placeholder.
5
+
6
+ ## Agency boundary
7
+
8
+ Research selects evidence, synthesizes causal propositions, and proposes language. The
9
+ owner accepts the problem boundary, `FP-*`, `NS-*`, `HC-*`, exclusions, and material
10
+ uncertainty. The validator observes headings, fields, IDs, and references; it never
11
+ decides whether a proposition is true, an outcome is valuable, or a constraint is wise.
12
+
13
+ Keep the last accepted file current while a replacement is drafted. Validation failure
14
+ returns diagnostics and leaves the draft mutable. Only explicit owner acceptance permits
15
+ an atomic replacement of `.ultra/north-star.md`.
16
+
17
+ ## Exact top-level headings
18
+
19
+ 1. `## Acceptance and Revision`
20
+ 2. `## Problem Reality`
21
+ 3. `## First-Principle Propositions`
22
+ 4. `## Value Causal Chain`
23
+ 5. `## North Star Outcomes`
24
+ 6. `## Hard Constraints`
25
+ 7. `## Explicit Exclusions`
26
+ 8. `## Uncertainties and Revisit Triggers`
27
+ 9. `## Research Trace`
28
+
29
+ `Acceptance and Revision` records `Schema`, `Status`, `Revision`, `Owner acceptance
30
+ source`, `Acceptance time`, and `Supersedes`. Do not invent a timestamp: use
31
+ `not-recorded` when the authoritative owner source has none. `Status` is exactly
32
+ `unresearched` for the empty Init placeholder, `draft` for a mutable candidate, or
33
+ `accepted` after owner acceptance. A draft may define semantic IDs but must use
34
+ `Owner acceptance source: none`; every First-Principle Proposition in an accepted
35
+ revision has `Status: accepted`.
36
+
37
+ The `unresearched` form is one exact packaged byte sequence, not a looser shape. Its
38
+ title, authority and adoption preamble, all six acceptance fields, all eight later
39
+ sentinel bodies, interstitial whitespace, and trailing newline must match
40
+ `.ultra-template/north-star.md`. Any mutation is invalid and Init stops before publication
41
+ with an `ultra-init-error-v1` payload: `code: north_star_template_invalid`, plus the full
42
+ canonical validator `diagnostics`, including `invalid_unresearched_placeholder` for an
43
+ exact-byte mismatch. This checksum-backed grammar prevents Init from becoming a hidden
44
+ semantic writer; it does not judge any researched proposition.
45
+
46
+ ## Stable semantic entries
47
+
48
+ Define accepted entries with level-three headings. IDs are stable within project
49
+ history, unique, and never silently recycled.
50
+
51
+ ```markdown
52
+ ### FP-1 — Short name
53
+ - Proposition:
54
+ - Evidence:
55
+ - Causal consequence:
56
+ - Falsifier or revisit trigger:
57
+ - Status: `accepted`
58
+
59
+ ### NS-1 — Short name
60
+ - Outcome:
61
+ - Observation method:
62
+ - Baseline:
63
+ - Target or expected change:
64
+ - Horizon:
65
+ - Anti-metric:
66
+
67
+ ### HC-1 — Short name
68
+ - Protected value or threat:
69
+ - Constraint:
70
+ - Authority or evidence:
71
+ - Revisit condition:
72
+ ```
73
+
74
+ Do not impose a maximum count. Prefer the smallest set that explains the accepted
75
+ boundary, but let Research and the owner decide semantic sufficiency.
76
+
77
+ The Value Causal Chain references definitions instead of repeating them:
78
+
79
+ ```text
80
+ FP-* -> capability -> observable behavior -> NS-*
81
+ ```
82
+
83
+ In a draft or accepted revision every pipe-delimited causal-chain row has exactly five
84
+ cells. Header and separator rows use that same width; each data row carries a `VC-*`, a
85
+ resolving `FP-*`, nonempty capability and behavior, and a resolving `NS-*`. A malformed
86
+ row remains invalid even when another row is valid. Every one of the nine required
87
+ sections is nonempty for accepted publication; these are exact structural observations,
88
+ not a mechanical claim that the content is semantically sufficient.
89
+
90
+ Supporting product behavior, actors, requirements, measurements, and architecture stay
91
+ in specifications. Shared vocabulary stays in `CONTEXT.md`. Change-local outcome,
92
+ non-goals, acceptance, risk, and recovery stay in the active intent.
93
+
94
+ ## Validation and adoption
95
+
96
+ Callers that already own a bounded stable no-symlink snapshot pass those exact bytes
97
+ through stdin while identifying the canonical absolute path:
98
+
99
+ ```bash
100
+ node <ultra-research-skill-dir>/scripts/validate_north_star.cjs --stdin --path <canonical-absolute-path>
101
+ ```
102
+
103
+ Research and manual callers may instead use the direct path entry:
104
+
105
+ ```bash
106
+ node <ultra-research-skill-dir>/scripts/validate_north_star.cjs <candidate-path>
107
+ ```
108
+
109
+ Path mode applies the same 8 MiB ceiling itself. It requires a regular non-symlink file,
110
+ opens with `O_NONBLOCK` and `O_NOFOLLOW`, binds the pre-read `lstat` to the open
111
+ descriptor, and rechecks descriptor/path identity, size, and the retained-byte digest
112
+ after the bounded read. An oversized file, symlink, special file, read failure, or
113
+ observable ordinary replacement returns `input_too_large`, `input_symlink`,
114
+ `input_not_regular`, `read_error`, or `input_changed`; preserve the current path and
115
+ retry after cooperative workspace writes settle. No typed input failure is a semantic
116
+ judgment or a promise to defeat a malicious operating-system-level writer.
117
+
118
+ Every verdict over a completed byte snapshot carries `input.path`, `input.byte_length`,
119
+ and `input.sha256` for those bytes. A capture failure keeps the same keys but uses null
120
+ for any byte length or digest it could not safely observe. Markdown headings, grammar
121
+ fields, causal rows, and decision-record fields count only rendered lines outside
122
+ backtick or tilde fences; acceptance binding still hashes the exact raw bytes.
123
+ SessionStart applies the same 8 MiB stable no-symlink snapshot limit and validates those
124
+ same bytes, rather than reopening a different path snapshot.
125
+
126
+ The command emits `ultra-north-star-validation-v1`. The actual v0.26 shape containing
127
+ `Project Direction`, `North Star Outcome`, and `Hard Constraints`, and the older
128
+ `## One-line` form, are reported as `legacy_unadopted` with an advisory. A candidate
129
+ combining v2 markers with a legacy semantic heading is reported with
130
+ `kind: "north-star-v2"`, its parsed v2 `status`, `classification: "mixed"`, and
131
+ `valid: false`; appending a legacy heading cannot bypass v2 validation. Other malformed
132
+ shapes are `unknown` and invalid. Research must migrate legacy input through an
133
+ owner-accepted replacement rather than mutating it in place.
134
+
135
+ Init consumes a preserved North Star from the same stable descriptor/path identity and
136
+ SHA-256 snapshot used for classification, and rechecks that snapshot before staging,
137
+ before publication, and before success. Under the cooperative-workspace contract, any
138
+ observable authority-path or byte drift preserves the current bytes and returns the
139
+ typed retryable `preserved_north_star_changed` diagnostic. Other preserved or newly
140
+ published Init paths use the same recovery rule and the typed retryable
141
+ `initialization_snapshot_changed` diagnostic. This is detectable-drift protection, not
142
+ a promise that Node filesystem calls can defend against a malicious operating-system-
143
+ level replacement.
144
+
145
+ For an accepted replacement:
146
+
147
+ 1. preserve the current accepted file while drafting and validating the candidate;
148
+ 2. challenge premise, falsifiers, causal chain, proxy failure, exclusions, and hard
149
+ constraints independently;
150
+ 3. show the owner the semantic delta and unresolved contradictions;
151
+ 4. preserve a stable decision record with the owner's exact words, conversation scope,
152
+ the model's responsibility for final wording, and a rule that future revisions do not
153
+ inherit acceptance; record no timestamp the owner source did not provide;
154
+ 5. atomically replace the canonical file;
155
+ 6. record that dependent active Change traces are stale observations until Change
156
+ reconciliation maps old `FP/NS/HC` references to the new revision.
157
+
158
+ The cited decision fragment resolves exactly one rendered Markdown heading outside fenced
159
+ code. That section carries each of these list fields exactly once with a nonempty value:
160
+ `Conversation scope`, `Exact raw owner acceptance`, `Agency boundary`, `Time boundary`,
161
+ and `Revision boundary`. The validator observes only their anchored presence, uniqueness,
162
+ and nonempty bytes. It does not decide whether the quoted acceptance is genuine,
163
+ sufficiently informed, or semantically adequate; those judgments remain with the owner
164
+ and model.
165
+
166
+ Never delete old task, review, Test, or delivery evidence because of supersession. Git
167
+ preserves the old North Star revision; canonical consumers retain their historical
168
+ revision and digest while current execution waits for explicit reconciliation.
@@ -27,6 +27,14 @@ Write `.ultra/research/<run-id>/brief.md` with:
27
27
  - owner decisions and the checkpoint that owns each one;
28
28
  - a stop condition stated as an observable artifact or resolved decision.
29
29
 
30
+ ## North Star Working Candidate
31
+
32
+ In the same brief, keep the current candidate outcome, `FP-*` propositions, causal chain,
33
+ evidence, counter-evidence, and the accepted `.ultra/north-star.md` revision and digest it
34
+ began from. Update
35
+ this section as lenses refine or contradict it. It is derived navigation and not semantic
36
+ authority; only accepted synthesis can replace the canonical North Star.
37
+
30
38
  The brief is derived navigation, not semantic authority. Specifications, the North Star,
31
39
  `CONTEXT.md`, and accepted decisions remain canonical. Rebuild or discard the map when
32
40
  evidence changes; never add a completion flag merely to route another Skill.