Doenexecutor memory research
Prompts
1. Title: A new initiative starts with the executor's questionnaire What the person wrote: The new initiative prompt should take the user thro2. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording, but preserve the pur3. Title: A new initiative starts with the executor's questionnaire What the person wrote: The new initiative prompt should take the user thro4. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording, but preserve the pur5. Title: A new initiative starts with the executor's questionnaire What the person wrote: The new initiative prompt should take the user thro6. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording, but preserve the pur7. Title: Live memory learns from the first initiative Intent: The executor's memory waits for five calls by a person before it dreams, and it8. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording, but preserve the pur9. Title: Live memory learns from the first initiative Intent: The executor's memory waits for five calls by a person before it dreams, and it10. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording, but preserve the pur11. Title: Live memory learns from the first initiative Intent: The executor's memory waits for five calls by a person before it dreams, and it12. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording, but preserve the pur13. Title: Move Structured Calls to pydantic-ai Intent: Structured model calls still rely on a custom OpenAI-compatible client whose forced-fun14. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording and propagate changes15. Title: Move Structured Calls to pydantic-ai Intent: Structured model calls still rely on a custom OpenAI-compatible client whose forced-fun16. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording and propagate changes17. Title: Move Structured Calls to pydantic-ai Intent: Structured model calls still rely on a custom OpenAI-compatible client whose forced-fun18. Memory of this project (the product context the code does not carry): Honor explicit product intent over stale wording and propagate changes
BD-125 · stateless · seed 1
Title: Move Structured Calls to pydantic-ai

Intent: Structured model calls still rely on a custom OpenAI-compatible client whose forced-function output mode can disable reasoning and is rejected by some models. Move the scoped calls to pydantic-ai so they use provider-native structured output, preserve current production models and prompts, and can be configured for other providers without losing reasoning or cost tracking. This initiative covers the listed services and research scripts; Jev remains separate, and any remaining follow-up outside that scope is not included.
Claude
Intent: Replace the custom forced-function structured-call path with pydantic-ai for the scoped service calls and research scripts. Preserve the current production model defaults and prompts, while allowing calls to use provider-native structured output so reasoning can remain available. Keep project cost tracking working across provider configurations.

Constraints:
- Scope the shared provider and structured calls in `backend/app/providers/llm.py`, `backend/app/services/ambiguity.py`, `backend/app/services/classification.py`, `backend/app/services/correction_review.py`, `backend/app/services/learn.py`, `backend/app/services/live_memory.py`, `backend/app/services/review.py`, and `backend/app/services/shaping.py`.
- Include the structured calls in `backend/app/measure_memory_replay.py`, `backend/app/replay_live_dreams.py`, and `backend/app/replay_live_predictions.py`.
- Leave Jev’s separate typed-judgment path in `backend/app/providers/jev.py` out of this migration.
- Keep the existing production model defaults, prompts, output shapes, and service behavior. A provider change must not silently change prompt wording or structured fields.
- Use provider-native structured output rather than relying on a forced function call. Preserve configured reasoning effort where it is supported, including the live-memory setting and the replay scripts’ reasoning options.
- Keep cost logging compatible with the existing `llm_cost_log` table and its `project_id`, `provider`, `model`, `purpose`, token-count, latency, and cost columns. Continue to handle unavailable cost data and best-effort log-write failures without breaking the model call.
- Do not broaden the work to unrelated provider follow-ups or other call types.

Discretion:
- Choose how to adapt the existing JSON schemas and `StructuredLLM` interface to pydantic-ai, provided callers retain their current output shape and failure behavior.
- Choose how to organize provider/model construction and lifecycle management, as long as current configuration continues to work and other provider configurations can be added without losing reasoning or cost metadata.
- Update dependency and deployment configuration as needed for pydantic-ai, and adjust or add tests to cover the migrated behavior.

Acceptance criteria:
- The scoped service calls and research scripts use the new structured-call path and no longer depend on the custom forced-function request mode.
- Existing production model defaults and prompt contents remain unchanged, and callers receive the same structured fields they currently expect.
- Reasoning effort settings reach compatible providers without forcing function-call output; tests cover this behavior.
- Project-attributed successful service calls continue to produce `llm_cost_log` records with the correct model, purpose, usage, latency, and provider-reported cost when available.
- Tests cover valid structured results, malformed or failed provider responses, and preservation of each caller’s existing error/fallback behavior.
- Jev remains unchanged and outside this migration.

Open questions:
- Which other provider or providers should be confirmed as supported initially? The current configuration exposes `LLM_BASE_URL` and `LLM_API_KEY` for an OpenAI-compatible endpoint; the desired configuration for providers that do not use that interface is not specified.
- The replay scripts currently state that their LLM costs are not logged. Should that remain true, or should the migration add cost logging for those research runs as well?
Claude
- How should model calls get structured output, now that the forced-tool-call trick in our own client disabled luna's reasoning and is rejected by Opus 5.5? → raised: True, leaned: chosen. The draft explicitly asks how to replace forced function calls with structured output and specifies provider-native structured output; it recommends the same direction as the later choice. Its scope is limited to the listed calls, rather than every model call.
- How should live executor memory be evaluated, given that a person's single choice on a call is noisy (context limits, misreadings, ambiguous questions)? → raised: False, leaned: neither. The draft covers migrating structured LLM calls and cost logging. It does not address how live executor memory should be evaluated or whether it should optimize single-choice prediction versus producing a more complete spec.
Claude
- How should model calls get structured output, now that the forced-tool-call trick in our own client disabled luna's reasoning and is rejected by Opus 5.5? → raised: True, leaned: chosen. The draft's intent and constraints explicitly call for replacing the custom forced-function structured-call path with pydantic-ai and using provider-native structured output rather than a forced function call, which matches the chosen option.
- How should live executor memory be evaluated, given that a person's single choice on a call is noisy (context limits, misreadings, ambiguous questions)? → raised: False, leaned: neither. The draft is about migrating structured-call plumbing to pydantic-ai and preserving cost/reasoning behavior; it never addresses how live executor memory should be evaluated or whether to reward predicting single choices versus enriching a spec. That question is outside the draft's scope.
Every decision is recorded with what was ruled out and why. That record is the evidence.