dsh-autolearn: Transforming "Learning Objectives" into a Traceable Knowledge Base within DSH

Preface

In DSH, having the model “learn a topic” commonly involves temporarily searching for materials and writing them into the conversation context, which disappear when the session ends; whether knowledge is verified, whether sources conflict, and whether tasks have budget boundaries often relies on prompt awareness and is difficult to reproduce. dsh-autolearn by community maintainer ILRI7512 (catalog category: workflow) consolidates this pipeline into a repeatable process: Learning goals → Bounded learning tasks → Traceable knowledge base → Evidence verification → Conflict detection → Evaluation reports, integrated into the Harness via a TypeScript engine + 11 DSH native tools, with an optional MCP adapter and local CLI, and no Python runtime dependency by default.

What Is This

dsh-autolearn is an autonomous learning plugin for DeepSeek Harness (README status: v2.0.0). Business logic is implemented in TypeScript under src/, with the README stating 0 external dependencies in production runtime; the DSH side registers 11 tools through adapters/dsh (converged from the 60 MCP tools described in the README), sharing the same AutolearnServices facade with the optional adapters/mcp and cli. The database schema is compatible with v1.2 (v7), allowing old knowledge bases to be opened directly.

Architecture and Data Flow

The following is the call relationship extracted from the README, which helps understand which layer the “tools seen by the model” belong to.

DSH Agent
   │  ctx.tools.register (native JSON Schema + runtime validation)
   ▼
adapters/dsh (11 tools + approval hooks)   adapters/mcp (optional)   cli (user side)
   └──────────────┬───────────────────────┬───────────────┘
                  ▼
        application/services (single business facade)
                  ▼
  Learning · Knowledge · Retrieval · Verification · Practice · Security · Storage
                  ▼
        node:sqlite (self-built inverted index independent of WAL/FTS + float32 vector index)

According to the README, upon plugin uninstallation, resources such as SQLite connections, index file locks, and hooks are released.

Core Features: 11 Native Tools

After understanding the architecture through the above steps, tools can be categorized by name. The following table is extracted from the README; the “Risk” column helps determine whether host approval or database writes are required.

Tool Purpose Risk
learning_create Create project + generate topic task chain (discover→extract→verify→practice + gaps/evaluation/report) write
learning_run Run a bounded learning cycle (budget/duration/task count/stagnation stop; failure retry and dependency blocking) write
learning_status Project/task/coverage/verification rate/unmet items/recent runs/gaps read
knowledge_search BM25 + feature hash vectors + RRF hybrid retrieval with verification/conflict/timeliness/license warnings read
knowledge_manage save / update / invalidate / rollback / export / get / partitions write (invalidate/rollback require confirmation)
knowledge_verify verify / verify_formula / list_evidence / find_duplicates / detect_conflicts read
source_manage discover / read / list (SSRF protection, domain whitelist, size/timeout limits) read/external
learning_evaluate Coverage/verification rate/source completeness/conflicts/practice pass rate/cost + optional report read
learning_review Review failures/blocks/exhausted retries/conflicts/gaps; can reset failed tasks (requires confirmation) read/write
system_diagnostics Database/foreign key/index consistency, schema, permissions, network policies, recent rejections read
system_maintenance integrity / rebuild_index / backup / verify_backup / restore / delete_chunk / vacuum destructive (host approval)

DSH native tools can return {kind:'ask'} for high-risk operations in tools/pre-execute; if the user rejects, the operation is not executed, and the README states that determination exceptions follow a fail-closed principle (no automatic approval).

Environment Requirements

Item Requirement
Node.js ≥ 22.6 (built-in node:sqlite and native TypeScript for testing)
DSH Version supporting Cordis plugins and ctx.tools (verified in repo against 0.2.0-rc.2 contract)
Python Not required (legacy directory is for reference only)
Build TypeScript 5.9 (devDependency)

Installation and Activation

First install dependencies and build, then link the plugin into the profile. All commands come from the README; replace paths according to your local repository location.

# 1) Type check + build (outputs to dist/)
pnpm install
pnpm run typecheck
pnpm run build

# If the repository is on FAT/exFAT/shared storage (no symlink support), pnpm may fail:
#   npm i -g typescript && tsc -p tsconfig.build.json
dsh plugin --profile web add link:/path/to/dsh-autolearn/plugins/autolearn

In the profile’s package.json, confirm that bundles include the local package name (example structure below):

{
  "dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-base", "...", "@local/dsh-autolearn"] } }
}

After restarting DSH, the model will see 11 tools including learning_create, learning_run, knowledge_search, etc. The README also notes: if webServer is not injected causing entry activation failure, you need to use the fixed version (sub-context ctx.inject(['webServer'], …)); when the web profile is normal, it will print [dsh-autolearn] settings API ready: <settingsPath>.

Engine Directory and Environment Variables

Engine directories are resolved in order by default (DSH_AL_HOME can override):

  1. DSH_AL_HOME
  2. <repo>/config.json exists → repository root
  3. <repo>/dsh_autonomous_learning/config.json exists → legacy engine directory (v1.2’s data/ is here)
  4. Repository root

Common environment variables (see README for defaults):

Environment Variable Purpose
DSH_AL_HOME Engine directory (config.json / data/)
DSH_AL_DATA_DIR Data directory override, defaults to <home>/data
DSH_AL_MODE assisted / auto / lab
DSH_AL_ALLOW_NETWORK Whether to allow external fetching, defaults to false
DSH_AL_CONFIG Configuration file path
DSH_AL_LOG_LEVEL DEBUG/INFO/WARNING/ERROR, defaults to INFO

Settings such as mode, daily budget, and task limits modified in the DSH plugin settings page take effect at the start of the next cycle; dataDir changes require a restart.

Typical Usage

Running the Learning Loop in DSH

  1. Use learning_create to create a project and generate the task chain.
  2. Use learning_run to execute a bounded cycle (subject to budget, duration, task count, and stagnation conditions).
  3. Use learning_status / learning_evaluate to check progress and report dimensions.
  4. Use knowledge_search to query stored content; use knowledge_verify for evidence and conflict-related checks.

External sources do not go through the network by default: DSH_AL_ALLOW_NETWORK defaults to false, and source_manage can only fetch after explicit permission (with SSRF and port restrictions, see security defaults below).

User-Side CLI (Approval and Diagnostics)

CLI examples provided in the README:

node dist/cli.js pending
node dist/cli.js approve <token>
node dist/cli.js reject <token> [note]
node dist/cli.js status [projectId]
node dist/cli.js diagnostics
node dist/cli.js search "slippage" <projectId>

The MCP / CLI channel uses local confirmation tokens for destructive operations (scope = action + target, valid for 15 minutes, single-use).

Optional MCP Compatibility Layer (Not Enabled by Default)

node dist/adapters/mcp/server.js

The README explains that it is not enabled by default to avoid writing to the same database simultaneously with the native entry. Client example:

{
  "mcpServers": {
    "autolearn": {
      "command": "node",
      "args": ["/path/to/dsh-autolearn/dist/adapters/mcp/server.js"],
      "env": { "DSH_AL_HOME": "/path/to/dsh-autolearn/dsh_autonomous_learning" }
    }
  }
}

Security Defaults and Runtime Permissions

The plugin executes within the DSH process and has the same system permission boundaries as the host; before installation, you should read the source code and MIT license, and evaluate database writes, backup restoration, and optional network fetching according to organizational policies.

Default policy summary listed in the README:

Item Default Description
Network Off allow_network=true only allows fetching; only http/https + limited ports
SSRF Default reject private/loopback addresses DNS pinning, redirect hop-by-hop validation
Paths Authorized root + data directory realpath, prevent symlinks and ../
Secrets Reject before entering database Log redaction
Evidence Always fail without evidence Opinions/hypotheses cannot be verified
Retrieval scope Only visibility='global' when no project Prevent cross-project leakage
Code execution Strict sandbox (lab mode) Not seccomp/LSM kernel sandbox; fail-closed when capabilities are insufficient

Document content is in data/documents/, not in the DB backup list; to perform a complete backup, you need to copy the data directory.

Applicable Scenarios and Known Limitations

Suitable for: Scenarios where you need to transform “learning a topic” into a queryable, verifiable, and evaluable local knowledge base within DSH workflows, and are willing to drive bounded tasks using 11 native tools rather than accumulating context in single conversations.

Cautions (from README “Known Limitations”):

  1. PDF/DOCX parsing has not been migrated; it will error and suggest converting to Markdown/TXT; HTML is cleaned with regex.
  2. Model-assisted planning/extraction with use_model=true has not been migrated; it will warn and only use the rule chain.
  3. Code execution is JavaScript-only, lab mode only; Python execution has been removed.
  4. Hash vectors are vocabulary-level recall; the README does not evaluate retrieval quality or claim semantic improvement.
  5. Scheduling tick, knowledge graph queries, and other capabilities have not been migrated (table structures are preserved).

For testing, the README states 171 node:test items and legacy 197 pytest baseline items; audit and performance materials are in reports/ and docs/refactor/.

Conclusion

dsh-autolearn consolidates autonomous learning into a DSH native toolchain: the same TypeScript engine serves Cordis plugins, optional MCP, and CLI, emphasizing evidence verification, conflict detection, and bounded learning_run, while maintaining compatibility with v1.2’s v7 knowledge base. For further information, you can read installation, environment variables, and failure recovery tables from the community catalog page and GitHub repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye