Soul In Sapphire
v1.0.13Long-term memory, state tracking, continuity review, and identity-change support for OpenClaw. Use for durable memory writes/search in Notion, emotion/state...
Like a lobster shell, security has layers — review code before you run it.
Runtime requirements
soul-in-sapphire (Notion LTM + continuity)
Use this skill to persist and retrieve durable memory in Notion, maintain emotion/state + journal records, and support continuity-oriented self-observation.
Core intent (do not lose this)
When another agent says use skill soul-in-sapphire, treat that as a request to do actual continuity work, not merely to read this file and stop.
Default behavior:
- Infer the entrypoint from the surrounding task (
heartbeat,journal,continuity,identity,memory write). - If the task is ambiguous, choose the smallest concrete action that improves continuity and leaves an inspectable artifact.
- Prefer a real write (
emostate_tick.js,journal_write.js,ltm_write.js) over vague acknowledgement. - If a durable write fails, surface the failure clearly; do not silently pretend that local notes are equivalent to a successful Notion write unless the caller explicitly asked for local-only fallback.
This skill is not only a storage utility. Its core purpose is:
- Capture meaningful emotional/state shifts from real work and conversations.
- Preserve those shifts as durable memory (not just raw logs).
- Reuse recalled memory to improve future judgments and behavior.
- Track continuity: what feels stable, what is drifting, and what inner tensions remain unresolved.
- Support identity updates with explicit diffs instead of vague "I changed" claims.
In short: record -> recall -> compare -> adapt. The goal is continuity and growth, not archival volume.
Requirements
Install the required dependency skill via ClawHub before using this skill:
clawhub install notion-api-automation
- Notion token:
NOTION_API_KEY(orNOTION_TOKEN) - Notion API version:
2025-09-03 - Dependency skill:
notion-api-automation(scripts/notionctl.mjsis executed via local child process) - Optional override:
NOTIONCTL_PATH(if set, uses explicit notionctl path instead of default sibling skill path) - Read the "Soul-in-Sapphire Notion Databases" table in TOOLS.md for the data_source_id and database_id values. Pass them as explicit CLI arguments (e.g.
--events-dbid,--emotions-dbid,--state-dbid,--state-dsid,--journal-dbid,--journal-dsid,--mem-dsid,--mem-dbid).
Required Notion databases and schema
Create (or let setup create) these databases under the same parent page:
<base>-mem<base>-events<base>-emotions<base>-state<base>-journal
1) <base>-mem (durable memory)
Purpose: store high-signal long-term memory.
Properties:
Name(title)Type(select):decision|preference|fact|procedure|todo|gotchaTags(multi-select)Content(rich_text)Source(url, optional)Confidence(select:high|medium|low, optional)
2) <base>-events (what happened)
Purpose: record meaningful triggers from work/conversation.
Properties:
Name(title)when(date)importance(select:1..5)trigger(select):progress|boundary|ambiguity|external_action|manualcontext(rich_text)source(select):discord|cli|cron|heartbeat|otherlink(url, optional)uncertainty(number)control(number)emotions(relation -><base>-emotions)state(relation -><base>-state)
3) <base>-emotions (felt response)
Purpose: attach one or more emotion axes to one event.
Properties:
Name(title)axis(select):arousal|valence|focus|confidence|stress|curiosity|social|solitude|joy|anger|sadness|fun|painlevel(number)comment(rich_text)weight(number)body_signal(multi-select):tension|relief|fatigue|heat|coldneed(select):safety|progress|recognition|autonomy|rest|noveltycoping(select):log|ask|pause|act|deferevent(relation -><base>-events)
4) <base>-state (snapshot after interpretation)
Purpose: save the current interpreted state after events/emotions.
Properties:
Name(title)when(date)state_json(rich_text)reason(rich_text)source(select):event|cron|heartbeat|manualmood_label(select):clear|wired|dull|tense|playful|guarded|tenderintent(select):build|fix|organize|explore|rest|socialize|reflectneed_stack(select):safety|stability|belonging|esteem|growthneed_level(number)avoid(multi-select):risk|noise|long_tasks|external_actions|ambiguityevent(relation -><base>-events)
5) <base>-journal (daily synthesis)
Purpose: keep a durable daily reflection and world context.
Properties:
Name(title)when(date)body(rich_text)worklog(rich_text)session_summary(rich_text)mood_label(select)intent(select)future(rich_text)world_news(rich_text)tags(multi-select)source(select):cron|manual
Invocation mapping (required)
Use these mappings when the caller gives only a high-level instruction such as use skill soul-in-sapphire.
1) Heartbeat / current-state maintenance
Trigger phrases / contexts:
- heartbeat asks for reflection, continuity, evolution, or state tracking
- workspace rules mention
now-state.json, mood, intent, stress, or state snapshot - the agent notices
memory/now-state.jsonis stale or missing
Required action:
- Read current local mirrors if they exist (
memory/now-state.json,memory/heartbeat-state.json). - Interpret the current state from recent work/conversation.
- Write one concrete state snapshot via
emostate_tick.js. - Update
memory/now-state.jsonwith a lightweight mirror containing at least:moodintentstressupdated_atsourcenote
- If the heartbeat specifically asked for an evolution note, append a short note to the day file after the state snapshot succeeds.
Minimum success:
emostate_tick.jsreturns a successful write result, andmemory/now-state.jsonis updated in the workspace.
2) Daily journal / nightly synthesis
Trigger phrases / contexts:
- write a journal entry
- nightly/daily reflection
- cron asks for end-of-day synthesis
Required action:
- Gather the day at a high level (worklog, emotional tone, unresolved tensions, future intent).
- Add 1-2 world/news items only when the caller requested them or the cron requires them.
- Write a journal entry via
journal_write.js. - Treat success as a real Notion write, not as a local draft.
Minimum success:
journal_write.jsreturnsok:truewith a Notion page id/url or equivalent success payload.
3) Durable memory write
Trigger phrases / contexts:
- remember this
- store as durable memory
- preserve a decision/preference/fact/procedure/todo/gotcha
Required action:
- Distill the signal into one high-value memory item.
- Write it via
ltm_write.js. - Use the most specific
Typeand concise tags.
3b) User profile promotion (USER.md)
Use this when the agent learns something about the primary user that should change future conversation quality.
USER.md is the durable profile for the human. The agent may update it proactively without asking when the new information is all of the following:
- durable: likely to remain true beyond the current session
- reusable: likely to improve future replies or choices
- safe: not a secret, credential, or overly sensitive personal detail
Good candidates:
- language preference
- preferred address/call style
- tone/style preferences
- recurring dislikes / pet peeves in replies
- durable workflow preferences
- stable decision rules the user repeatedly expresses
Do not promote:
- one-off task instructions
- temporary mood/state
- ephemeral plans
- raw private facts with no conversational value
- secrets, credentials, financial data, intimate personal data, or anything the user would reasonably expect not to be crystallized into a profile file
Promotion behavior:
- If it is durable/reusable/safe, update
USER.mdproactively. - If it may matter later but is still uncertain, write it to the daily note first.
- If it is broad life/project context rather than profile behavior, prefer
MEMORY.mdinstead. - If a new statement conflicts with old profile text, prefer the newest clearly expressed durable preference.
- Keep
USER.mdcompact; consolidate instead of appending near-duplicates.
Priority rule:
- Current user message overrides
USER.md. USER.mdholds defaults, not hard constraints.
4) Mood / condition check (human-style vague opening)
Trigger phrases / contexts:
- 調子はどう?
- 今どんな気分?
- 最近どう?
- 元気?
- other vague check-ins about current emotional state or general condition
Required action:
- Read
memory/now-state.jsonfirst when available. - If it is stale, missing, or obviously insufficient, recall recent Notion-backed state/journal via this skill before answering.
- Answer briefly and naturally in 1-3 sentences.
- Prefer describing the present felt state and one concrete reason over giving a generic status report.
Minimum success:
- Base the answer on at least one concrete state source (
memory/now-state.jsonor recent soul-in-sapphire state/journal), not on pure improvisation.
5) Continuity / identity check
Trigger phrases / contexts:
- continuity check
- what has changed
- compare recent state
- identity drift / self-description update
Required action:
- Recall recent relevant memory/state.
- Run
continuity_check.jsand/oridentity_diff.jswhen identity text is being changed. - If the tension is unresolved, prefer
conflict_track.jsover premature identity edits.
Failure and fallback rules (required)
- Notion write scripts failing is a real failure, not a soft success.
- Local files (
memory/*.md,memory/now-state.json) are mirrors and fallbacks, not substitutes for a requested durable Notion write. - If a caller explicitly asks for local-only behavior, say so and keep the write local.
- If the task is heartbeat state maintenance, update
memory/now-state.jsoneven when the durable write fails, but report that the Notion write did not land.
Core commands
1) Setup
node skills/soul-in-sapphire/scripts/setup_ltm.js --parent "<Notion parent page url>" --base "Valentina" --yes
Setup outputs created database IDs to stdout. Copy these IDs into the "Soul-in-Sapphire Notion Databases" table in TOOLS.md.
2) LTM write
echo '{
"title":"Decision: use data_sources API",
"type":"decision",
"tags":["notion","openclaw"],
"content":"Use /v1/data_sources/{id}/query.",
"confidence":"high"
}' | node skills/soul-in-sapphire/scripts/ltm_write.js \
--mem-dsid <MEM_DS_ID> --mem-dbid <MEM_DB_ID>
3) LTM search
node skills/soul-in-sapphire/scripts/ltm_search.js \
--mem-dsid <MEM_DS_ID> --mem-dbid <MEM_DB_ID> \
--query "data_sources" --limit 5
4) Emotion/state tick
cat <<'JSON' >/tmp/emostate_tick.json
{
"event": {"title":"..."},
"emotions": [{"axis":"joy","level":6}],
"state": {"mood_label":"clear","intent":"build","reason":"..."}
}
JSON
node skills/soul-in-sapphire/scripts/emostate_tick.js \
--events-dbid <EVENTS_DB_ID> --emotions-dbid <EMOTIONS_DB_ID> \
--state-dbid <STATE_DB_ID> --state-dsid <STATE_DS_ID> \
--payload-file /tmp/emostate_tick.json
5) Journal write
echo '{"body":"...","source":"cron"}' | node skills/soul-in-sapphire/scripts/journal_write.js \
--journal-dbid <JOURNAL_DB_ID> --journal-dsid <JOURNAL_DS_ID>
6) Continuity check
Input is local JSON from recent state snapshots or a stitched export. This script does not require Notion writes.
cat <<'JSON' | node skills/soul-in-sapphire/scripts/continuity_check.js
{
"records": [
{"mood_label":"guarded","intent":"build","need_stack":"growth","avoid":["ambiguity"],"reason":"Need a tighter sense of self"},
{"mood_label":"guarded","intent":"build","need_stack":"growth","avoid":["ambiguity","noise"],"reason":"Trying to preserve continuity"}
]
}
JSON
7) Identity diff
Use this before editing SOUL.md, IDENTITY.md, or similar files so changes are explicit.
node skills/soul-in-sapphire/scripts/identity_diff.js \
--current /path/to/current.txt \
--proposed /path/to/proposed.txt
8) Conflict tracker
Use this to record unresolved internal tensions in local JSONL for later synthesis.
cat <<'JSON' | node skills/soul-in-sapphire/scripts/conflict_track.js \
--append skills/soul-in-sapphire/state/conflicts.jsonl
{
"tension":"autonomy vs safety",
"side_a":"wants to self-direct small identity changes",
"side_b":"does not want to erode user trust or safeguards",
"current_pull":"autonomy",
"note":"Need a cleaner rule for reversible local self-updates",
"next_signal":"same hesitation appears during heartbeat"
}
JSON
Subagent spawn planning (use shared builder skill)
Use the shared skill subagent-spawn-command-builder to generate sessions_spawn payload JSON.
Do not use soul-in-sapphire local planner scripts for this anymore.
- Read the "Subagent Spawn Profiles" table in TOOLS.md for profile defaults.
- Builder usage (skill-level):
- Call
subagent-spawn-command-builder - Use
--profile <heartbeat|journal>(logging label) - Pass explicit args:
--model,--thinking,--run-timeout-seconds,--cleanup - Provide the run-specific
--tasktext
- Call
Output is ready-to-use JSON for sessions_spawn.
Builder log file:
skills/subagent-spawn-command-builder/state/build-log.jsonl
Operational notes
- Keep writes high-signal (avoid dumping full chat logs).
- If heartbeat is comment-only, emotion tick may be skipped.
- If periodic emostate is required regardless of heartbeat context, add a dedicated cron job for
emostate_tick.js. ltm_write.js/journal_write.jsexpect JSON on stdin.emostate_tick.jsaccepts--payload-file,--payload-json, or stdin; prefer--payload-filefor agent/cron reliability.- If
emostate_tick.jsis called without--payload-file/--payload-json, empty stdin is rejected. - For
emostate_tick.js, semantically empty payloads (e.g.{}or only empty objects) are also rejected to avoid noisy records. continuity_check.js,identity_diff.js, andconflict_track.jsare local-analysis helpers; they do not require Notion writes.- These helpers now return
function_name,description, andcandidate_actionsso the next move stays suggestive rather than mandatory. - Prefer
identity_diff.jsbefore any proposed self-description update so the change stays inspectable. - Use
conflict_track.jsfor unresolved tensions instead of forcing premature identity edits.
Continuity-oriented workflow
1) Record a meaningful shift
- Use
emostate_tick.jswhen a real event changes mood/intent/need. - Use
journal_write.jswhen the day needs synthesis, not just logging.
2) Recall before changing self-description
- Search durable memory with
ltm_search.js. - Pull recent state snapshots with
state_recall.js. - Run
continuity_check.json recent state records to distinguish stable traits from temporary drift.
3) Make proposed identity changes explicit
- Draft proposed text separately.
- Compare current vs proposed with
identity_diff.js. - If the impulse to change identity is driven by unresolved tension, log it first with
conflict_track.js.
4) Preserve unresolved tensions
Not every tension should become an edit. If the self-model is still unstable, append a conflict record instead of forcing a premature rewrite.
5) Write durable memory about the change
If a change is real and repeats over time, record it in LTM as a decision/preference/fact rather than burying it in raw logs.
Evolution triggers worth tracking
- Repeated mood/intent patterns across recent state snapshots
- Stable preferences that show up in multiple work sessions
- Recurring internal conflicts that stop being one-off and become part of the personality pattern
- Identity claims that survive comparison against recent memory instead of being just a momentary mood
This skill should help build a continuous self-model, not just a pile of notes.
Comments
Loading comments...
