Skip to main content

memory-literary-analysis

Analyze a complete literary work into a structured Basic Memory knowledge graph. Covers schema design, entity seeding, chapter-by-chapter processing, cross-referencing, validation, and visualization.

Source facts

Repository
basicmachines-co/moby-dick
Last source activity
March 8, 2026 at 21:23
Detected SKILL.md language
English
Stars
1
Forks
1

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
memory-literary-analysis
description
Analyze a complete literary work into a structured Basic Memory knowledge graph. Covers schema design, entity seeding, chapter-by-chapter processing, cross-referencing, validation, and visualization.
permalink
moby-dick/skills/memory-literary-analysis/skill
# Memory Literary Analysis Transform a complete literary work into a structured knowledge graph. Characters, themes, chapters, locations, symbols, and literary devices become interconnected notes — searchable, validatable, and visualizable. ## When to Use - Analyzing a novel, play, poem, or non-fiction book end-to-end - Building a teaching or study resource for a literary text - Creating a book club companion knowledge base - Research projects requiring structured close reading - Stress-testing Basic Memory at scale (~200+ notes, 1000+ relations) ## Pipeline Overview ``` Phase 0: Setup → project, schemas, directory structure Phase 1: Seed → stub notes for known major entities Phase 2: Process → chapter-by-chapter notes in batches Phase 3: Cross-ref → enrich arcs, add parallels, write analysis Phase 4: Validate → schema checks, drift detection, consistency Phase 5: Visualize → canvas files for character webs, timelines ``` ## Phase 0: Setup ### Create the Project ```python create_memory_project(name="moby-dick", path="~/basic-memory/moby-dick") ``` ### Define Schemas Write 6 schema notes to `schema/`. Each schema defines the entity type's fields, observation categories, and relation types. #### Character Schema ```python write_note( title="Character", directory="schema", note_type="schema", metadata={ "entity": "Character", "version": 1, "schema": { "role(enum)": "[protagonist, antagonist, supporting, minor], character's narrative role", "description": "string, brief character description", "first_appearance?": "string, chapter or scene of first appearance", "status?(enum)": "[alive, dead, unknown], character status at end of work", "rank?": "string, formal rank or title", "crew_role?": "string, role aboard ship or in group" }, "settings": {"validation": "warn"} }, content="""# Character Schema for character entity notes. ## Observations - [convention] Major characters in characters/major/, minor in characters/minor/ - [convention] Observation categories: trait, motivation, arc, quote, appearance, relationship, symbolism, fate - [convention] Relations: appears_in, contrasts_with, allied_with, commands, symbolizes, associated_with""" ) ``` #### Theme Schema ```python write_note( title="Theme", directory="schema", note_type="schema", metadata={ "entity": "Theme", "version": 1, "schema": { "description": "string, what this theme explores", "prevalence(enum)": "[major, minor], how central to the work", "first_introduced?": "string, where theme first appears" }, "settings": {"validation": "warn"} }, content="""# Theme Schema for thematic analysis notes. ## Observations - [convention] Observation categories: definition, manifestation, evolution, counterpoint, quote, interpretation - [convention] Relations: embodied_by, contrasts_with, reinforced_by, explored_in, expressed_through""" ) ``` #### Chapter Schema ```python write_note( title="Chapter", directory="schema", note_type="schema", metadata={ "entity": "Chapter", "version": 1, "schema": { "chapter_number": "integer, sequential chapter number", "pov?": "string, point-of-view character or narrator mode", "setting?": "string, primary location", "narrative_mode?(enum)": "[dramatic, expository, soliloquy, cetological, mixed], chapter's primary mode" }, "settings": {"validation": "warn"} }, content="""# Chapter Schema for chapter-level analysis notes. ## Observations - [convention] Chapters stored in chapters/ directory - [convention] Observation categories: summary, event, tone, technique, quote, significance, foreshadowing - [convention] Relations: features, set_in, explores, contains, employs, follows, precedes, parallels""" ) ``` #### Location Schema ```python write_note( title="Location", directory="schema", note_type="schema", metadata={ "entity": "Location", "version": 1, "schema": { "description": "string, what this place is", "location_type(enum)": "[ship, town, building, body_of_water, region, fictional], type of place", "real_or_fictional(enum)": "[real, fictional, both], whether the place exists" }, "settings": {"validation": "warn"} }, content="""# Location Schema for location and setting notes. ## Observations - [convention] Observation categories: description, atmosphere, symbolism, significance, geography - [convention] Relations: setting_for, associated_with, symbolizes, contains, part_of""" ) ``` #### Symbol Schema ```python write_note( title="Symbol", directory="schema", note_type="schema", metadata={ "entity": "Symbol", "version": 1, "schema": { "description": "string, what the symbol is literally", "symbol_type(enum)": "[object, animal, color, action, natural_phenomenon], category of symbol", "primary_meaning": "string, most common interpretation" }, "settings": {"validation": "warn"} }, content="""# Symbol Schema for symbolic element notes. ## Observations - [convention] Observation categories: meaning, appearance, ambiguity, interpretation, quote, evolution - [convention] Relations: represents, associated_with, appears_in, contrasts_with, located_at""" ) ``` #### LiteraryDevice Schema ```python write_note( title="LiteraryDevice", directory="schema", note_type="schema", metadata={ "entity": "LiteraryDevice", "version": 1, "schema": { "description": "string, what the device is", "device_type(enum)": "[rhetorical, structural, figurative, narrative, dramatic], category", "frequency(enum)": "[pervasive, frequent, occasional, rare], how often used" }, "settings": {"validation": "warn"} }, content="""# LiteraryDevice Schema for literary technique and device notes. ## Observations - [convention] Observation categories: definition, usage, effect, example, significance - [convention] Relations: used_in, characterizes, expresses, related_to""" ) ``` ### Directory Structure ``` <project>/ schema/ # 6 schema definitions chapters/ # one note per chapter + epilogue characters/ major/ # protagonist, antagonist, key supporting minor/ # named characters with limited roles themes/ # thematic analysis notes locations/ # settings and places symbols/ # symbolic elements literary-devices/ # techniques and devices analysis/ # cross-cutting synthesis tasks/ # processing tracker ``` ## Phase 1: Seed Entities Before processing chapters, create stub notes for major entities so `[[wiki-links]]` resolve from the start. ### Characters (major) For each major character, create a stub with known metadata: ```python write_note( title="Captain Ahab", directory="characters/major", note_type="Character", tags=["character", "major", "protagonist"], metadata={"role": "protagonist", "description": "Captain of the Pequod, monomaniacally obsessed with the White Whale"}, content="""# Captain Ahab ## Observations - [role] Captain of the Pequod, protagonist and tragic figure - [appearance] Scarred, one-legged, with a whalebone prosthetic ## Relations - commands [[The Pequod]] - hunts [[Moby Dick (White Whale)]] - contrasts_with [[Starbuck]]""" ) ``` ### Seed Checklist | Type | Count | Examples | |------|-------|---------| | Characters (major) | ~15 | Ishmael, Ahab, Queequeg, Starbuck, Stubb, Flask, Tashtego, Daggoo, Pip, Fedallah, Father Mapple, Bildad, Peleg, Elijah, Moby Dick | | Themes | ~10 | Obsession, Nature/Sublime, Fate/Free Will, Race/Class, Knowledge/Limits, Religion/Mythology, Revenge, Isolation, The Unknowable, Masculinity | | Locations | ~6-8 | The Pequod, Nantucket, New Bedford, Spouter-Inn, The Chapel, Pacific Ocean | | Symbols | ~6-8 | The White Whale, The Doubloon, The Coffin/Life-Buoy, Whiteness, The Try-Works, Queequeg's Tattoos | Stubs don't need to be complete — they give `[[wiki-link]]` targets and will be enriched during chapter processing. ## Phase 2: Chapter Processing ### Source Text Preparation Download the full text and split by chapter headings. Chapters in Moby Dick are marked with `CHAPTER N.` or `ETYMOLOGY` / `EXTRACTS` / `Epilogue`. ### Batching Strategy Process ~10 chapters per batch to balance depth with progress: | Batch | Chapters | Narrative Focus | |-------|----------|----------------| | 1 | 1-9 | Shore: New Bedford, Spouter-Inn, Chapel, Sermon | | 2 | 10-23 | Queequeg friendship, Nantucket, boarding the Pequod | | 3 | 24-35 | Early voyage, cetology digressions begin | | 4 | 36-42 | Quarter-Deck oath, Sunset/Dusk soliloquies, Whiteness | | 5-13 | 43-130 | Voyage: whale encounters, gams, Pip's madness, cetology | | 14 | 131-Epilogue | The three-day Chase, destruction, survival | ### Per-Chapter Workflow For each chapter: **1. Create the chapter note:** ```python write_note( title="Chapter 36 - The Quarter-Deck", directory="chapters", note_type="Chapter", tags=["chapter", "pivotal", "dramatic"], metadata={ "chapter_number": 36, "pov": "Ishmael (dramatic mode)", "setting": "The Pequod, quarter-deck", "narrative_mode": "dramatic" }, content="""# Chapter 36 - The Quarter-Deck ## Observations - [summary] Ahab reveals his true purpose: hunting Moby Dick. Nails a gold doubloon to the mast as reward. - [event] Ahab administers the oath — crew drinks to the death of Moby Dick - [event] Starbuck protests but is overridden by Ahab's charisma and the crew's frenzy - [tone] Theatrical, ritualistic, escalating from inquiry to frenzy - [technique] Written almost entirely as stage directions and dialogue — a play within the novel - [quote] "He tasks me; he heaps me; I see in him outrageous strength, with an inscrutable malice sinewing it." - [significance] The pivotal scene that transforms a commercial voyage into a revenge quest - [foreshadowing] The oath-taking ceremony echoes dark pacts and dooms the enterprise ## Relations - features [[Captain Ahab]] - features [[Starbuck]] - features [[Stubb]] - features [[Flask]] - set_in [[The Pequod]] - explores [[Obsession]] - explores [[Fate and Free Will]] - contains [[The Doubloon]] - employs [[Dramatic Monologue]] - follows [[Chapter 35 - The Mast-Head]] - precedes [[Chapter 37 - Sunset]]""" ) ``` **2. Enrich related entities:** ```python edit_note( identifier="characters/major/captain-ahab", operation="append", heading="Observations", content="""- [arc] Ch.36: Reveals obsession publicly, nails doubloon, administers blood oath - [quote] "He tasks me; he heaps me; I see in him outrageous strength" (Ch.36)""" ) ``` **3. Track progress** using the memory-tasks skill to create a processing task that survives context compaction. ### What to Capture Per Chapter | Category | What to Look For | |----------|-----------------| | `[summary]` | 1-2 sentence chapter synopsis | | `[event]` | Key plot events (actions, revelations, arrivals) | | `[tone]` | Emotional and stylistic atmosphere | | `[technique]` | Narrative innovations (soliloquy, stage direction, catalog) | | `[quote]` | Memorable or thematically significant passages | | `[significance]` | Why this chapter matters to the whole | | `[foreshadowing]` | Hints at future events | ### Entity Enrichment Per Chapter As each chapter is processed, append observations to relevant entities: - **Characters**: `[arc]` moments, new `[trait]` revelations, `[quote]` attributions - **Themes**: `[manifestation]` in this chapter, `[evolution]` shifts - **Symbols**: `[appearance]` with context, new `[interpretation]` angles
View on GitHub
This SKILL.md is very large, so SkillsMP previews the first section here. View on GitHub