@undefineds.co/models 0.2.27 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,6 +31,18 @@ import {
31
31
  } from '@undefineds.co/models'
32
32
  ```
33
33
 
34
+ ## Pi Package
35
+
36
+ `@undefineds.co/models` is also a Pi package. It exposes the shared
37
+ `solid-modeling` skill through the package manifest, so Pi users can install it
38
+ from npm or git:
39
+
40
+ ```bash
41
+ pi install npm:@undefineds.co/models
42
+ ```
43
+
44
+ After installation, Pi can load the skill from `skills/solid-modeling/SKILL.md`.
45
+
34
46
  ## Namespaces
35
47
 
36
48
  LinX-owned predicates and classes use the company namespace:
package/package.json CHANGED
@@ -1,10 +1,23 @@
1
1
  {
2
2
  "name": "@undefineds.co/models",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
+ "keywords": [
9
+ "pi-package",
10
+ "solid",
11
+ "rdf",
12
+ "pod",
13
+ "drizzle-solid",
14
+ "models"
15
+ ],
16
+ "pi": {
17
+ "skills": [
18
+ "./skills"
19
+ ]
20
+ },
8
21
  "bin": {
9
22
  "udfs": "./dist/bin/udfs.js"
10
23
  },
@@ -88,6 +101,7 @@
88
101
  "packageManager": "yarn@1.22.22",
89
102
  "files": [
90
103
  "dist",
104
+ "skills",
91
105
  "README.md",
92
106
  "package.json"
93
107
  ],
@@ -0,0 +1,41 @@
1
+ # Models Skills
2
+
3
+ This directory contains shared modeling skills owned by `@undefineds.co/models`.
4
+
5
+ `models` owns reusable Solid/RDF resource semantics for LinX, Xpod, and other
6
+ Pod-facing shells. Product shells should consume these skills and model
7
+ resources instead of keeping private copies of durable Pod modeling rules.
8
+
9
+ Current public skills:
10
+
11
+ - `solid-modeling` - shared Solid Pod, RDF, drizzle-solid, and resource-schema
12
+ modeling guidance.
13
+
14
+ Release automation validates this directory and packages:
15
+
16
+ - a generic skill archive for tools that understand `SKILL.md`
17
+ - a Codex plugin archive that contains the same skill source
18
+ - a Claude Code plugin archive that contains the same skill source
19
+
20
+ The publish workflow uploads those artifacts to the GitHub Release for the
21
+ version tag. It does not directly submit entries to Codex Marketplace or Claude
22
+ Code Marketplace.
23
+
24
+ Codex users can install the skill from the repository path once these files are
25
+ on `main`:
26
+
27
+ ```bash
28
+ npx codex-marketplace add undefinedsco/models/skills/solid-modeling --skill --global
29
+ ```
30
+
31
+ Pi users can install the same skill through the package manifest:
32
+
33
+ ```bash
34
+ pi install npm:@undefineds.co/models
35
+ ```
36
+
37
+ The npm package includes `skills/` and declares `pi.skills` in `package.json`,
38
+ so Pi discovers `skills/solid-modeling/SKILL.md` as a package skill.
39
+
40
+ Marketplace-specific submission steps should be added only when the target
41
+ platform has a documented publishing API or CLI.
@@ -0,0 +1,185 @@
1
+ ---
2
+ name: solid-modeling
3
+ description: Use when designing or reviewing shared Solid Pod, RDF, Linked Data, drizzle-solid, or @undefineds.co/models schemas; especially for URI vs id fields, default id functions, inverse links, chat/thread/message/task/run modeling, Pod persistence boundaries, and cross-app data semantics.
4
+ ---
5
+
6
+ # Solid Modeling
7
+
8
+ Use this skill when changing or reviewing shared Pod data models, RDF vocab
9
+ mappings, drizzle-solid schemas, repositories, or tests that assert durable
10
+ cross-app semantics.
11
+
12
+ ## Core Stance
13
+
14
+ Model the Pod as a Linked Data graph, not as a relational database with foreign
15
+ keys.
16
+
17
+ - Use RDF/Pod relation fields for URI references.
18
+ - Use local ids only for UI state, runtime protocol keys, function parameters,
19
+ or the random key passed into an id default function.
20
+ - Treat durable `id` values as base-relative resource ids. If the storage path
21
+ or fragment is part of identity, the `id` must include it.
22
+ - Do not let a field named `xxxId` secretly behave like an RDF link.
23
+ - Prefer semantic relation names: `chat`, `thread`, `message`, `maker`,
24
+ `replyTo`, `workspace`, `task`, `run`, `agent`.
25
+ - UI-only state stays outside the Pod. Durable shared state belongs in the Pod.
26
+
27
+ ## Package Ownership
28
+
29
+ `@undefineds.co/models` owns durable shared model semantics. `drizzle-solid`
30
+ owns the ORM/resource machinery. Product shells such as Xpod, LinX desktop,
31
+ CLI, mobile, or workers should not duplicate shared schemas.
32
+
33
+ - If a resource/schema/repository already exists in `models`, consume it.
34
+ - If a product needs a missing shared query, mutation, or id helper, add it to
35
+ `models` first with tests, then call it from the product shell.
36
+ - Keep product shells focused on interaction and adapter code: routing,
37
+ rendering, runtime protocol projection, local cache plumbing, and mapping
38
+ native runtime events into shared DTOs.
39
+ - Do not copy shared predicates, subject/id defaults, Turtle serializers, URI
40
+ builders, or resource lifecycle state machines into shells.
41
+
42
+ ## ORM-First Pod Access
43
+
44
+ Do not hand-parse shared business TTL when a resource schema exists.
45
+
46
+ - Use `db.select().from(resource).where(...)` for list/subset reads.
47
+ - Use `db.findById`, `db.updateById`, and `db.deleteById` when callers hold a
48
+ canonical base-relative resource id.
49
+ - Use `db.findByIri`, `db.updateByIri`, and `db.deleteByIri` when the concrete
50
+ resource IRI is known.
51
+ - Use `db.findByResource`, `db.updateByResource`, and `db.deleteByResource`
52
+ only at adapter boundaries that intentionally accept mixed exact targets.
53
+ - Do not expose locator-shaped inputs in business APIs. `findByLocator`,
54
+ `updateByLocator`, and `deleteByLocator` are legacy compatibility surfaces.
55
+ - Raw Solid client or `fetch` access is acceptable only for protocol-level
56
+ adapters where no shared business resource exists yet.
57
+
58
+ ## Ids, Defaults, and Subject Templates
59
+
60
+ The durable `id` is base-relative. It is not a fragment id.
61
+
62
+ Use an `id.default((key, row) => ...)` function when the id shape depends on
63
+ related resources, dates, command kind, workspace, or other row values. The
64
+ function should return the full base-relative resource id.
65
+
66
+ Examples:
67
+
68
+ ```ts
69
+ chatResourceId('default') === 'default/index.ttl#this'
70
+ messageResourceId('msg_1', row) === 'chat/default/2026/05/18/messages.ttl#msg_1'
71
+ runResourceId('run_1', row) === 'task/secretary/2026/05/18/runs.ttl#run_1'
72
+ ```
73
+
74
+ Do not combine a full id default with a `subjectTemplate` that reparses or
75
+ wraps the same id. Exact ids should resolve directly against `base`.
76
+
77
+ Keep `subjectTemplate` only for simple resources where the id field is the
78
+ stable storage key and the template has no hidden dependency on another
79
+ resource. Prefer a default id function once the template needs parent paths,
80
+ date buckets, fragments, or associated resource ids.
81
+
82
+ If a user passes an explicit id, treat it as exact. Do not reinterpret it as a
83
+ random key or fragment id.
84
+
85
+ ## URI Fields and Query Ergonomics
86
+
87
+ Schema storage semantics and app ergonomics are different layers.
88
+
89
+ ### Pod Schema Layer
90
+
91
+ Use full URI relation fields:
92
+
93
+ ```ts
94
+ message.chat
95
+ message.thread
96
+ message.replyTo
97
+ thread.chat
98
+ run.thread
99
+ run.task
100
+ ```
101
+
102
+ Avoid persisted relation fields such as:
103
+
104
+ ```ts
105
+ message.chatId
106
+ message.threadId
107
+ thread.chatId
108
+ ```
109
+
110
+ unless they are intentionally opaque literal protocol fields, not RDF links.
111
+
112
+ ### Repository/API Layer
113
+
114
+ Short-id helpers are fine at API boundaries:
115
+
116
+ ```ts
117
+ messageRepository.listByThreadId(db, { chatId, threadId })
118
+ threadRepository.listByChatId(db, { chatId })
119
+ ```
120
+
121
+ These helpers should derive canonical Pod IRIs or base-relative ids internally.
122
+ Do not force UI/CLI callers to manually construct Pod IRIs in every query.
123
+
124
+ ## Chat, Task, Thread, Message, Run, Step
125
+
126
+ Use these concepts consistently across products:
127
+
128
+ - `Chat`: interactive command surface/counterpart. It answers who or what the
129
+ user is talking with.
130
+ - `Task`: task-style command surface, parallel to Chat. It describes recurring,
131
+ triggered, or one-off task intent.
132
+ - `Thread`: concrete timeline/place under a Chat or Task.
133
+ - `Message`: human/runtime communication item in a Thread, linked to the Chat
134
+ or Task surface when useful.
135
+ - `Run`: one concrete execution attempt by an Agent Runtime.
136
+ - `RunStep`: append-only execution facts for a Run.
137
+
138
+ Chat and Task are command surfaces. Run is the state center for execution.
139
+ RunStep is not a separate event store elsewhere; store it with Run when the
140
+ storage layout is date-bucketed.
141
+
142
+ ## Solid Chat Relationship Guidance
143
+
144
+ Align with graph semantics:
145
+
146
+ | Concept | Preferred RDF direction | Typical predicate |
147
+ |---|---|---|
148
+ | chat contains message | `chat -> message` | `wf:message` / project vocabulary |
149
+ | thread contains message | `thread -> message` | `sioc:has_member` or equivalent |
150
+ | reply points to original | `replyMessage -> originalMessage` | `sioc:has_reply` / project predicate |
151
+ | author/maker | `message -> maker` | `foaf:maker` |
152
+
153
+ When inverse predicates are supported, use them for read/write symmetry. If the
154
+ ORM cannot safely express the inverse write, put the relation writer in the
155
+ repository and cover it with integration tests.
156
+
157
+ ## Resource Naming
158
+
159
+ Use `Resource` names for shared models.
160
+
161
+ - Export `chatResource`, `messageResource`, `taskResource`, `runResource`.
162
+ - Keep `chatTable`-style aliases only for compatibility while downstream code
163
+ migrates.
164
+ - New shared-model code should prefer `solidResources` over table registries.
165
+
166
+ ## Testing Expectations
167
+
168
+ For shared schema changes, verify both ergonomics and graph semantics:
169
+
170
+ 1. Unit tests for id/default helpers and URI builders.
171
+ 2. Resource tests that assert exact-id mode or the intended `subjectTemplate`.
172
+ 3. Repository or Pod integration tests for relation read/write behavior.
173
+ 4. Assertions that produced IRIs contain no unresolved template placeholders.
174
+
175
+ Do not preserve obsolete tests that encode abandoned storage paths. Rewrite
176
+ them around current Pod semantics.
177
+
178
+ ## Product Boundary
179
+
180
+ Product-specific domain rules do not belong in this skill.
181
+
182
+ - Put product data semantics in owning schemas, repositories, and shared docs.
183
+ - Keep this skill limited to reusable Solid/RDF modeling guidance.
184
+ - If product terms such as `chat`, `task`, `run`, or `agent` become shared,
185
+ encode the durable semantics in `models`.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Solid Modeling"
3
+ short_description: "Design shared Solid/RDF model schemas"
4
+ default_prompt: "Use $solid-modeling to review this shared Pod schema for RDF links, id defaults, and resource ownership."
5
+ policy:
6
+ allow_implicit_invocation: true