Introduction¶
DSH session logs are piled up in ~/.dsh/sessions. Over time, this simply results in a pile of jsonl files: you know what was discussed, but you can’t tell which topics recur or which content constitutes “core memory.” Troubleshooting memory issues on a daily basis involves either grepping for keywords or reading through the entire log, and the cost rises linearly with the length of the record.
The dsh-memory-starmap introduced below takes a different approach: instead of performing retrieval, it calculates session memories into semantic vectors, reduces the dimensionality, and spreads them onto a sphere, rendering the result as a nebula using Three.js. White dots represent normal conversation, blue dots represent important memories, and gold dots represent personality cores; lines indicate semantic proximity.
This is an experimental project maintained by 1837458003-ctrl, categorized as “Model Inference” in the community plugin directory, with a current star count of 0. It is a personal, third-party plugin and is not an official project of DeepSeek or Fantopia.
What is it¶
One-sentence positioning: dsh-memory-starmap is a combination of a “DSH plugin + local microservice.” The plugin part is only responsible for the web overlay entry and keeping the local service alive; the actual work is done by a set of Python scripts in the repository:
Reading session records from ~/.dsh/sessions → calculating semantic vectors using bge-small-zh-v1.5 → reducing to 3D with UMAP and spreading onto a sphere → rendering into a nebula using Three.js.
The design trade-offs are clear: everything runs locally, without internet access or data uploads. The models, inference, and service all run on your own machine. The cost is that the data pipeline relies on Python; there is no Node.js native version.
Core Features¶
First, let’s cover the capabilities documented in the README, which are as follows:
- True Semantic Vectors: bge-small-zh-v1.5 (ONNX Runtime, CPU inference), not keyword matching.
- 3D Spherical Layout: UMAP preserves local distances; it spreads points onto the sphere surface according to the UMAP direction, with core memories collected in the inner layer.
- Interaction: Drag to rotate, scroll to zoom, hover to view full text, click to view details, statistics bar, pause/reset/refresh.
- Local First: Models, inference, and service are all local.
- Zero-configuration Startup: Start the service with one command, and open it by clicking ✦ in the plugin.
Color coding is directly tied to importance: white dots represent normal conversation, blue dots represent important memories, and gold dots represent personality cores; lines indicate semantic proximity.
The internal pipeline is a four-step process, as shown in the README flowchart:
~/.dsh/sessions/*/session.v4.jsonl.zstd
│ extract.py:解压、跳过 subagent、抽 user/assistant 文本
▼
memories.json
│ embed.py:bge-small-zh-v1.5 ONNX,512 维,L2 归一化
▼
(N, 512) 向量
│ build.py:余弦相似度 → 每点 top1 连线(阈值 0.70)
│ UMAP 3D → 白化 → 球面方向 + 球内半径填充
▼
graph.json(nodes + links + stats)
│ server.py(本地 http.server)
▼
web/index.html(Three.js)
The README provides reasons for two design choices. First, using UMAP instead of PCA: PCA projection naturally concentrates points along specific axes, with an actual axis ratio of about 2-5 times, causing points to be pressed into a slanted band without a spherical feel. UMAP preserves local neighborhoods, resulting in a more uniform distribution of directions, followed by whitening and spherical projection for positioning. Second, core points are placed in the inner circle: nodes with is_core have their radius multiplied by 0.62, and is_longterm by 0.85, while normal points are on the periphery, making it immediately visually apparent which are “personality cores.”
Installation and Usage¶
Prerequisites¶
- Python 3.10+
- DSH (DeepSeek Harness) desktop or web version
- Disk: Model is approximately 95MB, dependencies approximately 300MB
Prepare Repository¶
The README’s quick start requires cloning the repository to your local machine first, then installing dependencies and downloading models:
git clone https://github.com/1837458003-ctrl/dsh-memory-starmap.git
cd dsh-memory-starmap
python -m pip install -r requirements.txt
python download_model.py # 默认走 hf-mirror.com,可 --mirror 换源
download_model.py is simply a downloader. The copyright for bge-small-zh-v1.5 belongs to the Beijing Academy of Artificial Intelligence (BAAI), and this project itself is licensed under the MIT License.
Generate Star Map¶
python extract.py # 从 ~/.dsh/sessions 抽取记忆 -> memories.json
python build.py # embedding + UMAP + 连线 -> graph.json
python server.py 8126 # 起本地服务
Open http://127.0.0.1:8126/ in your browser to see it. After data changes, run python rebuild.py (a chain of extract + embed + build), or let the plugin handle automatic rebuilding every hour.
Install Plugin¶
The plugin installation command given in the README uses the “link” method, pointing to a local directory:
dsh plugin add link:C:/path/to/dsh-memory-starmap
Then in DSH settings, confirm that dsh-memory-starmap is enabled and restart DSH. A ✦ button will appear in the bottom right corner of the Web UI; clicking it opens the star map overlay.
The plugin needs to know where the repository is. Set the environment variable STARMAP_HOME to point to the cloned directory; otherwise, it will only display the entry point and not automatically start the service. On Windows, you can also add an entry to the system environment variables:
STARMAP_HOME = C:\path\to\dsh-memory-starmap
Configuration¶
| Environment Variable | Default | Description |
|---|---|---|
STARMAP_HOME |
Empty | Repository directory. The plugin uses this to start/rebuild the service; if not set, the plugin will not automatically start the service. |
STARMAP_PYTHON |
python / python3 |
Python executable file |
STARMAP_PORT |
8126 |
Local service port |
STARMAP_AI_NAME |
小鱼 |
Name displayed in the center of the star map |
STARMAP_MODEL_DIR |
./models/bge-small-zh-v1.5 |
Model directory |
DSH_SESSIONS |
~/.dsh/sessions |
DSH session directory |
Typical Usage¶
Below is a walkthrough of the complete process, assuming Python 3.10+ and the DSH desktop or web version are installed.
-
Prepare the environment. Clone the repository, install dependencies, and download models; refer to the “Prepare Repository” section above for the commands.
-
Run the mapping once to verify the data pipeline works:
python extract.py
python build.py
python server.py 8126
Open http://127.0.0.1:8126/ in your browser. Seeing the star map indicates that the extract / embed / build / server steps are all working correctly.
-
Install the plugin to embed the entry into DSH. After setting
STARMAP_HOME, rundsh plugin add link:<repository_path>, restart DSH, and click the ✦ in the bottom right corner to open the overlay. -
Daily maintenance. After session logs are updated, manually run
python rebuild.py; or if you want the plugin to handle it, configureSTARMAP_HOMEand let the plugin rebuild every hour.
Applicable Scenarios and Notes¶
Suitable scenarios: DSH users who want to intuitively review “what I let the AI remember”; people who want to perform semantic clustering on memories and observe topic drift; and developers willing to run the Python pipeline locally and accept that the initial mapping takes time.
The limitations listed in the README are worth checking against your own conditions one by one:
- Requires a Python runtime; there is no Node.js native version, so it cannot be used if you do not want to install Python.
- The model is 95MB and requires download the first time; it is completely offline afterwards.
- The initial mapping is slow, taking about 10–30 seconds for hundreds of memories (UMAP + ONNX CPU).
- Optimized for Chinese; bge-small-zh is a Chinese model. It works with mixed Chinese-English text, but performance for pure English is average.
- The overlay embeds
http://127.0.0.1:8126. If the port is occupied or the service is not started, it will prompt the startup command. - Only the user/assistant body text is read; tool calls, thinking processes, and system injections are not counted as memory.
There are two points to note regarding security. First, the plugin runs with the permissions of the current DSH process. Before installing, it is recommended to read plugin/index.js, plugin/client.js, and plugin/cordis.patch.yml to confirm that the patch content matches your expectations, and then check the license (the project is MIT). Second, the plugin reads local session files and starts a local HTTP service on the default port 8126; it is suggested to confirm that this port is not exposed externally.
Conclusion¶
The value of dsh-memory-starmap lies not in adding a new feature, but in presenting existing session records from a new angle: memories with similar semantics gather together, and core memories sink to the inner layer, making it easier to see the structure of long-term memory than by scrolling through jsonl files. It is currently an experimental project with zero stars and maintained personally. The pipeline depends on Python, so you need to review the source code yourself before installation.
- Directory: https://www.skillhub.cn/plugins/1837458003-ctrl/dsh-memory-starmap
- GitHub: https://github.com/1837458003-ctrl/dsh-memory-starmap