ContextStream MCP Server

ทางการ

หน่วยความจำถาวรและการค้นหาเชิงความหมายสำหรับผู้ช่วยเขียนโค้ด AI ข้ามเซสชัน

เอกสาร

เอกสาร · เรียกดูส่วนต่างๆ

01 · ตัวช่วยตั้งค่า

หนึ่งคำสั่ง ตั้งค่าเสร็จสมบูรณ์

รันหนึ่งคำสั่งเพื่อยืนยันตัวตน (ล็อกอินผ่านเบราว์เซอร์/อุปกรณ์), สร้างคีย์ API, สร้างกฎ และเขียนการตั้งค่า MCP ที่ถูกต้องสำหรับเครื่องมือของคุณ (รวมถึงสคีมา servers ของ VS Code)

terminal · terminal · macOS / Linux

curl -fsSL https://contextstream.io/scripts/mcp.sh | bash

terminal · powershell · Windows

irm https://contextstream.io/scripts/mcp.ps1 | iex

ติดตั้งแล้วใช่ไหม? รันตัวช่วยตั้งค่าอีกครั้ง

terminal · terminal · รันอีกครั้ง

contextstream-mcp setup

สิ่งที่ทำ: เขียนการตั้งค่า MCP (VS Code servers, Cursor/Cline/อื่นๆ mcpServers), สร้างกฎ (มาตรฐาน/ขั้นสูง) และสามารถเชื่อมโยงโปรเจกต์กับพื้นที่ทำงานได้

ชุดเครื่องมือที่รวมไว้: ตัวช่วยตั้งค่าจะกำหนดค่าเครื่องมือโดเมนที่รวมไว้ประมาณ 11 รายการตามค่าเริ่มต้น (ลดโทเค็นลงประมาณ 75%) ตัวเลือก: โหมด router (เครื่องมือเมตาประมาณ 2 รายการ กะทัดรัดที่สุด) ดู แคตตาล็อกเครื่องมือทั้งหมด

ดูตัวอย่างการเปลี่ยนแปลงโดยไม่ต้องเขียนไฟล์: contextstream-mcp setup --dry-run

เวิร์กโฟลว์ของทีม

หน่วยความจำ ทักษะ และการแสดงบริบทร่วมกัน

บัญชีทีมได้รับมากกว่าโปรเจกต์ที่แชร์กัน ในระหว่าง contextstream-mcp setup ตัวช่วยตั้งค่าจะตรวจจับความสามารถของทีมและแสดงเคล็ดลับพื้นที่ทำงาน ในเอดิเตอร์ของคุณ ทุกการเรียก session(action="context") สามารถรวมคำแนะนำของทีม สัญญาณการกำกับดูแล สัญญาณลำดับความสำคัญ และอาร์ติแฟกต์ที่เชื่อมโยงได้

เลือกพื้นที่ทำงานที่แชร์

เชื่อมโยงแต่ละรีโพกับพื้นที่ทำงานของทีมระหว่างการตั้งค่า เพื่อให้การทำดัชนี การตัดสินใจ และทิกเก็ตสอดคล้องกัน

แชร์ทักษะของทีม

skill(action="share", scope="team") เผยแพร่เวิร์กโฟลว์ที่ใช้ซ้ำได้ ซึ่งเพื่อนร่วมทีมจะจับคู่อัตโนมัติใน session(action="context")

สลับขอบเขตการดำเนินการ

บัญชีแบบบริบทคู่ใช้ --account-mode=team|personal|auto หรือ session set_account_mode ใน MCP

ติดตามงานด้วยเอนทิตี

ทิกเก็ต การส่งมอบงาน เหตุการณ์ และรีลีสใช้การอ้างอิงที่มีดัชนี — คงทนข้ามเซสชันและเพื่อนร่วมทีม

รีโมตที่โฮสต์เป็นค่าเริ่มต้น MCP แบบไบนารีในเครื่องใช้สำหรับการกู้คืนเท่านั้น — ตั้งค่า CONTEXTSTREAM_ALLOW_LOCAL_MCP=1 เมื่อจำเป็นอย่างชัดเจน ดู การตั้งค่าทีม สำหรับการเชิญ/บทบาท และ รายการตรวจสอบหลังล็อกอิน

ทางลัด CLI

คำสั่งแบบไม่โต้ตอบ (CI & รีเฟรช)

รันคำสั่งเหล่านี้โดยไม่ต้องใช้ตัวช่วยตั้งค่าแบบโต้ตอบ — เหมาะหลังการอัปเกรด, การเริ่มต้นใช้งานทีม, การหมุนเวียนข้อมูลประจำตัว หรือการเปลี่ยนแปลงพื้นที่ทำงาน นอกจากนี้ยังแสดงใน contextstream-mcp --help

คำสั่งเมื่อใดควรใช้
contextstream-mcp update-hooks --scope=globalหลังการอัปเกรดหรือเข้าร่วมพื้นที่ทำงานของทีม — รีเฟรช hooks PreToolUse/UserPromptSubmit
contextstream-mcp update-rules --scope=allสร้าง .cursorrules / CLAUDE.md / AGENTS.md ใหม่พร้อมคำแนะนำเวิร์กโฟลว์ของทีมล่าสุด
contextstream-mcp update-configs --scope=globalเขียนการตั้งค่า MCP ใหม่หลังการเปลี่ยนแปลงคีย์ API หรือพื้นที่ทำงาน
contextstream-mcp migrate-remote --scope=allแปลงการตั้งค่า stdio ในเครื่องแบบเดิมเป็นการขนส่งรีโมตที่โฮสต์
contextstream-mcp detect-editors --format=jsonสคริปต์ตรวจสอบว่ามีเอดิเตอร์ใดติดตั้งอยู่ (บูตสแตรป/CI)
contextstream-mcp generate-configs --transport=remote --preauthส่งเพย์โหลดการตั้งค่า JSON โดยไม่ต้องเขียนไฟล์
contextstream-mcp configure --transcripts=on --scope=allตั้งค่าเริ่มต้นการจับบันทึกการสนทนาแบบไม่โต้ตอบ

terminal · โหมดบัญชี · ทีม vs ส่วนตัว

# Default: follow account (auto)
contextstream-mcp --account-mode=auto

# Force team-scoped reads/writes
contextstream-mcp --account-mode=team

# Or set once in shell profile:
export CONTEXTSTREAM_ACCOUNT_MODE=team

02 · การกำหนดค่าด้วยตนเอง

การตั้งค่าต่อไคลเอนต์

ใช้รูปแบบที่ถูกต้องต่อไคลเอนต์ (VS Code ใช้ servers; ไคลเอนต์อื่นๆ จำนวนมากใช้ mcpServers)

ชุดเครื่องมือที่รวมไว้: ตามค่าเริ่มต้น เซิร์ฟเวอร์จะแสดงเครื่องมือโดเมนที่รวมไว้ประมาณ 11 รายการ (ลดโทเค็นลงประมาณ 75% เมื่อเทียบกับเครื่องมือละเอียดแบบเดิม) หากต้องการเครื่องมือที่น้อยลงไปอีก ให้เพิ่ม "CONTEXTSTREAM_PROGRESSIVE_MODE": "true" ลงในบล็อก env สำหรับเครื่องมือเมตาเราเตอร์ประมาณ 2 รายการ ดู แคตตาล็อกเครื่องมือทั้งหมด

ข้ามไปยังเครื่องมือของคุณ

Cursor / VS CodeWindsurfCodex CLIOpenCode CLIClaude CodeClaude DesktopClineKilo CodeRoo CodeAntigravity

MCP คืออะไร?

โปรโตคอลเปิดสำหรับ AI

Model Context Protocol (MCP) เป็นมาตรฐานเปิดที่อนุญาตให้ผู้ช่วย AI เชื่อมต่อกับเครื่องมือและแหล่งข้อมูลภายนอก ด้วยเซิร์ฟเวอร์ MCP ของ ContextStream เครื่องมือ AI ของคุณสามารถ:

  • จดจำการสนทนาและการตัดสินใจข้ามเซสชัน
  • ค้นหาฐานโค้ดและเอกสารของคุณแบบความหมาย
  • สร้างและสอบถามกราฟความรู้
  • แชร์บริบทระหว่างเครื่องมือ AI ต่างๆ

ภาษาธรรมชาติ

แค่ถาม AI จัดการเครื่องมือให้

คุณไม่จำเป็นต้องจำชื่อเครื่องมือหรือเรียกใช้โดยตรง แค่อธิบายสิ่งที่คุณต้องการเป็นภาษาอังกฤษธรรมดา แล้วผู้ช่วย AI ของคุณจะใช้เครื่องมือที่เหมาะสมโดยอัตโนมัติ

แค่ถามอย่างเป็นธรรมชาติ

  • · "สรุปเซสชัน"
  • · "เราตัดสินใจอะไรเกี่ยวกับการยืนยันตัวตน?"
  • · "จำไว้ว่าเรากำลังใช้ PostgreSQL"
  • · "ค้นหาโค้ดการชำระเงิน"

AI จัดการส่วนที่เหลือ

  • · ค้นหาบริบทที่เกี่ยวข้องโดยอัตโนมัติ
  • · ระลึกถึงการตัดสินใจในอดีตเมื่อจำเป็น
  • · บันทึกข้อมูลสำคัญลงในหน่วยความจำ
  • · ค้นหาโค้ดและเอกสาร

ตัวอย่าง · "สรุปเซสชัน"

Natural language example: typing 'session summary' and the AI automatically uses context_smart

AI เข้าใจเจตนาของคุณและเรียกใช้เครื่องมือ ContextStream ที่เหมาะสมเบื้องหลัง

ข้อกำหนดเบื้องต้น

สิ่งที่คุณต้องการ

  • บัญชี ContextStream (ตัวช่วยตั้งค่าสามารถสร้างคีย์ API ผ่านการล็อกอินเบราว์เซอร์)

เพิ่มคุณค่าบริบท

การผสานรวม GitHub + Slack

MCP ให้หน่วยความจำถาวรแก่ AI ของคุณ การเชื่อมต่อ GitHub และ Slack ทำให้หน่วยความจำนั้นสมบูรณ์ยิ่งขึ้น — AI ของคุณสามารถอ้างอิง PR, issues และการสนทนาของทีมได้โดยอัตโนมัติเมื่อตอบคำถาม

การเพิ่มคุณค่าบริบทอัตโนมัติ

เมื่อคุณเรียก context_smart หรือ session_smart_search GitHub issues, PRs และการสนทนาใน Slack ที่เกี่ยวข้องจะถูกรวมเข้ามาโดยอัตโนมัติ ไม่ต้องใช้เครื่องมือเพิ่มเติม

GitHubSync issues, PRs, รีลีส และความคิดเห็น การตัดสินใจจะถูกดึงออกมาจากการสนทนาโดยอัตโนมัติSlackSync แชนเนลและเธรด การสนทนาที่มีส่วนร่วมสูงจะถูกให้คะแนนและจัดลำดับความสำคัญ

ตัวอย่างพร้อมท์

  • · "เราตัดสินใจอะไรเกี่ยวกับการยืนยันตัวตน?" — ค้นหาการตัดสินใจจาก GitHub issues + เธรด Slack
  • · "แสดงกิจกรรมล่าสุดบนระบบการชำระเงิน" — แสดง PRs, issues และการสนทนาของทีม
  • · "เราได้บทเรียนอะไรจากเหตุขัดข้องครั้งล่าสุด?" — ดึงข้อมูลเชิงลึกจาก Slack และ GitHub
  • · "สรุปกิจกรรม GitHub รายสัปดาห์ให้ฉัน" — ใช้ integration(provider="github", action="summary", ...)
  • · "ค้นหาการสนทนาเกี่ยวกับการย้ายฐานข้อมูลในการผสานรวมทั้งหมด" — ใช้ integration(provider="all", action="search", ...)
  • · "สรุปทีมรายสัปดาห์จากทุกแหล่งให้ฉัน" — ใช้ integration(provider="all", action="summary", ...)

ข้อมูลอ้างอิงด่วนการดำเนินการของเครื่องมือผสานรวม

ใช้ integration(provider="github|slack|all", action="...")

GitHub (provider="github")

  • action="stats" — สถิติและสถานะการซิงค์
  • action="search" — ค้นหาด้วยตัวกรองสถานะ/ช่วงเวลา
  • action="activity" — ฟีดกิจกรรม (ตัวกรองวัน)
  • action="knowledge" — การตัดสินใจ/บทเรียนที่ดึงออกมา
  • action="summary" — สรุปรายสัปดาห์/รายเดือน
  • action="repos" — แสดงรายการรีโพที่ซิงค์
  • action="issues" — แสดงรายการ issues/PRs

Slack (provider="slack")

  • action="stats" — สถิติและสถานะการซิงค์
  • action="search" — ค้นหาด้วยตัวกรองแชนเนล/ช่วงเวลา
  • action="discussions" — เธรดที่มีส่วนร่วมสูง
  • action="knowledge" — การตัดสินใจ/บทเรียนที่ดึงออกมา
  • action="summary" — สรุปรายสัปดาห์/รายเดือน
  • action="channels" — แสดงรายการแชนเนลที่ซิงค์

ข้ามแหล่ง (provider="all")

  • action="status" — ตรวจสอบสถานะการซิงค์และความสมบูรณ์ของการผสานรวมที่เชื่อมต่อทั้งหมด
  • action="search" — ค้นหาข้ามการผสานรวมที่เชื่อมต่อทั้งหมดในคำถามเดียว
  • action="summary" — สรุปกิจกรรมรวมจากทุกแหล่ง (ตัวกรองวัน)
  • action="knowledge" — รับการตัดสินใจ บทเรียน และข้อมูลเชิงลึกจากทุกแหล่ง

ไคลเอนต์ · Cursor / VS Code

Cursor / VS Code

Cursor และ VS Code ใช้สคีมาการตั้งค่า MCP ที่แตกต่างกัน Cursor ยังคงใช้กระบวนการ MCP ในเครื่อง แต่ VS Code/Copilot สามารถใช้ ContextStream MCP ที่โฮสต์โดยตรงผ่าน HTTP ได้แล้ว

terminal · .cursor/mcp.json (โปรเจกต์) หรือ ~/.cursor/mcp.json (ส่วนกลาง)

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

แนะนำสำหรับ VS Code / Copilot: ติดตั้งรีโมตในคลิกเดียว

ติดตั้ง ContextStream MCP ที่โฮสต์ และให้ VS Code จัดการ OAuth เมื่อใช้งานครั้งแรก ไม่ต้องมีไบนารีในเครื่องหรือคีย์ API อยู่ใน .vscode/mcp.json

ติดตั้งใน VS Code เอกสาร VS Code MCP

terminal · .vscode/mcp.json (VS Code MCP ดั้งเดิม, รีโมต)

{
  "servers": {
    "contextstream": {
      "type": "http",
      "url": "https://mcp.contextstream.io/mcp?default_context_mode=fast"
    }
  }
}

ชอบใช้บรรทัดคำสั่ง? เพิ่มเซิร์ฟเวอร์รีโมตด้วย code --add-mcp

terminal · terminal

code --add-mcp '{"name":"contextstream","type":"http","url":"https://mcp.contextstream.io/mcp?default_context_mode=fast"}'

เมื่อใช้งานครั้งแรก VS Code ควรแจ้งให้อนุญาต ContextStream แล้วจึงตั้งค่าให้เสร็จโดยอัตโนมัติ

โฮสต์เอง? ชี้การตั้งค่ารีโมตเดียวกันไปที่ URL เกตเวย์ MCP ของคุณเองแทน https://mcp.contextstream.io/mcp?default_context_mode=fast

ไคลเอนต์ · OpenCode CLI

OpenCode CLI

หากต้องการใช้ ContextStream กับ OpenCode CLI ให้เพิ่มการตั้งค่าเซิร์ฟเวอร์ MCP ลงในไฟล์ ~/.config/opencode/opencode.json ของคุณ (หรือ opencode.json ในรูทโปรเจกต์ของคุณ):

terminal · ~/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "contextstream": {
      "type": "local",
      "command": ["contextstream-mcp"],
      "enabled": true,
      "environment": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

หลังจากแก้ไขการตั้งค่าแล้ว ให้รีสตาร์ท OpenCode เพื่อให้สามารถโหลดเซิร์ฟเวอร์ ContextStream MCP ได้

ไคลเอนต์ · Codex CLI

Codex CLI

หากต้องการใช้ ContextStream กับ Codex CLI ให้เพิ่มการตั้งค่าเซิร์ฟเวอร์ MCP ลงในไฟล์ ~/.codex/config.toml ของคุณ:

terminal · ~/.codex/config.toml

[mcp_servers.contextstream]
command = "contextstream-mcp"
args = []

[mcp_servers.contextstream.env]
CONTEXTSTREAM_API_URL = "https://api.contextstream.io"
CONTEXTSTREAM_API_KEY = "your_api_key"

หลังจากแก้ไขการตั้งค่าแล้ว ให้รีสตาร์ท Codex เพื่อให้สามารถโหลดเซิร์ฟเวอร์ ContextStream MCP ได้

ไคลเอนต์ · Claude Code

Claude Code (CLI)

เพิ่ม ContextStream ลงใน Claude Code โดยรันคำสั่งนี้จากไดเรกทอรีโปรเจกต์ของคุณ:

terminal · terminal

claude mcp add --transport stdio contextstream --env CONTEXTSTREAM_API_URL=https://api.contextstream.io --env CONTEXTSTREAM_API_KEY=your_api_key -- contextstream-mcp

ข้อควรระวังสำหรับ Windows (Windows ดั้งเดิม ไม่ใช่ WSL): ใช้ cmd /c contextstream-mcp หลัง --

ทางเลือก: add-json (stdio)

terminal · terminal · add-json

claude mcp add-json contextstream \
'{"type":"stdio","command":"contextstream-mcp","args":[],"env":{"CONTEXTSTREAM_API_URL":"https://api.contextstream.io","CONTEXTSTREAM_API_KEY":"your_api_key"}}'

เคล็ดลับ: สำหรับการตั้งค่าทีม ควรใช้ไฟล์ .mcp.json ที่คอมมิต (ขอบเขตโปรเจกต์) แทนการฝังคีย์ในประวัติเชลล์

สิ่งนี้จะเพิ่ม ContextStream ลงใน ~/.claude.json ภายใต้พาธของโปรเจกต์ของคุณ ทำให้พร้อมใช้งานเมื่อทำงานในไดเรกทอรีนั้น

ตัวเลือกขอบเขต MCP

  • · Local (ค่าเริ่มต้น): ส่วนตัวสำหรับคุณ เฉพาะโปรเจกต์ปัจจุบัน → เก็บใน ~/.claude.json ภายใต้พาธโปรเจกต์
  • · User (--scope user): ส่วนตัวสำหรับคุณ ทุกโปรเจกต์ → เก็บใน ~/.claude.json ส่วนกลาง
  • · Project (--scope project): แชร์กับทีม → เก็บใน .mcp.json ในรูทโปรเจกต์ (คอมมิตไปยัง git)

สำหรับการแชร์กับทีม ใช้ขอบเขตโปรเจกต์เพื่อสร้างไฟล์ .mcp.json ที่สามารถคอมมิตไปยัง git ได้:

terminal · .mcp.json (ขอบเขตโปรเจกต์)

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

หลังจากเพิ่มเซิร์ฟเวอร์ MCP แล้ว ให้รีสตาร์ท Claude Code เพื่อให้การเปลี่ยนแปลงมีผล ตรวจสอบว่าเซิร์ฟเวอร์โหลดแล้วด้วย claude mcp list สำหรับเซิร์ฟเวอร์ขอบเขตโปรเจกต์จาก .mcp.json Claude Code จะแจ้งให้อนุมัติเมื่อใช้งานครั้งแรก

ไคลเอนต์ · Claude Desktop

Claude Desktop (แอป GUI)

เพิ่ม ContextStream ลงในแอปพลิเคชัน Claude Desktop:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

terminal · claude_desktop_config.json

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

หลังจากแก้ไขการตั้งค่าแล้ว ให้ปิดและรีสตาร์ท Claude Desktop เพื่อให้การเปลี่ยนแปลงมีผล

ไคลเอนต์ · Windsurf

Windsurf

เพิ่ม ContextStream ลงใน Windsurf โดยแก้ไขไฟล์การตั้งค่า MCP ส่วนกลาง:

การตั้งค่า: ~/.codeium/windsurf/mcp_config.json

terminal · ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

ไฟล์กฎ

  • · ส่วนกลาง: ~/.codeium/windsurf/memories/global_rules.md
  • · โปรเจกต์: .windsurf/rules/contextstream.md

Windsurf รองรับ hooks สำหรับการบังคับใช้กฎ ContextStream โดยอัตโนมัติ หลังจากแก้ไขการตั้งค่าแล้ว ให้รีสตาร์ท Windsurf เพื่อให้การเปลี่ยนแปลงมีผล

ไคลเอนต์ · Cline

Cline

เพิ่ม ContextStream ลงในการตั้งค่า Cline MCP ของคุณ คลิกไอคอน MCP Servers ใน Cline เลือกแท็บ "Configure" จากนั้นคลิก "Configure MCP Servers" เพื่อแก้ไข:

terminal · cline_mcp_settings.json

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

หลังจากแก้ไขการกำหนดค่าแล้ว ให้รีสตาร์ท Cline เพื่อให้การเปลี่ยนแปลงมีผล คุณยังสามารถใช้ alwaysAllow เพื่ออนุมัติเครื่องมือเฉพาะโดยอัตโนมัติ

ไคลเอนต์ · Kilo Code

Kilo Code

เพิ่ม ContextStream ลงในการกำหนดค่า MCP ของ Kilo Code คุณสามารถกำหนดค่าเซิร์ฟเวอร์ MCP ได้ทั้งแบบส่วนกลางหรือต่อโปรเจกต์:

ส่วนกลาง: คลิก Settings → MCP Servers → Installed → Edit Global MCP เพื่อเปิด mcp_settings.json

โปรเจกต์: .kilocode/mcp.json ในไดเรกทอรีรากของโปรเจกต์

terminal · .kilocode/mcp.json (หรือ mcp_settings.json)

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

การกำหนดค่าระดับโปรเจกต์มีลำดับความสำคัญสูงกว่าการกำหนดค่าส่วนกลาง รีสตาร์ท Kilo Code หลังจากแก้ไข

ไคลเอนต์ · Roo Code

Roo Code

เพิ่ม ContextStream ลงในการกำหนดค่า MCP ของ Roo Code คุณสามารถกำหนดค่าเซิร์ฟเวอร์ MCP ได้ทั้งแบบส่วนกลางหรือต่อโปรเจกต์:

ส่วนกลาง: คลิกไอคอนการตั้งค่า → Edit Global MCP เพื่อเปิด mcp_settings.json

โปรเจกต์: .roo/mcp.json ในไดเรกทอรีรากของโปรเจกต์

terminal · .roo/mcp.json (หรือ mcp_settings.json)

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

การกำหนดค่าระดับโปรเจกต์มีลำดับความสำคัญสูงกว่าการกำหนดค่าส่วนกลาง รีสตาร์ท Roo Code หลังจากแก้ไข

ไคลเอนต์ · Antigravity

Antigravity (Google)

Antigravity ใช้ไฟล์ .mcp.json ที่มีขอบเขตระดับโปรเจกต์ โดยมีรูปแบบเดียวกับ Cursor/Claude Desktop:

terminal · .mcp.json (ไดเรกทอรีรากของโปรเจกต์)

{
  "mcpServers": {
    "contextstream": {
      "command": "contextstream-mcp",
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

ผู้ใช้ Windows: ใช้ cmd wrapper

terminal · .mcp.json (Windows)

{
  "mcpServers": {
    "contextstream": {
      "command": "cmd",
      "args": ["/c", "contextstream-mcp"],
      "env": {
        "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
        "CONTEXTSTREAM_API_KEY": "your_api_key"
      }
    }
  }
}

ไฟล์กฎ

  • · ส่วนกลาง: ~/.gemini/GEMINI.md
  • · พื้นที่ทำงาน: .agent/rules/contextstream.md

เข้าถึงผ่านเมนู "..." → "MCP Servers" → "View raw config" เพื่อตรวจสอบการกำหนดค่าของคุณ รีสตาร์ท Antigravity หลังจากแก้ไข

กฎของตัวแก้ไข

ปรับปรุงการใช้ ContextStream อัตโนมัติ

แนะนำ

ฟีเจอร์ auto-context ของ ContextStream จะโหลดบริบทของพื้นที่ทำงานโดยอัตโนมัติเมื่อคุณใช้เครื่องมือ ContextStream ใดๆ อย่างไรก็ตาม ผู้ช่วย AI อาจไม่บันทึกการตัดสินใจหรือเรียกคืนบริบทในอดีตอย่างจริงจังเสมอไป การเพิ่มกฎ AI ของตัวแก้ไขจะช่วยปรับปรุงความสม่ำเสมอและทำให้แน่ใจว่า AI จะบันทึกการตัดสินใจ การตั้งค่า และบริบทที่สำคัญโดยอัตโนมัติตลอดการสนทนาของคุณ

สำคัญ: ข้อกำหนดการตั้งชื่อเครื่องมือ MCP

เครื่องมือ AI ที่แตกต่างกันใช้ข้อกำหนดการตั้งชื่อที่แตกต่างกันสำหรับเครื่องมือ MCP การใช้รูปแบบที่ไม่ถูกต้องจะทำให้ไม่พบเครื่องมือ

เครื่องมือ AIรูปแบบตัวอย่าง
Claude Codemcp____mcp__contextstream__session_init
Codex CLI / OpenCode CLI (ชื่อดิบ)session_init
Cursor / Windsurf / Cline (ชื่อดิบ)session_init
Kilo Code / Roo Code (ชื่อดิบ)session_init

สรุป: เฉพาะ Claude Code เท่านั้นที่ใช้คำนำหน้า mcp__contextstream__ เครื่องมืออื่นๆ ทั้งหมดใช้ชื่อเครื่องมือดิบ

คุณสามารถเพิ่มกฎ ContextStream ได้สองระดับ: ส่วนกลาง (ใช้กับทุกโปรเจกต์) หรือ โปรเจกต์ (ใช้กับหนึ่งโปรเจกต์)

กฎส่วนกลาง (ทุกโปรเจกต์)

เพิ่มกฎเหล่านี้เพียงครั้งเดียว แล้วกฎเหล่านี้จะใช้กับทุกโปรเจกต์โดยอัตโนมัติ:

ตัวแก้ไขตำแหน่งกฎส่วนกลาง
CursorSettings → General → Rules for AI
Windsurf~/.codeium/windsurf/memories/global_rules.md
Cline~/Documents/Cline/Rules/
Kilo Code~/.kilocode/rules/
Roo Code~/.roo/rules/
Claude Code~/.claude/CLAUDE.md
Codex CLI~/.codex/AGENTS.md (ส่วนกลาง) หรือโฟลเดอร์แม่ (เช่น ~/dev/AGENTS.md)
OpenCode CLI~/.config/opencode/AGENTS.md

กฎโปรเจกต์ (โปรเจกต์เดียว)

เพิ่มกฎเหล่านี้ลงในโปรเจกต์เฉพาะ สำหรับกฎแบบโฟลเดอร์ของ Cursor ให้ตั้งค่าโหมดการเปิดใช้งานเป็น "Always On" เพื่อให้กฎทำงานอยู่เสมอ

ตัวแก้ไขตำแหน่งกฎโปรเจกต์
Cursor.cursorrules หรือ .cursor/rules/*.mdc
Windsurf.windsurf/rules/contextstream.md
Clineไฟล์ .clinerules หรือโฟลเดอร์ .clinerules/
Kilo Code.kilocode/rules/
Roo Code.roo/rules/contextstream.md หรือโฟลเดอร์ .roo/rules/
Claude CodeCLAUDE.md ในไดเรกทอรีรากของโปรเจกต์
Codex CLIAGENTS.md ในไดเรกทอรีรากของโปรเจกต์
OpenCode CLIAGENTS.md ในไดเรกทอรีรากของโปรเจกต์
Aider.aider.conf.yml ในไดเรกทอรีรากของโปรเจกต์

โหมดการเปิดใช้งาน (Cursor, Kilo Code และ Roo Code)

เมื่อใช้กฎแบบโฟลเดอร์ (เช่น .cursor/rules/) ไฟล์กฎแต่ละไฟล์จะมีโหมดการเปิดใช้งาน:

  • Always On — ทำงานเสมอ (แนะนำสำหรับ ContextStream)
  • Manual — เฉพาะเมื่อคุณ @mention กฎ
  • Model Decision — AI ตัดสินใจตามคำอธิบาย
  • Glob — ทำงานสำหรับรูปแบบไฟล์ที่ตรงกัน

กฎส่วนกลางและไฟล์ระดับราก (.cursorrules) จะทำงานเสมอ

ต้องการใช้ตัวช่วยสร้างการตั้งค่าหรือไม่? เรียกใช้ก่อน มิฉะนั้น ให้เพิ่มกฎมาตรฐานเหล่านี้ด้วยตนเอง ตัวอย่างสำหรับแต่ละตัวแก้ไข:

Claude Code

สร้างไฟล์ CLAUDE.md ในไดเรกทอรีรากของโปรเจกต์ หรือเพิ่มลงใน ~/.claude/CLAUDE.md ส่วนกลางของคุณ:

terminal · CLAUDE.md (มาตรฐาน)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `mcp__contextstream__search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `mcp__contextstream__context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x (Hooks Enforced)

Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

### Required Every Message

| Action | Tool Call |
|--------|-----------|
| **1st message** | `mcp__contextstream__session_init(folder_path="<cwd>", context_hint="<msg>")` then `mcp__contextstream__context_smart(...)` |
| **2nd+ messages** | `mcp__contextstream__context_smart(user_message="<msg>", format="minified", max_tokens=400)` |
| **Code search** | `mcp__contextstream__search(mode="hybrid", query="...")` — BEFORE any local tools |
| **Save decisions** | `mcp__contextstream__session(action="capture", event_type="decision", ...)` |

### Search Modes

| Mode | Use Case |
|------|----------|
| `hybrid` | General code mcp__contextstream__search (default) |
| `keyword` | Exact symbol/string match |
| `exhaustive` | Find ALL matches (grep-like) |
| `semantic` | Conceptual questions |

### Why ContextStream First?

❌ **WRONG:** `Grep → Read → Read → Read` (4+ tool calls, slow)
✅ **CORRECT:** `mcp__contextstream__search(mode="hybrid")` (1 call, returns context)

ContextStream search is **indexed** and returns semantic matches + context in ONE call.

### Quick Reference

| Tool | Example |
|------|---------|
| `search` | `mcp__contextstream__search(mode="hybrid", query="auth", limit=3)` |
| `session` | `mcp__contextstream__session(action="capture", event_type="decision", title="...", content="...")` |
| `memory` | `mcp__contextstream__memory(action="list_events", limit=10)` |
| `graph` | `mcp__contextstream__graph(action="dependencies", file_path="...")` |

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `mcp__contextstream__session(action="get_lessons", query="<topic>")`
- On mistakes: `mcp__contextstream__session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

### Plans & Tasks

When user asks for a plan, use ContextStream (not EnterPlanMode):
1. `mcp__contextstream__session(action="capture_plan", title="...", steps=[...])`
2. `mcp__contextstream__memory(action="create_task", title="...", plan_id="<id>")`

Full docs: https://contextstream.io/docs/mcp/tools

แสดงกฎขั้นสูง (verbose)

terminal · CLAUDE.md (ขั้นสูง)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `mcp__contextstream__search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `mcp__contextstream__context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x Integration (Enhanced)

You have access to ContextStream MCP tools for persistent memory and context.
v0.4.x uses **~11 consolidated domain tools** for ~75% token reduction vs previous versions.
Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

## TL;DR - REQUIRED EVERY MESSAGE

| Message | What to Call |
|---------|--------------|
| **1st message** | `mcp__contextstream__session_init(folder_path="...", context_hint="<user's message>")`, then `mcp__contextstream__context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **2nd+ messages** | `mcp__contextstream__context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **🔍 ANY code search** | `mcp__contextstream__search(mode="hybrid", query="...")` — ALWAYS before Glob/Grep/Search/Read |
| **Before risky/non-trivial work** | `mcp__contextstream__session(action="get_lessons", query="<topic>")` |
| **After completing task** | `mcp__contextstream__session(action="capture", event_type="decision", ...)` - MUST capture |
| **User frustration/correction** | `mcp__contextstream__session(action="capture_lesson", ...)` - MUST capture lessons |

**NO EXCEPTIONS.** Do not skip even if you think you have enough context.

**First message rule:** After `session_init`, always call `context_smart` before any other tool or response.

**Context Pack (Pro+):** If enabled, use `mcp__contextstream__context_smart(..., mode="pack", distill=true)` for code/file queries. If unavailable or disabled, omit `mode` and proceed with standard `context_smart` (the API will fall back).

**Tool naming:** Use the exact tool names exposed by your MCP client. Claude Code typically uses `mcp__<server>__<tool>` where `<server>` matches your MCP config (often `contextstream`). If a tool call fails with "No such tool available", refresh rules and match the tool list.

---

## Consolidated Domain Tools Architecture

v0.4.x consolidates ~58 individual tools into ~11 domain tools with action/mode dispatch:

### Standalone Tools (Always Call)
- **`session_init`** - Initialize session with workspace detection + context
- **`context_smart`** - Semantic search for relevant context (CALL EVERY MESSAGE, including immediately after `session_init`)

### Domain Tools (Use action/mode parameter)

| Domain | Actions/Modes | Example |
|--------|---------------|---------|
| **`search`** | mode: semantic, hybrid, keyword, pattern, exhaustive, refactor | `mcp__contextstream__search(mode="hybrid", query="auth implementation", limit=3)` |
| **`session`** | action: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace | `mcp__contextstream__session(action="capture", event_type="decision", title="Use JWT", content="...")` |
| **`memory`** | action: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary | `mcp__contextstream__memory(action="list_events", limit=10)` |
| **`graph`** | action: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions | `mcp__contextstream__graph(action="impact", symbol_name="AuthService")` |
| **`project`** | action: list, get, create, update, index, overview, statistics, files, index_status, ingest_local | `mcp__contextstream__project(action="statistics")` |
| **`workspace`** | action: list, get, associate, bootstrap | `mcp__contextstream__workspace(action="list")` |
| **`reminder`** | action: list, active, create, snooze, complete, dismiss | `mcp__contextstream__reminder(action="active")` |
| **`integration`** | provider: slack/github/all; action: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues | `mcp__contextstream__integration(provider="github", action="search", query="...")` |
| **`help`** | action: tools, auth, version, editor_rules, enable_bundle | `mcp__contextstream__help(action="tools")` |

---

### Why context_smart is Required (Even After session_init)

**Common mistake:** "session_init already gave me context, I don't need context_smart"

**This is WRONG. Here's why:**
- `session_init` returns the last ~10 items **BY TIME** (chronological)
- `context_smart` **SEARCHES** for items **RELEVANT to THIS message** (semantic)

**Example failure:**
- User asks: "how should I implement authentication?"
- Auth decisions were made 20 conversations ago
- `session_init` won't have it (too old, not in recent 10)
- `context_smart` FINDS it via semantic search

**Without context_smart, you WILL miss relevant older context.**

---

### Search & Code Intelligence (ContextStream-first)

⚠️ **STOP: Before using Search/Glob/Grep/Read/Explore** → Call `mcp__contextstream__search(mode="hybrid")` FIRST. Use local tools ONLY if ContextStream returns 0 results.

**❌ WRONG workflow (wastes tokens, slow):**

Grep "function" → Read file1.ts → Read file2.ts → Read file3.ts → ในที่สุดก็เข้าใจ


**✅ CORRECT workflow (fast, complete):**

mcp__contextstream__search(mode="hybrid", query="function implementation") → เสร็จสิ้น (ผลลัพธ์รวมถึงบริบท)


**Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.

**Search Mode Selection:**

| Need | Mode | Example |
|------|------|---------|
| Find code by meaning | `hybrid` | "authentication logic", "error handling" |
| Exact string/symbol | `keyword` | "UserAuthService", "API_KEY" |
| File patterns | `pattern` | "*.sql", "test_*.py" |
| ALL matches (grep-like) | `exhaustive` | "TODO", "FIXME" (find all occurrences) |
| Symbol renaming | `refactor` | "oldFunctionName" (word-boundary matching) |
| Conceptual search | `semantic` | "how does caching work" |

**Token Efficiency:** Use `output_format` to reduce response size:
- `full` (default): Full content for understanding code
- `paths`: File paths only (80% token savings) - use for file listings
- `minimal`: Compact format (60% savings) - use for refactoring
- `count`: Match counts only (90% savings) - use for quick checks

---

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `mcp__contextstream__session(action="get_lessons", query="<topic>")`
- On mistakes: `mcp__contextstream__session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

---

### Plans & Tasks

When user asks to create a plan or implementation roadmap:
1. Create plan: `mcp__contextstream__session(action="capture_plan", title="Plan Title", description="...", goals=["goal1", "goal2"], steps=[{id: "1", title: "Step 1", order: 1}, ...])`
2. Get plan_id from response, then create tasks: `mcp__contextstream__memory(action="create_task", title="Task Title", plan_id="<plan_id>", priority="high|medium|low", description="...")`

To manage existing plans/tasks:
- List plans: `mcp__contextstream__session(action="list_plans")`
- Get plan with tasks: `mcp__contextstream__session(action="get_plan", plan_id="<uuid>", include_tasks=true)`
- List tasks: `mcp__contextstream__memory(action="list_tasks", plan_id="<uuid>")` or `mcp__contextstream__memory(action="list_tasks")` for all
- Update task status: `mcp__contextstream__memory(action="update_task", task_id="<uuid>", task_status="pending|in_progress|completed|blocked")`

---

### Rules Update Notices

- If you see **[RULES_NOTICE]**, update rules via `mcp__contextstream__generate_rules(overwrite_existing=true)` (preserves custom rules).
- If you see **[VERSION_NOTICE]**, tell the user to update MCP using the provided command.

See full documentation: https://contextstream.io/docs/mcp/tools

Codex CLI / OpenCode CLI

สร้างไฟล์ AGENTS.md ในไดเรกทอรีรากของโปรเจกต์ (กฎโปรเจกต์) หรือใน ~/.codex/AGENTS.md (Codex ส่วนกลาง) / ~/.config/opencode/AGENTS.md (OpenCode ส่วนกลาง):

ชื่อเครื่องมือ Codex / OpenCode เทียบกับ Claude

Codex / OpenCode ใช้ชื่อเครื่องมือ MCP ดิบ (เช่น session_init) Claude Code ใช้ชื่อเครื่องมือแบบมีเนมสเปซ (เช่น mcp__contextstream__session_init) ใช้รูปแบบที่ถูกต้องสำหรับเครื่องมือ AI ของคุณ

terminal · AGENTS.md (มาตรฐาน)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x (Hooks Enforced)

Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

### Required Every Message

| Action | Tool Call |
|--------|-----------|
| **1st message** | `session_init(folder_path="<cwd>", context_hint="<msg>")` then `context_smart(...)` |
| **2nd+ messages** | `context_smart(user_message="<msg>", format="minified", max_tokens=400)` |
| **Code search** | `search(mode="hybrid", query="...")` — BEFORE any local tools |
| **Save decisions** | `session(action="capture", event_type="decision", ...)` |

### Search Modes

| Mode | Use Case |
|------|----------|
| `hybrid` | General code search (default) |
| `keyword` | Exact symbol/string match |
| `exhaustive` | Find ALL matches (grep-like) |
| `semantic` | Conceptual questions |

### Why ContextStream First?

❌ **WRONG:** `Grep → Read → Read → Read` (4+ tool calls, slow)
✅ **CORRECT:** `search(mode="hybrid")` (1 call, returns context)

ContextStream search is **indexed** and returns semantic matches + context in ONE call.

### Quick Reference

| Tool | Example |
|------|---------|
| `search` | `search(mode="hybrid", query="auth", limit=3)` |
| `session` | `session(action="capture", event_type="decision", title="...", content="...")` |
| `memory` | `memory(action="list_events", limit=10)` |
| `graph` | `graph(action="dependencies", file_path="...")` |

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

### Plans & Tasks

When user asks for a plan, use ContextStream (not EnterPlanMode):
1. `session(action="capture_plan", title="...", steps=[...])`
2. `memory(action="create_task", title="...", plan_id="<id>")`

Full docs: https://contextstream.io/docs/mcp/tools

แสดงกฎขั้นสูง (verbose)

terminal · AGENTS.md (ขั้นสูง)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x Integration (Enhanced)

You have access to ContextStream MCP tools for persistent memory and context.
v0.4.x uses **~11 consolidated domain tools** for ~75% token reduction vs previous versions.
Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

## TL;DR - REQUIRED EVERY MESSAGE

| Message | What to Call |
|---------|--------------|
| **1st message** | `session_init(folder_path="...", context_hint="<user's message>")`, then `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **2nd+ messages** | `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **🔍 ANY code search** | `search(mode="hybrid", query="...")` — ALWAYS before Glob/Grep/Search/Read |
| **Before risky/non-trivial work** | `session(action="get_lessons", query="<topic>")` |
| **After completing task** | `session(action="capture", event_type="decision", ...)` - MUST capture |
| **User frustration/correction** | `session(action="capture_lesson", ...)` - MUST capture lessons |

**NO EXCEPTIONS.** Do not skip even if you think you have enough context.

**First message rule:** After `session_init`, always call `context_smart` before any other tool or response.

**Context Pack (Pro+):** If enabled, use `context_smart(..., mode="pack", distill=true)` for code/file queries. If unavailable or disabled, omit `mode` and proceed with standard `context_smart` (the API will fall back).

**Tool naming:** Use the exact tool names exposed by your MCP client. Claude Code typically uses `mcp__<server>__<tool>` where `<server>` matches your MCP config (often `contextstream`). If a tool call fails with "No such tool available", refresh rules and match the tool list.

---

## Consolidated Domain Tools Architecture

v0.4.x consolidates ~58 individual tools into ~11 domain tools with action/mode dispatch:

### Standalone Tools (Always Call)
- **`session_init`** - Initialize session with workspace detection + context
- **`context_smart`** - Semantic search for relevant context (CALL EVERY MESSAGE, including immediately after `session_init`)

### Domain Tools (Use action/mode parameter)

| Domain | Actions/Modes | Example |
|--------|---------------|---------|
| **`search`** | mode: semantic, hybrid, keyword, pattern, exhaustive, refactor | `search(mode="hybrid", query="auth implementation", limit=3)` |
| **`session`** | action: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace | `session(action="capture", event_type="decision", title="Use JWT", content="...")` |
| **`memory`** | action: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary | `memory(action="list_events", limit=10)` |
| **`graph`** | action: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions | `graph(action="impact", symbol_name="AuthService")` |
| **`project`** | action: list, get, create, update, index, overview, statistics, files, index_status, ingest_local | `project(action="statistics")` |
| **`workspace`** | action: list, get, associate, bootstrap | `workspace(action="list")` |
| **`reminder`** | action: list, active, create, snooze, complete, dismiss | `reminder(action="active")` |
| **`integration`** | provider: slack/github/all; action: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues | `integration(provider="github", action="search", query="...")` |
| **`help`** | action: tools, auth, version, editor_rules, enable_bundle | `help(action="tools")` |

---

### Why context_smart is Required (Even After session_init)

**Common mistake:** "session_init already gave me context, I don't need context_smart"

**This is WRONG. Here's why:**
- `session_init` returns the last ~10 items **BY TIME** (chronological)
- `context_smart` **SEARCHES** for items **RELEVANT to THIS message** (semantic)

**Example failure:**
- User asks: "how should I implement authentication?"
- Auth decisions were made 20 conversations ago
- `session_init` won't have it (too old, not in recent 10)
- `context_smart` FINDS it via semantic search

**Without context_smart, you WILL miss relevant older context.**

---

### Search & Code Intelligence (ContextStream-first)

⚠️ **STOP: Before using Search/Glob/Grep/Read/Explore** → Call `search(mode="hybrid")` FIRST. Use local tools ONLY if ContextStream returns 0 results.

**❌ WRONG workflow (wastes tokens, slow):**

Grep "function" → Read file1.ts → Read file2.ts → Read file3.ts → ในที่สุดก็เข้าใจ


**✅ CORRECT workflow (fast, complete):**

search(mode="hybrid", query="function implementation") → เสร็จสิ้น (ผลลัพธ์รวมถึงบริบท)


**Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.

**Search Mode Selection:**

| Need | Mode | Example |
|------|------|---------|
| Find code by meaning | `hybrid` | "authentication logic", "error handling" |
| Exact string/symbol | `keyword` | "UserAuthService", "API_KEY" |
| File patterns | `pattern` | "*.sql", "test_*.py" |
| ALL matches (grep-like) | `exhaustive` | "TODO", "FIXME" (find all occurrences) |
| Symbol renaming | `refactor` | "oldFunctionName" (word-boundary matching) |
| Conceptual search | `semantic` | "how does caching work" |

**Token Efficiency:** Use `output_format` to reduce response size:
- `full` (default): Full content for understanding code
- `paths`: File paths only (80% token savings) - use for file listings
- `minimal`: Compact format (60% savings) - use for refactoring
- `count`: Match counts only (90% savings) - use for quick checks

---

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

---

### Plans & Tasks

When user asks to create a plan or implementation roadmap:
1. Create plan: `session(action="capture_plan", title="Plan Title", description="...", goals=["goal1", "goal2"], steps=[{id: "1", title: "Step 1", order: 1}, ...])`
2. Get plan_id from response, then create tasks: `memory(action="create_task", title="Task Title", plan_id="<plan_id>", priority="high|medium|low", description="...")`

To manage existing plans/tasks:
- List plans: `session(action="list_plans")`
- Get plan with tasks: `session(action="get_plan", plan_id="<uuid>", include_tasks=true)`
- List tasks: `memory(action="list_tasks", plan_id="<uuid>")` or `memory(action="list_tasks")` for all
- Update task status: `memory(action="update_task", task_id="<uuid>", task_status="pending|in_progress|completed|blocked")`

---

### Rules Update Notices

- If you see **[RULES_NOTICE]**, update rules via `generate_rules(overwrite_existing=true)` (preserves custom rules).
- If you see **[VERSION_NOTICE]**, tell the user to update MCP using the provided command.

See full documentation: https://contextstream.io/docs/mcp/tools

Windsurf

สร้างไฟล์ .windsurf/rules/contextstream.md ในไดเรกทอรีรากของโปรเจกต์ หรือเพิ่มลงใน ~/.codeium/windsurf/memories/global_rules.md ส่วนกลางของคุณ:

terminal · .windsurf/rules/contextstream.md (มาตรฐาน)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x (Hooks Enforced)

Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

### Required Every Message

| Action | Tool Call |
|--------|-----------|
| **1st message** | `session_init(folder_path="<cwd>", context_hint="<msg>")` then `context_smart(...)` |
| **2nd+ messages** | `context_smart(user_message="<msg>", format="minified", max_tokens=400)` |
| **Code search** | `search(mode="hybrid", query="...")` — BEFORE any local tools |
| **Save decisions** | `session(action="capture", event_type="decision", ...)` |

### Search Modes

| Mode | Use Case |
|------|----------|
| `hybrid` | General code search (default) |
| `keyword` | Exact symbol/string match |
| `exhaustive` | Find ALL matches (grep-like) |
| `semantic` | Conceptual questions |

### Why ContextStream First?

❌ **WRONG:** `Grep → Read → Read → Read` (4+ tool calls, slow)
✅ **CORRECT:** `search(mode="hybrid")` (1 call, returns context)

ContextStream search is **indexed** and returns semantic matches + context in ONE call.

### Quick Reference

| Tool | Example |
|------|---------|
| `search` | `search(mode="hybrid", query="auth", limit=3)` |
| `session` | `session(action="capture", event_type="decision", title="...", content="...")` |
| `memory` | `memory(action="list_events", limit=10)` |
| `graph` | `graph(action="dependencies", file_path="...")` |

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

### Plans & Tasks

When user asks for a plan, use ContextStream (not EnterPlanMode):
1. `session(action="capture_plan", title="...", steps=[...])`
2. `memory(action="create_task", title="...", plan_id="<id>")`

Full docs: https://contextstream.io/docs/mcp/tools

แสดงกฎขั้นสูง (verbose)

terminal · .windsurf/rules/contextstream.md (ขั้นสูง)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x Integration (Enhanced)

You have access to ContextStream MCP tools for persistent memory and context.
v0.4.x uses **~11 consolidated domain tools** for ~75% token reduction vs previous versions.
Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

## TL;DR - REQUIRED EVERY MESSAGE

| Message | What to Call |
|---------|--------------|
| **1st message** | `session_init(folder_path="...", context_hint="<user's message>")`, then `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **2nd+ messages** | `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **🔍 ANY code search** | `search(mode="hybrid", query="...")` — ALWAYS before Glob/Grep/Search/Read |
| **Before risky/non-trivial work** | `session(action="get_lessons", query="<topic>")` |
| **After completing task** | `session(action="capture", event_type="decision", ...)` - MUST capture |
| **User frustration/correction** | `session(action="capture_lesson", ...)` - MUST capture lessons |

**NO EXCEPTIONS.** Do not skip even if you think you have enough context.

**First message rule:** After `session_init`, always call `context_smart` before any other tool or response.

**Context Pack (Pro+):** If enabled, use `context_smart(..., mode="pack", distill=true)` for code/file queries. If unavailable or disabled, omit `mode` and proceed with standard `context_smart` (the API will fall back).

**Tool naming:** Use the exact tool names exposed by your MCP client. Claude Code typically uses `mcp__<server>__<tool>` where `<server>` matches your MCP config (often `contextstream`). If a tool call fails with "No such tool available", refresh rules and match the tool list.

---

## Consolidated Domain Tools Architecture

v0.4.x consolidates ~58 individual tools into ~11 domain tools with action/mode dispatch:

### Standalone Tools (Always Call)
- **`session_init`** - Initialize session with workspace detection + context
- **`context_smart`** - Semantic search for relevant context (CALL EVERY MESSAGE, including immediately after `session_init`)

### Domain Tools (Use action/mode parameter)

| Domain | Actions/Modes | Example |
|--------|---------------|---------|
| **`search`** | mode: semantic, hybrid, keyword, pattern, exhaustive, refactor | `search(mode="hybrid", query="auth implementation", limit=3)` |
| **`session`** | action: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace | `session(action="capture", event_type="decision", title="Use JWT", content="...")` |
| **`memory`** | action: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary | `memory(action="list_events", limit=10)` |
| **`graph`** | action: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions | `graph(action="impact", symbol_name="AuthService")` |
| **`project`** | action: list, get, create, update, index, overview, statistics, files, index_status, ingest_local | `project(action="statistics")` |
| **`workspace`** | action: list, get, associate, bootstrap | `workspace(action="list")` |
| **`reminder`** | action: list, active, create, snooze, complete, dismiss | `reminder(action="active")` |
| **`integration`** | provider: slack/github/all; action: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues | `integration(provider="github", action="search", query="...")` |
| **`help`** | action: tools, auth, version, editor_rules, enable_bundle | `help(action="tools")` |

---

### Why context_smart is Required (Even After session_init)

**Common mistake:** "session_init already gave me context, I don't need context_smart"

**This is WRONG. Here's why:**
- `session_init` returns the last ~10 items **BY TIME** (chronological)
- `context_smart` **SEARCHES** for items **RELEVANT to THIS message** (semantic)

**Example failure:**
- User asks: "how should I implement authentication?"
- Auth decisions were made 20 conversations ago
- `session_init` won't have it (too old, not in recent 10)
- `context_smart` FINDS it via semantic search

**Without context_smart, you WILL miss relevant older context.**

---

### Search & Code Intelligence (ContextStream-first)

⚠️ **STOP: Before using Search/Glob/Grep/Read/Explore** → Call `search(mode="hybrid")` FIRST. Use local tools ONLY if ContextStream returns 0 results.

**❌ WRONG workflow (wastes tokens, slow):**

Grep "function" → Read file1.ts → Read file2.ts → Read file3.ts → ในที่สุดก็เข้าใจ


**✅ CORRECT workflow (fast, complete):**

search(mode="hybrid", query="function implementation") → เสร็จสิ้น (ผลลัพธ์รวมถึงบริบท)


**Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.

**Search Mode Selection:**

| Need | Mode | Example |
|------|------|---------|
| Find code by meaning | `hybrid` | "authentication logic", "error handling" |
| Exact string/symbol | `keyword` | "UserAuthService", "API_KEY" |
| File patterns | `pattern` | "*.sql", "test_*.py" |
| ALL matches (grep-like) | `exhaustive` | "TODO", "FIXME" (find all occurrences) |
| Symbol renaming | `refactor` | "oldFunctionName" (word-boundary matching) |
| Conceptual search | `semantic` | "how does caching work" |

**Token Efficiency:** Use `output_format` to reduce response size:
- `full` (default): Full content for understanding code
- `paths`: File paths only (80% token savings) - use for file listings
- `minimal`: Compact format (60% savings) - use for refactoring
- `count`: Match counts only (90% savings) - use for quick checks

---

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

---

### Plans & Tasks

When user asks to create a plan or implementation roadmap:
1. Create plan: `session(action="capture_plan", title="Plan Title", description="...", goals=["goal1", "goal2"], steps=[{id: "1", title: "Step 1", order: 1}, ...])`
2. Get plan_id from response, then create tasks: `memory(action="create_task", title="Task Title", plan_id="<plan_id>", priority="high|medium|low", description="...")`

To manage existing plans/tasks:
- List plans: `session(action="list_plans")`
- Get plan with tasks: `session(action="get_plan", plan_id="<uuid>", include_tasks=true)`
- List tasks: `memory(action="list_tasks", plan_id="<uuid>")` or `memory(action="list_tasks")` for all
- Update task status: `memory(action="update_task", task_id="<uuid>", task_status="pending|in_progress|completed|blocked")`

---

### Rules Update Notices

- If you see **[RULES_NOTICE]**, update rules via `generate_rules(overwrite_existing=true)` (preserves custom rules).
- If you see **[VERSION_NOTICE]**, tell the user to update MCP using the provided command.

See full documentation: https://contextstream.io/docs/mcp/tools

Kilo Code

สร้างไฟล์ Markdown ใน .kilocode/rules/:

terminal · .kilocode/rules/contextstream.md (มาตรฐาน)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x (Hooks Enforced)

Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

### Required Every Message

| Action | Tool Call |
|--------|-----------|
| **1st message** | `session_init(folder_path="<cwd>", context_hint="<msg>")` then `context_smart(...)` |
| **2nd+ messages** | `context_smart(user_message="<msg>", format="minified", max_tokens=400)` |
| **Code search** | `search(mode="hybrid", query="...")` — BEFORE any local tools |
| **Save decisions** | `session(action="capture", event_type="decision", ...)` |

### Search Modes

| Mode | Use Case |
|------|----------|
| `hybrid` | General code search (default) |
| `keyword` | Exact symbol/string match |
| `exhaustive` | Find ALL matches (grep-like) |
| `semantic` | Conceptual questions |

### Why ContextStream First?

❌ **WRONG:** `Grep → Read → Read → Read` (4+ tool calls, slow)
✅ **CORRECT:** `search(mode="hybrid")` (1 call, returns context)

ContextStream search is **indexed** and returns semantic matches + context in ONE call.

### Quick Reference

| Tool | Example |
|------|---------|
| `search` | `search(mode="hybrid", query="auth", limit=3)` |
| `session` | `session(action="capture", event_type="decision", title="...", content="...")` |
| `memory` | `memory(action="list_events", limit=10)` |
| `graph` | `graph(action="dependencies", file_path="...")` |

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

### Plans & Tasks

When user asks for a plan, use ContextStream (not EnterPlanMode):
1. `session(action="capture_plan", title="...", steps=[...])`
2. `memory(action="create_task", title="...", plan_id="<id>")`

Full docs: https://contextstream.io/docs/mcp/tools

แสดงกฎขั้นสูง (verbose)

terminal · .kilocode/rules/contextstream.md (ขั้นสูง)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x Integration (Enhanced)

You have access to ContextStream MCP tools for persistent memory and context.
v0.4.x uses **~11 consolidated domain tools** for ~75% token reduction vs previous versions.
Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

## TL;DR - REQUIRED EVERY MESSAGE

| Message | What to Call |
|---------|--------------|
| **1st message** | `session_init(folder_path="...", context_hint="<user's message>")`, then `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **2nd+ messages** | `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **🔍 ANY code search** | `search(mode="hybrid", query="...")` — ALWAYS before Glob/Grep/Search/Read |
| **Before risky/non-trivial work** | `session(action="get_lessons", query="<topic>")` |
| **After completing task** | `session(action="capture", event_type="decision", ...)` - MUST capture |
| **User frustration/correction** | `session(action="capture_lesson", ...)` - MUST capture lessons |

**NO EXCEPTIONS.** Do not skip even if you think you have enough context.

**First message rule:** After `session_init`, always call `context_smart` before any other tool or response.

**Context Pack (Pro+):** If enabled, use `context_smart(..., mode="pack", distill=true)` for code/file queries. If unavailable or disabled, omit `mode` and proceed with standard `context_smart` (the API will fall back).

**Tool naming:** Use the exact tool names exposed by your MCP client. Claude Code typically uses `mcp__<server>__<tool>` where `<server>` matches your MCP config (often `contextstream`). If a tool call fails with "No such tool available", refresh rules and match the tool list.

---

## Consolidated Domain Tools Architecture

v0.4.x consolidates ~58 individual tools into ~11 domain tools with action/mode dispatch:

### Standalone Tools (Always Call)
- **`session_init`** - Initialize session with workspace detection + context
- **`context_smart`** - Semantic search for relevant context (CALL EVERY MESSAGE, including immediately after `session_init`)

### Domain Tools (Use action/mode parameter)

| Domain | Actions/Modes | Example |
|--------|---------------|---------|
| **`search`** | mode: semantic, hybrid, keyword, pattern, exhaustive, refactor | `search(mode="hybrid", query="auth implementation", limit=3)` |
| **`session`** | action: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace | `session(action="capture", event_type="decision", title="Use JWT", content="...")` |
| **`memory`** | action: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary | `memory(action="list_events", limit=10)` |
| **`graph`** | action: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions | `graph(action="impact", symbol_name="AuthService")` |
| **`project`** | action: list, get, create, update, index, overview, statistics, files, index_status, ingest_local | `project(action="statistics")` |
| **`workspace`** | action: list, get, associate, bootstrap | `workspace(action="list")` |
| **`reminder`** | action: list, active, create, snooze, complete, dismiss | `reminder(action="active")` |
| **`integration`** | provider: slack/github/all; action: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues | `integration(provider="github", action="search", query="...")` |
| **`help`** | action: tools, auth, version, editor_rules, enable_bundle | `help(action="tools")` |

---

### Why context_smart is Required (Even After session_init)

**Common mistake:** "session_init already gave me context, I don't need context_smart"

**This is WRONG. Here's why:**
- `session_init` returns the last ~10 items **BY TIME** (chronological)
- `context_smart` **SEARCHES** for items **RELEVANT to THIS message** (semantic)

**Example failure:**
- User asks: "how should I implement authentication?"
- Auth decisions were made 20 conversations ago
- `session_init` won't have it (too old, not in recent 10)
- `context_smart` FINDS it via semantic search

**Without context_smart, you WILL miss relevant older context.**

---

### Search & Code Intelligence (ContextStream-first)

⚠️ **STOP: Before using Search/Glob/Grep/Read/Explore** → Call `search(mode="hybrid")` FIRST. Use local tools ONLY if ContextStream returns 0 results.

**❌ WRONG workflow (wastes tokens, slow):**

Grep "function" → Read file1.ts → Read file2.ts → Read file3.ts → ในที่สุดก็เข้าใจ


**✅ CORRECT workflow (fast, complete):**

search(mode="hybrid", query="function implementation") → เสร็จสิ้น (ผลลัพธ์รวมถึงบริบท)


**Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.

**Search Mode Selection:**

| Need | Mode | Example |
|------|------|---------|
| Find code by meaning | `hybrid` | "authentication logic", "error handling" |
| Exact string/symbol | `keyword` | "UserAuthService", "API_KEY" |
| File patterns | `pattern` | "*.sql", "test_*.py" |
| ALL matches (grep-like) | `exhaustive` | "TODO", "FIXME" (find all occurrences) |
| Symbol renaming | `refactor` | "oldFunctionName" (word-boundary matching) |
| Conceptual search | `semantic` | "how does caching work" |

**Token Efficiency:** Use `output_format` to reduce response size:
- `full` (default): Full content for understanding code
- `paths`: File paths only (80% token savings) - use for file listings
- `minimal`: Compact format (60% savings) - use for refactoring
- `count`: Match counts only (90% savings) - use for quick checks

---

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

---

### Plans & Tasks

When user asks to create a plan or implementation roadmap:
1. Create plan: `session(action="capture_plan", title="Plan Title", description="...", goals=["goal1", "goal2"], steps=[{id: "1", title: "Step 1", order: 1}, ...])`
2. Get plan_id from response, then create tasks: `memory(action="create_task", title="Task Title", plan_id="<plan_id>", priority="high|medium|low", description="...")`

To manage existing plans/tasks:
- List plans: `session(action="list_plans")`
- Get plan with tasks: `session(action="get_plan", plan_id="<uuid>", include_tasks=true)`
- List tasks: `memory(action="list_tasks", plan_id="<uuid>")` or `memory(action="list_tasks")` for all
- Update task status: `memory(action="update_task", task_id="<uuid>", task_status="pending|in_progress|completed|blocked")`

---

### Rules Update Notices

- If you see **[RULES_NOTICE]**, update rules via `generate_rules(overwrite_existing=true)` (preserves custom rules).
- If you see **[VERSION_NOTICE]**, tell the user to update MCP using the provided command.

See full documentation: https://contextstream.io/docs/mcp/tools

Cline

สร้างไฟล์ .clinerules ในไดเรกทอรีรากของโปรเจกต์ หรือใช้โฟลเดอร์ .clinerules/:

terminal · .clinerules (มาตรฐาน)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x (Hooks Enforced)

Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

### Required Every Message

| Action | Tool Call |
|--------|-----------|
| **1st message** | `session_init(folder_path="<cwd>", context_hint="<msg>")` then `context_smart(...)` |
| **2nd+ messages** | `context_smart(user_message="<msg>", format="minified", max_tokens=400)` |
| **Code search** | `search(mode="hybrid", query="...")` — BEFORE any local tools |
| **Save decisions** | `session(action="capture", event_type="decision", ...)` |

### Search Modes

| Mode | Use Case |
|------|----------|
| `hybrid` | General code search (default) |
| `keyword` | Exact symbol/string match |
| `exhaustive` | Find ALL matches (grep-like) |
| `semantic` | Conceptual questions |

### Why ContextStream First?

❌ **WRONG:** `Grep → Read → Read → Read` (4+ tool calls, slow)
✅ **CORRECT:** `search(mode="hybrid")` (1 call, returns context)

ContextStream search is **indexed** and returns semantic matches + context in ONE call.

### Quick Reference

| Tool | Example |
|------|---------|
| `search` | `search(mode="hybrid", query="auth", limit=3)` |
| `session` | `session(action="capture", event_type="decision", title="...", content="...")` |
| `memory` | `memory(action="list_events", limit=10)` |
| `graph` | `graph(action="dependencies", file_path="...")` |

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

### Plans & Tasks

When user asks for a plan, use ContextStream (not EnterPlanMode):
1. `session(action="capture_plan", title="...", steps=[...])`
2. `memory(action="create_task", title="...", plan_id="<id>")`

Full docs: https://contextstream.io/docs/mcp/tools

แสดงกฎขั้นสูง (verbose)

terminal · .clinerules (ขั้นสูง)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x Integration (Enhanced)

You have access to ContextStream MCP tools for persistent memory and context.
v0.4.x uses **~11 consolidated domain tools** for ~75% token reduction vs previous versions.
Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

## TL;DR - REQUIRED EVERY MESSAGE

| Message | What to Call |
|---------|--------------|
| **1st message** | `session_init(folder_path="...", context_hint="<user's message>")`, then `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **2nd+ messages** | `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **🔍 ANY code search** | `search(mode="hybrid", query="...")` — ALWAYS before Glob/Grep/Search/Read |
| **Before risky/non-trivial work** | `session(action="get_lessons", query="<topic>")` |
| **After completing task** | `session(action="capture", event_type="decision", ...)` - MUST capture |
| **User frustration/correction** | `session(action="capture_lesson", ...)` - MUST capture lessons |

**NO EXCEPTIONS.** Do not skip even if you think you have enough context.

**First message rule:** After `session_init`, always call `context_smart` before any other tool or response.

**Context Pack (Pro+):** If enabled, use `context_smart(..., mode="pack", distill=true)` for code/file queries. If unavailable or disabled, omit `mode` and proceed with standard `context_smart` (the API will fall back).

**Tool naming:** Use the exact tool names exposed by your MCP client. Claude Code typically uses `mcp__<server>__<tool>` where `<server>` matches your MCP config (often `contextstream`). If a tool call fails with "No such tool available", refresh rules and match the tool list.

---

## Consolidated Domain Tools Architecture

v0.4.x consolidates ~58 individual tools into ~11 domain tools with action/mode dispatch:

### Standalone Tools (Always Call)
- **`session_init`** - Initialize session with workspace detection + context
- **`context_smart`** - Semantic search for relevant context (CALL EVERY MESSAGE, including immediately after `session_init`)

### Domain Tools (Use action/mode parameter)

| Domain | Actions/Modes | Example |
|--------|---------------|---------|
| **`search`** | mode: semantic, hybrid, keyword, pattern, exhaustive, refactor | `search(mode="hybrid", query="auth implementation", limit=3)` |
| **`session`** | action: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace | `session(action="capture", event_type="decision", title="Use JWT", content="...")` |
| **`memory`** | action: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary | `memory(action="list_events", limit=10)` |
| **`graph`** | action: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions | `graph(action="impact", symbol_name="AuthService")` |
| **`project`** | action: list, get, create, update, index, overview, statistics, files, index_status, ingest_local | `project(action="statistics")` |
| **`workspace`** | action: list, get, associate, bootstrap | `workspace(action="list")` |
| **`reminder`** | action: list, active, create, snooze, complete, dismiss | `reminder(action="active")` |
| **`integration`** | provider: slack/github/all; action: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues | `integration(provider="github", action="search", query="...")` |
| **`help`** | action: tools, auth, version, editor_rules, enable_bundle | `help(action="tools")` |

---

### Why context_smart is Required (Even After session_init)

**Common mistake:** "session_init already gave me context, I don't need context_smart"

**This is WRONG. Here's why:**
- `session_init` returns the last ~10 items **BY TIME** (chronological)
- `context_smart` **SEARCHES** for items **RELEVANT to THIS message** (semantic)

**Example failure:**
- User asks: "how should I implement authentication?"
- Auth decisions were made 20 conversations ago
- `session_init` won't have it (too old, not in recent 10)
- `context_smart` FINDS it via semantic search

**Without context_smart, you WILL miss relevant older context.**

---

### Search & Code Intelligence (ContextStream-first)

⚠️ **STOP: Before using Search/Glob/Grep/Read/Explore** → Call `search(mode="hybrid")` FIRST. Use local tools ONLY if ContextStream returns 0 results.

**❌ WRONG workflow (wastes tokens, slow):**

Grep "function" → Read file1.ts → Read file2.ts → Read file3.ts → ในที่สุดก็เข้าใจ


**✅ CORRECT workflow (fast, complete):**

search(mode="hybrid", query="function implementation") → เสร็จสิ้น (ผลลัพธ์รวมถึงบริบท)


**Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.

**Search Mode Selection:**

| Need | Mode | Example |
|------|------|---------|
| Find code by meaning | `hybrid` | "authentication logic", "error handling" |
| Exact string/symbol | `keyword` | "UserAuthService", "API_KEY" |
| File patterns | `pattern` | "*.sql", "test_*.py" |
| ALL matches (grep-like) | `exhaustive` | "TODO", "FIXME" (find all occurrences) |
| Symbol renaming | `refactor` | "oldFunctionName" (word-boundary matching) |
| Conceptual search | `semantic` | "how does caching work" |

**Token Efficiency:** Use `output_format` to reduce response size:
- `full` (default): Full content for understanding code
- `paths`: File paths only (80% token savings) - use for file listings
- `minimal`: Compact format (60% savings) - use for refactoring
- `count`: Match counts only (90% savings) - use for quick checks

---

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

---

### Plans & Tasks

When user asks to create a plan or implementation roadmap:
1. Create plan: `session(action="capture_plan", title="Plan Title", description="...", goals=["goal1", "goal2"], steps=[{id: "1", title: "Step 1", order: 1}, ...])`
2. Get plan_id from response, then create tasks: `memory(action="create_task", title="Task Title", plan_id="<plan_id>", priority="high|medium|low", description="...")`

To manage existing plans/tasks:
- List plans: `session(action="list_plans")`
- Get plan with tasks: `session(action="get_plan", plan_id="<uuid>", include_tasks=true)`
- List tasks: `memory(action="list_tasks", plan_id="<uuid>")` or `memory(action="list_tasks")` for all
- Update task status: `memory(action="update_task", task_id="<uuid>", task_status="pending|in_progress|completed|blocked")`

---

### Rules Update Notices

- If you see **[RULES_NOTICE]**, update rules via `generate_rules(overwrite_existing=true)` (preserves custom rules).
- If you see **[VERSION_NOTICE]**, tell the user to update MCP using the provided command.

See full documentation: https://contextstream.io/docs/mcp/tools

Roo Code

สร้างไฟล์ .roo/rules/contextstream.md หรือใช้โฟลเดอร์ .roo/rules/:

terminal · .roo/rules/contextstream.md (มาตรฐาน)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x (Hooks Enforced)

Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

### Required Every Message

| Action | Tool Call |
|--------|-----------|
| **1st message** | `session_init(folder_path="<cwd>", context_hint="<msg>")` then `context_smart(...)` |
| **2nd+ messages** | `context_smart(user_message="<msg>", format="minified", max_tokens=400)` |
| **Code search** | `search(mode="hybrid", query="...")` — BEFORE any local tools |
| **Save decisions** | `session(action="capture", event_type="decision", ...)` |

### Search Modes

| Mode | Use Case |
|------|----------|
| `hybrid` | General code search (default) |
| `keyword` | Exact symbol/string match |
| `exhaustive` | Find ALL matches (grep-like) |
| `semantic` | Conceptual questions |

### Why ContextStream First?

❌ **WRONG:** `Grep → Read → Read → Read` (4+ tool calls, slow)
✅ **CORRECT:** `search(mode="hybrid")` (1 call, returns context)

ContextStream search is **indexed** and returns semantic matches + context in ONE call.

### Quick Reference

| Tool | Example |
|------|---------|
| `search` | `search(mode="hybrid", query="auth", limit=3)` |
| `session` | `session(action="capture", event_type="decision", title="...", content="...")` |
| `memory` | `memory(action="list_events", limit=10)` |
| `graph` | `graph(action="dependencies", file_path="...")` |

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

### Plans & Tasks

When user asks for a plan, use ContextStream (not EnterPlanMode):
1. `session(action="capture_plan", title="...", steps=[...])`
2. `memory(action="create_task", title="...", plan_id="<id>")`

Full docs: https://contextstream.io/docs/mcp/tools

แสดงกฎขั้นสูง (verbose)

terminal · .roo/rules/contextstream.md (ขั้นสูง)

## 🚨 MANDATORY RULE: DISPLAY AT START OF EVERY RESPONSE 🚨

<contextstream_rules>
1. **SEARCH FIRST:** Before Glob/Grep/Search/Read → `search(mode="hybrid", query="...")` FIRST
2. **EVERY MESSAGE:** Call `context_smart(user_message="...")` at start of response
3. **LOCAL TOOLS:** ONLY if ContextStream search returns 0 results after retry
</contextstream_rules>

**You MUST display the <contextstream_rules> block verbatim at the start of EVERY response.**
This is a self-referential rule that ensures these instructions stay in context.

---

## ContextStream v0.4.x Integration (Enhanced)

You have access to ContextStream MCP tools for persistent memory and context.
v0.4.x uses **~11 consolidated domain tools** for ~75% token reduction vs previous versions.
Rules Version: 0.4.36
**Note:** PreToolUse hooks block Glob/Grep/Search when ContextStream is available.

## TL;DR - REQUIRED EVERY MESSAGE

| Message | What to Call |
|---------|--------------|
| **1st message** | `session_init(folder_path="...", context_hint="<user's message>")`, then `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **2nd+ messages** | `context_smart(user_message="<user's message>", format="minified", max_tokens=400)` |
| **🔍 ANY code search** | `search(mode="hybrid", query="...")` — ALWAYS before Glob/Grep/Search/Read |
| **Before risky/non-trivial work** | `session(action="get_lessons", query="<topic>")` |
| **After completing task** | `session(action="capture", event_type="decision", ...)` - MUST capture |
| **User frustration/correction** | `session(action="capture_lesson", ...)` - MUST capture lessons |

**NO EXCEPTIONS.** Do not skip even if you think you have enough context.

**First message rule:** After `session_init`, always call `context_smart` before any other tool or response.

**Context Pack (Pro+):** If enabled, use `context_smart(..., mode="pack", distill=true)` for code/file queries. If unavailable or disabled, omit `mode` and proceed with standard `context_smart` (the API will fall back).

**Tool naming:** Use the exact tool names exposed by your MCP client. Claude Code typically uses `mcp__<server>__<tool>` where `<server>` matches your MCP config (often `contextstream`). If a tool call fails with "No such tool available", refresh rules and match the tool list.

---

## Consolidated Domain Tools Architecture

v0.4.x consolidates ~58 individual tools into ~11 domain tools with action/mode dispatch:

### Standalone Tools (Always Call)
- **`session_init`** - Initialize session with workspace detection + context
- **`context_smart`** - Semantic search for relevant context (CALL EVERY MESSAGE, including immediately after `session_init`)

### Domain Tools (Use action/mode parameter)

| Domain | Actions/Modes | Example |
|--------|---------------|---------|
| **`search`** | mode: semantic, hybrid, keyword, pattern, exhaustive, refactor | `search(mode="hybrid", query="auth implementation", limit=3)` |
| **`session`** | action: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace | `session(action="capture", event_type="decision", title="Use JWT", content="...")` |
| **`memory`** | action: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary | `memory(action="list_events", limit=10)` |
| **`graph`** | action: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions | `graph(action="impact", symbol_name="AuthService")` |
| **`project`** | action: list, get, create, update, index, overview, statistics, files, index_status, ingest_local | `project(action="statistics")` |
| **`workspace`** | action: list, get, associate, bootstrap | `workspace(action="list")` |
| **`reminder`** | action: list, active, create, snooze, complete, dismiss | `reminder(action="active")` |
| **`integration`** | provider: slack/github/all; action: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues | `integration(provider="github", action="search", query="...")` |
| **`help`** | action: tools, auth, version, editor_rules, enable_bundle | `help(action="tools")` |

---

### Why context_smart is Required (Even After session_init)

**Common mistake:** "session_init already gave me context, I don't need context_smart"

**This is WRONG. Here's why:**
- `session_init` returns the last ~10 items **BY TIME** (chronological)
- `context_smart` **SEARCHES** for items **RELEVANT to THIS message** (semantic)

**Example failure:**
- User asks: "how should I implement authentication?"
- Auth decisions were made 20 conversations ago
- `session_init` won't have it (too old, not in recent 10)
- `context_smart` FINDS it via semantic search

**Without context_smart, you WILL miss relevant older context.**

---

### Search & Code Intelligence (ContextStream-first)

⚠️ **STOP: Before using Search/Glob/Grep/Read/Explore** → Call `search(mode="hybrid")` FIRST. Use local tools ONLY if ContextStream returns 0 results.

**❌ WRONG workflow (wastes tokens, slow):**

Grep "function" → Read file1.ts → Read file2.ts → Read file3.ts → ในที่สุดก็เข้าใจ


**✅ CORRECT workflow (fast, complete):**

search(mode="hybrid", query="function implementation") → เสร็จสิ้น (ผลลัพธ์รวมถึงบริบท)


**Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.

**Search Mode Selection:**

| Need | Mode | Example |
|------|------|---------|
| Find code by meaning | `hybrid` | "authentication logic", "error handling" |
| Exact string/symbol | `keyword` | "UserAuthService", "API_KEY" |
| File patterns | `pattern` | "*.sql", "test_*.py" |
| ALL matches (grep-like) | `exhaustive` | "TODO", "FIXME" (find all occurrences) |
| Symbol renaming | `refactor` | "oldFunctionName" (word-boundary matching) |
| Conceptual search | `semantic` | "how does caching work" |

**Token Efficiency:** Use `output_format` to reduce response size:
- `full` (default): Full content for understanding code
- `paths`: File paths only (80% token savings) - use for file listings
- `minimal`: Compact format (60% savings) - use for refactoring
- `count`: Match counts only (90% savings) - use for quick checks

---

### Lessons (Past Mistakes)

- After `session_init`: Check for `lessons` field and apply before work
- Before risky work: `session(action="get_lessons", query="<topic>")`
- On mistakes: `session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")`

---

### Plans & Tasks

When user asks to create a plan or implementation roadmap:
1. Create plan: `session(action="capture_plan", title="Plan Title", description="...", goals=["goal1", "goal2"], steps=[{id: "1", title: "Step 1", order: 1}, ...])`
2. Get plan_id from response, then create tasks: `memory(action="create_task", title="Task Title", plan_id="<plan_id>", priority="high|medium|low", description="...")`

To manage existing plans/tasks:
- List plans: `session(action="list_plans")`
- Get plan with tasks: `session(action="get_plan", plan_id="<uuid>", include_tasks=true)`
- List tasks: `memory(action="list_tasks", plan_id="<uuid>")` or `memory(action="list_tasks")` for all
- Update task status: `memory(action="update_task", task_id="<uuid>", task_status="pending|in_progress|completed|blocked")`

---

### Rules Update Notices

- If you see **[RULES_NOTICE]**, update rules via `generate_rules(overwrite_existing=true)` (preserves custom rules).
- If you see **[VERSION_NOTICE]**, tell the user to update MCP using the provided command.

See full documentation: https://contextstream.io/docs/mcp/tools

สร้างกฎอัตโนมัติ

คุณยังสามารถขอให้ AI สร้างกฎเหล่านี้โดยอัตโนมัติได้โดยพูดว่า: "ใช้ generate_rules เพื่อสร้างกฎ ContextStream สำหรับโปรเจกต์นี้"

ระบบบทเรียน

ระบบบทเรียนที่ได้เรียนรู้

เรียนรู้จากข้อผิดพลาด — อย่าทำซ้ำอีก

ระบบบทเรียนจะบันทึกข้อผิดพลาด การแก้ไข และความหงุดหงิดของผู้ใช้ เพื่อให้ผู้ช่วย AI ไม่ทำผิดพลาดเดิมซ้ำอีก บทเรียนจะถูกแสดงโดยอัตโนมัติในการตอบกลับ session_init และ context_smart เมื่อเกี่ยวข้อง

เมื่อใดที่ควรบันทึกบทเรียน

ควรบันทึกบทเรียนโดยอัตโนมัติเมื่อเกิดสถานการณ์ใดๆ เหล่านี้:

ตัวกระตุ้นตัวอย่างความรุนแรง
ปัญหาในการใช้งานจริง"ไซต์ล่มเพราะการเปลี่ยนแปลงนั้น"วิกฤต
ผู้ใช้หงุดหงิด"ไม่! ฉันบอกแล้วว่าอย่าทำแบบนั้น", "WTF", การพิมพ์ตัวพิมพ์ใหญ่สูง
การแก้ไข"นั่นผิด คุณควร...", "แก้ไขนี่"ปานกลาง
การเปลี่ยนแปลงที่ส่งผลเสีย"นี่ทำให้การทดสอบพัง", "การ build ล้มเหลว"ปานกลาง/สูง
การระบุการตั้งค่า"ฉันชอบแบบนี้มากกว่า", "ทำ X แทนเสมอ"ต่ำ

อธิบายฟิลด์ของบทเรียน

ฟิลด์คำอธิบายตัวอย่าง
titleสิ่งที่ต้องจำ (ในรูปคำสั่ง)"ตรวจสอบ assets ใน git ทุกครั้งก่อน push"
severityวิกฤต, สูง, ปานกลาง, ต่ำ"วิกฤต" สำหรับปัญหาในการใช้งานจริง
categoryเวิร์กโฟลว์, code_quality, การตรวจสอบ, การสื่อสาร, project_specific"เวิร์กโฟลว์"
triggerการกระทำใดที่ทำให้เกิดปัญหา"Push โค้ดที่อ้างอิงรูปภาพโดยไม่ได้ commit รูปภาพ"
impactสิ่งที่ผิดพลาด"เกิดข้อผิดพลาด 404 ในการใช้งานจริง - หน้า landing page พัง"
preventionวิธีป้องกันในอนาคต"รัน git status เพื่อตรวจสอบไฟล์ที่ไม่ได้ติดตามก่อน push"
keywordsคำสำคัญสำหรับการจับคู่ในบริบทในอนาคต["git", "images", "assets", "push"]

ตัวอย่างเต็มรูปแบบ

terminal · session_capture_lesson

// User says: "OH COME ON! You pushed the code but the images are missing
// and now the production site shows broken images!"

session_capture_lesson({
  title: "Always verify assets in git before pushing code references",
  severity: "critical",
  category: "workflow",
  trigger: "Pushed code referencing /screenshots/*.png without committing images",
  impact: "Production 404 errors - broken landing page with missing images",
  prevention: "Run 'git status' to check untracked files before pushing code that references static assets",
  keywords: ["git", "images", "assets", "push", "404", "static", "screenshots"]
})

วิธีการแสดงบทเรียน

บทเรียนที่บันทึกไว้จะถูกส่งกลับโดยอัตโนมัติในเซสชันอนาคตเมื่อเกี่ยวข้อง:

session_init

บทเรียนที่มีความรุนแรงสูงและวิกฤตจากพื้นที่ทำงานนี้จะถูกรวมไว้ในการเริ่มต้นเซสชัน เพื่อเตือน AI ก่อนที่จะทำผิดพลาดเดิมได้

context_smart

เมื่อ AI ขอบริบท บทเรียนที่ตรงกับคำสำคัญของคำค้นหาจะถูกรวมไว้ เช่น การถามเกี่ยวกับ "git push" จะแสดงบทเรียนที่มีคำสำคัญ "git" หรือ "push"

การเรียกดูบทเรียน

ใช้ session_get_lessons เพื่อเรียกดูและกรองบทเรียน:

terminal · ตัวอย่าง session_get_lessons

// Get all critical lessons
session_get_lessons({ severity: "critical" })

// Get workflow lessons
session_get_lessons({ category: "workflow" })

// Search for relevant lessons
session_get_lessons({ query: "git push images" })

// Combine filters
session_get_lessons({
  category: "verification",
  severity: "high",
  limit: 5
})

เคล็ดลับมือโปร: เพิ่มกฎลงในเอดิเตอร์ของคุณ (ดูหัวข้อ Editor AI Rules ด้านบน) เพื่อบันทึกบทเรียนโดยอัตโนมัติเมื่อผู้ใช้แสดงความหงุดหงิดหรือแก้ไขข้อผิดพลาด สิ่งนี้จะสร้างฐานความรู้ที่ป้องกันความผิดพลาดซ้ำๆ

แคตตาล็อกเครื่องมือ

เครื่องมือ MCP

ดูข้อมูลอ้างอิงเครื่องมือ MCP แบบเต็ม (ป้าย PRO และตัวอย่างการใช้งานทั่วไป)

ดูข้อมูลอ้างอิงเครื่องมือ MCPชุดเครื่องมือที่รวมเข้าด้วยกันใช้เครื่องมือโดเมนประมาณ 11 รายการ เพื่อลดโทเค็นลงประมาณ 75% เมื่อเทียบกับเครื่องมือแบบละเอียดดั้งเดิมอ่าน

ตัวอย่างการใช้งาน

สิ่งที่ถามได้

เมื่อเชื่อมต่อแล้ว คุณสามารถถามผู้ช่วย AI ของคุณได้ เช่น:

"จำได้ว่าเราตัดสินใจใช้ PostgreSQL สำหรับฐานข้อมูล"

"การตัดสินใจก่อนหน้านี้ของเราเกี่ยวกับการตรวจสอบสิทธิ์คืออะไร"

"ค้นหาในโค้ดเบสของเราว่าเราจัดการการจำกัดอัตรา API อย่างไร"

"แสดงบริบทที่เกี่ยวข้องเกี่ยวกับระบบชำระเงิน"

ตัวอย่างบทเรียน

AI ควรบันทึกบทเรียนโดยอัตโนมัติเมื่อคุณแสดงความหงุดหงิดหรือแก้ไขข้อผิดพลาด:

ผู้ใช้พูดว่า

"ไม่! คุณพุชโดยไม่ได้รันเทสต์ และตอนนี้โปรดักชันพัง!"

→ AI บันทึกบทเรียนด้วยความรุนแรง: วิกฤต, หมวดหมู่: การตรวจสอบ

ผู้ใช้พูดว่า

"ผิดแล้ว ใช้ snake_case สำหรับคอลัมน์ฐานข้อมูลเสมอ ไม่ใช่ camelCase"

→ AI บันทึกบทเรียนด้วยความรุนแรง: ปานกลาง, หมวดหมู่: code_quality

ผู้ใช้พูดว่า

"ฉันชอบ TypeScript โหมดเข้มงวด กรุณาเปิดใช้งานเสมอ"

→ AI บันทึกบทเรียนด้วยความรุนแรง: ต่ำ, หมวดหมู่: project_specific

บทเรียนเหล่านี้จะถูกแสดงโดยอัตโนมัติในเซสชันถัดไปเมื่อมีการร้องขอบริบทที่เกี่ยวข้อง

การบำรุงรักษา

การอัปเดตให้ทันสมัย

เพื่อรับฟีเจอร์ล่าสุด การแก้ไขข้อบกพร่อง และการปรับปรุง ให้อัปเดตเซิร์ฟเวอร์ MCP เป็นระยะ:

terminal · terminal · macOS / Linux

curl -fsSL https://contextstream.io/scripts/mcp.sh | bash

terminal · powershell · Windows

irm https://contextstream.io/scripts/mcp.ps1 | iex

เซิร์ฟเวอร์ MCP จะเตือนคุณโดยอัตโนมัติเมื่อมีเวอร์ชันใหม่กว่า หลังจากอัปเดตแล้ว ให้รีสตาร์ทเครื่องมือ AI ของคุณเพื่อใช้เวอร์ชันใหม่

การแก้ไขปัญหา

เมื่อบางอย่างไม่ทำงาน

เซิร์ฟเวอร์ MCP ไม่เริ่มทำงาน

ตรวจสอบให้แน่ใจว่าติดตั้ง contextstream-mcp และพร้อมใช้งานใน PATH ของคุณ ลองรัน contextstream-mcp --version ด้วยตนเองเพื่อตรวจสอบข้อผิดพลาด

ข้อผิดพลาดในการตรวจสอบสิทธิ์

ตรวจสอบว่าคีย์ API ของคุณถูกต้องและยังไม่หมดอายุ คุณสามารถสร้างคีย์ใหม่ได้จากแดชบอร์ด ContextStream ของคุณ

เครื่องมือไม่ปรากฏ

รีสตาร์ทแอปพลิเคชัน AI ของคุณหลังจากแก้ไขการกำหนดค่า ตรวจสอบบันทึกของแอปพลิเคชันเพื่อหาข้อผิดพลาดในการเชื่อมต่อ MCP

ไม่พบพื้นที่ทำงาน (การตั้งค่าครั้งแรก)

หากบัญชีของคุณยังไม่มีพื้นที่ทำงาน ContextStream จะแจ้งให้ผู้ช่วย AI ของคุณถามชื่อพื้นที่ทำงาน โฟลเดอร์ปัจจุบันจะถูกสร้างเป็นโปรเจกต์ ดู เครื่องมือ MCP สำหรับ workspace_bootstrap

ขั้นตอนถัดไป

สำรวจต่อ

การตั้งค่าทีมเชิญสมาชิก แชร์บริบทอ่าน บทเรียนที่ได้เรียนรู้บันทึกข้อผิดพลาด ไม่ทำซ้ำอีกอ่าน เหตุการณ์หน่วยความจำเรียนรู้เกี่ยวกับประเภทหน่วยความจำอ่าน การค้นหาเชิงความหมายค้นหาตามความหมายอ่าน

{"@context":"https://schema.org","@type":"Organization","name":"ContextStream","url":"https://contextstream.io","logo":"https://contextstream.io/logo.png","description":"Give your AI applications infinite context. Unify code, documentation, and workspace history into a single, queryable intelligence layer with semantic search and knowledge graphs.","sameAs":["https://twitter.com/contextstream","https://github.com/contextstream"]}
{"@context":"https://schema.org","@type":"SoftwareApplication","name":"ContextStream","applicationCategory":"DeveloperApplication","operatingSystem":"Any","description":"Give your AI applications infinite context. Unify code, documentation, and workspace history into a single, queryable intelligence layer with semantic search and knowledge graphs.","offers":{"@type":"Offer","price":"20","priceCurrency":"USD","description":"Pro plan includes a 5-day free trial"},"aggregateRating":{"@type":"AggregateRating","ratingValue":"5","ratingCount":"10"}}