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 · memory · seed 2
Memory of this project (the product context the code does not carry):
Honor explicit product intent over stale wording and propagate changes through affected artifacts, including installed executor guidance. Preserve material guarantees while preferring simple structural fixes. Keep deployment and live-behavior claims open until observed; mechanism tests are not outcomes. Use deterministic default gates and narrow, same-set model comparisons: test the requested candidate against the incumbent, choose the cheapest measured gain, and stop pursuing losers. Learn from visible executor calls on completed work, with human decisions and corrections weighted more. Continue reversible live experiments after thin, inconclusive replay negatives only under controls and kill rules. Prefer deliberate, product-specific triggers tied to finished

Heuristics you can open with open_heuristic: intent-over-literal-wording, keep-real-world-measurements-open, prefer-simple-rules-and-low-ceremony, protect-contracts-with-explicit-addition, measure-before-judging-and-iterate, deterministic-gates-for-deterministic, automate-routine-judgment-but-protect, live-experiments-need-controls

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 transport for the scoped structured model calls with pydantic-ai provider-native structured output. Preserve the production models and prompts, while making the provider configurable and retaining reasoning settings and production cost tracking. The code suggests this scope: structured calls in `backend/app/services/shaping.py`, `ambiguity.py`, `classification.py`, `correction_review.py`, `learn.py`, `live_memory.py`, and `review.py`, plus `backend/app/measure_memory_replay.py`, `replay_live_dreams.py`, and `replay_live_predictions.py`. Jev remains separate; follow-up outside the agreed scope is not part of this work.

Constraints:
- Keep the migration to the agreed structured-call paths. In mixed paths, leave Jev’s categorical judgments unchanged—for example, changing structured prose generation must not change the separate Jev verdict or classification.
- Keep the existing production model selections and prompt text. The code default in `backend/app/config.py` is `SHAPING_MODEL=openai/gpt-6-luna` with OpenRouter as the default endpoint; deployed values are not visible in this repository.
- Use provider-native structured output rather than forcing a named function. Do not silently discard reasoning settings; preserve the existing live-memory reasoning configuration and support provider-specific reasoning settings where configured.
- Preserve caller-visible results, validation, error behavior, and fallback behavior. A failed or invalid response must not be treated as a successful partial result.
- Keep production call tracking in `llm_cost_log`: retain `provider`, `model`, `purpose`, token counts, `latency_ms`, and `cost_usd` when reported. Do not invent missing usage or cost values. Keep live-memory’s cost-based budget meaningful.
- Preserve the research scripts’ existing read-only behavior unless the owner explicitly decides otherwise. Do not migrate embeddings or unrelated calls as part of a broad cleanup.
- Update provider configuration and setup documentation affected by the change, including `backend/.env.example` and `DEPLOYMENT.md`. Avoid changing executor guidance unless the way executors work is affected.

Discretion:
- Choose the smallest pydantic-ai adapter and output-validation approach that preserves the existing `StructuredLLM` call contract for services and tests.
- Choose the dependency version, provider-selection configuration shape, and client lifecycle approach, provided the current model configuration and supported reasoning settings remain usable.
- Update tests to check pydantic-ai’s native structured-output mechanism rather than preserving assertions about the old forced-function request. Keep tests for the material behavior and failure guarantees.
- Reuse the existing custom client only where a call is confirmed to remain outside scope; do not remove it merely to make a repository-wide search come back empty.
- Use focused same-model, same-prompt, same-input checks to compare the migration with the incumbent. Treat those as mechanism evidence, not proof of deployed behavior.

Acceptance criteria:
- Each agreed in-scope service call and research-script call uses pydantic-ai structured output; tests show these calls do not rely on the old forced named-function mode.
- Regression tests show prompts and model selections are retained, output still satisfies each caller’s expected shape, and service-specific failure and fallback behavior remains intact.
- Tests cover preservation of reasoning configuration, including the existing live-memory setting, and demonstrate that an owner-selected alternative provider can be configured without hard-coding OpenRouter.
- Tests show successful production calls still record the provider, model, purpose, usage, latency, and reported cost in `llm_cost_log`; missing provider-reported cost remains unknown rather than fabricated. Live-memory budget tests continue to use the recorded cost correctly.
- The research scripts retain their current command-line model/effort controls and read-only behavior unless the owner approves a change.
- Provider setup documentation explains how to configure the current setup and the agreed alternative-provider path.
- Report local mechanism-test evidence separately from any live-provider result. Do not claim the production model actually reasons with the new output mode until that behavior has been observed on a live call.

Open questions:
- Please confirm the scope inventory above. In particular, should `backend/tests/evals/test_shaping_classification_eval.py`, which still uses `OpenAICompatibleLLM`, be included, or remain an out-of-scope follow-up?
- What model and provider settings are actually used in production and must remain unchanged? The repository shows defaults, not deployed environment values.
- Which alternative provider should be supported and tested first? The intent asks for other-provider configuration but does not name one.
- Should the migration merely preserve existing per-call reasoning settings, or enable reasoning on all migrated calls where the provider supports it? The code currently explicitly configures reasoning for live memory, but not every structured call.
- Does cost tracking apply to the research scripts too? They currently describe themselves as read-only and do not log LLM costs; I would preserve that unless you want them to report costs through another route.
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: other. The draft directly raises the structured-output mechanism and recommends provider-native pydantic-ai output for the agreed scope. But it explicitly limits the migration to specified structured calls and excludes Jev, embeddings, and unrelated calls; the later decision was to move every model call to pydantic-ai.
- 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 preserving their behavior, but it does not raise how live executor memory should be evaluated or whether to reward prediction of individual choices versus contribution to a fuller 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 explicitly requires using provider-native structured output rather than forcing a named function, and its acceptance criteria require in-scope calls to use pydantic-ai structured output with tests showing they no longer rely on the old forced named-function mode. That is the same option the person later chose, though the draft scopes it to agreed structured-call paths rather than literally 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 concerns migrating structured model calls to pydantic-ai provider-native structured output, preserving models, prompts, reasoning, and cost tracking. It does not take up how live executor memory should be evaluated (predicting single choices vs. contributing to a rounded spec), so the question was not raised and no option was leaned toward.
Every decision is recorded with what was ruled out and why. That record is the evidence.