rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:smwyylc/dsh-work-diary
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
A daily work diary for the DSH Web GUI. The sidebar gains a "Diary" icon; opening it gathers the sessions that had activity on a given day and turns them into one Markdown diary entry. It can run on a schedule every day or on demand, and the model used for the summary is configurable.
A dozen sessions and a few dozen tool calls in one day, and by the evening you rarely remember what you actually did. This plugin flips through those sessions for you and saves them into a readable diary — you do not read the whole thing, it only has to say roughly "what got done today".
cwd, each project gets one request that writes its own section, and once all of them return one merge request assembles the full diary (including the overview). With a single project on that day it degrades to one request.From npm, or from any plugin market that indexes it:
dsh plugin --profile web add @smwyylc/dsh-work-diary
Or install a checkout as a local bundle: lib/index.js is the Host half, lib/client.js is the Client half, cordis.patch.yml declares the row to mount, and icon.svg is the sidebar icon; there is no build step.
After changing the code a restart is required: modules are loaded at process start.
For a date that already has a summary the button reads "Regenerate" — every click is a real model call. When the model output hits the length cap it is marked below the body, and that run's ending may be half a sentence.
Basis: input = that day's round records (50 characters of user request plus 200 of AI conclusion per round) + the fixed template of each request; output = one request per project plus one merge request (a single request when the day has only one project). Reading sessions and cutting rounds are local disk I/O and cost no tokens.
| Item | Brief (default) | Complete |
|---|---|---|
| Input tokens (a 14-session day with 296 rounds, 171 kept after sampling) | about 20.8k | about 21k |
| Output + thinking per request | about 2600 | about 2600-3000 |
| Number of requests | projects + 1 (1 for a single project) | same |
The daily total is roughly "input + per-request output × request count". The busiest measured day (14 sessions, 296 rounds, 171 kept) already costs about 20.8k input tokens; assuming 6 projects, the total lands near 38k tokens. A quiet day with one or two projects sits at about 8000-11000 tokens.
This version is clearly more expensive than the previous one (one request for the whole diary, about 8900-11600 tokens), for two reasons at once: the input went from "first and last line per session" to "a slice of every round that day", roughly triple, and the thinking half of the output is paid again on every request, so the more projects the higher the total. What it buys is a diary that can finally answer "what happened in the middle". To push the cost down, lower "rounds per session" or turn the schedule off and generate on demand only.
Every layer, from sampling to output, keeps only what is needed to answer "what got done today".
Sampling: one session sends its rounds for the day, two lines each (user request + that round's AI conclusion).
user/message with source.kind === 'user'; agent-injected context does not count) plus the AI's final reply before the next human input. The criterion is "not immediately followed by tool/call": within one turn DSH emits several assistant messages in a row, each followed by a batch of tool calls; those are the internal process, nine tenths of the log volume, and sending them only crowds out the real conclusions. The criterion is applied to the day-filtered sequence — an assistant message at the end of the day in a cross-day session is exactly the day's conclusion.text blocks only; reasoning (the thinking process) never enters the digest — "thought about" is not "did".- 13:05-17:40 · 175 rounds (50 sampled)), so the model does not read the omitted middle as empty. Sampling runs as soon as the day's rounds are cut, so only the sampled rounds stay in memory; the header still reports the true total.用户: / AI:), but the round is not dropped: the AI conclusion is still sent, and the conclusion after "continue" is often exactly what that round produced. The criteria:const / function / select / import or similar and statement punctuation appears nearby, or multiple lines carry semicolons and braces. Looking only at the first word would misjudge a normal sentence like "delete the temp files";Output:
cwd (different sessions in one directory count as one project), each project gets one llm.stream call, three in flight; when all of them return, one merge request writes the overview and ties the sections together. A single project degrades to one request so no extra thinking is paid for nothing. A failing project request loses only that section and logs a line, without sinking the whole diary. The merge request, being the last step, is retried once with a 1.5x higher maxTokens when it comes back empty — losing it would discard every section written before.maxTokens cap (4000 brief / 6000 complete). The cap has to cover thinking plus body together: on 2026-10-28 every one of eight tested models returned an empty body at 900 tokens, because their thinking runs 1500-9000 characters and eats the whole budget before any body appears. Word limits stay in the prompt (300 characters per project section for brief, 400 for complete; 600 and 800 for the merged diary); measured at the 4000 cap the bodies came out around 720-1000 characters, so they mostly obey.reasoning_effort=none/low/minimal, enable_thinking=false, thinking.type=disabled, and sending nothing): the gateway accepts them all without error and forwards none of them, so thinking never drops below roughly 460 characters, and reasoning_effort=none on a real digest sometimes made it longer (6536 characters). The only lever left is the prompt, which now explicitly forbids thinking, analysis and draft output; in a controlled run that took the body from empty to 905 characters. Thinking is therefore the larger half of the output cost and the main reason the total grows once the work is split per project.Settings are saved in [DSH_HOME]/work-diary/settings.json (~/.dsh when DSH_HOME is unset). Fields:
| Field | Default | Meaning |
|---|---|---|
enabled |
true |
Whether to generate automatically on a schedule every day |
time |
18:00 |
Local time HH:MM, runs once when the time arrives |
provider |
empty | Provider of the summary model; empty provider and model means follow the default model |
model |
empty | Model of the summary model |
language |
zh |
Output language, zh or en |
verbosity |
brief |
Detail level: brief (token-saving) / full |
maxSessions |
40 |
Maximum sessions included in one summary; the panel reports the count beyond it |
roundsPerSession |
50 |
Maximum rounds sent per session; above it the first 25% / an even sample of the middle 50% / the last 25% are kept (fixed ratio, not configurable) |
The settings panel can change the switch, the time, provider / model, language, detail level and rounds per session; maxSessions needs a hand edit of settings.json and takes effect on the next start. A non-numeric or empty roundsPerSession falls back to the default 50; numbers are clamped between 1 and 200.
Automatic execution: one run for the current day when the time arrives (the panel status shows "auto"). If the day has no result yet at DSH startup and the set time has passed, a catch-up run fires immediately; the word catch-up appears in the Host log.
Generated results are saved by date in [DSH_HOME]/work-diary/last-runs.json, keeping the latest 30. Opening the panel for a date that already has a result shows it directly without generating again.
updatedAt in sessionController.list() (the last real human question, taken from the persisted projection cache) falls on that day, plus sessions created in the last 7 days. The projection cache is not full coverage, so sessions it misses fall back to updatedAt = creation time and get dropped; the second path patches that hole, and the real event times give the final verdict. The second path is append-only: guessing wrong only reads a few extra sessions and never misses one.sessionQuery.observeSession, falling back to sessionQuery.readSession on DSH versions that do not have it. The reason is the cost of the old path: readSession lists the whole persistence store first, then deep-clones every event twice (once when loading, once inside snapshotSessionEvent) and builds a session object — 35 sessions took 137 seconds and left the UI nearly frozen. observeSession stats a single session instead of listing everything, shares the events as frozen objects rather than copies, keeps a 5-entry LRU, and hands back a lease that this plugin disposes as soon as the events are read.dayBounds (local 00:00 to the next 00:00, capped at the current moment for today) and only the target date survives; a session with no human input that day is skipped entirely and occupies neither a slot nor the digest.user/message with source.kind === 'user'; the final AI reply takes assistant/message's data.message.content (note: not data.content, which is the user message's path), collects only type === 'text' blocks joined with newlines, and must not be immediately followed by tool/call.session/title event (last-wins, consistent with the official title projection); a title that is code or an over-long paste falls back to the project name.llm.stream streaming interface; the model is decided by settings, and leaving it empty follows agentDefaultModel. The rounds array stays inside the Host: collect / poll return a summary with the round bodies stripped, so dozens of KB are not transferred twice.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。