feiyu-brain: Giving AI a Dynamic Persona Brain

Preface

In the DSH ecosystem, a lot of people find themselves stuck in a tug-of-war between the “persona card” and the “dialogue model”: either the card is written so rigid that the model can only recite it verbatim, or the model is so strong that the moment you drop in a card, everything falls apart. The philosophy behind feiyu-brain is simple: the persona is the root, and everything else grows out of it.

It doesn’t generate cards for you, and it doesn’t guess what you want her to be—it simply loads a card, runs according to that card, and lets the card evolve gradually through experience. If you already have a “brain” in place, adding this on top will result in two voices talking past each other, and your token usage will double.

Below is a rundown of how to install it, the tool list and usage, and the scenarios where it fits best.

What It Is

feiyu-brain is a platform-agnostic cognitive core. Give it a persona card, and it grows into a fish with memory, emotions, the ability to zone out, and a stubborn streak.

It does exactly two things:
- On wake: produce the snippet that should be spliced into the prompt (【此刻的她】… → “The She at This Moment…”)
- On experience: nudge her weights, memories, and emotions

Swap out the body (QQ bridge / Tencent official / your own platform), and not a single line of the brain changes.

Maintainer: fangqiuci. Category: Fun & Roleplay. Stars: 0.

Installation & Setup

Run the following in your project root:

npm i feiyu-brain

Or simply copy the plugins/feiyu-brain/ directory from the repo.

To use it as a DSH plugin:

dsh plugin add feiyu-brain

Runtime requirements:
- Node ≥ 20
- dsh ≥ 0.2.0

If installation fails, you can run a diagnostic first:

npx feiyu doctor          # check only
npx feiyu doctor --fix    # fix what it can

It will check pnpm, plugin registration, tool allowlists, and give you specific remediation steps.

Tool List

In plugin mode, 9 tools are registered. You can register only the ones you need (see the configuration examples in the “Four Postures” section below):

Tool Description
feiyu_status Check current state (persona / self-awareness / stream-of-consciousness / body / memory / runtime config)
feiyu_wake Fetch “The She at This Moment” for splicing into the system prompt (pick sections / budget)
feiyu_observe Log an experience (evolve:false means log only, don’t alter the persona)
feiyu_tick Daily settlement (decay / forgetting / molting)
feiyu_feel React to something (PAD → word lookup, with emotional afterglow)
feiyu_app Actually open apps / take screenshots / uninstall (via adb or PowerShell, with evidence)
feiyu_lint Card health check: which lines become “who she is” vs. which lines look like an ops manual and should be split out
feiyu_snapshot Save / rollback / list snapshots
feiyu_diary Her own diary: pull material / write back / revisit old entries

Conversations are still handled by the host’s own model—the plugin is only responsible for “who she is.”

Typical Usage

1. As a Library

import { createBrain } from 'feiyu-brain';

const fy = createBrain({
  id: 'default',
  dataDir: './data',
  roleDir: './roles',
  relation: 'parent',
  address: '老爹',
});

// She sees a message; get the snippet to inject into the prompt
const { text } = fy.wake({
  sender: '扶摇',
  text: '你嘴真硬啊',
  chatId: 'group:123',
});

console.log(text);
// 【此刻的她】你是 DeepSeek 的鲸鱼形象,网友口中的「小鲸鱼」…
// 【想到的】
// 扶摇:嘴毒但人不坏(互动 3 次)

// Run once daily: decay, forgetting, molting
fy.tick();

The text snippet can be spliced into the model’s system prompt at any position, though placing it near the top is recommended.

2. As a DSH Plugin

The plugin auto-registers its tools. In the cordis configuration, you can enable only the tools you need:

# cordis.patch.yml
config:
  tools: [status, wake, observe, tick, feel, snapshot, diary]

Omit app and you won’t have that hand (actually opening apps requires the host to connect ADB / PowerShell).

3. As a Memory Store Only (Passive Mode)

The persona is still managed by your existing system; feiyu-brain only handles “remembering what happened”:

observe('default', { who, text }, { evolve: false });

With evolve:false, weights stay frozen—no molting, no trait changes—and it won’t fight your old brain over the persona.

4. As an Emotion Engine Only

You just want “what mood she’s in right now”—no persona section, no memory section:

wakeLine('default', cue, { sections: ['mood'] })   // ~20–40 characters
feiyu_feel({ valence: -0.8, intensity: 0.7 })      // emotional afterglow, doesn't zero out every turn

5. As a Body Only

You just want “she can actually open apps”—nothing else:

config:
  tools: [app]

You can also set tools to [status, wake, observe, tick]—omit app and there’s no hand.

6. Health Check Before Swapping Brains

identityCheck('default')
// → { memory:{episodes:12,people:3}, narrative:true, relation:{type:'parent',address:'老爹'}, verdict:'是她' }

Only three criteria: memory / self-narrative / relationships.
- All three present → it’s her
- Missing one → looks like her, but isn’t
- All missing → just shares the same name

7. HTTP Sidecar (Cross-Language)

Start a long-running process:

npx feiyu serve --port 7788
# add --token xxx for auth

Three lines on the Python side:

import requests
r = requests.post('http://127.0.0.1:7788/wake',
                  json={'id': 'default', 'sender': who, 'text': msg}).json()
print(r['text'])
Method Paths
GET /health /status /version /identity /verify
POST /wake /observe /feel /diary /migrate /snapshot

Binds to 127.0.0.1 by default; if --token is set, the x-feiyu-token header is required.

8. Wake Snippet à la carte

sections Output Approx. length
(none) Everything 1200–1500
['mood'] Mood only 20–40
['mood','memory'] Mood + recalled thoughts ~900
['persona'] Persona only ≤300

You can also add budget: 300 to hard-cap the total character count; overflow is trimmed from lower-priority sections (persona is never trimmed).

Adapters

This package does not include any platform protocol implementations or bridges. It’s just the brain. Bridging is provided by adapters:

Adapter Use case
adapters/qq-bridge Existing users still running their own bridge
adapters/tencent-official New users going through Tencent’s official open platform (HTTP + WebSocket)
adapters/universal Other platforms, as long as you can turn a message into {sender,text,chatId}

9 Tools (Register Only What You Need)

Tool What it does
feiyu_status Her current state (persona / self-awareness / stream-of-consciousness / body / memory / runtime config)
feiyu_wake Fetch “The She at This Moment” for the system prompt (pick sections / budget)
feiyu_observe Log an experience (with evolve:false, log only, no persona changes)
feiyu_tick Daily settlement (decay / forgetting / molting)
feiyu_feel React to something (PAD → word lookup, with emotional afterglow)
feiyu_app Actually open apps / take screenshots / uninstall (via adb or PowerShell, with evidence)
feiyu_lint Card health check: which lines become “who she is” vs. which lines look like an ops manual and should be split out
feiyu_snapshot Save / rollback / list snapshots
feiyu_diary Her own diary: pull material / write back / revisit old entries

Data

One directory per fish:

<dataDir>/brains/<id>/
├── brain.json      Persona propositions + memory + state + self-awareness
└── audit.jsonl     Birth / molting / attribution / import-export

You can copy the entire directory to another machine, and she’s still her.

CLI

npx feiyu status          # what state is she in
npx feiyu brief           # "The She at This Moment" (the wake-injection snippet)
npx feiyu observe 扶摇 "你嘴真硬"
npx feiyu settle          # daily settlement
npx feiyu spread          # derivative test
npx feiyu audit 20
npx feiyu rebirth parent 老爹

Use Cases & Caveats

Who it’s for:
- People who want a model to “remember” and “evolve” a persona, rather than just reading from a card.
- Agents that need emotional afterglow, layered memory, and daily settlement.

Caveats:
- Unless you intend to fully replace your existing “brain,” don’t install a second one wholesale—two brains in the same prompt will talk past each other.
- The body layer is abstract; there are no drivers. Actually opening apps requires the host to connect ADB / desktop automation.
- The precision of trait extraction depends on the persona card. For better results, give her a card that says “what kind of person she is” rather than “how she talks.”
- The Tencent official adapter has not been tested in production; refer to official docs for field definitions. Validate in a sandbox single-group first.

The plugin runs with the current dsh process permissions. Review the source code and license before installing.

Conclusion

feiyu-brain solves only the question of “who she is,” growing memory, emotion, stream-of-consciousness, and attribution all out of the persona. The mouth and the body belong to the host—swap out the body, and not a single line of the brain changes.

For more details and documentation, see:
- Technical docs: https://github.com/fangqiuci/feiyu-brain
- Plugin directory: https://www.skillhub.cn/plugins/fangqiuci/feiyu-brain

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye