dsh-deeptutor 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  # DeepTutor Learning Assistant (dsh bundle + SKILL)
2
2
 
3
3
  > This README is the human-facing documentation; `SKILL.md` is the agent-facing instruction file (loaded on demand).
4
- > The bundle and this skill both live in `TecFancy/dsh-deeptutor`.
4
+ > The bundle, the Claude Code plugin and this skill all live in `TecFancy/dsh-deeptutor`.
5
5
 
6
6
  Bridges **DeepTutor** (open-source personalized tutoring platform) into your
7
7
  agent: combines your **personal knowledge bases** (RAG retrieval) with
@@ -9,8 +9,9 @@ agent: combines your **personal knowledge bases** (RAG retrieval) with
9
9
  questions, and study plans — then archives your notes to a DeepTutor notebook
10
10
  for later review.
11
11
 
12
- Shipped as the npm bundle `dsh-deeptutor` for DeepSeek Harness (dsh); the
13
- installer also copies this skill to `~/.dsh/skills/deeptutor/`.
12
+ Shipped as the npm bundle `dsh-deeptutor` for DeepSeek Harness (dsh), whose
13
+ installer also copies this skill to `~/.dsh/skills/deeptutor/`, and as a
14
+ Claude Code plugin (skills + an MCP server with the same tools).
14
15
 
15
16
  ## Features
16
17
 
@@ -26,7 +27,11 @@ installer also copies this skill to `~/.dsh/skills/deeptutor/`.
26
27
  ## Installation
27
28
 
28
29
  ```bash
29
- # One-shot: bundle + skill, from the published package
30
+ # Claude Code: plugin = this skill + html-doc + MCP tools
31
+ claude plugin marketplace add TecFancy/dsh-deeptutor
32
+ claude plugin install dsh-deeptutor@dsh-deeptutor
33
+
34
+ # dsh, one-shot: bundle + skill, from the published package
30
35
  pnpm dlx dsh-deeptutor --profile web
31
36
 
32
37
  # Or install the skill manually from a checkout
@@ -75,6 +80,12 @@ The agent follows the SKILL workflow automatically:
75
80
  | `deeptutor_run` | `capability` (deep_solve / deep_question / deep_research / chat / mastery_path / …), `kbs`, `tools` (rag / web_search), `session_id`, `config`, `language` |
76
81
  | `deeptutor_kb` | `list` / `search` (kb + query + mode) / `info` |
77
82
  | `deeptutor_note` | `notebook` (auto-created), `title`, `type` (chat/question/research/solve), `content` (Markdown) |
83
+ | `deeptutor_cli` | `args` (anything after `deeptutor`), `confirm` (state-changing commands, only on the user's request). Destructive and interactive commands are refused. |
84
+
85
+ Capabilities are not a fixed list: `deeptutor_run` accepts whatever the
86
+ deployment's ready modules provide (`deeptutor module list`), and every other
87
+ CLI command is reachable through `deeptutor_cli` and discoverable with
88
+ `--help`, so DeepTutor upgrades need no plugin release.
78
89
 
79
90
  ## Troubleshooting
80
91
 
@@ -99,12 +110,12 @@ A: Only env vars change (`DEEPTUTOR_SSH_HOST` / remote paths) — never the SKIL
99
110
  A: No. Tools query `deeptutor_kb list` dynamically; new bases are picked up automatically.
100
111
 
101
112
  **Q: Can other agents (Claude Code / Codex) use it?**
102
- A: Yes. The SKILL follows the Agent Skills standard and can be linked into `~/.agents/skills/`; the `deeptutor_*` tools are registered by the dsh bundle; other agents use the plain CLI path described in the SKILL.
113
+ A: Yes. Claude Code installs the plugin and gets the skill plus the `deeptutor_*` tools over MCP. Other MCP clients can run the `dsh-deeptutor-mcp` bin (`npx -y -p dsh-deeptutor dsh-deeptutor-mcp`); agents without MCP follow the plain CLI path in the SKILL.
103
114
 
104
115
  ## Maintenance
105
116
 
106
117
  The bundle code (`src/`) and this skill live in `TecFancy/dsh-deeptutor`; edit both there.
107
118
 
108
- - Code: `src/index.ts` for tool wiring, `cli-exec.ts` / `turn.ts` for CLI execution, `config.ts` for env vars/helpers → `npm run typecheck && npm test && npm run build`
119
+ - Code: `src/tools.ts` defines the tools (dsh wiring in `index.ts`, MCP in `mcp.ts`), `cli-policy.ts` the `deeptutor_cli` tiers, `discovery.ts` capability discovery, `cli-exec.ts` / `turn.ts` CLI execution, `config.ts` env vars/helpers → `npm run typecheck && npm test && npm run build`; after a DeepTutor upgrade, `npm run check:cli`
109
120
  - Skill: edit `.agents/skills/deeptutor/` directly and keep it in step with the tool parameters
110
121
  - Release: bump the version in `package.json`, push a `v*` tag → CI publishes to npm
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: deeptutor
3
- description: Combine DeepTutor personal knowledge bases (RAG) with authoritative web sources to generate learning content, self-test questions, and study plans, and archive notes to a notebook. Works with both local and remote DeepTutor deployments. Use when the user wants to learn/review a technical topic (e.g. .NET, C#, SQL Server, React), get a deep explanation grounded in their own knowledge bases, generate exercises, or plan their learning.
3
+ description: Combine DeepTutor personal knowledge bases (RAG) with authoritative web sources to generate learning content, self-test questions, and study plans, and archive notes to a notebook. Works with both local and remote DeepTutor deployments. Use when the user wants to learn/review a technical topic (e.g. .NET, C#, SQL Server, React), get a deep explanation grounded in their own knowledge bases, generate exercises, plan their learning, or manage their DeepTutor knowledge bases and notebooks.
4
4
  ---
5
5
 
6
6
  # DeepTutor Learning Assistant (Personal Knowledge Base)
@@ -9,28 +9,32 @@ Combines the user's **personal knowledge bases** (RAG retrieval) with
9
9
  **authoritative web sources** to produce learning content, self-test
10
10
  questions, and study plans, then archives notes to a DeepTutor notebook.
11
11
 
12
- This skill is **agent-agnostic**: every action below has two equivalent
13
- drivers —
12
+ ## Drivers
14
13
 
15
- - **dsh (with the `dsh-deeptutor` bundle installed):** the `deeptutor_*` tools.
16
- They drive the DeepTutor CLI for you, locally or over SSH for remote
17
- deployments.
18
- - **Any agent / plain CLI:** the `deeptutor` executable directly (local
19
- binary on PATH, or over SSH for remote deployments). No extension needed.
14
+ This skill is **agent-agnostic**. Use the first driver that exists in your
15
+ environment; the action, not the tool, is what matters.
20
16
 
21
- Pick whichever path exists in your environment; the action, not the tool, is
22
- what matters.
17
+ 1. **The `deeptutor_*` tools** (preferred). dsh registers them through the
18
+ `dsh-deeptutor` bundle; Claude Code and other MCP clients get the same four
19
+ tools from the `dsh-deeptutor` plugin's MCP server (in Claude Code they are
20
+ named `mcp__plugin_dsh-deeptutor_deeptutor__deeptutor_run` and so on).
21
+ 2. **The plain CLI.** `deeptutor <args>` locally, or
22
+ `ssh <DEEPTUTOR_SSH_HOST> <DEEPTUTOR_REMOTE_BIN> <args>` for a remote
23
+ deployment. On Windows run it from PowerShell, not Git Bash: MSYS rewrites
24
+ `/home/...` env values into Windows paths.
23
25
 
24
- ## When to Use
25
-
26
- - The user wants to learn or review a technical topic (.NET, C#, SQL Server, React, …)
27
- - The user wants content grounded in their own notes/knowledge bases
28
- - The user wants generated exercises, quizzes, or a learning plan
29
- - The user wants to archive study notes for later review
26
+ | Tool | Use it for |
27
+ | ---------------- | --------------------------------------------------------------------------- |
28
+ | `deeptutor_run` | one learning turn: explanation, questions, research, mastery path, … |
29
+ | `deeptutor_kb` | list / search / info of knowledge bases |
30
+ | `deeptutor_note` | archive a Markdown note into a notebook (find-or-create, file upload) |
31
+ | `deeptutor_cli` | **everything else** the CLI offers: `deeptutor <args>` behind safety tiers |
30
32
 
31
33
  ## Configuration (env vars, agent-agnostic)
32
34
 
33
- Nothing is hardcoded in this skill; all server parameters come from environment variables (put them in `~/.bashrc` or `~/.zshrc`; any agent — dsh / Claude Code / Codex / opencode — inherits them at startup). **Deployment mode adapts automatically**:
35
+ Nothing is hardcoded in this skill; all server parameters come from environment
36
+ variables that every agent inherits at startup. **Deployment mode adapts
37
+ automatically**:
34
38
 
35
39
  ```bash
36
40
  # Remote deployment (DeepTutor on a server, driven over SSH)
@@ -38,146 +42,107 @@ export DEEPTUTOR_SSH_HOST="tencent-cloud" # SSH host alias (set = remo
38
42
  export DEEPTUTOR_REMOTE_BIN="/home/ubuntu/my-deeptutor/.venv/bin/deeptutor"
39
43
  export DEEPTUTOR_REMOTE_HOME="/home/ubuntu/my-deeptutor"
40
44
 
41
- # Local deployment (DeepTutor on this machine) — leave DEEPTUTOR_SSH_HOST unset for local mode
45
+ # Local deployment: leave DEEPTUTOR_SSH_HOST unset
42
46
  # export DEEPTUTOR_LOCAL_BIN="deeptutor" # local CLI path (default: deeptutor on PATH)
43
47
  ```
44
48
 
45
- - **Tools path:** the bundle runs the local `deeptutor` CLI, or the remote one
46
- over SSH when `DEEPTUTOR_SSH_HOST` is set. `deeptutor serve` does not need to
47
- be reachable from this machine.
48
- - **Plain CLI path:** run `deeptutor <subcommand>` locally, or
49
- `ssh <DEEPTUTOR_SSH_HOST> <DEEPTUTOR_REMOTE_BIN> <subcommand>` for remote
50
- deployments.
51
- - DeepTutor 1.7+ ships `kb`, `notebook` and most capabilities as optional
52
- modules; `deeptutor module list` shows which are installed and enabled.
53
- - Migrating to another server only requires changing env vars — never this skill.
54
-
55
- ## Actions Cheat Sheet
56
-
57
- | Action | Tools (`deeptutor_*`) | CLI equivalent (`deeptutor …`) |
58
- | ---------------------------- | -------------------------------- | ------------------------------------------------------------ |
59
- | List knowledge bases | `deeptutor_kb action=list` | `kb list --format json` |
60
- | Search a knowledge base | `deeptutor_kb action=search` | `kb search <kb> "<query>" --format json --mode hybrid` |
61
- | Show a knowledge base's info | `deeptutor_kb action=info` | `kb info <kb>` |
62
- | Run a learning capability | `deeptutor_run capability=<cap>` | `run <cap> "<prompt>" --format json` |
63
- | Archive a note to a notebook | `deeptutor_note` | `notebook add-md <nb-id> <file> --title "<t>" --type <type>` |
64
- | View lightweight memory | — (CLI only) | `memory show` |
65
- | List / inspect sessions | — (CLI only) | `session list` · `session show <id>` |
66
- | Show a notebook's records | — (CLI only) | `notebook show <name>` |
67
- | Inspect configuration | — (CLI only) | `config show` (troubleshooting) |
68
-
69
- Capabilities: `deep_solve` / `deep_question` / `deep_research` / `chat` /
70
- `mastery_path` / `visualize` / `math_animator`.
71
-
72
- Useful `run` flags: `--kb <name>` (mount a knowledge base, repeatable),
73
- `--tool <name>` (`rag`, `web_search`, `reason`, …, repeatable),
74
- `--session <id>` (continue context), `--language zh`, `--config k=v`
75
- (repeatable; e.g. `--config num_questions=5`), `--config-json '{"..."}'`
76
- (complex config), `--notebook-ref <name>` / `--history-ref <id>` (reference
77
- notebooks or past sessions from the prompt).
78
-
79
- ## Discovering Commands
80
-
81
- The command set evolves — this cheat sheet is a curated subset, not the full
82
- surface. Before using a command not listed here, **discover it from the CLI
83
- itself** and never invent flags:
49
+ `deeptutor serve` never needs to be reachable: every call runs the CLI.
50
+ Changing servers only changes env vars, never this skill.
84
51
 
85
- ```bash
86
- deeptutor --help # top-level commands
87
- deeptutor <cmd> --help # one subcommand's options
88
- ```
52
+ ## Discover, don't assume
53
+
54
+ DeepTutor's command set, capabilities and tools change between releases and
55
+ between deployments (1.7+ ships them as optional modules). This skill
56
+ deliberately lists only the core workflow. For anything else, **ask the CLI**
57
+ and use only what it shows; never invent commands or flags:
58
+
59
+ | To learn | Call |
60
+ | -------------------------------- | ----------------------------------------------------------------- |
61
+ | top-level commands | `deeptutor_cli args=["--help"]` |
62
+ | one command's subcommands/flags | `deeptutor_cli args=["kb","--help"]`, `["kb","search","--help"]` |
63
+ | capabilities ready on this host | `deeptutor_cli args=["module","list"]` (JSON; `capabilities` of modules with `ready: true`) |
64
+ | tools a turn can enable | `deeptutor_cli args=["plugin","list"]`, details via `["plugin","info","<name>"]` |
65
+ | knowledge bases | `deeptutor_kb action=list` |
89
66
 
90
- Read the output, then use only what it shows. If a needed capability is not
91
- in `--help`, report that to the user instead of guessing.
67
+ `deeptutor_run` also tells you the available capabilities when you pick one
68
+ that is not ready. If a needed capability or command does not exist, say so to
69
+ the user instead of guessing.
70
+
71
+ ## Safety tiers (`deeptutor_cli`)
72
+
73
+ - **read**: runs directly. `--help`; verbs `list`, `show`, `info`, `search`,
74
+ `state`, `status`, `list-*`; `doctor`; `run`.
75
+ - **confirm**: everything else, including commands you have just discovered
76
+ (`kb create`, `kb add`, `notebook add-md`, `module enable`, …). Set
77
+ `confirm=true` **only after the user explicitly asked for that change**;
78
+ never proactively, never to "try it".
79
+ - **blocked**: destructive verbs (`delete`, `remove*`, `clear`, `uninstall`,
80
+ `rollback`, `login`, …) and interactive or long-running commands (`chat`,
81
+ `start`, `stop`, `serve`, `init`). The tool refuses them; tell the user the
82
+ exact command to run in their own terminal.
83
+
84
+ With the plain CLI driver the same rules apply; you enforce them yourself.
92
85
 
93
86
  ## Recommended Learning Workflow
94
87
 
95
88
  ### 1. Gather material from both channels
96
89
 
97
- - `web_search` for **authoritative sources**: official docs (Microsoft Learn / learn.microsoft.com), official blogs, trusted tutorials. Keep the source links.
98
- - Search the user's personal knowledge base (pick the right one: dotnet-related → their dotnet base, database → sqlserver) to get their own curated notes:
99
- - Tools: `deeptutor_kb action=search kb=<kb> query="<topic>"`
100
- - CLI: `deeptutor kb search <kb> "<topic>" --format json`
101
- - Always list bases first (`deeptutor_kb action=list` / `deeptutor kb list --format json`) — never assume names.
90
+ - `web_search` for **authoritative sources**: official docs (learn.microsoft.com, …), official blogs, trusted tutorials. Keep the links.
91
+ - Search the user's personal knowledge base. List bases first, never assume names:
92
+ `deeptutor_kb action=list`, then `deeptutor_kb action=search kb=<kb> query="<topic>"`.
102
93
 
103
94
  ### 2. Deep Solve
104
95
 
105
- - Tools: `deeptutor_run capability=deep_solve prompt="<topic>" kbs=[<kb>] tools=[rag, web_search] language=zh`
106
- - CLI: `deeptutor run deep_solve "<topic>" --kb <kb> --tool rag --tool web_search --language zh --format json`
96
+ `deeptutor_run capability=deep_solve prompt="<topic>" kbs=[<kb>] tools=[rag, web_search] language=zh`
97
+
98
+ (CLI: `deeptutor run deep_solve "<topic>" --kb <kb> --tool rag --tool web_search --language zh --format json`)
107
99
 
108
- **Always record the returned `session_id`** — reuse it for every follow-up turn so DeepTutor keeps the context (chat history, knowledge bases, tools).
100
+ **Record the returned `session_id`** and reuse it for every follow-up turn so
101
+ DeepTutor keeps the context (history, knowledge bases, tools).
109
102
 
110
103
  ### 3. Follow-up questions / targeted reinforcement
111
104
 
112
- Continue with the same `session_id`: details, code examples, common pitfalls, differences vs. authoritative sources.
105
+ Continue with the same `session_id`: details, code examples, pitfalls,
106
+ differences vs. authoritative sources.
113
107
 
114
108
  ### 4. Self-test
115
109
 
116
- - Tools: `deeptutor_run capability=deep_question prompt="<topic essentials>" session_id=<same> config={num_questions: 5} kbs=[<kb>] language=zh`
117
- - CLI: `deeptutor run deep_question "<topic essentials>" --session <same> --config num_questions=5 --kb <kb> --language zh --format json`
110
+ `deeptutor_run capability=deep_question prompt="<topic essentials>" session_id=<same> config={num_questions: 5} kbs=[<kb>] language=zh`
118
111
 
119
- ### 5. Output a study plan
112
+ ### 5. Study plan
120
113
 
121
- Combine all three material sources into a structured plan (Markdown):
122
-
123
- - Learning goals and prerequisites
124
- - Core concept list (marked: from personal KB / authoritative link)
125
- - Phased schedule (each phase: concept → authoritative reading → KB review → exercises)
126
- - Quiz questions and acceptance criteria
127
- - Reference list (authoritative links + KB hit sources)
114
+ Combine the three sources into a structured Markdown plan: goals and
115
+ prerequisites; core concepts (marked personal KB / authoritative link); phased
116
+ schedule (concept → authoritative reading → KB review → exercises); quiz and
117
+ acceptance criteria; references.
128
118
 
129
119
  ### 5b. Render study material to local HTML (recommended)
130
120
 
131
- When the user wants readable/browsable/printable study material, render the
132
- answers to a self-contained HTML page (dark/light toggle, TOC, collapsible
133
- quiz answers, print-friendly) with the **html-doc skill** (zero-dependency
134
- Node converter):
135
-
136
- ```bash
137
- node skills/html-doc/scripts/md-to-html.js <answer.md> --out <page.html> --title "<主题>" --toc
138
- ```
139
-
140
- When given the `html` param, `deeptutor_run` does this automatically:
121
+ Pass `html` to `deeptutor_run` and the answer is rendered to a self-contained
122
+ page (dark/light toggle, TOC, collapsible quiz answers, print-friendly) with
123
+ the bundled **html-doc** converter, plus the `.md` source next to it:
141
124
 
142
125
  ```
143
- deeptutor_run capability=deep_solve prompt=<topic> kbs=[...] tools=[rag, web_search]
144
- html="data/study/<topic>/knowledge.html" html_title="<主题> · 知识点" language=zh
145
- deeptutor_run capability=deep_question prompt=<topic essentials> config={num_questions: 5}
146
- html="data/study/<topic>/quiz.html" html_title="<主题> · 自测题" language=zh
126
+ deeptutor_run capability=deep_solve prompt=<topic> kbs=[...] tools=[rag, web_search]
127
+ html="data/study/<topic>/knowledge.html" html_title="<主题> · 知识点" language=zh
147
128
  ```
148
129
 
149
- Then tell the user the HTML file paths so they can open them in a browser.
150
-
151
- ### 6. Archive
152
-
153
- Store the final notes/plan in a server notebook (e.g. `dotnet-learning`) so they can be retrieved for review later:
154
-
155
- - Tools: `deeptutor_note notebook=<name> title="<t>" type=solve content=<markdown>`
156
- - CLI:
157
- ```bash
158
- deeptutor notebook list # find the notebook id
159
- deeptutor notebook create <name> --description "archived" # only if missing
160
- deeptutor notebook add-md <nb-id> <notes.md> --title "<t>" --type solve
161
- ```
162
-
163
- ## Safety Boundaries
130
+ Relative paths resolve against your working directory. To render other
131
+ Markdown, use the html-doc skill's converter
132
+ (`node <html-doc skill dir>/scripts/md-to-html.js <in.md> --out <out.html> --title "<t>" --toc`).
133
+ Tell the user the file paths.
164
134
 
165
- Read-only exploration is always fine: `kb list/info/search`, `memory show`,
166
- `session list/show`, `config show`, `notebook list/show`.
135
+ ### 6. Archive (only on request)
167
136
 
168
- Never run destructive commands: `kb delete`, `memory clear`, `session delete`,
169
- `notebook remove-record`. Creation/update commands (`kb create/add`,
170
- `notebook create/add-md/replace-md`, `session rename`) only on the user's
171
- explicit request — never proactively.
137
+ `deeptutor_note notebook=<name> title="<t>" type=solve content=<markdown>`
138
+ (creates the notebook if missing).
172
139
 
173
140
  ## Notes
174
141
 
175
- - Tool calls run the DeepTutor CLI (locally or over SSH) and return when the turn finishes; there is no live progress stream.
176
- - CLI-only flags (not exposed as `deeptutor_run` tool parameters): `--notebook-ref`, `--history-ref`. The tool's `config` object is passed as `--config k=v` for scalars and `--config-json` for nested values.
177
- - `deep_research` can take minutes: give a generous timeout (900+) or split long tasks.
178
- - Results may be truncated (default 30000 chars) — ask to continue for the full content.
179
- - RAG hits can be noisy; treat official sources as authoritative and point out conflicts to the user.
180
- - Do not delete knowledge bases or run destructive operations (see Safety
181
- Boundaries above); `kb create/add` is fine, but only on the user's explicit
182
- request, never proactively.
183
- - CLI output: add `--format json` for machine-readable events; without it you get human-readable text.
142
+ - Calls return when the turn finishes; there is no live progress stream.
143
+ - `deep_research` can take minutes: pass `timeout` 900+ or split the task.
144
+ - Results are truncated at `max_chars` (default 30000); ask to continue for more.
145
+ - `deeptutor_run` covers the common flags; CLI-only flags such as
146
+ `--notebook-ref` / `--history-ref` go through `deeptutor_cli args=["run", …]`.
147
+ - RAG hits can be noisy; treat official sources as authoritative and point out
148
+ conflicts to the user.
package/README.md CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  **English** | [简体中文](https://github.com/TecFancy/dsh-deeptutor/blob/main/README.zh.md)
4
4
 
5
- A **learning-assistant extension for DeepSeek Harness (dsh)**. It connects your
6
- agent to a [HKUDS/DeepTutor](https://github.com/HKUDS/DeepTutor) tutoring
7
- service, so a dsh session can explain topics in depth, quiz you, plan learning
8
- paths, search your personal knowledge bases, and keep a study notebook — all
9
- without leaving the harness.
5
+ A **learning-assistant extension for DeepSeek Harness (dsh) and Claude Code**.
6
+ It connects your agent to a [HKUDS/DeepTutor](https://github.com/HKUDS/DeepTutor)
7
+ tutoring service, so a session can explain topics in depth, quiz you, plan
8
+ learning paths, search your personal knowledge bases, and keep a study
9
+ notebook, all without leaving the agent. In dsh it loads as a bundle; in
10
+ Claude Code (or any MCP client) the same tools are served by a bundled MCP
11
+ server, installed as a Claude Code plugin.
10
12
 
11
13
  Ask the agent *"teach me async/await"* and it can run a deep-solve, render the
12
14
  answer as a self-contained HTML study page you can open in a browser, and
@@ -14,20 +16,41 @@ archive a summary into your notebook.
14
16
 
15
17
  ## What it adds
16
18
 
17
- Three agent-facing tools that the model uses whenever you ask for learning help:
19
+ Four agent-facing tools that the model uses whenever you ask for learning help:
18
20
 
19
21
  | Tool | What it does |
20
22
  |---|---|
21
- | `deeptutor_run` | Runs one learning capability: `deep_solve` (in-depth explanation), `deep_question` (self-test questions), `deep_research`, `chat`, `mastery_path` (learning-path planning), `visualize` / `math_animator` (visualization). Can mount your knowledge bases (`kbs`) and tools (`rag`, `web_search`, `reason`, `code_execution`, …); returns a `session_id` so later turns continue the same context. |
23
+ | `deeptutor_run` | Runs one learning capability, e.g. `deep_solve` (in-depth explanation), `deep_question` (self-test questions), `deep_research`, `chat`, `mastery_path` (learning-path planning), `visualize`. Can mount your knowledge bases (`kbs`) and tools (`rag`, `web_search`, `reason`, `code_execution`, …); returns a `session_id` so later turns continue the same context, and can render the answer to an HTML study page. |
22
24
  | `deeptutor_kb` | Lists, searches, and inspects your personal knowledge bases (RAG) |
23
25
  | `deeptutor_note` | Archives Markdown study notes (plans, summaries, wrong answers) into a server notebook |
24
-
25
- The seven capabilities above are the fixed enum accepted by `deeptutor_run`.
26
- The underlying DeepTutor CLI may expose more — enumerate the full command set
27
- with `deeptutor --help` / `deeptutor <cmd> --help`. The `deeptutor` skill
28
- instructs the agent to discover commands this way and, when the tool's enum
29
- doesn't cover a capability, to drive the CLI directly (local binary or over
30
- SSH).
26
+ | `deeptutor_cli` | Runs any other DeepTutor CLI command, behind safety tiers (below) |
27
+
28
+ ### Following DeepTutor upgrades without plugin releases
29
+
30
+ The plugin does not mirror DeepTutor's command surface, so a DeepTutor upgrade
31
+ that adds commands, capabilities or tools needs no plugin change:
32
+
33
+ - **Capabilities are discovered at runtime.** `deeptutor_run` takes any
34
+ capability name. The plugin reads `deeptutor module list` (JSON, cached for
35
+ five minutes) to learn which capabilities the deployment's ready modules
36
+ provide; a capability whose module is not ready fails fast with the reason and
37
+ the list of available ones, and names no module lists are passed straight to
38
+ the CLI (they may come from a DeepTutor plugin).
39
+ - **Every other command goes through `deeptutor_cli`.** The agent discovers
40
+ commands from the CLI itself (`args: ["--help"]`, then `["kb", "--help"]`, …)
41
+ instead of a list baked into the plugin. Safety tiers keep the passthrough
42
+ honest about commands it has never seen:
43
+
44
+ | Tier | Commands | Behaviour |
45
+ |---|---|---|
46
+ | read | `--help`, verbs `list` / `show` / `info` / `search` / `state` / `status` / `list-*`, `doctor`, `run` | runs directly |
47
+ | confirm | everything else, including verbs the plugin does not know yet | runs only with `confirm: true`, which the agent may set only after you explicitly asked for that change |
48
+ | blocked | `delete`, `remove*`, `clear`, `uninstall`, `rollback`, `login`, …; interactive or long-running `chat` / `start` / `stop` / `serve` / `init` | refused; run them in a terminal yourself |
49
+
50
+ - **Drift check.** Only the few CLI shapes the dedicated tools are built on
51
+ (`run --format json` events, `kb search`, `notebook add-md`, `module list`)
52
+ can break the plugin. `npm run check:cli` checks them against the deployment
53
+ your env vars point at; run it after upgrading DeepTutor.
31
54
 
32
55
  ## Example session
33
56
 
@@ -51,7 +74,8 @@ study page, then archived to a notebook):
51
74
 
52
75
  ## Requirements
53
76
 
54
- - A working DeepSeek Harness (dsh) install, 0.1.0-rc.6 or newer. The manifest
77
+ - An agent host: Claude Code (or another MCP client) with Node ≥ 20, or a
78
+ working DeepSeek Harness (dsh) install, 0.1.0-rc.6 or newer. The manifest
55
79
  declares a version floor rather than a ceiling, so a new dsh release is never
56
80
  refused at install time; a scheduled probe boots the plugin against the
57
81
  current npm `latest` and `next` hosts instead and opens an issue when
@@ -67,7 +91,40 @@ study page, then archived to a notebook):
67
91
  and most capabilities come from optional modules; check that the ones you
68
92
  use are installed and enabled with `deeptutor module list`.
69
93
 
70
- ## Install into a profile (bundle)
94
+ ## Install into Claude Code (plugin)
95
+
96
+ This repo is also a Claude Code plugin marketplace. Inside Claude Code:
97
+
98
+ ```text
99
+ /plugin marketplace add TecFancy/dsh-deeptutor
100
+ /plugin install dsh-deeptutor@dsh-deeptutor
101
+ ```
102
+
103
+ or from a shell:
104
+
105
+ ```sh
106
+ claude plugin marketplace add TecFancy/dsh-deeptutor
107
+ claude plugin install dsh-deeptutor@dsh-deeptutor
108
+ ```
109
+
110
+ The plugin brings the two skills (`deeptutor`, `html-doc`) and an MCP server
111
+ named `deeptutor` that serves the four tools (Claude Code shows them as
112
+ `mcp__plugin_dsh-deeptutor_deeptutor__deeptutor_run` and so on). Set the
113
+ `DEEPTUTOR_*` env vars (see [Configuration](#configuration-env-vars-agent-agnostic))
114
+ where Claude Code can inherit them, then restart Claude Code.
115
+
116
+ The server is started by `scripts/mcp-launch.mjs`, which picks the first entry
117
+ that works: compiled `lib/` → the plugin's own `src/` via Node's type stripping
118
+ (Node ≥ 22.6, no network) → `npx dsh-deeptutor@<plugin version>` for older Node.
119
+ Either way the server runs the code of the installed plugin version.
120
+
121
+ **Other MCP clients** (Codex, Cursor, …) can run the published bin directly:
122
+
123
+ ```json
124
+ { "command": "npx", "args": ["-y", "-p", "dsh-deeptutor", "dsh-deeptutor-mcp"] }
125
+ ```
126
+
127
+ ## Install into a dsh profile (bundle)
71
128
 
72
129
  The package is published to npm as `dsh-deeptutor`. Recommended one-liner —
73
130
  runs the bundled installer (`scripts/install-profile.mjs`, exposed as the
@@ -125,7 +182,7 @@ install`:
125
182
 
126
183
  ```json
127
184
  {
128
- "dependencies": { "dsh-deeptutor": "^0.2.0" },
185
+ "dependencies": { "dsh-deeptutor": "^0.3.1" },
129
186
  "dsh": {
130
187
  "profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-deeptutor"] }
131
188
  }
@@ -164,6 +221,7 @@ Two skills ship inside this package (`.agents/skills/deeptutor` and
164
221
  Installing a newer package version overwrites skill files in place; files not
165
222
  shipped by the package are never deleted.
166
223
 
224
+ The Claude Code plugin loads the same skills straight from `.agents/skills/`.
167
225
  The skills are maintained in this repo under `.agents/skills/`.
168
226
 
169
227
  ## Configuration (env vars, agent-agnostic)
@@ -178,7 +236,7 @@ export DEEPTUTOR_REMOTE_HOME="/home/ubuntu/my-deeptutor"
178
236
  # export DEEPTUTOR_LOCAL_BIN="deeptutor" # local CLI path (default: deeptutor on PATH)
179
237
  ```
180
238
 
181
- Restart dsh after changing env vars.
239
+ Restart dsh or Claude Code after changing env vars.
182
240
 
183
241
  **Windows, local mode:** point `DEEPTUTOR_LOCAL_BIN` at `deeptutor.exe`
184
242
  (for a pip/venv install: `<venv>\Scripts\deeptutor.exe`). A `.cmd`/`.bat`
@@ -212,6 +270,8 @@ npm install
212
270
  npm run build # tsc → lib/ (relative .ts imports rewritten to .js)
213
271
  npm run typecheck
214
272
  npm test # node:test + type stripping
273
+ npm run check:cli # drift check against the live DeepTutor your env vars point at
274
+ claude plugin validate . --strict # Claude Code plugin + marketplace manifests
215
275
  npm pack # inspect dsh-deeptutor-<version>.tgz
216
276
  npm publish # set a scope/registry of your choice first
217
277
  ```
@@ -227,12 +287,18 @@ src/ # TypeScript sources (dev loading, typecheck)
227
287
  lib/ # compiled ESM (published entry, from `npm run build`)
228
288
  scripts/md-to-html.js # zero-dependency Markdown → HTML converter
229
289
  scripts/install-profile.mjs # one-shot profile installer (exposed as the `dsh-deeptutor` binary)
290
+ scripts/mcp-launch.mjs # starts the MCP server for the Claude Code plugin
291
+ scripts/check-cli.ts # drift check against a live DeepTutor (`npm run check:cli`)
230
292
  .agents/skills/ # bundled skills: deeptutor/ + html-doc/ (installed to <DSH_HOME>/skills/)
293
+ .claude-plugin/ # Claude Code plugin.json (skills + MCP server) + marketplace.json
231
294
  cordis.yml # dev overlay: insert src/index.ts by absolute path
232
295
  cordis.patch.yml # bundle patch: insert the package by name
233
296
  ```
234
297
 
235
- `src/index.ts` registers the tools; `config.ts` holds env config;
298
+ `src/tools.ts` defines the four tools once, host-neutral; `index.ts` registers
299
+ them in dsh; `mcp.ts` serves them over MCP stdio (`mcp-main.ts` is the
300
+ `dsh-deeptutor-mcp` bin); `cli-policy.ts` holds the `deeptutor_cli` safety
301
+ tiers; `discovery.ts` capability discovery; `config.ts` holds env config;
236
302
  `cli-exec.ts` local/SSH CLI execution; `win-cmd.ts` starting a `.cmd`/`.bat` CLI on Windows;
237
303
  `turn.ts` one learning turn (CLI JSONL event folding + formatting);
238
304
  `html-render.ts` answer → self-contained HTML.