ContextStream MCP Server
공식세션 간 AI 코딩 어시스턴트를 위한 지속적 메모리 및 의미 검색
문서
Docs · 섹션 탐색
01 · 설정 마법사
단 하나의 명령으로 완전히 구성.
하나의 명령을 실행하여 인증(브라우저/기기 로그인)하고, API 키를 생성하고, 규칙을 생성하고, 사용 중인 도구에 맞는 올바른 MCP 구성을 작성합니다(VS Code의 servers 스키마 포함).
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")에서 자동으로 일치시킵니다.
실행 범위 전환
이중 컨텍스트 계정은 MCP에서 --account-mode=team|personal|auto 또는 session set_account_mode를 사용합니다.
엔티티로 작업 추적
티켓, 인계, 인시던트, 릴리스는 인덱싱된 참조를 사용하여 세션과 팀원 간에 지속됩니다.
호스팅 원격이 기본값입니다. 로컬 바이너리 MCP는 복구 전용입니다. 명시적으로 필요할 때 CONTEXTSTREAM_ALLOW_LOCAL_MCP=1을 설정하세요. 초대/역할에 대한 팀 설정과 로그인 후 체크리스트를 참조하세요.
CLI 단축키
비대화형 명령(CI 및 새로 고침).
대화형 마법사 없이 실행합니다. 업그레이드 후, 팀 온보딩, 자격 증명 교체, 워크스페이스 변경 시에 이상적입니다. contextstream-mcp --help에서도 표시됩니다.
| 명령 | 사용 시기 |
|---|---|
| contextstream-mcp update-hooks --scope=global | 업그레이드 후 또는 팀 워크스페이스 참여 후 — PreToolUse/UserPromptSubmit 훅 새로 고침. |
| contextstream-mcp update-rules --scope=all | 최신 팀 워크플로 지침으로 .cursorrules / CLAUDE.md / AGENTS.md 재생성. |
| contextstream-mcp update-configs --scope=global | API 키 또는 워크스페이스 변경 후 MCP 구성 다시 작성. |
| 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% 토큰 감소). 더 적은 도구를 원하면 env 블록에 "CONTEXTSTREAM_PROGRESSIVE_MODE": "true"를 추가하여 약 2개의 라우터 메타 도구를 사용하세요. 전체 도구 카탈로그를 참조하세요.
도구로 이동
Cursor / VS CodeWindsurfCodex CLIOpenCode CLIClaude CodeClaude DesktopClineKilo CodeRoo CodeAntigravity
MCP란 무엇인가요?
AI를 위한 개방형 프로토콜.
**모델 컨텍스트 프로토콜(MCP)**은 AI 어시스턴트가 외부 도구 및 데이터 소스에 연결할 수 있도록 하는 개방형 표준입니다. ContextStream의 MCP 서버를 사용하면 AI 도구가 다음을 수행할 수 있습니다:
- 세션 간 대화 및 결정 기억
- 코드베이스 및 문서를 의미론적으로 검색
- 지식 그래프 구축 및 쿼리
- 서로 다른 AI 도구 간 컨텍스트 공유
자연어
그냥 요청하세요. AI가 도구를 처리합니다.
도구 이름을 외우거나 직접 호출할 필요가 없습니다. 원하는 바를 평이한 영어로 설명하기만 하면 AI 어시스턴트가 자동으로 올바른 도구를 사용합니다.
자연스럽게 요청하기
- · "세션 요약"
- · "인증에 대해 무엇을 결정했나요?"
- · "PostgreSQL을 사용 중임을 기억해 주세요"
- · "결제 코드 검색"
AI가 나머지를 처리합니다
- · 관련 컨텍스트를 자동으로 찾음
- · 필요할 때 과거 결정을 회상
- · 중요한 정보를 메모리에 저장
- · 코드 및 문서 검색
예시 · "세션 요약"

AI가 사용자의 의도를 이해하고 백그라운드에서 적절한 ContextStream 도구를 호출합니다.
전제 조건
필요한 것.
- ContextStream 계정(설정 마법사가 브라우저 로그인을 통해 API 키를 생성할 수 있음).
컨텍스트 강화
GitHub + Slack 통합
MCP는 AI에 지속적인 메모리를 제공합니다. GitHub와 Slack을 연결하면 그 메모리가 훨씬 더 풍부해져 AI가 질문에 답할 때 PR, 이슈, 팀 토론을 자동으로 참조할 수 있습니다.
자동 컨텍스트 강화
context_smart 또는 session_smart_search을 호출하면 관련 GitHub 이슈, PR, Slack 토론이 자동으로 포함됩니다. 추가 도구가 필요하지 않습니다.
GitHubSync 이슈, PR, 릴리스, 댓글. 토론에서 결정이 자동으로 추출됩니다.SlackSync 채널 및 스레드. 참여도가 높은 대화에 점수가 매겨지고 우선순위가 지정됩니다.
예시 프롬프트
- · "인증에 대해 무엇을 결정했나요?" — GitHub 이슈 + Slack 스레드에서 결정을 찾음
- · "결제 시스템에 대한 최근 활동을 보여주세요" — PR, 이슈, 팀 토론을 표시
- · "마지막 장애에서 어떤 교훈을 얻었나요?" — 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"— 이슈/PR 목록
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은 이제 HTTP를 통해 호스팅된 ContextStream MCP를 직접 사용할 수 있습니다.
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를 처리하도록 합니다. .vscode/mcp.json에 로컬 바이너리나 API 키가 있을 필요가 없습니다.
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을 승인하라는 메시지를 표시한 다음 자동으로 설정을 완료해야 합니다.
자체 호스팅인가요? https://mcp.contextstream.io/mcp?default_context_mode=fast 대신 자체 MCP 게이트웨이 URL을 가리키도록 동일한 원격 구성을 사용하세요.
클라이언트 · OpenCode CLI
OpenCode CLI
OpenCode CLI에서 ContextStream을 사용하려면 ~/.config/opencode/opencode.json 파일(또는 프로젝트 루트의 opencode.json)에 MCP 서버 구성을 추가하세요:
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
Codex CLI에서 ContextStream을 사용하려면 ~/.codex/config.toml 파일에 MCP 서버 구성을 추가하세요:
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)
프로젝트 디렉터리에서 이 명령을 실행하여 Claude Code에 ContextStream을 추가하세요:
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 주의 사항 (WSL이 아닌 네이티브 Windows): -- 뒤에 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 파일(프로젝트 범위)을 선호합니다.
이렇게 하면 프로젝트 경로 아래의 ~/.claude.json에 ContextStream이 추가되어 해당 디렉터리에서 작업할 때 사용할 수 있습니다.
MCP 범위 옵션
- · 로컬 (기본값): 사용자 전용, 현재 프로젝트만 → 프로젝트 경로 아래의
~/.claude.json에 저장됨. - · 사용자 (
--scope user): 사용자 전용, 모든 프로젝트 → 전역~/.claude.json에 저장됨. - · 프로젝트 (
--scope project): 팀과 공유 → 프로젝트 루트의.mcp.json에 저장됨(git에 커밋).
팀 공유의 경우 프로젝트 범위를 사용하여 git에 커밋할 수 있는 .mcp.json 파일을 만듭니다:
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 앱)
Claude Desktop 애플리케이션에 ContextStream을 추가하세요:
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
전역 MCP 구성 파일을 편집하여 Windsurf에 ContextStream을 추가하세요:
구성: ~/.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는 ContextStream 규칙의 자동 적용을 위한 훅을 지원합니다. 구성을 편집한 후 변경 사항을 적용하려면 Windsurf를 다시 시작하세요.
클라이언트 · Cline
Cline
Cline MCP 구성에 ContextStream을 추가하세요. Cline에서 MCP 서버 아이콘을 클릭하고 "구성" 탭을 선택한 다음 "MCP 서버 구성"을 클릭하여 편집합니다:
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
Kilo Code MCP 설정에 ContextStream을 추가하세요. MCP 서버는 전역 또는 프로젝트별로 구성할 수 있습니다:
전역: 설정 → MCP 서버 → 설치됨 → 전역 MCP 편집을 클릭하여 mcp_settings.json 열기
프로젝트: 프로젝트 루트의 .kilocode/mcp.json
터미널 · .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
Roo Code MCP 설정에 ContextStream을 추가하세요. MCP 서버는 전역 또는 프로젝트별로 구성할 수 있습니다:
전역: 설정 아이콘 클릭 → 전역 MCP 편집을 클릭하여 mcp_settings.json 열기
프로젝트: 프로젝트 루트의 .roo/mcp.json
터미널 · .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는 Cursor/Claude Desktop과 동일한 형식의 프로젝트 범위 .mcp.json 파일을 사용합니다:
터미널 · .mcp.json (프로젝트 루트)
{
"mcpServers": {
"contextstream": {
"command": "contextstream-mcp",
"env": {
"CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
"CONTEXTSTREAM_API_KEY": "your_api_key"
}
}
}
}
Windows 사용자: cmd 래퍼 사용
터미널 · .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 서버" → "원시 설정 보기"를 통해 접근하여 설정을 확인하세요. 편집 후 Antigravity를 다시 시작하세요.
편집기 규칙
자동 ContextStream 사용 개선
권장 사항
ContextStream의 자동 컨텍스트 기능은 ContextStream 도구를 사용할 때 작업 영역 컨텍스트를 자동으로 로드합니다. 그러나 AI 어시스턴트가 항상 사전에 결정을 저장하거나 과거 컨텍스트를 회상하지는 않을 수 있습니다. 편집기 AI 규칙을 추가하면 일관성이 향상되고 AI가 대화 전반에 걸쳐 결정, 선호도 및 중요한 컨텍스트를 자동으로 캡처하도록 보장합니다.
중요: MCP 도구 명명 규칙
AI 도구마다 MCP 도구에 대해 서로 다른 명명 규칙을 사용합니다. 잘못된 형식을 사용하면 도구를 찾을 수 없습니다.
| AI 도구 | 형식 | 예시 |
|---|---|---|
| Claude Code | mcp____ | 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 규칙은 두 가지 수준에서 추가할 수 있습니다: 전역 (모든 프로젝트에 적용) 또는 프로젝트 (단일 프로젝트에 적용).
전역 규칙 (모든 프로젝트)
한 번 추가하면 모든 프로젝트에 자동으로 적용됩니다:
| 편집기 | 전역 규칙 위치 |
|---|---|
| Cursor | 설정 → 일반 → 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 폴더 기반 규칙의 경우 규칙이 항상 활성화되도록 활성화 모드를 **"항상 켜기"**로 설정하세요.
| 편집기 | 프로젝트 규칙 위치 |
|---|---|
| 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 Code | 프로젝트 루트의 CLAUDE.md |
| Codex CLI | 프로젝트 루트의 AGENTS.md |
| OpenCode CLI | 프로젝트 루트의 AGENTS.md |
| Aider | 프로젝트 루트의 .aider.conf.yml |
활성화 모드 (Cursor, Kilo Code 및 Roo Code)
폴더 기반 규칙(예: .cursor/rules/)을 사용할 때 각 규칙 파일에는 활성화 모드가 있습니다:
- 항상 켜기 — 항상 활성 (ContextStream에 권장)
- 수동 — 규칙을 @언급할 때만
- 모델 결정 — 설명에 따라 AI가 결정
- Glob — 일치하는 파일 패턴에 대해 활성
전역 규칙 및 루트 수준 파일(.cursorrules)은 항상 활성입니다.
설정 마법사를 선호하시나요? 먼저 실행하세요. 그렇지 않으면 이러한 표준 규칙을 수동으로 추가하세요. 각 편집기에 대한 예시:
Claude Code
프로젝트 루트에 CLAUDE.md 파일을 만들거나 전역 ~/.claude/CLAUDE.md에 추가하세요:
터미널 · 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
향상된 규칙 표시 (상세)
터미널 · 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
프로젝트 루트(프로젝트 규칙) 또는 ~/.codex/AGENTS.md (Codex 전역) / ~/.config/opencode/AGENTS.md (OpenCode 전역)에 AGENTS.md 파일을 만드세요:
Codex / OpenCode vs Claude 도구 이름
Codex / OpenCode는 원시 MCP 도구 이름(예: session_init)을 사용합니다. Claude Code는 네임스페이스가 지정된 도구 이름(예: mcp__contextstream__session_init)을 사용합니다. AI 도구에 맞는 올바른 형식을 사용하세요.
터미널 · 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
향상된 규칙 표시 (상세)
터미널 · 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에 추가하세요:
터미널 · .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
향상된 규칙 표시 (상세)
터미널 · .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
.kilocode/rules/에 Markdown 파일을 만드세요:
터미널 · .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
향상된 규칙 표시 (상세)
터미널 · .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/ 폴더를 사용하세요:
터미널 · .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
향상된 규칙 표시 (상세)
터미널 · .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/ 폴더를 사용하세요:
터미널 · .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
향상된 규칙 표시 (상세)
터미널 · .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", 대문자 사용 | 높음 |
| 수정 | "그건 틀렸어, 이렇게 해야 해...", "이거 고쳐줘" | 중간 |
| 주요 변경 사항 | "이게 테스트를 망가뜨렸어", "빌드가 실패했어" | 중간/높음 |
| 선호도 언급 | "이 방식이 더 좋아", "대신 항상 X를 해줘" | 낮음 |
레슨 필드 설명
| 필드 | 설명 | 예시 |
|---|---|---|
| 제목 | 기억할 사항 (명령형) | "푸시하기 전에 항상 git에서 자산 확인" |
| 심각도 | 심각, 높음, 중간, 낮음 | 프로덕션 문제의 경우 "심각" |
| 카테고리 | 워크플로우, 코드_품질, 검증, 커뮤니케이션, 프로젝트_특정 | "워크플로우" |
| 트리거 | 문제를 일으킨 작업 | "이미지를 커밋하지 않고 참조하는 코드를 푸시함" |
| 영향 | 무엇이 잘못되었는지 | "프로덕션 404 오류 - 랜딩 페이지 손상" |
| 예방 | 향후 예방 방법 | "푸시하기 전에 git status를 실행하여 추적되지 않은 파일 확인" |
| 키워드 | 향후 컨텍스트에서 일치시키기 위한 키워드 | ["git", "이미지", "자산", "푸시"] |
전체 예시
터미널 · 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를 사용하여 레슨을 검색하고 필터링하세요:
터미널 · 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
})
프로 팁: 사용자가 불만을 표시하거나 수정 사항을 제시할 때 자동으로 학습 내용을 캡처하도록 편집기에 규칙을 추가하세요(위의 편집기 AI 규칙 섹션 참조). 이를 통해 반복되는 실수를 방지하는 지식 베이스가 구축됩니다.
도구 카탈로그
MCP 도구.
전체 MCP 도구 레퍼런스(PRO 배지 및 일반적인 사용 예시)를 참조하세요.
MCP 도구 레퍼런스 보기통합 도구 세트는 레거시 세분화 도구 대비 약 75%의 토큰 감소를 위해 약 11개의 도메인 도구를 사용합니다.읽기
사용 예시
무엇을 물어볼까.
연결되면 AI 어시스턴트에게 다음과 같이 물어볼 수 있습니다:
"데이터베이스로 PostgreSQL을 사용하기로 결정한 것을 기억해 줘"
"인증에 관한 이전 결정 사항이 뭐였지?"
"API 속도 제한을 어떻게 처리하는지 코드베이스에서 검색해 줘"
"결제 시스템에 관한 관련 컨텍스트를 보여줘"
학습 예시
사용자가 불만을 표시하거나 수정 사항을 제시하면 AI가 자동으로 학습 내용을 캡처해야 합니다:
사용자 발언
"안 돼! 테스트도 안 하고 푸시해서 지금 프로덕션이 망가졌잖아!"
→ AI가 심각도: 심각, 카테고리: 검증으로 학습 내용 캡처
사용자 발언
"그거 틀렸어. 데이터베이스 컬럼은 camelCase 말고 항상 snake_case를 사용해."
→ AI가 심각도: 중간, 카테고리: 코드_품질로 학습 내용 캡처
사용자 발언
"TypeScript strict 모드를 선호해. 항상 활성화해 줘."
→ AI가 심각도: 낮음, 카테고리: 프로젝트_특정으로 학습 내용 캡처
이러한 학습 내용은 관련 컨텍스트가 요청될 때 향후 세션에서 자동으로 표시됩니다.
유지 관리
최신 상태 유지.
최신 기능, 버그 수정 및 개선 사항을 얻으려면 MCP 서버를 주기적으로 업데이트하세요:
터미널 · 터미널 · macOS / Linux
curl -fsSL https://contextstream.io/scripts/mcp.sh | bash
터미널 · 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 어시스턴트에게 워크스페이스 이름을 물어보도록 안내합니다. 현재 폴더가 프로젝트로 생성됩니다. workspace_bootstrap에 대한 MCP 도구를 참조하세요.
다음 단계
계속 탐색하기.
팀 설정멤버 초대, 컨텍스트 공유.읽기학습 내용실수를 캡처하고 반복하지 않기.읽기메모리 이벤트메모리 유형에 대해 알아보기.읽기의미 기반 검색의미로 검색하기.읽기
{"@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"}}