Documentation Index
Fetch the complete documentation index at: https://mintlify.com/XxYouDeaDPunKxX/Memory-Assisted-Shaping/llms.txt
Use this file to discover all available pages before exploring further.
notes.py is the Python persistence helper for Memory-Assisted Shaping. It owns the append-only session log — GPT writes signals to it but never reads or rewrites the log during active shaping. Run all commands with python3 -S (no site packages). The tool is stdlib-only.
Always run with
python3 -S (no site packages). The tool uses only Python standard library modules: argparse, hashlib, json, os, uuid, datetime, pathlib.Global flag
--dir <path>
Optional. Override the base directory for session files. Defaults to the directory containing notes.py. All session files (session_meta.json, session_notes.jsonl, session_export.json) are created in this directory.
Commands
init
Creates session_meta.json and initializes the empty session_notes.jsonl log. Safe to run multiple times — if session_meta.json already exists with a valid session_id, it is not overwritten.
Usage
append
Appends a memory signal to the session log. Requires --type and --text. Optionally includes --effect.
Signal type. Must be one of:
artifact, decision, discard, gate, mode, shape, source, tension.The signal content. Must be a non-empty string.
Downstream shaping or synthesis effect. Use only when the effect changes later shaping or synthesis.
--effect:
append call:
| Field | Description |
|---|---|
id | Format: n{seq:05d} (e.g. n00001) |
ts | UTC ISO 8601 timestamp |
session_id | UUID from session_meta.json |
seq | Sequence number (position in log) |
checksum | First 16 hex characters of the SHA-256 digest of the record |
tail
Returns the most recent N records from the session log. Use for reviewing recent context during re-entry or before synthesis.
Number of recent records to return. Must be
>= 1.summary
Returns counts of records by type, total count, and the last signal. Useful for a quick session overview without reading the full log.
Usage
export
Exports the full session to a JSON file. Default output: session_export.json in the session directory.
Custom output file path. Defaults to
session_export.json in the session directory.Error handling
notes.py always returns JSON. On error, ok is false and error contains the message.
| Exit code | Meaning |
|---|---|
0 | Success |
1 | Unexpected error |
2 | Usage or validation error |
Session files
notes.py creates and uses three files in the session directory:
| File | Description |
|---|---|
session_meta.json | Session metadata. Written once at init. Contains schema_version, session_id (UUID), created_at, and log_file path. |
session_notes.jsonl | The append-only log. One JSON record per line. Never rewritten by notes.py. |
session_export.json | Produced by the export command. A complete snapshot including all records. |