SIGN IN SIGN UP

fix(ctx_note): tighten smart-note guidance to prevent session-context misuse

Observed misuse pattern: an agent saved a multi-paragraph
task-resumption packet (background context, archive paths, commit
list, why-previous-attempt-failed) as a smart note with
surface_condition="When the user mentions that the worktree system
has landed, or when they ask to re-run the audit fixes, or when they
reference .alfonso/oracle-audit-2026-05-11/ in conversation."

That condition is unevaluatable: smart notes are checked by Dreamer,
a separate background process running in a separate session with no
access to the user's conversation. Dreamer can only verify external
signals (GitHub state via gh, web pages, files on disk, git history).
The original tool description ("dreamer evaluates ... when conditions
are met") was too vague — agents were filling in "the agent who reads
context will know when this is relevant" as implicit semantics.

Three tightenings:

1) ctx_note tool description (constants.ts) now explicitly states the
   dreamer's tool set, marks session-context conditions as misuse, and
   gives both ✓ GOOD (PR state, file contents, release tags, workflow
   runs) and ✗ BAD (user mentions, future requests, "when relevant")
   examples. Also documents the alternative: regular notes show up on
   natural work boundaries within the current session.

2) `surface_condition` parameter description (tools.ts) compressed
   into a single tight paragraph stating the misuse cases inline.
   Agents often skip the long tool description but always see the
   parameter description at call time.

3) Dreamer's evaluation prompt (runner.ts) now declares its sandbox
   ("you DO NOT have access to: any conversation, session state, or
   user intent") and instructs the model to OMIT unevaluatable notes
   from the result array rather than mark them met=false. The omission
   leaves them pending; the existing archive-stale task eventually
   retires them. Without this guard, models tried to verify "when the
   user mentions X" using web search and returned false negatives,
   keeping the note alive forever.

No schema/wire changes — only prompt/description text.
U
ualtinok committed
8ae723e8367d2eb6d99ef983ee2866fe6f590cc3
Parent: e0090f8