384961890-ui / pawin-brain-deepseek-harness

목록에 있음

A brain-inspired runtime for DeepSeek Harness agents — remember, self-correct, learn. v0.1 ships memory (injection, notes, recall), 100% covered.

main세션 소스 보기

설치

npx -y @deepseek-ai/dsh plugin --profile web add github:384961890-ui/pawin-brain-deepseek-harness

이 설치 명령은 GitHub 저장소 주소에서 생성된 확인되지 않은 시작점입니다.

README

유지 관리자가 작성한 문서 스냅샷입니다.

GitHub에서 보기 ↗
커밋 a0319f6동기화 2026. 8. 18.

Pawin Brain

Pawin Brain · DeepSeek Harness

简体中文

A brain-inspired agent runtime.
Remember · self-correct · learn — v0.1 starts with memory, the foundation of both.

Built for DeepSeek Harness MIT License 100% coverage 84 tests passing TypeScript strict

Quick start · How it works · Security · Configuration · Development


[!NOTE] This is an independent community plugin by the Pawin project — it is not an official DeepSeek product.

The brain idea

Pawin Brain is not a memory plugin — it is a brain-inspired runtime for agents, built around one loop:

remember ──► self-correct ──► learn
   ▲                             │
   └─────────────────────────────┘
  • Remember — an agent that cannot recall its past cannot learn from it.
  • Self-correct — surface contradictions, repeated failures, and missing evidence instead of glossing over them.
  • Learn — a lesson only counts when a later, different session changes its behavior, not when it merely writes a note about itself.

v0.1 ships the remember stage — the hippocampus. It is deliberately the foundation: every later stage reads what this one wrote down.

What v0.1 ships

The first, fully-tested slice of the runtime, for DeepSeek Harness:

  1. Per-turn injection — recent diary entries enter the model's context at the start of every turn.
  2. brain_note — append a fact worth remembering to today's diary.
  3. brain_recall — multi-word AND search over past diary entries.

Memory is a directory of plain Markdown files. No database, no network, no external service. Delete the directory and all memory is gone.

Roadmap

The later stages of the loop — self-correct (conflict monitoring, repeated-failure detection) and learn (behavior-differential proof) — are under active development and will ship as later versions. Memory is released first because every other stage depends on it.

<memoryRoot>/
└── diary/
    ├── 2026-08-13.md   # append-only, one [HH:MM] entry per line
    └── 2026-08-12.md

Quick start

Run from a DeepSeek Harness checkout:

pnpm dsh web --patch examples/demo.cordis.yml

Open http://127.0.0.1:3080 and say:

Note down that my favorite drink is oolong tea.

Then, in a new session (no need to restart the server):

What is my favorite drink? Check memory with brain_recall.

The agent recalls it from the diary on disk.

How it works

flowchart LR
    U[User turn] --> P[agent/pre-step]
    P -->|inject today's diary| M[Model request]
    M -->|calls| N[brain_note]
    M -->|calls| R[brain_recall]
    N --> D[(diary/YYYY-MM-DD.md)]
    R --> D
    D -->|next turn| P
  • Injection hooks agent/pre-step (waterfall) and appends one source-attributed message per turn — never more than once a turn, and never when the diary is empty.
  • Tools go through the normal ctx.tools registry: runtime argument validation, sandbox policy, approval, and teardown all behave as with any first-party tool.
  • Storage is append-only with O_APPEND; concurrent appends do not clobber each other.

Security

dsh-brain treats the diary as untrusted input and the filesystem as hostile:

BoundaryBehavior
DatesStrict YYYY-MM-DD calendar-roundtrip validation; 2026-02-30 is rejected
Path traversalRejected at the date-parameter level; a second join check stays as defense
Symbolic linksRejected at three layers: memory root, diary/ dir, and each diary file
ContentNUL bytes, overlong lines, and over-budget appends are rejected loudly
ReadsByte-budgeted with newest-tail truncation; 64 MB hard cap per file
WritesO_APPEND atomic appends; concurrent writes never interleave
ConfigInvalid configuration fails at plugin load — never silently

Configuration

FieldDefaultMeaning
memoryRoot~/.dsh-brain-memoryMemory root (absolute or ~-prefixed)
injectDiaryDays2Recent diary days injected per turn (incl. today), 1–7
injectMaxBytes8192Total injection byte budget
noteMaxBytes8192brain_note per-call byte budget
recallMaxResults20brain_recall max returned hits, 1–500
recallSnippetChars240Per-hit display characters, 1–4000
recallScanDays30brain_recall scan window in calendar days, 1–365

Example mount entry (examples/demo.cordis.yml):

- insert:
    - id: dsh-brain
      name: '/absolute/path/to/dsh-brain/src/index.ts'
      config:
        memoryRoot: '~/.dsh-brain-memory'

Development

This plugin is developed as a standalone directory inside a DeepSeek Harness checkout (its @deepseek-ai/* dependencies resolve through the harness workspace).

# unit tests + real-composition test; per-file 100% coverage gate
./node_modules/.bin/vitest run --config vitest.config.ts --coverage

# typecheck (paths map every @deepseek-ai/* package to its built lib/types)
./node_modules/.bin/tsc --noEmit -p tsconfig.json

# lint (harness .oxlintrc.json)
./node_modules/.bin/oxlint -c .oxlintrc.json src tests

Current state: 84 tests passing, 100% coverage across statements / branches / functions / lines, typecheck and lint clean.

The real-composition test boots a headless assembly through the harness's own Loader; a deterministic mock LLM really calls brain_note and brain_recall, and the test asserts that the second turn's injection sees the first turn's write.

License

MIT © Pawin

Not affiliated with or endorsed by DeepSeek.

프로젝트 파일 및 신호

표시된 항목은 디렉터리 스냅샷에서 감지된 공개 저장소 신호입니다.

테스트감지됨
예제감지됨

저장소 정보

언어
TypeScript
라이선스
MIT
마지막 업데이트
2026. 8. 13. 오후 4:12

신중하게 설치하기

소스 코드, 권한, 수명 주기 스크립트, 의존성 및 네트워크 접근을 검토하고 신뢰하지 않는 플러그인은 격리 환경에서 테스트하세요.