Reads the project's model/migration files (configured in stack.yml → schema.source) and regenerates .claude/memory/schema.md with a compact, token-efficient representation.
Synchronizes .claude/memory/schema.md with the actual data model files.
Read .claude/stack.yml → schema section
schema.source not defined → ❌ Error: No schema.source configured in stack.yml. Add schema.source and schema.paths.schema.paths not defined → ❌ Error: No schema.paths configured in stack.yml.Read all files matching schema.paths globs
Extract entities, columns, types, relationships, constraints, and indexes from the source files
schema.source type:
models → parse ORM model definitions (Prisma, Django, SQLAlchemy, Sequelize, TypeORM, etc.)migrations → parse migration files in chronological order, apply changes sequentiallysql → parse SQL DDL statements (CREATE TABLE, ALTER TABLE)manual → read the files as-is (user maintains them in compact format)Generate compact YAML-like representation:
table_name:
pk: column (type)
cols: [col1 (type, constraint), col2 (type, fk: other_table)]
timestamps: true|false
indexes: [col1, col2]
Rules:
timestamps: false (only show when true)indexes if noneuuid, text, int, decimal, bool, json, datetimeunique, nullable, fk: table, enum: val1|val2|val3Write to .claude/memory/schema.md:
Last synced: timestamp## Tables section content## Notes section the user may have addedOutput: ✅ Done: schema.md synced — N tables from {schema.source}
This is the verification step injected at pipeline start:
.claude/stack.yml → schema section
.claude/memory/schema.md → extract Last synced: dateschema.paths has been modified after the sync date:
find {schema.paths} -newer .claude/memory/schema.md -type f
schema.md doesn't exist → run full sync