Borrowing it
Nothing to install: this file belongs to masx200/persistent-terminal-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/masx200/persistent-terminal-mcp/main/CLAUDE.mdgit clone --depth 1 https://github.com/masx200/persistent-terminal-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/masx200/persistent-terminal-mcp/claude-md)<a href="https://agentmods.dev/instructions/masx200/persistent-terminal-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/masx200/persistent-terminal-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01910 | $0.01910 |
| Opus 5 | $0.00955 | $0.00955 |
| Sonnet 5 | $0.00382 | $0.00382 |
| Haiku 4.5 | $0.00191 | $0.00191 |
Grade A, and why
persistent-terminal-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 302 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
项目概述
这是一个基于 TypeScript 的 Model Context Protocol (MCP) 服务器,提供持久化终端会话管理功能。项目实现了完整的 MCP 协议标准,支持多种客户端(Claude Desktop、Claude Code、Cursor、Cline 等)。
核心架构
主要组件
-
MCP 服务器 (
src/mcp-server.ts)- 实现 Model Context Protocol 标准
- 处理 JSON-RPC 通信
- 提供工具、资源、提示词和日志功能
-
终端管理器 (
src/terminal-manager.ts)- 基于
node-pty的持久化终端会话管理 - 支持多终端会话并发
- 智能输出处理和 Spinner 压缩
- 自动超时清理机制
- 基于
-
Web UI 系统
- 基于 Express + WebSocket 的实时界面 (
src/web-ui-server.ts) - 使用 xterm.js 渲染终端界面 (
public/terminal.html) - 支持交互式操作和实时通信
- 基于 Express + WebSocket 的实时界面 (
-
REST API 服务器 (
src/rest-server.ts,src/rest-api.ts)- 独立的 HTTP 服务器(端口 3001)
- 完整的 RESTful API 接口
- 支持非 MCP 客户端集成
数据流架构
MCP Client ↔ MCP Server ↔ Terminal Manager ↔ Node PTY ↔ Terminal Process
↓
Web UI Server ↔ WebSocket ↔ Browser
↓
REST API Server ↔ HTTP Client
开发命令
构建和运行
# 构建 TypeScript 项目
npm run build
# 开发模式运行 MCP 服务器
npm run dev
# 生产模式运行
npm run start
# 开发模式运行 REST API 服务器
npm run dev:rest
测试
# 运行所有测试
npm test
# 仅运行单元测试
npm run test:unit
# 运行集成测试
npm run test:integration
# 运行特定集成测试
npm run test:integration:stdio
npm run test:integration:cursor
npm run test:integration:terminal
# 运行测试并生成覆盖率报告
npm test -- --coverage
示例和调试
# 基本使用示例
npm run example:basic
# REST API 演示
npm run example:rest
# 交互式演示
npm run example:interactive
# 智能读取演示
npm run example:smart
# Spinner 压缩测试
npm run example:spinner
# Web UI 测试
npm run example:webui
# 测试所有工具
npm run test:tools
环境配置
必需环境变量
# REST API 服务器端口
REST_PORT=3001
# 终端配置
MAX_BUFFER_SIZE=10000 # 最大缓冲区行数
SESSION_TIMEOUT=86400000 # 会话超时时间(24小时)
# 终端尺寸
DEFAULT_COLS=80
DEFAULT_ROWS=24
# 日志级别
LOG_LEVEL=info
开发配置
# 启用 MCP 调试模式
MCP_DEBUG=true
# 启用应用调试模式
DEBUG=true
关键技术细节
MCP 协议实现
- 使用
@modelcontextprotocol/sdk实现 - 支持 stdio 传输模式
- 保持 stdout 纯净,所有日志输出到 stderr
- 实现完整的工具、资源、提示词和日志功能
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 302 lines · 1,910 tokens per session scan A 9a4cee6ec337
persistent-terminal-mcp CLAUDE.md is an instructions file published in the GitHub repository masx200/persistent-terminal-mcp (4 stars, last pushed 4mo ago), licensed MIT. It adds 1,910 tokens to every session, about $0.0095 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
vibe-coding-prompt-template backend.instructions.md
Instructions for KhazP/vibe-coding-prompt-template: Read AGENTS.md, agentdocs/techstack.md, and agentdocs/codepatterns.md.
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.