@gregiteen/ssss-cli 0.7.1 → 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 (48) hide show
  1. package/CHANGELOG.md +42 -4
  2. package/README.md +19 -4
  3. package/VERSION +1 -1
  4. package/conformance/README.md +11 -7
  5. package/conformance/fixtures.json +24 -2
  6. package/conformance/reference-bundle.ucw.json +2 -2
  7. package/docs/help/bundle.md +6 -2
  8. package/docs/help/import.md +2 -0
  9. package/docs/help/overview.md +8 -4
  10. package/docs/help/semantic.md +38 -0
  11. package/docs/ssss-spec.md +67 -7
  12. package/package.json +27 -3
  13. package/registry/core.json +36 -3
  14. package/scripts/audit-registry-field-usage.mjs +10 -1
  15. package/scripts/build-reference-bundle.mjs +4 -1
  16. package/scripts/cmd-adapter.mjs +29 -0
  17. package/scripts/cmd-export.mjs +3 -3
  18. package/scripts/cmd-import.mjs +1 -1
  19. package/scripts/cmd-migrate.mjs +26 -0
  20. package/scripts/cmd-new.mjs +5 -5
  21. package/scripts/cmd-primitive.mjs +48 -0
  22. package/scripts/cmd-registry.mjs +25 -0
  23. package/scripts/cmd-semantic.mjs +86 -0
  24. package/scripts/conformance-09.mjs +199 -0
  25. package/scripts/conformance.mjs +320 -28
  26. package/scripts/ssss.mjs +10 -0
  27. package/skills/ssss/SKILL.md +221 -0
  28. package/skills/ssss/evals/evals.json +37 -0
  29. package/skills/ssss/references/contract-reference.md +95 -0
  30. package/skills/ssss/scripts/validate-schema.mjs +215 -0
  31. package/skills/ssss/subagents/audit-ssss-contract.md +22 -0
  32. package/src/authorization.mjs +61 -0
  33. package/src/bundle.mjs +171 -35
  34. package/src/engine.mjs +101 -429
  35. package/src/events.mjs +90 -0
  36. package/src/guard.mjs +32 -0
  37. package/src/http.mjs +26 -0
  38. package/src/idempotency.mjs +55 -0
  39. package/src/kernel.mjs +260 -0
  40. package/src/leases.mjs +125 -0
  41. package/src/primitive.mjs +227 -0
  42. package/src/projections.mjs +62 -0
  43. package/src/registry.mjs +408 -17
  44. package/src/semantic.mjs +210 -0
  45. package/src/ui.mjs +100 -0
  46. package/src/validator.mjs +87 -0
  47. package/src/vfs.mjs +203 -0
  48. package/types/kernel.d.ts +48 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,44 @@ All notable changes to the SSSS (Structured Semantic Syntax System) spec will be
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [0.8.0] - 2026-07-10
11
+ ### Changed
12
+ - Core registry/spec version is now `0.7`. Registry `patterns`,
13
+ `immutable_fields`, and `references` are enforced by the reference engine and
14
+ covered by the parity auditor.
15
+ - Bundle import now preflights the complete envelope plan before committing, so a
16
+ late invalid document cannot leave a partial installation.
17
+ - Bundle validation now applies all registry field constraints and returns
18
+ structured errors for malformed file entries instead of throwing.
19
+
20
+ ### Fixed
21
+ - Bundle provenance now uses the real published package identity,
22
+ `@gregiteen/ssss-cli`, instead of an unavailable package alias. The
23
+ reference bundle derives its exporter name and version from `package.json`.
24
+
25
+ ### Added
26
+ - A tracked, first-class `ssss` skill package with evidence-first canon routing,
27
+ a dependency-free document validator, contract reference, evals, and audit
28
+ prompt. The skill is included in the npm package allowlist.
29
+ - Conformance checks that pin default and reference-bundle exporter identities
30
+ to current package metadata.
31
+ - The `translation` document primitive and spec §11.9 semantic/localization
32
+ contract: exact-hash structural sources, immutable overlay identity, and
33
+ natural-language-only translated fields.
34
+ - `@gregiteen/ssss-cli/semantic`, `ssss semantic`, and `ssss localize` for
35
+ deterministic Unicode search/graph projections and non-destructive localized
36
+ materialization through a whole-projection staging directory.
37
+ - Fail-closed extension registry composition for malformed fields, invalid
38
+ regular expressions, symlinks, reserved ids, and core/sibling collisions.
39
+ - Privacy-safe semantic defaults that exclude `tenant_private` and
40
+ `resource_bound` data unless explicitly requested in an authorized context.
41
+ - Conformance fixtures 024–026 plus dedicated extension-registry,
42
+ semantic/localization, and expanded CLI smoke groups.
43
+ - Offline help for semantic search and localization, plus a security/UX impact
44
+ report for downstream host implementers.
45
+
8
46
  ## [0.7.1] - 2026-07-08
9
47
  ### Fixed
10
48
  - Reduced `resource_bound` primitives to requirement declarations in `template`
@@ -62,7 +100,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
62
100
  trigger evaluation across daemon, cron, webhook, file-change, event, condition,
63
101
  and manual runtimes. Workflows own `triggers[]`; external schedulers are only
64
102
  wake-up mechanisms.
65
- - **`@ssss/cli/runtime` helpers** — deterministic `planWorkflowTrigger()` and
103
+ - **`@gregiteen/ssss-cli/runtime` helpers** — deterministic `planWorkflowTrigger()` and
66
104
  `createRunEnvelope()` helpers derive `workflow_triggered` events, task
67
105
  documents, and run documents through the Operation Contract.
68
106
  - **Runtime conformance metadata/checks** — `conformance/fixtures.json` v1.3.0
@@ -79,7 +117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
79
117
  a starter `vault/` of core primitives (incl. a `tenant_private` task to demonstrate
80
118
  the sale-drop), a dependency-free conformance test (`node --test`) that replays the
81
119
  canonical fixtures through the engine and round-trips the vault as a `sale` bundle,
82
- plus `package.json` (pinned to the matching `@ssss/cli` tag), `CLAUDE.md`, `README`,
120
+ plus `package.json` (pinned to the matching `@gregiteen/ssss-cli` tag), `CLAUDE.md`, `README`,
83
121
  and `.gitignore`. Flags: `--with-total-recall` (wire the Total Recall memory OS),
84
122
  `--install` (npm install + Total Recall init + verify), `--ref`, `--name`, `--force`,
85
123
  `--no-git`. All shelling-out uses `execFileSync` with fixed argv (no shell). Docs:
@@ -114,7 +152,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
114
152
  `ssss help [topic]` serving offline docs from `docs/help/` and `ssss version`. Each
115
153
  command has its own `--help`. Shared parsing/formatting in `scripts/lib/cli.mjs`.
116
154
  - **Open-source packaging** — `README.md`, `LICENSE` (ISC), `.gitignore`, and
117
- `package.json` metadata (`engines`, `repository`, `files`) so `@ssss/cli` is
155
+ `package.json` metadata (`engines`, `repository`, `files`) so `@gregiteen/ssss-cli` is
118
156
  publishable and the runtime-read paths (`VERSION`, `docs/help`) ship in the tarball.
119
157
 
120
158
  ### Changed
@@ -133,7 +171,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
133
171
  the canonical Operation Contract as the fourth envelope type. Removes a replace-type file,
134
172
  rejects append-type targets, and emits a deletion event for audit. Idempotent.
135
173
  - **Reference engine (`src/engine.mjs`, `src/registry.mjs`, `src/frontmatter.mjs`)** — the
136
- canonical, dependency-free `@ssss/cli` Operation Contract engine. Harvested from total-recall
174
+ canonical, dependency-free `@gregiteen/ssss-cli` Operation Contract engine. Harvested from total-recall
137
175
  (§6.3 pipeline, idempotency replay from the audit log, `buildRepair`/§9 repair blocks) and
138
176
  festech (`delete` envelope, `resolveContainedPath` path-traversal guard, registry-driven
139
177
  content validation). Validates content against `registry/core.json` + `registry/extensions/*`
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  > Turn a running business into a single tradeable file — *a festival in a box.*
5
5
 
6
6
  [![conformance](https://img.shields.io/badge/conformance-fixtures%20%2B%20runtime%20%2B%20bundle-brightgreen)](conformance/)
7
- [![spec](https://img.shields.io/badge/spec-v0.6%20draft-blue)](docs/ssss-spec.md)
7
+ [![spec](https://img.shields.io/badge/spec-v0.9%20draft-blue)](docs/ssss-spec.md)
8
8
  [![OKF](https://img.shields.io/badge/OKF-v0.1%20compatible-blue)](docs/ssss-spec.md)
9
9
 
10
10
  SSSS is the vendor-neutral standard and reference implementation shared by
@@ -16,6 +16,8 @@ SSSS is the vendor-neutral standard and reference implementation shared by
16
16
  `event` / `delete`) for mutating a vault, with idempotency replay and audit.
17
17
  - **The Workflow Runtime Contract** (§11.8) — workflows own triggers; daemons,
18
18
  crons, and webhooks derive idempotent event/task/run envelopes from the vault.
19
+ - **Multilingual semantic runtime** (§11.9) — deterministic lexical evidence,
20
+ injected multilingual embeddings, and runtime rendering with symbolic controls fixed.
19
21
  - **Portability classification** (§5.5) — the keystone: every primitive is
20
22
  `structural`, `tenant_private`, or `resource_bound`, so a vault can be *sold*
21
23
  without leaking the operator's private data.
@@ -77,6 +79,7 @@ ssss import festival.ucw.json --vault ./new-tenant \
77
79
  | `ssss inspect <bundle>` | Human-readable summary (manifest, inventory, params, steps). |
78
80
  | `ssss provision <bundle>` | Plan an install: params + link integrity → envelopes (§17). |
79
81
  | `ssss import <bundle>` | Replay a bundle/plan into a vault via the engine (idempotent). |
82
+ | `ssss semantic <vault>` | Build or query a deterministic, privacy-safe semantic index (§11.9). |
80
83
  | `ssss autolink [dir]` | Generate OKF wiki-links across a vault. |
81
84
  | `ssss conformance` | Run the canonical conformance suite (§12). |
82
85
  | `ssss help [topic]` | Local docs: `runtime`, `portability`, `bundle`, `provisioning`, `leases`, … |
@@ -89,6 +92,7 @@ Run `ssss <command> --help` for flags, or `ssss help <topic>` for concepts.
89
92
  import { createEngine } from '@gregiteen/ssss-cli/engine';
90
93
  import { exportBundle, validateBundle, provisionBundle, importBundle } from '@gregiteen/ssss-cli/bundle';
91
94
  import { planWorkflowTrigger } from '@gregiteen/ssss-cli/runtime';
95
+ import { buildSemanticIndex, searchSemanticIndex, renderSemanticRecord } from '@gregiteen/ssss-cli/semantic';
92
96
 
93
97
  const bundle = exportBundle('./my-vault', { profile: 'sale', name: 'Festival in a Box' });
94
98
  const { valid, errors } = validateBundle(bundle);
@@ -113,11 +117,20 @@ const runtimePlan = planWorkflowTrigger({
113
117
  trigger: { type: 'cron', id: 'daily-0800', cron: '0 8 * * *' },
114
118
  scheduledFor: '2026-07-02T14:00:00.000Z',
115
119
  });
120
+
121
+ const index = buildSemanticIndex('./my-vault');
122
+ const matches = searchSemanticIndex(index, 'política de reembolsos');
123
+ const rendered = await renderSemanticRecord(matches[0].document, { language: 'es', render: renderer });
116
124
  ```
117
125
 
118
126
  Exports: `@gregiteen/ssss-cli` / `@gregiteen/ssss-cli/engine` (Operation Contract engine),
119
127
  `@gregiteen/ssss-cli/bundle` (export/provision/import), `@gregiteen/ssss-cli/registry`,
120
- `@gregiteen/ssss-cli/runtime`, `@gregiteen/ssss-cli/frontmatter`.
128
+ `@gregiteen/ssss-cli/runtime`, `@gregiteen/ssss-cli/semantic`,
129
+ `@gregiteen/ssss-cli/frontmatter`.
130
+
131
+ Canonical content is authored once in any language. Multilingual embedding and render
132
+ adapters handle cross-language retrieval and presentation at runtime; primitive IDs,
133
+ field IDs, enum codes, permissions, paths, hashes, and relations never change.
121
134
 
122
135
  ## Portability — why a vault is safe to sell
123
136
 
@@ -144,17 +157,19 @@ npm test # == ssss conformance --engine
144
157
  ## Repository layout
145
158
 
146
159
  ```
147
- docs/ssss-spec.md The normative specification (v0.6 draft).
160
+ docs/ssss-spec.md The normative specification (v0.9 draft).
148
161
  docs/help/ Topic docs surfaced by `ssss help`.
149
- registry/core.json 14 document + 5 contract primitives; bundle & provisioning schemas.
162
+ registry/core.json 15 document + 5 contract primitives; semantic, bundle & provisioning schemas.
150
163
  registry/extensions/ Application extension registries (e.g. festech).
151
164
  src/engine.mjs Operation Contract engine (§6).
152
165
  src/runtime.mjs Workflow trigger → event/task/run envelope planning (§11.8).
166
+ src/semantic.mjs Multilingual semantic retrieval + runtime rendering (§11.9).
153
167
  src/bundle.mjs export / validate / provision / import (§16–§17).
154
168
  src/registry.mjs Registry-driven type + portability resolution.
155
169
  src/frontmatter.mjs Zero-dependency YAML frontmatter.
156
170
  scripts/ssss.mjs The `ssss` CLI dispatcher.
157
171
  conformance/ Canonical fixtures + reference bundle.
172
+ skills/ssss/ Packaged SSSS system skill and dependency-free validator.
158
173
  ```
159
174
 
160
175
  ## License
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.9.0
@@ -11,13 +11,13 @@ shared test suite every implementation MUST pass to claim conformance (spec §12
11
11
  |------|---------|
12
12
  | [`fixtures.json`](fixtures.json) | Canonical request/response fixtures for the Operation Contract (spec §6). |
13
13
  | [`reference-bundle.ucw.json`](reference-bundle.ucw.json) | The canonical `.ucw` reference bundle (spec §16, "Festival in a Box"). A `sale`-profile export, content-hashed; round-tripped by the runner. Rebuild with `node scripts/build-reference-bundle.mjs`. |
14
- | `../registry/core.json` | The 14 core document primitives + 5 contract primitives, plus the `runtime` (§11.8), `bundle` (§16), and `provisioning` (§17) schemas the standard owns. |
14
+ | `../registry/core.json` | The 15 core document primitives + 5 contract primitives, plus `runtime` (§11.8), `semantic` (§11.9), `bundle` (§16), and `provisioning` (§17) contracts. |
15
15
 
16
16
  ## Implementations under test
17
17
 
18
18
  | Implementation | SSSS surface | Core primitives | Extensions |
19
19
  |----------------|--------------|-----------------|------------|
20
- | **festech.live** | `SsssOperationService` + `SsssLeaseService`, Postgres event log, ~4,024 vault files | all 14 ✓ | 118 app primitives |
20
+ | **festech.live** | `SsssOperationService` + `SsssLeaseService`, Postgres event log, ~4,024 vault files | integration audit required for core v0.7 | 118 app primitives |
21
21
  | **ultrachat** | SQL `ssss_core_contract` + hardening migrations, `SsssApiClient`, ~1,110 vault files | (audit pending) | app primitives |
22
22
  | **total-recall** | Markdown-native kernel, `validate-schema.mjs`, memory vault | memory-centric subset | memory categories |
23
23
 
@@ -32,8 +32,10 @@ npx ssss conformance --endpoint <url> --token <pat> # run fixtures against a l
32
32
  The runner validates that the fixture file is well-formed and that every
33
33
  `expected_response` is internally consistent with the envelope rules. With
34
34
  `--engine`, it replays every fixture through the reference engine (`src/engine.mjs`),
35
- checks workflow runtime planning (`src/runtime.mjs`, spec §11.8), runs regression
36
- coverage for patch serialization and leases (§6/§7), and round-trips the
35
+ checks workflow runtime planning (`src/runtime.mjs`, spec §11.8), extension-registry
36
+ collision/schema/symlink safety and multilingual semantic retrieval/rendering (`src/semantic.mjs`,
37
+ §11.9), runs regression coverage for patch serialization and leases (§6/§7), and
38
+ round-trips the
37
39
  reference bundle (validate → provision → import → re-import, spec §16/§17)
38
40
  against a temp vault — proving idempotency, strict bundle shape validation, and
39
41
  that no `tenant_private` or seller-bound `resource_bound` value ever lands. With
@@ -42,18 +44,20 @@ endpoint and diffs the response.
42
44
 
43
45
  ## Core vs. extension registry
44
46
 
45
- The standard owns only the **core**: the 14 document primitives and 5 contract
47
+ The standard owns only the **core**: the 15 document primitives and 5 contract
46
48
  primitives in [`../registry/core.json`](../registry/core.json), plus the `runtime`
47
- (§11.8), `bundle` (§16), and `provisioning` (§17) schemas. Every conformant
49
+ (§11.8), `semantic` (§11.9), `bundle` (§16), and `provisioning` contracts. Every conformant
48
50
  implementation maps to the same core.
49
51
 
50
52
  Applications **extend** the core with their own primitives (festech has 118 —
51
53
  `meeting`, `phone_number`, `inventory_item`, `language_convention`, …). Extensions:
52
54
 
53
55
  - MUST NOT redefine or shadow a core type.
56
+ - MUST NOT redefine a type from a sibling extension.
57
+ - MUST be regular, non-symlinked JSON files with valid regex patterns and field lists.
54
58
  - Live in the application's own extension registry, not here.
55
59
  - SHOULD follow the same schema shape as core entries (`required_fields`,
56
- `append_only`, enums) so the same validator handles them.
60
+ `append_only`, enums, patterns, immutable fields, references) so the same validator handles them.
57
61
 
58
62
  ## ⚠️ Open reconciliation items (spec ⇄ implementation drift)
59
63
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://ssss.dev/conformance/v1",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Canonical SSSS Operation Contract conformance fixtures. These define the canonical request/response shapes for the Operation Contract (spec §6) and are the shared test contract every SSSS implementation MUST pass. A host is conformant only if, for every fixture, it produces the expected response and status code (spec §12).",
5
5
  "spec_url": "../docs/ssss-spec.md",
6
6
  "operation_types": {
@@ -86,6 +86,9 @@
86
86
  "Required fields for each primitive type must be present and non-empty",
87
87
  "required_when-conditional fields must be present when their condition matches (spec §9)",
88
88
  "Fields with a registry-declared enum must take one of the declared values",
89
+ "Fields with a registry-declared pattern must match it",
90
+ "Registry-declared immutable fields cannot change through operation replacement or patch",
91
+ "Registry-declared document references must be safe, resolvable, type/portability-compatible, and hash-valid",
89
92
  "See /api/v1/ssss/schema for the full type schema definitions"
90
93
  ],
91
94
  "authorization": [
@@ -741,6 +744,25 @@
741
744
  }
742
745
  },
743
746
  "expected_http_status": 409
747
+ },
748
+ {
749
+ "id": "fixture-024",
750
+ "name": "Multilingual source — valid Spanish structural rule",
751
+ "description": "Natural-language fields may be authored in any language while symbolic controls remain stable.",
752
+ "request": {
753
+ "type": "operation",
754
+ "idempotency_key": "35353535-3535-3535-3535-353535353535",
755
+ "path": "rules/translatable-refund-rule.md",
756
+ "workspace_id": "TEST_WORKSPACE_ID",
757
+ "actor": { "role": "system" },
758
+ "content": "---\ntype: rule\ntitle: \"Política de reembolsos\"\ndescription: \"Explica cuándo están disponibles los reembolsos.\"\ntimestamp: \"2026-07-10T00:00:00Z\"\nname: refund-policy\nlanguage: es\n---\nLos reembolsos están disponibles antes de la fecha límite.",
759
+ "intent": "Conformance fixture: create a non-English structural source"
760
+ },
761
+ "expected_response": {
762
+ "success": true,
763
+ "type": "operation",
764
+ "validation": { "valid": true, "type": "rule", "errors": [] }
765
+ }
744
766
  }
745
767
  ],
746
768
  "error_codes": {
@@ -759,5 +781,5 @@
759
781
  ],
760
782
  "maintained_by": "SSSS standard (canonical: this repo)",
761
783
  "provenance": "Seeded from the festech.live reference implementation, which authored the original shared contract; canonicalized here as the vendor-neutral source of truth.",
762
- "last_updated": "2026-07-02"
784
+ "last_updated": "2026-07-10"
763
785
  }
@@ -4,7 +4,7 @@
4
4
  "description": "A complete music-festival operation as a tradeable SSSS bundle.",
5
5
  "version": "1.0.0",
6
6
  "exported_at": "1970-01-01T00:00:00.000Z",
7
- "ssss_core_version": "0.6",
7
+ "ssss_core_version": "0.9",
8
8
  "required_extensions": [
9
9
  "festech"
10
10
  ],
@@ -88,7 +88,7 @@
88
88
  "file_count": 14,
89
89
  "provenance": {
90
90
  "content_hash": "sha256:7febd673938a3dc04c068e0bf08097a9783c09e612606d2df9a4db8dcb8907f5",
91
- "exporter": "@ssss/cli@0.7.0"
91
+ "exporter": "@gregiteen/ssss-cli@0.9.0"
92
92
  }
93
93
  },
94
94
  "files": [
@@ -13,7 +13,7 @@ integrity. The container file is conventionally named `*.ucw.json`.
13
13
  "description": "...",
14
14
  "version": "0.1.0",
15
15
  "exported_at": "1970-01-01T00:00:00.000Z", // frozen → deterministic export
16
- "ssss_core_version": "0.6",
16
+ "ssss_core_version": "0.7",
17
17
  "required_extensions": ["festech"],
18
18
  "export_profile": "sale", // backup | template | sale
19
19
  "primitive_inventory": { "workflow": 1, "page": 1, "rule": 1, "assistant": 1, "domain": 1 },
@@ -22,7 +22,7 @@ integrity. The container file is conventionally named `*.ucw.json`.
22
22
  "file_count": 5,
23
23
  "provenance": {
24
24
  "content_hash": "sha256:…", // over the canonical file serialization
25
- "exporter": "@ssss/cli"
25
+ "exporter": "@gregiteen/ssss-cli"
26
26
  }
27
27
  },
28
28
  "files": [ { "path": "rules/refund-policy.md", "content": "---\n…" } ]
@@ -36,6 +36,10 @@ of `files`. `ssss validate` recomputes it and rejects any mismatch — a bundle
36
36
  be silently edited. `primitive_inventory` is registry-driven (a count per `type`),
37
37
  not a closed category enum.
38
38
 
39
+ Bundle validation also applies registry patterns and document-reference rules.
40
+ Primitive, extension, and migration dependencies must resolve against the effective
41
+ registry before any file is committed.
42
+
39
43
  ## Parameters
40
44
 
41
45
  Each entry in `parameters[]` is a template variable resolved at provision time:
@@ -12,6 +12,8 @@ ssss import --plan plan.json --vault <dir> # replay a plan from `ssss prov
12
12
  - `--vault <dir>` is required and is created if missing.
13
13
  - Without `--plan`, import provisions inline first (resolving `--param` flags); a
14
14
  failed provision (unresolved params / dangling links) aborts before any write.
15
+ - The engine preflights every envelope in the plan before the first commit. A
16
+ late schema, reference, or authorization failure cannot leave a partial import.
15
17
  - `--dry-run` validates every envelope without committing and reports
16
18
  `would commit` instead of `committed`.
17
19
  - The normal summary reports `committed`, `unchanged (idempotent)`, and `failed`
@@ -5,16 +5,18 @@ and mutation contract for AI-agent state. A vault is a directory of Markdown fil
5
5
  with YAML frontmatter; every file declares a `type` defined in the registry.
6
6
 
7
7
  `@gregiteen/ssss-cli` is the reference implementation: a dependency-free Operation Contract
8
- engine, a registry-driven validator, and the `.ucw` bundle/provisioning tooling.
8
+ kernel, a registry-driven validator, multilingual semantic adapters, and the
9
+ `.ucw` bundle/provisioning tooling.
9
10
 
10
11
  ## The pieces
11
12
 
12
13
  | Piece | Where | What it is |
13
14
  |-------|-------|------------|
14
15
  | Spec | `docs/ssss-spec.md` | The normative standard. |
15
- | Core registry | `registry/core.json` | The 14 document primitives + 5 contract primitives, plus the bundle (§16) and provisioning (§17) schemas. |
16
+ | Core registry | `registry/core.json` | The 15 document primitives + 5 contract primitives, plus semantic (§11.9), bundle (§16), and provisioning (§17) contracts. |
16
17
  | Engine | `src/engine.mjs` | The §6 Operation Contract pipeline (operation/patch/event/delete). |
17
18
  | Runtime | `src/runtime.mjs` | The §11.8 workflow trigger → event/task/run envelope planner. |
19
+ | Semantic | `src/semantic.mjs` | Lexical evidence, multilingual embeddings, privacy filters, and runtime rendering (§11.9). |
18
20
  | Bundle | `src/bundle.mjs` | export / validate / provision / import (§16–§17). |
19
21
  | Conformance | `conformance/` | Fixtures every host must pass. |
20
22
 
@@ -28,6 +30,8 @@ vault ──export──▶ .ucw bundle ──provision──▶ envelope plan
28
30
  ## Commands
29
31
 
30
32
  Run `ssss help <topic>` for any of:
31
- `runtime`, `portability`, `bundle`, `provisioning`, `export`, `provision`, `import`, `conformance`, `autolink`.
33
+ `runtime`, `semantic`, `portability`, `bundle`, `provisioning`,
34
+ `export`, `provision`, `import`, `conformance`, `autolink`.
32
35
 
33
- Run `ssss <command> --help` for: `export`, `validate`, `inspect`, `provision`, `import`, `autolink`, `conformance`.
36
+ Run `ssss <command> --help` for: `export`, `validate`, `inspect`, `provision`,
37
+ `import`, `semantic`, `autolink`, `conformance`.
@@ -0,0 +1,38 @@
1
+ # Semantic projection (spec §11.9)
2
+
3
+ SSSS builds a deterministic search and graph projection directly from validated
4
+ Markdown. The projection is disposable: the vault remains the only source of truth.
5
+
6
+ ```bash
7
+ ssss semantic ./vault
8
+ ssss semantic ./vault --query "refund policy" --limit 5
9
+ ssss semantic ./vault --query "política de reembolsos"
10
+ ssss semantic ./vault --out ./derived/semantic.json
11
+ ```
12
+
13
+ Records include stable identity, source path and hash, type, portability, surface
14
+ text, normalized Unicode tokens, and graph edges derived from `relations`, wiki
15
+ links, and Markdown links. Results use deterministic weighted lexical ranking; hosts
16
+ may fuse embeddings without replacing this interoperable baseline.
17
+
18
+ ## Privacy and output safety
19
+
20
+ Only `structural` documents are indexed by default. `tenant_private` and
21
+ `resource_bound` sources require the explicit `--include-private` option and an
22
+ authorized caller. This option can expose customer or operational data; never enable
23
+ it for a public index.
24
+
25
+ `--out` must point to a regular file outside the source vault. Writes are atomic.
26
+ Symlinked vault entries and unsafe paths fail closed.
27
+
28
+ ## Library API
29
+
30
+ ```js
31
+ import { buildSemanticIndex, searchSemanticIndex } from '@gregiteen/ssss-cli/semantic';
32
+
33
+ const index = buildSemanticIndex('./vault');
34
+ const results = searchSemanticIndex(index, 'reembolsos', { limit: 10 });
35
+ ```
36
+
37
+ Hosts may inject a multilingual embedding adapter and runtime renderer. Presentation
38
+ may change language and formatting, but never symbolic controls or authorization.
package/docs/ssss-spec.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SSSS — Structured Semantic Syntax System
2
2
 
3
- **Specification v0.6 — Draft**
3
+ **Specification v0.7 — Draft**
4
4
 
5
5
  > This is the canonical, vendor-neutral specification for SSSS. It is the ground
6
6
  > truth on which all SSSS implementations are built. It is intended to be vendored
@@ -31,6 +31,10 @@ SSSS additionally defines the **Operation Contract**: a single, validated, idemp
31
31
  envelope through which all agent-generated mutations must flow. This makes
32
32
  AI-generated state changes deterministic, replayable, conflict-safe, and auditable.
33
33
 
34
+ Its semantic runtime turns the same canonical files into a deterministic searchable
35
+ graph, while multilingual embedding and render adapters localize presentation without
36
+ mutating symbolic control fields or private operational data.
37
+
34
38
  Any tool, IDE, agent framework, daemon, or CLI that can read Markdown can
35
39
  interoperate with an SSSS vault. The only thing that distinguishes a memory engine,
36
40
  a chat runtime, and a workflow orchestrator is *which primitive types they read and
@@ -124,6 +128,17 @@ For OKF-compatible discovery, SSSS document primitives SHOULD also include:
124
128
  | `tags` | array | Array of string tags for categorization and routing. |
125
129
  | `aliases` | array | Array of alternative names for this concept, used for wiki autolinking. |
126
130
 
131
+ For stable semantic identity and graph projection, documents SHOULD also include:
132
+
133
+ | Field | Type | Description |
134
+ |-------|------|-------------|
135
+ | `semantic_id` | string | Stable concept identity that survives file moves and localized presentation. |
136
+ | `relations` | array | Explicit semantic edges to other vault-relative document paths or semantic ids. |
137
+ | `locale` | string | BCP-47-style locale of the authored natural-language surface, when known. |
138
+
139
+ `resource`, `tags`, and `aliases` serve both OKF discovery and the semantic layer.
140
+ These fields are recommendations, not new universal requirements.
141
+
127
142
  Every primitive type defines its own additional REQUIRED and OPTIONAL fields
128
143
  (§5.4). To maintain forward compatibility and allow agents scratchpad space, hosts MUST NOT reject documents containing unknown frontmatter keys. Unknown fields MUST be preserved.
129
144
 
@@ -180,6 +195,7 @@ primitive — it implements the subset its product requires — but any primitiv
180
195
  | `page` | capability | structural | A VFS-native sandboxed custom workspace page. |
181
196
  | `migration` | meta | structural | An SSSS schema migration state record. |
182
197
  | `release` | meta | structural | An SSSS system schema version release record. |
198
+ | `primitive` | meta | structural | A governed, versioned definition for a namespaced SSSS primitive. |
183
199
 
184
200
  The **Portability** column is the primitive's default portability class (§5.5); a host
185
201
  resolves it from `registry/core.json`. Extension registries assign their own primitives a
@@ -201,7 +217,7 @@ Document primitives are either:
201
217
 
202
218
  - **Replace-type** — the whole file represents current state; a write replaces it
203
219
  entirely (`memory`, `skill`, `assistant`, `workflow`, `model`, `task`,
204
- `conflict`).
220
+ `conflict`, `primitive`).
205
221
  - **Append-type** — the file is an ordered, append-only log; writes add records to
206
222
  the body and MUST NOT rewrite prior records (`conversation`, `run`).
207
223
 
@@ -545,6 +561,14 @@ released_at: 2026-05-16T12:00:00Z
545
561
  ---
546
562
  ```
547
563
 
564
+ #### `primitive`
565
+
566
+ A governed definition for a namespaced primitive that can be authored in any human
567
+ language without changing the core registry. REQUIRED: `type`, `primitive_id`,
568
+ `namespace`, `version`, `name`, `mutation`, `portability`, `scopes`, and `fields`.
569
+ Stable primitive, field, enum, capability, and action identifiers are symbolic and
570
+ language-independent. Labels and descriptions are multilingual presentation data.
571
+
548
572
  ### 5.5 Portability Classification
549
573
 
550
574
  A workspace is not one undifferentiated blob. Some of it is the **reusable business
@@ -1042,11 +1066,41 @@ run, plus an event explaining the terminal failure.
1042
1066
 
1043
1067
  #### Runtime Helpers
1044
1068
 
1045
- The reference package exposes `@ssss/cli/runtime`, including deterministic helpers
1069
+ The reference package exposes `@gregiteen/ssss-cli/runtime`, including deterministic helpers
1046
1070
  for planning a workflow trigger into a `workflow_triggered` event envelope and a
1047
1071
  task `operation` envelope. Hosts MAY implement their own daemon, but SHOULD pass the
1048
1072
  runtime conformance checks to prove the same source-of-truth and idempotency rules.
1049
1073
 
1074
+ ### 11.9 Multilingual Semantic Runtime Contract
1075
+
1076
+ The semantic layer is a **derived projection** over validated vault documents. It
1077
+ MUST be deterministic for the same vault bytes, registry set, adapter identity, and projection
1078
+ options. It MUST NOT become a second source of truth.
1079
+
1080
+ Each projected record SHOULD expose a stable identity, source path and content hash,
1081
+ primitive type, portability class, surface text, normalized search tokens, and graph
1082
+ edges. Identity is resolved from `semantic_id`, then `resource`, then the source path.
1083
+ Edges are derived from explicit `relations`, wiki links, and Markdown links. Hosts MAY
1084
+ add embeddings or richer ranking, but the exact lexical/graph projection MUST remain
1085
+ available as a dependency-free interoperability baseline.
1086
+
1087
+ The safe default projection contains only `structural` documents. It MUST exclude
1088
+ `tenant_private` and `resource_bound` documents unless the caller explicitly enables
1089
+ private indexing in an authorized context. Language selection MUST NOT widen scope or
1090
+ implicitly disclose conversations, runs, tasks, credentials, customer data, or bound
1091
+ resource values.
1092
+
1093
+ A host MAY inject a multilingual embedding adapter. Every enriched record MUST carry
1094
+ the embedding model identity and vector dimension. Search SHOULD report lexical and
1095
+ semantic evidence separately before computing a hybrid score.
1096
+
1097
+ A host MAY inject an LLM render adapter at presentation time. The render request MUST
1098
+ carry an invariant-control block. Rendering MAY change natural-language title,
1099
+ description, body, formatting, dates, and units, but MUST NOT change primitive IDs,
1100
+ field IDs, enum codes, actions, permissions, paths, versions, hashes, or relations.
1101
+ Canonical documents are authored once in any language; SSSS 0.9 neither requires nor
1102
+ materializes translation documents or localized vault trees.
1103
+
1050
1104
  ---
1051
1105
 
1052
1106
  ## 12. Conformance
@@ -1061,6 +1115,11 @@ Fixtures are distributed as a JSON document carrying:
1061
1115
  - `idempotency` — TTL and replay behavior.
1062
1116
  - `validation_rules` — envelope and content rules.
1063
1117
  - `runtime_contract` — trigger vocabulary and daemon idempotency rules (§11.8).
1118
+ - registry-extension checks — schema shape, regex validity, symlink rejection, and
1119
+ core/sibling collision rejection.
1120
+ - multilingual semantic checks — deterministic indexing, privacy defaults, graph
1121
+ edges, embedding provenance, cross-language retrieval, and invariant rendering
1122
+ (§11.9).
1064
1123
  - `fixtures[]` — each with a `request`, an `expected_response`, and an
1065
1124
  OPTIONAL `expected_http_status`.
1066
1125
  - `error_codes` — the canonical code table.
@@ -1068,7 +1127,8 @@ Fixtures are distributed as a JSON document carrying:
1068
1127
  The conformance fixture set is the shared test contract between all SSSS
1069
1128
  implementations. A host MUST NOT claim SSSS conformance without passing the current
1070
1129
  fixture set. Hosts implementing workflow daemons SHOULD also run the reference
1071
- runtime checks exposed by `@ssss/cli/runtime`.
1130
+ runtime checks exposed by `@gregiteen/ssss-cli/runtime`. Hosts exposing semantic
1131
+ search or runtime rendering MUST also pass the §11.9 checks.
1072
1132
 
1073
1133
  ---
1074
1134
 
@@ -1096,7 +1156,7 @@ opaque ID as the slug and keep the human-readable label in `title` / `name`.
1096
1156
  This document is versioned independently of any host and of the conformance
1097
1157
  fixture set.
1098
1158
 
1099
- - The spec version is stated in the document header (currently **v0.6 — Draft**).
1159
+ - The spec version is stated in the document header (currently **v0.9 — Draft**).
1100
1160
  - Breaking changes to the file format, the type registry, or the Operation
1101
1161
  Contract increment the spec version.
1102
1162
  - Until **v1.0**, any version MAY introduce breaking changes.
@@ -1208,7 +1268,7 @@ them without a spec change.
1208
1268
  serialization of `files` (path-sorted, §16.1). An importer MUST recompute it and reject
1209
1269
  a bundle whose files do not match. This is what makes a bundle tamper-evident and what a
1210
1270
  marketplace lists against.
1211
- - `exporter` — an identifier for the tool/host that produced the bundle (`"@ssss/cli@0.3.0"`).
1271
+ - `exporter` — an identifier for the tool/host that produced the bundle (`"@gregiteen/ssss-cli@0.8.0"`).
1212
1272
  - `signature` — OPTIONAL detached signature over `content_hash` for a sold bundle, so a
1213
1273
  buyer can verify authorship. Unsigned bundles are valid; signing is a marketplace concern.
1214
1274
 
@@ -1313,7 +1373,7 @@ cannot resolve a link MUST fail the provision rather than emit a dangling refere
1313
1373
 
1314
1374
  The following frontmatter keys are reserved by this spec across all primitives and
1315
1375
  MUST NOT be repurposed by hosts: `type`, `slug`, `schema_version`, `status`,
1316
- `feedback`, `confidence`.
1376
+ `feedback`, `confidence`, `semantic_id`, `relations`, and `language`.
1317
1377
 
1318
1378
  Hosts adding their own frontmatter fields SHOULD prefix them `x_` to remain
1319
1379
  forward-compatible with future spec revisions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregiteen/ssss-cli",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "description": "CLI tools and the reference engine for the Structured Semantic Syntax System",
5
5
  "main": "src/engine.mjs",
6
6
  "exports": {
@@ -10,13 +10,31 @@
10
10
  "./registry": "./src/registry.mjs",
11
11
  "./frontmatter": "./src/frontmatter.mjs",
12
12
  "./bundle": "./src/bundle.mjs",
13
+ "./semantic": "./src/semantic.mjs",
14
+ "./primitive": "./src/primitive.mjs",
15
+ "./validator": "./src/validator.mjs",
16
+ "./kernel": {
17
+ "types": "./types/kernel.d.ts",
18
+ "import": "./src/kernel.mjs",
19
+ "default": "./src/kernel.mjs"
20
+ },
21
+ "./vfs": "./src/vfs.mjs",
22
+ "./identity": "./src/authorization.mjs",
23
+ "./authorization": "./src/authorization.mjs",
24
+ "./leases": "./src/leases.mjs",
25
+ "./idempotency": "./src/idempotency.mjs",
26
+ "./events": "./src/events.mjs",
27
+ "./projections": "./src/projections.mjs",
28
+ "./ui": "./src/ui.mjs",
29
+ "./http": "./src/http.mjs",
30
+ "./guard": "./src/guard.mjs",
13
31
  "./conformance/fixtures.json": "./conformance/fixtures.json",
14
32
  "./conformance/reference-bundle.ucw.json": "./conformance/reference-bundle.ucw.json",
15
33
  "./registry/core.json": "./registry/core.json",
16
34
  "./package.json": "./package.json"
17
35
  },
18
36
  "bin": {
19
- "ssss": "./scripts/ssss.mjs"
37
+ "ssss": "scripts/ssss.mjs"
20
38
  },
21
39
  "type": "module",
22
40
  "engines": {
@@ -24,11 +42,13 @@
24
42
  },
25
43
  "files": [
26
44
  "src",
45
+ "types",
27
46
  "scripts",
28
47
  "registry",
29
48
  "conformance",
30
49
  "docs/ssss-spec.md",
31
50
  "docs/help",
51
+ "skills/ssss",
32
52
  "VERSION",
33
53
  "README.md",
34
54
  "CHANGELOG.md",
@@ -46,7 +66,11 @@
46
66
  "vault",
47
67
  "operation-contract",
48
68
  "ucw",
49
- "provisioning"
69
+ "provisioning",
70
+ "semantic-search",
71
+ "multilingual",
72
+ "generative-ui",
73
+ "application-kernel"
50
74
  ],
51
75
  "author": "Greg Iteen",
52
76
  "license": "ISC",