meta: shared context-inference framework for agents #111

Open
opened 2026-05-05 09:24:29 +00:00 by alvis · 0 comments
Owner

Goal

A shared library that any agent can use to fit per-user parameters from history (quiet hours, focus areas, momentum baselines, lateness tolerance, etc.) without reinventing the recompute/cadence/cold-start machinery.

Why

Each agent in ADR-0013 wants its own auto-inferred context (see linked per-agent issues). If each implements its own fitting + caching + cold-start logic, they will diverge in subtle ways and double the maintenance surface. The framework owns the boring parts so each agent ships only its inference function.

Scope

  • Inference contractinfer(user_id, history) -> dict per agent; pure function, no side effects.
  • Recompute cadence — declarative TTL per inferred parameter; framework runs the schedule.
  • Storage — writes to user_preferences under scope=agent:<id> (per the unified Profile model in #30).
  • Cold-start fallback — every parameter ships a sensible default; framework returns default until enough history exists.
  • Versioning — bump agent_version invalidates cached inferences so logic changes propagate.
  • Observability — log every recompute (input window size, output diff vs prior, latency).

Out of scope

  • The per-agent inference logic itself (tracked in the per-agent issues).
  • User-facing override UI (covered by #30 admin/settings work).

Done when

  • A ml/agents/inference/ module with the contract above.
  • One agent (likely time-of-day) migrated onto it as the proof.
  • Unit tests covering cold-start, TTL refresh, and version invalidation.
  • README documenting how to add a new inferred parameter.
  • ADR-0013 (multi-agent recommendation)
  • #30 (unified Profile model — defines user_preferences scope/key shape this writes into)
## Goal A shared library that any agent can use to fit per-user parameters from history (quiet hours, focus areas, momentum baselines, lateness tolerance, etc.) without reinventing the recompute/cadence/cold-start machinery. ## Why Each agent in ADR-0013 wants its own auto-inferred context (see linked per-agent issues). If each implements its own fitting + caching + cold-start logic, they will diverge in subtle ways and double the maintenance surface. The framework owns the boring parts so each agent ships only its inference function. ## Scope - **Inference contract** — `infer(user_id, history) -> dict` per agent; pure function, no side effects. - **Recompute cadence** — declarative TTL per inferred parameter; framework runs the schedule. - **Storage** — writes to `user_preferences` under `scope=agent:<id>` (per the unified Profile model in #30). - **Cold-start fallback** — every parameter ships a sensible default; framework returns default until enough history exists. - **Versioning** — bump `agent_version` invalidates cached inferences so logic changes propagate. - **Observability** — log every recompute (input window size, output diff vs prior, latency). ## Out of scope - The per-agent inference logic itself (tracked in the per-agent issues). - User-facing override UI (covered by #30 admin/settings work). ## Done when - A `ml/agents/inference/` module with the contract above. - One agent (likely `time-of-day`) migrated onto it as the proof. - Unit tests covering cold-start, TTL refresh, and version invalidation. - README documenting how to add a new inferred parameter. ## Related - ADR-0013 (multi-agent recommendation) - #30 (unified Profile model — defines `user_preferences` scope/key shape this writes into)
alvis added this to the M2 — AI tips + multi-source signals milestone 2026-05-05 09:24:29 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alvis/oO#111