LifeOSHooks: `promptSubmit` puts its composed context on the result after `next()`, which the engine does not attach, so memory, nudges and the ORIGIN warning never reach the model

未关闭 适合新手
#2,822 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

从 skills/LifeOSHooks/hooks/LifeOSHooks.ts 的 promptSubmit 开始:注意每个上下文条目在哪里构建,以及 next() 在哪里被 await,并阅读它引用的 PromptSubmitInput.context / PromptSubmitResult.context 声明,以确认受支持的向下路径。将 FAST-TOGGLE 和 ORIGIN 条目移入通过 next({ ...input, context }) 传入的数组,在接受 next() 之后保留 scheduleFast 和内存确认,并原样返回结果。完成意味着实时 prompt 在模型上下文中显示时间线、内存块和 ORIGIN: 行。开始前检查 #2608 的修复,并将第二个与 fallback 相关的问题视为后续事项,而不是本次编辑的一部分。

由索引模型根据 Issue 内容生成。

描述

What. skills/LifeOSHooks/hooks/LifeOSHooks.ts promptSubmit builds its per-turn entries before next() (the time line, then the prompt-context bridge reply: the memory hot layer, AlgorithmNudge, VersionDrift, DriftReminder, ModelDriftGuard, PresenceContext). After next(input) resolves, it appends the FAST-TOGGLE and ORIGIN lines and returns { ...r, context }.

The client's own plugin declarations (PromptSubmitResult.context, as written by 2.1.322) say:

A hook attaches context on the way down; one put here after next resolved is not attached (the prompt had entered), and is logged.

PromptSubmitInput.context gives the supported form: next({ ...e, context: [...(e.context ?? []), mine] }).

What happens. None of the plugin's prompt context reaches the model. In one live session, no time line, memory block or ORIGIN: line appeared in the model's context on any prompt, including prompts the plugin logged with origin task-notification. Context from native command hooks (a PostToolUse additionalContext) did arrive in the same session. Because native MemoryTurnStart exits early in an armed session, an armed session gets no hot memory at all.

The ORIGIN line is the warning that a prompt did not come from the principal and carries no authority. It is lost the same way.

Suggested fix. Build every entry before next() and pass it down, then return the result unchanged. Keep the side effects that need an accepted prompt (scheduleFast, the memory ack) after next():

const context = [...mine];
const bare = e.origin.kind === "composer" && !e.command && !e.isMeta ? bareFast(input.text) : null;
if (bare) context.push(`FAST-TOGGLE: ...`);
if (!PRINCIPAL_ORIGINS.has(e.origin.kind)) context.push(`ORIGIN: ...`);
const r = await next(context.length ? { ...input, context: [...(input.context ?? []), ...context] } : input);
if (r.drop !== undefined) return r;
if (bare) scheduleFast($, s, bare, "bare");
// memory ack, unchanged
return r;

Related. The memory ack in the same hook depends on this. It marks chunks consumed after next(), but those chunks were never attached, so the ack confirmed deliveries that hadn't happened. #2608 (closed, fixed for the next release) moves the ack after an accepted next() and carries the emission id back from prompt-context; its note does not say whether the context itself moved before next(). If that fix already passes the entries down through next(), this issue is covered and can be closed.

A second issue that shows up once context is delivered. When one composer inside prompt-context throws, the bridge withdraws the prompt-context cap and the native command hooks run for that prompt as well, so that turn carries some entries twice. Dropping the plugin's entries in that case doesn't fix it cleanly. Native TimeContext and VersionDrift are registered async: true, so their output arrives a turn late (and TimeContext falls back to UTC when no timezone is configured). VersionDrift has also already started its cooldown during the bridge's run, so its warning would be lost. PromptProcessing and SatisfactionCapture run in the bridge before coverage is decided, so their model request and rating pulse repeat natively either way. A fallback that is equivalent to the bridge would let the bridge report which composers failed, so that only those fall back to their native hooks.

主要语言
TypeScript
星标
19.8k
派生
2.5k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

danielmiessler/LifeOS 的其他 Issue

查看 danielmiessler/LifeOS 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。