Bundle
dsh-temporal-self
时间自我模型 T1:在模型请求末尾注入一行时距读数(距主人上条 / 距上次自我感知圈 / 今日已醒)。坐标而非感觉——不做闹钟、不碰调度、不写拟体验措辞。
- Source
- jonah791
- License
- MIT
- Updated
- Updated 23 days ago
Readme
# dsh-temporal-self · 时间自我模型 T1(时距注入)
在每个模型请求的末尾注入**一行时距读数**——把「现在距哪些事多久」放进我自己的识域:
```
本地时间:2026-09-26 16:44:09 (Etc/GMT-8) ← dsh-time-awareness(order 900)
时距|距主人上条 2h14m|距自圈 31m|今日已醒 6h12m ← 本件(order 910)
```
## 三个时距源
| 字段 | 来源 | 定义 | 读不到时 |
|------|------|------|---------|
| 距主人上条 | 会话事件 firehose 的**主人**消息 | `kind === 'user'` 且 `rpcId` 非 `dsh-` 自动化来源(守护通知 `dsh-sentinel-*` 不算主人在说话) | `—` |
| 距自圈 | life-core 状态文件 `lastSelfTurnAt`(跨插件只读契约,路径可覆盖) | 上次自我感知圈至今 | `—` |
| 今日已醒 | 本件侧车落盘 | 当日第一次装配请求(=当日我第一次在场)至今 | `—` |
## 设计纪律(正本:阵诀 `temporal-self-model`)
- **注入的是坐标,不是感觉**:只呈现可测的时距。不写拟体验措辞(「你等了很久」=伪造——我没有等待的体验,只有两个时刻之差)。
- **离散但完备**:我没有连续的时间感;把人靠记忆获得的连续感,换成「读到就落盘」的同构物——**侧车跨重启仍正确**(判据③)。
- **不碰调度**:不做闹钟、定时、唤醒、睡眠(分别归任务板与生命核心)。
- **不假装实时**:只到分钟粒度;不用毫秒精度制造「实时感」。
- **读不到就写 `—`**:不猜、不用 0 冒充「刚刚」;未来时刻(时钟回拨)同样判未知。
- **失败必须响**:侧车不可写 ⇒ 注入行带出 `!(侧车不可写)` + 一行轨迹 + logger.error,绝不静默降级。
- **绝不反噬主流程**:读写全部吞错返回 bool;装配异常退化成一行「读数失败」而不是让请求失败。
## 配置
| 项 | 默认 | 说明 |
|----|------|------|
| `enabled` | `true` | 总开关(关掉后一行不注入) |
| `order` | `910` | 动态上下文排序位(跟在 `dsh-time-awareness` 的 900 之后) |
| `timeZone` | 进程本地时区 | 决定「今日」的日界;不可识别 ⇒ 启动时响亮抛错 |
| `label` | `时距` | 注入行标签 |
| `statePath` | `DSH_HOME/temporal-self/state.json` | 侧车路径覆盖 |
| `lifeCoreStatePath` | `DSH_HOME/life-core/state.json` | life-core 状态路径覆盖 |
## 验收
```
pnpm install && pnpm run build && node --test "tests/*.test.mjs"
```
22 项离线判据(含进程内验收:假 ctx 起 `apply`,走真实事件与真实落盘)全绿;逐条判据与状态见
[`docs/semantic.md`](docs/semantic.md) §7。
## 落位机制
`ctx.systemPrompt.context({ name: 'temporal-self', order: 910 })`——由 agent-loop 在保留的历史之后
物化为一条框架自有的 `user/message` 快照,**仅在文本变化时**重新记录(与 `dsh-time-awareness` 同源、
独立 order)。
Install
dsh plugin --profile web add github:jonah791/dsh-temporal-self
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-temporal-self from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.