Prerequisites: requires
lxCLI to be configured and logged in.
⚡ When should you use this skill?
Scenarios for use:
- The user says "browse the knowledge base"/"look at the knowledge base structure"
- The user says "search file contents"/"view document contents"
- The user says "run grep/ls/cat in the knowledge base"
Prohibited in this skill:
- Do not modify content: the user says "edit a certain page"/"push changes" → immediately switch to the lx-git or lx-block skill
- Shell is read-only:
/kbis a read-only file system,rm/mv/cp/mkdir/touchand other write commands will be intercepted
⚡ How to choose commands? (Decision tree)
识别场景 →
├── 交互式浏览知识库内容? → lx sh(REPL 模式)
├── 执行单条命令后退出? → lx sh --exec "<command>"
├── 连接远程知识库(无需本地 clone)? → lx sh --space sp_xxx
├── 在已有 worktree 中浏览? → cd <worktree> && lx sh
├── 搜索知识库内容? → lx sh --exec "grep -r <pattern> /kb"
├── 查看文档结构? → lx sh --exec "tree /kb"
└── 需要修改内容(push/commit)? → 切换到 lx-git skill
⚠️ High-risk operations and default preferred paths
Read-only file system:
- In Shell,
/kbis read-only,rm/mv/cp/mkdir/touchand other write commands will be intercepted - To modify content, use
lx gitorlx blockcommands
Default preferred path:
- Agent should preferentially use
lx sh --exec "..."for a single execution, avoiding starting the REPL - Do not want to clone → use MCP remote mode
lx sh --space sp_xxx - Already have a local worktree → execute in the worktree directory
lx sh
Two running modes:
| Mode | Startup method | /kb mapping | Applicable scenarios |
|---|---|---|---|
| Worktree | cd <worktree> && lx sh |
Local disk | An already cloned knowledge base that needs to be browsed quickly |
| MCP remote | lx sh --space sp_xxx |
Remote MCP API | Do not want to clone, browse remote content directly |
Available tools
Startup command
| Command | Description |
|---|---|
lx sh |
Start REPL interactive mode |
lx sh --exec "<cmd>" |
Execute a single command and exit |
lx sh --space sp_xxx |
MCP remote mode |
lx sh --path <dir> |
Specify the worktree path |
Detailed parameters:lx sh --help
Shell built-in commands (used in lx sh )
| Category | Command |
|---|---|
| File browsing | ls, cat, tree, stat |
| Search | grep, find, fzf |
| Text processing | head, tail, wc, sort, uniq, awk, cut, tr |
| Navigation | cd, pwd, echo |
| Bridge commands | search, mcp, git |
Detailed parameters:lx sh --help, or enter within the Shell help
🎯 Execution rules
- Read-only file system: in Shell,
/kbis read-only,rm/mv/cp/mkdir/touchand other write commands will be intercepted. To modify content, uselx gitorlx blockcommands. - Pipes and redirection: fully supports
|pipes and>redirection. Such asgrep -r "API" /kb | head -20。 - Alias system:
rg→grep -rn、eza→ls、fd→find、bat→cat. Automatically converts when users use modern tool names. - git in Shell is read-only: enter in the Shell
git status/git log/git diffavailable (read-only), butgit push/git commitand other write operations will prompt you to exit the Shell and uselx gitto execute. /tmpwritable:/tmpdirectory is a memory filesystem, where temporary data can be written.- Non-interactive mode: Agents should prefer using
lx sh --exec "..."for one-shot execution, avoiding starting a REPL. - search command: The Shell's built-in
search <keyword>is a shortcut wrapper for the MCPsearch_kb_search. - mcp passthrough: Within the Shell,
mcp <tool_name> [json_args]can directly call any MCP tool.
Typical combined workflow
Browse the structure of a remote knowledge base
# 直接连接远程,不需要 clone
lx sh --space sp_xxx
# 在 Shell 中:
tree /kb --depth 2
ls -la /kb/项目文档/
cat /kb/项目文档/README.md
Search for content in the knowledge base
# 单次执行
lx sh --exec "grep -r 'OAuth' /kb | head -10"
# 或使用内置 search
lx sh --exec "search OAuth 认证"
Analyze document content
lx sh --exec "wc -l /kb/**/*.md"
lx sh --exec "grep -rl 'TODO' /kb"
lx sh --exec "find /kb -name '*.md' | wc -l"
Programming API usage (Agent integration)
# 执行命令并获取输出
lx sh --exec "grep -r 'API 设计' /kb | head -5"
# 透传 MCP 调用
lx sh --exec 'mcp entry_describe_entry {"entry_id": "entry_xxx"}'