@miadi/episodic-memory-schema 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Miadi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # `@miadi/episodic-memory-schema`
2
+
3
+ Types + JSON Schema for **episodic memory** — the durable session-to-session memory layer in the Miadi orchestration kit.
4
+
5
+ When a Storyweaver session closes, the Export Steward extracts an episodic-memory object and feeds it back to Miadi world memory. The next commission inherits what this one built.
6
+
7
+ ---
8
+
9
+ ## Why "episodic"
10
+
11
+ Tulving (1972) distinguishes three long-term memory systems:
12
+
13
+ | Type | What it stores | Storyweaver analogue |
14
+ | ----------- | ------------------------------- | ----------------------------------- |
15
+ | Episodic | Memory of experienced events | **This schema** — one session = one episode |
16
+ | Semantic | Decontextualized facts | The Story Bible |
17
+ | Procedural | How to do things | Skills + agent working rules |
18
+
19
+ The package is named for the cognitive system it serves, not the artifact alone.
20
+
21
+ ---
22
+
23
+ ## Schema layers
24
+
25
+ ```
26
+ EpisodicMemory
27
+ ├── episode — sessionId, openedAt/closedAt, charter, lineage
28
+ ├── narrative — NCP-aligned subtext + storytelling
29
+ ├── world — settings, rules introduced, characters advanced, themes
30
+ ├── provenance — sources, consent decisions, authority flags
31
+ ├── continuity — open promises, canonical facts, contradictions, chapter versions
32
+ ├── evaluations — HAWK 10-predicate rubric per beat/chapter/outline
33
+ └── followUpCommissions — seeds for the next episode
34
+ ```
35
+
36
+ ### Narrative layer is NCP-aligned
37
+
38
+ The `narrative` layer mirrors the [Narrative Context Protocol](https://github.com/) two-layer model:
39
+
40
+ - **Subtext** — authorial intent: perspectives, players, storypoints, storybeats, dynamics
41
+ - **Storytelling** — surface presentation: overviews, moments
42
+
43
+ An NCP-consuming agent can read the narrative layer directly. Episodic-memory adds the four other layers (episode metadata, world delta, provenance, continuity) that NCP doesn't cover.
44
+
45
+ ### Provenance layer is PROV-DM and OAIS-informed
46
+
47
+ - **W3C PROV-DM** for source-decision-authority triples
48
+ - **OAIS** (Wilkinson et al. 2016, FAIR) for archival packaging: the session workspace is a SIP, the export packet is an AIP, the delivered story is a DIP
49
+
50
+ ---
51
+
52
+ ## Install
53
+
54
+ ```bash
55
+ pnpm add @miadi/episodic-memory-schema
56
+ ```
57
+
58
+ ## Usage
59
+
60
+ ```ts
61
+ import type { EpisodicMemory } from "@miadi/episodic-memory-schema"
62
+
63
+ const ep: EpisodicMemory = {
64
+ schemaVersion: "episodic-memory.v1.0",
65
+ episode: {
66
+ sessionId: "sw-2026-05-19-001",
67
+ openedAt: "2026-05-19T13:00:00Z",
68
+ charter: { purpose: "story.bible.from.brief", protocols: ["wilson-3rs", "OCAP"] }
69
+ },
70
+ provenance: { sources: [], consentDecisions: [], authorityFlags: [] },
71
+ continuity: { promises: [], facts: [], contradictions: [] }
72
+ }
73
+ ```
74
+
75
+ The JSON Schema is at `@miadi/episodic-memory-schema/schema` (draft-07). Validate with `ajv`, `zod-from-json-schema`, or any draft-07-compliant validator.
76
+
77
+ A complete example episode (the *Inwe-village* foundation session from the Storyweaver scenario) lives at `examples/inwe-village.example.json`.
78
+
79
+ ---
80
+
81
+ ## Layer-by-layer
82
+
83
+ ### `episode` — required
84
+ Session identity, charter (purpose + protocols), and lineage. The `parentEpisodeId` and `childCommissionIds` form a directed graph of episodes.
85
+
86
+ ### `narrative` — optional (NCP)
87
+ Use when the session produced narrative material. Skip for utility sessions (e.g. tool maintenance).
88
+
89
+ ### `world` — optional
90
+ The world state *delta* this episode contributed — not the full world. Settings flagged `real | invented | hybrid` and `locked | malleable`. Themes accumulate across episodes.
91
+
92
+ ### `provenance` — required
93
+ - `sources` — every cited material with `authority: open | restricted | sacred | community-controlled`
94
+ - `consentDecisions` — protocol-gate decisions with timestamp + human-confirmation flag
95
+ - `authorityFlags` — open authority concerns raised by the Research Weaver
96
+
97
+ ### `continuity` — required
98
+ - `promises` — Chekhov's-gun-style commitments, with `status: open | fulfilled | broken`
99
+ - `facts` — canonical facts established this episode
100
+ - `contradictions` — detected contradictions and whether they were resolved
101
+
102
+ ### `evaluations` — optional (HAWK)
103
+ Narrative quality evaluations from the Critique Reviewer and Developmental Editor. Each evaluation targets a beat, chapter, outline, draft, or bible, and scores it against the HAWK 10-predicate rubric (Cheng et al. 2025):
104
+
105
+ - **Goal** (p1–p5): coherence · progression · originality · tension · resonance
106
+ - **Plan** (p6–p10): feasibility · consistency · interactivity · suspense · cohesion
107
+
108
+ Each value lies in [-1, 1] (the Decision Agent's logit-derived truth signal).
109
+
110
+ ### `continuity.chapterVersions` — optional (HAWK)
111
+ HAWK-style versioned audit trail per chapter — `{ chapterId, version, at, environmentDelta, characterMemoryDelta }`. Enables parallel review of the story's development over time.
112
+
113
+ ### `followUpCommissions` — optional
114
+ Work the manuscript *implies* but did not complete. Each commission becomes a candidate `parentEpisodeId` for the next session.
115
+
116
+ ---
117
+
118
+ ## Versioning
119
+
120
+ - v0.1.0 (current) — initial schema; expect minor additions before v1.0
121
+ - Schema version is encoded in the `schemaVersion` field, not just the package version
122
+
123
+ ---
124
+
125
+ ## Provenance lineage of this package
126
+
127
+ | Influence | Contribution |
128
+ | --- | --- |
129
+ | Tulving (1972), *Episodic and semantic memory* | Naming and conceptual grounding |
130
+ | Narrative Context Protocol (Dramatica Co. / USC ETC) | Subtext + Storytelling layer structure |
131
+ | W3C PROV-DM | Source / agent / activity attribution |
132
+ | OAIS reference model + FAIR (Wilkinson 2016) | Archival packaging frame |
133
+ | HAWK (Cheng et al. 2025, arXiv:2507.04067) | 10-predicate evaluation rubric; versioned chapter-state audit trail |
134
+ | Storyweaver foundations (`foundations/narrative-studies-and-digital-storytelling/`) | Domain integration |
135
+
136
+ ## License
137
+
138
+ MIT.
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./narrative";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./narrative";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * NCP-aligned narrative layer.
3
+ *
4
+ * Conceptually mirrors the Narrative Context Protocol (NCP) two-layer model:
5
+ * - Subtext — authorial intent (perspectives, players, storypoints, storybeats, dynamics)
6
+ * - Storytelling — surface presentation (overviews, moments)
7
+ *
8
+ * Reference: holisticagnostic-narrative-context-protocol
9
+ * Stewardship: The Dramatica Co. / USC Entertainment Technology Center
10
+ * License: MIT (compatible)
11
+ */
12
+ export interface NarrativeContribution {
13
+ subtext?: Subtext;
14
+ storytelling?: Storytelling;
15
+ }
16
+ export interface Subtext {
17
+ perspectives?: Perspective[];
18
+ players?: Player[];
19
+ storypoints?: Storypoint[];
20
+ storybeats?: Storybeat[];
21
+ dynamics?: Dynamic[];
22
+ }
23
+ export type Throughline = "Main Character" | "Influence Character" | "Objective Story" | "Relationship";
24
+ export interface Perspective {
25
+ id: string;
26
+ throughline: Throughline;
27
+ summary: string;
28
+ storytelling?: string;
29
+ }
30
+ export interface Player {
31
+ id: string;
32
+ name: string;
33
+ role: string;
34
+ summary?: string;
35
+ perspectiveId?: string;
36
+ }
37
+ export interface Storypoint {
38
+ id: string;
39
+ perspectiveId?: string;
40
+ appreciation: string;
41
+ illustration?: string;
42
+ storytelling?: string;
43
+ }
44
+ export interface Storybeat {
45
+ id: string;
46
+ perspectiveId?: string;
47
+ sequence?: number;
48
+ narrativeFunction?: string;
49
+ illustration: string;
50
+ summary?: string;
51
+ storytelling?: string;
52
+ timestamp?: string;
53
+ stageId?: string;
54
+ tones?: BeatTones;
55
+ }
56
+ export interface BeatTones {
57
+ abstraction?: string;
58
+ spatial?: string;
59
+ temporal?: string;
60
+ }
61
+ export interface Dynamic {
62
+ id: string;
63
+ name: string;
64
+ choice: string;
65
+ }
66
+ export interface Storytelling {
67
+ overviews?: Overview[];
68
+ moments?: Moment[];
69
+ }
70
+ export interface Overview {
71
+ id: string;
72
+ summary: string;
73
+ storytelling?: string;
74
+ }
75
+ export interface Moment {
76
+ id: string;
77
+ type: "Act" | "Scene" | "Sequence" | "Chapter" | "Level" | string;
78
+ summary: string;
79
+ synopsis?: string;
80
+ storybeats?: Array<{
81
+ order: number;
82
+ storybeatId: string;
83
+ }>;
84
+ }
85
+ //# sourceMappingURL=narrative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"narrative.d.ts","sourceRoot":"","sources":["../src/narr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AAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC3D"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * NCP-aligned narrative layer.
3
+ *
4
+ * Conceptually mirrors the Narrative Context Protocol (NCP) two-layer model:
5
+ * - Subtext — authorial intent (perspectives, players, storypoints, storybeats, dynamics)
6
+ * - Storytelling — surface presentation (overviews, moments)
7
+ *
8
+ * Reference: holisticagnostic-narrative-context-protocol
9
+ * Stewardship: The Dramatica Co. / USC Entertainment Technology Center
10
+ * License: MIT (compatible)
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=narrative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"narrative.js","sourceRoot":"","sources":["../src/narrative.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Episodic Memory — durable session-to-session memory.
3
+ *
4
+ * The cognitive-science analogue: Tulving (1972) distinguishes episodic memory
5
+ * (memory of experienced events) from semantic memory (facts) and procedural
6
+ * memory (skills). One Miadi session produces one episodic memory record,
7
+ * feedable back into world memory as lineage for the next session.
8
+ *
9
+ * The schema has five layers:
10
+ * 1. episode — session metadata + charter
11
+ * 2. narrative — NCP-aligned subtext + storytelling
12
+ * 3. world — settings, themes, character advancement (this episode's delta)
13
+ * 4. provenance — sources, consent decisions, authority flags (PROV-DM / OAIS-informed)
14
+ * 5. continuity — open promises, canonical facts, contradictions
15
+ *
16
+ * Plus follow-up commissions — seeds for the next episode.
17
+ */
18
+ import type { NarrativeContribution } from "./narrative";
19
+ export declare const SCHEMA_VERSION: "episodic-memory.v1.0";
20
+ export type SchemaVersion = typeof SCHEMA_VERSION;
21
+ export interface EpisodicMemory {
22
+ schemaVersion: SchemaVersion;
23
+ episode: EpisodeMetadata;
24
+ narrative?: NarrativeContribution;
25
+ world?: WorldStateDelta;
26
+ provenance: ProvenanceRecord;
27
+ continuity: ContinuityState;
28
+ evaluations?: NarrativeEvaluation[];
29
+ followUpCommissions?: FollowUpCommission[];
30
+ }
31
+ export interface EpisodeMetadata {
32
+ sessionId: string;
33
+ openedAt: string;
34
+ closedAt?: string;
35
+ charter: SessionCharter;
36
+ parentEpisodeId?: string;
37
+ childCommissionIds?: string[];
38
+ }
39
+ export interface SessionCharter {
40
+ purpose: string;
41
+ protocols?: string[];
42
+ audience?: string;
43
+ authority?: "draft" | "review" | "final";
44
+ }
45
+ export interface WorldStateDelta {
46
+ settings?: WorldSetting[];
47
+ rulesIntroduced?: string[];
48
+ charactersAdvanced?: CharacterAdvancement[];
49
+ themes?: string[];
50
+ }
51
+ export interface WorldSetting {
52
+ name: string;
53
+ type: "real" | "invented" | "hybrid";
54
+ locked: boolean;
55
+ notes?: string;
56
+ }
57
+ export interface CharacterAdvancement {
58
+ name: string;
59
+ role: string;
60
+ stake?: string;
61
+ beatIds?: string[];
62
+ }
63
+ export interface ProvenanceRecord {
64
+ sources: Source[];
65
+ consentDecisions: ConsentDecision[];
66
+ authorityFlags: AuthorityFlag[];
67
+ }
68
+ export type SourceAuthority = "open" | "restricted" | "sacred" | "community-controlled";
69
+ export interface Source {
70
+ id: string;
71
+ title: string;
72
+ authority: SourceAuthority;
73
+ citation?: string;
74
+ usedIn: string[];
75
+ attribution?: string;
76
+ }
77
+ export interface ConsentDecision {
78
+ id: string;
79
+ gate: string;
80
+ decision: string;
81
+ decidedBy: string;
82
+ confirmedByHuman: boolean;
83
+ at: string;
84
+ notes?: string;
85
+ }
86
+ export interface AuthorityFlag {
87
+ id: string;
88
+ flag: string;
89
+ raisedBy: string;
90
+ routedTo: string;
91
+ status: "open" | "resolved" | "pause";
92
+ }
93
+ export interface ContinuityState {
94
+ promises: StoryPromise[];
95
+ facts: StoryFact[];
96
+ contradictions: Contradiction[];
97
+ chapterVersions?: ChapterVersion[];
98
+ }
99
+ /**
100
+ * HAWK-style versioned audit trail for chapter state.
101
+ * Reference: Cheng et al. (2025), "Versioned State Update", §4.1.5.
102
+ */
103
+ export interface ChapterVersion {
104
+ chapterId: string;
105
+ version: string;
106
+ at: string;
107
+ environmentDelta?: string;
108
+ characterMemoryDelta?: string;
109
+ }
110
+ export interface StoryPromise {
111
+ id: string;
112
+ text: string;
113
+ status: "open" | "fulfilled" | "broken";
114
+ beatId?: string;
115
+ }
116
+ export interface StoryFact {
117
+ id: string;
118
+ text: string;
119
+ source?: string;
120
+ }
121
+ export interface Contradiction {
122
+ id: string;
123
+ description: string;
124
+ resolved: boolean;
125
+ resolution?: string;
126
+ }
127
+ export interface NarrativeEvaluation {
128
+ id: string;
129
+ evaluatedAt: string;
130
+ evaluatedBy: string;
131
+ target: EvaluationTarget;
132
+ goal?: GoalEvaluation;
133
+ plan?: PlanEvaluation;
134
+ notes?: string;
135
+ }
136
+ export interface EvaluationTarget {
137
+ type: "beat" | "chapter" | "outline" | "draft" | "bible";
138
+ id: string;
139
+ }
140
+ /** HAWK Decision Agent predicates p1–p5. Each value ∈ [-1, 1]. */
141
+ export interface GoalEvaluation {
142
+ coherence?: number;
143
+ progression?: number;
144
+ originality?: number;
145
+ tension?: number;
146
+ resonance?: number;
147
+ }
148
+ /** HAWK Decision Agent predicates p6–p10. Each value ∈ [-1, 1]. */
149
+ export interface PlanEvaluation {
150
+ feasibility?: number;
151
+ consistency?: number;
152
+ interactivity?: number;
153
+ suspense?: number;
154
+ cohesion?: number;
155
+ }
156
+ export interface FollowUpCommission {
157
+ id: string;
158
+ description: string;
159
+ rationale?: string;
160
+ proposedBy?: string;
161
+ }
162
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD,eAAO,MAAM,cAAc,EAAG,sBAA+B,CAAA;AAC7D,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAA;AAEjD,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,eAAe,CAAA;IACxB,SAAS,CAAC,EAAE,qBAAqB,CAAA;IACjC,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,UAAU,EAAE,gBAAgB,CAAA;IAC5B,UAAU,EAAE,eAAe,CAAA;IAC3B,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACnC,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAA;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IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
package/dist/types.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Episodic Memory — durable session-to-session memory.
3
+ *
4
+ * The cognitive-science analogue: Tulving (1972) distinguishes episodic memory
5
+ * (memory of experienced events) from semantic memory (facts) and procedural
6
+ * memory (skills). One Miadi session produces one episodic memory record,
7
+ * feedable back into world memory as lineage for the next session.
8
+ *
9
+ * The schema has five layers:
10
+ * 1. episode — session metadata + charter
11
+ * 2. narrative — NCP-aligned subtext + storytelling
12
+ * 3. world — settings, themes, character advancement (this episode's delta)
13
+ * 4. provenance — sources, consent decisions, authority flags (PROV-DM / OAIS-informed)
14
+ * 5. continuity — open promises, canonical facts, contradictions
15
+ *
16
+ * Plus follow-up commissions — seeds for the next episode.
17
+ */
18
+ export const SCHEMA_VERSION = "episodic-memory.v1.0";
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,cAAc,GAAG,sBAA+B,CAAA"}
@@ -0,0 +1,135 @@
1
+ {
2
+ "schemaVersion": "episodic-memory.v1.0",
3
+ "episode": {
4
+ "sessionId": "sw-2026-05-19-001",
5
+ "openedAt": "2026-05-19T13:00:00Z",
6
+ "closedAt": "2026-05-19T17:24:00Z",
7
+ "charter": {
8
+ "purpose": "story.bible.from.brief",
9
+ "protocols": ["wilson-3rs", "OCAP"],
10
+ "audience": "literary, adult",
11
+ "authority": "draft"
12
+ }
13
+ },
14
+ "narrative": {
15
+ "subtext": {
16
+ "perspectives": [
17
+ {
18
+ "id": "perspective_aen",
19
+ "throughline": "Main Character",
20
+ "summary": "Aen, who has forgotten how to walk softly.",
21
+ "storytelling": "A returning protagonist whose body remembers a violence the village has not forgiven."
22
+ }
23
+ ],
24
+ "players": [
25
+ { "id": "player_aen", "name": "Aen", "role": "Main Character", "perspectiveId": "perspective_aen", "summary": "Must relearn soft-step before first frost." },
26
+ { "id": "player_beech", "name": "Grandmother Beech", "role": "Influence Character", "summary": "Carries the village's footstep-memory." }
27
+ ],
28
+ "storypoints": [
29
+ { "id": "sp_accountability", "appreciation": "Issue", "illustration": "The forest keeps score of every footstep." }
30
+ ],
31
+ "storybeats": [
32
+ {
33
+ "id": "beat_loses_way",
34
+ "perspectiveId": "perspective_aen",
35
+ "sequence": 1,
36
+ "narrativeFunction": "Catalyst",
37
+ "illustration": "Aen realizes the forest is keeping score and she no longer remembers how to walk softly.",
38
+ "stageId": "bible",
39
+ "tones": { "abstraction": "situation", "spatial": "resistance", "temporal": "expression" }
40
+ }
41
+ ],
42
+ "dynamics": [
43
+ { "id": "dyn_resolve", "name": "Main Character Resolve", "choice": "Changed" }
44
+ ]
45
+ },
46
+ "storytelling": {
47
+ "overviews": [
48
+ { "id": "ov_01", "summary": "A literary fable in present tense, intimate scale, early autumn." }
49
+ ],
50
+ "moments": [
51
+ {
52
+ "id": "moment_return",
53
+ "type": "Chapter",
54
+ "summary": "Aen returns to Inwe-village",
55
+ "synopsis": "The forest greets her with the memory of her last departure.",
56
+ "storybeats": [{ "order": 0, "storybeatId": "beat_loses_way" }]
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ "world": {
62
+ "settings": [
63
+ { "name": "Inwe-village", "type": "invented", "locked": true, "notes": "Default-invented per protocol gate; real placement would require community consent." }
64
+ ],
65
+ "rulesIntroduced": [
66
+ "forest remembers footsteps",
67
+ "autumn is the season of accounting",
68
+ "silence is currency"
69
+ ],
70
+ "charactersAdvanced": [
71
+ { "name": "Aen", "role": "Main Character", "stake": "must relearn soft-step before first frost", "beatIds": ["beat_loses_way"] },
72
+ { "name": "Grandmother Beech", "role": "Influence Character", "stake": "carries the village's footstep-memory" }
73
+ ],
74
+ "themes": ["accountability", "return", "the weight of presence"]
75
+ },
76
+ "provenance": {
77
+ "sources": [
78
+ { "id": "src-01", "title": "Trees-as-witnesses motif (literary)", "authority": "open", "usedIn": ["bible"] },
79
+ { "id": "src-02", "title": "Soft-step traditions (cross-cultural)", "authority": "open", "usedIn": ["bible"] }
80
+ ],
81
+ "consentDecisions": [
82
+ {
83
+ "id": "c-01",
84
+ "gate": "research.authority",
85
+ "decision": "default-invented-setting",
86
+ "decidedBy": "protocol-steward",
87
+ "confirmedByHuman": true,
88
+ "at": "2026-05-19T13:42:00Z",
89
+ "notes": "Village named Inwe; not anchored to a real place."
90
+ }
91
+ ],
92
+ "authorityFlags": []
93
+ },
94
+ "continuity": {
95
+ "promises": [
96
+ { "id": "p1", "text": "Aen relearns soft-step by first frost", "status": "open", "beatId": "beat_loses_way" },
97
+ { "id": "p2", "text": "Grandmother Beech speaks at least once", "status": "open" }
98
+ ],
99
+ "facts": [
100
+ { "id": "f1", "text": "Season is early autumn" },
101
+ { "id": "f2", "text": "Village name is Inwe-village" }
102
+ ],
103
+ "contradictions": [],
104
+ "chapterVersions": [
105
+ { "chapterId": "moment_return", "version": "v1.0", "at": "2026-05-19T16:08:00Z",
106
+ "environmentDelta": "Inwe-village forest activated; autumn-accounting rule live.",
107
+ "characterMemoryDelta": "Aen recalls last departure; Beech's awareness of footsteps." }
108
+ ]
109
+ },
110
+ "evaluations": [
111
+ {
112
+ "id": "eval-bible-01",
113
+ "evaluatedAt": "2026-05-19T15:55:00Z",
114
+ "evaluatedBy": "developmental-editor",
115
+ "target": { "type": "bible", "id": "story.bible" },
116
+ "goal": { "coherence": 0.82, "progression": 0.61, "originality": 0.74, "tension": 0.88, "resonance": 0.79 },
117
+ "plan": { "feasibility": 0.71, "consistency": 0.85, "interactivity": 0.42, "suspense": 0.68, "cohesion": 0.77 },
118
+ "notes": "Foundation holds. Suspense and interactivity will rise as the outline lands."
119
+ }
120
+ ],
121
+ "followUpCommissions": [
122
+ {
123
+ "id": "fc-01",
124
+ "description": "Expand Aen's backstory into a prequel chapter.",
125
+ "rationale": "Backstory was implied in the bible but not developed; readers will ask.",
126
+ "proposedBy": "export-steward"
127
+ },
128
+ {
129
+ "id": "fc-02",
130
+ "description": "Map the seasonal accounting cycle as a world-building document.",
131
+ "rationale": "Rule introduced this episode is dense enough to warrant its own document.",
132
+ "proposedBy": "world-architect"
133
+ }
134
+ ]
135
+ }
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@miadi/episodic-memory-schema",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript types and JSON Schema for episodic memory — the durable session-to-session memory layer in the Miadi orchestration kit. Narrative layer is NCP-aligned; provenance layer is W3C PROV-DM and OAIS-informed.",
5
+ "keywords": [
6
+ "miadi",
7
+ "storyweaver",
8
+ "ncp",
9
+ "narrative-context-protocol",
10
+ "episodic-memory",
11
+ "schema",
12
+ "provenance",
13
+ "json-schema",
14
+ "tulving"
15
+ ],
16
+ "license": "MIT",
17
+ "author": "Miadi",
18
+ "homepage": "https://github.com/jgwill/Miadi/tree/main/packages/episodic-memory-schema",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/jgwill/Miadi.git",
22
+ "directory": "packages/episodic-memory-schema"
23
+ },
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js"
31
+ },
32
+ "./schema": "./schema/episodic-memory.schema.json",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "schema",
38
+ "examples",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "type-check": "tsc --noEmit",
45
+ "prepublishOnly": "pnpm build"
46
+ },
47
+ "devDependencies": {
48
+ "typescript": "^5.4.0"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ }
53
+ }
@@ -0,0 +1,357 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://miadi.dev/schema/episodic-memory.v1.0.json",
4
+ "title": "Episodic Memory",
5
+ "description": "Durable session-to-session memory for the Miadi orchestration kit. Narrative layer is NCP-aligned; provenance layer is W3C PROV-DM and OAIS-informed.",
6
+ "type": "object",
7
+ "required": ["schemaVersion", "episode", "provenance", "continuity"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schemaVersion": {
11
+ "type": "string",
12
+ "const": "episodic-memory.v1.0",
13
+ "description": "Schema version identifier."
14
+ },
15
+ "episode": { "$ref": "#/definitions/EpisodeMetadata" },
16
+ "narrative": { "$ref": "#/definitions/NarrativeContribution" },
17
+ "world": { "$ref": "#/definitions/WorldStateDelta" },
18
+ "provenance": { "$ref": "#/definitions/ProvenanceRecord" },
19
+ "continuity": { "$ref": "#/definitions/ContinuityState" },
20
+ "evaluations": {
21
+ "type": "array",
22
+ "description": "HAWK-derived narrative evaluations (Cheng et al. 2025).",
23
+ "items": { "$ref": "#/definitions/NarrativeEvaluation" }
24
+ },
25
+ "followUpCommissions": {
26
+ "type": "array",
27
+ "items": { "$ref": "#/definitions/FollowUpCommission" }
28
+ }
29
+ },
30
+ "definitions": {
31
+ "EpisodeMetadata": {
32
+ "type": "object",
33
+ "required": ["sessionId", "openedAt", "charter"],
34
+ "properties": {
35
+ "sessionId": { "type": "string" },
36
+ "openedAt": { "type": "string", "format": "date-time" },
37
+ "closedAt": { "type": "string", "format": "date-time" },
38
+ "charter": { "$ref": "#/definitions/SessionCharter" },
39
+ "parentEpisodeId": { "type": "string" },
40
+ "childCommissionIds": { "type": "array", "items": { "type": "string" } }
41
+ }
42
+ },
43
+ "SessionCharter": {
44
+ "type": "object",
45
+ "required": ["purpose"],
46
+ "properties": {
47
+ "purpose": { "type": "string" },
48
+ "protocols": { "type": "array", "items": { "type": "string" } },
49
+ "audience": { "type": "string" },
50
+ "authority": { "type": "string", "enum": ["draft", "review", "final"] }
51
+ }
52
+ },
53
+ "NarrativeContribution": {
54
+ "type": "object",
55
+ "description": "NCP-aligned narrative layer.",
56
+ "properties": {
57
+ "subtext": { "$ref": "#/definitions/Subtext" },
58
+ "storytelling": { "$ref": "#/definitions/Storytelling" }
59
+ }
60
+ },
61
+ "Subtext": {
62
+ "type": "object",
63
+ "description": "Authorial intent layer — NCP subtext.",
64
+ "properties": {
65
+ "perspectives": { "type": "array", "items": { "$ref": "#/definitions/Perspective" } },
66
+ "players": { "type": "array", "items": { "$ref": "#/definitions/Player" } },
67
+ "storypoints": { "type": "array", "items": { "$ref": "#/definitions/Storypoint" } },
68
+ "storybeats": { "type": "array", "items": { "$ref": "#/definitions/Storybeat" } },
69
+ "dynamics": { "type": "array", "items": { "$ref": "#/definitions/Dynamic" } }
70
+ }
71
+ },
72
+ "Storytelling": {
73
+ "type": "object",
74
+ "description": "Surface presentation layer — NCP storytelling.",
75
+ "properties": {
76
+ "overviews": { "type": "array", "items": { "$ref": "#/definitions/Overview" } },
77
+ "moments": { "type": "array", "items": { "$ref": "#/definitions/Moment" } }
78
+ }
79
+ },
80
+ "Perspective": {
81
+ "type": "object",
82
+ "required": ["id", "throughline", "summary"],
83
+ "properties": {
84
+ "id": { "type": "string" },
85
+ "throughline": { "type": "string", "enum": ["Main Character", "Influence Character", "Objective Story", "Relationship"] },
86
+ "summary": { "type": "string" },
87
+ "storytelling": { "type": "string" }
88
+ }
89
+ },
90
+ "Player": {
91
+ "type": "object",
92
+ "required": ["id", "name", "role"],
93
+ "properties": {
94
+ "id": { "type": "string" },
95
+ "name": { "type": "string" },
96
+ "role": { "type": "string" },
97
+ "summary": { "type": "string" },
98
+ "perspectiveId": { "type": "string" }
99
+ }
100
+ },
101
+ "Storypoint": {
102
+ "type": "object",
103
+ "required": ["id", "appreciation"],
104
+ "properties": {
105
+ "id": { "type": "string" },
106
+ "perspectiveId": { "type": "string" },
107
+ "appreciation": { "type": "string" },
108
+ "illustration": { "type": "string" },
109
+ "storytelling": { "type": "string" }
110
+ }
111
+ },
112
+ "Storybeat": {
113
+ "type": "object",
114
+ "required": ["id", "illustration"],
115
+ "properties": {
116
+ "id": { "type": "string" },
117
+ "perspectiveId": { "type": "string" },
118
+ "sequence": { "type": "integer" },
119
+ "narrativeFunction": { "type": "string" },
120
+ "illustration": { "type": "string" },
121
+ "summary": { "type": "string" },
122
+ "storytelling": { "type": "string" },
123
+ "timestamp": { "type": "string", "format": "date-time" },
124
+ "stageId": { "type": "string" },
125
+ "tones": { "$ref": "#/definitions/BeatTones" }
126
+ }
127
+ },
128
+ "BeatTones": {
129
+ "type": "object",
130
+ "properties": {
131
+ "abstraction": { "type": "string" },
132
+ "spatial": { "type": "string" },
133
+ "temporal": { "type": "string" }
134
+ }
135
+ },
136
+ "Dynamic": {
137
+ "type": "object",
138
+ "required": ["id", "name", "choice"],
139
+ "properties": {
140
+ "id": { "type": "string" },
141
+ "name": { "type": "string" },
142
+ "choice": { "type": "string" }
143
+ }
144
+ },
145
+ "Overview": {
146
+ "type": "object",
147
+ "required": ["id", "summary"],
148
+ "properties": {
149
+ "id": { "type": "string" },
150
+ "summary": { "type": "string" },
151
+ "storytelling": { "type": "string" }
152
+ }
153
+ },
154
+ "Moment": {
155
+ "type": "object",
156
+ "required": ["id", "type", "summary"],
157
+ "properties": {
158
+ "id": { "type": "string" },
159
+ "type": { "type": "string" },
160
+ "summary": { "type": "string" },
161
+ "synopsis": { "type": "string" },
162
+ "storybeats": {
163
+ "type": "array",
164
+ "items": {
165
+ "type": "object",
166
+ "required": ["order", "storybeatId"],
167
+ "properties": {
168
+ "order": { "type": "integer" },
169
+ "storybeatId": { "type": "string" }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ },
175
+ "WorldStateDelta": {
176
+ "type": "object",
177
+ "properties": {
178
+ "settings": { "type": "array", "items": { "$ref": "#/definitions/WorldSetting" } },
179
+ "rulesIntroduced": { "type": "array", "items": { "type": "string" } },
180
+ "charactersAdvanced": { "type": "array", "items": { "$ref": "#/definitions/CharacterAdvancement" } },
181
+ "themes": { "type": "array", "items": { "type": "string" } }
182
+ }
183
+ },
184
+ "WorldSetting": {
185
+ "type": "object",
186
+ "required": ["name", "type", "locked"],
187
+ "properties": {
188
+ "name": { "type": "string" },
189
+ "type": { "type": "string", "enum": ["real", "invented", "hybrid"] },
190
+ "locked": { "type": "boolean" },
191
+ "notes": { "type": "string" }
192
+ }
193
+ },
194
+ "CharacterAdvancement": {
195
+ "type": "object",
196
+ "required": ["name", "role"],
197
+ "properties": {
198
+ "name": { "type": "string" },
199
+ "role": { "type": "string" },
200
+ "stake": { "type": "string" },
201
+ "beatIds": { "type": "array", "items": { "type": "string" } }
202
+ }
203
+ },
204
+ "ProvenanceRecord": {
205
+ "type": "object",
206
+ "required": ["sources", "consentDecisions", "authorityFlags"],
207
+ "properties": {
208
+ "sources": { "type": "array", "items": { "$ref": "#/definitions/Source" } },
209
+ "consentDecisions": { "type": "array", "items": { "$ref": "#/definitions/ConsentDecision" } },
210
+ "authorityFlags": { "type": "array", "items": { "$ref": "#/definitions/AuthorityFlag" } }
211
+ }
212
+ },
213
+ "Source": {
214
+ "type": "object",
215
+ "required": ["id", "title", "authority", "usedIn"],
216
+ "properties": {
217
+ "id": { "type": "string" },
218
+ "title": { "type": "string" },
219
+ "authority": { "type": "string", "enum": ["open", "restricted", "sacred", "community-controlled"] },
220
+ "citation": { "type": "string" },
221
+ "usedIn": { "type": "array", "items": { "type": "string" } },
222
+ "attribution": { "type": "string" }
223
+ }
224
+ },
225
+ "ConsentDecision": {
226
+ "type": "object",
227
+ "required": ["id", "gate", "decision", "decidedBy", "confirmedByHuman", "at"],
228
+ "properties": {
229
+ "id": { "type": "string" },
230
+ "gate": { "type": "string" },
231
+ "decision": { "type": "string" },
232
+ "decidedBy": { "type": "string" },
233
+ "confirmedByHuman": { "type": "boolean" },
234
+ "at": { "type": "string", "format": "date-time" },
235
+ "notes": { "type": "string" }
236
+ }
237
+ },
238
+ "AuthorityFlag": {
239
+ "type": "object",
240
+ "required": ["id", "flag", "raisedBy", "routedTo", "status"],
241
+ "properties": {
242
+ "id": { "type": "string" },
243
+ "flag": { "type": "string" },
244
+ "raisedBy": { "type": "string" },
245
+ "routedTo": { "type": "string" },
246
+ "status": { "type": "string", "enum": ["open", "resolved", "pause"] }
247
+ }
248
+ },
249
+ "ContinuityState": {
250
+ "type": "object",
251
+ "required": ["promises", "facts", "contradictions"],
252
+ "properties": {
253
+ "promises": { "type": "array", "items": { "$ref": "#/definitions/StoryPromise" } },
254
+ "facts": { "type": "array", "items": { "$ref": "#/definitions/StoryFact" } },
255
+ "contradictions": { "type": "array", "items": { "$ref": "#/definitions/Contradiction" } },
256
+ "chapterVersions": {
257
+ "type": "array",
258
+ "description": "HAWK-style versioned audit trail per chapter (Cheng et al. 2025, §4.1.5).",
259
+ "items": { "$ref": "#/definitions/ChapterVersion" }
260
+ }
261
+ }
262
+ },
263
+ "ChapterVersion": {
264
+ "type": "object",
265
+ "required": ["chapterId", "version", "at"],
266
+ "properties": {
267
+ "chapterId": { "type": "string" },
268
+ "version": { "type": "string" },
269
+ "at": { "type": "string", "format": "date-time" },
270
+ "environmentDelta": { "type": "string" },
271
+ "characterMemoryDelta": { "type": "string" }
272
+ }
273
+ },
274
+ "NarrativeEvaluation": {
275
+ "type": "object",
276
+ "description": "HAWK 10-predicate Decision Agent rubric (Cheng et al. 2025, Figure 3).",
277
+ "required": ["id", "evaluatedAt", "evaluatedBy", "target"],
278
+ "properties": {
279
+ "id": { "type": "string" },
280
+ "evaluatedAt": { "type": "string", "format": "date-time" },
281
+ "evaluatedBy": { "type": "string" },
282
+ "target": {
283
+ "type": "object",
284
+ "required": ["type", "id"],
285
+ "properties": {
286
+ "type": { "type": "string", "enum": ["beat", "chapter", "outline", "draft", "bible"] },
287
+ "id": { "type": "string" }
288
+ }
289
+ },
290
+ "goal": { "$ref": "#/definitions/GoalEvaluation" },
291
+ "plan": { "$ref": "#/definitions/PlanEvaluation" },
292
+ "notes": { "type": "string" }
293
+ }
294
+ },
295
+ "GoalEvaluation": {
296
+ "type": "object",
297
+ "description": "HAWK predicates p1–p5. Each value ∈ [-1, 1].",
298
+ "properties": {
299
+ "coherence": { "type": "number", "minimum": -1, "maximum": 1 },
300
+ "progression": { "type": "number", "minimum": -1, "maximum": 1 },
301
+ "originality": { "type": "number", "minimum": -1, "maximum": 1 },
302
+ "tension": { "type": "number", "minimum": -1, "maximum": 1 },
303
+ "resonance": { "type": "number", "minimum": -1, "maximum": 1 }
304
+ }
305
+ },
306
+ "PlanEvaluation": {
307
+ "type": "object",
308
+ "description": "HAWK predicates p6–p10. Each value ∈ [-1, 1].",
309
+ "properties": {
310
+ "feasibility": { "type": "number", "minimum": -1, "maximum": 1 },
311
+ "consistency": { "type": "number", "minimum": -1, "maximum": 1 },
312
+ "interactivity": { "type": "number", "minimum": -1, "maximum": 1 },
313
+ "suspense": { "type": "number", "minimum": -1, "maximum": 1 },
314
+ "cohesion": { "type": "number", "minimum": -1, "maximum": 1 }
315
+ }
316
+ },
317
+ "StoryPromise": {
318
+ "type": "object",
319
+ "required": ["id", "text", "status"],
320
+ "properties": {
321
+ "id": { "type": "string" },
322
+ "text": { "type": "string" },
323
+ "status": { "type": "string", "enum": ["open", "fulfilled", "broken"] },
324
+ "beatId": { "type": "string" }
325
+ }
326
+ },
327
+ "StoryFact": {
328
+ "type": "object",
329
+ "required": ["id", "text"],
330
+ "properties": {
331
+ "id": { "type": "string" },
332
+ "text": { "type": "string" },
333
+ "source": { "type": "string" }
334
+ }
335
+ },
336
+ "Contradiction": {
337
+ "type": "object",
338
+ "required": ["id", "description", "resolved"],
339
+ "properties": {
340
+ "id": { "type": "string" },
341
+ "description": { "type": "string" },
342
+ "resolved": { "type": "boolean" },
343
+ "resolution": { "type": "string" }
344
+ }
345
+ },
346
+ "FollowUpCommission": {
347
+ "type": "object",
348
+ "required": ["id", "description"],
349
+ "properties": {
350
+ "id": { "type": "string" },
351
+ "description": { "type": "string" },
352
+ "rationale": { "type": "string" },
353
+ "proposedBy": { "type": "string" }
354
+ }
355
+ }
356
+ }
357
+ }