RedHeartSecretMan/dsh-plugins--plugins-session-title-template ↗★ 3

@redheartsecretman/session-title-template

Template-shaped session titles for DeepSeek Harness: a fixed [date][type] topic format with a controlled type vocabulary, CJK spacing, and optional backfill.

패키지
@redheartsecretman/session-title-template
호환성
미검증
Harness peer 범위
>=0.2.1-rc.3 <0.6.0
버전
0.1.2
라이선스
MIT
최근 업데이트
2026. 11. 12.

설치

$npx -p @deepseek-ai/dsh dsh plugin --profile web add https://github.com/RedHeartSecretMan/dsh-plugins/releases/download/session-title-template-v0.1.2/session-title-template-0.1.2.tgz

session-title-template

English | 简体中文 · Catalog

A configurable [date][type] topic title provider for DeepSeek Harness. Dates come from session creation timestamps; the type vocabulary, template, time zone and prompt language are configurable. Two current-session tools support explicit rename and regeneration.

Install

Requires Node.js 22+. Tested against the installed DSH 0.2.1-rc.3, 0.2.2-rc.1 and 0.2.2-rc.2 services; declared compatibility is >=0.2.1-rc.3 /plugins/session-title-template as the plugin manager's target, not the repository root.

The bundle disables the shipped session-title-llm. Disable other title providers too: the service accepts one provider. Follow the Host's application outcome; a restart-required result means fully quit and reopen Desktop.

Configure

Override id: session-title-template in your profile's user patch. The whole config object is replaced, not recursively merged; omitted fields use plugin defaults. Do not insert another provider merely to change its settings.

FieldDefaultMeaning
template[{date}][{type}] {topic}Each placeholder exactly once; order and literal separators are configurable
dateFormatMMDDComplete YYYY, YY, MM, DD tokens and - / . _ separators; month/day required
timezoneAsia/ShanghaiIANA zone for the creation timestamp
languagezhzh or en; selects prompt language, not translated type labels
typesNine Chinese typesArray of strings or { key, hint, provisional? } objects
fallbackType探索Local fallback type when no route is available; must exist in the vocabulary
cjkSpacingtrueSpace between Han text and adjacent Latin letters/digits
topicMinChars8Prompt guidance; a useful short topic is not rejected just to reach this target
topicMaxChars18Unicode code-point limit for the topic
provider / modelunsetSupply both or neither; otherwise use the session route
maxInputBytes4096Final framed JSON UTF-8 byte budget, including escaping and wrapper text
maxOutputTokens4096Output cap; uses the lowest supported reasoning effort; the cap includes hidden reasoning, while topic length is validated separately
timeoutMs60000Deadline for one candidate-route attempt
maxProvisionalRefinements4For summarized provisional titles, refine within the first N eligible messages; not a rewrite counter. Recognizable fallbacks remain retryable
agentsInstructions.enabledtrueRead applicable AGENTS naming excerpts and add main-agent naming coordination; false disables both
agentsInstructions.maxBytes4096Final supplemental guidance UTF-8 byte limit; integer from 256 to 65536
backfill.enabledfalseRun one historical maintenance pass after startup
backfill.fallbackRouteunset{ provider, model }; also the backup for ordinary title requests
backfill.retitle[]Targets [{ id, hint }], executed only while backfill is enabled

Unknown keys produce an activation error rather than silently discarding settings.

- id: session-title-template
  config:
    template: '[{date}] {type}: {topic}'
    dateFormat: YYYY-MM-DD
    language: en
    cjkSpacing: false
    types:
      - { key: feat, hint: New capability }
      - { key: fix, hint: Bug fixes }
      - { key: explore, hint: Understanding current behaviour, provisional: true }
    fallbackType: explore

The default Chinese vocabulary is 功能, 设计, 修复, 优化, 发布, 运维, 探索, 文档, 研究. 探索 is provisional. A canonical concrete title with the correct creation date is retained while the adaptive policy sees no reason to evaluate; summarized provisional titles refine when new substantive input arrives. Deterministic first-message fallbacks, including legacy provider-labelled fallbacks and Host-truncated fallbacks without model provenance, remain retryable. Retaining a title preserves its model provenance. Model output is leniently normalized, but stored titles require canonical syntax and the correct date, so malformed legacy dates are not frozen as settled.

Automatic refresh

The provider follows the conversation automatically, but does not spend one model call per prompt. A cheap local policy decides whether a title evaluation is worthwhile:

  • Always evaluate: explicit refresh/targeted retitle, a fallback/recovery title, a non-canonical title, the first provider title, or a provisional title with new substantive input.
  • Evaluate on explicit topic-shift phrases, a substantive message with low lexical overlap against the current title and recent messages, and a periodic audit after six human messages or roughly 1,500 new UTF-8 bytes.
  • Skip short acknowledgements and continuation messages; the same evaluated messages are not evaluated again.

When the model is called, the current title travels as a JSON anchor with explicit stability rules: a still-accurate title must be returned exactly unchanged, and only a materially changed main task justifies a rewrite. Returning the same title preserves its original provenance instead of creating a rewrite. The template, creation date, type vocabulary, length limits and explicit tools remain unchanged.

AGENTS naming guidance

The plugin remains the automatic naming owner. When a title needs generation or provisional refinement, it reads naming excerpts from applicable AGENTS.md and AGENTS.local.md files. It lazily loads the public discovery helper from the in-box @deepseek-ai/dsh-agent-instructions SDK, declared as an optional peer so the real profile resolver can find it for external linked installations; no second Harness is installed. The helper discovers global AGENTS.md files under DSH_HOME, then DSH_AGENTS_HOME, followed by project files in its default .git root-to-current-working-directory scope. Other instruction filenames are not read. Discovery uses host-visible paths and the SDK's default baseline chain; it does not mirror a remote filesystem provider or additional deeper scopes discovered by the main agent's file operations.

A heading matches when it combines 会话 or 对话 with 命名 or 标题, or session or conversation with naming or title. Matching is case-insensitive for English, and headings inside fenced code blocks are ignored. For an explicit excerpt, put the intended naming guidance between these markers:


Prefer a concise topic describing the user's current task.

Only matching naming excerpts enter the supplemental prompt; unrelated engineering instructions are left out. agentsInstructions.maxBytes bounds the final supplemental UTF-8 text, with more-specific excerpts retained preferentially. Source reads are bounded and discovery has a soft timeout. Missing rules, SDK/read failures or the timeout preserve existing naming behavior. Files are reread when generation needs them, with no filesystem cache or continuous watcher. Changing a file alone does not regenerate an existing canonical settled provider title.

AGENTS guidance may influence topic wording and provisional refinement. The configured template, creation date, type vocabulary, topic length limits and user-title pin remain authoritative. A systemPrompt coordination section asks the main agent to leave automatic naming to the plugin when only standing AGENTS rules request a rename; an explicit user rename should call rename_current_session rather than hand the task back to the GUI. This section is guidance, not a rename API restriction, and deployments that replace the complete system prompt may omit it. Set agentsInstructions.enabled: false to disable both the supplemental excerpts and coordination. The plugin never edits AGENTS files.

Model errors and ownership

The provider handles text-delta, completed block-end text and terminal finish events. Only a normal stop result can be accepted. Error, cancellation, truncation and tool-call partial output never become titles. Failed calls or parsing try a distinct backup route, then reject so Harness retains the current title or its built-in fallback. With no available route, a local title can be derived from the first message.

Harness suppresses automatic updates to user-pinned titles. An explicit UI refresh intentionally unpins them. Backfill always skips user titles, even a configured retitle target. Auxiliary calls use the built-in session/title-llm-request record; diagnostic files do not contain title, prompt or raw model text.

Explicit current-session tools

When the Host tools service is available, the plugin registers two tools globally across agent presets. Disabling AGENTS guidance does not remove them. Both keep the default exclusive scheduling and normal Harness execution policy.

  • rename_current_session({ title }) calls the official title service, cancels in-flight generation and pins the accepted title.
  • refresh_current_session_title({}) explicitly bypasses automatic stability and regenerates through sessionTitle.refresh(), deliberately unpinning a user title.

Targets come only from execution.agent.session; no session id is accepted. Missing/stale agents and extra fields are rejected. Success requires flush and read-back. If persistence fails, the error explains that memory may already have changed; retrying the same pinned title avoids duplicate rename events.

The tested Harness provider request carries no automatic/explicit trigger. The plugin does not guess from event order or words in user messages. Use refresh_current_session_title for a forced regeneration: native GUI refresh can still retain an already summarized title under the automatic stability policy. Initial/fallback recovery is unaffected. A future SDK trigger discriminator can enable direct GUI-refresh support.

Follow the Host reload outcome after upgrading; restart when required. Installing or editing the package does not prove an existing session has the new tools.

Backfill and state

Backfill is off by default. When enabled, it starts once after 2.5 seconds. sessionQuery.readSession performs read-only eligibility checks before resuming anything. It skips subagents, pinned titles, canonical titles, interrupted historical turns and currently running agents. Targeted retitles can rewrite canonical provider titles, once per exact id/hint.

A candidate's title must be accepted and acknowledged by sessions.flush() before completion is recorded. Failures remain retryable. Only handles created by the pass are disposed. Plugin unload cancels its timer and aborts/drains running maintenance; ordinary prompts never repeatedly force a configured retitle hint.

With DSH_PROFILE_DIR set:

$DSH_PROFILE_DIR/state/session-title-template/backfill-state.json
$DSH_PROFILE_DIR/state/session-title-template/backfill.log

Otherwise use $DSH_HOME/profiles/$DSH_PROFILE/state/session-title-template/, or the legacy $DSH_HOME/session-title-template/ only when there is no profile. DSH_HOME defaults to ~/.dsh.

Exclusive locks, atomic replacement and recoverable queues protect bookkeeping across activations/processes. Corrupt state is surfaced and preserved. Lock waits are bounded; locks are never stolen. After an abnormal process exit, remove a leftover .lock only after confirming that no writer is active. Diagnostic logs rotate at 512 KiB with one bounded backup; logging failures do not change title/bookkeeping success.

Development

No dependencies to install or build step. The optional AGENTS feature uses the public SDK helper shipped with Harness:

cd plugins/session-title-template
npm test
npm run check

Tests use isolated temporary directories, including AGENTS discovery/extraction and byte limits, config validation, naming coordination, multi-process state updates, flush failure, read-only backfill preflight and unload cancellation. scripts/verify-runtime.mjs additionally checks the installed SessionStore, projections, title service and Cordis lifecycle; ASAR installs require Electron's Node carrier. It uses the real profile linked-peer resolver, tool registry and title service. The LLM and disk durability listener are fixtures: this does not test external model availability or production-writer restart recovery. For a real-model smoke test, test/verify-gateway.mjs is opt-in via RUN_SESSION_TITLE_LIVE=1 and a gateway/model:

RUN_SESSION_TITLE_LIVE=1 SESSION_TITLE_GATEWAY=http://127.0.0.1:3425/v1 SESSION_TITLE_MODEL=auto/deepseek-flash MAGPIE_GATEWAY_KEY=... \
ELECTRON_RUN_AS_NODE=1 '/Applications/DeepSeek Harness.app/Contents/MacOS/DeepSeek Harness' test/verify-gateway.mjs

See validation and behavior boundaries for checked contracts and limits.

License

MIT