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

Open Beginner friendly
#2,822 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start in skills/LifeOSHooks/hooks/LifeOSHooks.ts at promptSubmit: note where each context entry is built versus where next() is awaited, and read the PromptSubmitInput.context / PromptSubmitResult.context declarations it quotes to confirm the supported path down. Move the FAST-TOGGLE and ORIGIN entries into the array passed through next({ ...input, context }), keep scheduleFast and the memory ack after an accepted next(), and return the result unchanged. Done means a live prompt shows the time line, memory block and ORIGIN: line in model context. Check #2608's fix before starting, and treat the second, fallback-related problem as follow-up rather than part of this edit.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
19.8k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from danielmiessler/LifeOS

All issues in danielmiessler/LifeOS

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.