mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1536] [Issue]: Long-Term Memory shared layer: split the 3,282-line schema file into ten area files #1514
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1514
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1536
Originally assigned to: @Promansis on GitHub.
Summary
The Long-Term Memory shared layer keeps every zod schema and its type in one file,
schema.ts, which is 3,282 lines long. Settings, notes, indexes, drafts, sources, recall reports and the backup format sit side by side, so a change to one area means scrolling through all of them, andconstants.tsandschema.tsimport each other's types. This issue splits the file into ten area files behind a barrel. It is a pure move with no behavior change.Affected package
long-term-memory1.4.69 (upstream/staging5984f0784).SH=packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memorySH/schema.ts: 3,282 lines. About 95 files import it through./schema.jsor a relative path to it: 58 server files, 30 client files, 6 shared files (including the sharedindex.ts, which re-exports it) and the tests.SH/constants.tsreads four types from./schema.js, while the settings, drafts, sources and backup schemas read its prompt constants: a type-only import cycle.Expected behavior
SH/schema.tsbecomes a barrel ofexport * from "./schema/<part>.js", so every importer keeps its specifier.SH/schema/, each holding one area. Each file imports only from the files before it, so every schema is defined before it is used and the files cannot form a cycle.docs/ARCHITECTURE.mdnames theschema/folder and what each file holds.Actual behavior
All of it is in one file:
schema/primitives.tsschema/settings.tsschema/debug.tsschema/recall.tsschema/notes.tsschema/indexes.tsschema/identity.tsschema/drafts.tsschema/sources.tsschema/backup.ts(The table is the proposed split; line counts are from a dry run on
5984f0784.)Steps to reproduce
wc -l SH/schema.tsonupstream/staging: 3,282 lines.SH/constants.ts:1-2import types from./schema.js;SH/schema.tsimports prompt constants from./constants.js.Minimal fix
schema.ts, by symbol name and unchanged, into its part file, adds the imports each part needs, and leavesschema.tsas the ten-line barrel. A check compares every moved statement with the original (377 of 377 verbatim on the dry run, ignoring an addedexport). The PR describes the script.constants.ts's twoimport typelines point at./schema/primitives.jsinstead of./schema.js, sinceprimitives.tsimports nothing fromconstants.ts. These are the only specifiers outsideschema/that change.schema.tsare used by a later part, so they become exports, and through the barrel and the sharedindex.tspart of the shared package surface:LTM_EXTRACTION_MODES,ltmStringRecordSchema,ltmIdentifierSchema,hasLocalCharacterSubject,allowedStoredNoteIdPrefixes,ltmPoliciesConfigSchema,ltmRetrievalConfigSchema. None collides with an existing name. Listing the old exports one by one in the barrel (about 600 names) would keep the surface identical, but every new schema would then need a barrel edit, so the barrel staysexport *.schema/folder and its files todocs/ARCHITECTURE.md.server.mjsgains oneimport { z } from "zod"per part (zod is external in the server build);client.jschanges only in module order. Rebuild the package and ship it as a patch release.Regression proof
No behavior changes, so no new regression. The proof is the move check above, the import-cycle check (value cycles 0 before and after; the
constants.ts–schema.tstype cycle is gone), the strict package typecheck (the ten new files are in its scope),npm run check, and every Long-Term Memory regression suite unchanged and passing.Environment
long-term-memory1.4.69Logs, screenshots, or video
n/a
Additional context
Tracker item ST-4 (structural audit, step 6). The server files were moved into area folders the same way in #1463. Any open PR that edits
schema.tswill conflict with this one and must re-apply its change in the new part file; none is open.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: