forge-openclaw-plugin 0.2.70 → 0.2.72

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 (32) hide show
  1. package/dist/assets/{board-BfqxFNiQ.js → board-B0TuXl4u.js} +1 -1
  2. package/dist/assets/index-DtT3Y-Bj.css +1 -0
  3. package/dist/assets/index-clNilMKr.js +91 -0
  4. package/dist/assets/{motion-C0ALlgho.js → motion-Dmjq6HPm.js} +1 -1
  5. package/dist/assets/{table-WcMjnJll.js → table-CKKimYN1.js} +1 -1
  6. package/dist/assets/{ui-B5I-3U91.js → ui-JBdCP1Qb.js} +1 -1
  7. package/dist/assets/{vendor-C56o26_3.js → vendor-fiXu5f59.js} +233 -228
  8. package/dist/index.html +7 -7
  9. package/dist/server/server/migrations/063_psyche_flashcards.sql +31 -0
  10. package/dist/server/server/src/app.js +227 -7
  11. package/dist/server/server/src/health.js +127 -34
  12. package/dist/server/server/src/openapi.js +1 -0
  13. package/dist/server/server/src/psyche-types.js +54 -0
  14. package/dist/server/server/src/repositories/psyche.js +146 -1
  15. package/dist/server/server/src/services/entity-crud.js +27 -5
  16. package/dist/server/server/src/services/gamification.js +2 -0
  17. package/dist/server/server/src/services/knowledge-graph.js +87 -1
  18. package/dist/server/server/src/services/psyche-observation-calendar.js +1 -0
  19. package/dist/server/server/src/services/psyche.js +4 -1
  20. package/dist/server/server/src/types.js +3 -0
  21. package/dist/server/src/lib/api.js +43 -0
  22. package/dist/server/src/lib/entity-visuals.js +9 -0
  23. package/dist/server/src/lib/knowledge-graph-types.js +19 -0
  24. package/dist/server/src/lib/psyche-schemas.js +177 -0
  25. package/openclaw.plugin.json +1 -1
  26. package/package.json +1 -1
  27. package/server/migrations/063_psyche_flashcards.sql +31 -0
  28. package/skills/forge-openclaw/SKILL.md +20 -4
  29. package/skills/forge-openclaw/entity_conversation_playbooks.md +6 -3
  30. package/skills/forge-openclaw/psyche_entity_playbooks.md +64 -3
  31. package/dist/assets/index-BfLQnCNZ.js +0 -91
  32. package/dist/assets/index-DIapFz9v.css +0 -1
@@ -64,6 +64,11 @@ export const KNOWLEDGE_GRAPH_HIERARCHY_LANES = [
64
64
  label: "Modes / Mode Sessions",
65
65
  kinds: ["mode", "mode_session"]
66
66
  },
67
+ {
68
+ id: "flashcards",
69
+ label: "Flashcards",
70
+ kinds: ["flashcard"]
71
+ },
67
72
  {
68
73
  id: "reports",
69
74
  label: "Reports / Event Types / Emotions",
@@ -110,6 +115,12 @@ export const KNOWLEDGE_GRAPH_RELATION_LABELS = {
110
115
  mode_pattern: "Mode to pattern",
111
116
  mode_behavior: "Mode to behavior",
112
117
  mode_value: "Mode to value",
118
+ flashcard_value: "Flashcard to value",
119
+ flashcard_behavior: "Flashcard to behavior",
120
+ flashcard_pattern: "Flashcard to pattern",
121
+ flashcard_belief: "Flashcard to belief",
122
+ flashcard_mode: "Flashcard to mode",
123
+ flashcard_report: "Flashcard to report",
113
124
  report_value: "Report to value",
114
125
  report_pattern: "Report to pattern",
115
126
  report_goal: "Report to goal",
@@ -165,6 +176,12 @@ export const KNOWLEDGE_GRAPH_RELATION_FAMILY_MAP = {
165
176
  mode_pattern: "contextual",
166
177
  mode_behavior: "contextual",
167
178
  mode_value: "contextual",
179
+ flashcard_value: "contextual",
180
+ flashcard_behavior: "contextual",
181
+ flashcard_pattern: "contextual",
182
+ flashcard_belief: "contextual",
183
+ flashcard_mode: "contextual",
184
+ flashcard_report: "contextual",
168
185
  report_value: "contextual",
169
186
  report_pattern: "contextual",
170
187
  report_goal: "contextual",
@@ -234,6 +251,8 @@ export function getKnowledgeGraphEntityHref(entityType, entityId, options) {
234
251
  return `/psyche/modes?focus=${encodeURIComponent(entityId)}`;
235
252
  case "mode_guide_session":
236
253
  return `/psyche/modes`;
254
+ case "flashcard":
255
+ return `/psyche/flashcards?focus=${encodeURIComponent(entityId)}`;
237
256
  case "trigger_report":
238
257
  return `/psyche/reports/${encodeURIComponent(entityId)}`;
239
258
  case "note":
@@ -0,0 +1,177 @@
1
+ import { z } from "zod";
2
+ const trimmed = z.string().trim();
3
+ const nonEmpty = trimmed.min(1);
4
+ const uniqueStrings = z.array(nonEmpty).transform((values) => Array.from(new Set(values)));
5
+ const ownedUserId = z.string().trim().min(1).nullable().optional();
6
+ export const psycheValueSchema = z.object({
7
+ title: nonEmpty,
8
+ description: trimmed,
9
+ valuedDirection: nonEmpty,
10
+ whyItMatters: trimmed,
11
+ linkedGoalIds: z.array(z.string()).default([]),
12
+ linkedProjectIds: z.array(z.string()).default([]),
13
+ linkedTaskIds: z.array(z.string()).default([]),
14
+ committedActions: z.array(trimmed).default([]),
15
+ userId: ownedUserId
16
+ });
17
+ export const behaviorPatternSchema = z.object({
18
+ title: nonEmpty,
19
+ description: trimmed,
20
+ targetBehavior: nonEmpty,
21
+ cueContexts: z.array(trimmed).default([]),
22
+ shortTermPayoff: trimmed,
23
+ longTermCost: trimmed,
24
+ preferredResponse: nonEmpty,
25
+ linkedValueIds: z.array(z.string()).default([]),
26
+ linkedSchemaLabels: uniqueStrings.default([]),
27
+ linkedModeIds: z.array(z.string()).default([]),
28
+ linkedBeliefIds: z.array(z.string()).default([]),
29
+ userId: ownedUserId
30
+ });
31
+ export const behaviorSchema = z.object({
32
+ kind: z.enum(["away", "committed", "recovery"]),
33
+ title: nonEmpty,
34
+ description: trimmed,
35
+ commonCues: z.array(trimmed).default([]),
36
+ urgeStory: trimmed,
37
+ shortTermPayoff: trimmed,
38
+ longTermCost: trimmed,
39
+ replacementMove: trimmed,
40
+ repairPlan: trimmed,
41
+ linkedPatternIds: z.array(z.string()).default([]),
42
+ linkedValueIds: z.array(z.string()).default([]),
43
+ linkedSchemaIds: z.array(z.string()).default([]),
44
+ linkedModeIds: z.array(z.string()).default([]),
45
+ userId: ownedUserId
46
+ });
47
+ export const beliefEntrySchema = z.object({
48
+ schemaId: z.string().nullable(),
49
+ statement: nonEmpty,
50
+ beliefType: z.enum(["absolute", "conditional"]),
51
+ originNote: trimmed,
52
+ confidence: z.number().int().min(0).max(100),
53
+ evidenceFor: z.array(trimmed).default([]),
54
+ evidenceAgainst: z.array(trimmed).default([]),
55
+ flexibleAlternative: trimmed,
56
+ linkedValueIds: z.array(z.string()).default([]),
57
+ linkedBehaviorIds: z.array(z.string()).default([]),
58
+ linkedModeIds: z.array(z.string()).default([]),
59
+ linkedReportIds: z.array(z.string()).default([]),
60
+ userId: ownedUserId
61
+ });
62
+ export const modeProfileSchema = z.object({
63
+ family: z.enum(["coping", "child", "critic_parent", "healthy_adult", "happy_child"]),
64
+ archetype: trimmed,
65
+ title: nonEmpty,
66
+ persona: trimmed,
67
+ imagery: trimmed,
68
+ symbolicForm: trimmed,
69
+ facialExpression: trimmed,
70
+ fear: trimmed,
71
+ burden: trimmed,
72
+ protectiveJob: trimmed,
73
+ originContext: trimmed,
74
+ firstAppearanceAt: z.string().trim().nullable(),
75
+ linkedPatternIds: z.array(z.string()).default([]),
76
+ linkedBehaviorIds: z.array(z.string()).default([]),
77
+ linkedValueIds: z.array(z.string()).default([]),
78
+ userId: ownedUserId
79
+ });
80
+ export const modeGuideSessionSchema = z.object({
81
+ summary: nonEmpty,
82
+ answers: z.array(z.object({
83
+ questionKey: nonEmpty,
84
+ value: nonEmpty
85
+ })).min(1),
86
+ userId: ownedUserId
87
+ });
88
+ export const flashcardSchema = z.object({
89
+ title: trimmed.default(""),
90
+ message: nonEmpty,
91
+ triggerSentence: trimmed.default(""),
92
+ triggerSituation: trimmed.default(""),
93
+ tags: z.array(trimmed).default([]),
94
+ backgroundColor: trimmed.default("#f8fafc"),
95
+ textColor: trimmed.default("#111827"),
96
+ accentColor: trimmed.default("#6ee7b7"),
97
+ typography: z.enum(["serif", "sans", "mono", "display"]).default("serif"),
98
+ imageUrl: trimmed.default(""),
99
+ imageAlt: trimmed.default(""),
100
+ layout: z.enum(["centered", "top_left", "image_split", "poster"]).default("centered"),
101
+ visualStyle: z.enum(["calm", "urgent", "warm", "clinical", "playful"]).default("calm"),
102
+ linkedValueIds: z.array(z.string()).default([]),
103
+ linkedBehaviorIds: z.array(z.string()).default([]),
104
+ linkedPatternIds: z.array(z.string()).default([]),
105
+ linkedBeliefIds: z.array(z.string()).default([]),
106
+ linkedModeIds: z.array(z.string()).default([]),
107
+ linkedReportIds: z.array(z.string()).default([]),
108
+ userId: ownedUserId
109
+ });
110
+ export const eventTypeSchema = z.object({
111
+ label: nonEmpty,
112
+ description: trimmed,
113
+ userId: ownedUserId
114
+ });
115
+ export const emotionDefinitionSchema = z.object({
116
+ label: nonEmpty,
117
+ description: trimmed,
118
+ category: trimmed,
119
+ userId: ownedUserId
120
+ });
121
+ export const triggerEmotionSchema = z.object({
122
+ id: nonEmpty,
123
+ emotionDefinitionId: z.string().nullable(),
124
+ label: nonEmpty,
125
+ intensity: z.number().int().min(0).max(100),
126
+ note: trimmed
127
+ });
128
+ export const triggerThoughtSchema = z.object({
129
+ id: nonEmpty,
130
+ text: nonEmpty,
131
+ parentMode: trimmed,
132
+ criticMode: trimmed,
133
+ beliefId: z.string().nullable()
134
+ });
135
+ export const triggerBehaviorSchema = z.object({
136
+ id: nonEmpty,
137
+ text: nonEmpty,
138
+ mode: trimmed,
139
+ behaviorId: z.string().nullable()
140
+ });
141
+ export const modeTimelineEntrySchema = z.object({
142
+ id: nonEmpty,
143
+ stage: nonEmpty,
144
+ modeId: z.string().nullable(),
145
+ label: nonEmpty,
146
+ note: trimmed
147
+ });
148
+ export const triggerReportSchema = z.object({
149
+ title: nonEmpty,
150
+ status: z.enum(["draft", "reviewed", "integrated"]).default("draft"),
151
+ eventTypeId: z.string().nullable(),
152
+ customEventType: trimmed,
153
+ eventSituation: nonEmpty,
154
+ occurredAt: z.string().trim().nullable(),
155
+ emotions: z.array(triggerEmotionSchema).default([]),
156
+ thoughts: z.array(triggerThoughtSchema).default([]),
157
+ behaviors: z.array(triggerBehaviorSchema).default([]),
158
+ consequences: z.object({
159
+ selfShortTerm: z.array(trimmed).default([]),
160
+ selfLongTerm: z.array(trimmed).default([]),
161
+ othersShortTerm: z.array(trimmed).default([]),
162
+ othersLongTerm: z.array(trimmed).default([])
163
+ }),
164
+ linkedPatternIds: z.array(z.string()).default([]),
165
+ linkedValueIds: z.array(z.string()).default([]),
166
+ linkedGoalIds: z.array(z.string()).default([]),
167
+ linkedProjectIds: z.array(z.string()).default([]),
168
+ linkedTaskIds: z.array(z.string()).default([]),
169
+ linkedBehaviorIds: z.array(z.string()).default([]),
170
+ linkedBeliefIds: z.array(z.string()).default([]),
171
+ linkedModeIds: z.array(z.string()).default([]),
172
+ modeOverlays: z.array(trimmed).default([]),
173
+ schemaLinks: z.array(trimmed).default([]),
174
+ modeTimeline: z.array(modeTimelineEntrySchema).default([]),
175
+ nextMoves: z.array(trimmed).default([]),
176
+ userId: ownedUserId
177
+ });
@@ -2,7 +2,7 @@
2
2
  "id": "forge-openclaw-plugin",
3
3
  "name": "Forge",
4
4
  "description": "Curated OpenClaw adapter for the Forge collaboration API, UI entrypoint, and localhost auto-start runtime.",
5
- "version": "0.2.70",
5
+ "version": "0.2.72",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-openclaw-plugin",
3
- "version": "0.2.70",
3
+ "version": "0.2.72",
4
4
  "description": "Curated OpenClaw adapter for the Forge collaboration API, UI entrypoint, and localhost auto-start runtime.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,31 @@
1
+ CREATE TABLE IF NOT EXISTS psyche_flashcards (
2
+ id TEXT PRIMARY KEY,
3
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
4
+ title TEXT NOT NULL DEFAULT '',
5
+ message TEXT NOT NULL,
6
+ trigger_sentence TEXT NOT NULL DEFAULT '',
7
+ trigger_situation TEXT NOT NULL DEFAULT '',
8
+ tags_json TEXT NOT NULL DEFAULT '[]',
9
+ background_color TEXT NOT NULL DEFAULT '#f8fafc',
10
+ text_color TEXT NOT NULL DEFAULT '#111827',
11
+ accent_color TEXT NOT NULL DEFAULT '#6ee7b7',
12
+ typography TEXT NOT NULL DEFAULT 'serif',
13
+ image_url TEXT NOT NULL DEFAULT '',
14
+ image_alt TEXT NOT NULL DEFAULT '',
15
+ layout TEXT NOT NULL DEFAULT 'centered',
16
+ visual_style TEXT NOT NULL DEFAULT 'calm',
17
+ linked_value_ids_json TEXT NOT NULL DEFAULT '[]',
18
+ linked_behavior_ids_json TEXT NOT NULL DEFAULT '[]',
19
+ linked_pattern_ids_json TEXT NOT NULL DEFAULT '[]',
20
+ linked_belief_ids_json TEXT NOT NULL DEFAULT '[]',
21
+ linked_mode_ids_json TEXT NOT NULL DEFAULT '[]',
22
+ linked_report_ids_json TEXT NOT NULL DEFAULT '[]',
23
+ created_at TEXT NOT NULL,
24
+ updated_at TEXT NOT NULL
25
+ );
26
+
27
+ CREATE INDEX IF NOT EXISTS idx_psyche_flashcards_domain_updated
28
+ ON psyche_flashcards(domain_id, updated_at DESC);
29
+
30
+ CREATE INDEX IF NOT EXISTS idx_psyche_flashcards_trigger_sentence
31
+ ON psyche_flashcards(trigger_sentence);
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: forge-openclaw-plugin
3
- description: use when the user wants to save, search, update, review, start, stop, reward, explain, compare, or run Forge records, or when the conversation is clearly about a Forge entity or domain surface such as a goal, project, strategy, task, habit, note, wiki_page, calendar_event, calendar_connection, work_block_template, task_timebox, task_run, work_adjustment, insight, preference item, preference context, preference catalog, preference judgment, preference signal, questionnaire instrument, questionnaire run, self observation, movement, life_force, workbench, psyche_value, behavior_pattern, behavior, belief_entry, mode_profile, mode_guide_session, trigger_report, event_type, emotion_definition, sleep_session, or workout_session. identify the exact Forge object or specialized surface, keep the main conversation natural, guide psyche intake with active listening before storing it, and for psyche issues that need understanding first usually begin with one exploratory question before any formulation or save suggestion.
3
+ description: use when the user wants to save, search, update, review, start, stop, reward, explain, compare, or run Forge records, or when the conversation is clearly about a Forge entity or domain surface such as a goal, project, strategy, task, habit, note, wiki_page, calendar_event, calendar_connection, work_block_template, task_timebox, task_run, work_adjustment, insight, preference item, preference context, preference catalog, preference judgment, preference signal, questionnaire instrument, questionnaire run, self observation, movement, life_force, workbench, psyche_value, behavior_pattern, behavior, belief_entry, mode_profile, mode_guide_session, flashcard, trigger_report, event_type, emotion_definition, sleep_session, or workout_session. identify the exact Forge object or specialized surface, keep the main conversation natural, guide psyche intake with active listening before storing it, and for psyche issues that need understanding first usually begin with one exploratory question before any formulation or save suggestion.
4
4
  ---
5
5
 
6
6
  Forge is the user's structured system for planning work, doing work, reflecting on patterns, and keeping a truthful record of what is happening. Use it when the user is clearly working inside that system, or when they are describing something that naturally belongs there and would benefit from being stored, updated, reviewed, or acted on in Forge. Keep the conversation natural first. Do not turn every message into intake. When a real Forge entity is clearly present, name the exact entity type plainly, help with the substance of the conversation, and then offer Forge once, lightly, if storing it would genuinely help.
@@ -59,7 +59,7 @@ PM surface rule:
59
59
  human/bot ownership filters.
60
60
  - Guided modal flows handle create, edit, move, link, and closeout actions.
61
61
 
62
- Forge has four major stored-entity surfaces and three specialized domain surfaces. The planning side covers goals, projects, strategies, tasks, habits, notes, calendar events, recurring work blocks, task timeboxes, live work sessions, and agent-authored insights. The Health side covers sleep sessions, sports and workout sessions, companion pairing, and habit-generated workout records that should still stay linked to the broader Forge graph. The Preferences side covers contextual taste modeling, pairwise comparisons, direct signals, editable concept libraries, and preference items that can come from Forge entities or seeded concept domains such as food, activities, places, countries, fashion, people, media, and tools. The Psyche side covers values, patterns, behaviors, beliefs, modes, guided mode sessions, trigger reports, event types, and reusable emotion definitions. The specialized domain surfaces are Movement, Life Force, and Workbench; agents must use their dedicated route families instead of forcing them through batch CRUD. Forge also has a SQLite-backed Wiki memory layer with explicit spaces, Markdown content in database rows, backlinks, optional embeddings, and structured links back to Forge entities. Forge is also multi-user: every entity can belong to a typed `human` or `bot` user through `userId`, and read routes can scope to one or many users with `userId` or repeated `userIds`. The current access posture is configurable through a directional user graph, but the live default is still permissive: Forge can list users directly, every relationship edge starts open, and a user can read or affect another user's linked records when the route explicitly asks for them. Use `forge_get_user_directory` when owner identity or cross-user access matters. Strategies can also be locked into a contract with `isLocked`; once locked, do not mutate the graph or target structure unless the user explicitly wants the strategy unlocked first. The model should use the real entity names, not vague substitutes. Say `project`, not “initiative”. Say `behavior_pattern`, not “theme”. Say `trigger_report`, not “incident note”.
62
+ Forge has four major stored-entity surfaces and three specialized domain surfaces. The planning side covers goals, projects, strategies, tasks, habits, notes, calendar events, recurring work blocks, task timeboxes, live work sessions, and agent-authored insights. The Health side covers sleep sessions, sports and workout sessions, companion pairing, and habit-generated workout records that should still stay linked to the broader Forge graph. The Preferences side covers contextual taste modeling, pairwise comparisons, direct signals, editable concept libraries, and preference items that can come from Forge entities or seeded concept domains such as food, activities, places, countries, fashion, people, media, and tools. The Psyche side covers values, patterns, behaviors, beliefs, modes, guided mode sessions, flashcards, trigger reports, event types, and reusable emotion definitions. The specialized domain surfaces are Movement, Life Force, and Workbench; agents must use their dedicated route families instead of forcing them through batch CRUD. Forge also has a SQLite-backed Wiki memory layer with explicit spaces, Markdown content in database rows, backlinks, optional embeddings, and structured links back to Forge entities. Forge is also multi-user: every entity can belong to a typed `human` or `bot` user through `userId`, and read routes can scope to one or many users with `userId` or repeated `userIds`. The current access posture is configurable through a directional user graph, but the live default is still permissive: Forge can list users directly, every relationship edge starts open, and a user can read or affect another user's linked records when the route explicitly asks for them. Use `forge_get_user_directory` when owner identity or cross-user access matters. Strategies can also be locked into a contract with `isLocked`; once locked, do not mutate the graph or target structure unless the user explicitly wants the strategy unlocked first. The model should use the real entity names, not vague substitutes. Say `project`, not “initiative”. Say `behavior_pattern`, not “theme”. Say `trigger_report`, not “incident note”.
63
63
  Habits are a first-class recurring entity in the planning side.
64
64
  NEGATIVE HABIT CHECK-IN RULE: for a `negative` habit, the correct aligned/resisted outcome is `missed`. `missed` means the bad habit was resisted, the user stayed aligned, and the habit should award its XP bonus.
65
65
 
@@ -237,7 +237,7 @@ Forge data location rule:
237
237
 
238
238
  Psyche interview rule:
239
239
 
240
- - For `psyche_value`, `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`, `mode_guide_session`, `trigger_report`, `event_type`, and `emotion_definition`, do not jump straight to raw field collection.
240
+ - For `psyche_value`, `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`, `mode_guide_session`, `flashcard`, `trigger_report`, `event_type`, and `emotion_definition`, do not jump straight to raw field collection.
241
241
  - Treat `event_type` and `emotion_definition` as psychologically meaningful Psyche records, not cold taxonomy labels; start from the repeated lived moment or felt signature before wording the reusable label.
242
242
  - First use the active-listening playbooks in [`psyche_entity_playbooks.md`](./psyche_entity_playbooks.md).
243
243
  - Ask permission before going deeper, ask one or two focused questions at a time, reflect back what you heard, and summarize before moving on.
@@ -276,6 +276,8 @@ Self-observation rule:
276
276
  - If the core is a sentence the user believes, prefer `belief_entry`.
277
277
  - If a part-state, protector, critic, child state, or healthy-adult stance is active,
278
278
  prefer `mode_guide_session` or `mode_profile`.
279
+ - If the user needs a brief rehearsable message during an urge, trigger, belief
280
+ activation, mode shift, or relapse-prevention moment, prefer `flashcard`.
279
281
  - If a schema theme is visible, do not bury it in self-observation: preserve it as
280
282
  the belief, recurring pattern, active mode, guided mode session, trigger report, or
281
283
  wiki explanation that best matches the material.
@@ -318,6 +320,10 @@ Use these exact entity meanings when deciding what the user is describing.
318
320
 
319
321
  `mode_guide_session` is a guided exploration record used to understand what mode may be active right now. It is a structured worksheet, not the final durable profile unless the user wants it that way.
320
322
 
323
+ `flashcard` is a small therapeutic reminder card. Use it when the user wants a sentence or short message that can be shown back during an urge, trigger, mode activation, belief activation, or values-based pivot. The message is the main content; title is optional and compact. Tags, trigger sentence, trigger situation, and Psyche links matter most for retrieval. Styling fields such as colors, typography, layout, visual tone, and image make the card easier to recognize but should come after the therapeutic sentence is clear.
324
+
325
+ When a user says something like "I feel the urge to drink" or "help me not do this", search existing `flashcard` records first with `forge_search_entities` using `entityTypes: ["flashcard"]` and the user's urge, trigger words, tags, and situation language. If a matching card exists, show the flashcard message first, then add brief psychotherapy-informed support around it: grounding, urge surfing, cognitive defusion, schema/mode-aware reflection, or a values pivot. Do not create a new card until you have checked whether an existing one already fits.
326
+
321
327
  `trigger_report` is one specific emotionally meaningful episode described as what happened, what was felt, what was thought, what was done, what happened next, and what would help next time.
322
328
 
323
329
  `event_type` is a reusable category for trigger reports, such as rejection, criticism, conflict, uncertainty, or abandonment cue.
@@ -440,6 +446,16 @@ Only ask if missing or unclear:
440
446
  2. If it had a voice, what would it say, fear, or need?
441
447
  3. Would it help if we suggested one or two candidate mode labels, with reasons, before deciding whether to store a durable profile?
442
448
 
449
+ `flashcard`
450
+ Use for a small therapeutic card to retrieve during an urge, trigger, mode activation, belief activation, or values-based pivot.
451
+ Minimum field: `message`
452
+ Usually useful: `triggerSentence`, `triggerSituation`, `tags`, optional compact `title`, visual styling, optional `imageUrl`, links to values, behaviors, patterns, beliefs, modes, or reports
453
+ Only ask if missing or unclear:
454
+
455
+ 1. What exact urge sentence, trigger, or situation should bring this card up?
456
+ 2. What one simple message should be centered on the card when that moment hits?
457
+ 3. What tags or trigger wording will help us find it later, and only then what visual tone, colors, typography, or image should it use?
458
+
443
459
  `trigger_report`
444
460
  Use for one specific emotionally important episode.
445
461
  Minimum field: `title`
@@ -480,7 +496,7 @@ Use the batch entity tools for stored records:
480
496
  `forge_search_entities`, `forge_create_entities`, `forge_update_entities`, `forge_delete_entities`, `forge_restore_entities`
481
497
 
482
498
  These tools operate on:
483
- `goal`, `project`, `strategy`, `task`, `habit`, `tag`, `note`, `insight`, `calendar_event`, `work_block_template`, `task_timebox`, `psyche_value`, `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`, `mode_guide_session`, `trigger_report`, `event_type`, `emotion_definition`, `preference_catalog`, `preference_catalog_item`, `preference_context`, `preference_item`, `questionnaire_instrument`, `sleep_session`, `workout_session`
499
+ `goal`, `project`, `strategy`, `task`, `habit`, `tag`, `note`, `insight`, `calendar_event`, `work_block_template`, `task_timebox`, `psyche_value`, `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`, `mode_guide_session`, `flashcard`, `trigger_report`, `event_type`, `emotion_definition`, `preference_catalog`, `preference_catalog_item`, `preference_context`, `preference_item`, `questionnaire_instrument`, `sleep_session`, `workout_session`
484
500
 
485
501
  Use the wiki tools for SQLite-backed memory work:
486
502
  `forge_get_wiki_settings`, `forge_list_wiki_pages`, `forge_get_wiki_page`, `forge_search_wiki`, `forge_upsert_wiki_page`, `forge_get_wiki_health`, `forge_sync_wiki_vault`, `forge_reindex_wiki_embeddings`, `forge_ingest_wiki_source`
@@ -275,7 +275,8 @@ still knowing the exact write/read family before it acts.
275
275
  CRUD. Use health overview/read helpers for review and reflective update helpers only
276
276
  when enriching one already-known record after review.
277
277
  - `psyche_value`, `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`,
278
- `mode_guide_session`, `trigger_report`, `event_type`, and `emotion_definition`:
278
+ `mode_guide_session`, `flashcard`, `trigger_report`, `event_type`, and
279
+ `emotion_definition`:
279
280
  psychologically meaningful records, but normal stored entities for API purposes.
280
281
  Search and mutate through shared batch entity routes after the formulation is clear.
281
282
  - `wiki_page`: specialized CRUD. Use wiki page/search/upsert routes so page rows,
@@ -1170,7 +1171,8 @@ Arc:
1170
1171
  visible.
1171
1172
  6. Decide whether this should stay a lightweight self-observation or become a
1172
1173
  `trigger_report`, `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`,
1173
- `mode_guide_session`, `event_type`, `emotion_definition`, or wiki page.
1174
+ `mode_guide_session`, `flashcard`, `event_type`, `emotion_definition`, or wiki
1175
+ page.
1174
1176
  7. Link the observation to the structured record when the structured record is the
1175
1177
  real container.
1176
1178
 
@@ -1193,7 +1195,8 @@ Route note:
1193
1195
  - Do not promote self-observation over functional analysis. If the user is describing
1194
1196
  a loop, use `behavior_pattern`; if they are describing one emotionally meaningful
1195
1197
  episode, use `trigger_report`; if a part-state is central, use `mode_guide_session`
1196
- or `mode_profile`; if a belief sentence is central, use `belief_entry`.
1198
+ or `mode_profile`; if a belief sentence is central, use `belief_entry`; if the
1199
+ user needs a rehearsable reminder during the trigger or urge, use `flashcard`.
1197
1200
  - If the user wants to remember a source, concept, book, article, or durable personal
1198
1201
  explanation, use `wiki_page` rather than self-observation.
1199
1202
 
@@ -237,6 +237,9 @@ short, tentative, and correctable.
237
237
  possible mode family only after the part's lived voice or posture is visible.
238
238
  - `mode_guide_session`: hypothesize about what the active part is trying to stop,
239
239
  force, prevent, or secure right now while keeping candidate mode labels provisional.
240
+ - `flashcard`: hypothesize about the cue, urge sentence, mode/belief activation, or
241
+ values pivot the card should meet, then help craft one brief message the user can
242
+ recognize in that moment.
240
243
  - `trigger_report`: hypothesize about the episode chain only after the situation,
241
244
  felt stake, meaning, action, and consequence are at least partly visible.
242
245
  - `event_type`: hypothesize about the repeated emotional or relational stake that
@@ -384,8 +387,9 @@ will preserve the structure best.
384
387
  Psyche records are psychologically meaningful, but they are still normal stored Forge
385
388
  entities for API purposes. Once the formulation is clear and the user has consented to
386
389
  save or update it, use the shared batch entity routes for `psyche_value`,
387
- `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`,
388
- `mode_guide_session`, `trigger_report`, `event_type`, and `emotion_definition`.
390
+ `behavior_pattern`, `behavior`, `belief_entry`, `mode_profile`,
391
+ `mode_guide_session`, `flashcard`, `trigger_report`, `event_type`, and
392
+ `emotion_definition`.
389
393
 
390
394
  Keep the route decision internal. With the user, keep talking about the lived moment,
391
395
  belief sentence, pattern, mode, value, report, event kind, or feeling signature.
@@ -400,7 +404,15 @@ Do not divert Psyche material into `self_observation` just because it started as
400
404
  episode. Use `trigger_report` for one emotionally meaningful incident, use
401
405
  `behavior_pattern` for a recurring functional loop, use `belief_entry` for one
402
406
  explicit sentence, and use `mode_guide_session` or `mode_profile` when a part-state is
403
- central.
407
+ central. Use `flashcard` when the user needs a small rehearsable message to retrieve
408
+ during an urge, trigger, mode activation, belief activation, or values-based pivot.
409
+
410
+ When a user says they feel an urge or asks for help not doing something, search
411
+ existing `flashcard` records before creating a new one. Use `forge_search_entities`
412
+ with `entityTypes: ["flashcard"]` and query text from the urge, tags, trigger
413
+ sentence, trigger situation, and user's own words. If a card matches, show the card's
414
+ message first, then add brief grounding, urge-surfing, cognitive defusion,
415
+ schema/mode-aware reflection, or values-based coaching around it.
404
416
 
405
417
  ## Lane chooser
406
418
 
@@ -829,6 +841,55 @@ Preferred opening question:
829
841
 
830
842
  - "What just happened, and what is this part trying to get you to do or stop doing right now?"
831
843
 
844
+ ## Flashcard
845
+
846
+ Aim: craft a small therapeutic card that can be retrieved during a specific urge,
847
+ trigger, belief activation, mode shift, or values-based pivot.
848
+
849
+ Arc:
850
+
851
+ 1. Start from the exact moment the card should help: the urge sentence, trigger cue,
852
+ mode activation, belief activation, or situation.
853
+ 2. Reflect what the card is trying to interrupt, steady, help the user tolerate, or
854
+ help the user choose.
855
+ 3. Ask for the one simple message that should be centered on the card, or offer one
856
+ concise working sentence if the user's meaning is clearer than their wording.
857
+ 4. Ask for tags, trigger sentence, and trigger situation before the title, because
858
+ retrieval matters more than the title.
859
+ 5. Ask about color, background, typography, image, layout, and visual tone only after
860
+ the message and retrieval cues are clear.
861
+ 6. If the user is in an urge right now, search existing flashcards first, show the
862
+ matching message first, then support it with brief psychotherapy-informed guidance.
863
+
864
+ Helpful follow-up lanes:
865
+
866
+ - the exact urge sentence or trigger cue
867
+ - what the card should help the user remember when the urge is strongest
868
+ - whether the card should interrupt an urge, comfort a part, challenge a belief, or
869
+ pivot toward a value
870
+ - tags and trigger wording for future retrieval
871
+ - visual tone, colors, typography, layout, or image after the message is clear
872
+
873
+ Likely linked entities:
874
+
875
+ - `behavior` when the card supports interrupting or replacing one recurring move
876
+ - `behavior_pattern` when the card belongs to a larger loop
877
+ - `belief_entry` when the card answers one activated belief sentence
878
+ - `mode_profile` when the card speaks to a recurring part-state
879
+ - `psyche_value` when the card points back to a chosen value
880
+ - `trigger_report` when the card was created from one meaningful episode
881
+
882
+ Ready to save when:
883
+
884
+ - the main `message` is clear enough to show back during the hard moment
885
+ - at least one retrieval cue is clear: tag, trigger sentence, trigger situation, or
886
+ linked Psyche record
887
+ - title and visual styling are either chosen or intentionally left for later
888
+
889
+ Preferred opening question:
890
+
891
+ - "What exact urge sentence or situation should make this card appear?"
892
+
832
893
  ## Trigger Report
833
894
 
834
895
  Aim: capture one emotionally meaningful episode clearly enough that it can teach the