Skip to content

Phase 3: entities → ProblemSpec projection; amicode_formulate/solve v2 emit scriptless solvespecs #340

Description

@aarontrowbridge

Roadmap context: vault plan `plan-20260812-142100-problemspecs-issimo-roadmap` (W2.1); master design `spec-20260717-020639-typed-problem-specs-piccolo-amicode` ("Amicode integration" + the entities↔spec mapping table). This is the reliability payoff of the whole typed-specs initiative: zero LLM-authored Julia for the spec-expressible subset. Depends on harmoniqs/Piccolo.jl#271 (shipped env admitting v1.21).

What exists today

solvespec v4 already routes `problem_spec` → `Piccolo.Specs.solve_spec` via `local_executor.ts` (`PROBLEM_SPEC_RUNNER`), and the gate already skips the import scan for scriptless specs. What's missing is the authoring side: nothing in TS produces a ProblemSpec from interview state.

Tasks

  • Deterministic projection (no LLM in the path): `packages/schema/src/project.ts` (new) mapping `FormulationEntity` + `CompositeSystem` → `ProblemSpec` per the master spec's mapping table (parameterization → pulse.kind + template; min_time → `goal_treatment="both"` + `free_dt` + time objective; ensemble robustness → sampling wrapper; leakage → options; `custom` objectives → "not spec-expressible" fallback with the reason surfaced).
  • `amicode_formulate` v2 (opencode-plugin): on completion, project → `~/.amico/problems//problem.toml`, ajv-validated before write; entity TOMLs still written (UI unchanged).
  • `amicode_solve` v2: reads `problem.toml`, applies overrides (`max_iter`/`T`/`N`), emits solvespec with `problem_spec` (path or inline); still never launches (the never-launches invariant holds; the AGENTS.md bash workflow owns launch for both tiers).
  • Rename the workspace card `problem.toml` → `card.toml` (or teach `kindForFilename` a `[problem]`-table sniff): today the opencode plugin writes a card at that path while both validators map the basename to the `problemspec` kind — `amico-validate` on a workspace card misfires.
  • Script-tier fallback: any facet combination the spec can't express reports the reason in the tool result and falls back to composed/free authoring (today's path, untouched).

Acceptance

  • Master-spec success criterion 1: a CZ-on-transmons solve runs end-to-end from `amicode_formulate` + `amicode_solve` with zero LLM-authored Julia; final infidelity matches the script path within 1e-6.
  • Criterion 2: an intentionally malformed spec is corrected by the agent in ≤1 retry using only the structured error payload.
  • vitest goldens on the projection; ajv dual-validation extended to the emitted `problem.toml`.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions