Skip to content

Synthesis LLM path (opt-in) + llm facade + mcp realize backend - #17

Merged
thorwhalen merged 1 commit into
mainfrom
feat/synthesis-mcp
Jun 4, 2026
Merged

Synthesis LLM path (opt-in) + llm facade + mcp realize backend#17
thorwhalen merged 1 commit into
mainfrom
feat/synthesis-mcp

Conversation

@thorwhalen

Copy link
Copy Markdown
Owner

PR D of the roadmap (#13). The two hard "extras" get an optional LLM, and the third realization backend lands.

What's here

  • llm.py — provider-agnostic facade (DECISIONS D10). resolve_llm() accepts a callable(str)->str, an aw StepConfig (reuses its resolve_llm), a model-name string, or None→ambient skill.ai.chat; returns None (never raises) when nothing is available. structured(prompt, schema) does instruct-JSON + parse + one retry. No hard provider dependency.
  • synthesis.pysynthesize_persona gains an optional llm that drafts the identity paragraph; the operating invariants and the return contract stay deterministic, so the machine-facing contract is never at the mercy of generation. Drafting fires only when an llm is explicitly injected — the mechanical path stays offline even when an ambient ANTHROPIC_API_KEY is present (this was caught and fixed: an earlier version auto-discovered the ambient provider and made a real network call on the no-LLM path).
  • complete() — optional llm= threaded through (non-breaking); an LLM failure falls back to the template.
  • realize.pymcp backend reads the source skill's coact: mcp: block (module + functions) and delegates to py2mcp.mk_mcp_from_refs. coact writes no MCP plumbing.

Companion (merged)

Verified

55 tests + 28 doctests + ruff green; the mechanical path is verified offline (fast); the mcp backend builds a real FastMCP server exposing a skill's declared tools.

Closes #9, #10.

- llm.py: provider-agnostic facade. resolve_llm() accepts a callable, an aw
  StepConfig (reuses its resolve_llm), a model name, or None->ambient
  skill.ai.chat; returns None (never raises) when nothing is available.
  structured(prompt, schema) does instruct-JSON + parse + one retry.
- synthesis.py: synthesize_persona gains an optional llm that DRAFTS the identity
  paragraph; invariants + the return contract stay deterministic so the
  machine-facing contract is never at the mercy of generation. Drafting fires
  ONLY when an llm is explicitly injected — the mechanical path stays offline
  even when an ambient API key is present (DECISIONS D10).
- complete(): optional llm= threaded through (non-breaking); LLM failure falls
  back to template.
- realize.py: 'mcp' backend reads the source skill's coact: mcp block and
  delegates to py2mcp.mk_mcp_from_refs (coact writes no MCP plumbing).

Companion py2mcp PR i2mint/py2mcp#2 added mk_mcp_from_refs + import_object.

55 tests + 28 doctests + ruff green; mechanical path verified offline.

Refs #9 #10 #13
@thorwhalen
thorwhalen merged commit 66992ab into main Jun 4, 2026
1 check passed
@thorwhalen
thorwhalen deleted the feat/synthesis-mcp branch June 4, 2026 14:26
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.

Persona & return-contract synthesis, LLM-optional (synthesis.py, llm.py)

1 participant