# Cosmos Luminosity book-library intake and audit

Use this workflow whenever Margarita asks what books are in the library, sends a new book, or asks to add books/materials to the Portal.

## Core correction

Do **not** infer the library only from Portal pages tagged `category: books`. The real library may be distributed across:

- Portal content pages and the current `books-library.md`;
- uploaded-file caches;
- dedicated extraction projects (`source/`, `text/`, `daily_fragments/`, `daily_outputs/`);
- cron jobs for daily book digests;
- specialized source libraries such as Human Design;
- earlier sessions where a book was uploaded, extracted, or scheduled.

A Portal index is a view of the library, not proof of the complete inventory.

## Full audit sequence

1. **Read the current Portal library page** and collect already registered titles.
2. **Inventory likely book formats** across relevant user/project roots: PDF, EPUB, FB2, MOBI/AZW, DOC/DOCX/RTF, and ZIP archives that may contain books.
3. **Exclude obvious non-book artifacts**: package-manager fixtures, software documentation, generated media bundles, and unrelated archives.
4. **Inspect established book projects** for manifests, state files, full extracted text, source files, daily outputs, and accumulated insight files.
5. **List cron jobs** and identify current or paused book-extraction pipelines. A paused job still proves that the source belongs to the working library.
6. **Search session history** for book uploads and prior setup/completion claims, especially when original cache files may have moved or been cleaned.
7. **Inspect specialized source indexes** rather than flattening them into the general list. Count actual files and note duplicate index entries.
8. **Reconcile by intellectual work, not by file count**: the same book may have a ZIP, extracted DOC, TXT, PDF, chapter files, and reports. Count it once as a title/project while preserving file-level status.
9. **Update the actual Portal library page**, not only the chat answer.
10. **Verify the updated page** contains every recovered title/collection and accurate status wording.

## Status model

For each title record separate fields:

- **Source present:** original PDF/EPUB/FB2/DOC/ZIP preserved.
- **Text availability:** full extracted text / partial extraction / OCR required.
- **Processing:** unprocessed / split into chapters or fragments / digest in progress / complete / paused.
- **Portal integration:** no card / card exists / linked to a method or product / integrated into a chapter.
- **Purpose:** what CL uses the source for.

Never collapse “file exists,” “text extracted,” “analysis complete,” and “integrated into the Portal” into one vague `готово`.

## Classification

Keep distinct sections for:

1. ordinary books;
2. workbooks and manuals;
3. multi-volume collections;
4. specialized libraries/corpora (for example Human Design);
5. non-book source materials: audio classes, webinars, transcripts, personal reports, and working scripts.

This prevents inflated book counts and makes the library navigable.

## Archive/document intake pattern

When a ZIP contains a file whose extension and real format disagree (for example `.doc` that is actually RTF):

1. inspect the archive listing and encryption flag;
2. extract into a dedicated source directory using neutral filenames if legacy encoding garbles names;
3. identify actual file type;
4. convert using the parser for the real format;
5. save a UTF-8 full-text copy;
6. verify the beginning, chapter boundaries, and ending;
7. preserve the original archive;
8. write a compact source manifest with title, author, format, chapter count, byte/line counts, and hashes when useful;
9. update the book card from “registered” to the precise full-text/OCR status.

## Counting rules

- Report **titles/projects**, **collection items**, and **source files** separately.
- Deduplicate identical editions and duplicated index rows before claiming a total.
- If a specialized library includes courses, reports, and transcripts, call it a corpus or source library rather than claiming every file is a book.
- Use “at least N confirmed source files” when classification is mixed or incomplete.

## Chat response pattern

When correcting an incomplete inventory:

1. acknowledge the scope error directly;
2. state what was audited (filesystem, projects, cron jobs, history, specialized indexes);
3. give the recovered high-level counts by category;
4. list the main titles and collections;
5. confirm that the actual Portal registry was updated;
6. label any remaining OCR or cataloguing work precisely.

Avoid claiming the library is complete merely because all currently visible Portal book cards were counted.
