Skip to content

Library File Structure Map

Version: 1.0 Date: 18 December 2025 Author: Francesco Pelosio Purpose: Human-readable guide to library folder structure


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.

  • Files = Source of Truth: All docs live as .md files in /library/
  • Sync Script: npm run sync-library pushes 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)

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)

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

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

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

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

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.


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.


Every .md file in /public/ uses this structure:

---
title: "Document Title"
slug: "it/filosofia/rhama"
language: "it"
translation_id: "rhama"
category: "filosofia"
public: true
author: "Francesco Pelosio"
last_updated: 2025-12-18
tags: ["tag1", "tag2", "tag3"]
---
# Markdown Content
Your document content here...
FieldRequiredDescription
titleโœ… YesHuman-readable title
slugโœ… YesURL-friendly identifier (e.g., it/filosofia/rhama)
languageโœ… YesLanguage code (it, en, es, fr, de)
translation_idโš ๏ธ OptionalLinks translated versions (e.g., all โ€œrhamaโ€ docs have same ID)
categoryโœ… YesCategory (filosofia, progetti, algoritmi, legal, strategie, finanza)
publicโœ… Yestrue = API-accessible, false = private
authorโœ… YesDocument author name
last_updatedโœ… YesDate of last update (YYYY-MM-DD)
tagsโš ๏ธ OptionalArray of tags for search/filtering
descriptionโš ๏ธ OptionalShort description for SEO
featuredโš ๏ธ Optionaltrue to highlight document

  1. Write File: Create .md file in /library/public/it/filosofia/manifesto.md

  2. Add Frontmatter: Include all required YAML fields

  3. Run Sync:

    Terminal window
    npm run sync-library
  4. Script Actions:

    • Scans all .md files in library/public/
    • Parses frontmatter + content
    • Calculates MD5 hash of content
    • Checks library.documents table
    • If document exists (by slug):
      • Compare hash
      • If changed โ†’ UPDATE record
      • If unchanged โ†’ SKIP
    • If document doesnโ€™t exist:
      • INSERT new record
  5. Database Result: New row in library.documents table

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

After sync, files map to database like this:

Maps to: library.documents table row:

ColumnValueSource
id1Auto-generated (SERIAL)
slugit/filosofia/rhamaFrontmatter: slug
titleLa Nascita di RhamaFrontmatter: title
categoryfilosofiaFrontmatter: category
content# RHAMA\n\n## La Nascita...Full markdown content
content_hasha1b2c3d4e5f6...MD5 hash (change detection)
publictrueFrontmatter: public
authorFrancesco PelosioFrontmatter: author
tags{filosofia, rhama, poesia}Frontmatter: tags (array)
metadata{"dedicated_to": "A tutte le mamme..."}Extra frontmatter fields (JSONB)
languageitFrontmatter: language
translation_idrhamaFrontmatter: translation_id
last_updated2025-12-18 10:59:00Frontmatter: last_updated
created_at2025-12-18 09:00:00Auto-generated on INSERT

Example: Find all versions of โ€œrhamaโ€ document

SELECT
slug,
title,
language
FROM library.documents
WHERE translation_id = 'rhama'
ORDER BY language;

Result:

it/filosofia/rhama | La Nascita di Rhama | it
en/philosophy/rhama | The Birth of Rhama | en

  • Language-First: /public/it/ vs /public/en/
  • Same Categories: Both languages have same folder structure (filosofia, progetti, etc.)
  • Translation Linking: Use translation_id in frontmatter to link versions

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';

  • โœ… 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:

Terminal window
GET https://in-1.ai/api/library/documents?category=filosofia&language=it
  • โŒ 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

Terminal window
# Create file
touch library/public/it/progetti/nuovo-progetto.md
# Add frontmatter (manually or via script)
# ...write content...
# Sync to database
npm run sync-library
Terminal window
# Edit file
nano 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-library
Terminal window
# Remove file
rm 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 embeddings
npm run cleanup-embeddings
SELECT
slug,
title,
category,
language,
last_updated
FROM library.documents
WHERE public = true
ORDER BY category, language, title;

LocationCountSize
/public/it/filosofia/3 files~8 KB
/public/en/philosophy/2 files~5 KB
/public/it/progetti/0 files0 KB
/public/en/projects/0 files0 KB
/public/it/algoritmi/0 files0 KB
/public/en/algorithms/0 files0 KB
/public/it/legal/0 files0 KB
/public/en/legal/0 files0 KB
/private/strategie/PrivatePrivate
/private/finanza/PrivatePrivate

Total Public Documents: 5 markdown files (~13 KB)

SELECT
category,
language,
COUNT(*) as doc_count
FROM library.documents
WHERE public = true
GROUP BY category, language
ORDER BY category, language;

Expected Result:

filosofia | it | 3
filosofia | en | 2

  • Add IN-1 algorithm documentation (algoritmi/in1-algoritmo.md)
  • Create legal documents (ToS, Privacy, Cookie Policy)
  • Add first project case study
  • Full i18n support (Spanish, French, German)
  • Automatic embedding generation on sync
  • API endpoint for document suggestions (RAG-powered)
  • Version history (track changes over time)
  • Collaborative editing (multi-author workflow)
  • Automated translation via Claude
  • Document analytics (view counts, search queries)
  • Integration with docs.blacktrails.io (Starlight)

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.โ€