soturail 0.8.0 → 0.9.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 (57) hide show
  1. package/README.md +57 -16
  2. package/dist/commands/bench.d.ts +1 -0
  3. package/dist/commands/bench.js +18 -6
  4. package/dist/commands/bench.js.map +1 -1
  5. package/dist/commands/brain.js +14 -7
  6. package/dist/commands/brain.js.map +1 -1
  7. package/dist/commands/native.js +12 -0
  8. package/dist/commands/native.js.map +1 -1
  9. package/dist/commands/rules.js +20 -1
  10. package/dist/commands/rules.js.map +1 -1
  11. package/dist/commands/self.js +19 -0
  12. package/dist/commands/self.js.map +1 -1
  13. package/dist/core/baseline-snapshot.d.ts +27 -0
  14. package/dist/core/baseline-snapshot.js +225 -0
  15. package/dist/core/baseline-snapshot.js.map +1 -0
  16. package/dist/core/benchmark-rail.d.ts +44 -0
  17. package/dist/core/benchmark-rail.js +322 -0
  18. package/dist/core/benchmark-rail.js.map +1 -0
  19. package/dist/core/config.d.ts +5 -0
  20. package/dist/core/config.js +6 -1
  21. package/dist/core/config.js.map +1 -1
  22. package/dist/core/evaluation-suite.js +117 -2
  23. package/dist/core/evaluation-suite.js.map +1 -1
  24. package/dist/core/evidence-pack.js +17 -0
  25. package/dist/core/evidence-pack.js.map +1 -1
  26. package/dist/core/harness-rail.js +2 -0
  27. package/dist/core/harness-rail.js.map +1 -1
  28. package/dist/core/native-candidates.d.ts +44 -0
  29. package/dist/core/native-candidates.js +163 -0
  30. package/dist/core/native-candidates.js.map +1 -0
  31. package/dist/core/project-brain.d.ts +70 -4
  32. package/dist/core/project-brain.js +475 -30
  33. package/dist/core/project-brain.js.map +1 -1
  34. package/dist/core/release-preflight.js +8 -0
  35. package/dist/core/release-preflight.js.map +1 -1
  36. package/dist/core/version.d.ts +1 -1
  37. package/dist/core/version.js +1 -1
  38. package/docs/agents.md +9 -1
  39. package/docs/baseline-snapshots.md +54 -0
  40. package/docs/benchmarking.md +69 -0
  41. package/docs/code-graph.md +33 -0
  42. package/docs/diagram-rail.md +2 -0
  43. package/docs/evaluation-suite.md +23 -0
  44. package/docs/harness-rail.md +10 -0
  45. package/docs/knowledge-to-rules.md +23 -0
  46. package/docs/memory-rail.md +2 -0
  47. package/docs/native-performance-policy.md +62 -0
  48. package/docs/native-runner.md +24 -0
  49. package/docs/project-brain.md +101 -4
  50. package/docs/release-workflow.md +13 -0
  51. package/docs/releases/README.md +2 -0
  52. package/docs/releases/RELEASE_NOTES_v0.8.1.md +42 -0
  53. package/docs/releases/RELEASE_NOTES_v0.9.0.md +35 -0
  54. package/docs/reverse-specification-rail.md +19 -0
  55. package/docs/rules.md +3 -0
  56. package/docs/workflow-rail.md +23 -0
  57. package/package.json +1 -1
@@ -21,10 +21,33 @@ soturail rules doctor
21
21
  ```txt
22
22
  .soturail/brain/rules.jsonl
23
23
  .soturail/rules/from-brain.md
24
+ .soturail/rules/from-brain.json
24
25
  ```
25
26
 
26
27
  Each brain-derived rule links back to claim IDs or decision IDs.
27
28
 
29
+ ## v0.8.1 Safety Model
30
+
31
+ Rule derivation is conservative:
32
+
33
+ - verified claims with validation references can become `test-backed` rules;
34
+ - verified release, policy or security claims can become `policy-gate` candidates;
35
+ - verified claims without tests usually become `manual-review`;
36
+ - unverified claims stay advisory/draft;
37
+ - suspect or stale claims do not create active rules by default;
38
+ - superseded or rejected decisions do not create active rules.
39
+
40
+ Use this repair-first flow when rules look weak or stale:
41
+
42
+ ```bash
43
+ soturail brain stale --repair-plan
44
+ soturail brain consolidate --dry-run
45
+ soturail rules from-brain
46
+ soturail rules doctor
47
+ ```
48
+
49
+ `rules doctor` reports brain-derived rule counts, active/advisory rules, missing source links and stale-source warnings.
50
+
28
51
  ## Example Rules
29
52
 
30
53
  - Release notes must live under `docs/releases/`.
@@ -176,6 +176,8 @@ Rules:
176
176
  - recurring memory should link to a claim, decision, bug or gap when possible;
177
177
  - brain exports should prefer source references and concise summaries over long copied notes.
178
178
 
179
+ v0.8.1 keeps memory-to-brain conservative: use `soturail brain consolidate --dry-run` before deriving rules from repeated memories, and use `soturail brain stale --repair-plan` when a memory points at evidence that moved or changed.
180
+
179
181
  ## Privacy And Redaction
180
182
 
181
183
  Memory Rail must not make secrets easier to leak.
@@ -0,0 +1,62 @@
1
+ # Native Performance Policy
2
+
3
+ SotuRail native acceleration is benchmark-gated.
4
+
5
+ ```txt
6
+ No benchmark, no native rewrite.
7
+ ```
8
+
9
+ TypeScript remains the portable baseline and the default safe fallback. Normal npm installs must not require Rust, Cargo, native build tools, prebuilt platform packages or a working native binary.
10
+
11
+ ## Decision Policy
12
+
13
+ Native acceleration is allowed only when:
14
+
15
+ 1. A benchmark exists for the operation.
16
+ 2. A TypeScript baseline is recorded.
17
+ 3. The native path is optional.
18
+ 4. The fallback path is tested.
19
+ 5. The speedup justifies the maintenance risk.
20
+ 6. npm install stays safe for normal users.
21
+
22
+ Decision statuses:
23
+
24
+ ```txt
25
+ not-measured
26
+ measured
27
+ candidate
28
+ approved-for-native
29
+ native-implemented
30
+ rejected
31
+ ```
32
+
33
+ ## Current Candidate Flow
34
+
35
+ ```bash
36
+ soturail bench list
37
+ soturail bench run --suite brain
38
+ soturail native candidates
39
+ soturail native status
40
+ soturail native doctor
41
+ soturail native compare
42
+ ```
43
+
44
+ `native candidates` classifies operations as:
45
+
46
+ - `good-candidate`
47
+ - `maybe-candidate`
48
+ - `not-worth-it-yet`
49
+ - `blocked`
50
+
51
+ Candidate reports are written to:
52
+
53
+ ```txt
54
+ .soturail/native/candidates.json
55
+ .soturail/native/candidates.md
56
+ ```
57
+
58
+ ## Required Boundary
59
+
60
+ SotuRail does not claim native speedups unless a local benchmark report proves them.
61
+
62
+ Native acceleration is optional. TypeScript remains the portable baseline.
@@ -43,10 +43,34 @@ npm run build:all # TypeScript + Rust
43
43
  npm run build:native
44
44
  soturail bench run --engine native
45
45
  soturail bench compare-engines
46
+ soturail bench run --suite brain
47
+ soturail native candidates
48
+ soturail native status
49
+ soturail native compare
46
50
  ```
47
51
 
52
+ ## v0.9.0 Benchmark Gate
53
+
54
+ Native acceleration is not promoted just because a native path exists. v0.9.0 requires:
55
+
56
+ - a local benchmark case;
57
+ - a TypeScript baseline;
58
+ - optional native execution only;
59
+ - tested fallback behavior;
60
+ - a maintenance-risk decision.
61
+
62
+ Candidate reports are written to:
63
+
64
+ ```txt
65
+ .soturail/native/candidates.json
66
+ .soturail/native/candidates.md
67
+ ```
68
+
69
+ SotuRail does not claim native speedups unless a local benchmark report proves them. Normal npm install does not require Rust or native binaries.
70
+
48
71
  ## Current Limitations
49
72
 
50
73
  - Native binaries are not prebuilt for npm yet.
51
74
  - Interactive TTY behavior is best-effort.
52
75
  - TypeScript remains the source of truth for workspace manifests and safety prompts.
76
+ - Parser/graph acceleration remains deferred until benchmark evidence justifies it.
@@ -50,21 +50,58 @@ Stale events record evidence drift when a source file, source range or validatio
50
50
  ```bash
51
51
  soturail brain init
52
52
  soturail brain scan
53
+ soturail brain consolidate --dry-run
53
54
  soturail brain profile
54
55
  soturail brain recall "release notes"
55
- soturail brain stale
56
- soturail brain doctor
57
- soturail brain export --agent codex
56
+ soturail brain stale --repair-plan
57
+ soturail brain doctor --repair-plan
58
+ soturail brain doctor --json
59
+ soturail brain export --agent codex --limit 10
58
60
  ```
59
61
 
60
62
  `brain scan` detects package metadata, CLI version, docs folders, release note paths, rails, commands, tests, workflow/harness/diagram/eval status and supported agent hosts.
61
63
 
62
64
  `brain recall` uses deterministic scoring: exact phrases, keyword overlap, tags, record type, status, confidence and recency.
63
65
 
64
- `brain stale` recomputes `fileHash` and `rangeHash`. If the file changed but the range did not, it warns. If the range changed, it records a suspect event. If the source file is missing, it records a stale event.
66
+ `brain consolidate --dry-run` reads `claims.jsonl`, groups duplicate or near-duplicate claims, chooses canonical claims conservatively and writes:
67
+
68
+ ```txt
69
+ .soturail/brain/consolidated-claims.jsonl
70
+ .soturail/brain/consolidation-report.json
71
+ .soturail/brain/consolidation-report.md
72
+ ```
73
+
74
+ It preserves append-only history. It does not delete or rewrite original claim records.
75
+
76
+ `brain stale` recomputes `fileHash` and `rangeHash`. If the file changed but the range did not, it warns. If the source range changed, v0.8.1 tries to relocate similar evidence in the same file using normalized whitespace and token overlap. A high-confidence match records a `relocated` stale event; a medium-confidence match records a suspect relocation candidate. If the source file is missing, it records a stale event.
77
+
78
+ `brain stale --repair-plan` writes safe guidance to:
79
+
80
+ ```txt
81
+ .soturail/brain/stale-repair-plan.json
82
+ .soturail/brain/stale-repair-plan.md
83
+ ```
84
+
85
+ Repair plans never edit code, docs or claims. They name the record, source path, affected range, candidate new range, related validations and suggested commands for a human review.
86
+
87
+ `brain doctor --repair-plan` checks JSONL validity, profile/index/freshness files, duplicate groups, stale/suspect records, open gaps, rules without sources, agent exports and integration status. It prints next commands for scan, consolidate, stale repair, export, rules and brain evaluation.
65
88
 
66
89
  `brain export` writes agent-safe briefs to `.soturail/brain/exports/<agent>.md`. Generic exports also write `.soturail/brain/exports/agent-brief.md`.
67
90
 
91
+ v0.8.1 briefs are bounded by default and separate:
92
+
93
+ - verified rules and claims;
94
+ - active decisions;
95
+ - known gaps;
96
+ - recurring bugs and harness patterns;
97
+ - suspect claims;
98
+ - stale claims;
99
+ - safe commands and critical commands;
100
+ - recovery pointers;
101
+ - source references.
102
+
103
+ Stale claims are not placed in the verified section.
104
+
68
105
  ## Agent-Safe Export
69
106
 
70
107
  Brain exports include:
@@ -82,6 +119,65 @@ Brain exports include:
82
119
 
83
120
  Exports do not include private memory unless it is explicitly approved. Generated briefs must be reviewed before agent handoff.
84
121
 
122
+ ## Troubleshooting
123
+
124
+ ### Problem: brain stale reports many suspect claims
125
+
126
+ Run:
127
+
128
+ ```bash
129
+ soturail brain stale --repair-plan
130
+ soturail reverse claims ./src
131
+ soturail brain consolidate --dry-run
132
+ ```
133
+
134
+ Then inspect `.soturail/brain/stale-repair-plan.md`. A suspect claim means the evidence changed enough to require review; it does not mean SotuRail fixed or rejected the claim.
135
+
136
+ ### Problem: agent brief is too long
137
+
138
+ Run:
139
+
140
+ ```bash
141
+ soturail brain export --agent codex --limit 10
142
+ ```
143
+
144
+ Use `--include-suspect` only when the agent explicitly needs warning context.
145
+
146
+ ### Problem: rules from brain are too weak
147
+
148
+ Check:
149
+
150
+ - claims must be verified before they can become active rules;
151
+ - stale or suspect sources are excluded from active rules by default;
152
+ - rules must link to `sourceClaimIds` or `sourceDecisionIds`;
153
+ - test-backed claims produce stronger enforcement than unvalidated facts.
154
+
155
+ ## v0.9.0 Benchmark Seeds
156
+
157
+ v0.9.0 adds lightweight timing/reporting around Project Brain-related operations through Benchmark Rail 2.0:
158
+
159
+ ```bash
160
+ soturail bench run --suite brain
161
+ soturail native candidates
162
+ ```
163
+
164
+ Candidate categories include:
165
+
166
+ ```txt
167
+ brain-scan
168
+ brain-stale
169
+ brain-consolidate
170
+ reverse-claims
171
+ format-compare
172
+ json-validate
173
+ reducer-large-log
174
+ workflow-evidence
175
+ ```
176
+
177
+ TypeScript fallback must always work. Rust/native acceleration remains optional and should not be required for npm install.
178
+
179
+ Project Brain performance evidence lives under `.soturail/bench/` and can be referenced by release and workflow evidence. Timing values are not public speed claims by themselves.
180
+
85
181
  ## Limitations
86
182
 
87
183
  - No LLM extraction.
@@ -89,4 +185,5 @@ Exports do not include private memory unless it is explicitly approved. Generate
89
185
  - No network calls.
90
186
  - No cloud sync.
91
187
  - No full static analyzer.
188
+ - No automatic repair of code, docs or claims.
92
189
  - No claim should be treated as true without source evidence and freshness checks.
@@ -20,6 +20,8 @@ The check also verifies:
20
20
  - `CHANGELOG.md` and `docs/releases/RELEASE_NOTES_vX.Y.Z.md` exist for the local version;
21
21
  - README install instructions and `LICENSE` exist.
22
22
  - required GitHub CI and community files exist under `.github/`.
23
+ - optional performance evidence paths for benchmark, native candidate and baseline reports when present.
24
+ - TypeScript fallback status and native-optional install policy.
23
25
 
24
26
  Release notes now live under `docs/releases/`. Root-level `RELEASE_NOTES_vX.Y.Z.md` files should not be created for new releases.
25
27
 
@@ -48,6 +50,17 @@ soturail release check
48
50
 
49
51
  These commands do not publish to npm or create GitHub releases.
50
52
 
53
+ v0.9.0 adds performance evidence for release readiness:
54
+
55
+ ```bash
56
+ soturail bench run --suite brain
57
+ soturail native candidates
58
+ soturail self baseline --check
59
+ soturail release check
60
+ ```
61
+
62
+ Release preflight warns when benchmark/native/baseline reports are missing, but native unavailability is not a release failure. A broken TypeScript fallback is a release blocker.
63
+
51
64
  You can run only the package verification gate with:
52
65
 
53
66
  ```bash
@@ -26,3 +26,5 @@ docs/releases/RELEASE_NOTES_vX.Y.Z.md
26
26
  - [v0.6.1](RELEASE_NOTES_v0.6.1.md)
27
27
  - [v0.7.0](RELEASE_NOTES_v0.7.0.md)
28
28
  - [v0.8.0](RELEASE_NOTES_v0.8.0.md)
29
+ - [v0.8.1](RELEASE_NOTES_v0.8.1.md)
30
+ - [v0.9.0](RELEASE_NOTES_v0.9.0.md)
@@ -0,0 +1,42 @@
1
+ # SotuRail v0.8.1 - Release Notes
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ npm install -g soturail@0.8.1
7
+ soturail --version
8
+ ```
9
+
10
+ ## Highlights
11
+
12
+ - Polished Project Brain stale detection with source-range relocation events.
13
+ - Added `soturail brain consolidate --dry-run` for duplicate claim grouping.
14
+ - Added `soturail brain stale --repair-plan` and `soturail brain doctor --repair-plan`.
15
+ - Improved agent briefs with verified/suspect/stale separation, section limits, source references and recovery pointers.
16
+ - Made `soturail rules from-brain` safer by excluding stale/suspect claims from active rules.
17
+ - Expanded the brain evaluation suite with v0.8.1 quality cases.
18
+
19
+ ## Safety
20
+
21
+ - Repair plans are guidance only. SotuRail does not auto-edit code, docs or claims.
22
+ - Project Brain remains local and deterministic: no LLM calls, embeddings, cloud service or network-required tests.
23
+ - Native/performance work remains benchmark-gated and TypeScript fallback remains mandatory.
24
+
25
+ ## Validation
26
+
27
+ - `npx vitest run tests/v081.test.ts`
28
+ - `npx vitest run tests/v080.test.ts`
29
+ - `npm run typecheck`
30
+ - `npm run build`
31
+ - `npm test`
32
+ - `npm run release:check`
33
+ - `git diff --check`
34
+ - `node dist/cli.js brain consolidate --dry-run`
35
+ - `node dist/cli.js brain stale --repair-plan`
36
+ - `node dist/cli.js brain doctor --repair-plan`
37
+ - `node dist/cli.js eval run --suite brain`
38
+
39
+ ## Links
40
+
41
+ - npm: https://www.npmjs.com/package/soturail
42
+ - GitHub: https://github.com/Soturine/soturail
@@ -0,0 +1,35 @@
1
+ # SotuRail v0.9.0 - Release Notes
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ npm install -g soturail@0.9.0
7
+ soturail --version
8
+ ```
9
+
10
+ ## Highlights
11
+
12
+ - Added Benchmark Rail 2.0 reports with `soturail bench list`, `bench run --suite <suite>`, `bench compare` and stable `.soturail/bench/latest.*` output.
13
+ - Added benchmark categories for Project Brain, reducers, JSONL, range hashing, file scanning, workflow evidence and release preflight.
14
+ - Added `soturail native candidates`, `native status`, improved `native doctor` and `native compare` so native work is classified before any acceleration claim.
15
+ - Added `soturail self baseline --check|--zip|--bundle|--pack` for clean source, history and package snapshots.
16
+ - Release and workflow evidence now reference benchmark, native candidate and baseline reports when present.
17
+ - Added docs for benchmark-gated native policy, baseline snapshots and the deferred parser/graph seed.
18
+
19
+ ## Safety
20
+
21
+ - TypeScript fallback remains mandatory and default.
22
+ - Rust/native remains optional.
23
+ - Normal npm install does not require Rust, Cargo or native build tools.
24
+ - SotuRail does not claim native speedups unless a local benchmark report proves them.
25
+ - Parser/graph work is documented as a future seed, not promoted as a mandatory runtime.
26
+
27
+ ## Validation
28
+
29
+ - `npm run typecheck`
30
+ - `npm run build`
31
+ - `npm test`
32
+ - `npm run release:check`
33
+ - `node dist/cli.js bench run --suite brain`
34
+ - `node dist/cli.js native candidates`
35
+ - `node dist/cli.js self baseline --check`
@@ -38,6 +38,14 @@ The report summarizes scanned files, detected commands/modules, likely rails, li
38
38
 
39
39
  Claims are appended to `.soturail/brain/claims.jsonl` only when their stable ID is not already present.
40
40
 
41
+ After a large reverse-claims run, use:
42
+
43
+ ```bash
44
+ soturail brain consolidate --dry-run
45
+ ```
46
+
47
+ This groups duplicate and near-duplicate claims into a report while preserving the append-only claim history.
48
+
41
49
  ## Draft Specs
42
50
 
43
51
  `reverse specs` writes draft specs under `.soturail/brain/specs/`:
@@ -71,3 +79,14 @@ Outputs:
71
79
  ```
72
80
 
73
81
  Use it as compact context for an agent, then verify against the cited source paths before changing code.
82
+
83
+ ## v0.9.0 Performance Evidence
84
+
85
+ Reverse claim extraction is now tracked as a Benchmark Rail 2.0 category:
86
+
87
+ ```bash
88
+ soturail bench run --suite brain
89
+ soturail native candidates
90
+ ```
91
+
92
+ `reverse-claims` is classified as a possible native/parser candidate only after local TypeScript benchmark evidence exists. The current rail remains heuristic, local and TypeScript-first.
package/docs/rules.md CHANGED
@@ -36,10 +36,13 @@ soturail rules doctor
36
36
  ```txt
37
37
  .soturail/brain/rules.jsonl
38
38
  .soturail/rules/from-brain.md
39
+ .soturail/rules/from-brain.json
39
40
  ```
40
41
 
41
42
  Each rule links back to claim IDs or decision IDs. Treat the output as advisory until a human promotes it to a policy gate or deterministic validator.
42
43
 
44
+ v0.8.1 avoids active rules from stale or suspect claims by default. Run `soturail brain stale --repair-plan` and `soturail brain consolidate --dry-run` before deriving rules when the brain has drifted.
45
+
43
46
  ## Planned Policy Rule IDs
44
47
 
45
48
  Policy Rail should eventually expose stable, readable rule IDs for risky agent-assisted actions.
@@ -113,9 +113,24 @@ Evidence packs include:
113
113
  - evaluation report result;
114
114
  - release notes path under `docs/releases/`;
115
115
  - release gates and publish checklist notes.
116
+ - latest benchmark report path when available;
117
+ - native candidate report path when available;
118
+ - baseline snapshot report path when available;
119
+ - engine status and TypeScript fallback note.
116
120
 
117
121
  SotuRail does not claim build, test, audit, npm pack, publish or GitHub release success unless those results exist as local evidence.
118
122
 
123
+ v0.9.0 also lets workflow evidence point to performance readiness:
124
+
125
+ ```bash
126
+ soturail bench run --suite brain
127
+ soturail native candidates
128
+ soturail self baseline --check
129
+ soturail workflow evidence <id>
130
+ ```
131
+
132
+ Native speedups are not claimed from workflow evidence alone. The evidence pack only records where the local benchmark and candidate reports live.
133
+
119
134
  ## Worktrees
120
135
 
121
136
  `soturail workflow start <id> --worktree --dry-run` prints a local worktree plan. If run without `--dry-run` inside a Git repository, SotuRail may create a local worktree under `.soturail/worktrees/<id>/`.
@@ -147,10 +162,18 @@ Future Workflow Rail work can add richer trace/report commands, deeper task gene
147
162
 
148
163
  v0.8.0 lets Workflow Rail evidence reference Project Brain status. A workflow evidence pack can show the local brain profile path, claim count, gap count and stale-event count.
149
164
 
165
+ v0.8.1 adds stronger workflow evidence hints:
166
+
167
+ - brain suspect/stale count;
168
+ - latest brain doctor path when available;
169
+ - repair-plan flow for stale claims that affect release or workflow evidence.
170
+
150
171
  Useful flow:
151
172
 
152
173
  ```bash
153
174
  soturail brain scan
175
+ soturail brain stale --repair-plan
176
+ soturail brain doctor --repair-plan
154
177
  soturail workflow verify
155
178
  soturail workflow evidence <id>
156
179
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soturail",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Local-first context rails for AI coding agents: reversible terminal compression, progressive repo reading, SDD workflows, hooks, benchmarks, memory and cache-friendly payloads.",
5
5
  "type": "module",
6
6
  "bin": {