Install
openclaw skills install @nohn3043-arch/story-engine-for-creatorDeterministic plot architecture tool with built-in Second Perspective causal reasoning, logic vulnerability detection, automatic worldbuilding generation, narrative presentation layer audit, foreshadowing ledger, spacetime consistency check, hash-chained audit reports, and incremental diff-only audit.
openclaw skills install @nohn3043-arch/story-engine-for-creatorA professional plot creation tool based on deterministic causal reasoning, providing full-process logic verification and generation support for epic novels, game scripts, and film & television screenplays from outline to final draft.
Automatically trigger when the user asks about the following content:
unrecovered_topics and all_closedaudit_text gating: an unclosed foreshadow fails the auditaudit_hash / audit_prev_hash), making reports tamper-evidentaudit_text(..., diff_only=True) audits only the passed-in text and skips global state recomputation — short path for real-time single-chapter/fragment gatekeeping# Initialize engine
from scripts.story_engine import UltimateCausalNovelEngine, GlobalState
state = GlobalState()
engine = UltimateCausalNovelEngine("Your Novel Title", state)
# Load worldview setting
engine.conceive_world("Worldview outline text")
# Create chapter from natural language outline
chapter = engine.create_chapter_from_outline(1, "Chapter Title", "Natural language outline text")
# Perform logic audit
audit_result = engine.audit_text("Chapter content", "consistency")
print(audit_result)
# Generate chapter content
content = engine.render_chapter(chapter)
# v2.3: attach a real LLM (any OpenAI-compatible API, zero external deps)
from scripts.story_engine import OpenAIProvider
engine.set_llm_provider(OpenAIProvider(api_key="sk-...", model="gpt-4o",
base_url="https://api.openai.com/v1"))
# v2.3: single-chapter real-time gatekeeping (skips global recomputation)
quick = engine.audit_text("Chapter content", diff_only=True)
# v2.3: foreshadow + spacetime + hash-chain fields
print(quick["foreshadow"]["ledger"]["unrecovered_topics"], quick["spacetime"],
quick["audit_hash"])
audit_text return shape (v2.3): presentation / causal / logical / foreshadow / spacetime /
audit_hash / audit_prev_hash / all_passed. all_passed is a five-way AND:
presentation + causal + logical + foreshadow closed + spacetime.
Stricter than v2.1.0 — text that passed before may now fail on unclosed foreshadowing or spacetime conflicts.
Shares the same character_id with the AI Drawing Composition Template: Visual identity (drawing template) → behavioral identity (this engine) → emotional state (anthropomorphic engine), three sources one truth. Runs continuity checklist per chapter (immutable facts retained verbatim, temperament-consistent behavior, prop continuity, emotional arc, line style). See references/CharacterToNarrativeLink.md.
Worldviews are managed like code: Three layers (core_rules (immutable) / derived_rules (evolvable) / canon (narrative facts)) + semantic versioning (major = core rule change / minor = derived rule change / patch = canon addition). Generates diff per chapter, rejects rule violations or requires explicit version upgrade. See references/WorldviewVersioning.md.
Three-level checkpoints (chapter gate / arc gate / volume gate) + rolling summary window + foreshadowing ledger (promise → fulfillment tracking, alert if >10 chapters unfulfilled). Chapter 20 will never betray Chapter 1. See references/LongNarrativeWindow.md.
Status: as of v2.3 only the foreshadowing ledger part is implemented in the engine (ForeshadowLedger SET/PAY reconciliation); the three-level checkpoints, rolling summary window, and the >10-chapter threshold alert remain design-level documents with no code behind them.
Vulnerability detection directly reuses the five-operator chain from the NOMOS Decision Hub for plot causal audit — the same deterministic engine, migrated from the decision domain to the narrative domain.
UltimateCausalNovelEngine(novel_title, initial_global_state, output_language="zh")recognize_style(), audit_text(), simulate_chapter(), repair_presentation_issues()OpenAIProvider — zero-dependency urllib client for any OpenAI-compatible API; error responses degrade to [LLM Error] … instead of raisingForeshadowLedger.scan_nodes() / reconcile() — SET/PAY keyword reconciliation with an unrecovered_topics list. Note: the >10-chapter unfulfilled alert promised in v2.0 is still not implemented (no chapter-distance threshold in code); the ledger reports unclosed topics unconditionallyaudit_spacetime_consistency(nodes); CausalNode gains time / place / foreshadow / foreshadow_topic_hash_block() + engine._stamp_audit_hash(); engine keeps audit_chain_prefix (genesis "GENESIS")audit_text(..., diff_only=True) + _build_audit_report()UltimateCausalNovelEngine gains foreshadow_ledger and audit_chain_prefixaudit_textreferences/CharacterToNarrativeLink.md (P0 character-narrative interlink)references/WorldviewVersioning.md (P0 worldview versioning)references/LongNarrativeWindow.md (P1 long narrative window management)scripts/ (Engine core)OpenAIProvider; the default path (MockLLM / no provider) stays fully offlineOnly allowed for personal non-commercial research use. Commercial use requires written authorization.