rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:JayYuen666/dsh-lesson-loop
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Guard denials, gate failures and human thumb-downs become project lessons; only a rule a human confirmed is injected back into the model at session start.
A self-evolution loop for dsh: one lesson bus the guard plugins report to, one rule library a human curates, and armed rules injected into every new session of their project.
lessonLoop service; a profile without this package only drops those reports. The host half provides the service, the client half renders a web card holding the switches and the rule review desk.promoteThreshold that key is marked ready for review.armed is only ever a human decision — the card's arm action writes it, and the startup migration merely carries an existing armed state onto a merged card. reject / demote / archive / edit / revive are human actions too.agent/created. Subagent sessions are skipped — rc.2 AgentTeam's named members remain origin: 'subagent' subagent sessions and receive nothing either.lessonLoopRules, reached through the host /api gateway.violation (the scenario fired and was broken), suppressed (the scenario fired and was followed, driven by pass), samples (the rule was present and not violated).violation / (violation + suppressed); samples is exposure and never a denominator.samples counts a durable session once even when it is resumed: duplicate disposal edges are deduplicated, so reopening a session does not inflate exposure.suppressed, violation at demoteThreshold, real evidence at demoteMinSamples, and the ratio at demoteRatio.pass clears the flag.dsh plugin --profile web add @jayyuen66/dsh-lesson-loop
Remove with dsh plugin --profile web remove @jayyuen66/dsh-lesson-loop. The package is on the public npm registry, so installation needs no credentials.
>= 24.9, host dsh on the rolling ^0.2.2-rc.2 window. The plugin's own floor is engines.node (>=24.9.0), which is the host's floor from 0.2.2-alpha.2 up: a host below it never starts, so a lower claim here would promise an environment nobody can install into. The requirement the host reads is engines.dsh (^0.2.2-rc.2), and it decides alone — with that field present, evaluatePluginCompatibility never looks at the @deepseek-ai/dsh* peers. Measured: 0.2.0-rc.2, 0.2.1-rc.5, 0.2.2-alpha.3 and 0.2.2-rc.1 are refused, 0.2.2-rc.2 through 0.2.2 pass, 0.3.0 is refused. The support window rolls: this package is verified against every released host version inside the window at publish time and re-verified once the window moves, so the version number in this bullet is not a standing promise.underdependencies, by contract.** Profiles install withnodeLinker: hoistedandautoInstallPeers: false, so a host package there becomes a real second copy;@deepseek-ai/dsh-toolskeys its scheduler with a plainSymbol, so **every native tool call throws** in that profile while build, typecheck and coverage stay green. The host packages imported for value —schemastery,@deepseek-ai/dsh-brandand@deepseek-ai/dsh-home-pathsbyhost.js,@deepseek-ai/dsh-typert-protocolby the Remote namespace, and@deepseek-ai/dsh-output-retentionby shared'slib/text— are required peers and repeated underdevDependenciesat the same exact pin, so the bundler externalizes them instead of inlining the official function bodies;test/publish-manifest.test.tsenforces both halves, including the value imports inside the shared subpaths this package uses. Artifacts are rebuilt byprepack`, never committed.If your profile pins @jayyuen66/dsh-plugin-shared with a pnpm overrides entry, that pin must be at least the version this package declares. A lower pin installs a copy without the names imported at runtime, and the host then reports N entries did not activate together with does not provide an export named ... at boot — the package installs fine and never loads, and no per-repository CI run can see it.
dsh --profile web --dump-config ends with # == @jayyuen66/dsh-lesson-loop plus - id: lesson-loop.# == <layer> and # == <layer>, patched by <path>./lessons-digest in a session with negative feedback; the candidate group gains evidence.[lesson-loop] Experience rules for this project. Subagent sessions receive nothing, by design.node_modules/ in a scratch profile holds @jayyuen66/ and no @deepseek-ai/ directory.lesson_report tool; the surface is the service plus the card's namespace./lessons-digest.llm service.rejected card may return to candidate at the revive threshold; only a human can arm it again.dsh.bundle.patch points at cordis.patch.yml, which carries a - id: dsh-plugin-shared supplier row (keep it enabled; disabling it removes the cards' shared component supply) plus the - id: lesson-loop entry with name: "@jayyuen66/dsh-lesson-loop". What makes the host scan the client half is the bare package name. The card components come from the shared client row, externalized as @jayyuen66/dsh-plugin-shared/client; the host module table provides react, zod and that shared row.Config. The settings namespace is the entry id, so switches, thresholds and the rules array share one section and one revision. rules carries .loose(), the read side checks the raw shape through describe().user (unreadable means it refuses to write rather than overwriting), and every write is one CAS commit with re-read and replay.settings is the only plugin-level hard dependency. timer / commands / systemPrompt / llm are optional: a missing one removes that capability, the plugin still loads.locale/en.json / locale/zh.json supply the plugin page's meta.title, meta.description and meta.detail; the detail page reads docs/DETAIL.md in English and docs/DETAIL.zh.md in Chinese. The README is not the source for that page.config: (card value > row config > schema default); an invalid config fails this entry's fiber alone.dsh plugin --profile web allow-version @jayyuen66/dsh-lesson-loop@<version> --dsh-version <exact running host version> --accept-risk
version-exemptions lists the grants and revoke-version removes one; --dsh-version must equal the version the running host reports.
| Method | Purpose |
|---|---|
report(input) |
Append a lesson, merge it into that key's card; returns { ok, reason?, violationOf?, candidate?, ready?, justReady? } |
pass(input) |
The rule's scenario fired and was followed; counted as suppressed when the session ends |
rules() / recentLessons(project?, limit?) |
Read the rule library / the event stream |
ruleAction(id, action, statement?) |
The six human actions |
stats() |
Counters and the config summary behind the card |
reason is one of disabled, rules-not-persisted (this change did not reach the library — retry) or error. It is a receipt code, not translated text.source is an open set: danger-guard, quality-gate, session-rescue, lessons-digest and manual are built in, and a third party may name itself freely (trimmed, non-empty, ≤ 64 characters, else manual with a log line). Two report kinds carry meaning worth naming: gate-not-run marks a check that never ran, because an environment problem must not be learned as a code lesson, and needsUserConfirmation: true in the evidence marks a judgement the reporter could not make — evidence, but no violation.edit-before-factgate, edit-before-secret-path, dangerous-bash), so one general lesson does not shatter into per-file cards. The concrete target stays in the evidence: signature for secret-path and dangerous-bash, target for factgate-deny (which reports the folded key as its signature).settleLessonCall from @jayyuen66/dsh-plugin-shared/lib/lesson-bus, which routes sync throws and async rejections to one exit.Namespace = the entry id lesson-loop. Four switches default to true: enabled (master — off means no reporting, injection, exit settlement or standing section, periodic decay pauses, and /lessons-digest refuses), reportEnabled (lesson entry gate: it stops report() and /lessons-digest only — pass() accounting and the dispose-time settlement follow enabled alone), injectEnabled, sectionEnabled.
| Field | Default | Range | Purpose |
|---|---|---|---|
promoteThreshold |
3 |
1–20 | Same-key lessons reaching this count mark the card for review |
demoteThreshold |
3 |
1–50 | Violations after arming required to demote |
demoteMinSamples |
5 |
1–100 | Minimum real evidence violation + suppressed |
demoteRatio |
0.5 |
0.05–1 (step 0.05) | Recurrence-ratio red line |
decayDays |
30 |
1–365 | Armed this long without a clean hit turns the card undeterminable; later violations do not reset the window |
reviveThreshold |
3 |
1–20 | A rejected rule seen this often returns to candidates |
maxLessonsBytes |
0 |
0–1 GiB | Disk fuse; 0 = no cap, content never truncated to save context |
maxStatementChars |
4000 |
1–100000 | Character limit for an armed rule statement on arm/edit (UTF-16 units); longer writes are refused, stored statements are unaffected |
digestTimeoutMs |
120000 |
≥ 1000 | Wall clock for one digest run (ms); no card row |
decayIntervalMs |
86400000 |
≥ 1000 | Interval arming the periodic decay pass (ms); no card row |
maxInjectedRules |
50 |
0–1000 | Armed rules injected per session; when capped, the newest rules are kept; 0 = no cap; no card row |
The last three rows are deployment values: not .volatile(), so the card has no row for them and they are given only on the registration line's config:, taking effect on restart.
Four methods on one official Typert Remote namespace, lessonLoopRules.
| Method | Input | Reply |
|---|---|---|
stats() |
— | { ok: true, …counters, …config summary, rules }; the rule projection carries the derived undeterminable flag and no evidence bodies |
rules(request) |
{ project? } |
{ ok: true, rules }; a non-string project reads as absent, i.e. the whole library |
lessons(request) |
{ project?, limit? } |
{ ok: true, count, lessons }; an absent, non-finite or ≤ 0 limit means the default 50, and an explicit value is capped at 500 |
ruleAction(request) |
{ id, action, statement? } |
{ ok: true, id, action }, or { ok: false, error, status } |
action must be one of the six whitelisted values; statement is read by arm and edit only, trimmed, and a blank string counts as "not given". A statement longer than maxStatementChars returns { ok: false, status: 400 } and the library stays untouched.status is a retained semantic code, not an HTTP status: 400 for a missing field or an off-whitelist action, 404 for an unknown card, 500 for a change the library refused to persist (carrying rules-not-persisted).{ ok: false, error, status: 500 } when the host read path fails; error is localized and the original exception stays in the host log. A 500 here means the read failed, not that the request was malformed.| Aspect | Content |
|---|---|
| Written to disk | The event stream at $DSH_HOME/cache/lesson-loop/events.jsonl (a discardable derived-data location) plus its transient .lock / .tmp siblings, and the rules array in the lesson-loop section of the settings document |
| Network | No call of its own. /lessons-digest sends this session's negative feedback and the project's recent lessons to the current default model through the host llm service, so that content leaves the machine when that model is remote |
| Retention | The event stream keeps details and rule statements in full, with zero truncation; maxLessonsBytes is a disk fuse, not a context cap |
| Evidence convergence | Rule-card evidence is the one exception: an over-long detail is truncated with an ellipsis and only the most recent rows per card are kept, at write time only. signature and the counters are never trimmed |
| Concurrency | Rule-library writes carry cross-process CAS; event-stream appends share one lock with trimming |
| Language | Host-side wording follows the official locale preference; stored rule statements are user data and are never rewritten |
lessons() read face may carry a lesson's detail, capped at 400 characters, and the card renders only the signature and the counters.commands means no /lessons-digest, no systemPrompt means no standing section, no llm means the digest refuses, no timer leaves manual review only; without settings the entry never activates and the startup diagnostic names it.| Question | Answer |
|---|---|
| Do rules ever enable themselves? | No. Only arm writes armed; reaching the revive threshold only returns a rejected card to candidate. |
What happens with reportEnabled off? |
report() returns { ok: false, reason: "disabled" } immediately and /lessons-digest refuses; the Remote reads and the card keep working. |
The arm button reports rules-not-persisted. |
That change never reached the library; the old state still holds, so retry. |
| A rule keeps showing "undeterminable". | suppressed is still zero, so there is no clean hit to divide by: the rule either sat past decayDays or hit demoteThreshold violations without one followed session. With zero violations too the ratio is undefined, not 1.0 — either way the machine will not decide for you. Disable or archive it yourself; one pass clears the flag. |
I hand-edited rules into a non-array. |
The rule side degrades to "reads empty, refuses writes" and this process never writes that section; the switches keep working until you repair the field. |
| Another plugin cannot see the bus. | Without this package, or when ctx.provide is unavailable (one explicit error), reporters drop their reports and their own functionality is unaffected. |
pnpm install
pnpm run check # typecheck → lint → client build → host build → types → tests → format
test/ splits by the class of defect a stub cannot see: unit tests drive the store and the pure helpers; test/integration/ drives a real cordis and loader, so service hand-out, sibling inject resolution, activation order and bulkhead isolation are measured rather than mocked.test/build-host.test.ts holds the cross-package imports external as bare specifiers, test/dist-size.test.ts a size budget, so an inlined dependency cannot pass unnoticed. test/publish-manifest.test.ts guards the published shape — entry targets covered by files, no source file as an entry point, host packages absent from dependencies, dsh-* pins exact and uniform, no dates in comments or documents.Issues and pull requests are welcome: https://github.com/JayYuen666/dsh-lesson-loop/issues.
If a plugin fails to boot, include the dsh host version, the profile install shape, and the browser console line. The missed the module table line is especially useful: it tells us whether the shared client row was materialized.
MIT. Source at github.com/JayYuen666/dsh-lesson-loop. Issues go to that repository's tracker.
This package contains no third-party source code: host.js and client.js keep every cross-package import external as a bare specifier. Runtime dependencies carry their own licenses; THIRD_PARTY_NOTICES.md records that artifact boundary and how to re-check it.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。