Library File Structure Map
LIBRARY FILE STRUCTURE MAP
Section titled โLIBRARY FILE STRUCTURE MAPโVersion: 1.0 Date: 18 December 2025 Author: Francesco Pelosio Purpose: Human-readable guide to library folder structure
๐ OVERVIEW
Section titled โ๐ OVERVIEWโThe Library is BlackTrailsโ knowledge base system. It stores all documentation as Markdown files with YAML frontmatter, which are then synced to the database (library.documents) for RAG (Retrieval Augmented Generation) semantic search.
Key Concepts:
Section titled โKey Concepts:โ- Files = Source of Truth: All docs live as
.mdfiles in/library/ - Sync Script:
npm run sync-librarypushes files โ database - Public vs Private: Public docs sync to DB and are API-accessible; Private docs stay local-only
- i18n Support: Folder structure separates languages (
/it/,/en/) - Categories: Documents organized by domain (filosofia, progetti, algoritmi, legal, strategie, finanza)
๐ COMPLETE FILE STRUCTURE
Section titled โ๐ COMPLETE FILE STRUCTUREโE:\BLACKTRAILS-PLATFORM\library\โโโโ README.md # Library documentation (system guide)โโโโ public/ # Public documents (synced to DB, API-accessible)โ โโ โโโ it/ # Italian documentsโ โ โโโ filosofia/ # Philosophy & Visionโ โ โ โโโ rhama.md # Birth of Rhama (poetry concept)โ โ โ โโโ rhama-paradigm.md # Rhama Paradigm (technical philosophy)โ โ โ โโโ manifesto.md # BlackTrails Manifestoโ โ โโ โ โโโ progetti/ # Projects & Case Studiesโ โ โ โโโ (empty - future content)โ โ โโ โ โโโ algoritmi/ # Algorithms & Technical Docsโ โ โ โโโ (empty - future IN-1 algorithm doc)โ โ โโ โ โโโ legal/ # Legal Documentsโ โ โโโ (empty - future ToS, Privacy, Cookie Policy)โ โโ โโโ en/ # English documentsโ โโโ philosophy/ # Philosophy & Vision (English)โ โ โโโ rhama.md # Birth of Rhama (EN translation)โ โ โโโ rhama-paradigm.md # Rhama Paradigm (EN translation)โ โโ โโโ projects/ # Projects & Case Studies (English)โ โ โโโ (empty - future content)โ โโ โโโ algorithms/ # Algorithms & Technical Docs (English)โ โ โโโ (empty - future content)โ โโ โโโ legal/ # Legal Documents (English)โ โโโ (empty - future content)โโโโ private/ # Private documents (NOT synced, local-only) โโโ strategie/ # Business Strategies (internal) โ โโโ (internal strategic docs) โ โโโ finanza/ # Financial Documents (internal) โโโ (budgets, invoices, financial planning)๐ CATEGORY EXPLANATIONS
Section titled โ๐ CATEGORY EXPLANATIONSโ1. filosofia / philosophy ๐ฒ
Section titled โ1. filosofia / philosophy ๐ฒโWhat it contains: Core vision, philosophy, and cultural documents
Current Files:
rhama.md- Personal story about the birth of Rhama (poetry concept for IN-1)rhama-paradigm.md- Technical philosophy behind Rhama (how AI poetry works)manifesto.md- BlackTrails company manifesto (vision, principles, products)
Purpose:
- Explains why BlackTrails exists
- Defines our approach to AI (amplification, not replacement)
- Documents the emotional/cultural foundation of products like IN-1
Who reads it:
- Team members (onboarding)
- Potential partners/investors
- Public users curious about our philosophy
2. progetti / projects ๐ฆ
Section titled โ2. progetti / projects ๐ฆโWhat it contains: Case studies, completed projects, client work documentation
Current Files: (empty - future content)
Planned Content:
- IN-1 launch case study
- Elements booking system implementation
- Client project retrospectives
- Technical deep-dives on specific features
Purpose:
- Showcase real-world implementations
- Document lessons learned
- Serve as portfolio/credibility
Who reads it:
- Potential clients
- Team for reference
- Public developers learning from our approach
3. algoritmi / algorithms ๐งฎ
Section titled โ3. algoritmi / algorithms ๐งฎโWhat it contains: Technical documentation for algorithms and systems
Current Files: (empty - future IN-1 algorithm doc)
Planned Content:
- ALMA V2 (IN-1 conversation algorithm) - 5-turn dialogue system
- Emotion detection logic
- Haiku generation pipeline
- Tree planting API integration
- RAG semantic search implementation
Purpose:
- Document how our systems work technically
- Enable team members to understand/modify algorithms
- Transparency for users (open methodology)
Who reads it:
- Developers (internal/external)
- Technical partners
- Researchers interested in our approach
4. legal / legal โ๏ธ
Section titled โ4. legal / legal โ๏ธโWhat it contains: Legal documents (terms, privacy, compliance)
Current Files: (empty - future content)
Planned Content:
- Terms of Service
- Privacy Policy
- Cookie Policy
- GDPR compliance documentation
- Data processing agreements
Purpose:
- Legal compliance
- User transparency
- Protect company and users
Who reads it:
- Users (mandatory for account signup)
- Legal team
- Auditors/regulators
5. strategie / strategies ๐ฏ (PRIVATE)
Section titled โ5. strategie / strategies ๐ฏ (PRIVATE)โWhat it contains: Internal business strategies, competitive analysis, roadmaps
Current Files: (internal - not disclosed)
Example Content:
- Product roadmaps (next 6-12 months)
- Market positioning strategies
- Competitive analysis
- Growth plans
- Partnership strategies
Purpose:
- Internal planning
- Strategic alignment
- Confidential decision-making
Who reads it:
- Francesco (founder)
- Core team
- Strategic advisors (under NDA)
โ ๏ธ NOT SYNCED: These files do NOT go to the database and are NOT accessible via API.
6. finanza / finance ๐ฐ (PRIVATE)
Section titled โ6. finanza / finance ๐ฐ (PRIVATE)โWhat it contains: Financial documents, budgets, invoices, cost tracking
Current Files: (internal - not disclosed)
Example Content:
- Monthly budgets
- Invoice archives
- Cost breakdowns (infrastructure, services)
- Revenue tracking
- Tax documentation
Purpose:
- Financial planning
- Cost control
- Tax compliance
- Audit trail
Who reads it:
- Francesco (founder)
- Accountant
- Tax advisor
โ ๏ธ NOT SYNCED: These files do NOT go to the database and are NOT accessible via API.
๐ DOCUMENT FORMAT (FRONTMATTER)
Section titled โ๐ DOCUMENT FORMAT (FRONTMATTER)โEvery .md file in /public/ uses this structure:
---title: "Document Title"slug: "it/filosofia/rhama"language: "it"translation_id: "rhama"category: "filosofia"public: trueauthor: "Francesco Pelosio"last_updated: 2025-12-18tags: ["tag1", "tag2", "tag3"]---
# Markdown Content
Your document content here...Field Explanations:
Section titled โField Explanations:โ| Field | Required | Description |
|---|---|---|
title | โ Yes | Human-readable title |
slug | โ Yes | URL-friendly identifier (e.g., it/filosofia/rhama) |
language | โ Yes | Language code (it, en, es, fr, de) |
translation_id | โ ๏ธ Optional | Links translated versions (e.g., all โrhamaโ docs have same ID) |
category | โ Yes | Category (filosofia, progetti, algoritmi, legal, strategie, finanza) |
public | โ Yes | true = API-accessible, false = private |
author | โ Yes | Document author name |
last_updated | โ Yes | Date of last update (YYYY-MM-DD) |
tags | โ ๏ธ Optional | Array of tags for search/filtering |
description | โ ๏ธ Optional | Short description for SEO |
featured | โ ๏ธ Optional | true to highlight document |
๐ SYNC WORKFLOW
Section titled โ๐ SYNC WORKFLOWโHow Files Become Database Records
Section titled โHow Files Become Database Recordsโ-
Write File: Create
.mdfile in/library/public/it/filosofia/manifesto.md -
Add Frontmatter: Include all required YAML fields
-
Run Sync:
Terminal window npm run sync-library -
Script Actions:
- Scans all
.mdfiles inlibrary/public/ - Parses frontmatter + content
- Calculates MD5 hash of content
- Checks
library.documentstable - If document exists (by slug):
- Compare hash
- If changed โ UPDATE record
- If unchanged โ SKIP
- If document doesnโt exist:
- INSERT new record
- Scans all
-
Database Result: New row in
library.documentstable
Example Sync Output
Section titled โExample Sync OutputโSyncing library/public/ โ library.documents...
+ it/filosofia/manifesto.md (CREATED - new document) โ it/filosofia/rhama.md (UPDATED - hash changed) - en/philosophy/rhama.md (SKIPPED - no changes)
Summary: - Scanned: 3 files - Created: 1 - Updated: 1 - Skipped: 1
โ Sync complete๐๏ธ DATABASE MAPPING
Section titled โ๐๏ธ DATABASE MAPPINGโAfter sync, files map to database like this:
File: library/public/it/filosofia/rhama.md
Section titled โFile: library/public/it/filosofia/rhama.mdโMaps to: library.documents table row:
| Column | Value | Source |
|---|---|---|
id | 1 | Auto-generated (SERIAL) |
slug | it/filosofia/rhama | Frontmatter: slug |
title | La Nascita di Rhama | Frontmatter: title |
category | filosofia | Frontmatter: category |
content | # RHAMA\n\n## La Nascita... | Full markdown content |
content_hash | a1b2c3d4e5f6... | MD5 hash (change detection) |
public | true | Frontmatter: public |
author | Francesco Pelosio | Frontmatter: author |
tags | {filosofia, rhama, poesia} | Frontmatter: tags (array) |
metadata | {"dedicated_to": "A tutte le mamme..."} | Extra frontmatter fields (JSONB) |
language | it | Frontmatter: language |
translation_id | rhama | Frontmatter: translation_id |
last_updated | 2025-12-18 10:59:00 | Frontmatter: last_updated |
created_at | 2025-12-18 09:00:00 | Auto-generated on INSERT |
๐ FINDING TRANSLATED DOCUMENTS
Section titled โ๐ FINDING TRANSLATED DOCUMENTSโExample: Find all versions of โrhamaโ document
SELECT slug, title, languageFROM library.documentsWHERE translation_id = 'rhama'ORDER BY language;Result:
it/filosofia/rhama | La Nascita di Rhama | iten/philosophy/rhama | The Birth of Rhama | en๐ i18n STRATEGY
Section titled โ๐ i18n STRATEGYโFolder Structure
Section titled โFolder Structureโ- Language-First:
/public/it/vs/public/en/ - Same Categories: Both languages have same folder structure (filosofia, progetti, etc.)
- Translation Linking: Use
translation_idin frontmatter to link versions
Example: Italian + English
Section titled โExample: Italian + EnglishโItalian File: /library/public/it/filosofia/rhama.md
---slug: "it/filosofia/rhama"language: "it"translation_id: "rhama"---English File: /library/public/en/philosophy/rhama.md
---slug: "en/philosophy/rhama"language: "en"translation_id: "rhama"---Query for Both:
SELECT * FROM library.documents WHERE translation_id = 'rhama';๐ SECURITY & ACCESS
Section titled โ๐ SECURITY & ACCESSโPublic Documents (/library/public/)
Section titled โPublic Documents (/library/public/)โ- โ Synced to database
- โ
API-accessible via
/api/library/documents - โ Used in RAG semantic search
- โ Can be embedded in apps (IN-1, docs site, etc.)
Example API Request:
GET https://in-1.ai/api/library/documents?category=filosofia&language=itPrivate Documents (/library/private/)
Section titled โPrivate Documents (/library/private/)โ- โ NOT synced to database
- โ NOT API-accessible
- โ NOT searchable via RAG
- โ Local filesystem only
- โ Can be git-ignored (optional)
Use Cases:
- Internal strategic planning
- Financial documents
- Confidential client notes
- Personal brainstorming
๐ ๏ธ MAINTENANCE COMMANDS
Section titled โ๐ ๏ธ MAINTENANCE COMMANDSโCreate New Document
Section titled โCreate New Documentโ# Create filetouch library/public/it/progetti/nuovo-progetto.md
# Add frontmatter (manually or via script)# ...write content...
# Sync to databasenpm run sync-libraryUpdate Existing Document
Section titled โUpdate Existing Documentโ# Edit filenano library/public/it/filosofia/manifesto.md
# Update `last_updated` field in frontmatter# Save file
# Sync (script detects hash change and updates DB)npm run sync-libraryDelete Document
Section titled โDelete Documentโ# Remove filerm library/public/it/progetti/old-project.md
# Sync (script can mark as deleted or remove from DB)npm run sync-library
# Optional: Clean up orphaned embeddingsnpm run cleanup-embeddingsList All Synced Documents
Section titled โList All Synced DocumentsโSELECT slug, title, category, language, last_updatedFROM library.documentsWHERE public = trueORDER BY category, language, title;๐ CURRENT STATISTICS
Section titled โ๐ CURRENT STATISTICSโFiles Count (As of 18 Dec 2025)
Section titled โFiles Count (As of 18 Dec 2025)โ| Location | Count | Size |
|---|---|---|
/public/it/filosofia/ | 3 files | ~8 KB |
/public/en/philosophy/ | 2 files | ~5 KB |
/public/it/progetti/ | 0 files | 0 KB |
/public/en/projects/ | 0 files | 0 KB |
/public/it/algoritmi/ | 0 files | 0 KB |
/public/en/algorithms/ | 0 files | 0 KB |
/public/it/legal/ | 0 files | 0 KB |
/public/en/legal/ | 0 files | 0 KB |
/private/strategie/ | Private | Private |
/private/finanza/ | Private | Private |
Total Public Documents: 5 markdown files (~13 KB)
Documents in Database
Section titled โDocuments in DatabaseโSELECT category, language, COUNT(*) as doc_countFROM library.documentsWHERE public = trueGROUP BY category, languageORDER BY category, language;Expected Result:
filosofia | it | 3filosofia | en | 2๐ FUTURE PLANS
Section titled โ๐ FUTURE PLANSโShort-Term (Next 30 Days)
Section titled โShort-Term (Next 30 Days)โ- Add IN-1 algorithm documentation (
algoritmi/in1-algoritmo.md) - Create legal documents (ToS, Privacy, Cookie Policy)
- Add first project case study
Medium-Term (Next 90 Days)
Section titled โMedium-Term (Next 90 Days)โ- Full i18n support (Spanish, French, German)
- Automatic embedding generation on sync
- API endpoint for document suggestions (RAG-powered)
- Version history (track changes over time)
Long-Term (Next 6 Months)
Section titled โLong-Term (Next 6 Months)โ- Collaborative editing (multi-author workflow)
- Automated translation via Claude
- Document analytics (view counts, search queries)
- Integration with docs.blacktrails.io (Starlight)
๐ SUPPORT
Section titled โ๐ SUPPORTโLibrary System Owner: Francesco Pelosio Email: francesco.pelosio@gmail.com Documentation: https://docs.blacktrails.io/private/area-x/infrastructure/ Database: Neon.tech (patient-queen-89181819)
End of Library Map ๐ฒ๐
โEvery document is a seed. Every sync is growth. Every search is discovery.โ