← Về thư mục
name: tourism-research-pipeline
description: Orchestrate static tourism policy research pipelines with NotebookLM, Kanban phases, cron handoffs, Telegram reporting, and bilingual deliverable control.
Tourism Research Pipeline
Use this skill for static multi-phase tourism policy research pipelines that compare countries or regions, especially when the workflow is driven by cron jobs, Kanban phases, and NotebookLM-backed retrieval.
When to use
- The user wants a staged research pipeline with 5 phases.
- The workflow uses cron to advance Kanban tasks.
- NotebookLM is the trusted core corpus for the first pass.
- Deliverables must be localized, usually Vietnamese.
- Telegram updates must include a Funnel link.
- Task 4 and Task 5 are pre-loop handoffs for the next research cycle.
Core workflow
Project Base Path
- Project Base:
/opt/ai-os/products/ceo/content/research/tourism_benchmarking/
- Master Reports:
/opt/ai-os/products/ceo/content/research/tourism_benchmarking/master_reports/
- Sources:
/opt/ai-os/products/ceo/content/research/tourism_benchmarking/sources/
Frame-level constants (apply to all phases)
- ** thesis: Evaluate if the target country's tourism policy is coherent or over-dispersed relative to implementation capacity.
- Source of Truth & Four Pillars:
brief.md (which must structure the 7-pillar comparison into 4 core integrated pillars for deliverables):
- TRỤ CỘT I: Sức tải, Hạ tầng cứng và Nguồn lực (Capacity, Hard Infrastructure & Resources)
- Hard Infrastructure: Air (airport capacity), maritime (cruise port capacity), land (highway/road connectivity).
- Utility & Ecology: Water supply, wastewater treatment, and ecological carrying capacity (max daily tourists for bio-reserves).
- Lodging Capacity: Total room count caps, height/density restrictions.
- Human Resources: Industry workforce size and availability of trained local staff.
- TRỤ CỘT II: Thị trường và Sản phẩm Du lịch (Market & Products)
- Accommodation Mix: Hotel distribution (3-star to 5-star & luxury resorts), driving shift from low-end downtown hotels to premium isolated resorts.
- Product Strategy: MICE (Meeting, Incentive, Conference, Exhibition), wellness (mud baths, traditional medicine), and marine sports/leisure.
- Key Metrics: Average length of stay (days) and average daily spend (USD/guest) instead of pure arrivals.
- TRỤ CỘT III: Phân khu và Tổ chức Không gian (Zoning, Spatial Organization & Economic Geography)
- Economic Geography: Position the province within national economic-social zones (6 official regions) and geo-ecological/climatic zones (8 natural zones).
- Internal Zoning: Map out strategic sub-regions (e.g., for Khanh Hoa: Van Phong for ultra-luxury isolated eco-tourism, Nha Trang for MICE/night economy, Cam Ranh for massive resort cluster near airport) aligned with supporting industrial clusters (cảng biển, thủy hải sản).
- TRỤ CỘT IV: Thể chế, Liên kết vùng, Hạ tầng mềm và Khung xúc tiến (Institutions, Regional Linkage, Soft Infrastructure & Promotion)
- Soft Infrastructure Lesson (The Van Phong Port case study): Acknowledge that physical infrastructure fails without custom policies, streamlined customs, tax incentives, and regional logistics linkages.
- Regional Linkage: Inter-provincial tourism corridors (e.g. sea-to-mountain links like Nha Trang-Da Lat), and joint marketing with neighboring coastal provinces.
- Target Markets & Promotion: Diversification of international markets (Korea, India, Western Europe) to avoid dependency; phased investment plans focusing on digital tourism maps, and green conversion (zero-plastic policies).
- Vùng kinh tế xã hội và sáp nhập đơn vị hành chính: Cần tôn trọng tuyệt đối thực tế địa giới hành chính của quốc gia tại thời điểm nghiên cứu (Khánh Hòa và Ninh Thuận duy trì độc lập pháp lý). Khi nghiên cứu liên kết vùng, phân tách rõ ràng dữ liệu lưu trú của hai tỉnh thành các phần riêng biệt. Tránh hư cấu hóa hoặc gộp chung địa giới hành chính khi chưa có văn bản quyết định pháp lý chính thức.
- Sáp nhập Hành chính Khánh Hòa & Ninh Thuận: Đối với các tác vụ yêu cầu sáp nhập hành chính đặc thù của người dùng (Ninh Thuận thuộc Khánh Hòa mở rộng), quy trình phải phản ánh sự đồng bộ hoàn toàn trên cả khía cạnh địa lý, hạ tầng lưu trú và quy hoạch. Toàn bộ cơ sở lưu trú tại Ninh Thuận (như Amanoi) phải được gom chung và quản lý dưới danh nghĩa phân vùng du lịch phía Nam của Khánh Hòa mở rộng, tuyệt đối không tách riêng hoặc coi là hai thực thể hành chính độc lập khi viết các báo cáo hợp nhất. Dữ liệu bảng phải được link trực tiếp qua GID của tab tương ứng trên Google Sheets thay vì chèn trực tiếp bảng thô dài vào file báo cáo Markdown.
- Định dạng Công thức toán học (SOR & BCCI): Khi trình bày công thức toán học trong báo cáo Markdown, bắt buộc phải sử dụng định dạng khối LaTeX tiêu chuẩn rõ ràng và viết lời giải thích tường minh cho các biến số, tránh hiển thị lỗi code thô hoặc các biểu thức bị vỡ nét trên các thiết bị hiển thị di động của CEO.
- Style: Policy Researcher tone. APA 7 citations required for all claims. No hyphens in Vietnamese prose.
- Official Baselines & Accommodation Data: Refer to
references/khanh_hoa_official_accommodation_data.md for official room counts, contact coordinates, and hotel registry data extracted trực tiếp từ phụ lục của Sở Du lịch Khánh Hòa.
- OTA Data Sourcing & Reconciliation Rule (TripAdvisor & Traveloka):
- Scraping/matching 5-star accommodation data in target regions (Nha Trang, Cam Ranh, Ninh Thuận, Vân Phong) from TripAdvisor and Traveloka:
- Cloudflare & Bot Defenses: Do NOT scrape TripAdvisor/Traveloka directly using the headless browser if CAPTCHAs or DataDome blocks occur. Pivot immediately to search-reconstruction via target query snippets or trusted secondary sources (e.g. booking.com description text, hotel homepages, local news like baokhanhhoa.vn).
- Reconciliation Protocol: Match hotel names, locations, and total rooms/villas across channels. Discrepancies (such as TripAdvisor showing different room counts than official sites or Traveloka) must be reconciled by verifying the official resort homepage or press releases.
- Data Schema & Clean-up: For each matched 5-star entity, document: Name, Location (Nha Trang / Cam Ranh / Ninh Thuận / Vân Phong), Room/Villa count, TripAdvisor rating/reviews, Traveloka rating/reviews, and Key features (isolated resort, private beach, pool, etc.).
- URL Identification Verification: Verify carefully the unique IDs of each property to avoid duplication (e.g. The Anam Cam Ranh must map to its own ID instead of reusing Amanoi's
ks.1998).
- Validation of Room Count: Sáp nhập dữ liệu buồng phòng thực tế hoạt động thay vì dữ liệu tự phong (ví dụ: Havana Nha Trang thực tế có 1.060 phòng hoạt động thay vì 1.260 phòng).
- Output: Concise Vietnamese summary + clickable Tailscale Funnel link to report/index.
- Telegram Funnel base:
https://vmi3427693.tail8c1aaf.ts.net/files/opt/ai-os/products/ceo/content/research/tourism_benchmarking/
- Funnel link format in Telegram:
- [Tên file]({funnel_base}master_reports/{filename})
File output rule (applies to all phases that write deliverables)
When a phase writes a deliverable file (Phase 2, 4, 5):
- Write the file normally in the Kanban workspace (happens automatically)
- COPY the file to the project Master Reports directory:
bash
mkdir -p /opt/ai-os/products/ceo/content/research/tourism_benchmarking/master_reports/
cp {workspace_path}/{filename} /opt/ai-os/products/ceo/content/research/tourism_benchmarking/master_reports/{filename}
workspace_path: read from task metadata (column workspace_path)
filename: the deliverable name (e.g. Vietnam_tourism_policy.md)
- Verify the copy succeeded before sending Telegram notification
- Never skip the copy step — writing only to the workspace makes the file invisible to the user
Phase 1: Scoping & Data Sync
- Assignee: r-and-d | Output:
/sources/ (write directly to Project Base/sources/, not workspace)
- Task body to write (must include [CONTEXT] + [PHASE]):
```
[CONTEXT] Luận đề: đánh giá chính sách du lịch {Country} có tập trung (coherent) hay bị dàn trải (over-dispersed) so với năng lực thực thi. Sử dụng brief.md làm nguồn chân lý với 7 trụ cột. Ma trận benchmark: lượt quốc tế/nội địa, GDP du lịch, việc làm, phòng, chi tiêu trung bình, ngân sách xúc tiến.
[PHASE 1] Đối chiếu 10 nguồn tài liệu mới với 7 trụ cột chiến lược. Phân tích xem tài liệu đề cập đến khía cạnh nào trong 7 trụ cột, đánh giá mức độ bao phủ dữ liệu, phát hiện nội dung chính sách có mâu thuẫn hay lệch pha với mục tiêu nghiên cứu gốc không.
``
- **Progress tracking:** Đọcprocessed_sources_{country}.json(e.g.processed_sources_vn.json) để xác định 10 nguồn kế tiếp. Lấy 10 source ID chưa có trongprocessed_idstừ danh sách nguồn trên NotebookLM. Lưu 10 ID này vàolast_batch. Nếu chưa có file, tạo mới và lấy 10 source đầu tiên.
- **Sync Logic:** Format của progress file:`.
- Telegram: Research start (Dùng Topic thread đúng).
Phase 2: RAG Analysis & Deep Finding
- Assignee: r-and-d | Output:
{Country}_tourism_policy.md
- Task body to write (must include [CONTEXT] + [PHASE]):
```
[CONTEXT] Luận đề: đánh giá chính sách du lịch {Country} có tập trung (coherent) hay bị dàn trải (over-dispersed). brief.md là nguồn chân lý. 7 trụ cột. Benchmark matrix đầy đủ.
[PHASE 2] Khai thác chuyên sâu 10 nguồn thuộc last_batch qua RAG. Thực hiện Policy Coherence Test: đánh giá sự tương thích giữa số lượng mục tiêu chính sách đề ra với nguồn lực thực thi được phân bổ (flag quá tải chương trình nghị sự). Đúc kết findings định lượng lẫn định tính.
``
- **Scope control:** Chỉ query đúng 10 source ID từlast_batchtrong progress file. Dùngnlm notebook query --source-idsvới đúng 10 ID đó. Không query toàn bộ notebook. Ghi kết quả phân tích vào file master với tiêu đề phân biệt theoloop_count`.
- Telegram: Task 2 findings + funnel link.
Phase 3: Critique (CRITICAL — must use research-critism skill)
- Assignee: grill-qa
- Personality: grill-qa (set explicitly on task)
- Task body to write (must include [CONTEXT] + [PHASE]):
```
[CONTEXT] Luận đề chính: policy coherence vs dispersion (brief.md). 7 trụ cột. Yêu cầu phản biện chuyên sâu.
[PHASE 3] BẮT BUỘC SỬ DỤNG SKILL: research/research-critism. Đóng vai phản biện độc lập (Methodology Reviewer & Devil's Advocate). Áp dụng quy tắc Anti Sycophancy (tấn công ít nhất 2 luận điểm chính của Phase 2, không đồng thuận dễ dãi). Kiểm tra Hypothesis Discipline và đặt Counter argument cho các luận điểm về "dàn trải chính sách". Chỉ ra điểm cần R&D làm rõ hoặc bổ sung nguồn đối chứng. Trả kết quả bằng Template phê bình (Mức A/B/C).
``
- **HANDOFF RULE (critical):** Sau khi hoàn thành critique, GHI critique findings vào comment của task này. KHÔNG block pipeline — set status thànhdone, sau đó chuyển Task 4 (Synthesis) từtodo→ready` và ghi comment với handoff context. Task 4 sẽ đọc comment critique để điều chỉnh synthesis. Chỉ block pipeline nếu board trống hoặc Task N+1 không tồn tại.
- Telegram: Critique summary & update needs.
Phase 4: Synthesis & Reporting
- Assignee: writers | Output:
{Country}_tourism_policy.md
- Personality: policy researcher
- Language: Vietnamese only (when scope is Vietnamese).
- Task body to write (must include [CONTEXT] + [PHASE]):
```
[CONTEXT] Luận đề trung tâm: chính sách du lịch {Country} tập trung hay dàn trải? brief.md là nguồn chân lý. 7 trụ cột. Benchmark matrix.
[PHASE 4] ĐỌC COMMENT của Phase 3 (Critique) để biết các điểm phản biện. Tổng hợp dữ liệu từ các phase trước có tính đến ý kiến phê bình, điều chỉnh lập luận nếu critique hợp lý. Biên soạn theo cấu trúc Claim → Evidence → Inference → Citation (APA 7). Trả lời trực tiếp Thesis: chính sách đang tập trung hay bị phân mảnh? Làm rõ ưu tiên cốt lõi vs thứ cấp.
```
- Pre-loop note: Đây là handoff point cho vòng nghiên cứu kế tiếp.
- Telegram: Update summary + funnel link (Synthesis Report) + Index.
Phase 5: Master Update & QA Gate
- Assignee: grill-qa | Output:
index.md
- Personality: grill-qa
- Task body to write (must include [CONTEXT] + [PHASE]):
```
[CONTEXT] Luận đề: policy coherence (brief.md). 7 trụ cột. Toàn bộ dữ liệu từ 4 phase trước.
[PHASE 5] Đóng vai tổng biên tập kiểm soát chất lượng cuối cùng. Kiểm tra APA 7 cho toàn bộ in-text citations & References list; không để sót dấu gạch nối trong văn xuôi tiếng Việt. Cập nhật index.md cho các hướng nghiên cứu kế tiếp.
``
- **Progress update:** Gộplast_batchvàoprocessed_ids, tăngloop_count, clearlast_batch`. Ghi lại file. Điều này đảm bảo vòng sau Phase 1 sẽ lấy 10 nguồn mới tiếp theo.
- Telegram: Link file + handoff note + funnel link to index.
Cron prompt structure (rules for writing the cron prompt itself)
The cron prompt must contain these exact sections in order:
1. FRAMEWORK CORE
Apply to all phases — thesis, source of truth, style, output format.
2. PROGRESS TRACKING
Schema, persistence behavior, batching rule (10 sources per loop).
3. PIPELINE PHASES
Each phase entry must contain:
- Assignee, personality (if applicable), output path
- Task body to write: Raw markdown block with [CONTEXT] (thesis, pillars, matrix) + [PHASE] (specific task) — this text goes literally into the Kanban task body so the spawned agent has full context without reading external files.
- HANDOFF RULE (Phase 3 only): block self but advance Phase 4 regardless.
- Telegram link template: complete with the exact Funnel URL.
4. EXECUTION RULES
- Route by phase name, not hardcoded task ID.
Infrastructure troubleshooting rules
- If NotebookLM sync or Kanban worker reports protocol violation, inspect service ownership and port contention before rerunning cron.
- A worker exiting cleanly without
kanban_complete or kanban_block is a protocol violation, not a successful run.
- If a service is holding a port like 9120, resolve the process conflict before resuming the pipeline.
- Cron Agent Context Pollution & Script-Only Shift: Scheduled cron jobs that require complex, sequential multi-step logic (e.g. checking Kanban DB, making decisions, creating tasks, reporting status) are highly susceptible to agent context pollution. Agents running inside the cron may hallucinate prior outputs (e.g. creating dummy a/b/c.txt files because they saw a debugging session in history).
- Mitigation: Shift cron orchestration from agent-based prompts to deterministic python scripts (configured with
no_agent: true).
- Put the logic (e.g. SQLite querying, Task insertion, status checking, Telegram reporting) in a script (like
cron_kanban_watcher.py saved under ~/.hermes/scripts/), and let the scheduler run this script. This guarantees 100% execution stability, bypasses LLM noise, and prevents agent side-effects.
Telegram reporting rules
- After each phase, send a concise Telegram message in Vietnamese.
- Include a clickable Tailscale Funnel link to the file or index.
- For Phase 4 and Phase 5, explicitly say it is a pre-loop for the next research cycle.
- Topic Targeting: Target format:
telegram:<chat_id>:<thread_id> (e.g., telegram:-1003707758328:12). Do NOT prefix with platform:. Do not send to the general thread when a topic thread is configured.
- Funnel link format: All link must use
https://vmi3427693.tail8c1aaf.ts.net/files/opt/ai-os/products/ceo/content/research/tourism_benchmarking/... — tailscale Funnel base. Correct example: https://vmi3427693.tail8c1aaf.ts.net/files/opt/ai-os/products/ceo/content/research/tourism_benchmarking/master_reports/Vietnam_tourism_policy.md
- Telegram send format: Link text — markdown link syntax.
- No Agent Message Formatting: When configuring the cron to run in
no_agent: true mode, ensure the orchestration script outputs only the clean final Telegram message directly to stdout. The scheduler captures this stdout and delivers it to the target chat. Avoid developer logging in the stdout channel; use stderr or separate files for logging to prevent Telegram message pollution.
Kanban / orchestration rules
- Prefer manual orchestration.
- Disable auto-decompose for static research boards.
- Keep Task 1 blocked until cron intentionally releases it.
- Do not create duplicate tasks.
- Do not delete a pipeline just because the prompt was updated; update task bodies in place unless a full fresh run is required.
- Kanban CLI syntax: Always use
hermes kanban --board <board_slug> <action> (e.g., hermes kanban --board research-hub create --assignee r-and-d --body "..." "[VN.Task 1] ..."). The task title and body must be separated by the --body flag. Never pass --board to the top-level hermes executable.
- Reusable pipeline-creation script:
scripts/create_loop.py creates the full 5-task Vietnam chain (parent-linked) in one invocation. Run it as python3 scripts/create_loop.py when initiating a new loop from scratch.
- Deterministic watcher script:
scripts/cron_kanban_watcher.py handles the cron orchestration and status checks cleanly, outputting formatted Telegram updates to stdout without agent context pollution.
- Task transition: Claim tasks via
claim <task_id> and finish via complete <task_id> "<message>". Do not use "close". To mark ready: kanban ready <task_id>.
Infrastructure troubleshooting rules
- If NotebookLM sync or Kanban worker reports protocol violation, inspect service ownership and port contention before rerunning cron.
- A worker exiting cleanly without
kanban_complete or kanban_block is a protocol violation, not a successful run.
- If a service is holding a port like 9120, resolve the process conflict before resuming the pipeline.
Pitfalls
- NotebookLM is a trusted corpus, not a file-dump target.
- Phase 1 and Phase 2 are not the same as external source harvesting.
- Do not let Task 4 drift back into English when the final report is supposed to be Vietnamese.
- Do not send Telegram to the general thread when a topic thread is configured.
- Do not rely on task IDs in cron prompt logic — use phase name matching.
- Progress Update Persistence Issue (CRITICAL): The
processed_sources_vn.json file is meant to track processed_ids, last_batch, and loop_count across cron runs, with Phase 5 responsible for merging last_batch into processed_ids and incrementing loop_count. If a previous Phase 5 failed to update this file (e.g., due to an unexpected worker exit or archiving before completion), the next cron run will re-process the same last_batch sources. Mitigation: When initiating a new loop, explicitly merge the existing last_batch into processed_ids and increment loop_count before selecting new sources for the current last_batch. This ensures proper progression even if the previous Phase 5 was incomplete.
- Phase 3 block trap: A common bug is Phase 3 blocking itself on critique issues and not advancing Phase 4. The HANDOFF RULE exists specifically to prevent this. Phase 3 should NOT block — it writes critique to a comment, sets itself
done, and advances Phase 4. Critique findings travel via comments, not via block status.
- Workspace file black hole: Writing a deliverable file to the Kanban workspace only makes it visible within the task's sandbox. The user cannot access it. Every file-writing phase MUST
cp the file from workspace to the project's master_reports/ directory and verify the copy succeeded before sending the Telegram notification.
- Context starvation: If the task body only contains the phase description without a [CONTEXT] section, the spawned agent has no awareness of the thesis, 7 pillars, or brief.md. Always embed [CONTEXT] in every task body.
- Deliver format: Using
platform:telegram:... causes unknown platform 'platform' scheduler error. Correct format is telegram:<chat_id>:<thread_id>.
- Black-hole Phase 4: Phase 4 must explicitly read Phase 3 comment context, otherwise it synthesizes without addressing critique points.