Skip to main content
Glama

리마이(limai) - 理脈

리화(理華)와 리월(理月)의 공유 신경계——캐릭터에서 제1원리로 추출한 독립 기관.

제1원리 도출

캐릭터에서의 모습

본질

모듈

MCP 도구

하트비트 폴링+오류 백오프(on_idle.mjs)

리듬

heartbeat.mjs

heartbeat_now・vitals_latest・vitals_history

스크린샷/창/클립보드(screenshot.mjs)

시각

vision.mjs

screen_capture(이미지 반환)・list_windows・read_clipboard

todo-tasks.json+가중치 융합 하트비트

의도

todo.mjs

todo_add・todo_list・todo_update

장기 기억(이름×키워드×내용)

기억

memory.mjs

memory_add・memory_search・memory_list・memory_forget

o-pi 6종 파일 도구

파일 액션

filesys.mjs

fs_ls/read/write/edit/find/grep

o-pi websearch/webfetch

네트워크 액션

web.mjs

web_search・web_fetch

버린 것: 캐릭터의 LLM 작업 프롬프트(성격은 이전하지 않음), 메모리의 JS eval 트리거(보안). 보존한 정수: 가중치 랜덤 스케줄링 사상→하트비트 백오프; STALE_READ 가드; SSRF 방어; 유계 읽기.

Related MCP server: qwen-mcp

시작

npm install
npm run start          # ① stdio → Claude Desktop / Cursor 等本地客戶端
npm run serve:http     # ② HTTP MCP → GPT 客戶端 / 區網 / 遠端
npm run tick           # ③ 手動跑一次心跳(驗證感知層)

CLI는 AI 에이전트를 위해 설계됨

limai shot                       # → {"file":...,"width":1920,"height":1080,"bytes":...}
limai win                        # → {"foreground":...,"windows":[{process,title},…]}
limai clip [--json]              # 剪貼簿原文走 stdout(利於管線)
limai tick                       # 心跳一次,生命徵象 JSON
limai web search <q>             # → [{title,url,snippet},…]
limai web fetch <url>            # 正文走 stdout、中繼 stderr;--json 得全包裝
limai fs ls|read|write|edit|find|grep …
limai mem … / limai todo …       # 同前

에이전트 계약:

  • 출력 기본 JSON, 오류 코드 접두사를 stderr 메시지에 포함(STALE_READ: …), 종료 코드 0이 아니면 실패

  • fs edit 엄격 계약은 MCP와 동일: 반드시 먼저 fs read; 관측 상태는 fs-state.json에 영속화, 「read 프로세스 → edit 프로세스」가 호출을 넘어서도 성립, 외부 변경은 반드시 차단됨(--force로 우회 가능)

  • 성공한 fs write도 관측을 생성하므로 edit 연결 가능(o-pi의 「성공 직후 write」 규칙과 동일)

아키텍처상 MCP는 핵심 모듈 위의 한 가지 인터페이스일 뿐: 동일한 vision/web/filesys/memory/todo/heartbeat 세트를 CLI 하위 명령과 MCP 도구가 함께 호출하며, 두 인터페이스는 동일한 데이터와 동일한 보안 계약을 공유합니다.

최초 실행 시 자동으로 ~/.limai/(config.json・memory.json・todo.json・vitals.*・screenshots/)를 생성하고 token을 출력합니다.

클라이언트 연동

로컬(stdio)

// claude_desktop_config.json
{ "mcpServers": { "limai": { "command": "node", "args": ["F:\\fount開發項目\\理脈\\src\\cli.mjs", "serve", "--stdio"] } } }

LAN/동일 머신 GPT 클라이언트(Cherry Studio, LobeChat, OpenWebUI…)

node src/cli.mjs serve --http                # 預設 127.0.0.1:8931
# 對區網開放:--host 0.0.0.0 --token <強密碼>
{ "type": "http", "url": "http://192.168.x.x:8931/mcp",
  "headers": { "Authorization": "Bearer <token>" } }

클라우드 ChatGPT(Connectors/개발자 모드)

ChatGPT는 localhost에 접근할 수 없으므로 공용 HTTPS가 필요합니다——한 줄 터널:

cloudflared tunnel --url http://127.0.0.1:8931
# → https://xxxx.trycloudflare.com

커넥터 URL에 https://xxxx.trycloudflare.com/mcp?token=<token> 입력(GPT 계열 클라이언트는 대부분 커스텀 header를 지원하지 않으므로 query로 token 전달을 지원). 장기 방안: Tailscale Funnel(포트 개방 불필요) 또는 Caddy 리버스 프록시로 자체 도메인 사용.

보안 경계

  • 파일: config.json의 allowedRoots에 잠금; .git 영구 차단; fs_edit는 반드시 먼저 fs_read(STALE_READ 버전 가드); old 텍스트는 유일해야 함

  • 네트워크: localhost/사설망/link-local 거부(SSRF), 리다이렉트 홉별 재검사, 2MB 상한, 30초 타임아웃

  • 인증: HTTP 전체 Bearer/query-token; 기본적으로 127.0.0.1에만 바인딩

  • 프라이버시: 하트비트는 창 제목+클립보드 해시만 기록(변화 시 앞 60자 미리보기 저장); 픽셀 스크린샷은 명시적 screen_capture 호출 시에만

하트비트 의미론(리화 계승)

15분마다 한 번(조정 가능 heartbeat.intervalMin). 매 홉마다 수집: 포그라운드 창・창 목록(top8)・유휴 시간・클립보드 변화・열린 할 일 수. 실패 시 간격 ×2(상한 8×), 성공 시 리셋. 로그는 vitals.ndjson에 롤링.

상류 동기화(o-pi)

  • 2026-08-23 점검: 상류 당일 대량 커밋은 내부 리팩터링(file-tools/web-tools/filesystem/lsp 단순화)이며, 6개 도구+2개 웹 도구의 동작 계약은 불변; duckduckgo-html-provider는 여전히 zero-key 폴백 경로——리마이 추출은 여전히 충실함.

  • 새 기능 read가 PDF 페이지 이미지 지원(d762209): 리마이가 이미 정렬 구현——fs_read에 pages 파라미터 추가(N / N-M / N-), 페이지 PNG의 MCP 이미지 콘텐츠 블록 반환; CLI는 fs read <pdf> --pages "1-5" 사용. 주 경로는 PDF.js(pdfjs-dist legacy)+@napi-rs/canvas 크로스 플랫폼 렌더링; Windows에서 의존성 로드 불가 시 내장 WinRT Windows.Data.Pdf로 자동 다운그레이드. 기본 단일 상한 20페이지, 총 페이지 수와 이어 읽기 위치 포함.

  • skill URI/bash 도구/approval gate는 Pi 호스트 전용이므로 추출 범위에 없음.

  • 당일 2차 점검(d795f92 new approval UI): src/approval/*와 TUI만 변경, file-tools/web-tools는 제로 변경. 이에 따라 grep 계약 정렬 완료: 비정규식은 정확한 리터럴로 다운그레이드——히트 있음→literal_fallback 경고 반환; 히트 없음→INVALID_REGEX로 빈 결과를 위장하지 않음. 테스트 통과.

라이선스와 출처(License & Attribution)

본 프로젝트는 GNU Affero General Public License v3.0 또는 이후 버전(AGPL-3.0-or-later)으로 배포되며, 전체 조항은 LICENSE에서 확인할 수 있습니다.

코드 출처 선언:

  • 파일 도구(src/core/filesys.mjs: ls/read/write/edit/find/grep)와 웹 도구(src/core/web.mjs: web_search/web_fetch)의 동작 계약과 설계는 Orion-zhen/o-pi(Pi Agent의 file-tools 및 web-tools 설계 문서, AGPL-3.0 라이선스)에서 파생되었습니다. 리마이는 그 정수의 독립적인 Node.js 제로 중복 의존성 구현이며, 코드 복사가 아닌 AGPL 동일 조항으로 오픈소스에 환원합니다.

  • 하트비트/todo/기억/시각 등 능력 프리미티브의 추출 청사진은 steve02081504/fount 생태계의 「리화」 캐릭터 능력 설계(MIT 라이선스)에서 왔습니다. 아키텍처 사상(유휴 폴링 백오프, 가중치 작업, 이름×키워드×내용 기억)만 참고했으며 코드는 복사하지 않았습니다.

  • MCP 프로토콜 구현은 공식 @modelcontextprotocol/sdk 기반.

  • PDF 렌더링은 pdf.js(Apache-2.0)와 @napi-rs/canvas(MIT)에 의존.

Available Tools

21 tools
fs_edit精確編輯A

對既有檔案做精確替換。須先 fs_read;old 必須唯一(多處命中需 replace_all 或更多上下文)。

Inputs: file (required), edits (required), force.

fs_find找路徑A

glob 路徑模糊搜尋(跳過 .git/node_modules;不搜尋內容)。

Inputs: glob, root, limit.

fs_grep搜內容A

正則逐行搜尋檔案內容(跳過 .git/node_modules 與 >1MB 檔)。非法正則時降級為精確字面量:有命中回 literal_fallback 警告,零命中才報 INVALID_REGEX。

Inputs: query (required), root, limit.

fs_ls列目錄B

列出目錄直屬成員(不遞迴、不讀內容)。

Inputs: dir.

fs_read讀檔案A

讀取檔案。文字檔用行範圍;PDF 用 pages 參數(如 "1-5"、"3"),回傳頁面 PNG 圖像內容(預設單次上限 20 頁,含總頁數與續讀位置);fs_edit 前必讀以建立觀測狀態。

Inputs: file (required), pages, maxLines, offsetLine.

fs_write寫檔案A

建立新檔或完整覆蓋(自動建父目錄)。不做局部合併。

Inputs: file (required), content (required).

heartbeat_now立即心跳A

立即執行一次心跳:收集前景視窗/閒置秒數/剪貼簿變化/todo 數量,寫入 vitals。

Inputs: no named parameters.

list_windows視窗清單A

列出前景視窗與所有有標題的視窗(行程名+標題)。輕量了解使用者正在做什麼。

Inputs: no named parameters.

memory_add記憶寫入B

新增或更新長期記憶。名稱唯一;keywords 供日後檢索觸發。內容應簡潔、去修辭、客觀(角色記憶規範)。

Inputs: name (required), content (required), keywords.

memory_forget遺忘C

依名稱刪除一條記憶。

Inputs: name (required).

memory_list記憶清單B

列出全部長期記憶。

Inputs: no named parameters.

read_clipboard讀剪貼簿A

讀取目前剪貼簿文字(上限 2 萬字元)。

Inputs: no named parameters.

screen_capture螢幕截圖A

擷取本機全螢幕畫面。回傳 PNG 圖片(多模態客戶端可直接看見畫面內容)。僅在明確需要時呼叫。

Inputs: no named parameters.

todo_add新增待辦C

新增待辦任務(open 狀態;同名 open 任務會拒絕重複)。

Inputs: name (required), weight, content.

todo_list待辦清單A

列待辦;status 可選 open/done,省略則全部。

Inputs: status.

todo_update更新待辦C

標記完成(done)/重開(reopen)/刪除(remove)。id 接受 id 或 name。

Inputs: id (required), action (required).

vitals_history徵象歷史C

最近 N 筆心跳歷史。

Inputs: n.

vitals_latest最新徵象B

最近一次心跳快照。

Inputs: no named parameters.

web_fetch抓取網頁A

讀取公開 HTTP(S) URL。readable=抽正文、source=原文;offset/limit 有界分頁;拒絕本機與私網位址。

Inputs: url (required), mode, limit, offset.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 21 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action—monitoring (screen, windows, clipboard, heartbeat), memory (add/search/list/forget), todo (add/list/update), web (search/fetch), and filesystem (ls/read/write/edit/find/grep). There is no meaningful overlap; even fs_write vs fs_edit are clearly separated by create/overwrite vs precise replacement.

    Naming Consistency5/5

    All tool names follow a consistent 'domain_action' pattern with snake_case (e.g., memory_add, web_fetch, fs_grep). The verb is consistently after the domain, and every name is lowercase, making the API predictable and easy to navigate.

    Tool Count4/5

    With 21 tools, the server is slightly above the ideal range but each tool serves a clear purpose across multiple domains (system monitoring, memory, todos, web, filesystem). The count is justified given the broad scope, though a few tools could potentially be consolidated without losing clarity.

    Completeness3/5

    The server covers most core operations for its domains—memory and todo have full CRUD-ish coverage, web has search and fetch, and filesystem has read/write/edit/find/grep. However, the absence of a file deletion tool (e.g., fs_delete) leaves the filesystem incomplete, and there is no explicit tool for renaming or moving files. This gap could cause agent failures when cleanup is required.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Provides persistent memory for MCP-compatible agents (like Copilot CLI) to save and recall knowledge across sessions, plus long-running monitoring tools.
      9
      -
    • A
      license
      B
      quality
      D
      maintenance
      An all-in-one MCP server that enables AI agents with local system capabilities like filesystem navigation, command execution, desktop automation, and a continuity memory suite for persistent cross-session project context.
      37
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Local-first memory MCP server that captures macOS screen and app context into persistent Markdown, enabling any tool-capable LLM agent to query its working history.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes MCP tools that give desktop agents durable two-tier memory with recall and graph traversal, project code intelligence (symbol lookup, impact walking, notes search), and web search with page-to-Markdown conversion. It also runs a local model gateway that routes Anthropic- and OpenAI-shaped traffic across providers with usage accounting.
      MIT