Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-11-24-shipped-procedures-recalled-like-learned-ones.md
2026-11-24-shipped-procedures-recalled-like-learned-ones.md: 3e240dcafbfc7405ec45fc3c012579ad7bdc5d09
2026-11-24-shipped-procedures-recalled-like-learned-ones.zh.md: b35d703921e7e4c824a20338cf9ac9d4ed38e1ec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Agent Note: Shipped procedures are recalled like learned ones, and Enter in a post composer is not a send

Status: implemented

English | [中文](2026-11-24-shipped-procedures-recalled-like-learned-ones.zh.md)

## Problem

Aeven needed site know-how for every user, starting with LinkedIn posting: the link preview card hides the Media button, two different controls are both labelled `Dismiss`, and one video never goes with images. A preset skill would carry it, but every skill puts its description into every session's catalog, so each new site makes every conversation longer. Learned procedures avoid that cost because memory recall offers only the ones a request matches, but they exist only per owner, as what that owner's agents learned.

Recording the LinkedIn procedure also showed the send guard misreading the post composer: Enter there adds a line, yet the guard asked "Send this message on linkedin.com", and the approval card read the same for that Enter as for a click on Post, so the person could not tell a line break from publishing.

## Decision

### Shipped procedures

- `ctx.memory.ship(procedures)` registers procedures a composition ships for every owner and returns the disposer; `shipped()` lists them, one per name, earliest live registration first. Each carries the id `shipped:<name>` (`shippedProcedureId`), a description, a summary of at most 950 characters, the full procedure, and a domain.
- The memory service adds them to every turn-start `recall` as `shipped`. `@aeven/memory-memos` scores them with the owner's procedures (embedding of name and description, then shared words) and delivers a chosen one as an `active` procedure hit with its summary, except one whose name a non-archived procedure of the owner uses. When a shipped procedure qualifies but none ranks among the first `procedureCandidates`, the best one takes the last place: in the recorded check, an owner's own single-run LinkedIn procedure otherwise outranked the shipped one. An offered shipped procedure then leads the recall's hits: in the same check the unjudged block filled its 16,000 characters with retrieval hits and left out the shipped procedure, which arrived after them.
- The service answers a `trace` `detail` of a shipped id itself, so `memory_get` reads the full procedure, and declines `edit`, `forget`, and `setProcedureStatus` for one without reaching the provider. `procedures()` still lists only the owner's own, so Settings → Memory shows no shipped procedure.
- `@aeven/tool-capability` reads them from `shippedProcedures` (absolute directories, one Markdown file per procedure with `name`, `description`, `summary`, optional `domain` frontmatter) at load, fails the load on a malformed file, and registers them. The learner offers a shipped procedure the owner has no procedure of its name for as an active one it may update; an update is stored as the owner's own procedure of that name and supersedes the shipped one for that owner, with the status an update of an active procedure gets.
- The Aeven preset ships `procedures/` beside its composition; `linkedin-post` is the first procedure. Its steps come from a recorded run of every composer case in the sidebar browser, with nothing published.

### Send guard and approval card

- The outbound probe treats a plain Enter in a multi-line editor (`textarea` or `contenteditable`) as adding a line when the editor's dialog, form, or article shows a control whose label opens with a Post verb and none with a Send verb. Chat composers show Send and single-line inputs submit their form, so both keep asking, and so does Enter with Control, Meta, or Alt, which publishes in X's composer; `preview_press` passes that chord to the probe.
- `ApprovalOutbound.trigger` names the input that publishes, `{ kind: 'key', key }` or `{ kind: 'click', label }`; `preview_*` approvals set it from the probe, and the approval card shows it as an Action line in zh, en, and es.

## Alternatives considered

- **One preset skill per site.** Rejected because each skill's description enters every session's catalog, whatever the request.
- **Copying shipped procedures into each owner's memory.** Rejected because every account would hold a copy, Settings → Memory would list procedures the owner never made, and a shipped update would have to tell an untouched copy from one the learner revised.
- **Delivering a procedure when the sidebar browser shows its site.** Rejected because a request such as "post this on LinkedIn" made while the browser shows another page would get nothing.

## Consequences

- A shipped procedure costs a turn nothing unless recall chooses it; adding one is a Markdown file in the preset's `procedures/`.
- A shipped procedure changes only with a release, and an owner's learned copy of the same name stops receiving those changes.
- Enter in a post composer whose Post control is not labelled with a known Post verb in the page language still asks.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Agent Note:内置流程像已学流程一样被召回,发帖输入框中的 Enter 不算发送

Status: implemented

[English](2026-11-24-shipped-procedures-recalled-like-learned-ones.md) | 中文

## Problem

Aeven 需要为每个用户提供网站操作知识,先从 LinkedIn 发帖开始:链接预览卡会隐藏 Media 按钮,两个不同的控件都标为 `Dismiss`,一条视频从不与图片同发。预设技能可以承载这些内容,但每个技能都会把描述放进每个会话的目录,每多一个网站,每场对话就更长。已学流程没有这项开销,因为记忆召回只提供与请求匹配的流程,但它们只按所有者存在,是该所有者的代理学到的内容。

录制 LinkedIn 流程时还发现发送守卫误判发帖输入框:在那里按 Enter 只会换行,守卫却询问"Send this message on linkedin.com",而且审批卡对这次 Enter 和点击 Post 的显示完全相同,用户无法分辨换行与发布。

## Decision

### 内置流程

- `ctx.memory.ship(procedures)` 注册组合为每个所有者内置的流程并返回 disposer;`shipped()` 按名称各列出一条,以最早仍有效的注册为准。每条带有 id `shipped:<name>`(`shippedProcedureId`)、描述、最多 950 字符的摘要、完整流程和领域。
- 记忆服务把它们作为 `shipped` 加入每次轮次开始的 `recall`。`@aeven/memory-memos` 把它们与所有者的流程一起评分(名称与描述的嵌入,再看共有词语),并把选中的一条作为带摘要的 `active` 流程命中提供;所有者有同名且未归档流程的除外。当有内置流程符合条件、但没有一条排进前 `procedureCandidates` 名时,最佳的一条占据最后一个位置:在记录的检查中,所有者自己从单次运行学到的 LinkedIn 流程原本会排在内置流程之前。被提供的内置流程随后排在召回命中的最前面:在同一次检查中,未经判定的召回块用检索命中填满了 16,000 字符,排在其后的内置流程被排除在外。
- 服务自行回答对内置 id 的 `trace` `detail`,因此 `memory_get` 能读到完整流程;对内置流程的 `edit`、`forget` 和 `setProcedureStatus` 不触及提供方即拒绝。`procedures()` 仍只列出所有者自己的流程,所以 Settings → Memory 不显示内置流程。
- `@aeven/tool-capability` 在加载时从 `shippedProcedures`(绝对目录,每条流程一个 Markdown 文件,frontmatter 含 `name`、`description`、`summary`、可选 `domain`)读取,文件格式错误即加载失败,然后注册。对所有者没有同名流程的内置流程,学习器把它当作可更新的 active 流程提供;更新结果存为所有者自己的同名流程,对该所有者取代内置流程,状态与更新一条 active 流程时相同。
- Aeven 预设在其组合旁提供 `procedures/`;`linkedin-post` 是第一条流程。其步骤来自在侧栏浏览器中逐一录制的全部发帖输入框情形,期间未发布任何内容。

### 发送守卫与审批卡

- 当多行编辑器(`textarea` 或 `contenteditable`)所在的对话框、表单或文章显示一个标签以 Post 类动词开头的控件、且没有以 Send 类动词开头的控件时,外发探测把其中单独按下的 Enter 视为换行。聊天输入框显示 Send,单行输入框会提交表单,因此两者仍会询问;同时按住 Control、Meta 或 Alt 的 Enter 在 X 的输入框中会发布,同样仍会询问,`preview_press` 会把这种组合键交给探测。
- `ApprovalOutbound.trigger` 指明发布所用的输入:`{ kind: 'key', key }` 或 `{ kind: 'click', label }`;`preview_*` 的审批根据探测结果设置它,审批卡以中、英、西三种语言将其显示为"操作"一行。

## Alternatives considered

- **每个网站一个预设技能。** 否决,因为无论请求是什么,每个技能的描述都会进入每个会话的目录。
- **把内置流程复制到每个所有者的记忆中。** 否决,因为每个账户都会持有一份副本,Settings → Memory 会列出所有者从未创建的流程,而内置流程更新时还得区分未改动的副本和学习器修订过的副本。
- **在侧栏浏览器显示某网站时提供对应流程。** 否决,因为浏览器正显示其他页面时,像"把这条发到 LinkedIn"这样的请求将得不到任何流程。

## Consequences

- 内置流程只有在召回选中它时才占用轮次开销;新增一条流程就是在预设的 `procedures/` 中加一个 Markdown 文件。
- 内置流程只随发布版本更新,而所有者学到的同名副本不再接收这些更新。
- 若发帖输入框的 Post 控件在页面语言中不以已知的 Post 类动词标注,其中的 Enter 仍会询问。
4 changes: 2 additions & 2 deletions docs/config-catalog.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/config-catalog.md
config-catalog.md: 6a1e3b0f72bae01c7e14a0ce3412d1d145147e07
config-catalog.zh.md: fbae5ec2bec5ad19f590c967d709d8bd8888294b
config-catalog.md: d7b952e5de52699e70e2f4d636713fa554236be0
config-catalog.zh.md: fd00494bae237ecb100f482b5390c4a3c1560e35
6 changes: 6 additions & 0 deletions docs/config-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5739,6 +5739,12 @@ export interface Config {
maintenanceRenewMs: number
/** Memory store: days an unconfirmed candidate procedure waits before it is archived. */
candidateTtlDays: number
/**
* Absolute directories of procedures this composition ships for every owner, one Markdown file each (see
* `readShippedProcedures`). They are registered with the memory service, which recalls them beside each owner's
* learned procedures; an owner's learned procedure with the same name supersedes one. Requires the memory service.
*/
shippedProcedures: string[]
}
```

Expand Down
6 changes: 6 additions & 0 deletions docs/config-catalog.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -5741,6 +5741,12 @@ export interface Config {
maintenanceRenewMs: number
/** Memory store: days an unconfirmed candidate procedure waits before it is archived. */
candidateTtlDays: number
/**
* Absolute directories of procedures this composition ships for every owner, one Markdown file each (see
* `readShippedProcedures`). They are registered with the memory service, which recalls them beside each owner's
* learned procedures; an owner's learned procedure with the same name supersedes one. Requires the memory service.
*/
shippedProcedures: string[]
}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/event-producer-consumer.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/event-producer-consumer.md
event-producer-consumer.md: 07e14eb88e60c6a2725f738450d7c5877c393088
event-producer-consumer.zh.md: f355f6dd0aaaba059bfd80296c01216033227a1a
event-producer-consumer.md: c002b4d3e6e0169a1c11f86691c00ca454dd8a59
event-producer-consumer.zh.md: 46d12f685a11153fb612652f42e03624c518a7a9
2 changes: 1 addition & 1 deletion docs/event-producer-consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This matrix shows which packages dispatch each harness-owned event and which pac
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:741`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:720`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:727`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:148`](../packages/interaction/user-approval/src/types.ts) | `session-controller` (`waterfall`), [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), [`automations`](../packages/core/automations), `remotes`, `session-controller` |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:155`](../packages/interaction/user-approval/src/types.ts) | `session-controller` (`waterfall`), [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), [`automations`](../packages/core/automations), `remotes`, `session-controller` |
| `attachment/missing` | `waterfall` | [`packages/attachment/attachment/src/index.ts:30`](../packages/attachment/attachment/src/index.ts) | [`attachment-local`](../packages/attachment/attachment-local) (`waterfall`) | [`hosted-app`](../packages/bundle/hosted-app) |
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | [`authorization`](../packages/credentials/authorization) |
| `browser/automation` | `waterfall` | [`packages/web/tool-browser/src/types.ts:37`](../packages/web/tool-browser/src/types.ts) | [`tool-browser`](../packages/web/tool-browser) (`waterfall`) | `remotes` |
Expand Down
2 changes: 1 addition & 1 deletion docs/event-producer-consumer.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:741`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:720`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:727`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:148`](../packages/interaction/user-approval/src/types.ts) | `session-controller` (`waterfall`), [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), [`automations`](../packages/core/automations), `remotes`, `session-controller` |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:155`](../packages/interaction/user-approval/src/types.ts) | `session-controller` (`waterfall`), [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), [`automations`](../packages/core/automations), `remotes`, `session-controller` |
| `attachment/missing` | `waterfall` | [`packages/attachment/attachment/src/index.ts:30`](../packages/attachment/attachment/src/index.ts) | [`attachment-local`](../packages/attachment/attachment-local) (`waterfall`) | [`hosted-app`](../packages/bundle/hosted-app) |
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | [`authorization`](../packages/credentials/authorization) |
| `browser/automation` | `waterfall` | [`packages/web/tool-browser/src/types.ts:37`](../packages/web/tool-browser/src/types.ts) | [`tool-browser`](../packages/web/tool-browser) (`waterfall`) | `remotes` |
Expand Down
4 changes: 2 additions & 2 deletions docs/subsystems/memory.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/memory.md
memory.md: d08e8339f41581ff7dae5d089231ede7da18dc64
memory.zh.md: 0db41971f53f2810a2fb188914163d018b33d3d3
memory.md: 5b9c612eb5d819864cf63494a67a9278cd49c259
memory.zh.md: 7c628aed31eb55d2afc0ff8e00fa78ef26f18427
18 changes: 17 additions & 1 deletion docs/subsystems/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ register(provider: MemoryProvider): () => void
*/
whileActive(setup: () => () => void): () => void

/**
* Register procedures a composition ships for every owner. Each name may appear once per registration; across
* registrations the earliest live one of a name is served.
* @param procedures - the procedures, each with the id {@link shippedProcedureId} gives its name.
* @returns idempotent disposer that withdraws them.
* @throws Error when a name repeats or an id does not match its name.
*/
ship(procedures: readonly ShippedProcedure[]): () => void

/**
* The procedures registered with {@link ship}, one per name. An owner's learned procedure with the same name
* supersedes one in recall; callers that list procedures for an owner apply the same rule.
* @returns the shipped procedures.
*/
shipped(): readonly ShippedProcedure[]

/**
* Retrieve memory relevant to a query within the request's foreground budget.
* @param request - query, scope, and foreground budget.
Expand Down Expand Up @@ -76,7 +92,7 @@ setProcedureStatus(request: Parameters<MemoryProvider['setProcedureStatus']>[0])
async turnDomain(request: Parameters<MemoryProvider['turnDomain']>[0]): Promise<MemoryDomain | undefined>

/**
* Read one memory item.
* Read one memory item. A `trace` read of a shipped procedure's id answers with the procedure, without the provider.
* @param request - scope, item kind, and id.
* @returns the item, or undefined when the scope holds no such item.
*/
Expand Down
18 changes: 17 additions & 1 deletion docs/subsystems/memory.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ register(provider: MemoryProvider): () => void
*/
whileActive(setup: () => () => void): () => void

/**
* Register procedures a composition ships for every owner. Each name may appear once per registration; across
* registrations the earliest live one of a name is served.
* @param procedures - the procedures, each with the id {@link shippedProcedureId} gives its name.
* @returns idempotent disposer that withdraws them.
* @throws Error when a name repeats or an id does not match its name.
*/
ship(procedures: readonly ShippedProcedure[]): () => void

/**
* The procedures registered with {@link ship}, one per name. An owner's learned procedure with the same name
* supersedes one in recall; callers that list procedures for an owner apply the same rule.
* @returns the shipped procedures.
*/
shipped(): readonly ShippedProcedure[]

/**
* Retrieve memory relevant to a query within the request's foreground budget.
* @param request - query, scope, and foreground budget.
Expand Down Expand Up @@ -76,7 +92,7 @@ setProcedureStatus(request: Parameters<MemoryProvider['setProcedureStatus']>[0])
async turnDomain(request: Parameters<MemoryProvider['turnDomain']>[0]): Promise<MemoryDomain | undefined>

/**
* Read one memory item.
* Read one memory item. A `trace` read of a shipped procedure's id answers with the procedure, without the provider.
* @param request - scope, item kind, and id.
* @returns the item, or undefined when the scope holds no such item.
*/
Expand Down
Loading
Loading