Skip to content

Priors: the user's standing instructions in every prompt; download retries - #7

Merged
FMXExpress merged 4 commits into
mainfrom
claude/optimistic-allen-i3bd3d
Oct 31, 2026
Merged

FMXExpress merged 4 commits into
mainfrom
claude/optimistic-allen-i3bd3d

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Priors

Facts say what is true about the user; priors say how to answer them.

  • Detection (Mem.Priors): "from now on keep your answers to one sentence", "never use emojis", "I prefer short answers" or /prior <text> become priors.
    • A standing instruction needs a marker: from now on, always/never, don't + an answering verb, I prefer + an answer word, or you can ….
    • "Use Python for this" is a one-off request, not a prior.
  • Confidence is counted: alpha / (alpha + beta).
    • prior_evidence counts each user message once per prior, so the same remark is never re-weighed on later turns.
    • A remark starts at 1:1, /prior at 3:1.
    • This replaces the observer pattern where a model proposes a new confidence every turn and delta × volatility is applied: there the same evidence is reread each turn and the value drifts to whatever the observer asks.
  • Contradiction:
    • "Actually, you can use emojis" counts against "never use emojis" and becomes a prior of its own.
    • Of two opposite priors, only the more confident (or the newer) reaches the prompt.
    • A prior contradicted down to deprecate_under is deprecated, never deleted, and comes back if confirmed again.
  • Prompt: at most max_in_prompt priors at or above min_confidence, under "The user's standing instructions".
  • Commands: /priors (each prior with its evidence, and why it is in or out of the prompt), /prior <text>|drop <id>|restore <id>, /prompt <text> (the exact system prompt a message would get), and a /status line.
  • Config: [priors] in memagent.ini.

Downloads (carried over from #6, merged before it)

The #6 Linux smoke test died with an unhandled ESocketError: a single DNS failure for Hugging Face's CDN during first-run provisioning, and ProvisionRetrieval let the exception escape instead of falling back to the lexical embedder.

  • HttpsGetToFile now retries socket errors after 2 s and 4 s.
  • A download that still fails is reported, and retrieval falls back instead of crashing.

Tests

  • make test: pass. Includes the new memagent/tests/priors_test.lpr, 30 checks covering detection, matching, evidence once per message, deprecation and restoring.
  • scripts/e2e_priors.sh, on the real binary with no training: pass.
    • Instructions are picked up, confirmed (2:1 → 3:1) and contradicted (3:1 → 3:2).
    • /prior sets one and /prior drop drops one.
    • /prompt shows the right priors, with the losing one of an opposite pair left out.

Generated by Claude Code

…ger crashes

The PR's Linux smoke test died on an unhandled ESocketError: DNS for
Hugging Face's CDN host failed once during first-run provisioning, and
ProvisionRetrieval let the exception escape instead of falling back to the
lexical embedder. HttpsGetToFile now retries socket errors (DNS, reset)
after 2 s and 4 s; ProvisionRetrieval reports a download that still fails
and returns False.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
Mem.Priors finds standing instructions in the user's words (from now on,
always/never, don't + an answering verb, I prefer + an answer word, you can
...), and matches each against stored priors as a confirmation or a
contradiction (content-word Jaccard, polarity from negators). TMemStore
keeps priors with alpha:beta evidence counts and a prior_evidence log in
which each message counts once; confidence = alpha / (alpha + beta), a
remark starts at 1:1, /prior at 3:1. Contradicted down to deprecate_under a
prior is deprecated, never deleted, and confirmed back it returns.

The most confident active priors go into the system prompt, at most
max_in_prompt, and of two opposite ones only the more confident (or newer).
/priors, /prior <text>|drop <id>|restore <id>, /prompt <text> (the system
prompt a message would get), /status line. [priors] in memagent.ini.

Tests: memagent/tests/priors_test.lpr (make test-pascal), scripts/e2e_priors.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
@FMXExpress
FMXExpress merged commit 6ce7c2f into main Oct 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants