@ifsoul/core 0.3.0 → 0.5.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 (147) hide show
  1. package/README.md +30 -33
  2. package/dist/packages/memory/src/sql.js +54 -5
  3. package/dist/packages/protocol/src/generated/validators.cjs +1 -1
  4. package/dist/packages/protocol/src/index.d.ts +1 -6
  5. package/dist/packages/protocol/src/index.js +3 -16
  6. package/dist/packages/protocol/src/types.d.ts +1 -1
  7. package/dist/packages/runtime/src/behavior-types.d.ts +150 -0
  8. package/dist/packages/runtime/src/behavior-types.js +1 -0
  9. package/dist/packages/runtime/src/behavior.d.ts +40 -0
  10. package/dist/packages/runtime/src/behavior.js +621 -0
  11. package/dist/packages/runtime/src/group-scheduler.d.ts +165 -0
  12. package/dist/packages/runtime/src/group-scheduler.js +647 -0
  13. package/dist/packages/runtime/src/index.d.ts +4 -0
  14. package/dist/packages/runtime/src/index.js +4 -1
  15. package/dist/packages/runtime/src/participants.d.ts +107 -0
  16. package/dist/packages/runtime/src/participants.js +309 -0
  17. package/dist/packages/runtime/src/types.d.ts +1 -0
  18. package/package.json +2 -3
  19. package/packages/protocol/schemas/current/archive.schema.json +16 -16
  20. package/packages/protocol/schemas/current/character.schema.json +21 -21
  21. package/packages/protocol/schemas/current/common.schema.json +15 -15
  22. package/packages/protocol/schemas/current/context.schema.json +24 -24
  23. package/packages/protocol/schemas/current/conversation.schema.json +39 -39
  24. package/packages/protocol/schemas/current/environment.schema.json +18 -18
  25. package/packages/protocol/schemas/current/memory.schema.json +66 -66
  26. package/packages/protocol/schemas/current/model-provider.schema.json +40 -40
  27. package/packages/protocol/schemas/current/planning.schema.json +61 -61
  28. package/packages/protocol/schemas/current/provider-common.schema.json +6 -6
  29. package/release.json +7 -12
  30. package/specs/README.md +3 -86
  31. package/specs/current/README.md +3 -5
  32. package/specs/current/examples/archive-fork.json +12 -12
  33. package/specs/current/examples/archive-resume.json +12 -12
  34. package/specs/current/examples/character-instance.json +1 -1
  35. package/specs/current/examples/character-template.json +1 -1
  36. package/specs/current/examples/context-after-inspection.json +1 -1
  37. package/specs/current/examples/context-chat.json +1 -1
  38. package/specs/current/examples/context-daily.json +1 -1
  39. package/specs/current/examples/context-no-speech.json +1 -1
  40. package/specs/current/examples/conversation-delivery.json +1 -1
  41. package/specs/current/examples/conversation-live-request.json +1 -1
  42. package/specs/current/examples/conversation-live-response.json +1 -1
  43. package/specs/current/examples/conversation-no-speech-request.json +1 -1
  44. package/specs/current/examples/conversation-no-speech-response.json +1 -1
  45. package/specs/current/examples/conversation-requested-request.json +1 -1
  46. package/specs/current/examples/conversation-requested-response.json +1 -1
  47. package/specs/current/examples/environment-chat.json +1 -1
  48. package/specs/current/examples/environment-game.json +1 -1
  49. package/specs/current/examples/environment-no-speech.json +1 -1
  50. package/specs/current/examples/intent-checkpoint.json +1 -1
  51. package/specs/current/examples/memory-episode.json +1 -1
  52. package/specs/current/examples/memory-event-conversation.json +1 -1
  53. package/specs/current/examples/memory-event-observed.json +2 -2
  54. package/specs/current/examples/memory-event-plan-proposal.json +2 -2
  55. package/specs/current/examples/memory-event-proposed.json +2 -2
  56. package/specs/current/examples/memory-fact.json +1 -1
  57. package/specs/current/examples/memory-relationship.json +1 -1
  58. package/specs/current/examples/memory-working-context.json +1 -1
  59. package/specs/current/examples/plan-cancel-request.json +1 -1
  60. package/specs/current/examples/plan-cancel-result.json +1 -1
  61. package/specs/current/examples/plan-daily.json +1 -1
  62. package/specs/current/examples/plan-partial-decision.json +1 -1
  63. package/specs/current/examples/portable-memory.jsonl +9 -9
  64. package/specs/current/examples/task-outcome.json +1 -1
  65. package/specs/current/examples/task-progress.json +1 -1
  66. package/specs/current/model-provider/examples/capabilities.json +1 -1
  67. package/specs/current/model-provider/examples/error.json +1 -1
  68. package/specs/current/model-provider/examples/request.json +1 -1
  69. package/specs/current/model-provider/examples/response.json +1 -1
  70. package/docs/npm-publishing.md +0 -44
  71. package/packages/protocol/schemas/action-result.schema.json +0 -187
  72. package/packages/protocol/schemas/action.schema.json +0 -68
  73. package/packages/protocol/schemas/archive-manifest.schema.json +0 -126
  74. package/packages/protocol/schemas/capability.schema.json +0 -131
  75. package/packages/protocol/schemas/character-instance.schema.json +0 -73
  76. package/packages/protocol/schemas/character-template.schema.json +0 -67
  77. package/packages/protocol/schemas/common.schema.json +0 -154
  78. package/packages/protocol/schemas/derived-memory.schema.json +0 -145
  79. package/packages/protocol/schemas/memory-event.schema.json +0 -123
  80. package/packages/protocol/schemas/model-provider.schema.json +0 -326
  81. package/packages/protocol/schemas/perception.schema.json +0 -89
  82. package/packages/protocol/schemas/permission-policy.schema.json +0 -153
  83. package/packages/protocol/schemas/v0.2/archive.schema.json +0 -205
  84. package/packages/protocol/schemas/v0.2/character.schema.json +0 -344
  85. package/packages/protocol/schemas/v0.2/common.schema.json +0 -239
  86. package/packages/protocol/schemas/v0.2/context.schema.json +0 -230
  87. package/packages/protocol/schemas/v0.2/conversation.schema.json +0 -340
  88. package/packages/protocol/schemas/v0.2/environment.schema.json +0 -244
  89. package/packages/protocol/schemas/v0.2/memory.schema.json +0 -495
  90. package/packages/protocol/schemas/v0.2/planning.schema.json +0 -443
  91. package/packages/protocol/schemas/world-event.schema.json +0 -74
  92. package/specs/character/README.md +0 -84
  93. package/specs/character/examples/archive-manifest.json +0 -32
  94. package/specs/character/examples/character-instance.json +0 -20
  95. package/specs/character/examples/character-template.json +0 -19
  96. package/specs/memory/README.md +0 -80
  97. package/specs/memory/examples/derived-memory.json +0 -21
  98. package/specs/memory/examples/memory-event.json +0 -35
  99. package/specs/model-provider/README.md +0 -85
  100. package/specs/model-provider/examples/capabilities.json +0 -10
  101. package/specs/model-provider/examples/error.json +0 -18
  102. package/specs/model-provider/examples/request.json +0 -17
  103. package/specs/model-provider/examples/response.json +0 -19
  104. package/specs/v0.2/README.md +0 -421
  105. package/specs/v0.2/examples/archive-fork.json +0 -64
  106. package/specs/v0.2/examples/archive-resume.json +0 -63
  107. package/specs/v0.2/examples/character-instance.json +0 -57
  108. package/specs/v0.2/examples/character-template.json +0 -45
  109. package/specs/v0.2/examples/context-after-inspection.json +0 -44
  110. package/specs/v0.2/examples/context-chat.json +0 -27
  111. package/specs/v0.2/examples/context-daily.json +0 -69
  112. package/specs/v0.2/examples/context-no-speech.json +0 -27
  113. package/specs/v0.2/examples/conversation-delivery.json +0 -17
  114. package/specs/v0.2/examples/conversation-live-request.json +0 -31
  115. package/specs/v0.2/examples/conversation-live-response.json +0 -23
  116. package/specs/v0.2/examples/conversation-no-speech-request.json +0 -23
  117. package/specs/v0.2/examples/conversation-no-speech-response.json +0 -22
  118. package/specs/v0.2/examples/conversation-requested-request.json +0 -31
  119. package/specs/v0.2/examples/conversation-requested-response.json +0 -23
  120. package/specs/v0.2/examples/environment-chat.json +0 -43
  121. package/specs/v0.2/examples/environment-game.json +0 -80
  122. package/specs/v0.2/examples/environment-no-speech.json +0 -47
  123. package/specs/v0.2/examples/intent-checkpoint.json +0 -29
  124. package/specs/v0.2/examples/memory-episode.json +0 -28
  125. package/specs/v0.2/examples/memory-event-conversation.json +0 -32
  126. package/specs/v0.2/examples/memory-event-observed.json +0 -50
  127. package/specs/v0.2/examples/memory-event-plan-proposal.json +0 -82
  128. package/specs/v0.2/examples/memory-event-proposed.json +0 -53
  129. package/specs/v0.2/examples/memory-fact.json +0 -23
  130. package/specs/v0.2/examples/memory-relationship.json +0 -25
  131. package/specs/v0.2/examples/memory-working-context.json +0 -24
  132. package/specs/v0.2/examples/plan-cancel-request.json +0 -16
  133. package/specs/v0.2/examples/plan-cancel-result.json +0 -21
  134. package/specs/v0.2/examples/plan-daily.json +0 -57
  135. package/specs/v0.2/examples/plan-partial-decision.json +0 -28
  136. package/specs/v0.2/examples/portable-memory.jsonl +0 -9
  137. package/specs/v0.2/examples/task-outcome.json +0 -21
  138. package/specs/v0.2/examples/task-progress.json +0 -19
  139. package/specs/world-adapter/README.md +0 -114
  140. package/specs/world-adapter/examples/action-result-unknown.json +0 -23
  141. package/specs/world-adapter/examples/action-result.json +0 -45
  142. package/specs/world-adapter/examples/action.json +0 -17
  143. package/specs/world-adapter/examples/capability.json +0 -44
  144. package/specs/world-adapter/examples/perception.json +0 -30
  145. package/specs/world-adapter/examples/permission-decision.json +0 -14
  146. package/specs/world-adapter/examples/permission-policy.json +0 -17
  147. package/specs/world-adapter/examples/world-event.json +0 -25
@@ -1,421 +0,0 @@
1
- # Character and host contracts: draft-0.2.0
2
-
3
- This revision describes portable characters in games and chat, including hosts
4
- that already control NPC behavior. It is **documentation, JSON Schema, and
5
- synthetic examples only**. There is no character controller, model client, game
6
- bridge, locomotion executor, storage engine, archive importer, or migration.
7
- The words MUST, MUST NOT, SHOULD, and MAY describe future conformance.
8
-
9
- The historical [draft-0.1.0](../README.md) schemas and example bytes remain unchanged. This revision is an
10
- explicit new contract, not an automatic upgrade, replacement of every independent
11
- contract, or promise that old documents can be imported. In particular,
12
- [ModelProvider](../model-provider/README.md) retains `schemaVersion: "draft-0.1.0"`
13
- and its existing `urn:ifsoul:protocol:draft-0.1.0:model-provider` ID. A v0.2
14
- controller may use that independent provider boundary after explicit composition;
15
- a v0.2 character or plan is not a v0.1 model request. No v0.2 provider schema or
16
- implicit version coercion is introduced. Historical v0.1 permission-policy
17
- messages are also not embedded into these new envelopes; current trusted
18
- policy and host restrictions still require explicit evaluation.
19
-
20
- ## Registry and shared conventions
21
-
22
- All schema files are in
23
- [`packages/protocol/schemas/v0.2/`](../../packages/protocol/schemas/v0.2/).
24
- The `$id` prefix is `urn:ifsoul:protocol:draft-0.2.0:` plus the listed suffix.
25
- Register all eight local files by `$id`, then compile with Ajv 2020,
26
- `strict: true`, and `ajv-formats` for `date-time`. URNs are identifiers, not
27
- hosted endpoints; no network resolution, type coercion, default insertion,
28
- unknown-field removal, or union-type relaxation is needed.
29
-
30
- | File / ID suffix | Root `kind` values |
31
- | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
32
- | [common.schema.json](../../packages/protocol/schemas/v0.2/common.schema.json) / `common` | Definitions only; deliberately rejects exchange documents |
33
- | [character.schema.json](../../packages/protocol/schemas/v0.2/character.schema.json) / `character` | `character-template`, `character-instance` |
34
- | [environment.schema.json](../../packages/protocol/schemas/v0.2/environment.schema.json) / `environment` | `environment-profile` |
35
- | [context.schema.json](../../packages/protocol/schemas/v0.2/context.schema.json) / `context` | `context-report` |
36
- | [planning.schema.json](../../packages/protocol/schemas/v0.2/planning.schema.json) / `planning` | `plan-proposal`, `plan-decision`, `task-report`, `plan-cancel-request`, `plan-cancel-result` |
37
- | [conversation.schema.json](../../packages/protocol/schemas/v0.2/conversation.schema.json) / `conversation` | `conversation-request`, `conversation-response`, `conversation-delivery` |
38
- | [memory.schema.json](../../packages/protocol/schemas/v0.2/memory.schema.json) / `memory` | `memory-event`, `working-context`, `memory-episode`, `memory-fact`, `memory-relationship`, `intent-checkpoint` |
39
- | [archive.schema.json](../../packages/protocol/schemas/v0.2/archive.schema.json) / `archive` | `archive-manifest` |
40
-
41
- Every envelope requires `schemaVersion: "draft-0.2.0"` and `kind`. Objects are
42
- closed unless explicitly designated as a trait/argument map or extension object.
43
- Optional fields are omitted; `null` is not a substitute. JSON is UTF-8 and field
44
- names are case-sensitive camelCase. IDs match
45
- `[A-Za-z0-9][A-Za-z0-9._:-]{0,127}`: opaque, case-sensitive names rather than
46
- credentials, paths, proof of identity, or executable instructions. Counters use
47
- nonnegative integers no larger than `9007199254740991`.
48
-
49
- Bound host envelopes require `binding: { environmentId, sessionId, characterId,
50
- embodimentId }`. The trusted composition root verifies that binding against the
51
- current host. Model identity is absent from it. UTC timestamps require RFC 3339
52
- `Z` form with seconds, a four-digit year, and optional 1–9 digit fractional
53
- seconds. `worldTime`, where present, is `{ timelineId, tick }`, with no assumed
54
- UTC conversion or fixed tick rate. A reset or incomparable timeline needs a new
55
- ID. Chat does not require a world clock.
56
-
57
- `period` and `horizon` are tagged unions:
58
-
59
- - `{ basis: "utc", startAt, endAt }`, using UTC timestamps.
60
- - `{ basis: "world-ticks", timelineId, fromTick, toTick }`.
61
-
62
- Consumers MUST check ordering, available clocks, and agreement with the current
63
- environment. A host's daily cadence may mean an arbitrary configured game day;
64
- it is not hardcoded to 24 wall-clock hours or a built-in scheduler.
65
-
66
- Optional `extensions` uses lowercase dotted namespaces such as
67
- `org.example.notes`, preserving arbitrary JSON values. Every optional
68
- `requiredExtensions` key MUST exist and be understood before processing.
69
- Unknown optional extensions MUST survive a claimed lossless transfer; inability
70
- to preserve them requires rejection or a disclosed filtered operation. Unknown
71
- required extensions reject processing. None can grant authority. Schemas cannot
72
- verify implementation support or dynamic key membership.
73
-
74
- Numeric array/string bounds on profiles, reports, plans, and utterances limit
75
- one supported exchange or snapshot; they are not lifetime memory quotas. Exceeding
76
- a bound MUST produce an explicit rejection or a separately agreed filtered
77
- operation, never silent truncation. Instance memory references are selected
78
- snapshot/index roots, not an exhaustive enumeration of lifetime history. Archive
79
- memory streams may be sharded across files; the schema imposes no fixed maximum
80
- file count or lifetime event count. Implementations still apply explicit resource
81
- budgets and fail transparently when exceeded.
82
-
83
- ## Character, model, and embodiment
84
-
85
- A **character** is portable authored identity plus permitted lived experience.
86
- A **model** is a replaceable inference facility, not the character. An
87
- **embodiment** is the host's present representation and available modalities, not
88
- a portable inventory, health record, or behavior engine.
89
-
90
- | `kind` | Required fields beyond the envelope fields |
91
- | -------------------- | -------------------------------------------------------------------------------------------------- |
92
- | `character-template` | `templateId`, `revision`, `profile`, `authorship` |
93
- | `character-instance` | `characterId`, `participantId`, `createdAt`, `profile`, `memoryRecordIds`, `relationshipMemoryIds` |
94
-
95
- One shared `$defs/profile` supplies both documents. It requires `name`,
96
- `description`, `traits`, `preferences`, `speechStyle`, `goals`, and
97
- `authoredBiography`. Empty collections and a style description that language is
98
- unavailable are valid. `speechStyle` contains description, language labels, and
99
- habits: preferences for expression **when supported**, never an ability or a
100
- requirement to speak. The same character may be a human, horse, computer, or
101
- another form; the active embodiment restricts actual output.
102
-
103
- Preferences identify a subject, stance (`like`, `dislike`, `avoid`, `seek`),
104
- description, and optional strength. Goals have IDs, descriptions, priority, and
105
- status; they are intentions, not host tasks or achieved facts. Authored biography
106
- is explicitly marked `fictional: true`; it describes this baseline's original
107
- fictional characters and MUST NOT be presented as lived memory. Templates have
108
- positive integer revisions, authorship/license claims, and no individual memory.
109
- Instances may reference an exact template revision and record import/fork lineage;
110
- template changes do not silently overwrite an instance. Memory and relationship
111
- references must resolve consistently, subject to declared export filtering.
112
-
113
- The [template](examples/character-template.json) defines reusable authored data;
114
- the [instance](examples/character-instance.json) includes selected references
115
- into the recorded synthetic trace. Model settings, authentication, host state,
116
- and host execution bindings do not belong in the portable character document.
117
-
118
- ## Environment and stable participants
119
-
120
- An Environment Profile requires `binding`, `hostId`, `revision`, `medium`,
121
- `embodiment`, `participantLinks`, `planning`, `communication`, and `hostIntents`.
122
- `medium` is `game` or `chat`. `embodiment.form` is an open opaque ID; the examples
123
- `human`, `horse`, and `computer` are not a closed species catalog. Modalities are
124
- an explicit subset of `speech`, `text`, `vocalization`, `gesture`, and `status`,
125
- and may be empty. No language-capable form is compulsory.
126
-
127
- `participantId` is a stable participant reference across sessions. Each
128
- `participantLinks` entry is an issuer's **claim** connecting that reference to an
129
- `environmentSubjectId` in this bound session. An entry has a `claimId` and
130
- `issuerId`; no self-asserted verification flag exists. Trusted identity proof,
131
- revocation checks, access checks, and the host binding are required before using
132
- the claim. A display name, repeated ID string, imported relationship, or prior
133
- session claim proves no identity or consent in a new session.
134
-
135
- Planning and communication are independent:
136
-
137
- - `planning` declares `cadence: host-requested | daily | event-driven` and a
138
- `maxTasks` bound. The host chooses when to issue a planning request; the schema
139
- does not schedule it or authorize unsolicited execution.
140
- - `communication` declares `mode: host-requested | live-channel`,
141
- `availability: on-demand | persistent`, `allowUnrequestedMessages`, and known
142
- `channelIds`. Persistent availability does not authorize unrequested speech.
143
- Host-requested mode structurally requires `allowUnrequestedMessages: false`.
144
- Live mode may also forbid unrequested messages while allowing replies.
145
-
146
- [Game](examples/environment-game.json), [live chat](examples/environment-chat.json),
147
- and [non-speaking horse](examples/environment-no-speech.json) profiles illustrate
148
- independent host cadence, online availability, and output capabilities.
149
-
150
- ## Host briefing and bounded planning
151
-
152
- The host owns NPC state machines, locomotion, steering, pathfinding, combat,
153
- shooting, interactions, inventory, health, scheduling, and authoritative outcomes.
154
- The bridge conveys context, a bounded plan proposal, dialogue, and status to
155
- existing host facilities. It MUST NOT grow an IfSoul locomotion skill executor,
156
- remote command shell, or replacement game behavior engine. Whether the bridge
157
- is built by IfSoul or a third party does not change that boundary.
158
-
159
- A Context Report requires `reportId`, `contextRevision`, `environmentRevision`,
160
- `correlationId`, `binding`, `recordedAt`, `period`, `observedState`, `priorNeeds`,
161
- `priorPlans`, and `changes`. The observed state contains a summary and typed
162
- string/number/boolean property observations, not authority to write those fields.
163
- Needs include priority and current/resolved/unknown status. Prior plans carry
164
- task states; changes/events carry recording times and optional world times.
165
- Missing observations remain unknown. A bridge receives only scoped selected
166
- context, not the full archive.
167
-
168
- An optional `planningRequest` adds `requestId`, `cadence`, `horizon`, `maxTasks`,
169
- and `allowedIntentIds`. Every allowed ID must be in the current `hostIntents`
170
- catalog. The host may expose health or inventory as observed context when
171
- permitted; these observations MUST NOT become portable state to transplant into
172
- a new embodiment. Chat context can use UTC periods without `worldTime` and
173
- without requesting any plan.
174
-
175
- Each advertised host intent has `intentId`, description, typed parameter
176
- descriptors, and a cancellation-support flag. Parameter names are unique; types
177
- are `entity-ref`, `choice`, `quantity`, and `boolean`. Choice lists, quantity units,
178
- and numeric bounds must fit that parameter's type. They are a small safe data
179
- vocabulary, not embedded JSON Schema or executable source.
180
-
181
- A Plan Proposal requires the bound `planId`/`correlationId`, planning `requestId`,
182
- `contextReportId`, `contextRevision`, `environmentRevision`, `createdAt`,
183
- `expiresAt`, `horizon`, and at most 16 `tasks`. The accepted bound is the minimum
184
- of protocol, profile, and request bounds. No tasks is a valid no-action proposal.
185
- Each task has a unique `taskId`, advertised `intentId`, typed `arguments`, priority,
186
- optional explanation, and explicit `dependsOnTaskIds`.
187
-
188
- Argument values are tagged objects: `{ type: "entity-ref", entityId }`,
189
- `{ type: "choice", value }`, `{ type: "quantity", value, unit }`, or
190
- `{ type: "boolean", value }`. Consumers MUST validate exact parameter names,
191
- requiredness, type, current entity visibility, allowed choices, units, and bounds
192
- against the current advertised descriptor. IDs MUST be advertised and allowed by
193
- this request. Dependencies must resolve in the proposal and form an acyclic
194
- graph. Unknown intent IDs, extra arguments, stale revisions, expired proposals,
195
- and unauthorized operations reject processing. An explanation is untrusted
196
- non-executable commentary. There is no arbitrary execute-code, command, script,
197
- filesystem path, raw skill, or model-generated locomotion field.
198
-
199
- A Plan Decision records host `decisionId`, `requestId`, context revision, time,
200
- `status: accepted | partially-accepted | rejected`, and per-task decisions.
201
- The task decisions must uniquely cover all proposed tasks and agree with the
202
- aggregate status; dependencies of accepted tasks must remain satisfiable. This
203
- is an acceptance decision, **not achievement**. It does not bypass current host
204
- restrictions or promise that execution has begun.
205
-
206
- Task Reports identify a plan/task, report ID, context revision, correlation, time,
207
- status, summary, and actual `observedEffects`. Status is `pending`, `running`,
208
- `succeeded`, `failed`, `cancelled`, or `unknown`. Only the host reports execution
209
- facts; a plan's predicted effects are not observations. A host can execute
210
- accepted work independently until it reports back or requests another plan.
211
- Reports and context revisions can arrive out of order; trusted consumers
212
- reconcile them rather than overwrite later facts with stale messages.
213
-
214
- Cancellation has separate `plan-cancel-request` and `plan-cancel-result` kinds.
215
- A request names `cancellationId`, plan and task IDs, time, and reason; it does not
216
- stop the host. The result reports per-task `cancelled`, `already-finished`,
217
- `rejected`, or `unknown`. A confirmed cancellation prevents further work only as
218
- reported by the host; it does not roll back observed effects. A cancellation
219
- request is never a cancellation confirmation.
220
-
221
- All decisions, reports, and cancellation messages MUST correlate binding, plan,
222
- task, request/cancellation IDs, and trusted sender identity. Duplicate delivery
223
- is not new work. This draft promises no idempotent execution or exactly-once
224
- transport. Unknown acceptance, execution, cancellation, or delivery requires
225
- host reconciliation; do not send a replacement plan/task or blindly retry under
226
- new IDs. If the host cannot reconcile, preserve unknown and request an explicit
227
- recovery decision. No transport or reconciliation method is implemented here.
228
-
229
- The [daily context](examples/context-daily.json), [proposal](examples/plan-daily.json),
230
- [partial acceptance](examples/plan-partial-decision.json),
231
- [progress](examples/task-progress.json), [outcome](examples/task-outcome.json),
232
- [cancel request](examples/plan-cancel-request.json), and
233
- [cancel result](examples/plan-cancel-result.json) are a synthetic host-owned trace.
234
- Watering was proposed and rejected; it never becomes an accomplished memory.
235
-
236
- ## Conversation is a separate exchange
237
-
238
- Requests and responses require `binding`, `requestId`, `correlationId`,
239
- `channelId`, `speakerParticipantId`, and `recipientParticipantIds`.
240
- A Conversation Request additionally carries the environment/context revisions,
241
- mode, trigger, requested modality, receipt/deadline timestamps, and bounded
242
- input messages. Messages identify their author participant, message ID, recording
243
- time, modality, and content. The requested speaker must be the character's
244
- verified bound participant; sender/channel identity and recipients require
245
- trusted verification and current authorization.
246
-
247
- `host-requested` mode structurally requires `trigger: "host-request"`. Live mode
248
- may use `host-request`, `incoming-message`, or `presence-event`. A trusted host
249
- or authorized runtime issues every correlated request; an always-online character
250
- cannot manufacture a request to bypass profile policy. Reactive live replies
251
- can be allowed while unrequested speech is forbidden. Proactive output from a
252
- presence trigger additionally requires `allowUnrequestedMessages: true`,
253
- authorized scheduling, and channel permission. If any condition is missing,
254
- produce no output. The flag alone is not a scheduler or permission grant.
255
-
256
- Responses add `responseId`, `createdAt`, `expiresAt`, and an output union:
257
- `{ type: "utterance", modality, content }` or
258
- `{ type: "no-output", reason }`. Output is a proposal for host/channel delivery,
259
- not proof anyone heard it. The host must validate the current modality, binding,
260
- channel, recipients, request correlation, and expiry before delivery. A missing
261
- speech modality never causes synthesized spoken language; `unsupported-modality`
262
- is a valid no-output reason. Style preference cannot override embodiment limits.
263
-
264
- Conversation Delivery reports identify the response and channel with a unique
265
- `deliveryId`, timestamp, and `accepted | delivered | rejected | unknown` status.
266
- Accepted is not delivered; unknown must be reconciled before retrying to avoid
267
- duplicate speech. Host delivery controls remain authoritative in both modes.
268
- Model output is not directly broadcast or treated as a world action.
269
-
270
- Examples: [host request](examples/conversation-requested-request.json) and
271
- [utterance](examples/conversation-requested-response.json),
272
- [live incoming message](examples/conversation-live-request.json) and
273
- [text reply](examples/conversation-live-response.json),
274
- [unsupported speech request](examples/conversation-no-speech-request.json) and
275
- [non-speaking response](examples/conversation-no-speech-response.json).
276
- The chat profile is persistent but explicitly disallows autonomous unrequested
277
- messages. No conversation or game connection is actually running.
278
-
279
- ## Portable memory and intent checkpoints
280
-
281
- All memory variants require `memoryId`, `characterId`, `recordedAt`, `scope`, and
282
- `provenance`. Scope uses stable `participantIds`, audience, and export policy.
283
- Private means exactly one participant; participants means a nonempty explicit
284
- list; public means an empty list. These cardinalities and identity verification
285
- are semantic checks. Public world visibility does not grant public publication
286
- or export consent. `export` is allowed, consent-required, or forbidden; actual
287
- access/consent must still be checked. Derived records cannot broaden their
288
- sources' scope or export rights.
289
-
290
- Provenance sources have explicit `sourceType` and `sourceId`. Types distinguish
291
- authored material, host reports, conversations, memory, derivation, import,
292
- plan proposals, and plan decisions. References preserve their original meaning:
293
-
294
- - A `plan-proposal` proves only that an intention was proposed.
295
- - A `plan-decision` proves only what the host accepted or rejected.
296
- - A trusted `host-report` can support a claim about observed execution, subject
297
- to its actual reported status and access scope.
298
- - Authored biography remains authored material, never generated lived history.
299
-
300
- | Memory `kind` | Additional content |
301
- | --------------------- | --------------------------------------------------------------------------------------------------------------- |
302
- | `memory-event` | `eventType`, required original `recordedPayload`, participants; optional summary/environment/session/world time |
303
- | `working-context` | Summary, active topics, selected relevant memory IDs, expiry |
304
- | `memory-episode` | Summary, nonempty source memory IDs, period |
305
- | `memory-fact` | Claim, nonempty source memory IDs, optional uncalibrated confidence |
306
- | `memory-relationship` | Stable subject/object participants, relation, description, source memory IDs |
307
- | `intent-checkpoint` | Bounded portable intents, optional next review time |
308
-
309
- Working context is a bounded current selection, not the full archive. Episodes,
310
- facts, and relationships are interpretations with provenance; they do not replace
311
- raw event records or become trusted instructions. Every raw Memory Event requires
312
- `recordedPayload`, an open JSON object preserving the original authorized content
313
- that IfSoul actually received, including unknown fields. Its optional `summary`
314
- is an index annotation and MUST NOT replace the received content. Raw means the
315
- received observation or message, not omniscient world history. When privacy or
316
- consent requires redaction, the filtered export must explicitly disclose the
317
- omission; it MUST NOT claim the remaining summary is the original record. Confidence is a source score,
318
- not a calibrated probability. Missing or deleted source data requires explicit
319
- reference/filter handling and deletion or recomputation of affected derivatives.
320
- No store, retention engine, summarizer, or deletion propagation is implemented.
321
-
322
- Each checkpoint intent contains a portable ID, description, desired outcome,
323
- status, and source memory references. It contains **no host plan/task execution
324
- handle**, environment binding, inventory, health, combat state, path, skill
325
- executor continuation, or running game state machine. Text and extensions MUST
326
- NOT smuggle executable commands or host continuation credentials. Restoring an
327
- active intention means re-evaluating a desire under a freshly verified profile
328
- and context, not restarting a host operation. A new host request/decision is
329
- required before any execution. Portable status cannot prove current host state.
330
-
331
- The [proposal memory](examples/memory-event-plan-proposal.json),
332
- [decision memory](examples/memory-event-proposed.json), and
333
- [observed outcome memory](examples/memory-event-observed.json) deliberately
334
- separate intentions, acceptance, and reported facts. The
335
- [initial checkpoint](examples/intent-checkpoint.json) contains a general learning
336
- intention, not the daily plan's host task handles.
337
-
338
- ## Archive: resume or fork explicitly
339
-
340
- An Archive Manifest requires `archiveVersion`, `archiveId`, `characterId`,
341
- `createdAt`, `transferIntent`, `schemaInventory`, `files`, `filter`, `provenance`,
342
- and `portableCheckpointIds`, in addition to the envelope fields. The archive
343
- version is independent from wire and provider versions even though its current
344
- value is also `draft-0.2.0`.
345
-
346
- `transferIntent` is exactly one of:
347
-
348
- - `{ mode: "resume", expectedCharacterId }`: continue the same portable identity
349
- after trusted authorization; the expected ID must equal the snapshot identity.
350
- - `{ mode: "fork", newCharacterId, newParticipantId }`: request a distinct branch
351
- with newly allocated, different character and participant IDs. Preserve source
352
- lineage and provenance; the new identity inherits no access rights or consent.
353
-
354
- A transfer intent is not itself authorization. Neither mode resumes host
355
- execution. Existing world bindings, sessions, execution handles, inventory,
356
- health, provider keys/settings, account credentials, or other secrets MUST NOT
357
- be exported as portable state. Resume requires fresh host mapping and
358
- reconciliation. Fork needs an explicit identity/provenance mapping; original
359
- source authors and participants are not silently relabelled as the new identity.
360
- No fork implementation or conflict-merge policy is claimed.
361
-
362
- `schemaInventory` explicitly lists supported character/memory schema IDs and
363
- versions. `files` entries have safe relative path, role, schema ID, record count,
364
- SHA-256 over exact uncompressed bytes, and byte count. Character files contain
365
- one UTF-8 JSON document; memory files contain UTF-8 JSONL with one complete record
366
- per nonempty line, and can be sharded. Roles must match the actual tagged kind;
367
- all referenced schemas must appear in the inventory. Only v0.2 character/memory
368
- files are admitted. Direct host execution/profile files and model/provider
369
- configuration are excluded. Authorized original reports and conversation content
370
- are retained inside memory-event recordedPayload as historical evidence, not
371
- imported as live execution messages. Historical plan/task/report IDs support
372
- provenance; they are not active execution handles. A recorded health or inventory
373
- observation may be remembered, but MUST NOT initialize or overwrite the next
374
- host embodiment's health or inventory. Secrets remain excluded even from raw
375
- payloads; any required redaction is explicit filtered export.
376
-
377
- A future importer MUST verify unique confined normalized paths, reject traversal,
378
- symlinks, unlisted entries and platform collisions, enforce decompression/size
379
- budgets, verify counts/checksums, validate records and versions, check reference
380
- closure/identity/scope/consent, and operate safely before mutating a destination.
381
- These checks exceed JSON Schema and are not an implemented import pipeline.
382
- Checksums prove byte equality, not a trusted author. Missing data is not invented.
383
- Portable reference closure covers the declared character/memory records and
384
- their provenance sources, which may retain an original source object inside
385
- recordedPayload. Historical world/session/entity/revision identifiers inside that
386
- original content are evidence, not promises to include or reconnect the entire
387
- host world. They MUST NOT be resolved into live host authority during import.
388
-
389
- `filter` explicitly declares complete-authorized or filtered mode, omitted
390
- categories, reasons, and whether external references remain. Complete-authorized
391
- means all authorized portable data in the declared source snapshot, including
392
- original received memory events rather than summaries alone, with empty
393
- omissions/reasons and no unresolved external references; it does not bypass consent. A filtered export
394
- records actual exclusions and nonempty reasons without revealing withheld
395
- content or private IDs. Unknown optional extensions must be preserved or their
396
- loss disclosed. Unsupported required extensions or versions reject import.
397
- There is no automatic v0.1-to-v0.2 migration, behavioral equivalence guarantee,
398
- round-trip implementation, or silent down-conversion.
399
-
400
- [Resume](examples/archive-resume.json) and [fork](examples/archive-fork.json)
401
- manifests describe the same synthetic snapshot after the interaction trace. Their
402
- hashes cover the two sibling character files and the nine-record
403
- [memory stream](examples/portable-memory.jsonl), including original host-report,
404
- plan/decision and chat content, derived selections, relationships, and the
405
- portable checkpoint. The other envelope examples are not claimed as executable
406
- archive contents.
407
-
408
- ## Structural versus semantic validation
409
-
410
- Schemas enforce exact versions, tags, closed shapes, typed values, bounded
411
- exchanges, and the two requested-only communication constraints. A schema pass
412
- cannot prove identity, authorization, truthful provenance, scope/consent,
413
- reference closure, intent-catalog membership, argument-descriptor agreement,
414
- unique selected IDs, acyclic dependencies, valid period ordering, fresh revisions,
415
- clock accuracy, plan-decision aggregation, actual task effects, checkpoint safety,
416
- or archive integrity. Future consumers MUST perform the applicable checks before
417
- acting. Unknown outcomes stay unknown until authoritative reconciliation.
418
-
419
- All examples are original synthetic fixtures under the project's normative
420
- example license. No real conversations, credentials, installed game content,
421
- third-party characters, or private project code are included.
@@ -1,64 +0,0 @@
1
- {
2
- "schemaVersion": "draft-0.2.0",
3
- "kind": "archive-manifest",
4
- "archiveVersion": "draft-0.2.0",
5
- "archiveId": "archive-mira-fork",
6
- "characterId": "character-mira",
7
- "createdAt": "2026-01-01T08:03:01Z",
8
- "transferIntent": {
9
- "mode": "fork",
10
- "newCharacterId": "character-mira-fork",
11
- "newParticipantId": "participant-mira-fork"
12
- },
13
- "schemaInventory": [
14
- {
15
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:character",
16
- "schemaVersion": "draft-0.2.0"
17
- },
18
- {
19
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:memory",
20
- "schemaVersion": "draft-0.2.0"
21
- }
22
- ],
23
- "files": [
24
- {
25
- "path": "character-template.json",
26
- "role": "character-template",
27
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:character",
28
- "recordCount": 1,
29
- "sha256": "bf726a3b4c4f69a28f41fc83f2b563818da279270bffd8985e9de0dcd12a3644",
30
- "sizeBytes": 1269
31
- },
32
- {
33
- "path": "character-instance.json",
34
- "role": "character-instance",
35
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:character",
36
- "recordCount": 1,
37
- "sha256": "8b803f886b4749e38af239e9be66809556333bccd61644d9b6bc314b20d2c4ee",
38
- "sizeBytes": 1580
39
- },
40
- {
41
- "path": "portable-memory.jsonl",
42
- "role": "memory",
43
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:memory",
44
- "recordCount": 9,
45
- "sha256": "a2c58c69e5901fc35625149da2d30e063bce3939a241a412ac1e17f5aafbef2f",
46
- "sizeBytes": 7325
47
- }
48
- ],
49
- "filter": {
50
- "mode": "complete-authorized",
51
- "omittedCategories": [],
52
- "reasons": [],
53
- "externalReferences": false
54
- },
55
- "provenance": {
56
- "sources": [
57
- {
58
- "sourceType": "authored",
59
- "sourceId": "template-mira-v2"
60
- }
61
- ]
62
- },
63
- "portableCheckpointIds": ["checkpoint-initial"]
64
- }
@@ -1,63 +0,0 @@
1
- {
2
- "schemaVersion": "draft-0.2.0",
3
- "kind": "archive-manifest",
4
- "archiveVersion": "draft-0.2.0",
5
- "archiveId": "archive-mira-resume",
6
- "characterId": "character-mira",
7
- "createdAt": "2026-01-01T08:03:01Z",
8
- "transferIntent": {
9
- "mode": "resume",
10
- "expectedCharacterId": "character-mira"
11
- },
12
- "schemaInventory": [
13
- {
14
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:character",
15
- "schemaVersion": "draft-0.2.0"
16
- },
17
- {
18
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:memory",
19
- "schemaVersion": "draft-0.2.0"
20
- }
21
- ],
22
- "files": [
23
- {
24
- "path": "character-template.json",
25
- "role": "character-template",
26
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:character",
27
- "recordCount": 1,
28
- "sha256": "bf726a3b4c4f69a28f41fc83f2b563818da279270bffd8985e9de0dcd12a3644",
29
- "sizeBytes": 1269
30
- },
31
- {
32
- "path": "character-instance.json",
33
- "role": "character-instance",
34
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:character",
35
- "recordCount": 1,
36
- "sha256": "8b803f886b4749e38af239e9be66809556333bccd61644d9b6bc314b20d2c4ee",
37
- "sizeBytes": 1580
38
- },
39
- {
40
- "path": "portable-memory.jsonl",
41
- "role": "memory",
42
- "schemaId": "urn:ifsoul:protocol:draft-0.2.0:memory",
43
- "recordCount": 9,
44
- "sha256": "a2c58c69e5901fc35625149da2d30e063bce3939a241a412ac1e17f5aafbef2f",
45
- "sizeBytes": 7325
46
- }
47
- ],
48
- "filter": {
49
- "mode": "complete-authorized",
50
- "omittedCategories": [],
51
- "reasons": [],
52
- "externalReferences": false
53
- },
54
- "provenance": {
55
- "sources": [
56
- {
57
- "sourceType": "authored",
58
- "sourceId": "template-mira-v2"
59
- }
60
- ]
61
- },
62
- "portableCheckpointIds": ["checkpoint-initial"]
63
- }
@@ -1,57 +0,0 @@
1
- {
2
- "schemaVersion": "draft-0.2.0",
3
- "kind": "character-instance",
4
- "characterId": "character-mira",
5
- "participantId": "participant-mira",
6
- "createdAt": "2026-01-01T08:00:00Z",
7
- "template": {
8
- "templateId": "template-mira-v2",
9
- "revision": 1
10
- },
11
- "profile": {
12
- "name": "Mira Vale",
13
- "description": "An original synthetic character who enjoys careful gardening.",
14
- "traits": {
15
- "patience": "high",
16
- "curiosity": 0.7
17
- },
18
- "preferences": [
19
- {
20
- "preferenceId": "quiet",
21
- "subject": "conversation setting",
22
- "stance": "seek",
23
- "description": "Prefers calm settings when available.",
24
- "strength": 0.8
25
- }
26
- ],
27
- "speechStyle": {
28
- "description": "Uses concise, warm language when the current embodiment supports language.",
29
- "languages": ["en"],
30
- "habits": ["Asks one question at a time."]
31
- },
32
- "goals": [
33
- {
34
- "goalId": "grow-herbs",
35
- "description": "Learn to care for a small herb garden.",
36
- "priority": "normal",
37
- "status": "desired"
38
- }
39
- ],
40
- "authoredBiography": {
41
- "text": "Mira grew up beside an imagined hillside garden. This is authored fiction, not a record of lived sessions.",
42
- "fictional": true
43
- }
44
- },
45
- "memoryRecordIds": [
46
- "checkpoint-initial",
47
- "event-inspection",
48
- "event-visitor-question",
49
- "event-plan-proposal",
50
- "event-plan-proposed",
51
- "working-garden",
52
- "episode-garden",
53
- "fact-inspection",
54
- "relationship-visitor"
55
- ],
56
- "relationshipMemoryIds": ["relationship-visitor"]
57
- }
@@ -1,45 +0,0 @@
1
- {
2
- "schemaVersion": "draft-0.2.0",
3
- "kind": "character-template",
4
- "templateId": "template-mira-v2",
5
- "revision": 1,
6
- "profile": {
7
- "name": "Mira Vale",
8
- "description": "An original synthetic character who enjoys careful gardening.",
9
- "traits": {
10
- "patience": "high",
11
- "curiosity": 0.7
12
- },
13
- "preferences": [
14
- {
15
- "preferenceId": "quiet",
16
- "subject": "conversation setting",
17
- "stance": "seek",
18
- "description": "Prefers calm settings when available.",
19
- "strength": 0.8
20
- }
21
- ],
22
- "speechStyle": {
23
- "description": "Uses concise, warm language when the current embodiment supports language.",
24
- "languages": ["en"],
25
- "habits": ["Asks one question at a time."]
26
- },
27
- "goals": [
28
- {
29
- "goalId": "grow-herbs",
30
- "description": "Learn to care for a small herb garden.",
31
- "priority": "normal",
32
- "status": "desired"
33
- }
34
- ],
35
- "authoredBiography": {
36
- "text": "Mira grew up beside an imagined hillside garden. This is authored fiction, not a record of lived sessions.",
37
- "fictional": true
38
- }
39
- },
40
- "authorship": {
41
- "authors": ["IfSoul contributors"],
42
- "license": "Apache-2.0",
43
- "source": "Original synthetic example"
44
- }
45
- }