basicmachines-co/basic-memory1 file

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 graph exploration.

Specification
Skill ID
basicmachines-co/basic-memory/memory-literary-analysis
Publisher
basicmachines-co
Repository
basic-memory
Installs
0
Files
1
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

basicmachines-co/basic-memory/memory-literary-analysisInstalls these files
  • SKILL.md

What this skill tells the agent

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 traversable.

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: Explore       → traverse the graph, write synthesis notes

Tools

Writing always goes through write_note and edit_note. For reading — which is most of the work in a long analysis — prefer the POSIX read verbs where they are available (enable_posix_tools for the MCP tools; the bm CLI verbs are always available):

NeedUseInstead of
A section of a long notecat <note> --section Observationsreading the whole note
A line range of the source textcat <source>.txt --lines 4200-4890pulling the whole book into context
Notes matching frontmatterfind --meta status=activereading notes to check fields
Fields across many notesfind --meta ... --fields pov,settingone read per note
Where something livesls, tree, find --name '*.md'listing everything

The two rules that matter across a 100+ chapter run:

  • Never read a note to check a field. That is what --meta predicates and --fields projection are for — one call answers what a read-per-note loop would cost.
  • Never pull a whole file into context to reach one part of it. Sections and line ranges slice the output: the full note is still fetched, then cut down before it is returned. What they save is context, not I/O — a long chapter or a full source text costs you the tokens of the relevant part, not of the whole file.

These compound. In measured runs, predicate queries replaced 28-call scans with a single call; across 138 chapters that difference is the run.

Three sharp edges to know before you write a query. The first two fail quietly — a wrong answer, exit 0, no warning — so learn them here rather than from a graph you thought you had audited:

  • `--meta` matches case-sensitively, and the stored value is always snake_case. note_type is an alias for the frontmatter type: key, compared with SQL =. write_note normalizes note_type through to_snake_case before writing, so a note authored as note_type="Chapter" is stored as type: chapter — the casing you author with is not the casing on disk. Query the snake_case form: --meta 'note_type=chapter'. The capitalized spelling returns zero rows and exit 0. The value a result row displays is the value to query with.
  • `find` pages, and the default page is 10. Any query whose answer is "all N chapters" needs --page-size 200 (the maximum) — see Coverage Checks.
  • `--name` cannot combine with `--meta`. The metadata search has no filename glob. Scope a --meta query with the positional path instead: find /characters --meta 'note_type=character'. That path is matched on a directory boundary against the file path a note is indexed under — where the note actually lives, not its permalink, which stops mirroring the file path once a note pins permalink: in frontmatter or is moved. So /characters reaches everything filed under characters/ (including characters/major/), and never characters-cut/.

If the POSIX verbs are unavailable, every step below still works with search_notes, read_note, and list_directory — it just costs more.

Phase 0: Setup

Create the Project

create_memory_project(name="<work-name>", path="~/basic-memory/<work-name>")

Use a kebab-case slug of the work's title (e.g., great-gatsby, hamlet, beloved).

Define Schemas

Write 6 schema notes to schema/. Each schema defines the entity type's fields, observation categories, and relation types. Adapt fields to fit the work — the schemas below are starting points, not rigid templates.

Character Schema
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, transformed], character status at end of work"
    },
    "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"""
)

Add work-specific fields as needed — e.g., rank for military fiction, house for family sagas, species for fantasy.

Theme Schema
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
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, reflective, epistolary, 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
write_note(
  title="Location",
  directory="schema",
  note_type="schema",
  metadata={
    "entity": "Location",
    "version": 1,
    "schema": {
      "description": "string, what this place is",
      "location_type(enum)": "[city, building, landscape, body_of_water, region, fictional, vehicle], 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

Use this skill in a project

Open any RiverX project, search the Skills panel for basicmachines-co/basic-memory/memory-literary-analysis, and install it in one click.

Use this skill