# dsh-sticky-notes

[中文](README.md)
Workspace sticky notes for DSH (DeepSeek Harness). It adds a compact note entry to the current conversation header, letting you create, edit, and delete multiple notes for the current workspace.
Notes are stored as Markdown files in the `dsh-notes/` directory of the current workspace. No hidden database, no extra index — just plain Markdown files.
## Features
- Quick entry in the current conversation header, no sidebar clutter.
- Multiple notes per workspace: list, preview, edit, create, save, and delete.
- A workspace selector in the dialog, defaulting to the current conversation workspace and allowing other registered local workspaces.
- The note UI follows DSH's active language setting, with Chinese and English copy.
- Unsaved edits are automatically saved before switching notes, changing workspaces, or closing the dialog.
- Data is stored in the current workspace: `/dsh-notes/*.md`.
- One Markdown file per note, easy to inspect and manage with any editor or Git.
- The server resolves workspace paths through `workspaceRegistry`; it does not trust arbitrary paths from the browser.
- Mutating endpoints only accept same-origin POST requests.
## Compatibility
- Supports DSH `0.1.0-rc.6`, `0.1.0-rc.8`, `0.1.1-rc.2`, `0.1.2-alpha.2`, and later versions.
- Zero external runtime dependencies; does not depend on the deprecated `dsh-client-runtime`.
- This plugin uses DSH's additive `conversation.session.header.actions` slot. It does not replace the whole conversation header or own the position exclusively.
- Uses a unique ID `sticky-notes` to avoid conflicts with other plugins.
- Uses `order: 30` so it coexists with other header actions in a predictable order.
- HTTP API is namespaced under `/dsh-sticky-notes/*`.
- Dialog styles are scoped with the `dsh-sticky-notes-modal` class and do not pollute global styles.
- Registers through `ctx.slots.inject(...)`, so it does not depend on plugin load order.
## Why multiple notes?
A workspace accumulates many kinds of loose thoughts: todos, ideas, meeting notes, and temporary code snippets. A single note would quickly become a dumping ground.
Multiple notes are closer to the sticky-note metaphor:
- Each note has its own topic.
- The list shows the title, preview, and last updated time at a glance.
- Each note is an independent file, easy to track with Git.
## Install
### From GitHub
```bash
dsh plugin --profile web add github:flyhigao/dsh-sticky-notes
```
Restart `dsh web`, open any conversation, and you will see the note icon on the right side of the conversation header.
### Local development install
1. Clone the repository:
```bash
git clone git@github.com:flyhigao/dsh-sticky-notes.git
```
2. Install into the Web profile and restart:
```bash
dsh plugin --profile web add file:/path/to/dsh-sticky-notes
# restart dsh web
```
## Usage
1. Open a conversation.
2. Click the note icon in the conversation header.
3. Select a workspace at the top of the dialog. The current conversation workspace is selected by default, and other registered local workspaces are available.
4. In the dialog:
- Left side: notes from the selected workspace.
- Right side: title input and content editor.
- Bottom: new, delete, and save actions.
5. Unsaved edits are automatically saved before switching notes, changing workspaces, or closing the dialog.
6. The note is written immediately to `dsh-notes/` in the selected workspace.
## Data format
Each note is a Markdown file:
```text
/dsh-notes/.md
```
File content:
```markdown
# Note title
Note body…
```
- `note-id` is generated by the plugin, for example `note-msw19zz2-7gbiyg`.
- Deleting a note deletes the corresponding `.md` file. There is no extra index.
- You can manually edit or add `.md` files; reopen the note panel to see the changes.
## HTTP API
The plugin provides a small HTTP API for the browser half:
| Method | Path | Description |
|---|---|---|
| GET | `/dsh-sticky-notes/list?workspaceId=` | List all notes in a workspace |
| POST | `/dsh-sticky-notes/save` | Create or update a note |
| POST | `/dsh-sticky-notes/delete` | Delete a note |
### Save body
```json
{
"workspaceId": "workspace-id",
"note": {
"id": "optional-note-id",
"title": "Note title",
"content": "Note body"
}
}
```
### Delete body
```json
{
"workspaceId": "workspace-id",
"id": "note-id"
}
```
## Development
- Server entry: `lib/index.js`
- Browser entry: `client/client.js`
- Plugin manifest: `cordis.patch.yml`
This is a lightweight hand-maintained implementation and does not require a build step. `client/client.js` is a CJS bundle that DSH's client module loader can load directly.
## License
[MIT](LICENSE)